function _typeof(obj){"@babel/helpers - typeof";return _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},_typeof(obj)}(function(){'use strict';var loaderScript=document.getElementById("amd-loader"),configUrl=loaderScript.getAttribute("data-config"),bundle=loaderScript.getAttribute("data-bundle"),loadController=function(){var controllerOptions={},controllerPath=loaderScript.getAttribute("data-controller"),params=loaderScript.getAttribute("data-params");try{controllerOptions=JSON.parse(params)}catch(err){controllerOptions={}}window.require([controllerPath],function(controller){var startController=function(){window.started||(window.started=!0,controller.start(controllerOptions))};document.addEventListener("readystatechange",startController,!1),"complete"===document.readyState&&startController()})};window.require([configUrl],function(){window.loadBundles||(window.loaded={},window.loadBundles=function(bundles){bundles=bundles||[],bundles=bundles.concat(window.bundles),bundles=bundles.filter(function(item,index){return item&&bundles.indexOf(item)===index&&!0!==window.loaded[item]}),require(bundles,function(){bundles.forEach(function(item){window.loaded[item]=!0}),loadController()})}),bundle||window.bundles&&window.bundles.length?window.loadBundles([bundle]):loadController()})})(),define("loader/bootstrap",function(){}),define("taoClientDiagnostic/tools/fixedDecimals",[],function(){'use strict';return function(value,decimals){var shift=Math.pow(10,Math.abs(decimals||1));return Math.round(+value*shift)/shift||0}}),define("taoClientDiagnostic/tools/stats",["lodash","taoClientDiagnostic/tools/fixedDecimals"],function(_,fixedDecimals){'use strict';var _Mathfloor=Math.floor,_Mathmax=Math.max,_Mathmin=Math.min;function valueGetter(name){return"function"==typeof name?name:function(item){return item&&item[name]||0}}return function(list,fieldName,decimals){var _Mathceil=Math.ceil,_Mathsqrt=Math.sqrt,_NumberMAX_VALUE=Number.MAX_VALUE,getValue=valueGetter(fieldName),values=[],min=_NumberMAX_VALUE,max=0,count=0,sum=_.reduce(list,function(sum,item){if("undefined"!=typeof item){var value=getValue(item);return values.push(value),min=_Mathmin(min,value),max=_Mathmax(max,value),sum+=value,count++,sum}},0),average=sum/(count||1),sum2=values.reduce(function(sum,value){var diff=value-average;return sum+=diff*diff,sum},0),variance=1=step.threshold));i++)feedback=step;feedback&&(status.feedback=_.clone(feedback))}return status}}),define("taoClientDiagnostic/tools/performances/tester",["jquery","lodash","i18n","async","context","helpers","taoClientDiagnostic/tools/stats","taoQtiItem/qtiItem/core/Loader","taoQtiItem/qtiCommonRenderer/renderers/Renderer","taoClientDiagnostic/tools/getConfig","taoClientDiagnostic/tools/getLabels","taoClientDiagnostic/tools/getStatus"],function($,_,__,async,context,helpers,stats,Loader,Renderer,getConfig,getLabels,getStatus){'use strict';var _Mathabs=Math.abs;function loadItem(data,done){var qtiJsonFile="".concat(data.url,"qti.json"),urlTokens=data.url.split("/"),extension=urlTokens[0],fullpath=require.s.contexts._.config.paths[extension],baseUrl=data.url.replace(extension,fullpath),loader=new Loader,renderer=new Renderer({baseUrl:baseUrl});renderer.getAssetManager&&renderer.getAssetManager().setData("baseUrl",baseUrl),require(["json!".concat(qtiJsonFile)],function(itemData){loader.loadItemData(itemData,function(item){renderer.load(function(){var start=window.performance.now();item.setRenderer(this);var $container=$("
").appendTo("body");$container.append(item.render()),item.postRender(),$container.remove();var end=window.performance.now(),result={id:data.id,url:data.url,duration:(end-start)/1000};done(null,result)},this.getLoadedClasses())})})}var _defaultSamples=["taoClientDiagnostic/tools/performances/data/sample1/","taoClientDiagnostic/tools/performances/data/sample2/","taoClientDiagnostic/tools/performances/data/sample3/"],_defaults={id:"performances",optimal:.025,threshold:.25},_thresholds=[{threshold:0,message:__("Very slow performances"),type:"error"},{threshold:33,message:__("Average performances"),type:"warning"},{threshold:66,message:__("Good performances"),type:"success"}],_messages=[{title:__("Workstation performances"),status:__("Checking the performances..."),performancesMin:__("Minimum rendering time"),performancesMax:__("Maximum rendering time"),performancesAverage:__("Average rendering time")}];return function(config){var initConfig=getConfig(config,_defaults),labels=getLabels(_messages,initConfig.level),idx=0,_samples=_.map(!_.isEmpty(initConfig.samples)&&initConfig.samples||_defaultSamples,function(sample){return idx++,{id:"sample"+idx,url:sample,timeout:1e3*initConfig.timeout||30000,nb:initConfig.occurrences||10}});return _samples[0].nb++,{start:function start(done){var _this=this,tests=[];_.forEach(_samples,function(data){for(var cb=_.partial(loadItem,data),iterations=data.nb||1;iterations--;)tests.push(cb)}),async.series(tests,function(err,measures){if(err&&!measures.length)throw err;measures.shift();var results=stats(measures,"duration",2),status=_this.getFeedback(results.average),summary=_this.getSummary(results);done(status,summary,results)})},get labels(){return labels},getSummary:function getSummary(results){return{performancesMin:{message:labels.performancesMin,value:"".concat(results.min," s")},performancesMax:{message:labels.performancesMax,value:"".concat(results.max," s")},performancesAverage:{message:labels.performancesAverage,value:"".concat(results.average," s")}}},getFeedback:function getFeedback(result){var optimal=initConfig.optimal,range=_Mathabs(optimal-initConfig.threshold),status=getStatus(100*((range+optimal-result)/range),_thresholds);return status.title=labels.title,status.id=initConfig.id,status}}}}),define("taoClientDiagnostic/tools/bandwidth/tester",["lodash","i18n","async","context","taoClientDiagnostic/tools/getConfig","taoClientDiagnostic/tools/getLabels","taoClientDiagnostic/tools/stats","taoClientDiagnostic/tools/fixedDecimals","taoClientDiagnostic/tools/getStatus"],function(_,__,async,context,getConfig,getLabels,stats,fixedDecimals,getStatus){'use strict';var _Mathfloor2=Math.floor,_Mathmax4=Math.max;function download(data,cb){var _this2=this;if(data.threshold&&this.bandwidthmaxTestTakers&&(nb=">"+maxTestTakers),status.id=initConfig.id,status.title=labels.title,status.feedback.legend=labels.legend,status.quality.label=nb,stable||(status.feedback.type="warning",status.feedback.message=__("Unstable bandwidth, temporary fluctuations in connection speed may affect test taker experience."),status.feedback.legend=__("Simultaneous test takers under normal connection conditions.")),2",buffer}function program3(depth0,data){var stack1,helper,buffer="";return buffer+="

",(helper=helpers.info)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.info,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"

",buffer}function program5(depth0,data){var stack1,helper,buffer="";return buffer+="

",(helper=helpers.setup)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.setup,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"

",buffer}function program7(depth0,data){var helper,options,buffer="";return buffer+="\n

\n \n \n

\n

\n \n \n

\n ",buffer}function program9(depth0,data){var stack1,buffer="";return buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.validateSchoolName,{hash:{},inverse:self.program(12,program12,data),fn:self.program(10,program10,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",buffer}function program10(depth0,data){var helper,options,buffer="";return buffer+="\n

\n \n \n

\n

\n \n \n

\n ",buffer}function program12(depth0,data){var helper,options,buffer="";return buffer+="\n

\n \n \n

\n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing,self=this;return buffer+="
\n\n

",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"

\n\n
\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.header,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.info,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.setup,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.requireSchoolId,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.requireSchoolName,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
\n\n
\n \n
\n\n
    \n\n
    \n

    \n
    \n\n
    ",buffer})}),define("tpl!taoClientDiagnostic/tools/diagnostic/tpl/result",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var helper,options,buffer="";return buffer+="\n
    \n \n \n
    \n
    \n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,self=this;return buffer+="
  • \n

    ",(helper=helpers.title)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.title,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"

    \n
    \n\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.details,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
  • ",buffer})}),define("tpl!taoClientDiagnostic/tools/diagnostic/tpl/details",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper,buffer="";return buffer+="\n ",(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"",(helper=helpers.value)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.value,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing,self=this;return buffer+="
    \n

    "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Details",options):helperMissing.call(depth0,"__","Details",options)))+"

    \n
    \n \n \n ",stack1=helpers.each.call(depth0,depth0,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n
    \n
    \n
    ",buffer})}),define("tpl!taoClientDiagnostic/tools/diagnostic/tpl/feedback",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper,buffer="";return buffer+="
    ",(helper=helpers.legend)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.legend,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"
    ",buffer}function program3(depth0,data){var stack1,helper,buffer="";return buffer+="
    ",(helper=helpers.customMsg)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.customMsg,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"
    ",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",escapeExpression=this.escapeExpression,self=this;return buffer+="
    \n \n ",(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.legend,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.customMsg,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
    ",buffer})}),define("tpl!taoClientDiagnostic/tools/diagnostic/tpl/quality-bar",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program3(depth0,data){var stack1,helper,buffer="";return buffer+=" title=\"",(helper=helpers.label)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.label,stack1="function"===_typeof(helper)?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\"",buffer}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,buffer="",escapeExpression=this.escapeExpression,self=this;return buffer+="
    \n
    \n
    ",buffer})}),define("css!taoClientDiagnosticCss/diagnostics",[],function(){}),define("taoClientDiagnostic/tools/diagnostic/diagnostic",["jquery","lodash","i18n","async","ui/component","core/logger","core/store","core/request","core/dataProvider/request","ui/dialog/alert","ui/feedback","util/url","taoClientDiagnostic/tools/performances/tester","taoClientDiagnostic/tools/bandwidth/tester","taoClientDiagnostic/tools/upload/tester","taoClientDiagnostic/tools/browser/tester","taoClientDiagnostic/tools/getStatus","taoClientDiagnostic/tools/getConfig","tpl!taoClientDiagnostic/tools/diagnostic/tpl/main","tpl!taoClientDiagnostic/tools/diagnostic/tpl/result","tpl!taoClientDiagnostic/tools/diagnostic/tpl/details","tpl!taoClientDiagnostic/tools/diagnostic/tpl/feedback","tpl!taoClientDiagnostic/tools/diagnostic/tpl/quality-bar","css!taoClientDiagnosticCss/diagnostics"],function($,_,__,async,component,loggerFactory,store,request,requestData,dialogAlert,feedback,urlHelper,performancesTester,bandwidthTester,uploadTester,browserTester,getStatus,getConfig,mainTpl,resultTpl,detailsTpl,feedbackTpl,qualityBarTpl){'use strict';var logger=loggerFactory("taoClientDiagnostic/diagnostic"),_defaults={title:__("System Compatibility"),header:__("This tool will run a number of tests in order to establish how well your current environment is suitable to run the TAO platform."),info:__("Be aware that these tests will take up to several minutes."),button:__("Test system compatibility"),actionStore:"storeData",actionSchool:"schoolName",controller:"DiagnosticChecker",extension:"taoClientDiagnostic",actionDropId:"deleteId",storeAllRuns:!1,configurableText:{}},_thresholds=[{threshold:0,message:__("Your system requires a compatibility update, please contact your system administrator."),type:"error"},{threshold:33,message:__("Your system is not optimal, please contact your system administrator."),type:"warning"},{threshold:66,message:__("Your system is fully compliant."),type:"success"}],diagnostic={changeStatus:function changeStatus(status){return this.is("rendered")&&this.controls.$status.html(status),this},store:function(type,data,done){var config=this.config,url=urlHelper.route(config.actionStore,config.controller,config.extension,config.storeParams);data=_.omit(data,"values"),data.type=type,request({url:url,data:data,method:"POST",noToken:!0}).then(done).catch(function(err){logger.error(err),feedback().error(__("Unable to save the results! Please check your connection.")),done()})},getCustomMsg:function getCustomMsg(key){return this.config.configurableText[key]},addCustomFeedbackMsg:function addCustomFeedbackMsg(status,msg){this.hasFailed(status)&&msg&&(_.isFunction(status.customMsgRenderer)&&(msg=status.customMsgRenderer(msg)),status.feedback=status.feedback||{},status.feedback.customMsg=msg)},hasFailed:function hasFailed(result){return!(result&&result.feedback&&"success"===result.feedback.type)},addResult:function addResult(result){if(this.is("rendered")){result.quality&&result.quality.label&&2