// JS module 'theme_mb2nl/mb2mycourses' cannot be loaded, or does not contain a javascript module in AMD format. "define()" not found. define("core/adapter",[],(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,(function(e){var n=t[o][1][e];return s(n||e)}),l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o0&&void 0!==arguments[0]?arguments[0]:{},window=_ref.window,options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},logging=utils.log,browserDetails=utils.detectBrowser(window),adapter={browserDetails:browserDetails,commonShim:commonShim,extractVersion:utils.extractVersion,disableLog:utils.disableLog,disableWarnings:utils.disableWarnings,sdp:sdp};switch(browserDetails.browser){case"chrome":if(!chromeShim||!chromeShim.shimPeerConnection||!options.shimChrome)return logging("Chrome shim is not included in this adapter release."),adapter;if(null===browserDetails.version)return logging("Chrome shim can not determine version, not shimming."),adapter;logging("adapter.js shimming chrome."),adapter.browserShim=chromeShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),chromeShim.shimGetUserMedia(window,browserDetails),chromeShim.shimMediaStream(window,browserDetails),chromeShim.shimPeerConnection(window,browserDetails),chromeShim.shimOnTrack(window,browserDetails),chromeShim.shimAddTrackRemoveTrack(window,browserDetails),chromeShim.shimGetSendersWithDtmf(window,browserDetails),chromeShim.shimGetStats(window,browserDetails),chromeShim.shimSenderReceiverGetStats(window,browserDetails),chromeShim.fixNegotiationNeeded(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;case"firefox":if(!firefoxShim||!firefoxShim.shimPeerConnection||!options.shimFirefox)return logging("Firefox shim is not included in this adapter release."),adapter;logging("adapter.js shimming firefox."),adapter.browserShim=firefoxShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),firefoxShim.shimGetUserMedia(window,browserDetails),firefoxShim.shimPeerConnection(window,browserDetails),firefoxShim.shimOnTrack(window,browserDetails),firefoxShim.shimRemoveStream(window,browserDetails),firefoxShim.shimSenderGetStats(window,browserDetails),firefoxShim.shimReceiverGetStats(window,browserDetails),firefoxShim.shimRTCDataChannel(window,browserDetails),firefoxShim.shimAddTransceiver(window,browserDetails),firefoxShim.shimGetParameters(window,browserDetails),firefoxShim.shimCreateOffer(window,browserDetails),firefoxShim.shimCreateAnswer(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimConnectionState(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails);break;case"safari":if(!safariShim||!options.shimSafari)return logging("Safari shim is not included in this adapter release."),adapter;logging("adapter.js shimming safari."),adapter.browserShim=safariShim,commonShim.shimAddIceCandidateNullOrEmpty(window,browserDetails),safariShim.shimRTCIceServerUrls(window,browserDetails),safariShim.shimCreateOfferLegacy(window,browserDetails),safariShim.shimCallbacksAPI(window,browserDetails),safariShim.shimLocalStreamsAPI(window,browserDetails),safariShim.shimRemoteStreamsAPI(window,browserDetails),safariShim.shimTrackEventTransceiver(window,browserDetails),safariShim.shimGetUserMedia(window,browserDetails),safariShim.shimAudioContext(window,browserDetails),commonShim.shimRTCIceCandidate(window,browserDetails),commonShim.shimMaxMessageSize(window,browserDetails),commonShim.shimSendThrowTypeError(window,browserDetails),commonShim.removeExtmapAllowMixed(window,browserDetails);break;default:logging("Unsupported browser!")}return adapter};var utils=_interopRequireWildcard(require("./utils")),chromeShim=_interopRequireWildcard(require("./chrome/chrome_shim")),firefoxShim=_interopRequireWildcard(require("./firefox/firefox_shim")),safariShim=_interopRequireWildcard(require("./safari/safari_shim")),commonShim=_interopRequireWildcard(require("./common_shim")),sdp=_interopRequireWildcard(require("sdp"));function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}},{"./chrome/chrome_shim":3,"./common_shim":6,"./firefox/firefox_shim":7,"./safari/safari_shim":10,"./utils":11,sdp:12}],3:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimMediaStream=function(window){window.MediaStream=window.MediaStream||window.webkitMediaStream},exports.shimOnTrack=function(window){if("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("ontrack"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(f){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=f)},enumerable:!0,configurable:!0});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var _this=this;return this._ontrackpoly||(this._ontrackpoly=function(e){e.stream.addEventListener("addtrack",(function(te){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===te.track.id})):{track:te.track};var event=new Event("track");event.track=te.track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)})),e.stream.getTracks().forEach((function(track){var receiver=void 0;receiver=window.RTCPeerConnection.prototype.getReceivers?_this.getReceivers().find((function(r){return r.track&&r.track.id===track.id})):{track:track};var event=new Event("track");event.track=track,event.receiver=receiver,event.transceiver={receiver:receiver},event.streams=[e.stream],_this.dispatchEvent(event)}))},this.addEventListener("addstream",this._ontrackpoly)),origSetRemoteDescription.apply(this,arguments)}}else utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))},exports.shimGetSendersWithDtmf=function(window){if("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&!("getSenders"in window.RTCPeerConnection.prototype)&&"createDTMFSender"in window.RTCPeerConnection.prototype){var shimSenderWithDtmf=function(pc,track){return{track:track,get dtmf(){return void 0===this._dtmf&&("audio"===track.kind?this._dtmf=pc.createDTMFSender(track):this._dtmf=null),this._dtmf},_pc:pc}};if(!window.RTCPeerConnection.prototype.getSenders){window.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){var sender=origAddTrack.apply(this,arguments);return sender||(sender=shimSenderWithDtmf(this,track),this._senders.push(sender)),sender};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){origRemoveTrack.apply(this,arguments);var idx=this._senders.indexOf(sender);-1!==idx&&this._senders.splice(idx,1)}}var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this2=this;this._senders=this._senders||[],origAddStream.apply(this,[stream]),stream.getTracks().forEach((function(track){_this2._senders.push(shimSenderWithDtmf(_this2,track))}))};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._senders=this._senders||[],origRemoveStream.apply(this,[stream]),stream.getTracks().forEach((function(track){var sender=_this3._senders.find((function(s){return s.track===track}));sender&&_this3._senders.splice(_this3._senders.indexOf(sender),1)}))}}else if("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&"getSenders"in window.RTCPeerConnection.prototype&&"createDTMFSender"in window.RTCPeerConnection.prototype&&window.RTCRtpSender&&!("dtmf"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;window.RTCPeerConnection.prototype.getSenders=function(){var _this4=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this4})),senders},Object.defineProperty(window.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},exports.shimGetStats=function(window){if(!window.RTCPeerConnection)return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _this5=this,_arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];if(arguments.length>0&&"function"==typeof selector)return origGetStats.apply(this,arguments);if(0===origGetStats.length&&(0===arguments.length||"function"!=typeof selector))return origGetStats.apply(this,[]);var fixChromeStats_=function(response){var standardReport={};return response.result().forEach((function(report){var standardStats={id:report.id,timestamp:report.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[report.type]||report.type};report.names().forEach((function(name){standardStats[name]=report.stat(name)})),standardReport[standardStats.id]=standardStats})),standardReport},makeMapStats=function(stats){return new Map(Object.keys(stats).map((function(key){return[key,stats[key]]})))};if(arguments.length>=2){var successCallbackWrapper_=function(response){onSucc(makeMapStats(fixChromeStats_(response)))};return origGetStats.apply(this,[successCallbackWrapper_,selector])}return new Promise((function(resolve,reject){origGetStats.apply(_this5,[function(response){resolve(makeMapStats(fixChromeStats_(response)))},reject])})).then(onSucc,onErr)}},exports.shimSenderReceiverGetStats=function(window){if(!("object"===(void 0===window?"undefined":_typeof(window))&&window.RTCPeerConnection&&window.RTCRtpSender&&window.RTCRtpReceiver))return;if(!("getStats"in window.RTCRtpSender.prototype)){var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this6=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this6})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender}),window.RTCRtpSender.prototype.getStats=function(){var sender=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,sender.track,!0)}))}}if(!("getStats"in window.RTCRtpReceiver.prototype)){var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this7=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this7})),receivers}),utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){var receiver=this;return this._pc.getStats().then((function(result){return utils.filterStats(result,receiver.track,!1)}))}}if(!("getStats"in window.RTCRtpSender.prototype)||!("getStats"in window.RTCRtpReceiver.prototype))return;var origGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof window.MediaStreamTrack){var track=arguments[0],sender=void 0,receiver=void 0,err=void 0;return this.getSenders().forEach((function(s){s.track===track&&(sender?err=!0:sender=s)})),this.getReceivers().forEach((function(r){return r.track===track&&(receiver?err=!0:receiver=r),r.track===track})),err||sender&&receiver?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):sender?sender.getStats():receiver?receiver.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return origGetStats.apply(this,arguments)}},exports.shimAddTrackRemoveTrackWithNative=shimAddTrackRemoveTrackWithNative,exports.shimAddTrackRemoveTrack=function(window,browserDetails){if(!window.RTCPeerConnection)return;if(window.RTCPeerConnection.prototype.addTrack&&browserDetails.version>=65)return shimAddTrackRemoveTrackWithNative(window);var origGetLocalStreams=window.RTCPeerConnection.prototype.getLocalStreams;window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this11=this,nativeStreams=origGetLocalStreams.apply(this);return this._reverseStreams=this._reverseStreams||{},nativeStreams.map((function(stream){return _this11._reverseStreams[stream.id]}))};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this12=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},stream.getTracks().forEach((function(track){if(_this12.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[stream.id]){var newStream=new window.MediaStream(stream.getTracks());this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,stream=newStream}origAddStream.apply(this,[stream])};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;function replaceInternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(internalStream.id,"g"),externalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}function replaceExternalStreamId(pc,description){var sdp=description.sdp;return Object.keys(pc._reverseStreams||[]).forEach((function(internalId){var externalStream=pc._reverseStreams[internalId],internalStream=pc._streams[externalStream.id];sdp=sdp.replace(new RegExp(externalStream.id,"g"),internalStream.id)})),new RTCSessionDescription({type:description.type,sdp:sdp})}window.RTCPeerConnection.prototype.removeStream=function(stream){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},origRemoveStream.apply(this,[this._streams[stream.id]||stream]),delete this._reverseStreams[this._streams[stream.id]?this._streams[stream.id].id:stream.id],delete this._streams[stream.id]},window.RTCPeerConnection.prototype.addTrack=function(track,stream){var _this13=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var streams=[].slice.call(arguments,1);if(1!==streams.length||!streams[0].getTracks().find((function(t){return t===track})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var alreadyExists=this.getSenders().find((function(s){return s.track===track}));if(alreadyExists)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var oldStream=this._streams[stream.id];if(oldStream)oldStream.addTrack(track),Promise.resolve().then((function(){_this13.dispatchEvent(new Event("negotiationneeded"))}));else{var newStream=new window.MediaStream([track]);this._streams[stream.id]=newStream,this._reverseStreams[newStream.id]=stream,this.addStream(newStream)}return this.getSenders().find((function(s){return s.track===track}))},["createOffer","createAnswer"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){var _this14=this,args=arguments,isLegacyCall=arguments.length&&"function"==typeof arguments[0];return isLegacyCall?nativeMethod.apply(this,[function(description){var desc=replaceInternalStreamId(_this14,description);args[0].apply(null,[desc])},function(err){args[1]&&args[1].apply(null,err)},arguments[2]]):nativeMethod.apply(this,arguments).then((function(description){return replaceInternalStreamId(_this14,description)}))}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var origSetLocalDescription=window.RTCPeerConnection.prototype.setLocalDescription;window.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=replaceExternalStreamId(this,arguments[0]),origSetLocalDescription.apply(this,arguments)):origSetLocalDescription.apply(this,arguments)};var origLocalDescription=Object.getOwnPropertyDescriptor(window.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(window.RTCPeerConnection.prototype,"localDescription",{get:function(){var description=origLocalDescription.get.apply(this);return""===description.type?description:replaceInternalStreamId(this,description)}}),window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this15=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!sender._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(sender._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var stream=void 0;Object.keys(this._streams).forEach((function(streamid){_this15._streams[streamid].getTracks().find((function(track){return sender.track===track}))&&(stream=_this15._streams[streamid])})),stream&&(1===stream.getTracks().length?this.removeStream(this._reverseStreams[stream.id]):stream.removeTrack(sender.track),this.dispatchEvent(new Event("negotiationneeded")))}},exports.shimPeerConnection=function(window,browserDetails){!window.RTCPeerConnection&&window.webkitRTCPeerConnection&&(window.RTCPeerConnection=window.webkitRTCPeerConnection);if(!window.RTCPeerConnection)return;browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=_defineProperty({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}))},exports.fixNegotiationNeeded=function(window,browserDetails){utils.wrapPeerConnectionEvent(window,"negotiationneeded",(function(e){var pc=e.target;if(!(browserDetails.version<72||pc.getConfiguration&&"plan-b"===pc.getConfiguration().sdpSemantics)||"stable"===pc.signalingState)return e}))};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js"));function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function shimAddTrackRemoveTrackWithNative(window){window.RTCPeerConnection.prototype.getLocalStreams=function(){var _this8=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(streamId){return _this8._shimmedLocalStreams[streamId][0]}))};var origAddTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addTrack=function(track,stream){if(!stream)return origAddTrack.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var sender=origAddTrack.apply(this,arguments);return this._shimmedLocalStreams[stream.id]?-1===this._shimmedLocalStreams[stream.id].indexOf(sender)&&this._shimmedLocalStreams[stream.id].push(sender):this._shimmedLocalStreams[stream.id]=[stream,sender],sender};var origAddStream=window.RTCPeerConnection.prototype.addStream;window.RTCPeerConnection.prototype.addStream=function(stream){var _this9=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},stream.getTracks().forEach((function(track){if(_this9.getSenders().find((function(s){return s.track===track})))throw new DOMException("Track already exists.","InvalidAccessError")}));var existingSenders=this.getSenders();origAddStream.apply(this,arguments);var newSenders=this.getSenders().filter((function(newSender){return-1===existingSenders.indexOf(newSender)}));this._shimmedLocalStreams[stream.id]=[stream].concat(newSenders)};var origRemoveStream=window.RTCPeerConnection.prototype.removeStream;window.RTCPeerConnection.prototype.removeStream=function(stream){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[stream.id],origRemoveStream.apply(this,arguments)};var origRemoveTrack=window.RTCPeerConnection.prototype.removeTrack;window.RTCPeerConnection.prototype.removeTrack=function(sender){var _this10=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},sender&&Object.keys(this._shimmedLocalStreams).forEach((function(streamId){var idx=_this10._shimmedLocalStreams[streamId].indexOf(sender);-1!==idx&&_this10._shimmedLocalStreams[streamId].splice(idx,1),1===_this10._shimmedLocalStreams[streamId].length&&delete _this10._shimmedLocalStreams[streamId]})),origRemoveTrack.apply(this,arguments)}}},{"../utils.js":11,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,getSourceId){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;if("function"!=typeof getSourceId)return void console.error("shimGetDisplayMedia: getSourceId argument is not a function");window.navigator.mediaDevices.getDisplayMedia=function(constraints){return getSourceId(constraints).then((function(sourceId){var widthSpecified=constraints.video&&constraints.video.width,heightSpecified=constraints.video&&constraints.video.height,frameRateSpecified=constraints.video&&constraints.video.frameRate;return constraints.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:sourceId,maxFrameRate:frameRateSpecified||3}},widthSpecified&&(constraints.video.mandatory.maxWidth=widthSpecified),heightSpecified&&(constraints.video.mandatory.maxHeight=heightSpecified),window.navigator.mediaDevices.getUserMedia(constraints)}))}}},{}],5:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator;if(!navigator.mediaDevices)return;var constraintsToChrome_=function(c){if("object"!==(void 0===c?"undefined":_typeof(c))||c.mandatory||c.optional)return c;var cc={};return Object.keys(c).forEach((function(key){if("require"!==key&&"advanced"!==key&&"mediaSource"!==key){var r="object"===_typeof(c[key])?c[key]:{ideal:c[key]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);var oldname_=function(prefix,name){return prefix?prefix+name.charAt(0).toUpperCase()+name.slice(1):"deviceId"===name?"sourceId":name};if(void 0!==r.ideal){cc.optional=cc.optional||[];var oc={};"number"==typeof r.ideal?(oc[oldname_("min",key)]=r.ideal,cc.optional.push(oc),(oc={})[oldname_("max",key)]=r.ideal,cc.optional.push(oc)):(oc[oldname_("",key)]=r.ideal,cc.optional.push(oc))}void 0!==r.exact&&"number"!=typeof r.exact?(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_("",key)]=r.exact):["min","max"].forEach((function(mix){void 0!==r[mix]&&(cc.mandatory=cc.mandatory||{},cc.mandatory[oldname_(mix,key)]=r[mix])}))}})),c.advanced&&(cc.optional=(cc.optional||[]).concat(c.advanced)),cc},shimConstraints_=function(constraints,func){if(browserDetails.version>=61)return func(constraints);if((constraints=JSON.parse(JSON.stringify(constraints)))&&"object"===_typeof(constraints.audio)){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])};remap((constraints=JSON.parse(JSON.stringify(constraints))).audio,"autoGainControl","googAutoGainControl"),remap(constraints.audio,"noiseSuppression","googNoiseSuppression"),constraints.audio=constraintsToChrome_(constraints.audio)}if(constraints&&"object"===_typeof(constraints.video)){var face=constraints.video.facingMode;face=face&&("object"===(void 0===face?"undefined":_typeof(face))?face:{ideal:face});var getSupportedFacingModeLies=browserDetails.version<66;if(face&&("user"===face.exact||"environment"===face.exact||"user"===face.ideal||"environment"===face.ideal)&&(!navigator.mediaDevices.getSupportedConstraints||!navigator.mediaDevices.getSupportedConstraints().facingMode||getSupportedFacingModeLies)){delete constraints.video.facingMode;var matches=void 0;if("environment"===face.exact||"environment"===face.ideal?matches=["back","rear"]:"user"!==face.exact&&"user"!==face.ideal||(matches=["front"]),matches)return navigator.mediaDevices.enumerateDevices().then((function(devices){var dev=(devices=devices.filter((function(d){return"videoinput"===d.kind}))).find((function(d){return matches.some((function(match){return d.label.toLowerCase().includes(match)}))}));return!dev&&devices.length&&matches.includes("back")&&(dev=devices[devices.length-1]),dev&&(constraints.video.deviceId=face.exact?{exact:dev.deviceId}:{ideal:dev.deviceId}),constraints.video=constraintsToChrome_(constraints.video),logging("chrome: "+JSON.stringify(constraints)),func(constraints)}))}constraints.video=constraintsToChrome_(constraints.video)}return logging("chrome: "+JSON.stringify(constraints)),func(constraints)},shimError_=function(e){return browserDetails.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(navigator.getUserMedia=function(constraints,onSuccess,onError){shimConstraints_(constraints,(function(c){navigator.webkitGetUserMedia(c,onSuccess,(function(e){onError&&onError(shimError_(e))}))}))}.bind(navigator),navigator.mediaDevices.getUserMedia){var origGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);navigator.mediaDevices.getUserMedia=function(cs){return shimConstraints_(cs,(function(c){return origGetUserMedia(c).then((function(stream){if(c.audio&&!stream.getAudioTracks().length||c.video&&!stream.getVideoTracks().length)throw stream.getTracks().forEach((function(track){track.stop()})),new DOMException("","NotFoundError");return stream}),(function(e){return Promise.reject(shimError_(e))}))}))}}};var logging=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils.js")).log},{"../utils.js":11}],6:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimRTCIceCandidate=function(window){if(!window.RTCIceCandidate||window.RTCIceCandidate&&"foundation"in window.RTCIceCandidate.prototype)return;var NativeRTCIceCandidate=window.RTCIceCandidate;window.RTCIceCandidate=function(args){if("object"===(void 0===args?"undefined":_typeof(args))&&args.candidate&&0===args.candidate.indexOf("a=")&&((args=JSON.parse(JSON.stringify(args))).candidate=args.candidate.substr(2)),args.candidate&&args.candidate.length){var nativeCandidate=new NativeRTCIceCandidate(args),parsedCandidate=_sdp2.default.parseCandidate(args.candidate),augmentedCandidate=Object.assign(nativeCandidate,parsedCandidate);return augmentedCandidate.toJSON=function(){return{candidate:augmentedCandidate.candidate,sdpMid:augmentedCandidate.sdpMid,sdpMLineIndex:augmentedCandidate.sdpMLineIndex,usernameFragment:augmentedCandidate.usernameFragment}},augmentedCandidate}return new NativeRTCIceCandidate(args)},window.RTCIceCandidate.prototype=NativeRTCIceCandidate.prototype,utils.wrapPeerConnectionEvent(window,"icecandidate",(function(e){return e.candidate&&Object.defineProperty(e,"candidate",{value:new window.RTCIceCandidate(e.candidate),writable:"false"}),e}))},exports.shimMaxMessageSize=function(window,browserDetails){if(!window.RTCPeerConnection)return;"sctp"in window.RTCPeerConnection.prototype||Object.defineProperty(window.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var sctpInDescription=function(description){if(!description||!description.sdp)return!1;var sections=_sdp2.default.splitSections(description.sdp);return sections.shift(),sections.some((function(mediaSection){var mLine=_sdp2.default.parseMLine(mediaSection);return mLine&&"application"===mLine.kind&&-1!==mLine.protocol.indexOf("SCTP")}))},getRemoteFirefoxVersion=function(description){var match=description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===match||match.length<2)return-1;var version=parseInt(match[1],10);return version!=version?-1:version},getCanSendMaxMessageSize=function(remoteIsFirefox){var canSendMaxMessageSize=65536;return"firefox"===browserDetails.browser&&(canSendMaxMessageSize=browserDetails.version<57?-1===remoteIsFirefox?16384:2147483637:browserDetails.version<60?57===browserDetails.version?65535:65536:2147483637),canSendMaxMessageSize},getMaxMessageSize=function(description,remoteIsFirefox){var maxMessageSize=65536;"firefox"===browserDetails.browser&&57===browserDetails.version&&(maxMessageSize=65535);var match=_sdp2.default.matchPrefix(description.sdp,"a=max-message-size:");return match.length>0?maxMessageSize=parseInt(match[0].substr(19),10):"firefox"===browserDetails.browser&&-1!==remoteIsFirefox&&(maxMessageSize=2147483637),maxMessageSize},origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===browserDetails.browser&&browserDetails.version>=76){var _getConfiguration=this.getConfiguration(),sdpSemantics=_getConfiguration.sdpSemantics;"plan-b"===sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(sctpInDescription(arguments[0])){var isFirefox=getRemoteFirefoxVersion(arguments[0]),canSendMMS=getCanSendMaxMessageSize(isFirefox),remoteMMS=getMaxMessageSize(arguments[0],isFirefox),maxMessageSize=void 0;maxMessageSize=0===canSendMMS&&0===remoteMMS?Number.POSITIVE_INFINITY:0===canSendMMS||0===remoteMMS?Math.max(canSendMMS,remoteMMS):Math.min(canSendMMS,remoteMMS);var sctp={};Object.defineProperty(sctp,"maxMessageSize",{get:function(){return maxMessageSize}}),this._sctp=sctp}return origSetRemoteDescription.apply(this,arguments)}},exports.shimSendThrowTypeError=function(window){if(!window.RTCPeerConnection||!("createDataChannel"in window.RTCPeerConnection.prototype))return;function wrapDcSend(dc,pc){var origDataChannelSend=dc.send;dc.send=function(){var data=arguments[0],length=data.length||data.size||data.byteLength;if("open"===dc.readyState&&pc.sctp&&length>pc.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+pc.sctp.maxMessageSize+" bytes)");return origDataChannelSend.apply(dc,arguments)}}var origCreateDataChannel=window.RTCPeerConnection.prototype.createDataChannel;window.RTCPeerConnection.prototype.createDataChannel=function(){var dataChannel=origCreateDataChannel.apply(this,arguments);return wrapDcSend(dataChannel,this),dataChannel},utils.wrapPeerConnectionEvent(window,"datachannel",(function(e){return wrapDcSend(e.channel,e.target),e}))},exports.shimConnectionState=function(window){if(!window.RTCPeerConnection||"connectionState"in window.RTCPeerConnection.prototype)return;var proto=window.RTCPeerConnection.prototype;Object.defineProperty(proto,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(proto,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(cb){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),cb&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=cb)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(method){var origMethod=proto[method];proto[method]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var pc=e.target;if(pc._lastConnectionState!==pc.connectionState){pc._lastConnectionState=pc.connectionState;var newEvent=new Event("connectionstatechange",e);pc.dispatchEvent(newEvent)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),origMethod.apply(this,arguments)}}))},exports.removeExtmapAllowMixed=function(window,browserDetails){if(!window.RTCPeerConnection)return;if("chrome"===browserDetails.browser&&browserDetails.version>=71)return;if("safari"===browserDetails.browser&&browserDetails.version>=605)return;var nativeSRD=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(desc){if(desc&&desc.sdp&&-1!==desc.sdp.indexOf("\na=extmap-allow-mixed")){var sdp=desc.sdp.split("\n").filter((function(line){return"a=extmap-allow-mixed"!==line.trim()})).join("\n");window.RTCSessionDescription&&desc instanceof window.RTCSessionDescription?arguments[0]=new window.RTCSessionDescription({type:desc.type,sdp:sdp}):desc.sdp=sdp}return nativeSRD.apply(this,arguments)}},exports.shimAddIceCandidateNullOrEmpty=function(window,browserDetails){if(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype)return;var nativeAddIceCandidate=window.RTCPeerConnection.prototype.addIceCandidate;if(!nativeAddIceCandidate||0===nativeAddIceCandidate.length)return;window.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===browserDetails.browser&&browserDetails.version<78||"firefox"===browserDetails.browser&&browserDetails.version<68||"safari"===browserDetails.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():nativeAddIceCandidate.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}};var obj,_sdp=require("sdp"),_sdp2=(obj=_sdp)&&obj.__esModule?obj:{default:obj},utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("./utils"))},{"./utils":11,sdp:12}],7:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=exports.shimGetUserMedia=void 0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_getusermedia=require("./getusermedia");Object.defineProperty(exports,"shimGetUserMedia",{enumerable:!0,get:function(){return _getusermedia.shimGetUserMedia}});var _getdisplaymedia=require("./getdisplaymedia");Object.defineProperty(exports,"shimGetDisplayMedia",{enumerable:!0,get:function(){return _getdisplaymedia.shimGetDisplayMedia}}),exports.shimOnTrack=function(window){"object"===(void 0===window?"undefined":_typeof(window))&&window.RTCTrackEvent&&"receiver"in window.RTCTrackEvent.prototype&&!("transceiver"in window.RTCTrackEvent.prototype)&&Object.defineProperty(window.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},exports.shimPeerConnection=function(window,browserDetails){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection&&!window.mozRTCPeerConnection)return;!window.RTCPeerConnection&&window.mozRTCPeerConnection&&(window.RTCPeerConnection=window.mozRTCPeerConnection);browserDetails.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(method){var nativeMethod=window.RTCPeerConnection.prototype[method],methodObj=function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value;return obj}({},method,(function(){return arguments[0]=new("addIceCandidate"===method?window.RTCIceCandidate:window.RTCSessionDescription)(arguments[0]),nativeMethod.apply(this,arguments)}));window.RTCPeerConnection.prototype[method]=methodObj[method]}));var modernStatsTypes={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},nativeGetStats=window.RTCPeerConnection.prototype.getStats;window.RTCPeerConnection.prototype.getStats=function(){var _arguments=Array.prototype.slice.call(arguments),selector=_arguments[0],onSucc=_arguments[1],onErr=_arguments[2];return nativeGetStats.apply(this,[selector||null]).then((function(stats){if(browserDetails.version<53&&!onSucc)try{stats.forEach((function(stat){stat.type=modernStatsTypes[stat.type]||stat.type}))}catch(e){if("TypeError"!==e.name)throw e;stats.forEach((function(stat,i){stats.set(i,Object.assign({},stat,{type:modernStatsTypes[stat.type]||stat.type}))}))}return stats})).then(onSucc,onErr)}},exports.shimSenderGetStats=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpSender.prototype)return;var origGetSenders=window.RTCPeerConnection.prototype.getSenders;origGetSenders&&(window.RTCPeerConnection.prototype.getSenders=function(){var _this=this,senders=origGetSenders.apply(this,[]);return senders.forEach((function(sender){return sender._pc=_this})),senders});var origAddTrack=window.RTCPeerConnection.prototype.addTrack;origAddTrack&&(window.RTCPeerConnection.prototype.addTrack=function(){var sender=origAddTrack.apply(this,arguments);return sender._pc=this,sender});window.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},exports.shimReceiverGetStats=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection||!window.RTCRtpSender)return;if(window.RTCRtpSender&&"getStats"in window.RTCRtpReceiver.prototype)return;var origGetReceivers=window.RTCPeerConnection.prototype.getReceivers;origGetReceivers&&(window.RTCPeerConnection.prototype.getReceivers=function(){var _this2=this,receivers=origGetReceivers.apply(this,[]);return receivers.forEach((function(receiver){return receiver._pc=_this2})),receivers});utils.wrapPeerConnectionEvent(window,"track",(function(e){return e.receiver._pc=e.srcElement,e})),window.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},exports.shimRemoveStream=function(window){if(!window.RTCPeerConnection||"removeStream"in window.RTCPeerConnection.prototype)return;window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;utils.deprecated("removeStream","removeTrack"),this.getSenders().forEach((function(sender){sender.track&&stream.getTracks().includes(sender.track)&&_this3.removeTrack(sender)}))}},exports.shimRTCDataChannel=function(window){window.DataChannel&&!window.RTCDataChannel&&(window.RTCDataChannel=window.DataChannel)},exports.shimAddTransceiver=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origAddTransceiver=window.RTCPeerConnection.prototype.addTransceiver;origAddTransceiver&&(window.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var initParameters=arguments[1],shouldPerformCheck=initParameters&&"sendEncodings"in initParameters;shouldPerformCheck&&initParameters.sendEncodings.forEach((function(encodingParam){if("rid"in encodingParam){if(!/^[a-z0-9]{0,16}$/i.test(encodingParam.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in encodingParam&&!(parseFloat(encodingParam.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in encodingParam&&!(parseFloat(encodingParam.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var transceiver=origAddTransceiver.apply(this,arguments);if(shouldPerformCheck){var sender=transceiver.sender,params=sender.getParameters();(!("encodings"in params)||1===params.encodings.length&&0===Object.keys(params.encodings[0]).length)&&(params.encodings=initParameters.sendEncodings,sender.sendEncodings=initParameters.sendEncodings,this.setParametersPromises.push(sender.setParameters(params).then((function(){delete sender.sendEncodings})).catch((function(){delete sender.sendEncodings}))))}return transceiver})},exports.shimGetParameters=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCRtpSender)return;var origGetParameters=window.RTCRtpSender.prototype.getParameters;origGetParameters&&(window.RTCRtpSender.prototype.getParameters=function(){var params=origGetParameters.apply(this,arguments);return"encodings"in params||(params.encodings=[].concat(this.sendEncodings||[{}])),params})},exports.shimCreateOffer=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateOffer=window.RTCPeerConnection.prototype.createOffer;window.RTCPeerConnection.prototype.createOffer=function(){var _this4=this,_arguments2=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateOffer.apply(_this4,_arguments2)})).finally((function(){_this4.setParametersPromises=[]})):origCreateOffer.apply(this,arguments)}},exports.shimCreateAnswer=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var origCreateAnswer=window.RTCPeerConnection.prototype.createAnswer;window.RTCPeerConnection.prototype.createAnswer=function(){var _this5=this,_arguments3=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return origCreateAnswer.apply(_this5,_arguments3)})).finally((function(){_this5.setParametersPromises=[]})):origCreateAnswer.apply(this,arguments)}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":11,"./getdisplaymedia":8,"./getusermedia":9}],8:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.shimGetDisplayMedia=function(window,preferredMediaSource){if(window.navigator.mediaDevices&&"getDisplayMedia"in window.navigator.mediaDevices)return;if(!window.navigator.mediaDevices)return;window.navigator.mediaDevices.getDisplayMedia=function(constraints){if(!constraints||!constraints.video){var err=new DOMException("getDisplayMedia without video constraints is undefined");return err.name="NotFoundError",err.code=8,Promise.reject(err)}return!0===constraints.video?constraints.video={mediaSource:preferredMediaSource}:constraints.video.mediaSource=preferredMediaSource,window.navigator.mediaDevices.getUserMedia(constraints)}}},{}],9:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimGetUserMedia=function(window,browserDetails){var navigator=window&&window.navigator,MediaStreamTrack=window&&window.MediaStreamTrack;if(navigator.getUserMedia=function(constraints,onSuccess,onError){utils.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),navigator.mediaDevices.getUserMedia(constraints).then(onSuccess,onError)},!(browserDetails.version>55&&"autoGainControl"in navigator.mediaDevices.getSupportedConstraints())){var remap=function(obj,a,b){a in obj&&!(b in obj)&&(obj[b]=obj[a],delete obj[a])},nativeGetUserMedia=navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);if(navigator.mediaDevices.getUserMedia=function(c){return"object"===(void 0===c?"undefined":_typeof(c))&&"object"===_typeof(c.audio)&&(c=JSON.parse(JSON.stringify(c)),remap(c.audio,"autoGainControl","mozAutoGainControl"),remap(c.audio,"noiseSuppression","mozNoiseSuppression")),nativeGetUserMedia(c)},MediaStreamTrack&&MediaStreamTrack.prototype.getSettings){var nativeGetSettings=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var obj=nativeGetSettings.apply(this,arguments);return remap(obj,"mozAutoGainControl","autoGainControl"),remap(obj,"mozNoiseSuppression","noiseSuppression"),obj}}if(MediaStreamTrack&&MediaStreamTrack.prototype.applyConstraints){var nativeApplyConstraints=MediaStreamTrack.prototype.applyConstraints;MediaStreamTrack.prototype.applyConstraints=function(c){return"audio"===this.kind&&"object"===(void 0===c?"undefined":_typeof(c))&&(c=JSON.parse(JSON.stringify(c)),remap(c,"autoGainControl","mozAutoGainControl"),remap(c,"noiseSuppression","mozNoiseSuppression")),nativeApplyConstraints.apply(this,[c])}}}};var utils=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(require("../utils"))},{"../utils":11}],10:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.shimLocalStreamsAPI=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getLocalStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams});if(!("addStream"in window.RTCPeerConnection.prototype)){var _addTrack=window.RTCPeerConnection.prototype.addTrack;window.RTCPeerConnection.prototype.addStream=function(stream){var _this=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(stream)||this._localStreams.push(stream),stream.getAudioTracks().forEach((function(track){return _addTrack.call(_this,track,stream)})),stream.getVideoTracks().forEach((function(track){return _addTrack.call(_this,track,stream)}))},window.RTCPeerConnection.prototype.addTrack=function(track){for(var _this2=this,_len=arguments.length,streams=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)streams[_key-1]=arguments[_key];return streams&&streams.forEach((function(stream){_this2._localStreams?_this2._localStreams.includes(stream)||_this2._localStreams.push(stream):_this2._localStreams=[stream]})),_addTrack.apply(this,arguments)}}"removeStream"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.removeStream=function(stream){var _this3=this;this._localStreams||(this._localStreams=[]);var index=this._localStreams.indexOf(stream);if(-1!==index){this._localStreams.splice(index,1);var tracks=stream.getTracks();this.getSenders().forEach((function(sender){tracks.includes(sender.track)&&_this3.removeTrack(sender)}))}})},exports.shimRemoteStreamsAPI=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;"getRemoteStreams"in window.RTCPeerConnection.prototype||(window.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]});if(!("onaddstream"in window.RTCPeerConnection.prototype)){Object.defineProperty(window.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(f){var _this4=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=f),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(_this4._remoteStreams||(_this4._remoteStreams=[]),!_this4._remoteStreams.includes(stream)){_this4._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,_this4.dispatchEvent(event)}}))})}});var origSetRemoteDescription=window.RTCPeerConnection.prototype.setRemoteDescription;window.RTCPeerConnection.prototype.setRemoteDescription=function(){var pc=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(stream){if(pc._remoteStreams||(pc._remoteStreams=[]),!(pc._remoteStreams.indexOf(stream)>=0)){pc._remoteStreams.push(stream);var event=new Event("addstream");event.stream=stream,pc.dispatchEvent(event)}}))}),origSetRemoteDescription.apply(pc,arguments)}}},exports.shimCallbacksAPI=function(window){if("object"!==(void 0===window?"undefined":_typeof(window))||!window.RTCPeerConnection)return;var prototype=window.RTCPeerConnection.prototype,origCreateOffer=prototype.createOffer,origCreateAnswer=prototype.createAnswer,setLocalDescription=prototype.setLocalDescription,setRemoteDescription=prototype.setRemoteDescription,addIceCandidate=prototype.addIceCandidate;prototype.createOffer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateOffer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.createAnswer=function(successCallback,failureCallback){var options=arguments.length>=2?arguments[2]:arguments[0],promise=origCreateAnswer.apply(this,[options]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};var withCallback=function(description,successCallback,failureCallback){var promise=setLocalDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise};prototype.setLocalDescription=withCallback,withCallback=function(description,successCallback,failureCallback){var promise=setRemoteDescription.apply(this,[description]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.setRemoteDescription=withCallback,withCallback=function(candidate,successCallback,failureCallback){var promise=addIceCandidate.apply(this,[candidate]);return failureCallback?(promise.then(successCallback,failureCallback),Promise.resolve()):promise},prototype.addIceCandidate=withCallback},exports.shimGetUserMedia=function(window){var navigator=window&&window.navigator;if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var mediaDevices=navigator.mediaDevices,_getUserMedia=mediaDevices.getUserMedia.bind(mediaDevices);navigator.mediaDevices.getUserMedia=function(constraints){return _getUserMedia(shimConstraints(constraints))}}!navigator.getUserMedia&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&(navigator.getUserMedia=function(constraints,cb,errcb){navigator.mediaDevices.getUserMedia(constraints).then(cb,errcb)}.bind(navigator))},exports.shimConstraints=shimConstraints,exports.shimRTCIceServerUrls=function(window){if(!window.RTCPeerConnection)return;var OrigPeerConnection=window.RTCPeerConnection;window.RTCPeerConnection=function(pcConfig,pcConstraints){if(pcConfig&&pcConfig.iceServers){for(var newIceServers=[],i=0;i=pos&&parseInt(match[pos],10)}function isObject(val){return"[object Object]"===Object.prototype.toString.call(val)}function walkStats(stats,base,resultSet){base&&!resultSet.has(base.id)&&(resultSet.set(base.id,base),Object.keys(base).forEach((function(name){name.endsWith("Id")?walkStats(stats,stats.get(base[name]),resultSet):name.endsWith("Ids")&&base[name].forEach((function(id){walkStats(stats,stats.get(id),resultSet)}))})))}},{}],12:[function(require,module,exports){var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},SDPUtils={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};SDPUtils.localCName=SDPUtils.generateIdentifier(),SDPUtils.splitLines=function(blob){return blob.trim().split("\n").map((function(line){return line.trim()}))},SDPUtils.splitSections=function(blob){return blob.split("\nm=").map((function(part,index){return(index>0?"m="+part:part).trim()+"\r\n"}))},SDPUtils.getDescription=function(blob){var sections=SDPUtils.splitSections(blob);return sections&§ions[0]},SDPUtils.getMediaSections=function(blob){var sections=SDPUtils.splitSections(blob);return sections.shift(),sections},SDPUtils.matchPrefix=function(blob,prefix){return SDPUtils.splitLines(blob).filter((function(line){return 0===line.indexOf(prefix)}))},SDPUtils.parseCandidate=function(line){for(var parts=void 0,candidate={foundation:(parts=0===line.indexOf("a=candidate:")?line.substring(12).split(" "):line.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[parts[1]],protocol:parts[2].toLowerCase(),priority:parseInt(parts[3],10),ip:parts[4],address:parts[4],port:parseInt(parts[5],10),type:parts[7]},i=8;i0?parts[0].split("/")[1]:"sendrecv",uri:parts[1]}},SDPUtils.writeExtmap=function(headerExtension){return"a=extmap:"+(headerExtension.id||headerExtension.preferredId)+(headerExtension.direction&&"sendrecv"!==headerExtension.direction?"/"+headerExtension.direction:"")+" "+headerExtension.uri+"\r\n"},SDPUtils.parseFmtp=function(line){for(var parsed={},kv=void 0,parts=line.substr(line.indexOf(" ")+1).split(";"),j=0;j-1?(parts.attribute=line.substr(sp+1,colon-sp-1),parts.value=line.substr(colon+1)):parts.attribute=line.substr(sp+1),parts},SDPUtils.parseSsrcGroup=function(line){var parts=line.substr(13).split(" ");return{semantics:parts.shift(),ssrcs:parts.map((function(ssrc){return parseInt(ssrc,10)}))}},SDPUtils.getMid=function(mediaSection){var mid=SDPUtils.matchPrefix(mediaSection,"a=mid:")[0];if(mid)return mid.substr(6)},SDPUtils.parseFingerprint=function(line){var parts=line.substr(14).split(" ");return{algorithm:parts[0].toLowerCase(),value:parts[1]}},SDPUtils.getDtlsParameters=function(mediaSection,sessionpart){return{role:"auto",fingerprints:SDPUtils.matchPrefix(mediaSection+sessionpart,"a=fingerprint:").map(SDPUtils.parseFingerprint)}},SDPUtils.writeDtlsParameters=function(params,setupType){var sdp="a=setup:"+setupType+"\r\n";return params.fingerprints.forEach((function(fp){sdp+="a=fingerprint:"+fp.algorithm+" "+fp.value+"\r\n"})),sdp},SDPUtils.parseCryptoLine=function(line){var parts=line.substr(9).split(" ");return{tag:parseInt(parts[0],10),cryptoSuite:parts[1],keyParams:parts[2],sessionParams:parts.slice(3)}},SDPUtils.writeCryptoLine=function(parameters){return"a=crypto:"+parameters.tag+" "+parameters.cryptoSuite+" "+("object"===_typeof(parameters.keyParams)?SDPUtils.writeCryptoKeyParams(parameters.keyParams):parameters.keyParams)+(parameters.sessionParams?" "+parameters.sessionParams.join(" "):"")+"\r\n"},SDPUtils.parseCryptoKeyParams=function(keyParams){if(0!==keyParams.indexOf("inline:"))return null;var parts=keyParams.substr(7).split("|");return{keyMethod:"inline",keySalt:parts[0],lifeTime:parts[1],mkiValue:parts[2]?parts[2].split(":")[0]:void 0,mkiLength:parts[2]?parts[2].split(":")[1]:void 0}},SDPUtils.writeCryptoKeyParams=function(keyParams){return keyParams.keyMethod+":"+keyParams.keySalt+(keyParams.lifeTime?"|"+keyParams.lifeTime:"")+(keyParams.mkiValue&&keyParams.mkiLength?"|"+keyParams.mkiValue+":"+keyParams.mkiLength:"")},SDPUtils.getCryptoParameters=function(mediaSection,sessionpart){return SDPUtils.matchPrefix(mediaSection+sessionpart,"a=crypto:").map(SDPUtils.parseCryptoLine)},SDPUtils.getIceParameters=function(mediaSection,sessionpart){var ufrag=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-ufrag:")[0],pwd=SDPUtils.matchPrefix(mediaSection+sessionpart,"a=ice-pwd:")[0];return ufrag&&pwd?{usernameFragment:ufrag.substr(12),password:pwd.substr(10)}:null},SDPUtils.writeIceParameters=function(params){var sdp="a=ice-ufrag:"+params.usernameFragment+"\r\na=ice-pwd:"+params.password+"\r\n";return params.iceLite&&(sdp+="a=ice-lite\r\n"),sdp},SDPUtils.parseRtpParameters=function(mediaSection){for(var description={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},mline=SDPUtils.splitLines(mediaSection)[0].split(" "),i=3;i0?"9":"0",sdp+=" UDP/TLS/RTP/SAVPF ",sdp+=caps.codecs.map((function(codec){return void 0!==codec.preferredPayloadType?codec.preferredPayloadType:codec.payloadType})).join(" ")+"\r\n",sdp+="c=IN IP4 0.0.0.0\r\n",sdp+="a=rtcp:9 IN IP4 0.0.0.0\r\n",caps.codecs.forEach((function(codec){sdp+=SDPUtils.writeRtpMap(codec),sdp+=SDPUtils.writeFmtp(codec),sdp+=SDPUtils.writeRtcpFb(codec)}));var maxptime=0;return caps.codecs.forEach((function(codec){codec.maxptime>maxptime&&(maxptime=codec.maxptime)})),maxptime>0&&(sdp+="a=maxptime:"+maxptime+"\r\n"),caps.headerExtensions&&caps.headerExtensions.forEach((function(extension){sdp+=SDPUtils.writeExtmap(extension)})),sdp},SDPUtils.parseRtpEncodingParameters=function(mediaSection){var encodingParameters=[],description=SDPUtils.parseRtpParameters(mediaSection),hasRed=-1!==description.fecMechanisms.indexOf("RED"),hasUlpfec=-1!==description.fecMechanisms.indexOf("ULPFEC"),ssrcs=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(parts){return"cname"===parts.attribute})),primarySsrc=ssrcs.length>0&&ssrcs[0].ssrc,secondarySsrc=void 0,flows=SDPUtils.matchPrefix(mediaSection,"a=ssrc-group:FID").map((function(line){return line.substr(17).split(" ").map((function(part){return parseInt(part,10)}))}));flows.length>0&&flows[0].length>1&&flows[0][0]===primarySsrc&&(secondarySsrc=flows[0][1]),description.codecs.forEach((function(codec){if("RTX"===codec.name.toUpperCase()&&codec.parameters.apt){var encParam={ssrc:primarySsrc,codecPayloadType:parseInt(codec.parameters.apt,10)};primarySsrc&&secondarySsrc&&(encParam.rtx={ssrc:secondarySsrc}),encodingParameters.push(encParam),hasRed&&((encParam=JSON.parse(JSON.stringify(encParam))).fec={ssrc:primarySsrc,mechanism:hasUlpfec?"red+ulpfec":"red"},encodingParameters.push(encParam))}})),0===encodingParameters.length&&primarySsrc&&encodingParameters.push({ssrc:primarySsrc});var bandwidth=SDPUtils.matchPrefix(mediaSection,"b=");return bandwidth.length&&(bandwidth=0===bandwidth[0].indexOf("b=TIAS:")?parseInt(bandwidth[0].substr(7),10):0===bandwidth[0].indexOf("b=AS:")?1e3*parseInt(bandwidth[0].substr(5),10)*.95-16e3:void 0,encodingParameters.forEach((function(params){params.maxBitrate=bandwidth}))),encodingParameters},SDPUtils.parseRtcpParameters=function(mediaSection){var rtcpParameters={},remoteSsrc=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(obj){return"cname"===obj.attribute}))[0];remoteSsrc&&(rtcpParameters.cname=remoteSsrc.value,rtcpParameters.ssrc=remoteSsrc.ssrc);var rsize=SDPUtils.matchPrefix(mediaSection,"a=rtcp-rsize");rtcpParameters.reducedSize=rsize.length>0,rtcpParameters.compound=0===rsize.length;var mux=SDPUtils.matchPrefix(mediaSection,"a=rtcp-mux");return rtcpParameters.mux=mux.length>0,rtcpParameters},SDPUtils.writeRtcpParameters=function(rtcpParameters){var sdp="";return rtcpParameters.reducedSize&&(sdp+="a=rtcp-rsize\r\n"),rtcpParameters.mux&&(sdp+="a=rtcp-mux\r\n"),void 0!==rtcpParameters.ssrc&&rtcpParameters.cname&&(sdp+="a=ssrc:"+rtcpParameters.ssrc+" cname:"+rtcpParameters.cname+"\r\n"),sdp},SDPUtils.parseMsid=function(mediaSection){var parts=void 0,spec=SDPUtils.matchPrefix(mediaSection,"a=msid:");if(1===spec.length)return{stream:(parts=spec[0].substr(7).split(" "))[0],track:parts[1]};var planB=SDPUtils.matchPrefix(mediaSection,"a=ssrc:").map((function(line){return SDPUtils.parseSsrcMedia(line)})).filter((function(msidParts){return"msid"===msidParts.attribute}));return planB.length>0?{stream:(parts=planB[0].value.split(" "))[0],track:parts[1]}:void 0},SDPUtils.parseSctpDescription=function(mediaSection){var mline=SDPUtils.parseMLine(mediaSection),maxSizeLine=SDPUtils.matchPrefix(mediaSection,"a=max-message-size:"),maxMessageSize=void 0;maxSizeLine.length>0&&(maxMessageSize=parseInt(maxSizeLine[0].substr(19),10)),isNaN(maxMessageSize)&&(maxMessageSize=65536);var sctpPort=SDPUtils.matchPrefix(mediaSection,"a=sctp-port:");if(sctpPort.length>0)return{port:parseInt(sctpPort[0].substr(12),10),protocol:mline.fmt,maxMessageSize:maxMessageSize};var sctpMapLines=SDPUtils.matchPrefix(mediaSection,"a=sctpmap:");if(sctpMapLines.length>0){var parts=sctpMapLines[0].substr(10).split(" ");return{port:parseInt(parts[0],10),protocol:parts[1],maxMessageSize:maxMessageSize}}},SDPUtils.writeSctpDescription=function(media,sctp){var output=[];return output="DTLS/SCTP"!==media.protocol?["m="+media.kind+" 9 "+media.protocol+" "+sctp.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+sctp.port+"\r\n"]:["m="+media.kind+" 9 "+media.protocol+" "+sctp.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+sctp.port+" "+sctp.protocol+" 65535\r\n"],void 0!==sctp.maxMessageSize&&output.push("a=max-message-size:"+sctp.maxMessageSize+"\r\n"),output.join("")},SDPUtils.generateSessionId=function(){return Math.random().toString().substr(2,21)},SDPUtils.writeSessionBoilerplate=function(sessId,sessVer,sessUser){var version=void 0!==sessVer?sessVer:2;return"v=0\r\no="+(sessUser||"thisisadapterortc")+" "+(sessId||SDPUtils.generateSessionId())+" "+version+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},SDPUtils.getDirection=function(mediaSection,sessionpart){for(var lines=SDPUtils.splitLines(mediaSection),i=0;i * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modal_cancel=_interopRequireDefault(_modal_cancel),_templates=_interopRequireDefault(_templates),_ajax=_interopRequireDefault(_ajax);const SELECTORS_ADD_BLOCK='[data-key="addblock"]';let listenerEventsRegistered=!1;const registerListenerEvents=(pageType,pageLayout,addBlockUrl,subPage)=>{document.addEventListener("click",(e=>{const addBlock=e.target.closest(SELECTORS_ADD_BLOCK);if(addBlock){e.preventDefault();let addBlockModal=null,addBlockModalUrl=null!=addBlockUrl?addBlockUrl:addBlock.dataset.url;buildAddBlockModal().then((modal=>{addBlockModal=modal;const modalBody=renderBlocks(addBlockModalUrl,pageType,pageLayout,subPage);return modal.setBody(modalBody),modal.show(),modalBody})).catch((()=>{addBlockModal.destroy()}))}}))},buildAddBlockModal=()=>_modal_cancel.default.create({title:(0,_str.getString)("addblock")}),renderBlocks=async(addBlockUrl,pageType,pageLayout,subPage)=>{const blocks=await getAddableBlocks(pageType,pageLayout,subPage);return _templates.default.render("core/add_block_body",{blocks:blocks,url:addBlockUrl})},getAddableBlocks=async(pageType,pageLayout,subPage)=>{const request={methodname:"core_block_fetch_addable_blocks",args:{pagecontextid:M.cfg.contextid,pagetype:pageType,pagelayout:pageLayout,subpage:subPage}};return _ajax.default.call([request])[0]};_exports.init=function(pageType,pageLayout){let addBlockUrl=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,subPage=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";listenerEventsRegistered||(registerListenerEvents(pageType,pageLayout,addBlockUrl,subPage),listenerEventsRegistered=!0)}})); /** * Standard Ajax wrapper for Moodle. It calls the central Ajax script, * which can call any existing webservice using the current session. * In addition, it can batch multiple requests and return multiple responses. * * @module core/ajax * @copyright 2015 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 2.9 */ define("core/ajax",["jquery","core/config","core/log","core/url"],(function($,config,Log,URL){var unloading=!1,requestSuccess=function(responses){var request,response,nosessionupdate,exception=null,i=0;if(responses.error)for(;i2e3?(settings.type="POST",settings.data=ajaxRequestData):url=urlUseGet}return async?$.ajax(url,settings).done(requestSuccess).fail(requestFail):(settings.success=requestSuccess,settings.error=requestFail,$.ajax(url,settings)),promises}}})); define("core/aria",["exports","./local/aria/aria-hidden"],(function(_exports,_ariaHidden){Object.defineProperty(_exports,"__esModule",{value:!0}),Object.defineProperty(_exports,"hide",{enumerable:!0,get:function(){return _ariaHidden.hide}}),Object.defineProperty(_exports,"hideSiblings",{enumerable:!0,get:function(){return _ariaHidden.hideSiblings}}),Object.defineProperty(_exports,"unhide",{enumerable:!0,get:function(){return _ariaHidden.unhide}}),Object.defineProperty(_exports,"unhideSiblings",{enumerable:!0,get:function(){return _ariaHidden.unhideSiblings}})})); /* * 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}})); /** * Enhance a textarea with auto growing rows to fit the content. * * @module core/auto_rows * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 3.2 */ define("core/auto_rows",["jquery"],(function($){var SELECTORS_ELEMENT="[data-auto-rows]",EVENTS={ROW_CHANGE:"autorows:rowchange"},changeListener=function(e){var element=$(e.target),minRows=element.data("min-rows"),currentRows=element.attr("rows");void 0===minRows&&element.data("min-rows",currentRows),element.attr("rows",1);var rows=function(element){var currentRows=element.attr("rows"),minRows=element.data("min-rows"),maxRows=element.attr("data-max-rows"),height=element.height(),padding=element.innerHeight()-height,rows=(element[0].scrollHeight-padding)/(height/currentRows);return element.css("height",""),rows=maxRows?maxRows:rows}(element);element.attr("rows",rows),rows!=currentRows&&element.trigger(EVENTS.ROW_CHANGE)};return{init:function(root){$(root).data("auto-rows")?$(root).on("input propertychange",changeListener.bind(this)):$(root).on("input propertychange",SELECTORS_ELEMENT,changeListener.bind(this))},events:EVENTS}})); /** * A timer that will execute a callback with decreasing frequency. Useful for * doing polling on the server without overwhelming it with requests. * * @module core/backoff_timer * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/backoff_timer",(function(){var BackoffTimer=function(callback,backoffFunction){this.callback=callback,this.backOffFunction=backoffFunction};return BackoffTimer.prototype.callback=null,BackoffTimer.prototype.backOffFunction=null,BackoffTimer.prototype.time=null,BackoffTimer.prototype.timeout=null,BackoffTimer.prototype.generateNextTime=function(){var newTime=this.backOffFunction(this.time);return this.time=newTime,newTime},BackoffTimer.prototype.reset=function(){return this.time=null,this.stop(),this},BackoffTimer.prototype.stop=function(){return this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null),this},BackoffTimer.prototype.start=function(){if(!this.timeout){var time=this.generateNextTime();this.timeout=window.setTimeout(function(){this.callback(),this.stop(),this.start()}.bind(this),time)}return this},BackoffTimer.prototype.restart=function(){return this.reset().start()},BackoffTimer.getIncrementalCallback=function(minamount,incrementamount,maxamount,timeoutamount){return function(time){return time?time+incrementamount>maxamount?timeoutamount:time+incrementamount:minamount}},BackoffTimer})); /** * Chart.js loader. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/chartjs",["core/chartjs-lazy"],(function(ChartJS){return ChartJS})); /** * 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})); /** * Chart bar. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_bar */ define("core/chart_bar",["core/chart_base"],(function(Base){function Bar(){Base.prototype.constructor.apply(this,arguments)}return Bar.prototype=Object.create(Base.prototype),Bar.prototype._horizontal=!1,Bar.prototype._stacked=!1,Bar.prototype.TYPE="bar",Bar.prototype.create=function(Klass,data){var chart=Base.prototype.create.apply(this,arguments);return chart.setHorizontal(data.horizontal),chart.setStacked(data.stacked),chart},Bar.prototype._setDefaults=function(){Base.prototype._setDefaults.apply(this,arguments);var axis=this.getYAxis(0,!0);axis.setMin(0)},Bar.prototype.getHorizontal=function(){return this._horizontal},Bar.prototype.getStacked=function(){return this._stacked},Bar.prototype.setHorizontal=function(horizontal){var axis=this.getXAxis(0,!0);null===axis.getMin()&&axis.setMin(0),this._horizontal=Boolean(horizontal)},Bar.prototype.setStacked=function(stacked){this._stacked=Boolean(stacked)},Bar})); /** * Chart base. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_base */ define("core/chart_base",["core/chart_series","core/chart_axis"],(function(Series,Axis){function Base(){this._series=[],this._labels=[],this._xaxes=[],this._yaxes=[],this._setDefaults()}return Base.prototype._series=null,Base.prototype._labels=null,Base.prototype._legendOptions=null,Base.prototype._title=null,Base.prototype._xaxes=null,Base.prototype._yaxes=null,Base.prototype.COLORSET=["#f3c300","#875692","#f38400","#a1caf1","#be0032","#c2b280","#7f180d","#008856","#e68fac","#0067a5"],Base.prototype._configColorSet=null,Base.prototype.TYPE=null,Base.prototype.addSeries=function(series){if(this._validateSeries(series),this._series.push(series),null===series.getColor()){var configColorSet=this.getConfigColorSet()||Base.prototype.COLORSET;series.setColor(configColorSet[this._series.length%configColorSet.length])}},Base.prototype.create=function(Klass,data){var Chart=new Klass;return Chart.setConfigColorSet(data.config_colorset),Chart.setLabels(data.labels),Chart.setTitle(data.title),data.legend_options&&Chart.setLegendOptions(data.legend_options),data.series.forEach((function(seriesData){Chart.addSeries(Series.prototype.create(seriesData))})),data.axes.x.forEach((function(axisData,i){Chart.setXAxis(Axis.prototype.create(axisData),i)})),data.axes.y.forEach((function(axisData,i){Chart.setYAxis(Axis.prototype.create(axisData),i)})),Chart},Base.prototype.__getAxis=function(xy,index,createIfNotExists){var axis,axes="x"===xy?this._xaxes:this._yaxes,setAxis=("x"===xy?this.setXAxis:this.setYAxis).bind(this);if(createIfNotExists=void 0!==createIfNotExists&&createIfNotExists,void 0===(axis=axes[index=void 0===index?0:index])){if(!createIfNotExists)throw new Error("Unknown axis.");setAxis(axis=new Axis,index)}return axis},Base.prototype.getConfigColorSet=function(){return this._configColorSet},Base.prototype.getLabels=function(){return this._labels},Base.prototype.getLegendOptions=function(){return this._legendOptions},Base.prototype.getSeries=function(){return this._series},Base.prototype.getTitle=function(){return this._title},Base.prototype.getType=function(){if(!this.TYPE)throw new Error("The TYPE property has not been set.");return this.TYPE},Base.prototype.getXAxes=function(){return this._xaxes},Base.prototype.getXAxis=function(index,createIfNotExists){return this.__getAxis("x",index,createIfNotExists)},Base.prototype.getYAxes=function(){return this._yaxes},Base.prototype.getYAxis=function(index,createIfNotExists){return this.__getAxis("y",index,createIfNotExists)},Base.prototype.setConfigColorSet=function(colorset){this._configColorSet=colorset},Base.prototype._setDefaults=function(){},Base.prototype.setLabels=function(labels){if(labels.length&&this._series.length&&this._series[0].length!=labels.length)throw new Error("Series must match label values.");this._labels=labels},Base.prototype.setLegendOptions=function(legendOptions){if("object"!=typeof legendOptions)throw new Error("Setting legend with non-object value:"+legendOptions);this._legendOptions=legendOptions},Base.prototype.setTitle=function(title){this._title=title},Base.prototype.setXAxis=function(axis,index){index=void 0===index?0:index,this._validateAxis("x",axis,index),this._xaxes[index]=axis},Base.prototype.setYAxis=function(axis,index){index=void 0===index?0:index,this._validateAxis("y",axis,index),this._yaxes[index]=axis},Base.prototype._validateAxis=function(xy,axis,index){if((index=void 0===index?0:index)>0&&void 0===("x"==xy?this._xaxes:this._yaxes)[index-1])throw new Error("Missing "+xy+" axis at index lower than "+index)},Base.prototype._validateSeries=function(series){if(this._series.length&&this._series[0].getCount()!=series.getCount())throw new Error("Series do not have an equal number of values.");if(this._labels.length&&this._labels.length!=series.getCount())throw new Error("Series must match label values.")},Base})); /** * Chart builder. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/chart_builder",["jquery"],(function($){return{make:function(data){var deferred=$.Deferred();return require(["core/chart_"+data.type],(function(Klass){var instance=Klass.prototype.create(Klass,data);deferred.resolve(instance)})),deferred.promise()}}})); /** * 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 output. * * Proxy to the default output module. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/chart_output",["core/chart_output_chartjs"],(function(Output){return Output})); /** * Chart output base. * * This takes a chart object and draws it. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_output_base */ define("core/chart_output_base",["jquery"],(function($){function Base(node,chart){this._node=$(node),this._chart=chart}return Base.prototype.update=function(){throw new Error("Not supported.")},Base})); /** * Chart output for chart.js. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_output_chartjs */ define("core/chart_output_chartjs",["jquery","core/chartjs","core/chart_axis","core/chart_bar","core/chart_output_base","core/chart_line","core/chart_pie","core/chart_series"],(function($,Chartjs,Axis,Bar,Base,Line,Pie,Series){var makeAxisId=function(xy,index){return"axis-"+xy+"-"+index};function Output(){Base.prototype.constructor.apply(this,arguments),this._canvas=this._node,"CANVAS"!=this._canvas.prop("tagName")&&(this._canvas=$(""),this._node.append(this._canvas)),this._build()}return Output.prototype=Object.create(Base.prototype),Output.prototype._config=null,Output.prototype._chartjs=null,Output.prototype._canvas=null,Output.prototype._build=function(){this._config=this._makeConfig(),this._chartjs=new Chartjs(this._canvas[0],this._config)},Output.prototype._cleanData=function(data){return data instanceof Array?data.map((function(value){return $("").html(value).text()})):$("").html(data).text()},Output.prototype._getChartType=function(){var type=this._chart.getType();return this._chart.getType()===Bar.prototype.TYPE&&!0===this._chart.getHorizontal()?type="horizontalBar":this._chart.getType()===Pie.prototype.TYPE&&!0===this._chart.getDoughnut()&&(type="doughnut"),type},Output.prototype._makeAxisConfig=function(axis,xy,index){var scaleData={id:makeAxisId(xy,index)};return axis.getPosition()!==Axis.prototype.POS_DEFAULT&&(scaleData.position=axis.getPosition()),null!==axis.getLabel()&&(scaleData.title={display:!0,text:this._cleanData(axis.getLabel())}),null!==axis.getStepSize()&&(scaleData.ticks=scaleData.ticks||{},scaleData.ticks.stepSize=axis.getStepSize()),null!==axis.getMax()&&(scaleData.ticks=scaleData.ticks||{},scaleData.ticks.max=axis.getMax()),null!==axis.getMin()&&(scaleData.ticks=scaleData.ticks||{},scaleData.ticks.min=axis.getMin()),scaleData},Output.prototype._makeConfig=function(){var charType=this._getChartType(),labels=this._cleanData(this._chart.getLabels()),config={type:charType,data:{labels:labels.map((label=>label.length>25?"".concat(label.substring(0,25),"..."):label)),datasets:this._makeDatasetsConfig()},options:{responsive:!0,maintainAspectRatio:!1,plugins:{title:{display:null!==this._chart.getTitle(),text:this._cleanData(this._chart.getTitle())}}}};"horizontalBar"===charType&&(config.type="bar",config.options.indexAxis="y");var legendOptions=this._chart.getLegendOptions();return legendOptions&&(config.options.plugins.legend=legendOptions),this._chart.getXAxes().forEach(function(axis,i){var axisLabels=axis.getLabels();config.options.scales=config.options.scales||{},config.options.scales.x=config.options.scales.x||{},config.options.scales.x[i]=this._makeAxisConfig(axis,"x",i),null!==axisLabels&&(config.options.scales.x[i].ticks.callback=function(value,index){return axisLabels[index]||""}),config.options.scales.x.stacked=this._isStacked()}.bind(this)),this._chart.getYAxes().forEach(function(axis,i){var axisLabels=axis.getLabels();config.options.scales=config.options.scales||{},config.options.scales.y=config.options.scales.yAxes||{},config.options.scales.y[i]=this._makeAxisConfig(axis,"y",i),null!==axisLabels&&(config.options.scales.y[i].ticks.callback=function(value){return axisLabels[parseInt(value,10)]||""}),config.options.scales.y.stacked=this._isStacked()}.bind(this)),config.options.plugins.tooltip={callbacks:{title:ctx=>labels[ctx[0].dataIndex].match(/.{1,80}/g),label:this._makeTooltip.bind(this)}},config},Output.prototype._makeDatasetsConfig=function(){return this._chart.getSeries().map(function(series){var colors=series.hasColoredValues()?series.getColors():series.getColor(),dataset={label:this._cleanData(series.getLabel()),data:series.getValues(),type:series.getType(),fill:series.getFill(),backgroundColor:colors,borderColor:this._chart.getType()==Pie.prototype.TYPE?"#fff":colors,tension:this._isSmooth(series)?.3:0};return null!==series.getXAxis()&&(dataset.xAxisID=makeAxisId("x",series.getXAxis())),null!==series.getYAxis()&&(dataset.yAxisID=makeAxisId("y",series.getYAxis())),dataset}.bind(this))},Output.prototype._makeTooltip=function(tooltipItem){var serieLabel=this._chart.getSeries()[tooltipItem.datasetIndex].getLabel(),tooltipData=tooltipItem.dataset.data[tooltipItem.dataIndex],tooltip=[];if(this._chart.getType()===Pie.prototype.TYPE){var chartLabels=this._cleanData(this._chart.getLabels());tooltip.push(chartLabels[tooltipItem.dataIndex]+" - "+this._cleanData(serieLabel)+": "+tooltipData)}else tooltip.push(this._cleanData(serieLabel)+": "+tooltipData);return tooltip},Output.prototype._isSmooth=function(series){var smooth=!1;return this._chart.getType()===Line.prototype.TYPE?null===(smooth=series.getSmooth())&&(smooth=this._chart.getSmooth()):series.getType()===Series.prototype.TYPE_LINE&&(smooth=series.getSmooth()),smooth},Output.prototype._isStacked=function(){var stacked=!1;return this._chart.getType()===Bar.prototype.TYPE&&(stacked=this._chart.getStacked()),stacked},Output.prototype.update=function(){$.extend(!0,this._config,this._makeConfig()),this._chartjs.update()},Output})); /** * Chart output for HTML table. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_output_htmltable */ define("core/chart_output_htmltable",["jquery","core/chart_output_base"],(function($,Base){function Output(){Base.prototype.constructor.apply(this,arguments),this._build()}return Output.prototype=Object.create(Base.prototype),Output.prototype._build=function(){this._node.empty(),this._node.append(this._makeTable())},Output.prototype._makeTable=function(){var node,value,tbl=$(""),c=this._chart,labels=c.getLabels(),hasLabel=labels.length>0,series=c.getSeries(),rowCount=series[0].getCount();tbl.addClass("chart-output-htmltable generaltable"),null!==c.getTitle()&&tbl.append($(""),hasLabel&&node.append($(" * * */ const copyNodeContentToClipboard=(copyButton,copyTarget)=>(copyTarget.select(),document.execCommand("copy")?(displaySuccessToast(copyButton),!0):(displayFailureToast(),!1)),displaySuccessToast=copyButton=>getSuccessText(copyButton).then((successMessage=>(0,_toast.add)(successMessage,{}))),displayFailureToast=()=>getFailureText().then((message=>(0,_toast.add)(message,{type:"warning"}))),getFailureText=()=>(0,_str.getString)("unabletocopytoclipboard","core"),getSuccessText=copyButton=>copyButton.dataset.clipboardSuccessMessage?Promise.resolve(copyButton.dataset.clipboardSuccessMessage):(0,_str.getString)("textcopiedtoclipboard","core"),getTextFromContainer=container=>container.value?container.value:container.innerText?container.innerText:null;let loaded=!1;loaded||((0,_prefetch.prefetchStrings)("core",["textcopiedtoclipboard","unabletocopytoclipboard"]),document.addEventListener("click",(e=>{const copyButton=e.target.closest('[data-action="copytoclipboard"]');if(!copyButton)return;if(!copyButton.dataset.clipboardTarget)return;const copyTarget=document.querySelector(copyButton.dataset.clipboardTarget);if(!copyTarget)return;e.preventDefault();const textToCopy=getTextFromContainer(copyTarget);if(textToCopy)if(navigator.clipboard)navigator.clipboard.writeText(textToCopy).then((()=>displaySuccessToast(copyButton))).catch();else if(copyTarget instanceof HTMLInputElement||copyTarget instanceof HTMLTextAreaElement)copyTarget.focus(),copyNodeContentToClipboard(copyButton,copyTarget)&©Button.focus();else{const copyRegion=document.createElement("textarea");copyRegion.value=textToCopy,copyRegion.classList.add("sr-only"),document.body.appendChild(copyRegion),copyNodeContentToClipboard(copyButton,copyRegion),copyRegion.remove(),copyButton.focus()}else displayFailureToast()})),loaded=!0)})); /** * This module provides a wrapper to encapsulate a lot of the common combinations of * user interaction we use in Moodle. * * @module core/custom_interaction_events * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 3.2 */ define("core/custom_interaction_events",["jquery","core/key_codes"],(function($,keyCodes){var events={activate:"cie:activate",keyboardActivate:"cie:keyboardactivate",escape:"cie:escape",down:"cie:down",up:"cie:up",home:"cie:home",end:"cie:end",next:"cie:next",previous:"cie:previous",asterix:"cie:asterix",scrollLock:"cie:scrollLock",scrollTop:"cie:scrollTop",scrollBottom:"cie:scrollBottom",ctrlPageUp:"cie:ctrlPageUp",ctrlPageDown:"cie:ctrlPageDown",enter:"cie:enter",accessibleChange:"cie:accessibleChange"},triggeredEvents={},isModifierPressed=function(e){return e.shiftKey||e.metaKey||e.altKey||e.ctrlKey},triggerEvent=function(eventName,e){var eventTypeKey="";return e.hasOwnProperty("originalEvent")?(eventTypeKey="triggeredCustom_"+eventName,e.originalEvent.hasOwnProperty(eventTypeKey)?void 0:(e.originalEvent[eventTypeKey]=!0,void $(e.target).trigger(eventName,[{originalEvent:e}]))):(eventTypeKey=""+eventName+e.type+e.timeStamp,void(triggeredEvents.hasOwnProperty(eventTypeKey)||(triggeredEvents[eventTypeKey]=!0,$(e.target).trigger(eventName,[{originalEvent:e}]))))},addKeyboardEvent=function(element,event,keyCode){element.off("keydown."+event).on("keydown."+event,(function(e){isModifierPressed(e)||e.keyCode==keyCode&&triggerEvent(event,e)}))},addActivateListener=function(element){element.off("click.cie.activate").on("click.cie.activate",(function(e){triggerEvent(events.activate,e)})),element.off("keydown.cie.activate").on("keydown.cie.activate",(function(e){isModifierPressed(e)||e.keyCode!=keyCodes.enter&&e.keyCode!=keyCodes.space||triggerEvent(events.activate,e)}))},addKeyboardActivateListener=function(element){element.off("keydown.cie.keyboardactivate").on("keydown.cie.keyboardactivate",(function(e){isModifierPressed(e)||e.keyCode!=keyCodes.enter&&e.keyCode!=keyCodes.space||triggerEvent(events.keyboardActivate,e)}))},addEscapeListener=function(element){addKeyboardEvent(element,events.escape,keyCodes.escape)},addDownListener=function(element){addKeyboardEvent(element,events.down,keyCodes.arrowDown)},addUpListener=function(element){addKeyboardEvent(element,events.up,keyCodes.arrowUp)},addHomeListener=function(element){addKeyboardEvent(element,events.home,keyCodes.home)},addEndListener=function(element){addKeyboardEvent(element,events.end,keyCodes.end)},addNextListener=function(element){var keyCode="rtl"==$("html").attr("dir")?keyCodes.arrowLeft:keyCodes.arrowRight;addKeyboardEvent(element,events.next,keyCode)},addPreviousListener=function(element){var keyCode="rtl"==$("html").attr("dir")?keyCodes.arrowRight:keyCodes.arrowLeft;addKeyboardEvent(element,events.previous,keyCode)},addAsterixListener=function(element){addKeyboardEvent(element,events.asterix,keyCodes.asterix)},addScrollTopListener=function(element){element.off("scroll.cie.scrollTop").on("scroll.cie.scrollTop",(function(e){0===element.scrollTop()&&triggerEvent(events.scrollTop,e)}))},addScrollBottomListener=function(element){element.off("scroll.cie.scrollBottom").on("scroll.cie.scrollBottom",(function(e){element.scrollTop()+element.innerHeight()>=element[0].scrollHeight&&triggerEvent(events.scrollBottom,e)}))},addScrollLockListener=function(element){element.off("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock").on("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock",(function(e){var scrollTop=element.scrollTop(),scrollHeight=element[0].scrollHeight,height=element.height(),delta="DOMMouseScroll"==e.type?-40*e.originalEvent.detail:e.originalEvent.wheelDelta,up=delta>0;return!up&&-delta>scrollHeight-height-scrollTop?(element.scrollTop(scrollHeight),e.stopPropagation(),e.preventDefault(),e.returnValue=!1,triggerEvent(events.scrollLock,e),!1):!(up&&delta>scrollTop)||(element.scrollTop(0),e.stopPropagation(),e.preventDefault(),e.returnValue=!1,triggerEvent(events.scrollLock,e),!1)}))},addCtrlPageUpListener=function(element){element.off("keydown.cie.ctrlpageup").on("keydown.cie.ctrlpageup",(function(e){e.ctrlKey&&e.keyCode==keyCodes.pageUp&&triggerEvent(events.ctrlPageUp,e)}))},addCtrlPageDownListener=function(element){element.off("keydown.cie.ctrlpagedown").on("keydown.cie.ctrlpagedown",(function(e){e.ctrlKey&&e.keyCode==keyCodes.pageDown&&triggerEvent(events.ctrlPageDown,e)}))},addEnterListener=function(element){addKeyboardEvent(element,events.enter,keyCodes.enter)},addAccessibleChangeListener=function(element){var onMac=-1!==navigator.userAgent.indexOf("Macintosh"),touchEnabled="ontouchstart"in window||"msMaxTouchPoints"in navigator&&navigator.msMaxTouchPoints>0;if(onMac||touchEnabled)element.on("change",(function(e){triggerEvent(events.accessibleChange,e)}));else{var checkAndTriggerAccessibleChange=function(e){"initValue"in e.target.dataset&&e.target.value!==e.target.dataset.initValue&&(e.target.dataset.initValue=e.target.value,triggerEvent(events.accessibleChange,e))},nativeElement=element.get()[0];nativeElement.addEventListener("focus",(function(e){var target;(target=e.target).dataset.initValue=target.value}),!0),nativeElement.addEventListener("blur",(function(e){checkAndTriggerAccessibleChange(e)}),!0),element.on("keydown",(function(e){var target;e.which===keyCodes.enter?checkAndTriggerAccessibleChange(e):e.which===keyCodes.escape?("initValue"in(target=e.target).dataset&&(target.value=target.dataset.initValue),e.target.dataset.ignoreChange=!0):e.target.dataset.ignoreChange=!0})),element.on("change",(function(e){e.target.dataset.ignoreChange||checkAndTriggerAccessibleChange(e)})),element.on("keyup",(function(e){delete e.target.dataset.ignoreChange})),element.on("click",(function(e){checkAndTriggerAccessibleChange(e)}))}};return{define:function(element,include){var handlers;(element=$(element),include=include||[],element.length&&include.length)&&$.each(((handlers={})[events.activate]=addActivateListener,handlers[events.keyboardActivate]=addKeyboardActivateListener,handlers[events.escape]=addEscapeListener,handlers[events.down]=addDownListener,handlers[events.up]=addUpListener,handlers[events.home]=addHomeListener,handlers[events.end]=addEndListener,handlers[events.next]=addNextListener,handlers[events.previous]=addPreviousListener,handlers[events.asterix]=addAsterixListener,handlers[events.scrollLock]=addScrollLockListener,handlers[events.scrollTop]=addScrollTopListener,handlers[events.scrollBottom]=addScrollBottomListener,handlers[events.ctrlPageUp]=addCtrlPageUpListener,handlers[events.ctrlPageDown]=addCtrlPageDownListener,handlers[events.enter]=addEnterListener,handlers[events.accessibleChange]=addAccessibleChangeListener,handlers),(function(eventType,handler){(function(eventType,include){return!(!(include=include||[]).length||-1===include.indexOf(eventType))})(eventType,include)&&handler(element)}))},events:events}})); define("core/datafilter",["exports","core/datafilter/filtertypes/courseid","core/datafilter/filtertype","core/str","core/notification","core/pending","core/datafilter/selectors","core/templates","core/custom_interaction_events","jquery"],(function(_exports,_courseid,_filtertype,_str,_notification,_pending,_selectors,_templates,_custom_interaction_events,_jquery){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_courseid=_interopRequireDefault(_courseid),_filtertype=_interopRequireDefault(_filtertype),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending),_selectors=_interopRequireDefault(_selectors),_templates=_interopRequireDefault(_templates),_custom_interaction_events=_interopRequireDefault(_custom_interaction_events),_jquery=_interopRequireDefault(_jquery);var _systemImportTransformerGlobalIdentifier="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:{};function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}return _exports.default=class{constructor(filterSet,applyCallback){this.filterSet=filterSet,this.applyCallback=applyCallback,this.activeFilters={courseid:new _courseid.default("courseid",filterSet)}}init(){this.filterSet.querySelector(_selectors.default.filterset.region).addEventListener("click",(e=>{e.target.closest(_selectors.default.filterset.actions.addRow)&&(e.preventDefault(),this.addFilterRow()),e.target.closest(_selectors.default.filterset.actions.applyFilters)&&(e.preventDefault(),this.updateTableFromFilter()),e.target.closest(_selectors.default.filterset.actions.resetFilters)&&(e.preventDefault(),this.removeAllFilters())})),this.filterSet.querySelector(_selectors.default.filterset.regions.filterlist).addEventListener("click",(e=>{e.target.closest(_selectors.default.filter.actions.remove)&&(e.preventDefault(),this.removeOrReplaceFilterRow(e.target.closest(_selectors.default.filter.region),!0))}));let filterRegion=(0,_jquery.default)(this.getFilterRegion());_custom_interaction_events.default.define(filterRegion,[_custom_interaction_events.default.events.accessibleChange]),filterRegion.on(_custom_interaction_events.default.events.accessibleChange,(e=>{const typeField=e.target.closest(_selectors.default.filter.fields.type);if(typeField&&typeField.value){const filter=e.target.closest(_selectors.default.filter.region);this.addFilter(filter,typeField.value)}})),this.filterSet.querySelector(_selectors.default.filterset.fields.join).addEventListener("change",(e=>{this.filterSet.dataset.filterverb=e.target.value}))}getFilterRegion(){return this.filterSet.querySelector(_selectors.default.filterset.regions.filterlist)}addFilterRow(){var _filterdata$rownum;let filterdata=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const pendingPromise=new _pending.default("core/datafilter:addFilterRow"),rownum=null!==(_filterdata$rownum=filterdata.rownum)&&void 0!==_filterdata$rownum?_filterdata$rownum:1+this.getFilterRegion().querySelectorAll(_selectors.default.filter.region).length;return _templates.default.renderForPromise("core/datafilter/filter_row",{rownumber:rownum}).then((_ref=>{let{html:html,js:js}=_ref;return _templates.default.appendNodeContents(this.getFilterRegion(),html,js)})).then((filterRow=>{const typeList=this.filterSet.querySelector(_selectors.default.data.typeList);return filterRow.forEach((contentNode=>{const contentTypeList=contentNode.querySelector(_selectors.default.filter.fields.type);contentTypeList&&(contentTypeList.innerHTML=typeList.innerHTML)})),filterRow})).then((filterRow=>(this.updateFiltersOptions(),filterRow))).then((result=>(pendingPromise.resolve(),filterdata.filtertype&&result.forEach((filter=>{this.addFilter(filter,filterdata.filtertype,filterdata.values,filterdata.jointype,filterdata.filteroptions)})),result))).catch(_notification.default.exception)}getFilterDataSource(filterType){return this.filterSet.querySelector(_selectors.default.filterset.regions.datasource).querySelector(_selectors.default.data.fields.byName(filterType))}async addFilter(filterRow,filterType,initialFilterValues,filterJoin,filterOptions){filterRow.dataset.filterType=filterType;const filterDataNode=this.getFilterDataSource(filterType);let Filter=_filtertype.default;filterDataNode.dataset.filterTypeClass&&(Filter=await("function"==typeof _systemImportTransformerGlobalIdentifier.define&&_systemImportTransformerGlobalIdentifier.define.amd?new Promise((function(resolve,reject){_systemImportTransformerGlobalIdentifier.require([filterDataNode.dataset.filterTypeClass],resolve,reject)})):"undefined"!=typeof module&&module.exports&&"undefined"!=typeof require||"undefined"!=typeof module&&module.component&&_systemImportTransformerGlobalIdentifier.require&&"component"===_systemImportTransformerGlobalIdentifier.require.loader?Promise.resolve(require(filterDataNode.dataset.filterTypeClass)):Promise.resolve(_systemImportTransformerGlobalIdentifier[filterDataNode.dataset.filterTypeClass]))),this.activeFilters[filterType]=new Filter(filterType,this.filterSet,initialFilterValues,filterOptions);const typeField=filterRow.querySelector(_selectors.default.filter.fields.type);typeField.value=filterType,typeField.disabled="disabled",this.updateJoinList(JSON.parse(filterDataNode.dataset.joinList),filterRow);const joinField=filterRow.querySelector(_selectors.default.filter.fields.join);return isNaN(filterJoin)||(joinField.value=filterJoin),this.updateFiltersOptions(),this.activeFilters[filterType]}getFilterObject(name){return this.activeFilters[name]}removeOrReplaceFilterRow(filterRow,refreshContent){1===this.getFilterRegion().querySelectorAll(_selectors.default.filter.region).length?this.replaceFilterRow(filterRow,refreshContent):this.removeFilterRow(filterRow,refreshContent)}async removeFilterRow(filterRow){let refreshContent=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(filterRow.querySelector(_selectors.default.data.required))return;const hasFilterValue=!!filterRow.querySelector(_selectors.default.filter.fields.type).value;this.removeFilterObject(filterRow.dataset.filterType),filterRow.remove(),this.updateFiltersOptions(),hasFilterValue&&refreshContent&&this.updateTableFromFilter();const filterLegends=await this.getAvailableFilterLegends();this.getFilterRegion().querySelectorAll(_selectors.default.filter.region).forEach(((filterRow,index)=>{filterRow.querySelector("legend").innerText=filterLegends[index]}))}replaceFilterRow(filterRow){let refreshContent=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],rowNum=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(!filterRow.querySelector(_selectors.default.data.required))return this.removeFilterObject(filterRow.dataset.filterType),_templates.default.renderForPromise("core/datafilter/filter_row",{rownumber:rowNum}).then((_ref2=>{let{html:html,js:js}=_ref2;return _templates.default.replaceNode(filterRow,html,js)})).then((filterRow=>{const typeList=this.filterSet.querySelector(_selectors.default.data.typeList);return filterRow.forEach((contentNode=>{const contentTypeList=contentNode.querySelector(_selectors.default.filter.fields.type);contentTypeList&&(contentTypeList.innerHTML=typeList.innerHTML)})),filterRow})).then((filterRow=>(this.updateFiltersOptions(),filterRow))).then((filterRow=>refreshContent?this.updateTableFromFilter():filterRow)).catch(_notification.default.exception)}removeFilterObject(filterName){if(filterName){const filter=this.getFilterObject(filterName);filter&&(filter.tearDown(),delete this.activeFilters[filterName])}}removeAllFilters(){return this.getFilterRegion().querySelectorAll(_selectors.default.filter.region).forEach((filterRow=>this.removeOrReplaceFilterRow(filterRow,!1))),this.updateTableFromFilter()}removeEmptyFilters(){this.getFilterRegion().querySelectorAll(_selectors.default.filter.region).forEach((filterRow=>{filterRow.querySelector(_selectors.default.filter.fields.type).value||this.removeOrReplaceFilterRow(filterRow,!1)}))}updateFiltersOptions(){const filters=this.getFilterRegion().querySelectorAll(_selectors.default.filter.region);filters.forEach((filterRow=>{filterRow.querySelectorAll(_selectors.default.filter.fields.type+" option").forEach((option=>{option.value===filterRow.dataset.filterType?(option.classList.remove("hidden"),option.disabled=!1):this.activeFilters[option.value]?(option.classList.add("hidden"),option.disabled=!0):(option.classList.remove("hidden"),option.disabled=!1)}))}));const addRowButton=this.filterSet.querySelector(_selectors.default.filterset.actions.addRow);this.filterSet.querySelectorAll(_selectors.default.data.fields.all).length<=filters.length?addRowButton.setAttribute("disabled","disabled"):addRowButton.removeAttribute("disabled"),1===filters.length?(this.filterSet.querySelector(_selectors.default.filterset.regions.filtermatch).classList.add("hidden"),this.filterSet.querySelector(_selectors.default.filterset.fields.join).value=2,this.filterSet.dataset.filterverb=2):this.filterSet.querySelector(_selectors.default.filterset.regions.filtermatch).classList.remove("hidden")}updateTableFromFilter(){const pendingPromise=new _pending.default("core/datafilter:updateTableFromFilter"),filters={};Object.values(this.activeFilters).forEach((filter=>{filters[filter.filterValue.name]=filter.filterValue})),this.applyCallback&&this.applyCallback(filters,pendingPromise)}async getAvailableFilterLegends(){const maxFilters=document.querySelector(_selectors.default.data.typeListSelect).length-1;let requests=[];[...Array(maxFilters)].forEach(((_,rowIndex)=>{requests.push({key:"filterrowlegend",component:"core",param:rowIndex+1})}));return await(0,_str.getStrings)(requests).then((fetchedStrings=>fetchedStrings)).catch(_notification.default.exception)}updateJoinList(filterJoinList,filterRow){const regularJoinList=[0,1,2];if(0!==filterJoinList.length){const joinField=filterRow.querySelector(_selectors.default.filter.fields.join);regularJoinList.forEach((join=>{filterJoinList.includes(join)||(joinField.options[join].classList.add("hidden"),joinField.options[join].disabled=!0)})),joinField.options.forEach(((element,index)=>{element.disabled&&(joinField.options[index]=null)})),1===joinField.options.length&&(joinField.hidden=!0)}}},_exports.default})); /* * JavaScript to handle drag operations, including automatic scrolling. * * Note: this module is defined statically. It is a singleton. You * can only have one use of it active at any time. However, you * can only drag one thing at a time, this is not a problem in practice. * * @module core/dragdrop * @copyright 2016 The Open University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 3.6 */ define("core/dragdrop",["jquery","core/autoscroll"],(function($,autoScroll){var dragdrop={eventCaptureOptions:{passive:!1,capture:!0},dragProxy:null,onMove:null,onDrop:null,initialPosition:null,initialX:null,initialY:null,touching:null,prepare:function(event){if(event.preventDefault(),"touchstart"===event.type?null===dragdrop.touching&&event.changedTouches.length>0:1===event.which){var details=dragdrop.getEventXY(event);return details.start=!0,details}return{start:!1}},start:function(event,dragProxy,onMove,onDrop){var xy=dragdrop.getEventXY(event);switch(dragdrop.initialX=xy.x,dragdrop.initialY=xy.y,dragdrop.initialPosition=dragProxy.offset(),dragdrop.dragProxy=dragProxy,dragdrop.onMove=onMove,dragdrop.onDrop=onDrop,event.type){case"mousedown":dragdrop.addEventSpecial("mousemove",dragdrop.mouseMove),dragdrop.addEventSpecial("mouseup",dragdrop.mouseUp);break;case"touchstart":dragdrop.addEventSpecial("touchend",dragdrop.touchEnd),dragdrop.addEventSpecial("touchcancel",dragdrop.touchEnd),dragdrop.addEventSpecial("touchmove",dragdrop.touchMove),dragdrop.touching=event.changedTouches[0].identifier;break;default:throw new Error("Unexpected event type: "+event.type)}autoScroll.start(dragdrop.scroll)},addEventSpecial:function(event,handler){try{window.addEventListener(event,handler,dragdrop.eventCaptureOptions)}catch(ex){dragdrop.eventCaptureOptions=!0,window.addEventListener(event,handler,dragdrop.eventCaptureOptions)}},getEventXY:function(event){switch(event.type){case"touchstart":return{x:event.changedTouches[0].pageX,y:event.changedTouches[0].pageY};case"mousedown":return{x:event.pageX,y:event.pageY};default:throw new Error("Unexpected event type: "+event.type)}},touchMove:function(e){e.preventDefault();for(var i=0;i * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_jquery=_interopRequireDefault(_jquery),PubSub=_interopRequireWildcard(PubSub),Aria=_interopRequireWildcard(Aria),_drawer_events=_interopRequireDefault(_drawer_events);const show=root=>{root=(0,_jquery.default)(root),Aria.unhide(root.get()),root.removeClass("hidden"),root.attr("aria-expanded",!0),root.focus(),PubSub.publish(_drawer_events.default.DRAWER_SHOWN,root)},hide=root=>{(root=(0,_jquery.default)(root)).addClass("hidden"),root.attr("aria-expanded",!1),Aria.hide(root.get()),PubSub.publish(_drawer_events.default.DRAWER_HIDDEN,root)},isVisible=root=>!root.hasClass("hidden"),toggle=root=>{isVisible(root)?hide(root):show(root)};var _default={hide:hide,show:show,isVisible:isVisible,toggle:toggle,registerToggles:(root,toggleElements)=>{let openTrigger=null;toggleElements.attr("aria-expanded",isVisible(root)),toggleElements.on("click",(e=>{e.preventDefault();const wasVisible=isVisible(root);toggle(root),toggleElements.attr("aria-expanded",!wasVisible),wasVisible?openTrigger&&(openTrigger.focus(),openTrigger=null):openTrigger=toggleElements.filter(((index,element)=>element==e.target||element.contains(e.target)))}))},getDrawerRoot:contentRoot=>(contentRoot=(0,_jquery.default)(contentRoot)).closest('[data-region="right-hand-drawer"]')};return _exports.default=_default,_exports.default})); define("core/drawer_events",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default={DRAWER_SHOWN:"drawer-shown",DRAWER_HIDDEN:"drawer-hidden"},_exports.default})); define("core/dropzone",["exports","core/str","core/log","core/prefetch","core/templates"],(function(_exports,_str,_log,_prefetch,_templates){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_log=_interopRequireDefault(_log),_templates=_interopRequireDefault(_templates);var _default=class{constructor(dropZoneElement,fileTypes,callback){_defineProperty(this,"dropZoneElement",void 0),_defineProperty(this,"fileTypes",void 0),_defineProperty(this,"callback",void 0),_defineProperty(this,"dropZoneLabel",""),(0,_prefetch.prefetchString)("core","addfilesdrop"),this.dropZoneElement=dropZoneElement,this.fileTypes=fileTypes,this.callback=callback}init(){return this.dropZoneElement.addEventListener("dragover",(e=>{const dropZone=this.getDropZoneFromEvent(e);dropZone&&(e.preventDefault(),dropZone.classList.add("dragover"))})),this.dropZoneElement.addEventListener("dragleave",(e=>{const dropZone=this.getDropZoneFromEvent(e);dropZone&&(e.preventDefault(),dropZone.classList.remove("dragover"))})),this.dropZoneElement.addEventListener("drop",(e=>{const dropZone=this.getDropZoneFromEvent(e);dropZone&&(e.preventDefault(),dropZone.classList.remove("dragover"),this.callback(e.dataTransfer.files))})),this.dropZoneElement.addEventListener("click",(e=>{this.getDropZoneContainerFromEvent(e)&&this.getFileElementFromEvent(e).click()})),this.dropZoneElement.addEventListener("click",(e=>{e.target.closest(".dropzone-sr-only-focusable")&&this.getFileElementFromEvent(e).click()})),this.dropZoneElement.addEventListener("change",(e=>{const fileInput=this.getFileElementFromEvent(e);fileInput&&(e.preventDefault(),this.callback(fileInput.files))})),this.renderDropZone(this.dropZoneElement,this.fileTypes),_log.default.info("Dropzone has been initialized!"),this}getDropZoneFromEvent(e){return e.target.closest(".dropzone")}getDropZoneContainerFromEvent(e){return e.target.closest(".dropzone-container")}getFileElementFromEvent(e){return e.target.closest(".dropzone-container").querySelector(".drop-zone-fileinput")}setLabel(label){this.dropZoneLabel=label}getLabel(){return this.dropZoneLabel}async renderDropZone(dropZoneElement,fileTypes){this.getLabel()||this.setLabel(await(0,_str.getString)("addfilesdrop","core"));const dropZoneLabel=this.getLabel();dropZoneElement.innerHTML=await _templates.default.render("core/dropzone",{label:dropZoneLabel,filetypes:fileTypes})}};return _exports.default=_default,_exports.default})); define("core/dynamic_tabs",["exports","jquery","core/templates","core/loadingicon","core/notification","core/pending","core/str","core/local/repository/dynamic_tabs","core_form/changechecker"],(function(_exports,_jquery,_templates,_loadingicon,_notification,_pending,_str,_dynamic_tabs,_changechecker){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} /** * Dynamic Tabs UI element with AJAX loading of tabs content * * @module core/dynamic_tabs * @copyright 2021 David Matamoros based on code from Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_jquery=_interopRequireDefault(_jquery),_templates=_interopRequireDefault(_templates),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending);const SELECTORS={dynamicTabs:".dynamictabs",activeTab:".dynamictabs .nav-link.active",allActiveTabs:'.dynamictabs .nav-link[data-toggle="tab"]:not(.disabled)',tabContent:".dynamictabs .tab-pane [data-tab-content]",tabToggle:'a[data-toggle="tab"]',tabPane:".dynamictabs .tab-pane",forTabName:tabName=>'.dynamictabs [data-tab-content="'.concat(tabName,'"]'),forTabId:tabName=>'.dynamictabs [data-toggle="tab"][href="#'.concat(tabName,'"]')};_exports.init=()=>{const tabToggle=(0,_jquery.default)(SELECTORS.tabToggle);if(tabToggle.on("click",(event=>{(0,_changechecker.isAnyWatchedFormDirty)()&&(event.preventDefault(),event.stopPropagation(),(0,_str.getStrings)([{key:"changesmade",component:"moodle"},{key:"changesmadereallygoaway",component:"moodle"},{key:"confirm",component:"moodle"}]).then((_ref=>{let[strChangesMade,strChangesMadeReally,strConfirm]=_ref;return _notification.default.confirm(strChangesMade,strChangesMadeReally,strConfirm,null,(()=>{(0,_changechecker.resetAllFormDirtyStates)(),(0,_jquery.default)(event.target).trigger(event.type)}))})).catch(_notification.default.exception))})),tabToggle.on("show.bs.tab",(function(){const previousTabName=getActiveTabName();if(previousTabName){document.querySelector(SELECTORS.forTabName(previousTabName)).textContent=""}})).on("shown.bs.tab",(function(){const tab=(0,_jquery.default)((0,_jquery.default)(this).attr("href"));1===tab.length&&loadTab(tab.attr("id"))})),!openTabFromHash()){const tabs=document.querySelector(SELECTORS.allActiveTabs);if(tabs)openTab(tabs.getAttribute("aria-controls"));else{const tabPane=document.querySelector(SELECTORS.tabPane);tabPane&&(tabPane.classList.add("active","show"),loadTab(tabPane.getAttribute("id")))}}};const getActiveTabName=()=>{const element=document.querySelector(SELECTORS.activeTab);return(null==element?void 0:element.getAttribute("aria-controls"))||null},loadTab=tabName=>{var _ref2,_tabName;tabName=null!==(_ref2=null!==(_tabName=tabName)&&void 0!==_tabName?_tabName:getActiveTabName())&&void 0!==_ref2?_ref2:(()=>{const element=document.querySelector(SELECTORS.tabContent);return(null==element?void 0:element.dataset.tabContent)||null})();const tab=document.querySelector(SELECTORS.forTabName(tabName));if(!tab)return;const pendingPromise=new _pending.default("core/dynamic_tabs:loadTab:"+tabName);(0,_loadingicon.addIconToContainer)(tab).then((()=>{let tabArgs={...tab.dataset};return delete tabArgs.tabClass,delete tabArgs.tabContent,(0,_dynamic_tabs.getContent)(tab.dataset.tabClass,JSON.stringify(tabArgs))})).then((response=>Promise.all([_jquery.default.parseHTML(response.javascript,null,!0).map((node=>node.innerHTML)).join("\n"),_templates.default.renderForPromise(response.template,JSON.parse(response.content))]))).then((_ref3=>{let[responseJs,{html:html,js:js}]=_ref3;return _templates.default.replaceNodeContents(tab,html,js+responseJs)})).then((()=>pendingPromise.resolve())).catch(_notification.default.exception)},openTab=tabName=>{const tab=(tabName=>document.querySelector(SELECTORS.forTabId(tabName)))(tabName);return!!tab&&(loadTab(tabName),tab.classList.add("active"),(tabName=>document.getElementById(tabName))(tabName).classList.add("active","show"),!0)},openTabFromHash=()=>{const hash=document.location.hash;return!!hash.match(/^#\w+$/g)&&openTab(hash.replace(/^#/g,""))}})); define("core/edit_switch",["exports","core/ajax","core/event_dispatcher","core/notification"],(function(_exports,_ajax,_event_dispatcher,_notification){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=_exports.eventTypes=void 0; /** * Controls the edit switch. * * @module core/edit_switch * @copyright 2021 Bas Brands * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ const eventTypes={editModeSet:"core/edit_switch/editModeSet"};_exports.eventTypes=eventTypes;const notifyEditModeSet=(container,editMode)=>(0,_event_dispatcher.dispatchEvent)(eventTypes.editModeSet,{editMode:editMode},container,{cancelable:!0});_exports.init=editingSwitchId=>{const editSwitch=document.getElementById(editingSwitchId);editSwitch.addEventListener("change",(()=>{var context,setmode;(context=editSwitch.dataset.context,setmode=editSwitch.checked,(0,_ajax.call)([{methodname:"core_change_editmode",args:{context:context,setmode:setmode}}])[0]).then((result=>{result.success?(editSwitch=>{editSwitch.checked?editSwitch.setAttribute("aria-checked",!0):editSwitch.setAttribute("aria-checked",!1),notifyEditModeSet(editSwitch,editSwitch.checked).defaultPrevented||(editSwitch.setAttribute("disabled",!0),window.location=editSwitch.dataset.pageurl)})(editSwitch):editSwitch.checked=!1})).catch(_notification.exception)}))}})); define("core/event",["exports","core_editor/events","core_filters/events","core_form/events"],(function(_exports,_events,_events2,_events3){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0; /** * Global registry of core events that can be triggered/listened for. * * @module core/event * @copyright 2015 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 3.0 */ const getRenamedLegacyFunction=(oldFunctionName,newModule,newFunctionName,newFunctionRef)=>function(){return window.console.warn("The core/event::".concat(oldFunctionName,"() function has been moved to ").concat(newModule,"::").concat(newFunctionName,". ")+"Please update your code to use the new module."),newFunctionRef(...arguments)};var _default={Events:{FORM_FIELD_VALIDATION:"core_form-field-validation"},notifyEditorContentRestored:getRenamedLegacyFunction("notifyEditorContentRestored","core_editor/events","notifyEditorContentRestored",_events.notifyEditorContentRestored),notifyFilterContentUpdated:getRenamedLegacyFunction("notifyFilterContentUpdated","core_filters/events","notifyFilterContentUpdated",_events2.notifyFilterContentUpdated),notifyFormSubmitAjax:getRenamedLegacyFunction("notifyFormSubmitAjax","core_form/events","notifyFormSubmittedByJavascript",_events3.notifyFormSubmittedByJavascript)};return _exports.default=_default,_exports.default})); 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}})); define("core/fetch",["exports","core/config","./pending"],(function(_exports,_config,_pending){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classStaticPrivateMethodGet(receiver,classConstructor,method){return function(receiver,classConstructor){if(receiver!==classConstructor)throw new TypeError("Private static access of wrong provenance")}(receiver,classConstructor),method}function _classPrivateFieldInitSpec(obj,privateMap,value){!function(obj,privateCollection){if(privateCollection.has(obj))throw new TypeError("Cannot initialize the same private elements twice on an object")}(obj,privateMap),privateMap.set(obj,value)}function _classPrivateFieldGet(receiver,privateMap){return function(receiver,descriptor){if(descriptor.get)return descriptor.get.call(receiver);return descriptor.value}(receiver,_classExtractFieldDescriptor(receiver,privateMap,"get"))}function _classPrivateFieldSet(receiver,privateMap,value){return function(receiver,descriptor,value){if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}}(receiver,_classExtractFieldDescriptor(receiver,privateMap,"set"),value),value}function _classExtractFieldDescriptor(receiver,privateMap,action){if(!privateMap.has(receiver))throw new TypeError("attempted to "+action+" private field on non-instance");return privateMap.get(receiver)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_config=_interopRequireDefault(_config),_pending=_interopRequireDefault(_pending);var _request=new WeakMap,_promise=new WeakMap,_resolve=new WeakMap,_reject=new WeakMap;class RequestWrapper{constructor(request){_classPrivateFieldInitSpec(this,_request,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,_promise,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,_resolve,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,_reject,{writable:!0,value:null}),_classPrivateFieldSet(this,_request,request),_classPrivateFieldSet(this,_promise,new Promise(((resolve,reject)=>{_classPrivateFieldSet(this,_resolve,resolve),_classPrivateFieldSet(this,_reject,reject)})))}get request(){return _classPrivateFieldGet(this,_request)}get promise(){return _classPrivateFieldGet(this,_promise)}handleResponse(response){response.ok?_classPrivateFieldGet(this,_resolve).call(this,response):_classPrivateFieldGet(this,_reject).call(this,response.statusText)}}class Fetch{static async request(component,action){let{params:params={},body:body=null,method:method="GET"}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const pending=new _pending.default("Requesting ".concat(component,"/").concat(action," with ").concat(method)),requestWrapper=_classStaticPrivateMethodGet(Fetch,Fetch,_getRequest).call(Fetch,_classStaticPrivateMethodGet(Fetch,Fetch,_normaliseComponent).call(Fetch,component),action,{params:params,method:method,body:body}),result=await fetch(requestWrapper.request);return pending.resolve(),requestWrapper.handleResponse(result),requestWrapper.promise}static performGet(component,action){let{params:params={}}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(component,action,{params:params,method:"GET"})}static performHead(component,action){let{params:params={}}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(component,action,{params:params,method:"HEAD"})}static performPost(component,action){let{body:body}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(component,action,{body:body,method:"POST"})}static performPut(component,action){let{body:body}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(component,action,{body:body,method:"PUT"})}static performPatch(component,action){let{body:body}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(component,action,{body:body,method:"PATCH"})}static performDelete(component,action){let{params:params={},body:body=null}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.request(component,action,{body:body,params:params,method:"DELETE"})}}function _normaliseComponent(component){return component.replace(/^core_/,"")}function _getRequest(component,endpoint,_ref){let{params:params={},body:body=null,method:method="GET"}=_ref;const url=new URL("".concat(_config.default.apibase,"/rest/v2/").concat(component,"/").concat(endpoint)),options={method:method,headers:{Accept:"application/json","Content-Type":"application/json"}};return Object.entries(params).forEach((_ref2=>{let[key,value]=_ref2;url.searchParams.append(key,value)})),body&&(body instanceof FormData?options.body=body:options.body=body instanceof Object?JSON.stringify(body):body),new RequestWrapper(new Request(url,options))}return _exports.default=Fetch,_exports.default})); define("core/first",["jquery"],(function(_jquery){var obj; /** * This is an empty module, that is required before all other modules. * Because every module is returned from a request for any other module, this * forces the loading of all modules with a single request. * * This function also sets up the listeners for ajax requests so we can tell * if any requests are still in progress. * * @module core/first * @copyright 2015 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 2.9 */(0,(_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj}).default)(document).bind("ajaxStart",(function(){M.util.js_pending("jq")})).bind("ajaxStop",(function(){M.util.js_complete("jq")}))})); /** * 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","core/popper2"],(function($,log,str,templates,notification,LoadingIcon,Aria,FormChangeChecker,Popper){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));index=wrapListIndex(index,selectionElement.children("[aria-selected=true]").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=rebuildOptions(originalSelect.children("option:selected"),!1),newSelection=$(document.getElementById(state.selectionId));if(!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",{bubbles:!0}))},deselectItem=function(options,state,item,originalSelect){var selectedItemValue=$(item).attr("data-value");return void 0!==originalSelect.find("option").first().attr("value")&&originalSelect.prepend($("`) where each draggable element has a drag handle. * The best practice is to use the template core/drag_handle: * $OUTPUT->render_from_template('core/drag_handle', ['movetitle' => get_string('movecontent', 'moodle', ELEMENTNAME)]); * * Attach this JS module to this list: * * Space between define and ( critical in comment but not allowed in code in order to function * correctly with Moodle's requirejs.php * * For the full list of possible parameters see var defaultParameters below. * * The following jQuery events are fired: * - SortableList.EVENTS.DRAGSTART : when user started dragging a list element * - SortableList.EVENTS.DRAG : when user dragged a list element to a new position * - SortableList.EVENTS.DROP : when user dropped a list element * - SortableList.EVENTS.DROPEND : when user finished dragging - either fired right after dropping or * if "Esc" was pressed during dragging * * @example * define (['jquery', 'core/sortable_list'], function($, SortableList) { * var list = new SortableList('ul.my-awesome-list'); // source list (usually
    or
) - selector or element * * // Listen to the events when element is dragged. * $('ul.my-awesome-list > *').on(SortableList.EVENTS.DROP, function(evt, info) { * console.log(info); * }); * * // Advanced usage. Overwrite methods getElementName, getDestinationName, moveDialogueTitle, for example: * list.getElementName = function(element) { * return $.Deferred().resolve(element.attr('data-name')); * } * }); * * @module core/sortable_list * @class core/sortable_list * @copyright 2018 Marina Glancy * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/sortable_list",["jquery","core/log","core/autoscroll","core/str","core/modal_cancel","core/modal_events","core/notification"],(function($,log,autoScroll,str,ModalCancel,ModalEvents,Notification){var defaultParameters={targetListSelector:null,moveHandlerSelector:"[data-drag-type=move]",isHorizontal:!1,autoScroll:!0},CSS_keyboardDragClass="dragdrop-keyboard-drag",CSS_isDraggedClass="sortable-list-is-dragged",CSS_isDroppedClass="sortable-list-is-dropped",CSS_currentPositionClass="sortable-list-current-position",CSS_targetListClass="sortable-list-target",CSS_overElementClass="sortable-list-over-element",registerNotPassiveListeners=function(eventname){return{setup:function(x,ns,handle){return!!ns.includes("notPassive")&&(this.addEventListener(eventname,handle,{passive:!1}),!0)}}};(function(){var options,passivesupported=!1;try{options=Object.defineProperty({},"passive",{get:function(){passivesupported=!0}}),document.addEventListener("testpassiveeventoptions",options,options),document.removeEventListener("testpassiveeventoptions",options,options)}catch(err){passivesupported=!1}return passivesupported})&&($.event.special.touchstart=registerNotPassiveListeners("touchstart"),$.event.special.touchmove=registerNotPassiveListeners("touchmove"),$.event.special.touchend=registerNotPassiveListeners("touchend"));var SortableList=function(root,config){this.info=null,this.proxy=null,this.proxyDelta=null,this.dragCounter=0,this.lastEvent=null,this.config=$.extend({},defaultParameters,config||{}),this.config.listSelector=root,this.config.targetListSelector||(this.config.targetListSelector=root),"object"==typeof this.config.listSelector?$(this.config.listSelector).on("mousedown touchstart.notPassive",$.proxy(this.dragStartHandler,this)):$("body").on("mousedown touchstart.notPassive",this.config.listSelector,$.proxy(this.dragStartHandler,this)),null!==this.config.moveHandlerSelector&&$("body").on("click keypress",this.config.moveHandlerSelector,$.proxy(this.clickHandler,this))};return SortableList.EVENTS={DRAGSTART:"sortablelist-dragstart",DRAG:"sortablelist-drag",DROP:"sortablelist-drop",DRAGEND:"sortablelist-dragend"},SortableList.prototype.resetDraggedClasses=function(){var classes=[CSS_isDraggedClass,CSS_currentPositionClass,CSS_overElementClass,CSS_targetListClass];for(var i in classes)$("."+classes[i]).removeClass(classes[i]);this.proxy&&(this.proxy.remove(),this.proxy=$())},SortableList.prototype.calculatePositionOnPage=function(evt){if(evt.originalEvent&&evt.originalEvent.touches&&void 0!==evt.originalEvent.touches[0]){var touch=evt.originalEvent.touches[0];evt.pageX=touch.pageX,evt.pageY=touch.pageY}void 0===evt.pageX?(evt.pageX=this.lastEvent.pageX,evt.pageY=this.lastEvent.pageY):this.lastEvent=evt,void 0===evt.clientX&&(evt.clientX=Math.round(evt.pageX-$(window).scrollLeft()),evt.clientY=Math.round(evt.pageY-$(window).scrollTop()))},SortableList.prototype.dragStartHandler=function(evt){if(null!==this.info){if("click"===this.info.type||"touchend"===this.info.type)return;this.moveElement(this.info.sourceList,this.info.sourceNextElement),this.finishDragging()}if("mousedown"!==evt.type||1===evt.which){this.calculatePositionOnPage(evt);var movedElement=$(evt.target).closest($(evt.currentTarget).children());if(movedElement.length&&(null===this.config.moveHandlerSelector||$(evt.target).closest(this.config.moveHandlerSelector,movedElement).length)){evt.stopPropagation(),evt.preventDefault(),this.dragCounter++,this.info={element:movedElement,sourceNextElement:movedElement.next(),sourceList:movedElement.parent(),targetNextElement:movedElement.next(),targetList:movedElement.parent(),type:evt.type,dropped:!1,startX:evt.pageX,startY:evt.pageY,startTime:(new Date).getTime()},$(this.config.targetListSelector).addClass(CSS_targetListClass);var offset=movedElement.offset();movedElement.addClass(CSS_currentPositionClass),this.proxyDelta={x:offset.left-evt.pageX,y:offset.top-evt.pageY},this.proxy=$();var thisDragCounter=this.dragCounter;setTimeout($.proxy((function(){null!==this.info&&"click"!==this.info.type&&"keypress"!==this.info.type&&this.dragCounter===thisDragCounter&&this.createProxy()}),this),500),$(window).on("mousemove touchmove.notPassive mouseup touchend.notPassive",$.proxy(this.dragHandler,this)),$(window).on("keypress",$.proxy(this.dragcancelHandler,this)),this.config.autoScroll&&autoScroll.start((function(){$(window).trigger("mousemove")})),this.executeCallback(SortableList.EVENTS.DRAGSTART)}}},SortableList.prototype.createProxy=function(){this.proxy=this.info.element.clone(),this.info.sourceList.append(this.proxy),this.proxy.removeAttr("id").removeClass(CSS_currentPositionClass).addClass(CSS_isDraggedClass).css({position:"fixed"}),this.proxy.offset({top:this.proxyDelta.y+this.lastEvent.pageY,left:this.proxyDelta.x+this.lastEvent.pageX})},SortableList.prototype.clickHandler=function(evt){if(("keypress"!==evt.type||13===evt.originalEvent.keyCode||32===evt.originalEvent.keyCode)&&null===this.info){var clickedElement=$(evt.target).closest(this.config.moveHandlerSelector),sourceList=clickedElement.closest(this.config.listSelector),movedElement=clickedElement.closest(sourceList.children());movedElement.length&&(evt.preventDefault(),evt.stopPropagation(),this.dragCounter++,this.info={element:movedElement,sourceNextElement:movedElement.next(),sourceList:sourceList,targetNextElement:movedElement.next(),targetList:sourceList,dropped:!1,type:evt.type,startTime:(new Date).getTime()},this.executeCallback(SortableList.EVENTS.DRAGSTART),this.displayMoveDialogue(clickedElement))}},SortableList.prototype.getPositionInNode=function(pageX,pageY,element){if(!element.length)return null;var rect=element[0].getBoundingClientRect(),y=pageY-(rect.top+window.scrollY),x=pageX-(rect.left+window.scrollX);return x>=-0&&x<=rect.width+0&&y>=-0&&y<=rect.height+0?{x:x,y:y,xRatio:rect.width?x/rect.width:0,yRatio:rect.height?y/rect.height:0}:null},SortableList.prototype.isListHorizontal=function(element){var isHorizontal=this.config.isHorizontal;return!0===isHorizontal||!1===isHorizontal?isHorizontal:isHorizontal(element)},SortableList.prototype.dragHandler=function(evt){evt.preventDefault(),evt.stopPropagation(),this.calculatePositionOnPage(evt),this.proxy.offset({top:-1e3,left:-1e3});var element=$(document.elementFromPoint(evt.clientX,evt.clientY)),mainElement=this.info.element[0],isNotSelf=function(){return this!==mainElement},current=element.closest("."+CSS_targetListClass+" > :not(."+CSS_isDraggedClass+")").filter(isNotSelf),currentList=element.closest("."+CSS_targetListClass),proxy=this.proxy,isNotProxy=function(){return!proxy||!proxy.length||this!==proxy[0]};if($("."+CSS_overElementClass).removeClass(CSS_overElementClass),current.addClass(CSS_overElementClass),this.proxy.offset({top:this.proxyDelta.y+evt.pageY,left:this.proxyDelta.x+evt.pageX}),currentList.length&&!currentList.children().filter(isNotProxy).length)this.moveElement(currentList,$());else if(1===current.length&&!this.info.element.find(current[0]).length){var coordinates=this.getPositionInNode(evt.pageX,evt.pageY,current);if(coordinates){var parent=current.parent(),ratio=this.isListHorizontal(parent)?coordinates.xRatio:coordinates.yRatio,subList=current.find("."+CSS_targetListClass),subListEmpty=!subList.children().filter(isNotProxy).filter(isNotSelf).length;subList.length&&subListEmpty&&ratio>.2&&ratio<.8?this.moveElement(subList,$()):ratio>.5?this.moveElement(parent,current.next().filter(isNotProxy)):this.moveElement(parent,current)}}if("mouseup"===evt.type||"touchend"===evt.type){this.info.endX=evt.pageX,this.info.endY=evt.pageY,this.info.endTime=(new Date).getTime(),this.info.dropped=!0,this.info.positionChanged=this.hasPositionChanged(this.info);var oldinfo=this.info;this.executeCallback(SortableList.EVENTS.DROP),this.finishDragging(),"touchend"===evt.type&&null!==this.config.moveHandlerSelector&&oldinfo.endTime-oldinfo.startTime<500&&!oldinfo.positionChanged?this.clickHandler(evt):oldinfo.positionChanged&&mainElement.classList.add(CSS_isDroppedClass)}},SortableList.prototype.hasPositionChanged=function(info){return info.sourceList[0]!==info.targetList[0]||info.sourceNextElement.length!==info.targetNextElement.length||info.sourceNextElement.length&&info.sourceNextElement[0]!==info.targetNextElement[0]},SortableList.prototype.moveElement=function(parentElement,beforeElement){var dragEl=this.info.element;beforeElement.length&&beforeElement[0]===dragEl[0]||parentElement[0]===this.info.targetList[0]&&beforeElement.length===this.info.targetNextElement.length&&beforeElement[0]===this.info.targetNextElement[0]||(beforeElement.length?parentElement[0].insertBefore(dragEl[0],beforeElement[0]):this.proxy&&this.proxy.parent().length&&this.proxy.parent()[0]===parentElement[0]?parentElement[0].insertBefore(dragEl[0],this.proxy[0]):parentElement[0].appendChild(dragEl[0]),this.info.targetList=parentElement,this.info.targetNextElement=beforeElement,this.executeCallback(SortableList.EVENTS.DRAG))},SortableList.prototype.finishDragging=function(){this.resetDraggedClasses(),this.config.autoScroll&&autoScroll.stop(),$(window).off("mousemove touchmove.notPassive mouseup touchend.notPassive",$.proxy(this.dragHandler,this)),$(window).off("keypress",$.proxy(this.dragcancelHandler,this)),this.executeCallback(SortableList.EVENTS.DRAGEND),this.info=null},SortableList.prototype.executeCallback=function(eventName){this.info.element.trigger(eventName,this.info)},SortableList.prototype.dragcancelHandler=function(evt){"keypress"===evt.type&&27===evt.originalEvent.keyCode&&(this.moveElement(this.info.sourceList,this.info.sourceNextElement),this.finishDragging())},SortableList.prototype.getElementName=function(element){return $.Deferred().resolve(element.text())},SortableList.prototype.getDestinationName=function(parentElement,afterElement){return afterElement.length?this.getElementName(afterElement).then((function(name){return str.get_string("movecontentafter","moodle",name)})):str.get_string("movecontenttothetop","moodle")},SortableList.prototype.getMoveDialogueTitle=function(element,handler){return handler.attr("title")?$.Deferred().resolve(handler.attr("title")):this.getElementName(element).then((function(name){return str.get_string("movecontent","moodle",name)}))},SortableList.prototype.getDestinationsList=function(){var addedLists=[],targets=$(this.config.targetListSelector),destinations=$("
").text(c.getTitle())),node=$("
")),series.forEach((function(serie){node.append($("").text(serie.getLabel()).attr("scope","col"))})),tbl.append(node);for(var rowId=0;rowId"),labels.length>0&&node.append($("").text(labels[rowId]).attr("scope","row"));for(var serieId=0;serieId").text(value));tbl.append(node)}return tbl},Output.prototype.update=function(){this._build()},Output})); /** * Chart pie. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_pie */ define("core/chart_pie",["core/chart_base"],(function(Base){function Pie(){Base.prototype.constructor.apply(this,arguments)}return Pie.prototype=Object.create(Base.prototype),Pie.prototype.TYPE="pie",Pie.prototype._doughnut=null,Pie.prototype.create=function(Klass,data){var chart=Base.prototype.create.apply(this,arguments);return chart.setDoughnut(data.doughnut),chart},Pie.prototype.addSeries=function(series){if(null===series.getColor()){for(var colors=[],configColorSet=this.getConfigColorSet()||Base.prototype.COLORSET,i=0;i=1)throw new Error("Pie charts only support one serie.");return Base.prototype._validateSeries.apply(this,arguments)},Pie})); /** * Chart series. * * @copyright 2016 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @module core/chart_series */ define("core/chart_series",[],(function(){function Series(label,values){if("string"!=typeof label)throw new Error("Invalid label for series.");if("object"!=typeof values)throw new Error("Values for a series must be an array.");if(values.length<1)throw new Error("Invalid values received for series.");this._colors=[],this._label=label,this._values=values}return Series.prototype.TYPE_DEFAULT=null,Series.prototype.TYPE_LINE="line",Series.prototype._colors=null,Series.prototype._fill=!1,Series.prototype._label=null,Series.prototype._labels=null,Series.prototype._smooth=!1,Series.prototype._type=Series.prototype.TYPE_DEFAULT,Series.prototype._values=null,Series.prototype._xaxis=null,Series.prototype._yaxis=null,Series.prototype.create=function(obj){var s=new Series(obj.label,obj.values);return s.setType(obj.type),s.setXAxis(obj.axes.x),s.setYAxis(obj.axes.y),s.setLabels(obj.labels),obj.colors&&obj.colors.length>1?s.setColors(obj.colors):s.setColor(obj.colors[0]),s.setFill(obj.fill),s.setSmooth(obj.smooth),s},Series.prototype.getColor=function(){return this._colors[0]||null},Series.prototype.getColors=function(){return this._colors},Series.prototype.getCount=function(){return this._values.length},Series.prototype.getFill=function(){return this._fill},Series.prototype.getLabel=function(){return this._label},Series.prototype.getLabels=function(){return this._labels},Series.prototype.getSmooth=function(){return this._smooth},Series.prototype.getType=function(){return this._type},Series.prototype.getValues=function(){return this._values},Series.prototype.getXAxis=function(){return this._xaxis},Series.prototype.getYAxis=function(){return this._yaxis},Series.prototype.hasColoredValues=function(){return this._colors.length==this.getCount()},Series.prototype.setColor=function(color){this._colors=[color]},Series.prototype.setColors=function(colors){if(colors&&colors.length!=this.getCount())throw new Error("When setting multiple colors there must be one per value.");this._colors=colors||[]},Series.prototype.setFill=function(fill){this._fill=void 0===fill?null:fill},Series.prototype.setLabels=function(labels){this._validateLabels(labels),labels=void 0===labels?null:labels,this._labels=labels},Series.prototype.setSmooth=function(smooth){smooth=void 0===smooth?null:smooth,this._smooth=smooth},Series.prototype.setType=function(type){if(type!=this.TYPE_DEFAULT&&type!=this.TYPE_LINE)throw new Error("Invalid serie type.");this._type=type||null},Series.prototype.setXAxis=function(index){this._xaxis=index||null},Series.prototype.setYAxis=function(index){this._yaxis=index||null},Series.prototype._validateLabels=function(labels){if(labels&&labels.length>0&&labels.length!=this.getCount())throw new Error("Series labels must match series values.")},Series})); /** * A module to help with toggle select/deselect all. * * @module core/checkbox-toggleall * @copyright 2019 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define("core/checkbox-toggleall",["jquery","core/pubsub"],(function($,PubSub){var registered=!1,events={checkboxToggled:"core/checkbox-toggleall:checkboxToggled"},getToggleGroupElements=function(root,toggleGroup,exactMatch){return exactMatch?root.find('[data-action="toggle"][data-togglegroup="'+toggleGroup+'"]'):root.find('[data-action="toggle"][data-togglegroup^="'+toggleGroup+'"]')},getAllSlaveCheckboxes=function(root,toggleGroup){return getToggleGroupElements(root,toggleGroup,!1).filter('[data-toggle="slave"]')},getControlCheckboxes=function(root,toggleGroup,exactMatch){return getToggleGroupElements(root,toggleGroup,exactMatch).filter('[data-toggle="master"]')},toggleSlavesFromMasters=function(e){var targetState,root=e.data.root,target=$(e.target),toggleGroupName=target.data("togglegroup");targetState=target.is(":checkbox")?target.is(":checked"):1===target.data("checkall"),toggleSlavesToState(root,toggleGroupName,targetState)},toggleMastersAndActionElements=function(root,toggleGroupName){var toggleGroupSlaves=getAllSlaveCheckboxes(root,toggleGroupName);if(toggleGroupSlaves.length>0){var toggleGroupCheckedSlaves=toggleGroupSlaves.filter(":checked"),targetState=toggleGroupSlaves.length===toggleGroupCheckedSlaves.length;setMasterStates(root,toggleGroupName,targetState,!0),setActionElementStates(root,toggleGroupName,!toggleGroupCheckedSlaves.length)}},getToggleGroupLevels=function(toggleGroupName){var toggleGroups=toggleGroupName.split(" "),toggleGroupLevels=[],toggleGroupLevel="";return toggleGroups.forEach((function(toggleGroupName){toggleGroupLevel+=" "+toggleGroupName,toggleGroupLevels.push(toggleGroupLevel.trim())})),toggleGroupLevels},toggleSlavesToState=function(root,toggleGroupName,targetState){var slaves=getAllSlaveCheckboxes(root,toggleGroupName);slaves.prop("checked",targetState).trigger("change");var checkedSlaves=slaves.filter(":checked");setMasterStates(root,toggleGroupName,targetState,!1),setActionElementStates(root,toggleGroupName,!checkedSlaves.length),getToggleGroupLevels(toggleGroupName).filter((toggleGroupLevel=>toggleGroupLevel!==toggleGroupName)).forEach((function(toggleGroupLevel){toggleMastersAndActionElements(root,toggleGroupLevel)})),PubSub.publish(events.checkboxToggled,{root:root,toggleGroupName:toggleGroupName,slaves:slaves,checkedSlaves:checkedSlaves,anyChecked:targetState})},toggleMastersFromSlaves=function(e){var root=e.data.root,toggleGroupName=$(e.target).data("togglegroup"),slaves=getAllSlaveCheckboxes(root,toggleGroupName),checkedSlaves=slaves.filter(":checked");getToggleGroupLevels(toggleGroupName).forEach((function(toggleGroupLevel){toggleMastersAndActionElements(root,toggleGroupLevel)})),PubSub.publish(events.checkboxToggled,{root:root,toggleGroupName:toggleGroupName,slaves:slaves,checkedSlaves:checkedSlaves,anyChecked:!!checkedSlaves.length})},setActionElementStates=function(root,toggleGroupName,disableActionElements){(function(root,toggleGroup){return getToggleGroupElements(root,toggleGroup,!0).filter('[data-toggle="action"]')})(root,toggleGroupName).prop("disabled",disableActionElements)},setMasterStates=function(root,toggleGroupName,targetState,exactMatch){var masters=getControlCheckboxes(root,toggleGroupName,exactMatch);masters.prop("checked",targetState),masters.each((function(i,masterElement){var targetString;if(masterElement=$(masterElement),targetString=targetState?masterElement.data("toggle-deselectall"):masterElement.data("toggle-selectall"),masterElement.is(":checkbox")){var masterLabel=root.find('[for="'+masterElement.attr("id")+'"]');masterLabel.length&&masterLabel.html()!==targetString&&masterLabel.html(targetString)}else masterElement.text(targetString),masterElement.data("checkall",targetState?0:1)}))};return{init:function(){!function(){if(!registered){registered=!0;var root=$(document.body);root.on("click",'[data-action="toggle"][data-toggle="master"]',{root:root},toggleSlavesFromMasters),root.on("click",'[data-action="toggle"][data-toggle="slave"]',{root:root},toggleMastersFromSlaves)}}()},events:events,setGroupState:function(root,toggleGroupName,targetState){root=$(root),setMasterStates(root,toggleGroupName,targetState,!0),toggleSlavesToState(root,toggleGroupName,targetState)},updateSlavesFromMasterState:function(root,toggleGroupName){root=$(root);var targetState,target=getControlCheckboxes(root,toggleGroupName,!1);targetState=target.is(":checkbox")?target.is(":checked"):1===target.data("checkall"),toggleSlavesToState(root,toggleGroupName,targetState)}}})); define("core/config",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0; /** * Expose the M.cfg global variable. * * @module core/config * @copyright 2015 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since 2.9 */ var _default=M.cfg;return _exports.default=_default,_exports.default})); define("core/copy_to_clipboard",["core/str","core/toast","core/prefetch"],(function(_str,_toast,_prefetch){ /** * A JavaScript module that enhances a button and text container to support copy-to-clipboard functionality. * * This module needs to be loaded by pages/templates/modules that require this functionality. * * To enable copy-to-clipboard functionality, we need a trigger element (usually a button) and a copy target element * (e.g. a div, span, text input, or text area). * * In the trigger element, we need to declare the data-action="copytoclipboard" attribute and set the * data-clipboard-target attribute which is the CSS selector that points to the target element that contains the text * to be copied. * * When the text is successfully copied to the clipboard, a toast message that indicates that the copy operation was a success * will be shown. This success message can be customised by setting the data-clipboard-success-message attribute in the * trigger element. * * @module core/copy_to_clipboard * @copyright 2021 Jun Pataleta * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * * @example
Markup for the trigger and target elements