// JS module 'local_cveteval/assessment-formatter' cannot be loaded, or does not contain a javascript module in AMD format. "define()" not found. /* * JavaScript to provide automatic scrolling, e.g. during a drag operation. * * Note: this module is defined statically. It is a singleton. You * can only have one use of it active at any time. However, since this * is usually used in relation to drag-drop, and since you only ever * drag one thing at a time, this is not a problem in practice. * * @module core/autoscroll * @copyright 2016 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 3.6 */ define("core/autoscroll",["jquery"],(function($){var autoscroll={SCROLL_THRESHOLD:30,SCROLL_FREQUENCY:1e3/60,SCROLL_SPEED:.5,scrollingId:null,scrollAmount:0,callback:null,start:function(callback){$(window).on("mousemove",autoscroll.mouseMove),$(window).on("touchmove",autoscroll.touchMove),autoscroll.callback=callback},stop:function(){$(window).off("mousemove",autoscroll.mouseMove),$(window).off("touchmove",autoscroll.touchMove),null!==autoscroll.scrollingId&&autoscroll.stopScrolling()},touchMove:function(e){for(var i=0;i$(window).height()-autoscroll.SCROLL_THRESHOLD?autoscroll.scrollAmount=Math.min(clientY-($(window).height()-autoscroll.SCROLL_THRESHOLD),autoscroll.SCROLL_THRESHOLD):autoscroll.scrollAmount=0,autoscroll.scrollAmount&&null===autoscroll.scrollingId?autoscroll.startScrolling():autoscroll.scrollAmount||null===autoscroll.scrollingId||autoscroll.stopScrolling()},startScrolling:function(){var maxScroll=$(document).height()-$(window).height();autoscroll.scrollingId=window.setInterval((function(){var y=$(window).scrollTop(),offset=Math.round(autoscroll.scrollAmount*autoscroll.SCROLL_SPEED);if(y+offset<0&&(offset=-y),y+offset>maxScroll&&(offset=maxScroll-y),0!==offset){$(window).scrollTop(y+offset);var realOffset=$(window).scrollTop()-y;0!==realOffset&&autoscroll.callback&&autoscroll.callback(realOffset)}}),autoscroll.SCROLL_FREQUENCY)},stopScrolling:function(){window.clearInterval(autoscroll.scrollingId),autoscroll.scrollingId=null}};return{start:autoscroll.start,stop:autoscroll.stop}})); /** * Show/hide admin settings based on other settings selected * * @copyright 2018 Davo Smith, Synergy Learning * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/showhidesettings",["jquery"],(function($){var dependencies;function isCheckboxHiddenElement($el){return $el.is("input[type=hidden]")&&$el.siblings('input[type=checkbox][name="'+$el.attr("name")+'"]').length}function isCheckedRelevant($el,value){return!isCheckboxHiddenElement($el)&&!function($el,value){return $el.is("input[type=radio]")&&$el.attr("value")!==value}($el,value)}function isUncheckedRadioButton($el){return $el.is("input[type=radio]")&&!$el.prop("checked")}function isUncheckedCheckbox($el){return $el.is("input[type=checkbox]")&&!$el.prop("checked")}function isMultiSelect($el){return $el.is("select")&&$el.prop("multiple")}function multiSelectMatches($el,values){var selected=$el.val()||[];if(!values.length)return!1;if(selected.length!==values.length)return!1;for(var i in selected)if(selected.hasOwnProperty(i)&&-1===values.indexOf(selected[i]))return!1;return!0}var depFns={notchecked:function($dependon,value){var hide=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);isCheckedRelevant($el,value)&&(hide=hide||!$el.prop("checked"))})),hide},checked:function($dependon,value){var hide=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);isCheckedRelevant($el,value)&&(hide=hide||$el.prop("checked"))})),hide},noitemselected:function($dependon){var hide=!1;return $dependon.each((function(idx,el){var $el=$(el);hide=hide||-1===$el.prop("selectedIndex")})),hide},eq:function($dependon,value){var hide=!1,hiddenVal=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);if(!isUncheckedRadioButton($el))if(isCheckboxHiddenElement($el))hiddenVal=$el.val()===value;else if(isUncheckedCheckbox($el))hide=hide||hiddenVal;else if(isMultiSelect($el)){var values=value.split("|");hide=multiSelectMatches($el,values)}else hide=hide||$el.val()===value})),hide},in:function($dependon,value){var hide=!1,hiddenVal=!1,values=value.split("|");return $dependon.each((function(idx,el){var $el=$(el);isUncheckedRadioButton($el)||(isCheckboxHiddenElement($el)?hiddenVal=values.indexOf($el.val())>-1:hide=isUncheckedCheckbox($el)?hide||hiddenVal:isMultiSelect($el)?multiSelectMatches($el,values):hide||values.indexOf($el.val())>-1)})),hide},defaultCondition:function($dependon,value){var hide=!1,hiddenVal=!1;return value=String(value),$dependon.each((function(idx,el){var $el=$(el);if(!isUncheckedRadioButton($el))if(isCheckboxHiddenElement($el))hiddenVal=$el.val()!==value;else if(isUncheckedCheckbox($el))hide=hide||hiddenVal;else if(isMultiSelect($el)){var values=value.split("|");hide=!multiSelectMatches($el,values)}else hide=hide||$el.val()!==value})),hide}};function getElementsByName(name){return $('[name="'+name+'"],[name^="'+name+'["]')}function updateDependencies(){var toHide={};$.each(dependencies,(function(dependonname){var dependon=getElementsByName(dependonname);$.each(dependencies[dependonname],(function(condition,values){$.each(values,(function(value,elements){var hide=function($dependon,condition,value){return"function"==typeof depFns[condition]?depFns[condition]($dependon,value):depFns.defaultCondition($dependon,value)}(dependon,condition,value);$.each(elements,(function(idx,elToHide){toHide.hasOwnProperty(elToHide)?toHide[elToHide]=toHide[elToHide]||hide:toHide[elToHide]=hide}))}))}))})),$.each(toHide,(function(elToHide,hide){getElementsByName(elToHide).each((function(idx,el){var $parent=$(el).closest(".form-item");$parent.length&&(hide?$parent.hide():$parent.show())}))}))}return{init:function(opts){dependencies=opts.dependencies,$.each(dependencies,(function(depname){var $el=getElementsByName(depname);$el.length&&$el.on("change",updateDependencies)})),updateDependencies(),$(".form-dependenton").hide()}}})); /** * Javascript for showing/hiding pages of content. * * @module core/paged_content_pages * @copyright 2018 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/paged_content_pages",["jquery","core/templates","core/notification","core/pubsub","core/paged_content_events","core/pending"],(function($,Templates,Notification,PubSub,PagedContentEvents,Pending){var SELECTORS_PAGE_REGION='[data-region="paged-content-page"]',TEMPLATES_PAGING_CONTENT_ITEM="core/paged_content_page",TEMPLATES_LOADING="core/overlay_loading",findPage=function(root,pageNumber){return root.find('[data-page="'+pageNumber+'"]')},showPages=function(root,pagesData,id,renderPagesContentCallback){var pendingPromise=new Pending("core/paged_content_pages:showPages"),existingPages=[],newPageData=[],newPagesPromise=$.Deferred();if(pagesData.forEach((function(pageData){var pageNumber=pageData.pageNumber,existingPage=findPage(root,pageNumber);existingPage.length?existingPages.push(existingPage):newPageData.push(pageData)})),newPageData.length&&"function"==typeof renderPagesContentCallback){var renderPagePromises=renderPagesContentCallback(newPageData,{allItemsLoaded:function(lastPageNumber){PubSub.publish(id+PagedContentEvents.ALL_ITEMS_LOADED,lastPageNumber)}}).map((function(promise,index){return function(root,pagePromise,pageNumber){var deferred=$.Deferred();return pagePromise.then((function(html,pageJS){pageJS=pageJS||"",Templates.render(TEMPLATES_PAGING_CONTENT_ITEM,{page:pageNumber,content:html}).then((function(html){Templates.appendNodeContents(root,html,pageJS);var page=findPage(root,pageNumber);deferred.resolve(page)})).fail((function(exception){deferred.reject(exception)})).fail(Notification.exception)})).fail((function(exception){deferred.reject(exception)})).fail(Notification.exception),deferred.promise()}(root,promise,newPageData[index].pageNumber)}));$.when.apply($,renderPagePromises).then((function(){var newPages=Array.prototype.slice.call(arguments);newPagesPromise.resolve(newPages)})).fail((function(exception){newPagesPromise.reject(exception)})).fail(Notification.exception)}else newPagesPromise.resolve([]);var loadingPromise=function(root){var deferred=$.Deferred();root.attr("aria-busy",!0);var pendingPromise=new Pending("core/paged_content_pages:startLoading");return Templates.render(TEMPLATES_LOADING,{visible:!0}).then((function(html){var loadingSpinner=$(html),timerId=setTimeout((function(){root.css("position","relative"),loadingSpinner.appendTo(root)}),300);deferred.always((function(){clearTimeout(timerId),loadingSpinner.remove(),root.css("position",""),root.removeAttr("aria-busy"),pendingPromise.resolve()}))})).fail(Notification.exception),deferred}(root);newPagesPromise.then((function(newPages){var pagesToShow=existingPages.concat(newPages);root.find(SELECTORS_PAGE_REGION).addClass("hidden"),pagesToShow.forEach((function(page){page.removeClass("hidden")}))})).then((function(){PubSub.publish(id+PagedContentEvents.PAGES_SHOWN,pagesData)})).fail(Notification.exception).always((function(){loadingPromise.resolve(),pendingPromise.resolve()})).catch()};return{init:function(root,id,renderPagesContentCallback){root=$(root),PubSub.subscribe(id+PagedContentEvents.SHOW_PAGES,(function(pagesData){showPages(root,pagesData,id,renderPagesContentCallback)})),PubSub.subscribe(id+PagedContentEvents.SET_ITEMS_PER_PAGE_LIMIT,(function(){root.empty()}))},rootSelector:'[data-region="page-container"]'}})); /** * Chart line. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_line */ define("core/chart_line",["core/chart_base"],(function(Base){function Line(){Base.prototype.constructor.apply(this,arguments)}return Line.prototype=Object.create(Base.prototype),Line.prototype.TYPE="line",Line.prototype._smooth=!1,Line.prototype.create=function(Klass,data){var chart=Base.prototype.create.apply(this,arguments);return chart.setSmooth(data.smooth),chart},Line.prototype.getSmooth=function(){return this._smooth},Line.prototype.setSmooth=function(smooth){this._smooth=Boolean(smooth)},Line})); /** * Chart axis. * * @module core/chart_axis * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/chart_axis",[],(function(){function Axis(){}return Axis.prototype.POS_DEFAULT=null,Axis.prototype.POS_BOTTOM="bottom",Axis.prototype.POS_LEFT="left",Axis.prototype.POS_RIGHT="right",Axis.prototype.POS_TOP="top",Axis.prototype._label=null,Axis.prototype._labels=null,Axis.prototype._max=null,Axis.prototype._min=null,Axis.prototype._position=null,Axis.prototype._stepSize=null,Axis.prototype.create=function(obj){var s=new Axis;return s.setPosition(obj.position),s.setLabel(obj.label),s.setStepSize(obj.stepSize),s.setMax(obj.max),s.setMin(obj.min),s.setLabels(obj.labels),s},Axis.prototype.getLabel=function(){return this._label},Axis.prototype.getLabels=function(){return this._labels},Axis.prototype.getMax=function(){return this._max},Axis.prototype.getMin=function(){return this._min},Axis.prototype.getPosition=function(){return this._position},Axis.prototype.getStepSize=function(){return this._stepSize},Axis.prototype.setLabel=function(label){this._label=label||null},Axis.prototype.setLabels=function(labels){this._labels=labels||null,null===this._labels||null!==this._stepSize||null!==this._min&&0!==this._min||null!==this._max||(this.setStepSize(1),this.setMin(0),this.setMax(labels.length-1))},Axis.prototype.setMax=function(max){this._max=void 0!==max?max:null},Axis.prototype.setMin=function(min){this._min=void 0!==min?min:null},Axis.prototype.setPosition=function(position){if(position!=this.POS_DEFAULT&&position!=this.POS_BOTTOM&&position!=this.POS_LEFT&&position!=this.POS_RIGHT&&position!=this.POS_TOP)throw new Error("Invalid axis position.");this._position=position},Axis.prototype.setStepSize=function(stepSize){if(null==stepSize)stepSize=null;else{if(isNaN(Number(stepSize)))throw new Error("Value for stepSize is not a number.");stepSize=Number(stepSize)}this._stepSize=stepSize},Axis})); define("core/event_dispatcher",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.dispatchEvent=void 0;_exports.dispatchEvent=function(eventName){let detail=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},container=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,{bubbles:bubbles=!0,cancelable:cancelable=!1,composed:composed=!1}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const customEvent=new CustomEvent(eventName,{bubbles:bubbles,cancelable:cancelable,composed:composed,detail:detail});return container.dispatchEvent(customEvent),customEvent}})); /** * Autocomplete wrapper for select2 library. * * @module core/form-autocomplete * @copyright 2015 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 3.0 */ define("core/form-autocomplete",["jquery","core/log","core/str","core/templates","core/notification","core/loadingicon","core/aria","core_form/changechecker"],(function($,log,str,templates,notification,LoadingIcon,Aria,FormChangeChecker){var KEYS_DOWN=40,KEYS_ENTER=13,KEYS_SPACE=32,KEYS_ESCAPE=27,KEYS_COMMA=44,KEYS_UP=38,KEYS_LEFT=37,KEYS_RIGHT=39,uniqueId=Date.now(),activateSelection=function(index,state){var selectionElement=$(document.getElementById(state.selectionId)),length=selectionElement.children("[aria-selected=true]").length;for(index%=length;index<0;)index+=length;var element=$(selectionElement.children("[aria-selected=true]").get(index)),itemId=state.selectionId+"-"+index;return selectionElement.children().attr("data-active-selection",null).attr("id",""),element.attr("data-active-selection",!0).attr("id",itemId),selectionElement.attr("aria-activedescendant",itemId),selectionElement.attr("data-active-value",element.attr("data-value")),$.Deferred().resolve()},updateActiveSelectionFromState=function(state){var activeElement=function(state){var _selectionRegion$attr,selectionRegion=$(document.getElementById(state.selectionId)),activeId=selectionRegion.attr("aria-activedescendant");if(activeId){var activeElement=$(document.getElementById(activeId));if(activeElement.length)return activeElement}var activeValue=null===(_selectionRegion$attr=selectionRegion.attr("data-active-value"))||void 0===_selectionRegion$attr?void 0:_selectionRegion$attr.replace(/"/g,'\\"');return selectionRegion.find('[data-value="'+activeValue+'"]')}(state),activeValue=activeElement.attr("data-value"),selectionRegion=$(document.getElementById(state.selectionId));if(activeValue){var activeIndex=selectionRegion.find("[aria-selected=true]").index(activeElement);if(-1!==activeIndex)return void activateSelection(activeIndex,state)}activateSelection(0,state)},updateSelectionList=function(options,state,originalSelect){var pendingKey="form-autocomplete-updateSelectionList-"+state.inputId;M.util.js_pending(pendingKey);var items=[],newSelection=$(document.getElementById(state.selectionId));if(originalSelect.children("option").each((function(index,ele){var label;$(ele).prop("selected")&&(""!==(label=$(ele).data("html")?$(ele).data("html"):$(ele).html())&&items.push({label:label,value:$(ele).attr("value")}))})),!hasItemListChanged(state,items))return M.util.js_complete(pendingKey),Promise.resolve();state.items=items;var context=$.extend(options,state);return templates.render(options.templates.items,context).then((function(html,js){templates.replaceNodeContents(newSelection,html,js),updateActiveSelectionFromState(state)})).then((function(){return M.util.js_complete(pendingKey)})).catch(notification.exception)},hasItemListChanged=function(state,items){return state.items.length!==items.length||state.items.filter((item=>-1===items.indexOf(item))).length>0},notifyChange=function(originalSelect){FormChangeChecker.markFormChangedFromNode(originalSelect[0]),originalSelect[0].dispatchEvent(new Event("change"))},deselectItem=function(options,state,item,originalSelect){var selectedItemValue=$(item).attr("data-value");return originalSelect.prepend($("