1(()=>{function ChallengeInviteCtrl(utilities,$state,$rootScope,$stateParams){var vm=this,$stateParams=(vm.invitationKey=$stateParams.invitationKey,vm.registerChallengeParticipant=function(){var parameters={};parameters.url="challenges/"+vm.invitationKey+"/accept-invitation/",parameters.method="PATCH",parameters.token=null,parameters.data={first_name:vm.first_name,last_name:vm.last_name,password:vm.password},parameters.callback={onSuccess:function(response){200==response.status&&($state.go("auth.login"),$rootScope.notify("success","You've successfully accepted the challenge invitation."))},onError:function(response){response=response.error;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},{});$stateParams.url="challenges/"+vm.invitationKey+"/accept-invitation/",$stateParams.method="GET",$stateParams.token=null,$stateParams.callback={onSuccess:function(response){vm.data=response.data,200===response.status?(vm.challengeTitle=vm.data.challenge_title,vm.host=vm.data.challenge_host_team_name,vm.email=vm.data.email,vm.userDetails=vm.data.user_details):$state.go("error-404")},onError:function(response){vm.data=response.data,$state.go("error-404"),$rootScope.notify("error",vm.data.error)}},utilities.sendRequest($stateParams)}angular.module("evalai").controller("ChallengeInviteCtrl",ChallengeInviteCtrl),ChallengeInviteCtrl.$inject=["utilities","$state","$rootScope","$stateParams"]})(),(()=>{function SubmissionFilesCtrl(utilities,$rootScope,$state,$stateParams){var vm=this,$stateParams=(vm.bucket=$stateParams.bucket,vm.key=$stateParams.key,utilities.getData("userKey")),parameters={};parameters.url="jobs/submission_files/?bucket="+vm.bucket+"&key="+vm.key,parameters.method="GET",parameters.token=$stateParams,parameters.callback={onSuccess:function(response){vm.data=response.data,200===response.status?window.location.href=vm.data.signed_url:$state.go("error-404")},onError:function(response){vm.data=response.data,$state.go("error-404"),$rootScope.notify("error",vm.data.error)}},utilities.sendRequest(parameters)}angular.module("evalai").controller("SubmissionFilesCtrl",SubmissionFilesCtrl),SubmissionFilesCtrl.$inject=["utilities","$rootScope","$state","$stateParams"]})(),(()=>{function AnalyticsCtrl(utilities,$state,$rootScope){var vm=this,userKey=(vm.hostTeam={},vm.teamId=null,vm.currentTeamName=null,vm.challengeListCount=0,vm.challengeList={},vm.challengeAnalysisDetail={},vm.isTeamSelected=!1,vm.challengeId=null,vm.currentChallengeDetails={},vm.currentPhase=[],vm.totalSubmission={},vm.totalParticipatedTeams={},vm.lastSubmissionTime={},utilities.getData("userKey")),parameters={url:"hosts/challenge_host_team/",method:"GET"};parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.hostTeam=response.data.results)},onError:function(response){var status=response.status;403==status?(vm.error=response.data,utilities.handlePermissionDeniedError($state,response)):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters),parameters.url="challenges/challenge?mode=host",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){var status=response.status,response=response.data;200==status&&(vm.challengeList=response.results,vm.challengeListCount=response.count)},onError:function(response){var status=response.status;403==status?(vm.error=response.data,utilities.handlePermissionDeniedError($state,response)):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters),vm.showChallengeAnalysis=function(){if(null!=vm.challengeId){parameters.url="challenges/challenge/"+vm.challengeId+"/challenge_phase",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){var status=response.status,response=response.data;if(parameters.url="analytics/challenge/"+vm.challengeId+"/team/count",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.totalChallengeTeams=response.data.participant_team_count)},onError:function(response){var status=response.status;403==status?(vm.error=response.data,utilities.handlePermissionDeniedError($state,response)):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters),200===status){vm.currentPhase=response.results;for(var challengePhaseId=[],phaseCount=0;phaseCount<vm.currentPhase.length;phaseCount++)parameters.url="analytics/challenge/"+vm.challengeId+"/challenge_phase/"+vm.currentPhase[phaseCount].id+"/analytics",parameters.method="GET",parameters.token=userKey,challengePhaseId.push(vm.currentPhase[phaseCount].id),parameters.callback={onSuccess:function(response){var status=response.status,details=response.data;if(200==status)for(var i=0;i<challengePhaseId.length;
1i++)if(challengePhaseId[i]==details.challenge_phase){vm.totalSubmission[challengePhaseId[i]]=details.total_submissions,vm.totalParticipatedTeams[challengePhaseId[i]]=details.participant_team_count,i++;break}},onError:function(response){var status=response.status;403==status?(vm.error=response.data,utilities.handlePermissionDeniedError($state,response)):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters);for(phaseCount=0;phaseCount<vm.currentPhase.length;phaseCount++)parameters.url="analytics/challenge/"+vm.challengeId+"/challenge_phase/"+vm.currentPhase[phaseCount].id+"/last_submission_datetime_analysis/",parameters.method="GET",parameters.token=userKey,challengePhaseId.push(vm.currentPhase[phaseCount].id),parameters.callback={onSuccess:function(response){var status=response.status,details=response.data;if(200==status)for(var i=0;i<challengePhaseId.length;i++)if(challengePhaseId[i]==response.data.challenge_phase){vm.lastSubmissionTime[challengePhaseId[i]]=details.last_submission_timestamp_in_challenge_phase,i++;break}},onError:function(response){var status=response.status;403==status?(vm.error=response.data,utilities.handlePermissionDeniedError($state,response)):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters)}},onError:function(response){var status=response.status;403==status?(vm.error=response.data,utilities.handlePermissionDeniedError($state,response)):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters),vm.isTeamSelected=!0;for(var i=0;i<vm.challengeList.length;i++)vm.challengeList[i].id==vm.challengeId&&(vm.currentChallengeDetails=vm.challengeList[i])}else vm.isTeamSelected=!1},vm.downloadChallengeParticipantTeams=function(){parameters.url="analytics/challenges/"+vm.challengeId+"/download_all_participants/",parameters.method="GET",parameters.callback={onSuccess:function(response){response=response.data;angular.element("<a/>").attr({href:"data:attachment/csv;charset=utf-8,"+encodeURIComponent(response),download:"participant_teams_"+vm.challengeId+".csv"})[0].click()},onError:function(response){response=response.data;$rootScope.notify("error",response.error)}},utilities.sendRequest(parameters)}}angular.module("evalai").controller("AnalyticsCtrl",AnalyticsCtrl),AnalyticsCtrl.$inject=["utilities","$state","$rootScope"]})(),(()=>{function AuthCtrl(utilities,$state,$rootScope){var vm=this;vm.showPasswordStrength=!1,vm.isRem=!1,vm.isAuth=!1,vm.isMail=!0,vm.userMail="",vm.regUser={},vm.getUser={},vm.color={},vm.isResetPassword=!1,vm.isFormError=!1,vm.FormError={},vm.redirectUrl={},vm.isLoader=!1,vm.isPassConf=!0,vm.wrnMsg={},vm.isValid={},$rootScope.loaderTitle=vm.confirmMsg="",$rootScope.canShowPassword=!1,$rootScope.canShowConfirmPassword=!1,vm.loginContainer=angular.element(".auth-container"),vm.startLoader=function(msg){$rootScope.isLoader=!0,$rootScope.loaderTitle=msg,vm.loginContainer.addClass("low-screen")},vm.stopLoader=function(){$rootScope.isLoader=!1,$rootScope.loaderTitle="",vm.loginContainer.removeClass("low-screen")},vm.togglePasswordVisibility=function(){$rootScope.canShowPassword=!$rootScope.canShowPassword},vm.toggleConfirmPasswordVisibility=function(){$rootScope.canShowConfirmPassword=!$rootScope.canShowConfirmPassword},vm.resetForm=function(){vm.regUser={},vm.getUser={},vm.wrnMsg={},vm.isFormError=!1,vm.isMail=!0,$rootScope.canShowPassword=!1,$rootScope.canShowConfirmPassword=!1},vm.userSignUp=function(signupFormValid){signupFormValid?(vm.startLoader("Setting up your details!"),(signupFormValid={url:"auth/registration/",method:"POST"}).data={username:vm.regUser.name,password1:vm.regUser.password,password2:vm.regUser.confirm_password,email:vm.regUser.email},signupFormValid.callback={onSuccess:function(response){201==response.status&&(vm.isFormError=!1,$rootScope.notify("success","Registered successfully. Please verify your email address!"),vm.startLoader("Taking you to EvalAI!"),(response={url:"auth/login/",method:"POST"}).data={username:vm.regUser.name,password:vm.regUser.password},response.callback={onSuccess:function(response){200==response.status?(utilities.storeData("userKey",response.data.token),$rootScope.previousState?($state.go($rootScope.previousState),vm.stopLoader()):$state.go("web.dashboard")):alert("Something went wrong")},onError:function(response){if(400==response.status){vm.isFormError=!0;try{void 0!==response.data.non_field_errors&&(vm.FormError=response.data.non_field_errors[0])}catch(error){$rootScope.notify("error",error)}}vm.stopLoader()}},utilities.sendRequest(response,"no-header")),vm.stopLoader()},onError:function(response){if(400==response.status){var non_field_errors,isUsername_val
1id,isEmail_valid,isPassword1_valid,isPassword2_valid;vm.stopLoader(),vm.isFormError=!0;try{non_field_errors=void 0!==response.data.non_field_errors,isUsername_valid=void 0!==response.data.username,isEmail_valid=void 0!==response.data.email,isPassword1_valid=void 0!==response.data.password1,isPassword2_valid=void 0!==response.data.password2,non_field_errors?vm.FormError=response.data.non_field_errors[0]:isUsername_valid?vm.FormError=response.data.username[0]:isEmail_valid?vm.FormError=response.data.email[0]:isPassword1_valid?vm.FormError=response.data.password1[0]:isPassword2_valid&&(vm.FormError=response.data.password2[0])}catch(error){$rootScope.notify("error",error)}}vm.stopLoader()}},utilities.sendRequest(signupFormValid,"no-header")):vm.stopLoader()},vm.setRefreshJWT=function(){var parameters={url:"accounts/user/get_auth_token",method:"GET"};parameters.token=utilities.getData("userKey"),parameters.callback={onSuccess:function(response){200==response.status?utilities.storeData("refreshJWT",response.data.token):alert("Could not fetch Auth Token")},onError:function(response){if(400==response.status){vm.isFormError=!0;try{void 0!==response.data.non_field_errors&&(vm.FormError=response.data.non_field_errors[0])}catch(error){$rootScope.notify("error",error)}}}},utilities.sendRequest(parameters,"header")},vm.userLogin=function(loginFormValid){loginFormValid?(vm.startLoader("Taking you to EvalAI!"),(loginFormValid={url:"auth/login/",method:"POST"}).data={username:vm.getUser.name,password:vm.getUser.password},loginFormValid.callback={onSuccess:function(response){200==response.status?(utilities.storeData("userKey",response.data.token),vm.setRefreshJWT(),$rootScope.previousState?($state.go($rootScope.previousState),vm.stopLoader()):$state.go("web.dashboard")):alert("Something went wrong")},onError:function(response){if(400==response.status){vm.isFormError=!0;try{void 0!==response.data.non_field_errors&&(vm.FormError=response.data.non_field_errors[0])}catch(error){$rootScope.notify("error",error)}}vm.stopLoader()}},utilities.sendRequest(loginFormValid,"no-header")):vm.stopLoader()},vm.checkStrength=function(password){vm.showPasswordStrength=!!password;password=utilities.passwordStrength(password);vm.message=password[0],vm.color=password[1]},vm.verifyEmail=function(){vm.startLoader("Verifying Your Email");var parameters={};parameters.url="auth/registration/account-confirm-email/"+$state.params.email_conf_key+"/",parameters.method="GET",parameters.callback={onSuccess:function(){vm.email_verify_msg="Your email has been verified successfully",vm.stopLoader()},onError:function(){vm.email_verify_msg="Something went wrong!! Please try again.",vm.stopLoader()}},utilities.sendRequest(parameters,"no-header")},vm.resetPassword=function(resetPassFormValid){resetPassFormValid?(vm.startLoader("Sending Mail"),(resetPassFormValid={url:"auth/password/reset/",method:"POST"}).data={email:vm.getUser.email},resetPassFormValid.callback={onSuccess:function(response){vm.isMail=!1,vm.getUser.error=!1,vm.isFormError=!1,vm.deliveredMsg=response.data.success,vm.getUser.email="",vm.stopLoader()},onError:function(response){vm.isFormError=!0,vm.FormError=400==response.status?response.data.details:"Something went wrong. Please try again",vm.stopLoader()}},utilities.sendRequest(resetPassFormValid,"no-header")):vm.stopLoader()},vm.resetPasswordConfirm=function(resetconfirmFormValid){resetconfirmFormValid?(vm.startLoader("Resetting Your Password"),(resetconfirmFormValid={url:"auth/password/reset/confirm/",method:"POST"}).data={new_password1:vm.getUser.new_password1,new_password2:vm.getUser.new_password2,uid:$state.params.user_id,token:$state.params.reset_token},resetconfirmFormValid.callback={onSuccess:function(response){response=response.data;vm.isResetPassword=!0,vm.deliveredMsg=response.detail,vm.stopLoader()},onError:function(response){var token_valid,password1_valid,password2_valid;vm.isFormError=!0;try{token_valid=void 0!==response.data.token,password1_valid=void 0!==response.data.new_password1,password2_valid=void 0!==response.data.new_password2,token_valid?vm.FormError="this link has been already used or expired.":password1_valid?vm.FormError=Object.values(response.data.new_password1).join(" "):password2_valid&&(vm.FormError=Object.values(response.data.new_password2).join(" "))}catch(error){vm.FormError="Something went wrong! Please refresh the page and try again."}vm.stopLoader()}},utilities.sendRequest(resetconfirmFormValid,"no-header")):vm.stopLoader()},$rootScope.$on("$stateChangeStart",function(){vm.resetForm()})}angular.module("evalai").controller("AuthCtrl",AuthCtrl),AuthCtrl.$inject=["utilities","$state","$rootScope"]})(),(()=>{function ChallengeCreateCtrl(utilities,loaderService,$rootScope,$state){var vm=this,userKey=utilities.getData("userKey");vm.hostTeamId=utilities.getData("challengeHostTeamId"),vm.wrnMsg={},vm.isValid={},vm.isFormError=!1,vm.isSyntaxErrorInYamlFile=!1,vm.input_file=null,vm.formError={},vm.syntaxErrorInYamlFile={},vm.isExistLoader=!1,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader=loaderService.startLoader,vm.stopLoader=loaderService.stopLoader,vm.challengeCreate=function(){var parameters,fileVal;vm.hostTeamId?(null!==(fileVal=angular.element(".file-path").val())&&""!==fileVal||(vm.is
1FormError=!0,vm.formError="Please upload file!",vm.stopLoader()),vm.input_file&&(vm.startLoader("create challenge"),(parameters={}).url="challenges/challenge/challenge_host_team/"+vm.hostTeamId+"/zip_upload/",parameters.method="POST",(fileVal=new FormData).append("zip_configuration",vm.input_file),parameters.data=fileVal,parameters.token=userKey,parameters.callback={onSuccess:function(response){utilities.hideLoader();var status=response.status,response=response.data;201===status&&(angular.forEach(angular.element("input[type='file']"),function(inputElem){angular.element(inputElem).val(null)}),angular.element(".file-path").val(null),$rootScope.notify("success",response.success),localStorage.removeItem("challengeHostTeamId"),$state.go("home"))},onError:function(response){utilities.hideLoader();response=response.data;angular.element(".file-path").val(null),vm.isSyntaxErrorInYamlFile=!0,vm.syntaxErrorInYamlFile=response.error,vm.stopLoader()}}),utilities.showLoader(),utilities.sendRequest(parameters,"header","upload")):(angular.element(".file-path").val(null),vm.infoMsg="Please select a challenge host team!",$rootScope.notify("info",vm.infoMsg))}}angular.module("evalai").controller("ChallengeCreateCtrl",ChallengeCreateCtrl),ChallengeCreateCtrl.$inject=["utilities","loaderService","$rootScope","$state"]})(),(()=>{function ChallengeCtrl(utilities,loaderService,$scope,$state,$http,$stateParams,$rootScope,$interval,$mdDialog,moment,$location,$anchorScroll,$timeout){var vm=this,userKey=(vm.areSubmissionsFailing=!1,vm.getAllEntriesTestOption="Include private submissions",vm.showPrivateIds=[],vm.showLeaderboardToggle=!0,vm.challengeId=$stateParams.challengeId,vm.phaseId=null,vm.phaseSplitId=$stateParams.phaseSplitId,vm.input_file=null,vm.fileUrl="",vm.methodName="",vm.methodDesc="",vm.projectUrl="",vm.publicationUrl="",vm.isPublicSubmission=null,vm.isMultiMetricLeaderboardEnabled={},vm.wrnMsg={},vm.page={},vm.isParticipated=!1,vm.isActive=!1,vm.phases={},vm.phaseSplits={},vm.hasPrizes=!1,vm.has_sponsors=!1,vm.orderLeaderboardBy=decodeURIComponent($stateParams.metric),vm.phaseSplitLeaderboardSchema={},vm.submissionMetaAttributes=[],vm.metaAttributesforCurrentSubmission=null,vm.selectedPhaseSplit={},vm.phaseRemainingSubmissions={},vm.phaseRemainingSubmissionsFlags={},vm.phaseRemainingSubmissionsCountdown={},vm.isValid={},vm.submissionVisibility={},vm.baselineStatus={},vm.verifiedStatus={},vm.showUpdate=!1,vm.showLeaderboardUpdate=!1,vm.poller=null,vm.isChallengeHost=!1,vm.isDockerBased=!1,vm.stopLeaderboard=function(){},vm.stopFetchingSubmissions=function(){},vm.currentDate=null,vm.isPublished=!1,vm.approved_by_admin=!1,vm.is_approval_requested=!1,vm.sortColumn="rank",vm.reverseSort=!1,vm.columnIndexSort=0,vm.disableSubmit=!0,vm.initial_ranking={},vm.isExistLoader=!1,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.termsAndConditions=!1,vm.team={},vm.isSubmissionUsingUrl=null,vm.isSubmissionUsingCli=null,vm.isSubmissionUsingFile=null,vm.isRemoteChallenge=!1,vm.allowResumingSubmisisons=!1,vm.allowCancelRunningSubmissions=!1,vm.allowedSubmissionFileTypes=[],vm.currentPhaseAllowedSubmissionFileTypes="",vm.defaultSubmissionMetaAttributes=[],vm.currentSubmissionMetaData=null,vm.currentPhaseMetaAttributesVisibility={},vm.phaseLeaderboardPublic=[],vm.currentPhaseLeaderboardPublic=!1,vm.eligible_to_submit=!1,vm.evaluation_module_error=null,vm.filter_all_submission_by_team_name="",vm.filter_my_submission_by_team_name="",vm.startLoader=loaderService.startLoader,vm.stopLoader=loaderService.stopLoader,utilities.getData("userKey")),timezone=(vm.authToken=userKey,vm.refreshJWT=utilities.getData("refreshJWT"),vm.subErrors={},vm.currentHighlightedLeaderboardEntry=null,vm.isChallengeLeaderboardPrivate=!1,vm.previousPublicSubmissionId=null,vm.queueName=null,vm.workerLogs=[],moment.tz.guess()),gmtOffset=moment().utcOffset(),gmtSign=0<=gmtOffset?"+":"-",gmtHours=Math.abs(Math.floor(gmtOffset/60)),gmtOffset=Math.abs(gmtOffset%60),gmtZone="GMT "+gmtSign+" "+gmtHours+":"+(gmtOffset<10?"0":"")+gmtOffset,parameters=(vm.isStaticCodeUploadChallenge=!1,vm.selectedWorkerResources=[512,1024],vm.workerResourceOptions=[[256,512],[256,1024],[256,2048],[512,1024],[512,2048],[1024,2048]],vm.showBackgroun
1d="local"==utilities.getEnvironment()||"staging"==utilities.getEnvironment(),utilities.showLoader(),vm.scrollToEntryAfterLeaderboardLoads=function(){$timeout(function(){var elementId=$location.absUrl().split("?")[0].split("#")[1];elementId&&($anchorScroll.yOffset=90,$anchorScroll(elementId),$scope.isHighlight=elementId.split("leaderboardrank-")[1])},500)},vm.fetchRefreshJWTToken=function(){var parameters;userKey&&((parameters={url:"accounts/user/get_auth_token",method:"GET"}).token=userKey,parameters.callback={onSuccess:function(response){200==response.status?(utilities.storeData("refreshJWT",response.data.token),vm.refreshJWT=utilities.getData("refreshJWT")):alert("Could not fetch Auth Token")},onError:function(response){if(400==response.status){vm.isFormError=!0;try{void 0!==response.data.non_field_errors&&(vm.FormError=response.data.non_field_errors[0])}catch(error){$rootScope.notify("error",error)}}}},utilities.sendRequest(parameters,"header"))},"string"!=typeof vm.refreshJWT&&vm.fetchRefreshJWTToken(),vm.manageWorker=function(action){parameters.url="challenges/"+vm.challengeId+"/manage_worker/"+action+"/",parameters.method="PUT",parameters.data={},parameters.callback={onSuccess:function(response){response=response.data;"Success"==response.action?$rootScope.notify("success","Worker(s) "+action+"ed succesfully."):$rootScope.notify("error",response.error)},onError:function(response){response=response.data.error;null==response?$rootScope.notify("error","There was an error."):$rootScope.notify("error","There was an error: "+response)}},utilities.sendRequest(parameters)},vm.sendApprovalRequest=function(){parameters.url="challenges/"+vm.challengeId+"/request_approval",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){response=response.data;response.error?$rootScope.notify("error",response.error):(vm.is_approval_requested=!0,$rootScope.notify("success","Request sent successfully."))},onError:function(response){response=response.data.error;response?$rootScope.notify("error","There was an error: "+response):$rootScope.notify("error","There was an error.")}},utilities.sendRequest(parameters)},vm.startLoadingLogs=function(){vm.logs_poller=$interval(function(){vm.evaluation_module_error?(vm.workerLogs=[],vm.workerLogs.push(vm.evaluation_module_error)):(parameters.url="challenges/"+vm.challengeId+"/get_worker_logs/",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){var details=response.data;vm.workerLogs=[];for(var i=0;i<details.logs.length;i++){var localTime,log=details.logs[i],utcTime=log.match(/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\]/);utcTime?(utcTime=utcTime[0].substring(1,20),localTime=new Date(utcTime+"Z").toLocaleString("sv-SE"),utcTime=log.replace(utcTime,localTime),vm.workerLogs.push(utcTime)):vm.workerLogs.push(log)}},onError:function(response){response=response.data.error;vm.workerLogs.push(response)}},utilities.sendRequest(parameters))},5e3)},vm.stopLoadingLogs=function(){$interval.cancel(vm.logs_poller)},vm.highlightSpecificLeaderboardEntry=function(key){key="#"+key,null!=vm.currentHighlightedLeaderboardEntry&&angular.element(vm.currentHighlightedLeaderboardEntry)[0].setAttribute("class",""),angular.element(key)[0].setAttribute("class","highlightLeaderboard"),vm.currentHighlightedLeaderboardEntry=key,$scope.isHighlight=!1},vm.getTeamName=function(challengeId){parameters.url="challenges/"+challengeId+"/participant_team/team_detail",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){response=response.data;vm.participated_team_name=response.team_name,vm.eligible_to_submit=response.approved}},utilities.sendRequest(parameters)},vm.displayDockerSubmissionInstructions=function(isDockerBased,isParticipated){isDockerBased&&1==isParticipated&&vm.eligible_to_submit&&(parameters.url="jobs/"+vm.challengeId+"/remaining_submissions/",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){vm.phaseRemainingSubmissions=response.data;for(var details=vm.phaseRemainingSubmissions.phases,i=0;
1i<details.length;i++)!0===details[i].limits.submission_limit_exceeded?vm.phaseRemainingSubmissionsFlags[details[i].id]="maxExceeded":0<details[i].limits.remaining_submissions_today_count?vm.phaseRemainingSubmissionsFlags[details[i].id]="showSubmissionNumbers":(vm.eachPhase=details[i],vm.phaseRemainingSubmissionsFlags[details[i].id]="showClock",vm.countDownTimer=function(){vm.remainingTime=vm.eachPhase.limits.remaining_time,vm.days=Math.floor(vm.remainingTime/24/60/60),vm.hoursLeft=Math.floor(vm.remainingTime-86400*vm.days),vm.hours=Math.floor(vm.hoursLeft/3600),vm.minutesLeft=Math.floor(vm.hoursLeft-3600*vm.hours),vm.minutes=Math.floor(vm.minutesLeft/60),vm.remainingSeconds=Math.floor(vm.remainingTime%60),vm.remainingSeconds<10&&(vm.remainingSeconds="0"+vm.remainingSeconds),vm.phaseRemainingSubmissionsCountdown[details[i].id]={days:vm.days,hours:vm.hours,minutes:vm.minutes,seconds:vm.remainingSeconds},0===vm.remainingTime?vm.phaseRemainingSubmissionsFlags[details[i].id]="showSubmissionNumbers":vm.remainingSeconds--},setInterval(function(){$rootScope.$apply(vm.countDownTimer)},1e3),vm.countDownTimer());utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response)}},utilities.sendRequest(parameters))},{});parameters.token=null,userKey&&(parameters.token=userKey),parameters.method="GET",parameters.url="challenges/challenge/"+vm.challengeId+"/",parameters.data={},parameters.callback={onSuccess:function(response){var response=response.data,offset=(vm.page=response,new Date(vm.page.start_date).getTimezoneOffset());vm.page.time_zone=moment.tz.zone(timezone).abbr(offset),vm.page.gmt_zone=gmtZone,vm.isActive=response.is_active,vm.isPublished=vm.page.published,vm.isForumEnabled=response.enable_forum,vm.forumURL=response.forum_url,vm.cliVersion=response.cli_version,vm.isRegistrationOpen=response.is_registration_open,vm.approved_by_admin=response.approved_by_admin,vm.is_approval_requested=response.is_approval_requested,vm.isFrozen=response.is_frozen,vm.isRemoteChallenge=response.remote_evaluation,vm.isDockerBased=response.is_docker_based,vm.isStaticCodeUploadChallenge=response.is_static_dataset_code_upload,vm.allowResumingSubmissions=response.allow_resuming_submissions,vm.allowHostCancelSubmissions=response.allow_host_cancel_submissions,vm.allowCancelRunningSubmissions=response.allow_cancel_running_submissions,vm.allowParticipantsResubmissions=response.allow_participants_resubmissions,vm.selectedWorkerResources=[response.worker_cpu_cores,response.worker_memory],vm.manual_participant_approval=response.manual_participant_approval,vm.hasPrizes=response.has_prize,vm.has_sponsors=response.has_sponsors,vm.queueName=response.queue,vm.evaluation_module_error=response.evaluation_module_error,vm.githubRepository=response.github_repository,vm.getTeamName(vm.challengeId),null===vm.page.image&&(vm.page.image="dist/images/logo.png"),vm.prizes=[],vm.hasPrizes&&(parameters.url="challenges/challenge/"+vm.challengeId+"/prizes/",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){vm.prizes=response.data},onError:function(response){response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)),vm.sponsors={},vm.has_sponsors&&(parameters.url="challenges/challenge/"+vm.challengeId+"/sponsors/",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){vm.sponsors=response.data},onError:function(response){response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)),userKey&&(parameters.url="participants/participant_teams/challenges/"+vm.challengeId+"/user",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){var i,details=response.data;for(i in vm.currentDate=details.datetime_now,details.challenge_participant_team_list)if(null!==details.challenge_participant_team_list[i].challenge&&details.challenge_participant_team_list[i].challenge.id==vm.challengeId){vm.isParticipated=!0;break}vm.isChallengeHost=details.is_challenge_host,vm.isParticipated||(vm.team={},vm.teamId=null,vm.existTeam={},vm.currentPage="",vm.isNext="",vm.isPrev="",vm.team.error=!1,parameters.url="participants/participant_team",parameters.method="GET",parameters.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,0===vm.existTeam.count?(vm.showPagination=!1,vm.paginationMsg="No team exists for now. Start by creating a new team!"):(vm.showPagination=!0,vm.paginationMsg=""),utilities.deleteData("emailError"),null===vm.existTeam.next?vm.isNext="disabled":vm.isNext="",null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",null!==vm.existTeam.next?vm.currentPage=vm.existTeam.next.split("page=")[1]-1:vm.currentPage=1,vm.selectExistTeam=function(){vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Teams"),parameters.url="challenges/challenge/"+vm.challengeId+"/participant_team/"+vm.teamId,parameters.method="POST",parameters.callback={onSuccess:function(){vm.isParticipated=!0,$state.go("web.challenge-main.challenge-page.submission"),vm.displayDockerSubmissionInstructions(vm.page.is_docker_based,vm.isParticipated),vm.getTeamName(vm.challengeId),vm.stopLoader()},onError:function(response){response=404==response.status?"Please select a team first!":response.data.error;$rootScope.notify("error",response),vm.stopLoader()}},utilities.sendRequest(parameters)},vm.load=function(url){vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Teams"),null!==url&&$http.get(url,{headers:{Authorization:"Token "+userKey}}).then(function(response){response=response.data;vm.existTeam=response,null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=vm.existTeam.count/10):(vm.isNext="",vm.currentPage=parseInt(vm.existTeam.next.split("page=")[1]-1)),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader()})}),utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest(parameters)),vm.displayDockerSubmissionInstructions(vm.page.is_docker_based,vm.isParticipated),utilities.hideLoader()},onError:function(){utilities.hideLoader()}},utilities.sendRequest(parameters)),utilities.hideLoader()},onError:function(response){response=response.data;$rootScope.notify("error",response.error),$state.go("web.dashboard"),utilities.hideLoader()}},utilities.sendRequest(parameters),vm.toggleParticipation=function(ev,isRegistrationOpen){var participationState,participationModalText=isRegistrationOpen?(participationState="closed","Close participation in the challenge?"):(participationState="opened","Open participation in the challenge?"),participationModalText=$mdDialog.confirm().title(participationModalText).ariaLabel("").targetEvent(ev).ok("Yes, I'm sure").cancel("No");$mdDialog.show(participationModalText).then(function(){var challenge,challengeHostList=utilities.getData("challengeCreator");for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.method="PATCH",parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.data={is_registration_open:!isReg
1istrationOpen},parameters.callback={onSuccess:function(){vm.isRegistrationOpen=!vm.isRegistrationOpen,$rootScope.notify("success","Participation is "+participationState+" successfully")},onError:function(response){response=response.data;$rootScope.notify("error",response.error)}},utilities.sendRequest(parameters)},function(){})},vm.makeSubmission=function(){if(vm.isParticipated&&vm.eligible_to_submit){var fileVal=angular.element(".file-path").val();if(null!==fileVal&&""!==fileVal||null!==vm.fileUrl&&""!==vm.fileUrl){if(!0!==vm.isCurrentSubmissionMetaAttributeValid())return!(vm.subErrors.msg="Please provide input for meta attributes!");vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Making Submission"),vm.input_file,parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission/",parameters.method="POST";fileVal=new FormData;if(vm.isSubmissionUsingUrl){var validExtensions=vm.currentPhaseAllowedSubmissionFileTypes,isUrlValid=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(vm.fileUrl),extension=vm.fileUrl.split(".").pop();if(!isUrlValid||!validExtensions.includes(extension))return vm.stopLoader(),vm.subErrors.msg="Please enter a valid URL which ends in "+validExtensions+" file extension!",!1;fileVal.append("file_url",vm.fileUrl)}else fileVal.append("input_file",vm.input_file);fileVal.append("status","submitting"),fileVal.append("method_name",vm.methodName),fileVal.append("method_description",vm.methodDesc),fileVal.append("project_url",vm.projectUrl),fileVal.append("publication_url",vm.publicationUrl),fileVal.append("submission_metadata",JSON.stringify(vm.metaAttributesforCurrentSubmission)),null!==vm.isPublicSubmission&&fileVal.append("is_public",vm.isPublicSubmission),parameters.data=fileVal,parameters.token=userKey,parameters.callback={onSuccess:function(){angular.forEach(angular.element("input[type='file']"),function(inputElem){angular.element(inputElem).val(null)}),angular.element(".file-path").val(null),vm.phaseId=null,vm.fileUrl="",vm.methodName="",vm.methodDesc="",vm.projectUrl="",vm.publicationUrl="",vm.isPublicSubmission=null,$rootScope.notify("success","Your submission has been recorded succesfully!"),vm.disableSubmit=!0,vm.showSubmissionNumbers=!1,vm.metaAttributesforCurrentSubmission=null,vm.stopLoader()},onError:function(response){var status=response.status,response=response.data;vm.phaseId=null,vm.fileUrl=null,vm.methodName=null,vm.methodDesc=null,vm.projectUrl=null,vm.publicationUrl=null,vm.isPublicSubmission=null,404==status?vm.subErrors.msg="Please select phase!":response.error?vm.subErrors.msg=response.error:vm.subErrors.msg=response.input_file[0],vm.stopLoader()}},utilities.sendRequest(parameters,"header","upload")}else vm.subErrors.msg="Please upload file or enter submission URL!"}},parameters.url="challenges/challenge/"+vm.challengeId+"/challenge_phase",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){var details=response.data;vm.phases=details;for(var i=0;i<details.count;i++)0==details.results[i].is_public&&(vm.phases.results[i].showPrivate=!0);for(var j=0;j<vm.phases.results.length;j++){var offset=new Date(vm.phases.results[j].start_date).getTimezoneOffset();vm.phases.results[j].time_zone=moment.tz.zone(timezone).abbr(offset),vm.phases.results[j].gmt_zone=gmtZone}for(var k=0;k<details.count;k++){var meta_attributes,attributes=null!=details.results[k].submission_meta_attributes||null!=details.results[k].submission_meta_attributes?((attributes=details.results[k].submission_meta_attributes).forEach(function(attribute){"checkbox"==attribute.type?attribute.values=[]:attribute.value=null}),{phaseId:details.results[k].id,attributes:attributes}):{phaseId:details.results[k].id,attributes:null};vm.submissionMetaAttributes.push(attributes),null!=details.results[k].allowed_submission_file_types||null!=details.results[k].allowed_submission_file_types?vm.allowedSubmissionFileTypes.push({phaseId:details.results[k].id,allowedSubmissionFileTypes:details.results[k].allowed_submission_file_types}):vm.allowedSubmissionFileTypes.push({phaseId:details.results[k].id,allowedSubmissionFileTypes:".json, .zip, .txt, .tsv, .gz, .csv, .h5, .npy"}),null!=details.results[k].default_submission_meta_attributes&&null!=details.results[k].default_submission_meta_attributes?(meta_attributes=details.results[k].default_submission_meta_attributes,meta_attributes=vm.getDefaultMetaAttributesDict(meta_attributes),vm.defaultSubmissionMetaAttributes.push({phaseId:details.results[k].id,defaultAttributes:meta_attributes})):vm.defaultSubmissionMetaAttributes.push({phaseId:details.results[k].id,defaultAttributes:{}}),vm.phaseLeaderboardPublic.push({phaseId:details.results[k].id,leaderboardPublic:detail
1s.results[k].leaderboard_public})}utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest(parameters),vm.loadPhaseAttributes=function(phaseId){vm.metaAttributesforCurrentSubmission=vm.submissionMetaAttributes.find(function(element){return element.phaseId==phaseId}).attributes,vm.currentPhaseAllowedSubmissionFileTypes=vm.allowedSubmissionFileTypes.find(function(element){return element.phaseId==phaseId}).allowedSubmissionFileTypes,vm.currentPhaseMetaAttributesVisibility=vm.defaultSubmissionMetaAttributes.find(function(element){return element.phaseId==phaseId}).defaultAttributes,vm.currentPhaseLeaderboardPublic=vm.phaseLeaderboardPublic.find(function(element){return element.phaseId==phaseId}).leaderboardPublic,vm.subErrors.msg=""},vm.getDefaultMetaAttributesDict=function(defaultMetaAttributes){var defaultMetaAttributesDict={};return null!=defaultMetaAttributes&&defaultMetaAttributes.forEach(function(attribute){var attributeName=attribute.name;defaultMetaAttributesDict[attributeName]=attribute.is_visible}),defaultMetaAttributesDict},vm.clearMetaAttributeValues=function(){null!=vm.metaAttributesforCurrentSubmission&&vm.metaAttributesforCurrentSubmission.forEach(function(attribute){"checkbox"==attribute.type?attribute.values=[]:attribute.value=null})},vm.isCurrentSubmissionMetaAttributeValid=function(){var isMetaAttributeValid=!0;return null!==vm.metaAttributesforCurrentSubmission&&vm.metaAttributesforCurrentSubmission.forEach(function(attribute){1==attribute.required&&("checkbox"==attribute.type?0===attribute.values.length&&(isMetaAttributeValid=!1):null==attribute.value&&(isMetaAttributeValid=!1))}),isMetaAttributeValid},vm.toggleSelection=function(attribute,value){var idx=attribute.values.indexOf(value);-1<idx?attribute.values.splice(idx,1):attribute.values.push(value)};var challengePhaseVisibility_public=3;parameters.url="challenges/"+vm.challengeId+"/challenge_phase_split",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){var details=response.data;0==(vm.phaseSplits=details).length&&(vm.isChallengeLeaderboardPrivate=!0);for(var i=0;i<details.length;i++)details[i].visibility!==challengePhaseVisibility_public&&(vm.phaseSplits[i].showPrivate=!0,vm.showPrivateIds.push(vm.phaseSplits[i].id)),vm.isMultiMetricLeaderboardEnabled[vm.phaseSplits[i].id]=vm.phaseSplits[i].is_multi_metric_leaderboard,vm.phaseSplitLeaderboardSchema[vm.phaseSplits[i].id]=vm.phaseSplits[i].leaderboard_schema;utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest(parameters),vm.lastKey=null,vm.sortFunction=function(key){return"date"===vm.sortColumn?Date.parse(key.submission__submitted_at_formatted):"rank"===vm.sortColumn?vm.initial_ranking[key.id]:"number"===vm.sortColumn?parseFloat(key.result[vm.columnIndexSort]):"string"===vm.sortColumn?key.submission__participant_team__team_name:"exec"==vm.sortColumn?key.submission__execution_time:0},vm.sortLeaderboard=function(scope,column,index){null==index?scope.reverseSort=scope.sortColumn==column&&!scope.reverseSort:(scope.reverseSort=scope.sortColumn==column&&scope.columnIndexSort==index&&!scope.reverseSort,scope.columnIndexSort=index),scope.sortColumn=column},vm.isMetricOrderedAscending=function(metric){var metadata=vm.leaderboard[0].leaderboard__schema.metadata;return null!=metadata&&null!=metadata[metric]&&metadata[metric].sort_ascending},vm.getLabelDescription=function(metric){var metadata=vm.leaderboard[0].leaderboard__schema.metadata;return null==metadata||null==metadata[metric]||null==metadata[metric].description?"":metadata[metric].description},vm.isResult=!1,vm.startLeaderboard=function(){vm.stopLeaderboard(),vm.poller=$interval(function(){parameters.url="jobs/challenge_phase_split/"+vm.phaseSplitId+"/leaderboard/?page_size=1000&order_by="+vm.orderLeaderboardBy,parameters.method="GET",parameters.callback={onSuccess:function(response){response=response.data;vm.leaderboard.count!==response.results.count&&(vm.showLeaderboardUpdate=!0)},onError:function(response){utilities.handlePermissionDeniedError($state,response),vm.stopLoader()}},utilities.sendRequest(parameters)},1e4)},vm.getLeaderboard=function(phaseSplitId){vm.stopLeaderboard=function(){$interval.cancel(vm.poller)},vm.stopLeaderboard(),vm.isResult=!0,vm.phaseSplitId=phaseSplitId,vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Leaderboard Items"),parameters.url="challenges/challenge/create/challenge_phase_split/"+vm.phaseSplitId+"/",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){vm.selectedPhaseSplit=response.data,vm.sortLeaderboardTextOption=vm.selectedPhaseSplit.show_leaderboard_by_latest_submission?"Sort by best":"Sort by latest",!1===vm.selectedPhaseSplit.show_scores_on_leaderboard&&(vm.chosenMetrics=[])},onError:function(response){response=response.data;return vm.stopLoader(),$rootScope.notify("error",response),!1}},utilities.sendRequest(parameters),vm.leaderboard={},parameters.url="jobs/challenge_phase_split/"+vm.phaseSplitId+"/leaderboard/?page_size=1000&order_by="+vm.orderLeaderboardBy,parameters.method="GET",parameters.callback={onSuccess:function(response){response=response.data;vm.leaderboard=response.results;for(var j=0;j<vm.showPrivateIds.length;j++)if(vm.showPrivateIds[j]==vm.phaseSplitId){vm.showLeaderboardToggle=!1;break}vm.updateSubmissionMetaAttributesVisibility();for(var i=0;i<vm.leaderboard.length;i++){var leaderboardLabels=vm.leaderboard[i].leaderboard__schema.labels,defaultOrderBy=vm.leaderboard[i].leaderboard__schema.default_order_by,defaultOrderBy=(-1===leaderboardLabels.indexOf(vm.orderLeaderboardBy)&&defaultOrderBy&&(vm.orderLeaderboardBy=defaultOrderBy),vm.selectedPhaseSplit&&!1===vm.selectedPhaseSplit.show_scores_on_leaderboard?vm.chosenMetrics=[]:vm.chosenMetrics=leaderboardLabels.map(function(_,idx){return idx.toString()}),vm.leaderboard[i].submission__submitted_at_formatted=vm.leaderboard[i].submission__submitted_at,vm.initial_ranking[vm.leaderboard[i].id]=i+1,moment(new Date)),leaderboardLabels=moment(vm.leaderboard[i].submission__submitted_at),defaultOrderBy=moment.duration(defaultOrderBy.diff(leaderboardLabels));0!=defaultOrderBy._data.years?(leaderboardLabels=defaultOrderBy.asYears(),1==(vm.leaderboard[i].submission__submitted_at=leaderboardLabels).toFixed(0)?vm.leaderboard[i].timeSpan="year":vm.leaderboard[i].timeSpan="years"):0!=defaultOrderBy._data.months?(leaderboardLabels=defaultOrderBy.months(),1==(vm.leaderboard[i].submission__submitted_at=leaderboardLabels).toFixed(0)?vm.leaderboard[i].timeSpan="month":vm.leaderboard[i].timeSpan="months"):0!=defaultOrderBy._data.days?(leaderboardLabels=defaultOrderBy.asDays(),1==(vm.leaderboard[i].submission__submitted_at=leaderboardLabels).toFixed(0)?vm.leaderboard[i].timeSpan="day":vm.leaderboard[i].timeSpan="days"):0!=defaultOrderBy._data.hours?(leaderboardLabels=defaultOrderBy.asHours(),1==(vm.leaderboard[i].submission__submitted_at=leaderboardLabels).toFixed(0)?vm.leaderboard[i].timeSpan="hour":vm.leaderboard[i].timeSpan="hours"):0!=defaultOrderBy._data.minutes?(leaderboardLabels=defaultOrderBy.asMinutes(),1==(vm.leaderboard[i].submission__submitted_at=leaderboardLabels).toFixed(0)?vm.leaderboard[i].timeSpan="minute":vm.leaderboard[i].timeSpan="minutes"):0!=defaultOrderBy._data.seconds&&(leaderboardLabels=defaultOrderBy.asSeconds(),1==(vm.leaderboard[i].submission__submitted_at=leaderboardLabels).toFixed(0)?vm.leaderboard[i].timeSpan="second":vm.leaderboard[i].timeSpan="seconds")}vm.phaseName=vm.phaseSplitId,vm.startLeaderboard(),vm.stopLoader(),vm.scrollToEntryAfterLeaderboardLoads()},onError:function(response){response=response.data;vm.leaderboard.error=response,vm.stopLoader()}},utilities.sendRequest(parameters)},vm.hasSubmissionMetaAttributes=function(attributes){return Array.isArray(attributes)&&0<attributes.length},vm.updateSubmissionMetaAttributesVisibility=function(){vm.showSubmissionMetaAttributesOnLeaderboard=Array.isArray(vm.leaderboard)&&vm.leaderboard.some(function(entry){return vm.hasSubmissionMetaAttributes(entry.submission__submission_metadata)})},vm.showMetaAttributesDialog=function(ev,attributes){vm.hasSubmissionMetaAttributes(attributes)?(vm.metaAttributesData=[],attributes.forEac
1h(function(attribute){"checkbox"!=attribute.type?vm.metaAttributesData.push({name:attribute.name,value:attribute.value}):vm.metaAttributesData.push({name:attribute.name,values:attribute.values})}),$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"src/views/web/challenge/submission-meta-attributes-dialog.html",clickOutsideToClose:!0})):$mdDialog.hide()},vm.getResults=function(phaseId){vm.start=function(){vm.stopFetchingSubmissions(),vm.poller=$interval(function(){parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission/?page="+Math.ceil(vm.currentPage),parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){for(var details=response.data,i=0;i<details.results.length;i++)vm.submissionVisibility[details.results[i].id]=details.results[i].is_public,vm.baselineStatus[details.results[i].id]=details.results[i].is_baseline,vm.verifiedStatus[details.results[i].id]=details.results[i].is_verified_by_host;if(vm.submissionResult.results.length!==details.results.length)vm.showUpdate=!0;else for(i=0;i<details.results.length;i++)if(details.results[i].status!==vm.submissionResult.results[i].status){vm.showUpdate=!0;break}},onError:function(response){utilities.handlePermissionDeniedError($state,response),vm.stopLoader()}},utilities.sendRequest(parameters)},1e4)},vm.stopFetchingSubmissions=function(){$interval.cancel(vm.poller)},vm.stopFetchingSubmissions(),vm.isResult=!0,void 0!==phaseId&&(vm.phaseId=phaseId);for(var all_phases=vm.phases.results,i=0;i<vm.phases.results.length;i++)if(all_phases[i].id==phaseId){vm.currentPhaseLeaderboardPublic=all_phases[i].leaderboard_public,vm.isCurrentPhaseRestrictedToSelectOneSubmission=all_phases[i].is_restricted_to_select_one_submission;var attributes=all_phases[i].default_submission_meta_attributes,attributes=vm.getDefaultMetaAttributesDict(attributes);vm.currentPhaseMetaAttributesVisibility=attributes;break}parameters.url="analytics/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/count",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){response=response.data;vm.submissionCount=response.participant_team_submission_count},onError:function(response){response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters),vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Submissions"),vm.isNext="",vm.isPrev="",vm.currentPage="",vm.showPagination=!1,""===vm.filter_my_submission_by_team_name?parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission/":parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission?participant_team__team_name="+vm.filter_my_submission_by_team_name,parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){for(var details=response.data,i=0;i<details.results.length;i++)vm.submissionVisibility[details.results[i].id]=details.results[i].is_public,vm.baselineStatus[details.results[i].id]=details.results[i].is_baseline,vm.verifiedStatus[details.results[i].id]=details.results[i].is_verified_by_host,details.results[i].is_public&&(vm.previousPublicSubmissionId=details.results[i].id);vm.submissionResult=details,vm.start(),0===vm.submissionResult.count?(vm.showPagination=!1,vm.paginationMsg="No results found"):(vm.showPagination=!0,vm.paginationMsg=""),null===vm.submissionResult.next?vm.isNext="disabled":vm.isNext="",null===vm.submissionResult.previous?vm.isPrev="disabled":vm.isPrev="",null!==vm.submissionResult.next?vm.currentPage=vm.submissionResult.next.split("page=")[1]-1:vm.currentPage=1,vm.currentRefPage=Math.ceil(vm.currentPage),vm.load=function(url){vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Submissions"),null!==url?$http.get(url,{headers:{Authorization:"Token "+userKey}}).then(function(response){response=response.data;vm.submissionResult=response,null===vm.submissionResult.next?(vm.isNext="disabled",vm.currentPage=vm.submissionResult.count/150):(vm.isNext="",vm.currentPage=parseInt(vm.submissionResult.next.split("page=")[1]-1)),vm.currentRefPage=Math.ceil(vm.currentPage),null===vm.submissionResult.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader()}):vm.stopLoader()},vm.stopLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),vm.stopLoader()}},utilities.sendRequest(parameters)},vm.refreshSubmissionData=function(){vm.isResult||(vm.isNext="",vm.isPrev="",vm.currentPage="",vm.currentRefPage="",vm.showPagination=!1),vm.startLoader("Loading Submissions"),vm.submissionResult={},parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission/?page="+Math.ceil(vm.currentPage),parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){var details=response.data;vm.submissionResult=details,0===vm.submissionResult.count?(vm.showPagination=!1,vm.paginationMsg="No results found"):(vm.showPagination=!0,vm.paginationMsg=""),null===vm.submissionResult.next?vm.isNext="disabled":vm.isNext="",null===vm.submissionResult.previous?vm.isPrev="disabled":vm.isPrev="",null!==vm.submissionResult.next?vm.currentPage=vm.submissionResult.next.split("page=")[1]-1:vm.currentPage=1,vm.currentRefPage=Math.ceil(vm.currentPage);for(var i=0;
1i<details.results.length;i++)vm.submissionVisibility[details.results[i].id]=details.results[i].is_public,vm.baselineStatus[details.results[i].id]=details.results[i].is_baseline,vm.verifiedStatus[details.results[i].id]=details.results[i].is_verified_by_host;vm.submissionResult=details,vm.showUpdate=!1,vm.stopLoader()},onError:function(){vm.stopLoader()}},utilities.sendRequest(parameters)},vm.reRunSubmission=function(submissionObject){submissionObject.classList=["spin","progress-indicator"],parameters.url="jobs/submissions/"+submissionObject.id+"/re-run/",parameters.method="POST",parameters.token=userKey,parameters.callback={onSuccess:function(response){$rootScope.notify("success",response.data.success),submissionObject.classList=[""]},onError:function(response){response=response.data;$rootScope.notify("error",response),submissionObject.classList=[""]}},utilities.sendRequest(parameters)},vm.resumeSubmission=function(submissionObject){submissionObject.classList2=["progress-indicator"],parameters.url="jobs/submissions/"+submissionObject.id+"/resume/",parameters.method="POST",parameters.token=userKey,parameters.callback={onSuccess:function(response){$rootScope.notify("success",response.data.success),submissionObject.classList2=[""]},onError:function(response){response=response.data;$rootScope.notify("error",response),submissionObject.classList2=[""]}},utilities.sendRequest(parameters)},vm.refreshLeaderboard=function(){vm.startLoader("Loading Leaderboard Items"),vm.leaderboard={},parameters.url="jobs/challenge_phase_split/"+vm.phaseSplitId+"/leaderboard/?page_size=1000&order_by="+vm.orderLeaderboardBy,parameters.method="GET",parameters.callback={onSuccess:function(response){response=response.data;vm.leaderboard=response.results,vm.updateSubmissionMetaAttributesVisibility(),vm.startLeaderboard(),vm.stopLoader()},onError:function(response){response=response.data;vm.leaderboard.error=response,vm.stopLoader()}},utilities.sendRequest(parameters)},vm.toggleShowLeaderboardByLatest=function(){parameters.url="challenges/challenge/create/challenge_phase_split/"+vm.phaseSplitId+"/",parameters.method="PATCH",parameters.data={show_leaderboard_by_latest_submission:!vm.selectedPhaseSplit.show_leaderboard_by_latest_submission},parameters.callback={onSuccess:function(response){vm.selectedPhaseSplit=response.data,vm.getLeaderboard(vm.selectedPhaseSplit.id),vm.sortLeaderboardTextOption=vm.selectedPhaseSplit.show_leaderboard_by_latest_submission?"Sort by best":"Sort by latest"},onError:function(response){response=response.data;return vm.stopLoader(),$rootScope.notify("error",response),!1}},utilities.sendRequest(parameters)},vm.getAllEntriesOnPublicLeaderboard=function(phaseSplitId){vm.stopLeaderboard=function(){$interval.cancel(vm.poller)},vm.stopLeaderboard(),vm.isResult=!0,vm.phaseSplitId=phaseSplitId,vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Leaderboard Items"),vm.leaderboard={},parameters.url="jobs/phase_split/"+vm.phaseSplitId+"/public_leaderboard_all_entries/?page_size=1000&order_by="+vm.orderLeaderboardBy,parameters.method="GET",parameters.callback={onSuccess:function(response){response=response.data;vm.leaderboard=response.results,vm.updateSubmissionMetaAttributesVisibility();for(var i=0;i<vm.leaderboard.length;i++){vm.leaderboard[i].submission__submitted_at_formatted=vm.leaderboard[i].submission__submitted_at,vm.initial_ranking[vm.leaderboard[i].id]=i+1;var dateTimeNow=moment(new Date),submissionTime=moment(vm.leaderboard[i].submission__submitted_at),dateTimeNow=moment.duration(dateTimeNow.diff(submissionTime));0!=dateTimeNow._data.years?(submissionTime=dateTimeNow.asYears(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="year":vm.leaderboard[i].timeSpan="years"):0!=dateTimeNow._data.months?(submissionTime=dateTimeNow.months(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="month":vm.leaderboard[i].timeSpan="months"):0!=dateTimeNow._data.days?(submissionTime=dateTimeNow.asDays(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="day":vm.leaderboard[i].timeSpan="days"):0!=dateTimeNow._data.hours?(submissionTime=dateTimeNow.asHours(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="hour":vm.leaderboard[i].timeSpan="hours"):0!=dateTimeNow._data.minutes?(submissionTime=dateTimeNow.asMinutes(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="minute":vm.leaderboard[i].timeSpan="minutes"):0!=dateTimeNow._data.seconds&&(submissionTime=dateTimeNow.asSeconds(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="second":vm.leaderboard[i].timeSpan="seconds")}vm.phaseName=vm.phaseSplitId,vm.startLeaderboard(),vm.stopLoader(),vm.scrollToEntryAfterLeaderboardLoads()},onError:function(response){response=response.data;vm.leaderboard.error=response,vm.stopLoader()}},utilities.sendRequest(parameters)},vm.phaseSplitId&&vm.getLeaderboard(vm.phaseSplitId),vm.getAllEntries=!1,vm.toggleLeaderboard=function(getAllEntries){vm.getAllEntries=getAllEntries,vm.phaseSplitId&&(vm.getAllEntries?(vm.getAllEntriesTestOption="Exclude private submissions",vm.getAllEntriesOnPublicLeaderboard(vm.phaseSplitId)):(vm.getAllEntriesTestOption="Include private submissions",vm.getLeaderboard(vm.phaseSplitId)))},vm.createNewTeam=function(){vm.isLoader=!0,vm.loaderTitle="",vm.newContainer=angular.element(".new-team-card"),vm.startLoader("Loading Teams"),parameters.url="participants/participant_team",parameters.method="POST",parameters.data={team_name:vm.team.name,team_url:vm.team.url},parameters.callback={onSuccess:function(){$rootScope.notify("success","Team "+vm.team.name+" has been created successfully!"),vm.team.error=!1,vm.stopLoader(),vm.team={},vm.startLoader("Loading Teams"),parameters.url="participants/participant_team",parameters.method="GET",parameters.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,vm.showPagination=!0,vm.paginationMsg="",null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=1):(vm.isNext="",vm.currentPage=vm.existTeam.next.split("page=")[1]-1),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader())},onError:function(){vm.stopLoader()}},utilities.sendRequest(parameters)},onError:function(response){response=response.data;vm.team.error=response.team_name[0],vm.stopLoader(),$rootScope.notify("error","New team couldn't be created.")}},utilities.sendRequest(parameters)},vm.setWorkerResources=function(){parameters.url="challenges/"+vm.challengeId+"/scale_resources/",parameters.method="PUT",parameters.data={worker_cpu_cores:vm.selectedWorkerResources[0],worker_memory:vm.selectedWorkerResources[1]},parameters.callback={onSuccess:function(response){$rootScope.notify("success",response.data.Success),vm.team.error=!1,vm.stopLoader(),vm.team={}},onError:function(response){vm.team.error=!0,vm.stopLoader();let requestError="";requestError="string"==typeof response.data?response.data:response.data.error,$rootScope.notify("error","Error scaling evaluation worker resources: "+requestError)}},utilities.sendRequest(parameters)},vm.getAllSubmissionResults=function(phaseId){vm.stopFetchingSubmissions=function(){$interval.cancel(vm.poller)},vm.stopFetchingSubmissions(),vm.isResult=!0,void 0!==phaseId&&(vm.phaseId=phaseId),vm.startLoader=loaderService.startLoader,vm.startLoader("Loading Submissions"),vm.isNext="",vm.isPrev="",vm.currentPage="",vm.showPagination=!1,""===vm.filter_all_submission_by_team_name?parameters.url="challenges/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submissions":parameters.url="challenges/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submissions?participant_team__team_name="+vm.filter_all_submission_by_team_name,parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){var details=response.data;if(vm.submissionResult=details,Array.isArray(vm.submissionResult.results))for(var i=0;
1i<details.results.length;i++)vm.submissionVisibility[details.results[i].id]=details.results[i].is_public,vm.verifiedStatus[details.results[i].id]=details.results[i].is_verified_by_host;0===vm.submissionResult.count?(vm.showPagination=!1,vm.paginationMsg="No results found"):(vm.showPagination=!0,vm.paginationMsg=""),null===vm.submissionResult.next?vm.isNext="disabled":vm.isNext="",null===vm.submissionResult.previous?vm.isPrev="disabled":vm.isPrev="",null!==vm.submissionResult.next?vm.currentPage=vm.submissionResult.next.split("page=")[1]-1:vm.currentPage=1,vm.currentRefPage=Math.ceil(vm.currentPage),vm.load=function(url){vm.startLoader=loaderService.startLoader,vm.startLoader("Loading Submissions"),null!==url?$http.get(url,{headers:{Authorization:"Token "+userKey}}).then(function(response){response=response.data;vm.submissionResult=response,null===vm.submissionResult.next?(vm.isNext="disabled",vm.currentPage=vm.submissionResult.count/150):(vm.isNext="",vm.currentPage=parseInt(vm.submissionResult.next.split("page=")[1]-1)),vm.currentRefPage=Math.ceil(vm.currentPage),null===vm.submissionResult.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader()}):vm.stopLoader()},vm.stopLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),vm.stopLoader()}},utilities.sendRequest(parameters)},vm.changeSubmissionVisibility=function(submission_id,submissionVisibility){parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission/"+submission_id,parameters.method="PATCH",parameters.data={is_public:submissionVisibility},parameters.callback={onSuccess:function(response){var message="";200===response.status&&(message=1==response.data.is_public?"The submission is made public.":"The submission is made private.",$rootScope.notify("success",message),vm.isCurrentPhaseRestrictedToSelectOneSubmission)&&($mdDialog.hide(),vm.previousPublicSubmissionId!=submission_id?(vm.submissionVisibility[vm.previousPublicSubmissionId]=!1,vm.previousPublicSubmissionId=submission_id):vm.previousPublicSubmissionId=null,vm.submissionVisibility[submission_id]=submissionVisibility)},onError:function(response){var error=response.data,response=response.status;400!==response&&403!==response||$rootScope.notify("error",error.error),vm.isCurrentPhaseRestrictedToSelectOneSubmission&&($mdDialog.hide(),vm.submissionVisibility[submission_id]=!vm.submissionVisibility[submission_id])}},utilities.sendRequest(parameters)},vm.activateCollapsible=function(){angular.element(".collapsible").collapsible()},vm.team_approval_list=function(){var parameters={};parameters.token=utilities.getData("userKey"),parameters.url="challenges/challenge/"+$stateParams.challengeId+"/get_participant_teams",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){vm.approved_teams=response.data,vm.activateCollapsible()},onError:function(){$rootScope.notify("error","Some error occured.Please try again.")}},utilities.sendRequest(parameters)},vm.showapprovalparticipantteamDialog=function(challengeId,participant_team_id,approved_status){approved_status?(vm.dialog={},vm.dialog.challengeId=challengeId,vm.dialog.participant_team_id=participant_team_id,vm.dialog.approved_status=approved_status,$mdDialog.show({scope:$scope,preserveScope:!0,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-approvalConfirm.html"})):vm.check_approval_status(challengeId,participant_team_id,approved_status,!1)},vm.check_approval_status=function(challengeId,participant_team_id,approved_status,formvalid){var parameters={};parameters.token=utilities.getData("userKey"),parameters.method="POST",approved_status?formvalid?(parameters.url="challenges/challenge/"+challengeId+"/approve_participant_team/"+participant_team_id,parameters.callback={onSuccess:function(response){201==response.status&&$rootScope.notify("success","Participant Team Approved successfully.")},onError:function(response){$rootScope.notify("error",response.data.error)}},utilities.sendRequest(parameters),$mdDialog.hide()):($mdDialog.hide(),$state.reload()):(parameters.url="challenges/challenge/"+challengeId+"/disapprove_participant_team/"+participant_team_id,parameters.callback={onSuccess:function(response){204==response.status&&$rootScope.notify("success","Participant Team Disapproved successfully.")},onError:function(response){$rootScope.notify("error",response.data.error),$state.reload()}},utilities.sendRequest(parameters))},vm.changeBaselineStatus=function(submission_id){parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission/"+submission_id,parameters.method="PATCH",parameters.data={is_baseline:vm.baselineStatus[submission_id]},parameters.callback={onSuccess:function(){},onError:function(){}},utilities.sendRequest(parameters)},vm.showRemainingSubmissions=function(phaseID){vm.remainingSubmissions={},vm.remainingTime={},vm.showClock=!1,vm.showSubmissionNumbers=!1,vm.maxExceeded=!1,parameters.url="jobs/"+vm.challengeId+"/remaining_submissions/",parameters.method="GET",parameters.callback={onSuccess:function(response){var phase,details,status=response.status;for(phase in response.data.phases)response.data.phases[phase].id==phaseID&&(details=response.data.phases[phase].limits);
1200===status&&(!0===details.submission_limit_exceeded?(vm.maxExceeded=!0,vm.maxExceededMessage=details.message,vm.disableSubmit=!0):0<details.remaining_submissions_today_count?(vm.remainingSubmissions=details,vm.showSubmissionNumbers=!0,vm.disableSubmit=!1):(vm.message=details,vm.showClock=!0,vm.disableSubmit=!0,vm.countDownTimer=function(){vm.remainingTime=vm.message.remaining_time,vm.days=Math.floor(vm.remainingTime/24/60/60),vm.hoursLeft=Math.floor(vm.remainingTime-86400*vm.days),vm.hours=Math.floor(vm.hoursLeft/3600),vm.minutesLeft=Math.floor(vm.hoursLeft-3600*vm.hours),vm.minutes=Math.floor(vm.minutesLeft/60),vm.remainingSeconds=Math.floor(vm.remainingTime%60),vm.remainingSeconds<10&&(vm.remainingSeconds="0"+vm.remainingSeconds),0===vm.remainingTime?vm.showSubmissionNumbers=!0:vm.remainingSeconds--},setInterval(function(){$rootScope.$apply(vm.countDownTimer)},1e3),vm.countDownTimer()))},onError:function(response){response=response.data;vm.stopLoader(),$rootScope.notify("error",response.error)}},utilities.sendRequest(parameters)},vm.fileTypes=[{name:"csv"}],vm.fields=[{label:"Team Name",id:"participant_team"},{label:"Team Members",id:"participant_team_members"},{label:"Team Members Email Id",id:"participant_team_members_email"},{label:"Team Members Affiliation",id:"participant_team_members_affiliation"},{label:"Challenge Phase",id:"challenge_phase"},{label:"Status",id:"status"},{label:"Created By",id:"created_by"},{label:"Execution Time",id:"execution_time"},{label:"Submission Number",id:"submission_number"},{label:"Submitted File",id:"input_file"},{label:"Stdout File",id:"stdout_file"},{label:"Stderr File",id:"stderr_file"},{label:"Environment Log File",id:"environment_log_file"},{label:"Submitted At",id:"created_at"},{label:"Submission Result File",id:"submission_result_file"},{label:"Submission Metadata File",id:"submission_metadata_file"},{label:"Method Name",id:"method_name"},{label:"Method Description",id:"method_description"},{label:"Publication URL",id:"publication_url"},{label:"Project URL",id:"project_url"},{label:"Submission Meta Attributes",id:"submission_meta_attributes"}],vm.downloadChallengeSubmissions=function(){if(vm.phaseId){for(var challengeName=vm.page.title.replace(/\s+/g,"_").replace(/\//g,"_"),phaseName="",i=0;i<vm.phases.results.length;i++)if(vm.phases.results[i].id==vm.phaseId){phaseName=vm.phases.results[i].name.replace(/\s+/g,"_").replace(/\//g,"_");break}var filename="all_submissions_"+challengeName+"_"+vm.challengeId+"_"+phaseName+"_"+vm.phaseId+".csv";if(parameters.url="challenges/"+vm.challengeId+"/phase/"+vm.phaseId+"/download_all_submissions/"+vm.fileSelected+"/",void 0===vm.fieldsToGet||0===vm.fieldsToGet.length)parameters.method="GET",parameters.callback={onSuccess:function(response){response=response.data;angular.element("<a/>").attr({href:"data:attachment/csv;charset=utf-8,"+encodeURI(response),download:filename})[0].click()},onError:function(response){response=response.data;$rootScope.notify("error",response.error)}};else{parameters.method="POST";var fieldsExport=[];for(let i=0;i<vm.fields.length;i++)vm.fieldsToGet.includes(vm.fields[i].id)&&fieldsExport.push(vm.fields[i].id);parameters.data=fieldsExport,parameters.callback={onSuccess:function(response){response=response.data;angular.element("<a/>").attr({href:"data:attachment/csv;charset=utf-8,"+encodeURI(response),download:filename})[0].click()},onError:function(response){response=response.data;$rootScope.notify("error",response.error)}}}utilities.sendRequest(parameters)}else $rootScope.notify("error","Please select a challenge phase!")},vm.isOptionChecked=function(option,attribute){return-1!==attribute.values.findIndex(el=>el===option)},vm.showMdDialog=function(ev,submissionId){for(var i=0;i<vm.submissionResult.count;i++)if(vm.submissionResult.results[i].id===submissionId){vm.submissionMetaData=vm.submissionResult.results[i];break}vm.method_name=vm.submissionMetaData.method_name,vm.method_description=vm.submissionMetaData.method_description,vm.project_url=vm.submissionMetaData.project_url,vm.publication_url=vm.submissionMetaData.publication_url,vm.submissionId=submissionId,null!=vm.submissionMetaData.submission_metadata&&(vm.currentSubmissionMetaData=JSON.parse(JSON.stringify(vm.submissionMetaData.submission_metadata))),$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/update-submission-metadata.html"})},vm.showVisibilityDialog=function(submissionId,submissionVisibility){vm.submissionId=submissionId,submissionVisibility&&vm.previousPublicSubmissionId?$mdDialog.show({scope:$scope,preserveScope:!0,templateUrl:"dist/views/web/challenge/update-submission-visibility.html"}):vm.changeSubmissionVisibility(submissionId,submissionVisibility)},vm.cancelSubmission=function(submissionId){parameters.url="jobs/challenges/"+vm.challengeId+"/submissions/"+submissionId+"/update_submission_meta/",parameters.method="PATCH",parameters.data={status:"cancelled"},parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","Submission cancelled successfully!"))},onError:function(response){$mdDialog.hide();response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},vm.showCancelSubmissionDialog=function(submissionId,status){vm.allowCancelRunningSubmissions||"submitted"==status?(vm.
1submissionId=submissionId,$mdDialog.show({scope:$scope,preserveScope:!0,templateUrl:"dist/views/web/challenge/cancel-submission.html"})):$rootScope.notify("error","Only unproccessed submissions can be cancelled")},vm.hideDialog=function(){$mdDialog.hide()},vm.updateSubmissionMetaData=function(updateSubmissionMetaDataForm){updateSubmissionMetaDataForm?(parameters.url="jobs/challenge/"+vm.challengeId+"/challenge_phase/"+vm.phaseId+"/submission/"+vm.submissionId,parameters.method="PATCH",parameters.data={method_name:vm.method_name,method_description:vm.method_description,project_url:vm.project_url,publication_url:vm.publication_url,submission_metadata:vm.currentSubmissionMetaData},parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The data is successfully updated!"),null!=vm.currentSubmissionMetaData)&&(vm.submissionMetaData.submission_metadata=JSON.parse(JSON.stringify(vm.currentSubmissionMetaData)))},onError:function(response){$mdDialog.hide();response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)):$mdDialog.hide()},vm.verifySubmission=function(submissionId,isVerified){parameters.url="jobs/challenges/"+vm.challengeId+"/submissions/"+submissionId+"/update_submission_meta/",parameters.method="PATCH",parameters.data={is_verified_by_host:isVerified},parameters.callback={onSuccess:function(response){200===response.status&&$rootScope.notify("success","Verification status updated successfully!")},onError:function(response){response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},vm.isStarred=function(){parameters.url="challenges/"+vm.challengeId+"/",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){response=response.data;vm.count=response.count||0,vm.is_starred=response.is_starred,vm.caption=!1===response.is_starred?"Star":"Unstar"},onError:function(){}},utilities.sendRequest(parameters)},vm.starChallenge=function(){parameters.url="challenges/"+vm.challengeId+"/",parameters.method="POST",parameters.data={},parameters.callback={onSuccess:function(response){response=response.data;vm.count=response.count,vm.is_starred=response.is_starred,vm.caption=!0===response.is_starred?"Unstar":"Star"},onError:function(response){response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},vm.overviewDialog=function(ev){vm.tempDesc=vm.page.description,$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-overview.html",escapeToClose:!1})},vm.editChallengeOverview=function(editChallengeOverviewForm){if(editChallengeOverviewForm){var challenge,challengeHostList=utilities.getData("challengeCreator");for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.method="PATCH",parameters.data={description:vm.page.description},parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The description is successfully updated!"))},onError:function(response){$mdDialog.hide(),vm.page.description=vm.tempDesc;response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)}else vm.page.description=vm.tempDesc,$mdDialog.hide()},vm.deleteChallengeDialog=function(ev){vm.titleInput="",$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/delete-challenge/delete-challenge.html",escapeToClose:!1})},vm.deleteChallenge=function(deleteChallengeForm){deleteChallengeForm?((deleteChallengeForm={}).url="challenges/challenge/"+vm.challengeId+"/disable",deleteChallengeForm.method="POST",deleteChallengeForm.token=userKey,deleteChallengeForm.callback={onSuccess:function(response){204===response.status&&($mdDialog.hide(),$rootScope.notify("success","The Challenge is successfully deleted!"))},onError:function(response){$mdDialog.hide();response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(deleteChallengeForm)):$mdDialog.hide()},vm.submissionGuidelinesDialog=function(ev){vm.tempSubmissionGuidelines=vm.page.submission_guidelines,$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-submission-guidelines.html",escapeToClose:!1})},vm.editSubmissionGuideline=function(editSubmissionGuidelinesForm){if(editSubmissionGuidelinesForm){var challenge,challengeHostList=utilities.getData("challengeCreator");for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.method="PATCH",parameters.data={submission_guidelines:vm.page.submission_guidelines},parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The submission guidelines is successfully updated!"))},onError:function(response){$mdDialog.hide(),vm.page.submission_guidelines=vm.tempSubmissionGuidelines;response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)}else vm.page.submission_guidelines=vm.tempSubmissionGuidelines,$mdDialog.hide()},vm.evaluationCriteriaDialog=function(ev){vm.tempEvaluationCriteria=vm.page.evaluation_details,$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-evaluation-criteria.html",escapeToClose:!1})},vm.editEvaluationCriteria=function(editEvaluationCriteriaForm){if(editEvaluationCriteriaForm){var challenge,challengeHostList=utilities.getData("challengeCreator");for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.method="PATCH",parameters.data={evaluation_details:vm.page.evaluation_details},parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The evaluation details is successfully updated!"))},onError:function(response){$mdDialog.hide(),vm.page.evaluation_details=vm.tempEvaluationCriteria;response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)}else vm.page.evaluation_details=vm.tempEvaluationCriteria,$mdDialog.hide()},vm.evaluationScriptDialog=function(ev){vm.tempEvaluationCriteria=vm.page.evaluation_details,$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-evaluation-script.html",escapeToClose:!1})},vm.editEvalScript=function(editEvaluationCriteriaForm){if(editEvaluationCriteriaForm)if(null==vm.editEvaluationScript||""===vm.editEvaluationScript)$mdDialog.hide(),$rootScope.notify("error","Please upload a valid evaluation script!");else{var challenge,editEvaluationCriteriaForm=new FormData,challengeHostList=(editEvaluationCriteriaForm.append("evaluation_script",vm.editEvaluationScript),utilities.getData("challengeCreator"));for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.method="PATCH",parameters.data=editEvaluationCriteriaForm,parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The evaluation script is successfully updated!"))},onError:function(response){$mdDialog.hide(),vm.page.evaluation_details=vm.tempEvaluationCriteria;response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters,"header","upload")}else vm.page.evaluation_details=vm.tempEvaluationCriteria,$mdDialog.hide()},vm.termsAndConditionsDialog=function(ev){vm.tempTermsAndConditions=vm.page.terms_and_conditions,$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-terms-and-conditions.html",escapeToClose:!1})},vm.editTermsAndConditions=function(editTermsAndConditionsForm){if(editTermsAndConditionsForm){var challenge,challengeHostList=utilities.getData("challengeCreator");for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.method="PATCH",parameters.data={terms_and_conditions:vm.page.terms_and_conditions},parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The terms and conditions are successfully updated!"))},onError:function(response){$mdDialog.hide(),vm.page.terms_and_conditions=vm.tempTermsAndConditions;response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)}else vm.page.terms_and_conditions=vm.tempTermsAndConditions,$mdDialog.hide()},vm.challengeTitleDialog=function(ev){vm.tempChallengeTitle=vm.page.title,$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-title.html",escapeToClose:!1})},vm.editChallengeTitle=function(editChallengeTitleForm){if(editChallengeTitleForm){var challenge,challengeHostList=utilities.getData("challengeCreator");for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.method="PATCH",parameters.data={title:vm.page.title},parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The challenge title is successfully updated!"))},onError:function(response){$mdDialog.hide(),vm.page.title=vm.tempChallengeTitle;response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)}else vm.page.title=vm.tempChallengeTitle,$mdDialog.hide()},vm.challengePhaseDialog=function(ev,phase){vm.page.challenge_phase=phase,vm.page.max_submissions_per_day=phase.max_submissions_per_day,vm.page.max_submissions_per_month=phase.max_submissions_per_month,vm.phaseStartDate=moment(phase.start_date),vm.phase
1EndDate=moment(phase.end_date),vm.testAnnotationFile=null,vm.sanityCheckPass=!0,vm.sanityCheck="",$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-phase.html",escapeToClose:!1})},vm.editChallengePhase=function(editChallengePhaseForm){editChallengePhaseForm?(vm.challengePhaseId=vm.page.challenge_phase.id,parameters.url="challenges/challenge/"+vm.challengeId+"/challenge_phase/"+vm.challengePhaseId,parameters.method="PATCH",(editChallengePhaseForm=new FormData).append("name",vm.page.challenge_phase.name),editChallengePhaseForm.append("description",vm.page.challenge_phase.description),editChallengePhaseForm.append("start_date",vm.phaseStartDate.toISOString()),editChallengePhaseForm.append("end_date",vm.phaseEndDate.toISOString()),editChallengePhaseForm.append("max_submissions_per_day",vm.page.challenge_phase.max_submissions_per_day),editChallengePhaseForm.append("max_submissions_per_month",vm.page.challenge_phase.max_submissions_per_month),editChallengePhaseForm.append("max_submissions",vm.page.challenge_phase.max_submissions),editChallengePhaseForm.append("max_concurrent_submissions_allowed",vm.page.challenge_phase.max_concurrent_submissions_allowed),vm.testAnnotationFile&&editChallengePhaseForm.append("test_annotation",vm.testAnnotationFile),parameters.data=editChallengePhaseForm,parameters.callback={onSuccess:function(response){response=response.status;utilities.hideLoader(),200===response&&($mdDialog.hide(),$rootScope.notify("success","The challenge phase details are successfully updated!"))},onError:function(response){utilities.hideLoader(),$mdDialog.hide();response=response.data;$rootScope.notify("error",response)}},utilities.showLoader(),utilities.sendRequest(parameters,"header","upload")):(parameters.url="challenges/challenge/"+vm.challengeId+"/challenge_phase",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){response=response.data;vm.phases=response,utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest(parameters),$mdDialog.hide())},vm.publishChallenge=function(ev){ev.stopPropagation(),vm.toggleChallengeState=null,vm.publishDesc=null,vm.isPublished?vm.toggleChallengeState="private":vm.toggleChallengeState="public";ev=$mdDialog.confirm().title("Make this challenge "+vm.toggleChallengeState+"?").ariaLabel("").targetEvent(ev).ok("Yes").cancel("No");$mdDialog.show(ev).then(function(){parameters.url="challenges/challenge_host_team/"+vm.page.creator.id+"/challenge/"+vm.page.id,parameters.method="PATCH",parameters.data={published:!vm.isPublished},vm.isPublished=!vm.isPublished,parameters.callback={onSuccess:function(response){200===response.status&&($mdDialog.hide(),$rootScope.notify("success","The challenge was successfully made "+vm.toggleChallengeState))},onError:function(response){$mdDialog.hide(),vm.page.description=vm.tempDesc;response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},function(){})},vm.challengeDateDialog=function(ev){vm.challengeStartDate=moment(vm.page.start_date),vm.challengeEndDate=moment(vm.page.end_date),$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-date.html",escapeToClose:!1})},vm.editChallengeDate=function(editChallengeDateForm){if(editChallengeDateForm){var challenge,challengeHostList=utilities.getData("challengeCreator");for(challenge in challengeHostList)if(challenge==vm.challengeId){vm.challengeHostId=challengeHostList[challenge];break}parameters.url="challenges/challenge_host_team/"+vm.challengeHostId+"/challenge/"+vm.challengeId,parameters.method="PATCH",new Date(vm.challengeStartDate).valueOf()<new Date(vm.challengeEndDate).valueOf()?(parameters.data={start_date:vm.challengeStartDate,end_date:vm.challengeEndDate},parameters.callback={onSuccess:function(response){response=response.status;utilities.hideLoader(),200===response&&(vm.page.start_date=vm.challengeStartDate.format("MMM D, YYYY h:mm:ss A"),vm.page.end_date=vm.challengeEndDate.format("MMM D, YYYY h:mm:ss A"),$mdDialog.hide(),$rootScope.notify("success","The challenge start and end date is successfully updated!"))},onError:function(response){utilities.hideLoader(),$mdDialog.hide();response=response.data;$rootScope.notify("error",response)}},utilities.showLoader(),utilities.sendRequest(parameters)):$rootScope.notify("error","The challenge start date cannot be same or greater than end date.")}else $mdDialog.hide()},vm.editchallengeTagDialog=function(ev){vm.tags=vm.page.list_tags,vm.domain_choices(),$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-tag.html",escapeToClose:!1})}
1,vm.editChallengeTag=function(editChallengeTagDomainForm){editChallengeTagDomainForm?(editChallengeTagDomainForm="string"==typeof vm.tags?vm.tags.split(",").map(item=>item.trim()):vm.page.list_tags.map(tag=>tag),"string"==typeof vm.tags&&(4<editChallengeTagDomainForm.length||editChallengeTagDomainForm.some(tag=>15<tag.length))?$rootScope.notify("error","Invalid tags! Maximum 4 tags are allowed, and each tag must be 15 characters or less."):(parameters.url="challenges/challenge/"+vm.challengeId+"/update_challenge_tags_and_domain/",parameters.method="PATCH",parameters.data={list_tags:editChallengeTagDomainForm,domain:vm.domain},parameters.callback={onSuccess:function(response){response=response.status;utilities.hideLoader(),200===response&&($rootScope.notify("success","The challenge tags and domain is successfully updated!"),$state.reload(),$mdDialog.hide())},onError:function(response){utilities.hideLoader(),$mdDialog.hide();response=response.data;$rootScope.notify("error",response)}},utilities.showLoader(),utilities.sendRequest(parameters))):$mdDialog.hide()},vm.domain_choices=function(){parameters.url="challenges/challenge/get_domain_choices/",parameters.method="GET",parameters.data={},parameters.callback={onSuccess:function(response){for(var domain_choices=response.data,i=0;i<domain_choices.length;i++)domain_choices[i][0]==vm.page.domain&&(vm.domain=domain_choices[i][0]);vm.domainoptions=domain_choices},onError:function(response){response=response.data;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},$scope.$on("$destroy",function(){vm.stopFetchingSubmissions(),vm.stopLeaderboard(),vm.stopLoadingLogs()}),$rootScope.$on("$stateChangeStart",function(){vm.phase={},vm.isResult=!1,vm.stopFetchingSubmissions(),vm.stopLeaderboard()}),vm.showConfirmation=function(message){$rootScope.notify("success",message)},vm.termsAndConditionDialog=function(ev){$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/terms-and-conditions.html",escapeToClose:!1})},vm.acceptTermsAndConditions=function(acceptTermsAndConditionsForm){acceptTermsAndConditionsForm?vm.termsAndConditions&&(vm.selectExistTeam(),$mdDialog.hide()):$mdDialog.hide()},vm.encodeMetricURI=function(metric){return encodeURIComponent(metric)},vm.deregisterdialog=function(ev){$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/challenge/edit-challenge/edit-challenge-deregister.html",escapeToClose:!1})},vm.deregister=function(deregisterformvalid){deregisterformvalid?(parameters.url="challenges/challenge/"+vm.challengeId+"/deregister/",parameters.method="POST",parameters.data={},parameters.callback={onSuccess:function(response){200===response.status&&($rootScope.notify("success","You have successfully deregistered from the challenge."),$mdDialog.hide(),$state.go("web.challenge-main.challenge-page.overview"),setTimeout(function(){$state.reload()},100))},onError:function(response){$rootScope.notify("error",response.data.error),$mdDialog.hide()}},utilities.sendRequest(parameters)):$mdDialog.hide()},vm.openLeaderboardDropdown=function(){if(null==vm.chosenMetrics&&(!vm.selectedPhaseSplit||!1!==vm.selectedPhaseSplit.show_scores_on_leaderboard)&&vm.leaderboard&&vm.leaderboard[0]){for(var index=[],k=0;k<vm.leaderboard[0].leaderboard__schema.labels.length;k++)index.push(k.toString());vm.chosenMetrics=index}vm.leaderboardDropdown=!vm.leaderboardDropdown},vm.getTrophySize=function(rank){switch(rank){case 1:return"trophy-gold";case 2:return"trophy-silver";case 3:return"trophy-bronze";default:return"trophy-black"}}}angular.module("evalai").controller("ChallengeCtrl",ChallengeCtrl),ChallengeCtrl.$inject=["utilities","loaderService","$scope","$state","$http","$stateParams","$rootScope","$interval","$mdDialog","moment","$location","$anchorScroll","$timeout"]})(),(()=>{function ChallengeHostTeamsCtrl(utilities,loaderService,$scope,$state,$http,$rootScope,$mdDialog){var vm=this,userKey=utilities.getData("userKey"),parameters=(utilities.showLoader(),vm.team={},vm.teamId=null,vm.existTeam={},vm.currentPage="",vm.isNext="",vm.isPrev="",vm.team.error=!1,vm.showPagination=!1,vm.hostTeamId=null,vm.challengeHostTeamId=null,vm.isExistLoader=!1,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader=loaderService.startLoader,vm.stopLoader=loaderService.stopLoader,vm.activateCollapsible=function(){angular.element(".collapsible").collapsible()},{});parameters.url="hosts/challenge_host_team/",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,0===vm.existTeam.count?(vm.showPagination=!1,vm.paginationMsg="No team exists for now. Start by creating a new team!"):(vm.activateCollapsible(),vm.showPagination=!0,vm.paginationMsg=""),utilities.deleteData("emailError"),null===vm.existTeam.next?vm.isNext="disabled":vm.isNext="",null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",null!==vm.existTeam.next?vm.currentPage=vm.existTeam.next.split("page=")[1]-1:vm.currentPage=1,vm.load=function(url){vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Teams"),null!==url?$http.get(url,{headers:{Authorization:"Token "+userKey}}).then(function(response){response=response.data;vm.existTeam=response,null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=vm.existTeam.count/10):(vm.isNext="",vm.currentPage=parseInt(vm.existTeam.next.split("page=")[1]-1)),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader()}):vm.stopLoader()}),utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest(parameters),vm.showMdDialog=function(ev,hostTeamId){vm.hostTeamId=hostTeamId,parameters.url="hosts/challenge_host_team/"+hostTeamId,parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){vm.team.TeamName=response.data.team_name,vm.team.TeamURL=response.data.team_url},onError:function(response){response=response.data.error;vm.stopLoader(),$rootScope.notify("error",response)}},utilities.sendRequest(parameters),$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/edit-host-teams.html"})},vm.updateChallengeHostTeamData=function(updateChallengeHostTeamDataForm){updateChallengeHostTeamDataForm?((updateChallengeHostTeamDataForm={}).url="hosts/challenge_host_team/"+vm.hostTeamId,updateChallengeHostTeamDataForm.method="PATCH",updateChallengeHostTeamDataForm.data={team_name:vm.team.TeamName,team_url:vm.team.TeamURL},updateChallengeHostTeamDataForm.token=userKey,updateChallengeHostTeamDataForm.callback={onSuccess:function(){$mdDialog.hide(),vm.team={},$rootScope.notify("success","Host team updated!");var parameters={url:"hosts/challenge_host_team",method:"GET"};parameters.token=userKey,parameters.callback={onSuccess:function(response){vm.existTeam.results=response.data.results},onError:function(response){response=response.data.error;vm.stopLoader(),$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},onError:function(response){response="team_name"in response.data?response.data.team_name:response.data.error;$rootScope.notify("error",response[0])}},utilities.sendRequest(updateChallengeHostTeamDataForm)):$mdDialog.hide()},vm.createNewTeam=function(){vm.isExistLoader=!0,vm.loaderTitle="",vm.startLoader("Loading Teams");var parameters={url:"hosts/create_challenge_host_team",method:"POST"};parameters.data={team_name:vm.team.name,team_url:vm.team.url},parameters.token=userKey,parameters.callback={onSuccess:function(response){$rootScope.notify("success","New team- '"+vm.team.name+"' has been created");response=response.data,vm.teamId=response.id,vm.team.error=!1,vm.team={},vm.stopLoader(),vm.startLoader("Loading Teams"),response={};response.url="hosts/challenge_host_team/",response.method="GET",response.token=userKey,response.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,vm.showPagination=!0,vm.paginationMsg="",null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=1):(vm.isNext="",vm.currentPage=vm.existTeam.next.split("page=")[1]-1),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader())},onError:function(){vm.stopLoader()}},utilities.sendRequest(response)},onError:function(response){response=response.data;vm.team.error=response.team_name[0],vm.stopLoader(),$rootScope.notify("error",response.team_name[0])}},utilities.sendRequest(parameters)},vm.confirmDelete=function(ev,hostTeamId){ev.stopPropagation();ev=$mdDialog.confirm().title("Would you like to remove yourself?").textContent("Note: This action will remove you from the team.").ariaLabel("Lucky day").targetEvent(ev).ok("Yes").cancel("No");$mdDialog.show(ev).then(function(){vm.startLoader();var parameters={};parameters.url="hosts/remove_self_from_challenge_host/"+hostTeamId,parameters.method="DELETE",parameters.data={},parameters.token=userKey,parameters.callback={onSuccess:function(){vm.team.error=!1,$rootScope.notify("info","You have removed yourself successfully");var parameters={url:"hosts/challenge_host_team/",method:"GET"};parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=vm.existTeam.count/10):(vm.isNext="",vm.currentPage=parseInt(vm.existTeam.next.split("page=")[1]-1)),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",0===vm.existTeam.count?(vm.showPagination=!1,vm.paginationMsg="No team exists for now, start by creating a new team!"):(vm.showPagination=!0,vm.paginationMsg="")),vm.stopLoader()}},utilities.sendRequest(parameters)},onError:function(){vm.stopLoader(),$rootScope.notify("error","Couldn't remove you from the challenge")}},utilities.sendRequest(parameters)},function(){})},vm.inviteOthers=function(ev,hostTeamId){ev.stopPropagation();ev=$mdDialog.prompt().title("Add other members to your team").textContent("Enter the email address of the person").placeholder("email").ariaLabel("").targetEvent(ev).ok("Add").cancel("Cancel");$mdDialog.show(ev).then(function(result){var parameters={};parameters.url="hosts/challenge_host_teams/"+hostTeamId+"/invite",parameters.method="POST",parameters.data={email:result},parameters.token=userKey,parameters.callback={onSuccess:function(){$rootScope.notify("success",parameters.data.email+" has been added successfully")},onError:function(response){response=response.data.error;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)})},vm.storeChallengeHostTeamId=function(){utilities.storeData("challengeHostTeamId",vm.challengeHostTeamId),$state.go("web.challenge-create")}}angular.module("evalai").controller("ChallengeHostTeamsCtrl",ChallengeHostTeamsCtrl),ChallengeHostTeamsCtrl.$inject=["utilities","loader
1Service","$scope","$state","$http","$rootScope","$mdDialog"]})(),(()=>{function ChallengeListCtrl(utilities,$window,moment){var vm=this,gmtOffset=moment().utcOffset(),gmtSign=0<=gmtOffset?"+":"-",gmtHours=Math.abs(Math.floor(gmtOffset/60)),gmtOffset=Math.abs(gmtOffset%60),gmtZone="GMT "+gmtSign+" "+gmtHours+":"+(gmtOffset<10?"0":"")+gmtOffset;utilities.showLoader(),utilities.hideButton(),vm.currentList=[],vm.upcomingList=[],vm.pastList=[],vm.currentCount=0,vm.upcomingCount=0,vm.pastCount=0,vm.noneCurrentChallenge=!1,vm.noneUpcomingChallenge=!1,vm.nonePastChallenge=!1,vm.challengeCreator={},vm.tab=1,vm.getAllResults=function(parameters,resultsArray,typ,countKey,isFirstPage){parameters.method="GET",parameters.callback={onSuccess:function(response){var i,response=response.data,results=response.results,timezone=(isFirstPage&&countKey&&void 0!==response.count&&(vm[countKey]=response.count),moment.tz.guess());for(i in results){var descLength=results[i].description.length,descLength=(results[i].isLarge=50<=descLength?"...":"",new Date(results[i].start_date).getTimezoneOffset()),descLength=(results[i].time_zone=moment.tz.zone(timezone).abbr(descLength),results[i].gmt_zone=gmtZone,results[i].id);vm.challengeCreator[descLength]=results[i].creator.id,utilities.storeData("challengeCreator",vm.challengeCreator),resultsArray.push(results[i])}null!==response.next?(response=(response=response.next).substring(response.indexOf("challenges/challenge"),response.length),vm.getAllResults({url:response},resultsArray,typ,countKey,!1)):(utilities.hideLoader(),0===resultsArray.length?vm[typ]=!0:vm[typ]=!1)},onError:function(){utilities.hideLoader()}},utilities.sendRequest(parameters)};vm.getAllResults({url:"challenges/challenge/present/approved/public"},vm.currentList,"noneCurrentChallenge","currentCount",!0),vm.getAllResults({url:"challenges/challenge/future/approved/public"},vm.upcomingList,"noneUpcomingChallenge","upcomingCount",!0),vm.getAllResults({url:"challenges/challenge/past/approved/public"},vm.pastList,"nonePastChallenge","pastCount",!0),vm.scrollUp=function(){angular.element($window).bind("scroll",function(){100<=this.pageYOffset?utilities.showButton():utilities.hideButton()})}}angular.module("evalai").controller("ChallengeListCtrl",ChallengeListCtrl),ChallengeListCtrl.$inject=["utilities","$window","moment"]})(),(()=>{function ChangePwdCtrl(utilities,$state,$rootScope){var vm=this,userKey=utilities.getData("userKey");vm.wrnMsg={},vm.isValid={},vm.user={},vm.isFormError=!1,$rootScope.canShowOldPassword=!1,$rootScope.canShowNewPassword=!1,$rootScope.canShowNewConfirmPassword=!1,vm.changepassContainer=angular.element(".change-password-card"),vm.startLoader=function(msg){$rootScope.isLoader=!0,$rootScope.loaderTitle=msg,vm.changepassContainer.addClass("low-screen")},vm.stopLoader=function(){$rootScope.isLoader=!1,$rootScope.loaderTitle="",vm.changepassContainer.removeClass("low-screen")},vm.toggleOldPasswordVisibility=function(){$rootScope.canShowOldPassword=!$rootScope.canShowOldPassword},vm.toggleNewPasswordVisibility=function(){$rootScope.canShowNewPassword=!$rootScope.canShowNewPassword},vm.toggleNewConfirmVisibility=function(){$rootScope.canShowNewConfirmPassword=!$rootScope.canShowNewConfirmPassword},vm.changePassword=function(resetconfirmFormValid){resetconfirmFormValid?(vm.startLoader("Changing Your Password"),(resetconfirmFormValid={url:"auth/password/change/",method:"POST"}).data={old_password:vm.user.old_password,new_password1:vm.user.new_password1,new_password2:vm.user.new_password2,uid:$state.params.user_id},resetconfirmFormValid.token=userKey,resetconfirmFormValid.callback={onSuccess:function(){vm.user.error=!1,$rootScope.notify("success","Your password has been changed successfully!"),vm.stopLoader()},onError:function(response){var oldpassword_valid,password1_valid,password2_valid;vm.user.error="Failed",vm.isFormError=!0;try{oldpassword_valid=void 0!==response.data.old_password,password1_valid=void 0!==response.data.new_password1,password2_valid=void 0!==response.data.new_password2,oldpassword_valid?vm.FormError=Object.values(response.data.old_password).join(" "):password1_valid?vm.FormError=Object.values(response.data.new_password1).join(" "):password2_valid&&(vm.FormError=Object.values(response.data.new_password2).join(" "))}catch(error){vm.FormError="Something went wrong! Please refresh the page and try again."}vm.stopLoader()}},utilities.sendRequest(resetconfirmFormValid)):vm.stopLoader()}}angular.module("evalai").controller("ChangePwdCtrl",ChangePwdCtrl),ChangePwdCtrl.$inject=["utilities","$state","$rootScope"]})(),(()=>{function contactUsCtrl(utilities,loaderService,$state,$rootScope){var vm=this,userKey=utilities.getData("userKey"),loaderService=(vm.wrnMsg={},vm.isValid={},vm.user={},vm.isFormError=!1,vm.startLoader=loaderService.startLoader,vm.stopLoader=loaderService.stopLoader,{});
1loaderService.url="web/contact/",loaderService.method="GET",loaderService.token=userKey,loaderService.callback={onSuccess:function(response){200==response.status&&(vm.user=response.data,vm.isDisabled=!0)},onError:function(){}},utilities.sendRequest(loaderService),vm.contactUs=function(resetconfirmFormValid){resetconfirmFormValid&&(vm.isDisabled=!(resetconfirmFormValid={}),resetconfirmFormValid.url="web/contact/",resetconfirmFormValid.method="POST",resetconfirmFormValid.data={name:vm.user.name,email:vm.user.email,message:vm.user.message},resetconfirmFormValid.callback={onSuccess:function(response){201==response.status&&(response=response.data.message,$rootScope.notify("success",response),$state.go("home"),vm.stopLoader())},onError:function(response){if(400==response.status){var isUsernameValid,isEmailValid,isMessageValid;vm.isFormError=!0;try{isUsernameValid=void 0!==response.data.name,isEmailValid=void 0!==response.data.email,isMessageValid=void 0!==response.data.message,isUsernameValid?vm.FormError=response.data.name[0]:isEmailValid?vm.FormError=response.data.email[0]:isMessageValid?vm.FormError=response.data.message[0]:$rootScope.notify("error","Some error occured. Please try again!")}catch(error){$rootScope.notify("error",error)}}vm.stopLoader()}},utilities.sendRequest(resetconfirmFormValid))}}angular.module("evalai").controller("contactUsCtrl",contactUsCtrl),contactUsCtrl.$inject=["utilities","loaderService","$state","$rootScope"]})(),(()=>{function CookieConsentController($window,$timeout){var vm=this,storedValue=$window.localStorage.getItem("cookie_consent");vm.cookieConsentResponded="true"===storedValue||"false"===storedValue,vm.acceptCookies=function(){$window.localStorage.setItem("cookie_consent","true"),$timeout(function(){vm.cookieConsentResponded=!0})},vm.declineCookies=function(){$window.localStorage.setItem("cookie_consent","false"),$timeout(function(){vm.cookieConsentResponded=!0})}}angular.module("evalai").controller("CookieConsentController",CookieConsentController),CookieConsentController.$inject=["$window","$timeout"]})(),(()=>{function DashCtrl(utilities,$state,$rootScope){var vm=this,userKey=(vm.isPrivileged=!0,vm.challengeCount=0,vm.hostTeamCount=0,vm.hostTeamExist=!1,vm.participatedTeamCount=0,utilities.getData("userKey")),parameters=(utilities.showLoader(),vm.redirectUrl={},{}),parameters=(parameters.url="auth/user/",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.name=response.data.username)},onError:function(response){utilities.hideLoader();var status=response.status,response=response.data;403==status?(vm.error=response,utilities.storeData("emailError",response.detail),vm.isPrivileged=!1):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters),vm.getAllChallenges=function(params,counter){var requestParams={url:params.url,method:params.method,token:params.token,callback:{onSuccess:function(response){var status=response.status,response=response.data;200==status&&(vm[counter]+=response.results.length,null!==response.next)&&(response={url:(status=response.next).substring(status.indexOf("challenges/challenge"),status.length),method:"GET",token:params.token},vm.getAllChallenges(response,counter))},onError:function(response){utilities.hideLoader();var status=response.status;403==status?(vm.error=response.data,vm.isPrivileged=!1):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}}};utilities.sendRequest(requestParams)},{url:"challenges/challenge/present/approved/public",method:"GET",token:userKey});vm.getAllChallenges(parameters,"challengeCount");utilities.sendRequest({url:"hosts/challenge_host_team/",method:"GET",token:userKey,callback:{onSuccess:function(response){200==response.status&&(vm.hostTeamCount=response.data.results.length),0==vm.hostTeamCount?vm.hostTeamExist=!1:vm.hostTeamExist=!0},onError:function(response){utilities.hideLoader();var status=response.status;403==status?(vm.error=response.data,vm.isPrivileged=!1):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}}});parameters={url:"participants/participant_team",method:"GET",token:userKey,callback:{onSuccess:function(response){200==response.status&&(vm.participatedTeamCount=response.data.results.length),utilities.hideLoader()},onError:function(response){utilities.hideLoader();var status=response.status;403==status?(vm.error=response.data,vm.isPrivileged=!1):401==status&&(alert("Timeout, Please login again to continue!"),utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}}};utilities.sendRequest(parameters),vm.hostChallenge=function(){$state.go("web.challenge-host-teams")}}angular.module("evalai").controller("DashCtrl",DashCtrl),DashCtrl.$inject=["utilities","$state","$rootScope"]})(),(()=>{function FeaturedChallengeCtrl(utilities,loaderService,$state,$stateParams,moment){var vm=this,$stateParams=(vm.challengeId=$stateParams.challengeId,vm.phaseSplitId=$stateParams.phaseSplitId,vm.phaseId=null,vm.wrnMsg={},vm.page={},vm.phases={},vm.phaseSplits={},vm.isValid={},vm.isActive=!1,vm.showUpdate=!1,vm.showLeaderboardUpdate=!1,vm.poller=null,vm.stopLeaderboard=function(){},vm.isExistLoader=!1,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader=loaderService.startLoader,vm.stopLoader=loaderService.stopLoader,vm.subErrors={},utilities.showLoader(),{});
1$stateParams.url="challenges/challenge/"+vm.challengeId+"/",$stateParams.method="GET",$stateParams.data={},$stateParams.callback={onSuccess:function(response){response=response.data;vm.page=response,vm.isActive=response.is_active,null===vm.page.image&&(vm.page.image="dist/images/logo.png")},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest($stateParams),($stateParams={}).url="challenges/challenge/"+vm.challengeId+"/challenge_phase",$stateParams.method="GET",$stateParams.data={},$stateParams.callback={onSuccess:function(response){response=response.data;vm.phases=response,utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest($stateParams),($stateParams={}).url="challenges/"+vm.challengeId+"/challenge_phase_split",$stateParams.method="GET",$stateParams.data={},$stateParams.callback={onSuccess:function(response){response=response.data;vm.phaseSplits=response,utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response),utilities.hideLoader()}},utilities.sendRequest($stateParams),vm.getLeaderboard=function(phaseSplitId){vm.isResult=!0,vm.phaseSplitId=phaseSplitId,vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Leaderboard Items"),vm.leaderboard={};phaseSplitId={};phaseSplitId.url="jobs/challenge_phase_split/"+vm.phaseSplitId+"/leaderboard/?page_size=1000",phaseSplitId.method="GET",phaseSplitId.data={},phaseSplitId.callback={onSuccess:function(response){response=response.data;vm.leaderboard=response.results;for(var i=0;i<vm.leaderboard.length;i++){var dateTimeNow=moment(new Date),submissionTime=moment(vm.leaderboard[i].submission__submitted_at),dateTimeNow=moment.duration(dateTimeNow.diff(submissionTime));0!=dateTimeNow._data.years?(submissionTime=dateTimeNow.asYears(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="year":vm.leaderboard[i].timeSpan="years"):0!=dateTimeNow._data.months?(submissionTime=dateTimeNow.months(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="month":vm.leaderboard[i].timeSpan="months"):0!=dateTimeNow._data.days?(submissionTime=dateTimeNow.asDays(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="day":vm.leaderboard[i].timeSpan="days"):0!=dateTimeNow._data.hours?(submissionTime=dateTimeNow.asHours(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="hour":vm.leaderboard[i].timeSpan="hours"):0!=dateTimeNow._data.minutes?(submissionTime=dateTimeNow.asMinutes(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="minute":vm.leaderboard[i].timeSpan="minutes"):0!=dateTimeNow._data.seconds&&(submissionTime=dateTimeNow.asSeconds(),1==(vm.leaderboard[i].submission__submitted_at=submissionTime).toFixed(0)?vm.leaderboard[i].timeSpan="second":vm.leaderboard[i].timeSpan="seconds")}vm.phase_name=vm.phaseSplitId,vm.stopLoader()},onError:function(response){response=response.data;vm.leaderboard.error=response,vm.stopLoader()}},utilities.sendRequest(phaseSplitId)},vm.phaseSplitId&&vm.getLeaderboard(vm.phaseSplitId)}angular.module("evalai").controller("FeaturedChallengeCtrl",FeaturedChallengeCtrl),FeaturedChallengeCtrl.$inject=["utilities","loaderService","$state","$stateParams","moment"]})(),(()=>{function HostedChallengesCtrl(utilities){var vm=this,userKey=utilities.getData("userKey"),gmtOffset=(utilities.showLoader(),moment().utcOffset()),gmtSign=0<=gmtOffset?"+":"-",gmtHours=Math.abs(Math.floor(gmtOffset/60)),gmtOffset=Math.abs(gmtOffset%60),gmtZone="GMT "+gmtSign+" "+gmtHours+":"+(gmtOffset<10?"0":"")+gmtOffset;vm.challengeList=[],vm.ongoingChallenges=[],vm.upcomingChallenges=[],vm.pastChallenges=[],vm.challengeCreator={},vm.currentTab="ongoing",vm.setCurrentTab=function(tabName){vm.currentTab=tabName},utilities.sendRequest({url:"hosts/challenge_host_team/",method:"GET",token:userKey,callback:{onSuccess:function(response){for(var hostTeamId,host_teams=response.data.results,timezone=moment.tz.guess(),i=0;i<host_teams.length;i++)hostTeamId=host_teams[i].id,utilities.sendRequest({url:"challenges/challenge_host_team/"+hostTeamId+"/challenge",method:"GET",token:userKey,callback:{onSuccess:function(response){for(var data=response.data,current=ne
1w Date,j=0;j<data.results.length;j++){var challenge=data.results[j],id=(vm.challengeList.push(challenge),challenge.id),id=(vm.challengeCreator[id]=challenge.creator.id,utilities.storeData("challengeCreator",vm.challengeCreator),new Date(challenge.start_date).getTimezoneOffset()),id=(challenge.time_zone=moment.tz.zone(timezone).abbr(id),challenge.gmt_zone=gmtZone,new Date(challenge.start_date)),endDate=new Date(challenge.end_date);current<id?vm.upcomingChallenges.some(function(c){return c.id===challenge.id})||vm.upcomingChallenges.push(challenge):id<=current&¤t<=endDate?vm.ongoingChallenges.some(function(c){return c.id===challenge.id})||vm.ongoingChallenges.push(challenge):endDate<current&&(vm.pastChallenges.some(function(c){return c.id===challenge.id})||vm.pastChallenges.push(challenge))}},onError:function(){utilities.hideLoader()}}});utilities.hideLoader()},onError:function(){utilities.hideLoader()}}})}angular.module("evalai").controller("HostedChallengesCtrl",HostedChallengesCtrl),HostedChallengesCtrl.$inject=["utilities"]})(),(()=>{function MainCtrl(utilities,$rootScope,$state){var vm=this;vm.user={},vm.challengeList=[],vm.isChallenge=!0,vm.isMore=!1,vm.redirectUrl={},vm.getChallenge=function(){var parameters={url:"challenges/featured/",method:"GET",token:null,callback:{onSuccess:function(response){vm.challengeList=response.data},onError:function(){}}};utilities.sendRequest(parameters)},vm.init=function(){var parameters,userKey=utilities.getData("userKey");userKey&&((parameters={url:"auth/user/",method:"GET"}).token=userKey,parameters.callback={onSuccess:function(response){var status=response.status,response=response.data;200==status&&(vm.user.name=response.username,$rootScope.emailBounced=response.email_bounced||!1)},onError:function(response){401==response.status&&(utilities.resetStorage(),$state.go("auth.login"),$rootScope.isAuth=!1)}},utilities.sendRequest(parameters))},vm.hostChallenge=function(){!0===$rootScope.isAuth?$state.go("web.challenge-host-teams"):($state.go("auth.login"),$rootScope.previousState="web.challenge-host-teams")},vm.profileDropdown=function(){angular.element(".dropdown-button").dropdown()},vm.init(),vm.getChallenge(),angular.element(".carousel").carousel({duration:200})}angular.module("evalai").controller("MainCtrl",MainCtrl),MainCtrl.$inject=["utilities","$rootScope","$state"]})(),(()=>{function ourTeamCtrl(utilities){var vm=this,parameters={url:"web/team/",method:"GET",callback:{onSuccess:function(response){var status=response.status,results=response.data;if(200==status)if(0!==results.length)for(var coreTeamList=[],contributingTeamList=[],i=0;i<results.length;i++)"Core Team"===results[i].team_type?(vm.coreTeamType=results[i].team_type,vm.coreTeamList=coreTeamList.push(results[i])):"Contributor"===results[i].team_type&&(vm.contributingTeamType=results[i].team_type,vm.contributingTeamList=contributingTeamList.push(results[i])),vm.coreTeamDetails=coreTeamList,vm.contributingTeamDetails=contributingTeamList;else vm.noTeamDisplay="Team will be updated very soon !"},onError:function(){}}};utilities.sendRequest(parameters,"no-header")}angular.module("evalai").controller("ourTeamCtrl",ourTeamCtrl),ourTeamCtrl.$inject=["utilities"]})(),(()=>{function PermCtrl(utilities,$rootScope){var vm=this;vm.emailError=utilities.getData("emailError"),vm.isEmailVerificationRequired=!!vm.emailError,vm.deniedMessage=utilities.getData("permissionDeniedMessage")||"Sorry, you do not have permission to view this page.",vm.sendMail=!1,vm.requestLink=function(){var userKey=utilities.getData("userKey"),parameters={url:"accounts/user/resend_email_verification/",method:"POST"};parameters.token=userKey,parameters.callback={onSuccess:function(){vm.sendMail=!0,$rootScope.notify("success","The verification link was sent again.")},onError:function(response){var message=response.data.detail,message=Math.floor(message.match(/\d+/g)[0]/60);429==response.status?$rootScope.notify("error","Request limit exceeded. Please wait for "+message+" minutes and try again."):$rootScope.notify("error","Something went wrong. Please try again.")}},utilities.sendRequest(parameters)}}angular.module("evalai").controller("PermCtrl",PermCtrl),PermCtrl.$inject=["utilities","$rootScope"]})(),(()=>{function profileCtrl(utilities,$rootScope,$scope,$mdDialog,moment,$state){var vm=this,count=(vm.user={},vm.countLeft=0,vm.compPerc=0);vm.inputType="password",vm.status="Show",vm.token="",vm.expiresAt="",$rootScope.canShowOldPassword=!1,$rootScope.canShowNewPassword=!1,$rootScope.canShowNewConfirmPassword=!1,utilities.hideLoader(),vm.imgUrlObj={profilePic:"dist/images/spaceman.png"};utilities.getData("avatar")?vm.imgUrl=utilities.getData("avatar"):(vm.imgUrl=_.sample(vm.imgUrlObj),utilities.storeData("avatar",vm.imgUrl));var userKey=utilities.getData("userKey"),parameters={url:"auth/user/",method:"GET"};parameters.token=userKey,parameters.callback={onSuccess:function(response){var status=response.status,result=response.data;if(200==status){for(var i in result)""!==result[i]&&null!=result[i]||(result[i]="",vm.countLeft=vm.countLeft+1),count+=1;vm.compPerc=parseInt(vm.countLeft/count*100),vm.user=result,vm.userdetails=angular.copy(result),vm.user.complete=100-vm.compPerc}},onError:function(response){response=response.data;$rootScope.notify("error",response.error)}},utilities.sendRequest(parameters),parameters.url="accounts/user/get_auth_token",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){vm.jsonResponse=response.data,vm.token=response.data.token,vm.expiresAt=moment.utc(response.data.expires_at).local().format("MMM D, YYYY h:mm:ss A");var response=new Date(vm.expiresAt).getTimezoneOffset(),timezone=moment.tz.guess(),timezone=(vm.expiresAtTimezone=moment.tz.zone(timezone).abbr(response),moment().utcOffset()),response=0<=timezone?"+":"-",gmtHours=Math.abs(Math.floor(timezone/60)),timezone=Math.abs(timezone%60);vm.gmtZone="GMT "+response+" "+gmtHours+":"+(timezone<10?"0":"")+timezone},onError:function(response){response=response.data;$rootScope.notify("error",response.detail)}},utilities.sendRequest(parameters),vm.hideShowPassword=function(){"password"==vm.inputType?(vm.inputType="text",vm.status="Hide"):(vm.inputType="password",vm.status="Show")},vm.showConfirmation=function(){$rootScope.notify("success","Token copied to your clipboard.")},vm.getAuthTokenDialog=function(ev){vm.titleInput="",$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/auth/get-token.html",escapeToClose:!1})},vm.getAuthToken=function(getTokenForm){getTokenForm||(vm.inputType="password",vm.status="Show",$mdDialog.hide())},vm.downloadToken=function(){var anchor=angular.element("<a/>"),ev=(anchor.attr({href:"data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(vm.jsonResponse)),download:"token.json"}),document.createEvent("MouseEvents"));
1ev.initMouseEvent("click",!0,!1,self,0,0,0,0,0,!1,!1,!1,!1,0,null),anchor[0].dispatchEvent(ev)},vm.refreshToken=function(){parameters.url="accounts/user/refresh_auth_token",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){vm.jsonResponse=response.data,vm.token=response.data.token,utilities.storeData("refreshJWT",vm.token),$rootScope.notify("success","Token generated successfully.")},onError:function(response){response=response.data;$rootScope.notify("error",response.detail)}},utilities.sendRequest(parameters)},vm.isURLValid=function(url){return null==url||url.length<=200},vm.editprofileDialog=function(ev){switch(ev.currentTarget.id){case"first_name":vm.titleInput="First Name",vm.editid="first_name";break;case"last_name":vm.titleInput="Last Name",vm.editid="last_name";break;case"affiliation":vm.titleInput="Affiliation",vm.editid="affiliation";break;case"university":vm.titleInput="University",vm.editid="university";break;case"address_street":vm.titleInput="Street Address",vm.editid="address_street";break;case"address_city":vm.titleInput="City",vm.editid="address_city";break;case"address_state":vm.titleInput="State",vm.editid="address_state";break;case"address_country":vm.titleInput="Country",vm.editid="address_country";break;case"github_url":vm.titleInput="Github URL",vm.editid="github_url";break;case"google_scholar_url":vm.titleInput="Google Scholar URL",vm.editid="google_scholar_url";break;case"linkedin_url":vm.titleInput="Linkedin URL",vm.editid="linkedin_url"}$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/profile/edit-profile/edit-profile.html",escapeToClose:!1})},vm.updateProfile=function(resetconfirmFormValid,editid){if(resetconfirmFormValid)if(vm.user.github_url=null===vm.user.github_url?"":vm.user.github_url,vm.user.google_scholar_url=null===vm.user.google_scholar_url?"":vm.user.google_scholar_url,vm.user.linkedin_url=null===vm.user.linkedin_url?"":vm.user.linkedin_url,vm.user.address_street=null===vm.user.address_street?"":vm.user.address_street,vm.user.address_city=null===vm.user.address_city?"":vm.user.address_city,vm.user.address_state=null===vm.user.address_state?"":vm.user.address_state,vm.user.address_country=null===vm.user.address_country?"":vm.user.address_country,vm.user.university=null===vm.user.university?"":vm.user.university,vm.isURLValid(vm.user[editid])){var parameters={url:"auth/user/",method:"PUT"};if(parameters.data={affiliation:vm.user.affiliation,github_url:vm.user.github_url,google_scholar_url:vm.user.google_scholar_url,linkedin_url:vm.user.linkedin_url},!vm.user.is_profile_fields_locked)for(var profileFields=["first_name","last_name","address_street","address_city","address_state","address_country","university"],i=0;i<profileFields.length;i++){var key=profileFields[i],val=vm.user[key];(key===editid||val&&"string"==typeof val&&val.trim())&&(parameters.data[key]=val)}parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&($rootScope.notify("success","Profile updated successfully!"),$mdDialog.hide(),$state.reload())},onError:function(response){if(400==response.status){var isFirstname_val
1id,isLastname_valid,isAffiliation_valid,isUniversity_valid,isStreet_valid,isCity_valid,isState_valid,isCountry_valid;vm.errorResponse=response,vm.isFormError=!0;try{isFirstname_valid=void 0!==response.data.first_name,isLastname_valid=void 0!==response.data.last_name,isAffiliation_valid=void 0!==response.data.affiliation,isUniversity_valid=void 0!==response.data.university,isStreet_valid=void 0!==response.data.address_street,isCity_valid=void 0!==response.data.address_city,isState_valid=void 0!==response.data.address_state,isCountry_valid=void 0!==response.data.address_country,isFirstname_valid?vm.FormError=response.data.first_name[0]:isLastname_valid?vm.FormError=response.data.last_name[0]:isAffiliation_valid?vm.FormError=response.data.affiliation[0]:isUniversity_valid?vm.FormError=response.data.university[0]:isStreet_valid?vm.FormError=response.data.address_street[0]:isCity_valid?vm.FormError=response.data.address_city[0]:isState_valid?vm.FormError=response.data.address_state[0]:isCountry_valid?vm.FormError=response.data.address_country[0]:$rootScope.notify("error","Some error have occured . Please try again !"),$rootScope.notify("error",vm.FormError)}catch(error){$rootScope.notify("error",error)}}}},utilities.sendRequest(parameters)}else vm.isFormError=!0,$rootScope.notify("error","URL length should not be greater than 200 or is in invalid format!");else $mdDialog.hide(),$state.reload()},vm.toggleOldPasswordVisibility=function(){$rootScope.canShowOldPassword=!$rootScope.canShowOldPassword},vm.toggleNewPasswordVisibility=function(){$rootScope.canShowNewPassword=!$rootScope.canShowNewPassword},vm.toggleNewConfirmVisibility=function(){$rootScope.canShowNewConfirmPassword=!$rootScope.canShowNewConfirmPassword},vm.changePassword=function(resetconfirmFormValid){resetconfirmFormValid?((resetconfirmFormValid={url:"auth/password/change/",method:"POST"}).data={old_password:vm.user.old_password,new_password1:vm.user.new_password1,new_password2:vm.user.new_password2,uid:$state.params.user_id},resetconfirmFormValid.token=userKey,resetconfirmFormValid.callback={onSuccess:function(){vm.user.error=!1,$rootScope.notify("success","Your password has been changed successfully!"),$state.go("web.profile.AuthToken")},onError:function(response){var oldpassword_valid,password1_valid,password2_valid;vm.user.error="Failed",vm.isFormError=!0;try{oldpassword_valid=void 0!==response.data.old_password,password1_valid=void 0!==response.data.new_password1,password2_valid=void 0!==response.data.new_password2,oldpassword_valid?vm.FormError=Object.values(response.data.old_password).join(" "):password1_valid?vm.FormError=Object.values(response.data.new_password1).join(" "):password2_valid&&(vm.FormError=Object.values(response.data.new_password2).join(" "))}catch(error){vm.FormError="Something went wrong! Please refresh the page and try again."}$rootScope.notify("error",vm.FormError)}},utilities.sendRequest(resetconfirmFormValid)):$rootScope.notify("error","Something went wrong! Please refresh the page and try again.")},vm.confirmDeactivateAccount=function(deactivateAccountForm){deactivateAccountForm&&(parameters.token=userKey,parameters.method="POST",parameters.url="accounts/user/disable",parameters.callback={onSuccess:function(response){200==response.status&&(utilities.resetStorage(),$rootScope.isLoader=!1,$state.go("home"),$rootScope.isAuth=!1,$rootScope.notify("success","Your account has been deactivated successfully."))},onError:function(response){response=response.data;$rootScope.notify("error",response.error)}},utilities.sendRequest(parameters))}}angular.module("evalai").controller("profileCtrl",profileCtrl),profileCtrl.$inject=["utilities","$rootScope","$scope","$mdDialog","moment","$state"]})(),(()=>{function TeamsCtrl(utilities,loaderService,$scope,$state,$http,$rootScope,$mdDialog){var vm=this,userKey=utilities.getData("userKey"),parameters=(utilities.showLoader(),vm.team={},vm.teamId=null,vm.existTeam={},vm.currentPage="",vm.isNext="",vm.isPrev="",vm.team.error=!1,vm.showPagination=!1,vm.isExistLoader=!1,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader=loaderService.startLoader,vm.stopLoader=loaderService.stopLoader,vm.activateCollapsible=function(){angular.element(".collapsible").collapsible()},{});parameters.url="participants/participant_team",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,0===vm.existTeam.count?(vm.showPagination=!1,vm.paginationMsg="No team exists for now. Start by creating a new team!"):(vm.activateCollapsible(),vm.showPagination=!0,vm.paginationMsg=""),utilities.deleteData("emailError"),null===vm.existTeam.next?vm.isNext="disabled":vm.isNext="",null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",null!==vm.existTeam.next?vm.currentPage=vm.existTeam.next.split("page=")[1]-1:vm.currentPage=1,vm.selectExistTeam=function(){vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Teams");var parameters={};parameters.url="challenges/challenge/1/participant_team/"+vm.teamId,parameters.method="POST",parameters.token=userKey,parameters.callback={onSuccess:function(){$state.go("web.challenge-main.challenge-page.overview"),vm.stopLoader()},onError:function(){vm.existTeamError="Please select a team",vm.stopLoader()}},utilities.sendRequest(parameters)},vm.load=function(url){vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".exist-team-card"),vm.startLoader("Loading Teams"),null!==url?$http.get(url,{headers:{Authorization:"Token "+userKey}}).then(function(response){response=response.data;vm.existTeam=response,null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=vm.existTeam.count/10):(vm.isNext="",vm.currentPage=parseInt(vm.existTeam.next.split("page=")[1]-1)),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader()}):vm.stopLoader()}),utilities.hideLoader()},onError:function(response){utilities.handlePermissionDeniedError($state,response)||utilities.hideLoader()}},utilities.sendRequest(parameters),vm.createNewTeam=function(){vm.isExistLoader=!0,vm.loaderTitle="",vm.loaderContainer=angular.element(".new-team-card"),vm.startLoader("Loading Teams");var parameters={url:"participants/participant_team",method:"POST"};parameters.data={team_name:vm.team.name,team_url:vm.team.url},parameters.token=userKey,parameters.callback={onSuccess:function(){$rootScope.notify("success","Team "+vm.team.name+" has been created successfully!"),vm.team.error=!1,vm.stopLoader(),vm.team={},vm.startLoader("Loading Teams");var parameters={url:"participants/participant_team",method:"GET"};parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,vm.showPagination=!0,vm.paginationMsg="",null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=1):(vm.isNext="",vm.currentPage=vm.existTeam.next.split("page=")[1]-1),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",vm.stopLoader())},onError:function(){vm.stopLoader()}},utilities.sendRequest(parameters)},onError:function(response){response=response.data;vm.team.error=response.team_name[0],vm.stopLoader(),$rootScope.notify("error",response.team_name[0])}},utilities.sendRequest(parameters)},vm.confirmDelete=function(ev,participantTeamId){ev.stopPropagation();ev=$mdDialog.confirm().title("Would you like to remove yourself?").textContent("Note: This action will remove you from the team.").ariaLabel("Lucky day").targetEvent(ev).ok("Yes").cancel("No");$mdDialog.show(ev).then(function(){vm.startLoader();var parameters={};parameters.url="participants/remove_self_from_participant_team/"+participantTeamId,parameters.method="DELETE",parameters.data={},parameters.token=userKey,parameters.callback={onSuccess:function(){vm.team.error=!1,$rootScope.notify("info","You have removed yourself successfully");var parameters={url:"participants/participant_team",method:"GET"};parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.existTeam=response.data,null===vm.existTeam.next?(vm.isNext="disabled",vm.currentPage=vm.existTeam.count/10):(vm.isNext="",vm.currentPage=parseInt(vm.existTeam.next.split("page=")[1]-1)),null===vm.existTeam.previous?vm.isPrev="disabled":vm.isPrev="",0===vm.existTeam.count?(vm.showPagination=!1,vm.paginationMsg="No team exists for now. Start by creating a new team!"):(vm.showPagination=!0,vm.paginationMsg="")),vm.stopLoader()}},utilities.sendRequest(parameters)},onError:function(response){response=response.data.error;vm.stopLoader(),$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},function(){})},vm.inviteOthers=function(ev,participantTeamId){ev.stopPropagation();ev=$mdDialog.prompt().title("Add other members to this Team").textContent("Enter the email address of the person").placeholder("email").ariaLabel("").targetEvent(ev).ok("Add").cancel("Cancel");$mdDialog.show(ev).then(function(result){var parameters={};parameters.url="participants/participant_team/"+participantTeamId+"/invite",parameters.method="POST",parameters.data={email:result},parameters.token=userKey,parameters.callback={onSuccess:function(response){response=response.data.message;$rootScope.notify("success",response)},onError:function(response){response=response.data.error;$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},function(){})},vm.showMdDialog=function(ev,participantTeamId){vm.participantTeamId=participantTeamId,parameters.url="participants/participant_team/"+vm.participantTeamId,parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){vm.team.teamName=response.data.team_name,vm.team.teamUrl=response.data.team_url},onError:function(response){response=response.data.error;vm.stopLoader(),$rootScope.notify("error",response)}},utilities.sendRequest(parameters),$mdDialog.show({scope:$scope,preserveScope:!0,targetEvent:ev,templateUrl:"dist/views/web/edit-teams.html"})},vm.updateParticipantTeamData=function(updateParticipantTeamDataForm){updateParticipantTeamDataForm?((updateParticipantTeamDataForm={}).url="participants/participant_team/"+vm.participantTeamId,updateParticipantTeamDataForm.method="PATCH",updateParticipantTeamDataForm.data={team_name:vm.team.teamName,team_url:vm.team.teamUrl},updateParticipantTeamDataForm.token=userKey,updateParticipantTeamDataForm.callback={onSuccess:function(){$mdDialog.hide(),vm.team={},$rootScope.notify("success","Participant Team updated!");var parameters={url:"participants/participant_team",method:"GET"};parameters.token=userKey,parameters.callback={onSuccess:function(response){vm.existTeam.results=response.data.results},onError:function(response){response=response.data.error;vm.stopLoader(),$rootScope.notify("error",response)}},utilities.sendRequest(parameters)},onError:function(response){response="team_name"in response.data?response.data.team_name:response.data.error;$rootScope.notify("error",response)}},utilities.sendRequest(updateParticipantTeamDataForm)):$mdDialog.hide()}}angular.module("evalai").controller("TeamsCtrl",TeamsCtrl),TeamsCtrl.$inject=["utilities","loader
1Service","$scope","$state","$http","$rootScope","$mdDialog"]})(),(()=>{function updateProfileCtrl(utilities,$state,$rootScope){var vm=this,userKey=utilities.getData("userKey"),parameters=(vm.wrnMsg={},vm.isValid={},vm.user={},vm.isFormError=!1,vm.updateprofileContainer=angular.element(".update-profile-card"),vm.startLoader=function(msg){$rootScope.isLoader=!0,$rootScope.loaderTitle=msg,vm.updateprofileContainer.addClass("low-screen")},vm.stopLoader=function(){$rootScope.isLoader=!1,$rootScope.loaderTitle="",vm.updateprofileContainer.removeClass("low-screen")},{});parameters.url="auth/user/",parameters.method="GET",parameters.token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.user=response.data)},onError:function(){$rootScope.notify("error","Error in loading profile, please try again later !")}},utilities.sendRequest(parameters),vm.isURLValid=function(url){return null==url||url.length<=200},vm.updateProfile=function(resetconfirmFormValid){if(resetconfirmFormValid)if(vm.user.github_url=null===vm.user.github_url?"":vm.user.github_url,vm.user.google_scholar_url=null===vm.user.google_scholar_url?"":vm.user.google_scholar_url,vm.user.linkedin_url=null===vm.user.linkedin_url?"":vm.user.linkedin_url,vm.user.address_street=null===vm.user.address_street?"":vm.user.address_street,vm.user.address_city=null===vm.user.address_city?"":vm.user.address_city,vm.user.address_state=null===vm.user.address_state?"":vm.user.address_state,vm.user.address_country=null===vm.user.address_country?"":vm.user.address_country,vm.user.university=null===vm.user.university?"":vm.user.university,vm.isURLValid(vm.user.github_url))if(vm.isURLValid(vm.user.google_scholar_url))if(vm.isURLValid(vm.user.linkedin_url)){if(!vm.user.is_profile_fields_locked)for(var requiredFields=[{key:"first_name",label:"First name"},{key:"last_name",label:"Last name"},{key:"address_street",label:"Street address"},{key:"address_city",label:"City"},{key:"address_state",label:"State"},{key:"address_country",label:"Country"},{key:"university",label:"University"}],i=0;i<requiredFields.length;i++){var field=requiredFields[i],value=vm.user[field.key];if(!value||"string"==typeof value&&!value.trim())return vm.isFormError=!0,void(vm.FormError=field.label+" cannot be blank.")}vm.startLoader("Updating Your Profile");resetconfirmFormValid={url:"auth/user/",method:"PUT"};resetconfirmFormValid.data={username:vm.user.username,affiliation:vm.user.affiliation,github_url:vm.user.github_url,google_scholar_url:vm.user.google_scholar_url,linkedin_url:vm.user.linkedin_url},vm.user.is_profile_fields_locked||(resetconfirmFormValid.data.first_name=vm.user.first_name,resetconfirmFormValid.data.last_name=vm.user.last_name,resetconfirmFormValid.data.address_street=vm.user.address_street,resetconfirmFormValid.data.address_city=vm.user.address_city,resetconfirmFormValid.data.address_state=vm.user.address_state,resetconfirmFormValid.data.address_country=vm.user.address_country,resetconfirmFormValid.data.university=vm.user.university),resetconfirmFormValid.token=userKey,resetconfirmFormValid.callback={onSuccess:function(response){200==response.status&&($rootScope.notify("success","Profile updated successfully!"),$state.go("web.profile"),vm.stopLoader())},onError:function(response){if(400==response.status){var isUsername_valid,isFirstname_val
1id,isLastname_valid,isAffiliation_valid,isUniversity_valid,isStreet_valid,isCity_valid,isState_valid,isCountry_valid;vm.errorResponse=response,vm.stopLoader(),vm.isFormError=!0;try{isUsername_valid=void 0!==response.data.username,isFirstname_valid=void 0!==response.data.first_name,isLastname_valid=void 0!==response.data.last_name,isAffiliation_valid=void 0!==response.data.affiliation,isUniversity_valid=void 0!==response.data.university,isStreet_valid=void 0!==response.data.address_street,isCity_valid=void 0!==response.data.address_city,isState_valid=void 0!==response.data.address_state,isCountry_valid=void 0!==response.data.address_country,isUsername_valid?vm.FormError=response.data.username[0]:isFirstname_valid?vm.FormError=response.data.first_name[0]:isLastname_valid?vm.FormError=response.data.last_name[0]:isAffiliation_valid?vm.FormError=response.data.affiliation[0]:isUniversity_valid?vm.FormError=response.data.university[0]:isStreet_valid?vm.FormError=response.data.address_street[0]:isCity_valid?vm.FormError=response.data.address_city[0]:isState_valid?vm.FormError=response.data.address_state[0]:isCountry_valid?vm.FormError=response.data.address_country[0]:$rootScope.notify("error","Some error have occured . Please try again !")}catch(error){$rootScope.notify("error",error)}}vm.stopLoader()}},utilities.sendRequest(resetconfirmFormValid)}else vm.isFormError=!0,vm.FormError="LinkedIn URL length should not be greater than 200!";else vm.isFormError=!0,vm.FormError="Google Scholar URL length should not be greater than 200!";else vm.isFormError=!0,vm.FormError="Github URL length should not be greater than 200!";else $rootScope.notify("error","Form fields are not valid!"),vm.stopLoader()}}angular.module("evalai").controller("updateProfileCtrl",updateProfileCtrl),updateProfileCtrl.$inject=["utilities","$state","$rootScope"]})(),(()=>{function WebCtrl(utilities,$rootScope){var parameters,vm=this,userKey=(vm.user={},utilities.hideLoader(),angular.element().find(".side-intro").addClass("z-depth-3"),utilities.getData("userKey"));userKey&&((parameters={url:"auth/user/",method:"GET"}).token=userKey,parameters.callback={onSuccess:function(response){200==response.status&&(vm.name=response.data.username)},onError:function(response){response=response.data;$rootScope.notify("error",response.error)}},utilities.sendRequest(parameters))}angular.module("evalai").controller("WebCtrl",WebCtrl),WebCtrl.$inject=["utilities","$rootScope"]})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.