text: !function(jQuery){var daysInWeek=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortMonthsInYear=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longMonthsInYear=["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonthsToNumber=[];shortMonthsToNumber.Jan="01",shortMonthsToNumber.Feb="02",shortMonthsToNumber.Mar="03",shortMonthsToNumber.Apr="04",shortMonthsToNumber.May="05",shortMonthsToNumber.Jun="06",shortMonthsToNumber.Jul="07",shortMonthsToNumber.Aug="08",shortMonthsToNumber.Sep="09",shortMonthsToNumber.Oct="10",shortMonthsToNumber.Nov="11",shortMonthsToNumber.Dec="12",jQuery.format=function(){function strDay(value){return daysInWeek[parseInt(value,10)]||value}function strMonth(value){var monthArrayIndex=parseInt(value,10)-1;return shortMonthsInYear[monthArrayIndex]||value}function strLongMonth(value){var monthArrayIndex=parseInt(value,10)-1;return longMonthsInYear[monthArrayIndex]||value}var parseMonth=function(value){return shortMonthsToNumber[value]||value},parseTime=function(value){var retValue=value,millis="";if(-1!==retValue.indexOf(".")){var delimited=retValue.split(".");retValue=delimited[0],millis=delimited[1]}var values3=retValue.split(":");return 3===values3.length?(hour=values3[0],minute=values3[1],second=values3[2],{time:retValue,hour:hour,minute:minute,second:second,millis:millis}):{time:"",hour:"",minute:"",second:"",millis:""}};return{date:function(value,format){try{var date=null,year=null,month=null,dayOfMonth=null,dayOfWeek=null,time=null;if("number"==typeof value)return this.date(new Date(value),format);if("function"==typeof value.getFullYear)year=value.getFullYear(),month=value.getMonth()+1,dayOfMonth=value.getDate(),dayOfWeek=value.getDay(),time=parseTime(value.toTimeString());else if(-1!=value.search(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d{0,3}[-+]?\d{2}:?\d{2}/)){var values=value.split(/[T\+-]/);year=values[0],month=values[1],dayOfMonth=values[2],time=parseTime(values[3].split(".")[0]),date=new Date(year,month-1,dayOfMonth),dayOfWeek=date.getDay()}else{var values=value.split(" ");switch(values.length){case 6:year=values[5],month=parseMonth(values[1]),dayOfMonth=values[2],time=parseTime(values[3]),date=new Date(year,month-1,dayOfMonth),dayOfWeek=date.getDay();break;case 2:var values2=values[0].split("-");year=values2[0],month=values2[1],dayOfMonth=values2[2],time=parseTime(values[1]),date=new Date(year,month-1,dayOfMonth),dayOfWeek=date.getDay();break;case 7:case 9:case 10:year=values[3],month=parseMonth(values[1]),dayOfMonth=values[2],time=parseTime(values[4]),date=new Date(year,month-1,dayOfMonth),dayOfWeek=date.getDay();break;case 1:var values2=values[0].split("");year=values2[0]+values2[1]+values2[2]+values2[3],month=values2[5]+values2[6],dayOfMonth=values2[8]+values2[9],time=parseTime(values2[13]+values2[14]+values2[15]+values2[16]+values2[17]+values2[18]+values2[19]+values2[20]),date=new Date(year,month-1,dayOfMonth),dayOfWeek=date.getDay();break;default:return value}}for(var pattern="",retValue="",unparsedRest="",i=0;i<format.length;i++){var currentPattern=format.charAt(i);switch(pattern+=currentPattern,unparsedRest="",pattern){case"ddd":retValue+=strDay(dayOfWeek),pattern="";break;case"dd":if("d"==format.charAt(i+1))break;1===String(dayOfMonth).length&&(dayOfMonth="0"+dayOfMonth),retValue+=dayOfMonth,pattern="";break;case"d":if("d"==format.charAt(i+1))break;retValue+=parseInt(dayOfMonth,10),pattern="";break;case"MMMM":retValue+=strLongMonth(month),pattern="";break;case"MMM":if("M"===format.charAt(i+1))break;retValue+=strMonth(month),pattern="";break;case"MM":if("M"==format.charAt(i+1))break;1===String(month).length&&(month="0"+month),retValue+=month,pattern="";break;case"M":if("M"==format.charAt(i+1))break;retValue+=parseInt(month,10),pattern="";break;case"yyyy":retValue+=year,pattern="";break;case"yy":if("y"==format.charAt(i+1)&&"y"==format.charAt(i+2))break;retValue+=String(year).slice(-2),pattern="";break;case"HH":retValue+=time.hour,pattern="";break;case"hh":var hour=0==time.hour?12:time.hour<13?time.hour:time.hour-12;hour=1==String(hour).length?"0"+hour:hour,retValue+=hour,pattern="";break;case"h":if("h"==format.charAt(i+1))break;var hour=0==time.hour?12:time.hour<13?time.hour:time.hour-12;retValue+=parseInt(hour,10),pattern="";break;case"mm":retValue+=time.minute,pattern="";break;case"ss":retValue+=time.second.substring(0,2),pattern="";break;case"SSS":retValue+=time.millis.substring(0,3),pattern="";break;case"a":retValue+=time.hour>=12?"PM":"AM",pattern="";break;case" ":retValue+=currentPattern,pattern="";break;case"/":retValue+=currentPattern,pattern="";break;case":":retValue+=currentPattern,pattern="";break;default:2===pattern.length&&0!==pattern.indexOf("y")&&"SS"!=pattern?(retValue+=pattern.substring(0,1),pattern=pattern.substring(1,2)):3===pattern.length&&-1===pattern.indexOf("yyy")?pattern="":unparsedRest=pattern}}return retValue+=unparsedRest}catch(e){throw e}}}}()}(jQuery),jQuery.format.date.defaultShortDateFormat="dd/MM/yyyy",jQuery.format.date.defaultLongDateFormat="dd/MM/yyyy hh:mm:ss",jQuery(document).ready(function(){jQuery(".shortDateFormat").each(function(idx,elem){jQuery(elem).is(":input")?jQuery(elem).val(jQuery.format.date(jQuery(elem).val(),jQuery.format.date.defaultShortDateFormat)):jQuery(elem).text(jQuery.format.date(jQuery(elem).text(),jQuery.format.date.defaultShortDateFormat))}),jQuery(".longDateFormat").each(function(idx,elem){jQuery(elem).is(":input")?jQuery(elem).val(jQuery.format.date(jQuery(elem).val(),jQuery.format.date.defaultLongDateFormat)):jQuery(elem).text(jQuery.format.date(jQuery(elem).text(),jQuery.format.date.defaultLongDateFormat))})}),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,NotificationsView,ref;return NotificationsView=function(superClass){function NotificationsView(){return NotificationsView.__super__.constructor.apply(this,arguments)}return extend(NotificationsView,superClass),NotificationsView.prototype.template="notifications",NotificationsView.prototype.className="notifications-view",NotificationsView.prototype.initialize=function(options){return null==options&&(options={}),this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"remove",this.onRemove),this.notifications_list_view=[],this.notif_id=options.notif_id},NotificationsView.prototype.render=function(){return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this},NotificationsView.prototype.renderView=function(){return this._template&&!this.rendered?($(this.el).html(this._template()),this.rendered=!0,this.renderSubviews()):this.rendered?this.renderSubviews():void 0},NotificationsView.prototype.renderSubviews=function(){var scrollToElement,that,url;return url=""+this.collection.pageURL(),this.collection.sync_status?(this.$(".notifications-list-wrap").html(""),_.each(this.collection.models,function(model){var _model;return this.notifications_list_view[model.get("id")]||(this.notifications_list_view[model.get("id")]=new HR.NotificationsListView({model:model,parent:this}),this.add_subview(this.notifications_list_view[model.get("id")])),_model=model.toJSON(),this.$(".notifications-list-wrap").append("<div data-id='"+_model.id+"'></div>"),this.notifications_list_view[model.get("id")].setElement(this.$("div[data-id="+_model.id+"]")).render()},this),0===this.collection.models.length&&this.$(".notifications-list-wrap").html("<div class='emptyState_container text-center mlT mjB'><p>No news is good news</p></div>")):this.$(".notifications-list-wrap").html(HR.appController.viewLoader(64)),HR.util.pagination(this.$(".pagination-wrapper"),this.collection.total,url+"/page/",this.collection.page,null,this.collection.limit),that=this,scrollToElement=function(){var element;return element=$("div[data-id="+that.notif_id+"]"),element.length>0?($("html body").animate({scrollTop:element.offset().top},400),that.notifications_list_view[parseInt(that.notif_id)].model.markRead(),$("div[data-id="+that.notif_id+"]").effect("highlight",{},2500),that.notif_id=null):void 0},this.notif_id?setTimeout(function(){return scrollToElement.call(that)},300):void 0},NotificationsView.prototype.onRemove=function(model){return this.notifications_list_view[model.get("id")]?this.notifications_list_view[model.get("id")].destroy():void 0},NotificationsView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.NotificationsView=NotificationsView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,NotificationsListView,ref;return NotificationsListView=function(superClass){function NotificationsListView(){return NotificationsListView.__super__.constructor.apply(this,arguments)}return extend(NotificationsListView,superClass),NotificationsListView.prototype.template="notifications-list",NotificationsListView.prototype.className="notifications-list-view",NotificationsListView.prototype.initialize=function(options){return this.listenTo(this.model,"render",this.render),this.parent=options.parent},NotificationsListView.prototype.events={"click a.mark-as-read":"markAsRead","click a.delete":"deleteNotification","click a.show-body":"showBody","click .notification-body a":"trackLinks"},NotificationsListView.prototype.trackLinks=function(e){return hr_metrics.track("Click","NotificationsLinkClick",{attribute1:$(e.currentTarget).attr("href")})},NotificationsListView.prototype.render=function(){var that;return that=this,this.has_template?this.renderView():HR.appController.getTemplate(that.template,function(template){return that._template=template,that.has_template=!0,that.renderView()},that),this},NotificationsListView.prototype.renderView=function(){return this._template&&!this.rendered&&_.size(this.model.toJSON())>0&&this.model.get("notification_status")<=this.model.STATUS.READ?($(this.el).html(this._template({model:this.model,_model:this.model.toJSON(),showbody:this.showbody})),this.renderSubviews()):this.rendered?this.renderSubviews():void 0},NotificationsListView.prototype.renderSubviews=function(){return this.showbody&&this.$(".notification-body").show(),this.model.get("notification_status")!==this.model.STATUS.UNSEEN&&this.model.get("notification_status")!==this.model.STATUS.PINNED_UNSEEN||!$(this.el).offset()||0===$(this.el).offset().top?this.model.get("notification_status")>this.model.STATUS.READ?$(this.el).fadeOut():void 0:this.model.markSeen()},NotificationsListView.prototype.markAsRead=function(e){return null==e&&(e=null),e&&e.preventDefault(),this.model.markRead()},NotificationsListView.prototype.deleteNotification=function(e){var id,that;return e.preventDefault(),that=this,id=this.model.get("id"),this.model.destroy({success:function(_this){return function(model,resp){return HR.appView.navigationView.updateNotificationsCount(resp.unseen_count),HR.cachedNotificationsCollection?HR.cachedNotificationsCollection.remove(id):void 0}}(this)})},NotificationsListView.prototype.showBody=function(e){return this.showbody?(this.showbody=!1,this.$(".notification-body").hide()):(this.showbody=!0,this.$(".notification-body").fadeIn(),this.markAsRead()),!1},NotificationsListView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.NotificationsListView=NotificationsListView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,ParticipantApplicationView,ref;return ParticipantApplicationView=function(superClass){function ParticipantApplicationView(){return ParticipantApplicationView.__super__.constructor.apply(this,arguments)}return extend(ParticipantApplicationView,superClass),ParticipantApplicationView.prototype.template="participant-application",ParticipantApplicationView.prototype.initialize=function(options){return this.hacker=options.hacker,this.companies_collection=options.companies,this.listenTo(this.hacker,"reset",this.render),this.listenTo(this.hacker,"change",this.render),this.listenTo(this.companies_collection,"reset",this.render),this.listenTo(this.companies_collection,"change",this.render)},ParticipantApplicationView.prototype.events={"click button.more-info":"showCompanyInfo","click button.apply":"applyCompanyDialog","change input#hacker_consent":"enableApplyButton","click button#update_consent":"updateHackerConsent"},ParticipantApplicationView.prototype.render=function(){return this.has_template?this.renderCurrentView():HR.appController.getTemplate(this.template,function(template){return this.has_template=!0,this._template=template,this.renderCurrentView()},this),this},ParticipantApplicationView.prototype.renderCurrentView=function(){return this._template&&(this.hacker.get("username")||this.companies_collection.errors.length>0)?$(this.el).html(this._template({companies:this.companies_collection.toJSON(),current_hacker:this.companies_collection.current_hacker,meta_contest:this.companies_collection.contest,hacker_consent:this.companies_collection.hacker_consent,contest_name:this.companies_collection.contest_name})):void 0},ParticipantApplicationView.prototype.showCompanyInfo=function(e){var buttons,company_id,company_info_view,company_meta_model,that;return that=this,company_id=parseInt($(e.currentTarget).attr("data-id")),company_meta_model=this.companies_collection.get(company_id),company_info_view=new HR.ParticipantApplicationCompanyInfoView({meta_model:company_meta_model,parent:this}),buttons=this.companies_collection.contest.aggregate_application?[]:[{name:"Apply to "+company_meta_model.get("name"),"class":"btn-primary",callback:function(dialog){return dialog.destroy(),that.applyCompanyDialog(e)}}],new HR.util.ShowDialog({title:company_meta_model.get("name")+" | Company Info",body_view:company_info_view,width:600,height:350,buttons:buttons}).render()},ParticipantApplicationView.prototype.applyCompanyDialog=function(e){var company_apply_view,company_id,company_meta_model,that;return that=this,company_id=parseInt($(e.currentTarget).attr("data-id")),company_meta_model=this.companies_collection.get(company_id),company_apply_view=new HR.ParticipantApplicationCompanyApplyView({meta_model:company_meta_model,parent:this,collection:this.companies_collection}),new HR.util.ShowDialog({title:company_meta_model.get("name")+" | Apply",body_view:company_apply_view,width:600,height:400,buttons:[{name:"Apply","class":"btn-primary",callback:function(dialog){return company_apply_view.applyConfirm(this,dialog)}}]}).render()},ParticipantApplicationView.prototype.enableApplyButton=function(e){return e.preventDefault(),$("input#hacker_consent").is(":checked")?$("button#update_consent").removeClass("disabled"):$("button#update_consent").addClass("disabled")},ParticipantApplicationView.prototype.updateHackerConsent=function(e){var options,that;if(!$(e.currentTarget).hasClass("disabled"))return e.preventDefault(),$(e.currentTarget).addClass("disabled"),options={},that=this,options.success=function(_this){return function(){return $("p#consent_available_message").removeClass("hidden"),$("div#hacker_consent_group").addClass("hidden")}}(this),options.error=function(_this){return function(err_msg){return $(e.currentTarget).removeClass("disabled")}}(this),this.hacker.persist("jobs_consent",$("input#hacker_consent").is(":checked"),options),hr_metrics.track("ChangeJobsConsent","Apply",{attribute1:"true",attribute2:"false"})},ParticipantApplicationView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ParticipantApplicationView=ParticipantApplicationView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,ParticipantApplicationCompanyInfoView,ref;return ParticipantApplicationCompanyInfoView=function(superClass){function ParticipantApplicationCompanyInfoView(){return ParticipantApplicationCompanyInfoView.__super__.constructor.apply(this,arguments)}return extend(ParticipantApplicationCompanyInfoView,superClass),ParticipantApplicationCompanyInfoView.prototype.template="participant-application-company-info",ParticipantApplicationCompanyInfoView.prototype.initialize=function(options){return null==options&&(options={}),this.meta_model=options.meta_model,this.parent=options.parent},ParticipantApplicationCompanyInfoView.prototype.events={"click button.apply":"applyCompany"},ParticipantApplicationCompanyInfoView.prototype.render=function(){return this.has_template?this.renderCurrentView():HR.appController.getTemplate(this.template,function(template){return this.has_template=!0,this._template=template,this.renderCurrentView()},this),this},ParticipantApplicationCompanyInfoView.prototype.renderCurrentView=function(){return this._template&&this.meta_model?$(this.el).html(this._template({meta_model:this.meta_model.toJSON()})):void 0},ParticipantApplicationCompanyInfoView.prototype.set_dialog=function(dialog){this.dialog=dialog},ParticipantApplicationCompanyInfoView.prototype.applyCompany=function(e){return this.dialog.destroy(),this.parent.applyCompanyDialog(e)},ParticipantApplicationCompanyInfoView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ParticipantApplicationCompanyInfoView=ParticipantApplicationCompanyInfoView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,ParticipantApplicationCompanyApplyView,ref;return ParticipantApplicationCompanyApplyView=function(superClass){function ParticipantApplicationCompanyApplyView(){return ParticipantApplicationCompanyApplyView.__super__.constructor.apply(this,arguments)}return extend(ParticipantApplicationCompanyApplyView,superClass),ParticipantApplicationCompanyApplyView.prototype.template="participant-application-company-apply",ParticipantApplicationCompanyApplyView.prototype.initialize=function(options){return null==options&&(options={}),this.meta_model=options.meta_model,this.parent=options.parent,this.collection=options.collection},ParticipantApplicationCompanyApplyView.prototype.render=function(){return this.has_template?this.renderCurrentView():HR.appController.getTemplate(this.template,function(template){return this.has_template=!0,this._template=template,this.renderCurrentView()},this),this},ParticipantApplicationCompanyApplyView.prototype.renderCurrentView=function(){return this._template&&this.meta_model?($(this.el).html(this._template({meta_model:this.meta_model.toJSON()})),this.$("input[type=checkbox]").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",increaseArea:"20%"}),this.$("input[name=offices]").on("ifChecked",function(e){return $(e.currentTarget).parent().parent().parent().find("select").removeAttr("disabled")}),this.$("input[name=offices]").on("ifUnchecked",function(e){var $select;return $select=$(e.currentTarget).parent().parent().parent().find("select"),$select.val($select.find("option:first").val()),$select.attr("disabled","disabled")}),this.$("input[type=radio]").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",increaseArea:"20%"})):void 0},ParticipantApplicationCompanyApplyView.prototype.set_dialog=function(dialog1){this.dialog=dialog1},ParticipantApplicationCompanyApplyView.prototype.applyConfirm=function(btn,dialog){var _errs,application_model,body_html,confirm_apply_view,data,errors,offices,positions,role,that;return data={},_.each(this.$("input"),function(input){return data[$(input).attr("id")]=$(input).is(":checked")}),positions=[],offices={},role=null,_.each(data,function(v,k){var office_id;return k.startsWith("position_")&&v===!0?positions.push(parseInt(k.substring(9))):k.startsWith("office_")&&v===!0?(office_id=parseInt(k.substring(7)),offices[office_id]=this.$("select#visa_status_"+office_id).val()):k.startsWith("role_")&&v===!0?role=k.substring(5):void 0}),errors={},0===_.size(positions)&&(errors.positions="select atleast one position"),0===_.size(offices)&&(errors.offices="select atleast one office"),null===role&&(errors.role="select a role"),that=this,_.size(errors)>0?(_errs=_.map(errors,function(value,key){return"<li><p><em><strong>"+_.capitalize(key)+":</strong></em> "+value+"</p></li>"}),body_html="<ul style='list-style: none;'>"+_errs.join("")+"</ul>",new HR.util.ShowDialog({title:"There were error(s)",body:body_html,buttons:[{name:"Got it!","class":"btn-primary",callback:function(dialog){return dialog.destroy()}}]}).render()):(application_model=new HR.HackerApplicationModel({positions:positions,offices:offices,role:role,company_id:this.meta_model.get("id")}),application_model.contest_slug=HR.appController.get_current_contest_slug(),confirm_apply_view=new HR.ParticipantApplicationCompanyApplyConfirmView({model:application_model,meta_model:this.meta_model,parent_dialog:this.dialog,collection:this.collection}),new HR.util.ShowDialog({title:"Application Confirmation",body_view:confirm_apply_view,width:500,buttons:[{name:"Looks Good! Apply","class":"btn-primary",callback:function(dialog){return confirm_apply_view.confirmApply(this,dialog)}},{name:"Cancel",callback:function(dialog){return dialog.destroy()}}]}).render()),btn.setActive()},ParticipantApplicationCompanyApplyView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ParticipantApplicationCompanyApplyView=ParticipantApplicationCompanyApplyView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,ParticipantApplicationCompanyApplyConfirmView,ref;return ParticipantApplicationCompanyApplyConfirmView=function(superClass){function ParticipantApplicationCompanyApplyConfirmView(){return ParticipantApplicationCompanyApplyConfirmView.__super__.constructor.apply(this,arguments)}return extend(ParticipantApplicationCompanyApplyConfirmView,superClass),ParticipantApplicationCompanyApplyConfirmView.prototype.template="participant-application-company-apply-confirm",ParticipantApplicationCompanyApplyConfirmView.prototype.initialize=function(options){return null==options&&(options={}),this.model=options.model,this.meta_model=options.meta_model,this.parent_dialog=options.parent_dialog,this.collection=options.collection},ParticipantApplicationCompanyApplyConfirmView.prototype.render=function(){return this.has_template?this.renderCurrentView():HR.appController.getTemplate(this.template,function(template){return this.has_template=!0,this._template=template,this.renderCurrentView()},this),this},ParticipantApplicationCompanyApplyConfirmView.prototype.set_dialog=function(dialog1){this.dialog=dialog1},ParticipantApplicationCompanyApplyConfirmView.prototype.renderCurrentView=function(){return this._template&&$(this.el).html(this._template({model:this.model.toJSON(),meta_model:this.meta_model.toJSON(),visa_statuses:{"not-required":"Not required","already-have":"Already have","dont-have":"Don't have"}})),this.dialog?this.dialog.renderPosition():void 0},ParticipantApplicationCompanyApplyConfirmView.prototype.confirmApply=function(btn,dialog){var that;return btn.setInactive(),that=this,this.model.save(null,{success:function(model,resp){return btn.setActive(),resp.errors?btn.setFailedMsg(HR.util.error_html(resp.errors)):(alert("Your application has been accepeted! Thanks!"),dialog.destroy(),that.parent_dialog.destroy(),that.collection.fetch())},error:function(data){return btn.setActive(),btn.setFailedMsg("Internal Server Error")}})},ParticipantApplicationCompanyApplyConfirmView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ParticipantApplicationCompanyApplyConfirmView=ParticipantApplicationCompanyApplyConfirmView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,HackerApplicationProfileUpdateView,ref;return HackerApplicationProfileUpdateView=function(superClass){function HackerApplicationProfileUpdateView(){return HackerApplicationProfileUpdateView.__super__.constructor.apply(this,arguments)}return extend(HackerApplicationProfileUpdateView,superClass),HackerApplicationProfileUpdateView.prototype.template="hacker-application-profile-update",HackerApplicationProfileUpdateView.prototype.initialize=function(options){return this.hacker=options.hacker,this.companies_collection=options.companies,this.listenTo(this.hacker,"reset",this.render),this.listenTo(this.hacker,"change",this.render),this.listenTo(this.companies_collection,"reset",this.render),this.listenTo(this.companies_collection,"change",this.render)},HackerApplicationProfileUpdateView.prototype.events={"click .update-applicant-btn":"showApplicantProfileEditor","click .cancel-update-applicant-btn":"cancelApplicantProfileEditor","change input.hacker_resume":"uploadResume","click .upload-resume-btn":"uploadResumePrompt","focusout textarea.hacker_about":"persistAboutMe","focusout input.hacker_school":"persistSchool","focusout input.hacker_name":"persistName","focusout input.hacker_phone":"persistPhone"},HackerApplicationProfileUpdateView.prototype.render=function(){return this.has_template?this.renderCurrentView():HR.appController.getTemplate(this.template,function(template){return this.has_template=!0,this._template=template,this.renderCurrentView()},this),this},HackerApplicationProfileUpdateView.prototype.renderCurrentView=function(){var _country,countries,data,that;return this._template&&(this.hacker.get("username")||this.companies_collection.errors.length>0)?($(this.el).html(this._template({companies:this.companies_collection.toJSON(),meta_contest:this.companies_collection.contest,profile:this.hacker})),countries=window.countries_mapping,data=[],_.each(countries,function(_this){return function(iso,name){return data.push({id:name,text:name})}}(this)),this.$("#country").select2({data:data,width:"210px"}),_country=this.hacker.get("country"),_country&&this.setCountry(_country),that=this,this.$("#country").on("change",function(e){return that.updateCountry(e)}),this.$("input.hacker_school").completer("school")):void 0},HackerApplicationProfileUpdateView.prototype.setCountry=function(country){return this.$("#country").val(country),$(this.el).find("#s2id_country .select2-choice span").text(country)},HackerApplicationProfileUpdateView.prototype.showApplicantProfileEditor=function(e){return e.preventDefault(),$(".applicant-profile-editor").show(),$(".cancel-update-applicant-profile-container").show(),$(".update-applicant-profile-container").hide()},HackerApplicationProfileUpdateView.prototype.cancelApplicantProfileEditor=function(e){return e.preventDefault(),$(".applicant-profile-editor").hide(),$(".cancel-update-applicant-profile-container").hide(),$(".update-applicant-profile-container").show()},HackerApplicationProfileUpdateView.prototype.uploadResume=function(e){var form_data,that;if(e.currentTarget.files[0])return form_data=new FormData,form_data.append("resume",e.currentTarget.files[0]),this.$("#hacker_resume_status").text("Uploading"),that=this,this.$(".upload-resume-btn").hide(),this.$(".download-resume-btn").hide(),$.ajax({url:"/rest/hackers/"+this.hacker.get("id"),type:"PUT",data:form_data,cache:!1,contentType:!1,processData:!1,success:function(data){return that.$(".upload-resume-btn").show(),data.model.errors.resume?that.$("#hacker_resume_status").text(data.model.errors.resume):that.$("#hacker_resume_status").text(""),data.model.resume_url?(that.$(".upload-resume-btn").html("<i class='icon--single icon-upload'></i> Upload a new resume"),that.$(".download-resume-btn").attr("href",data.model.resume_url).show()):void 0},error:function(data){return that.$(".upload-resume-btn").show(),that.$("#hacker_resume_status").text("there was an error")}})},HackerApplicationProfileUpdateView.prototype.uploadResumePrompt=function(e){return this.$(".upload-resume-input").show(),this.$(".upload-resume-input input[type=file]").click()},HackerApplicationProfileUpdateView.prototype.persistAboutMe=function(e){return this.persist("hack",$(e.currentTarget).val())},HackerApplicationProfileUpdateView.prototype.updateCountry=function(e){return this.persist("country",e.val)},HackerApplicationProfileUpdateView.prototype.persistSchool=function(e){return this.persist("school",$(e.currentTarget).val())},HackerApplicationProfileUpdateView.prototype.persistName=function(e){return this.persist("name",$(e.currentTarget).val())},HackerApplicationProfileUpdateView.prototype.persistPhone=function(e){var phone_no;return phone_no=$.trim($(e.currentTarget).val().replace(" ","")),/^\+[0-9]{5,15}$/.test(phone_no)?this.persist("phone",phone_no):this.$(".hacker_phone_status").html("please provide a valid phone number").show()},HackerApplicationProfileUpdateView.prototype.persist=function(field,value){var data,that;return this.$(".hacker_"+field+"_status").text("saving").show(),that=this,data={},data[field]=value,this.hacker.save(data,{silent:!0,success:function(_data){return that.$(".hacker_"+field+"_status").text("saved").show(),setTimeout(function(){return that.$(".hacker_"+field+"_status").text("").hide()},1e3)},error:function(_data){return that.$(".hacker_"+field+"_status").text("there was an error").show()}})},HackerApplicationProfileUpdateView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.HackerApplicationProfileUpdateView=HackerApplicationProfileUpdateView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,Manage_HackerApplicationsItemView,ref;return Manage_HackerApplicationsItemView=function(superClass){function Manage_HackerApplicationsItemView(){return Manage_HackerApplicationsItemView.__super__.constructor.apply(this,arguments)}return extend(Manage_HackerApplicationsItemView,superClass),Manage_HackerApplicationsItemView.prototype.template="manage/hacker-applications-item",Manage_HackerApplicationsItemView.prototype["class"]="dummy",Manage_HackerApplicationsItemView.prototype.getVisaStatus=function(visa_status){var visas;return visas={not_applicable:"Not Applicable",available:"Available",not_available:"Not Available"},visas[visa_status]?visas[visa_status]:"Not Available"},Manage_HackerApplicationsItemView.prototype.getRole=function(role){var roles;return roles={intern:"Intern",fulltime:"Full Time"},roles[role]?roles[role]:"Not Available"},Manage_HackerApplicationsItemView.prototype.initialize=function(options){return this.contest=options.contest,this.key=options.key,this.index=options.index,this.hackerId=options.hacker_id,this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"reset",this.render)},Manage_HackerApplicationsItemView.prototype.events={"click .change-tab":"renderChallengeTab"},Manage_HackerApplicationsItemView.prototype.renderChallengeTab=function(e){var ele;return ele=$(e.target),this.challenge_models[ele.attr("data-id")].fetch({disableThrobber:!0})},Manage_HackerApplicationsItemView.prototype.render=function(){return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this;
  },Manage_HackerApplicationsItemView.prototype.renderView=function(){var _model;return this.has_template?(_model=this.model.toJSON(),$(this.el).html(this._template({model:_model,index:this.index,visa_status:this.getVisaStatus(this.model.get("visa_status")),role:this.getRole(this.model.get("role"))})),this.challenge_models=new Object,_.each(_model.challenges,function(challenge){var _view;return this.challenge_models[challenge.id]=HR.appController.getModel("hackerchallenge","hacker-"+_model.hacker_id+"-"+challenge.id,function(_this){return function(model){return model.setKey(_this.key),model.setHackerId(_model.hacker_id),model.setId(challenge.id),model.setContest(_this.contest.toJSON())}}(this),!1),_view=new HR.Manage_HackerChallengeView({model:this.challenge_models[challenge.id]}),_view.setElement($(this.el).find(".tab-content #"+challenge.slug+"-"+this.index)),this.add_subview(_view)},this)):void 0},Manage_HackerApplicationsItemView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.Manage_HackerApplicationsItemView=Manage_HackerApplicationsItemView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,Manage_HackerApplicationsView,ref;return Manage_HackerApplicationsView=function(superClass){function Manage_HackerApplicationsView(){return Manage_HackerApplicationsView.__super__.constructor.apply(this,arguments)}return extend(Manage_HackerApplicationsView,superClass),Manage_HackerApplicationsView.prototype.template="manage/hacker-applications",Manage_HackerApplicationsView.prototype["class"]="dummy",Manage_HackerApplicationsView.prototype.initialize=function(options){return this.contest=options.contest,this.listenTo(this.collection,"change",this.render),this.listenTo(this.collection,"reset",this.render)},Manage_HackerApplicationsView.prototype.events={"click [data-kind]":"filter_data"},Manage_HackerApplicationsView.prototype.render=function(){return this.log("Rendering..."),this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this},Manage_HackerApplicationsView.prototype.filter_data=function(e){var ele,filter,kind;return e.preventDefault(),ele=$(e.target),kind=ele.data("kind"),filter=ele.data("filter"),$(this.el).find(".applications-list-wrapper").html('<div class="block-center text-center"> <img src="'+asset_path("hackerrank_spinner_64x64.gif")+'"><br/><br/> Please wait while we fetch the applications </div>'),this.collection[kind]=filter,this.collection.setPage(1),this.collection.fetch({disableThrobber:!0}),$(this.el).find("[data-kind="+kind+"][data-filter]").show(),$(this.el).find("[data-kind="+kind+"][data-filter="+filter+"]").hide(),""!==filter?$(this.el).find("[data-title="+kind+"]").html($(this.el).find("[data-kind="+kind+"][data-filter="+filter+"]").html()):void 0},Manage_HackerApplicationsView.prototype.renderView=function(){var _statement,country,filters,role,visa;return this.has_template?($(this.el).html(this._template({contest:this.contest,company:this.collection.companyId,key:this.collection.key})),country=_.isEmpty(this.collection.country)?"All":$(this.el).find("[data-filter="+this.collection.country+"]").html().trim(),visa=_.isEmpty(this.collection.visa)?"any":$(this.el).find("[data-filter="+this.collection.visa+"]").html().trim(),role=_.isEmpty(this.collection.role)?"any role":$(this.el).find("[data-filter="+this.collection.role+"]").html().trim(),_statement="Currently showing <strong>"+country+"</strong> hacker(s) who have applied for <strong>"+role+"</strong> and have <strong>"+visa+"</strong>",$(this.el).find("#filter_text").html(_statement),filters=this.collection.getFilterString().split("-"),_.each(filters,function(_this){return function(filter,index){var kind;return kind=$(_this.el).find("[data-title]:eq("+index+")").data("title"),$(_this.el).find("[data-kind="+kind+"][data-filter]").show(),$(_this.el).find("[data-kind="+kind+"][data-filter="+filter+"]").hide(),""!==filter?$(_this.el).find("[data-title="+kind+"]").html($(_this.el).find("[data-kind="+kind+"][data-filter="+filter+"]").html()):void 0}}(this)),HR.util.pagination($(this.el).find(".pagination-wrapper"),this.collection.getTotal(),this.collection.pageURL(),this.collection.getCurrentPage(),this.collection,this.collection.getLimit()),0===this.collection.getTotal()?$(this.el).find(".applications-list-wrapper").html("<p class='text-center'>None of the valid candidate has applied yet.</p>"):this.collection.getTotal()>0&&$(this.el).find(".applications-list-wrapper").html(""),_.each(this.collection.models,function(_model,index){var _view;return _view=new HR.Manage_HackerApplicationsItemView({contest:this.contest,model:_model,index:(this.collection.page-1)*this.collection.getLimit()+index+1,key:this.collection.key}),$(this.el).find(".applications-list-wrapper").append(_view.render().el),this.add_subview(_view)},this)):void 0},Manage_HackerApplicationsView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.Manage_HackerApplicationsView=Manage_HackerApplicationsView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,Manage_HackerChallengeView,ref;return Manage_HackerChallengeView=function(superClass){function Manage_HackerChallengeView(){return Manage_HackerChallengeView.__super__.constructor.apply(this,arguments)}return extend(Manage_HackerChallengeView,superClass),Manage_HackerChallengeView.prototype.template="manage/hacker-challenges",Manage_HackerChallengeView.prototype["class"]="dummy",Manage_HackerChallengeView.prototype.initialize=function(options){return this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"reset",this.render)},Manage_HackerChallengeView.prototype.events={"click [data-toggle=tab]":"switchCode"},Manage_HackerChallengeView.prototype.render=function(){return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this},Manage_HackerChallengeView.prototype.changeLanguage=function(lang_code){var mode_code;return mode_code=lang_code,"c"===lang_code&&(mode_code="csrc"),"cpp"===lang_code&&(mode_code="c++src"),this.editor.setOption("mode","text/x-"+mode_code)},Manage_HackerChallengeView.prototype.switchCode=function(e){var ele,index,submissions;return e.preventDefault(),ele=$(e.target),index=ele.data("index"),submissions=this.model.get("submissions"),this.changeLanguage(submissions[index].language),this.editor.setValue(submissions[index].code),$(this.el).find("#language h5").html(lang_display_mapping[submissions[index].language]),$(this.el).find("#time_ago h5").html(submissions[index].time_ago)},Manage_HackerChallengeView.prototype.renderView=function(){var $codeeditor,_model,editorOptions;return this.has_template&&this.model.get("submissions")?(_model=this.model.toJSON(),$(this.el).html(this._template({model:_model})),editorOptions={lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,readOnly:!0,mode:"text/x-markdown",indentUnit:4},$codeeditor=this.$("#hacker_code").get(0),HR.appController.loadCodeMirrorMode("markdown",function(_this){return function(){return $codeeditor?(_this.editor=CodeMirror.fromTextArea($codeeditor,editorOptions),$(_this.el).find(".nav li:first a").trigger("click")):void 0}}(this))):void 0},Manage_HackerChallengeView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.Manage_HackerChallengeView=Manage_HackerChallengeView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,Manage_TemplateEditView,ref;return Manage_TemplateEditView=function(superClass){function Manage_TemplateEditView(){return Manage_TemplateEditView.__super__.constructor.apply(this,arguments)}return extend(Manage_TemplateEditView,superClass),Manage_TemplateEditView.prototype.template="manage/template-editor",Manage_TemplateEditView.prototype["class"]="dummy",Manage_TemplateEditView.prototype.initialize=function(options){return this.has_template=!1,this.rendered=!1,this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"reset",this.render),this.model.fetch({disableThrobber:!0,error:function(model,xhr){return HR.router.e404()}})},Manage_TemplateEditView.prototype.events={"click .save":"save","click .preview":"preview"},Manage_TemplateEditView.prototype.render=function(){return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this},Manage_TemplateEditView.prototype.renderView=function(){var $codeeditor,editorOptions;return this.has_template&&$(this.el).html(this._template({model:this.model.toJSON()})),this.model?(editorOptions={lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,minHeight:250,mode:"text/html",indentUnit:4},$codeeditor=this.$("#inputstatement").get(0),this.$("#template-edit-hints").html("<strong>Steps for having fixed datetime link</strong><br>1. To show timedate link do the followings <div class='CodeMirror cm-s-default CodeMirror-wrap template-tootltip'> <p style='word-wrap: break-word;'> a. Copy <span class='cm-tag'>&lt;a</span> <span class='cm-tag cm-attribute'>href</span>= <span class='cm-string'>\"http://www.timeanddate.com/worldclock/fixedtime.html?msg=<b style='font-weight: bold'>Your+Message</b>&iso=<b style='font-weight: bold'>20151003T17</b>&p1=224&ah=23&am=55\" target=\"_blank\" style=\"color:white;border-bottom: 1px dashed #fff;text-decoration:none;\"</span> <span class='cm-tag'>&lt;/a&gt</span> </p> <p style='word-wrap: break-word;'>b. Replace the code <span class='cm-variable'>$</span>(<span class='cm-string'>\".start-time\"</span>).html() in javascript with the copied code keeping the time format code between &lt;a&gt; tag</p> <p style='word-wrap: break-word;'>c. Do the same thing for end time also</p> </div>"),HR.appController.loadCodeMirrorMode("html",function(_this){return function(){return $codeeditor?(_this.editor=CodeMirror.fromTextArea($codeeditor,editorOptions),window.editor=_this.editor):void 0}}(this))):void 0},Manage_TemplateEditView.prototype.save=function(e,_callback){var data;return null==e&&(e=null),null==_callback&&(_callback=null),e&&e.preventDefault(),data={slug:$(this.el).find("#slug").val(),body:$("<div/>").text(this.editor.getValue()).html()},this.model.save(data,{success:function(_this){return function(model,resp){return _callback&&_callback.call(),_this.parseErrors(resp.errors,resp.status)}}(this),error:function(_this){return function(model,xhr){return $(_this.el).find(".message").removeClass("error success").addClass("info").html("<ul style='margin-left:30px'><li>Problem in Connecting to server.</li></ul>")}}(this)})},Manage_TemplateEditView.prototype.preview=function(e){return e.preventDefault(),$.ajax({url:"/rest/templates/"+this.model.get("slug")+"/preview",type:"POST",data:{body:$("<div/>").text(this.editor.getValue()).html()},success:function(html,xhr){return window.open($(e.target).attr("href"))}})},Manage_TemplateEditView.prototype.parseErrors=function(errors,status){var error_html;return status?$(this.el).find(".message").removeClass("error").addClass("success").html("<ul style='margin-left:30px'><li>Your Changes have been saved</li></ul>").show():($(this.el).find(".message").removeClass("success").addClass("error"),error_html="",_.each(errors,function(_this){return function(error){var name,temp;return name="",temp=$(_this.el).find("[for=input"+error.field+"]"),temp.length>0&&($(temp).addClass("error"),name=$(temp).html()+" "),_.each(error.errors,function(error_text){return error_html+="<li>"+name+error_text+"</li>"})}}(this)),$(this.el).find(".message").html("<ul style='margin-left:30px'>"+error_html+"</ul>").show())},Manage_TemplateEditView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.Manage_TemplateEditView=Manage_TemplateEditView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var ChecklistView,HR,ref;return ChecklistView=function(superClass){function ChecklistView(){return ChecklistView.__super__.constructor.apply(this,arguments)}return extend(ChecklistView,superClass),ChecklistView.prototype.template="checklist",ChecklistView.prototype.className="checklist-view",ChecklistView.prototype.initialize=function(options){return this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"change",this.render),this.listenTo(this.model,"reset",this.render),this.listenTo(this.model,"change",this.render)},ChecklistView.prototype.render=function(){var that;return $(this.el).html(HR.appController.template(this.template,this)({collection:this.collection,_collection:this.collection.toJSON(),model:this.model,_model:this.model.toJSON()})),that=this,this.$(".accordion-toggle").click(function(e){var action,id;return id=$(e.currentTarget).attr("data-name"),action="block"===that.$("#"+id).css("display")?"fadeOut":"fadeIn",that.$(".accordion-body").hide(),that.$("#"+id)[action]()}),this},ChecklistView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ChecklistView=ChecklistView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,PlayoffsView,ref;return PlayoffsView=function(superClass){function PlayoffsView(){return PlayoffsView.__super__.constructor.apply(this,arguments)}return extend(PlayoffsView,superClass),PlayoffsView.prototype.template="playoffs",PlayoffsView.prototype.className="playoffs-view",PlayoffsView.prototype.setChallenge=function(challenge){return this.challenge&&(this.challenge.unbind("reset",this.render,this),this.challenge.unbind("change",this.render,this)),this.challenge=challenge,this.listenTo(this.challenge,"reset",this.render),this.listenTo(this.challenge,"change",this.render),this.render},PlayoffsView.prototype.setCollection=function(collection){return this.collection&&(this.collection.unbind("reset",this.render,this),this.collection.unbind("change",this.render,this)),this.collection=collection,this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"change",this.render),this.render},PlayoffsView.prototype.setContest=function(contest){return this.contest&&(this.contest.unbind("reset",this.render,this),this.contest.unbind("change",this.render,this)),this.contest=contest,this.listenTo(this.contest,"reset",this.render),this.listenTo(this.contest,"change",this.render),this.render},PlayoffsView.prototype.applyTemplate=function(){return this.has_template&&!this.rendered&&($(this.el).html(this._template()),this.rendered=!0),this.rendered&&(this.playoff_header_view||(this.playoff_header_view=new HR.PlayoffHeaderView),this.playoff_header_view.setChallenge(this.challenge),this.playoff_header_view.setCollection(this.collection),this.playoff_header_view.setContest(this.contest),this.playoff_body_view||(this.playoff_body_view=new HR.PlayoffBodyView),this.playoff_body_view.setChallenge(this.challenge),this.playoff_body_view.setCollection(this.collection),this.playoff_body_view.setContest(this.contest),this.playoff_body_view.once=!1,this.assign({".playoffs .header":this.playoff_header_view,".playoffs .body":this.playoff_body_view})),this},PlayoffsView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.PlayoffsView=PlayoffsView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,PlayoffHeaderView,ref;return PlayoffHeaderView=function(superClass){function PlayoffHeaderView(){return PlayoffHeaderView.__super__.constructor.apply(this,arguments)}return extend(PlayoffHeaderView,superClass),PlayoffHeaderView.prototype.template="playoff-header",PlayoffHeaderView.prototype.setChallenge=function(challenge){return this.challenge&&(this.challenge.unbind("reset",this.render,this),this.challenge.unbind("change",this.render,this)),this.challenge=challenge,this.listenTo(this.challenge,"reset",this.render),this.listenTo(this.challenge,"change",this.render),this.render()},PlayoffHeaderView.prototype.setCollection=function(collection){return this.collection&&(this.collection.unbind("reset",this.render,this),this.collection.unbind("change",this.render,this)),this.collection=collection,this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"change",this.render),this.render()},PlayoffHeaderView.prototype.setContest=function(contest){return this.contest&&(this.contest.unbind("reset",this.render,this),this.contest.unbind("change",this.render,this)),this.contest=contest,this.listenTo(this.contest,"reset",this.render),this.listenTo(this.contest,"change",this.render),this.render()},PlayoffHeaderView.prototype.applyTemplate=function(){return this.collection&&this.collection.sync_status&&this.contest&&this.contest.sync_status&&this.challenge&&this.challenge.sync_status?(this.has_template&&$(this.el).html(this._template({contest:this.contest.toJSON(),challenge:this.challenge.toJSON(),round_data:this.collection.round_data})),this):this},PlayoffHeaderView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.PlayoffHeaderView=PlayoffHeaderView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,PlayoffBodyView,ref;return PlayoffBodyView=function(superClass){function PlayoffBodyView(){return PlayoffBodyView.__super__.constructor.apply(this,arguments)}return extend(PlayoffBodyView,superClass),PlayoffBodyView.prototype.template="playoff-body",PlayoffBodyView.prototype.setChallenge=function(challenge){return this.challenge&&(this.challenge.unbind("reset",this.render,this),this.challenge.unbind("change",this.render,this)),this.challenge=challenge,this.listenTo(this.challenge,"reset",this.render),this.listenTo(this.challenge,"change",this.render),this.render},PlayoffBodyView.prototype.setCollection=function(collection){return this.collection&&(this.collection.unbind("reset",this.render,this),this.collection.unbind("change",this.render,this)),this.collection=collection,this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"change",this.render),this.render},PlayoffBodyView.prototype.setContest=function(contest){return this.contest&&(this.contest.unbind("reset",this.render,this),this.contest.unbind("change",this.render,this)),this.contest=contest,this.listenTo(this.contest,"reset",this.render),this.listenTo(this.contest,"change",this.render),this.render},PlayoffBodyView.prototype.applyTemplate=function(){return this.collection.sync_status&&this.contest.sync_status&&this.challenge.sync_status?(this.has_template&&(this.rendered||($(this.el).html(this._template()),this.rendered=!0),this.list_views||(this.list_views={}),_.each(this.collection.models,function(model){var id;return id=model.get("id"),this.list_views[id]||(this.list_views[id]=new HR.PlayoffBodyListView({parent:this}),this.add_subview(this.list_views[id])),this.list_views[id].setModel(model),0===this.$(".playoffs-list-wrap #gameset-"+id).length&&this.$(".playoffs-list-wrap").append("<div id='gameset-"+id+"' class='gameset-view'></div>"),this.list_views[id].setElement(this.$(".playoffs-list-wrap #gameset-"+id)).render()},this)),this):this},PlayoffBodyView.prototype.closeAllGameContainers=function(){return _.each(this.list_views,function(view){return view.closeGameContainer()})},PlayoffBodyView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.PlayoffBodyView=PlayoffBodyView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,PlayoffBodyListView,ref;return PlayoffBodyListView=function(superClass){function PlayoffBodyListView(){return PlayoffBodyListView.__super__.constructor.apply(this,arguments)}return extend(PlayoffBodyListView,superClass),PlayoffBodyListView.prototype.template="playoff-body-list",PlayoffBodyListView.prototype.className="playoff-body-list-view",PlayoffBodyListView.prototype.events={"click .play-game":"playGame"},PlayoffBodyListView.prototype.setModel=function(model){return this.model&&(this.model.unbind("change",this.render,this),this.model.unbind("reset",this.render,this)),this.model=model,this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"reset",this.render)},PlayoffBodyListView.prototype.applyTemplate=function(){return this.has_template&&($(this.el).html(this._template({model:this.model.toJSON()})),this.delegateEvents()),this},PlayoffBodyListView.prototype.playGame=function(e){var _gameset_clbk,player1,player2,that;return e&&e.preventDefault(),this.parent.closeAllGameContainers(),this.$(".output-area-wrapper").html("").unbind().die(),this.gameset_model||(player1=this.model.get("submission_id1"),player2=this.model.get("submission_id2"),_gameset_clbk=function(model){return model.set("num_players",2),model.set("player1",player1),model.set("player2",player2)},this.gameset_model=HR.appController.getModel("gameset","player1-"+player1+"-"+player2,_gameset_clbk),this.gameset_model.unbind("reset",this.playGame,this),this.gameset_model.bind("reset",this.playGame,this)),that=this,this.gameset_model?(HR.requires(["compound/game-views"],function(){return that.game_container_view=new HR.GameContainerView({collection:that.gameset_model.getGameCollection(),gameset:that.gameset_model}),that.game_container_view.setElement(that.$(".output-area-wrapper")).render(),that.add_subview(that.game_container_view)}),this):void 0},PlayoffBodyListView.prototype.closeGameContainer=function(){return this.game_container_view?this.game_container_view.closeContainer():void 0},PlayoffBodyListView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.PlayoffBodyListView=PlayoffBodyListView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,SampleTemplateView,ref;return SampleTemplateView=function(superClass){function SampleTemplateView(){return SampleTemplateView.__super__.constructor.apply(this,arguments)}return extend(SampleTemplateView,superClass),SampleTemplateView.prototype.initialize=function(options){return null==options&&(options={}),options.template&&(this.template=options.template),SampleTemplateView.__super__.initialize.apply(this,arguments)},SampleTemplateView.prototype.applyTemplate=function(){return this.$el.html(this._template())},SampleTemplateView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.SampleTemplateView=SampleTemplateView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,SampleTemplate1View,ref;return SampleTemplate1View=function(superClass){function SampleTemplate1View(){return SampleTemplate1View.__super__.constructor.apply(this,arguments)}return extend(SampleTemplate1View,superClass),SampleTemplate1View.prototype.template="sampletemplate1",SampleTemplate1View.prototype.className="sampletemplate1-view",SampleTemplate1View.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},SampleTemplate1View}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.SampleTemplate1View=SampleTemplate1View})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,SampleTemplate2View,ref;return SampleTemplate2View=function(superClass){function SampleTemplate2View(){return SampleTemplate2View.__super__.constructor.apply(this,arguments)}return extend(SampleTemplate2View,superClass),SampleTemplate2View.prototype.template="sampletemplate2",SampleTemplate2View.prototype.className="sampletemplate2-view",SampleTemplate2View.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},SampleTemplate2View}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.SampleTemplate2View=SampleTemplate2View})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var AboutusView,HR,ref;return AboutusView=function(superClass){function AboutusView(){return AboutusView.__super__.constructor.apply(this,arguments)}return extend(AboutusView,superClass),AboutusView.prototype.template="aboutus",AboutusView.prototype.className="aboutus-view",AboutusView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},AboutusView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.AboutusView=AboutusView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty,indexOf=[].indexOf||function(item){for(var i=0,l=this.length;l>i;i++)if(i in this&&this[i]===item)return i;return-1};jQuery(function(){var CareersView,HR,ref;return CareersView=function(superClass){function CareersView(){return CareersView.__super__.constructor.apply(this,arguments)}return extend(CareersView,superClass),CareersView.prototype.template="careers",CareersView.prototype.className="careers-view",CareersView.prototype.initialize=function(options){var that;return that=this,this.categories=[],this.jobs=[],$.ajax({url:"/rest/job_postings",success:function(data){return _.each(data,function(position){var team;return team=position.categories.team,that.jobs.push(position),indexOf.call(that.categories,team)<0?that.categories.push(team):void 0}),that.render()}})},CareersView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)({categories:this.categories,jobs:this.jobs})),this},CareersView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.CareersView=CareersView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,ScoringView,ref;return ScoringView=function(superClass){function ScoringView(){return ScoringView.__super__.constructor.apply(this,arguments)}return extend(ScoringView,superClass),ScoringView.prototype.template="scoring",ScoringView.prototype.className="scoring-view container",ScoringView.prototype.initialize=function(options){return this.section=options.section,this.contest=HR.model("contest").cached(),this.template=this.contest.get("scoring_template")||this.template,this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"reset",this.render)},ScoringView.prototype.render=function(){var that;return $(this.el).html(HR.appController.template(this.template,this)({model:this.model})),this.section&&this.$("#"+this.section).length>0&&(that=this,setTimeout(function(){return $("body,html").animate({scrollTop:$("#"+that.section).offset().top-10},800)},800)),this},ScoringView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ScoringView=ScoringView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,ScoringBadgeView,ref;return ScoringBadgeView=function(superClass){function ScoringBadgeView(){return ScoringBadgeView.__super__.constructor.apply(this,arguments)}return extend(ScoringBadgeView,superClass),ScoringBadgeView.prototype.template="scoring-badge",ScoringBadgeView.prototype.className="scoring-badge-view container",ScoringBadgeView.prototype.initialize=function(options){},ScoringBadgeView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},ScoringBadgeView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ScoringBadgeView=ScoringBadgeView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var FaqView,HR,ref;return FaqView=function(superClass){function FaqView(){return FaqView.__super__.constructor.apply(this,arguments)}return extend(FaqView,superClass),FaqView.prototype.template="faq",FaqView.prototype.className="faq-view container",FaqView.prototype.initialize=function(options){return null==options&&(options={}),this.tab=options.tab,this.contest=HR.model("contest").cached(),this.template=this.contest.get("faq_template")||this.template,options.jobsTemplate?this.template=options.jobsTemplate:void 0},FaqView.prototype.render=function(){var that;return $(this.el).html(HR.appController.template(this.template,this)),this.tab&&this.$("#"+this.tab).length>0&&(that=this,setTimeout(function(){return $("body,html").animate({scrollTop:$("#"+that.tab).offset().top-10},800)},800)),this},FaqView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.FaqView=FaqView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,PrivacyView,ref;return PrivacyView=function(superClass){function PrivacyView(){return PrivacyView.__super__.constructor.apply(this,arguments)}return extend(PrivacyView,superClass),PrivacyView.prototype.template="privacy",PrivacyView.prototype.className="privacy-view",PrivacyView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},PrivacyView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.PrivacyView=PrivacyView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);
  return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var EnvironmentView,HR,ref;return EnvironmentView=function(superClass){function EnvironmentView(){return EnvironmentView.__super__.constructor.apply(this,arguments)}return extend(EnvironmentView,superClass),EnvironmentView.prototype.template="environment",EnvironmentView.prototype.className="environment-view container",EnvironmentView.prototype.initialize=function(options){return this.tab=options.tab,this.language=options.language},EnvironmentView.prototype.render=function(){var allowed_tabs,languageenvironmentview,that;return $(this.el).html(HR.appController.template(this.template,this)({base_url:window.location.pathname})),languageenvironmentview=new HR.LanguageEnvironmentCollectionView({showml:!0}),this.add_subview(languageenvironmentview),this.assign({"#languages":languageenvironmentview}),allowed_tabs=["languages","sample-problem","writing-to-file"],this.tab&&""!==this.tab&&-1!==$.inArray(this.tab,allowed_tabs)?(this.setTab(this.tab),this.language&&""!==this.language&&(that=this,this.$("div#"+this.tab+" .language-"+this.language).length>0&&setTimeout(function(){return $("body,html").animate({scrollTop:that.$("div#"+that.tab+" .language-"+that.language).offset().top-30},300)},500))):this.setTab("languages"),this},EnvironmentView.prototype.setTab=function(tab){return this.$("ul.nav-tabs li").removeClass("active"),this.$("ul.nav-tabs li."+tab).addClass("active"),this.$("div.tab-pane").removeClass("active"),this.$("div.tab-pane#"+tab).addClass("active")},EnvironmentView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.EnvironmentView=EnvironmentView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,LanguageEnvironmentCollectionView,ref;return LanguageEnvironmentCollectionView=function(superClass){function LanguageEnvironmentCollectionView(){return LanguageEnvironmentCollectionView.__super__.constructor.apply(this,arguments)}return extend(LanguageEnvironmentCollectionView,superClass),LanguageEnvironmentCollectionView.prototype.template="language-environment",LanguageEnvironmentCollectionView.prototype.events={"click .codepair-languages":"toggleLang","click .codepair-sample-problem":"toggleSampleProblem"},LanguageEnvironmentCollectionView.prototype.initialize=function(options){return this.collection=new HR.LanguageEnvironmentCollection,this.showml=options.showml,this.isrecruit=options.isrecruit},LanguageEnvironmentCollectionView.prototype.toggleLang=function(){return this.$("#sample-problem-statement").addClass("hidden"),this.$("#languages-table").removeClass("hidden"),this.$(".codepair-sample-problem").removeClass("active"),this.$(".codepair-languages").addClass("active")},LanguageEnvironmentCollectionView.prototype.toggleSampleProblem=function(){return this.$("#sample-problem-statement").removeClass("hidden"),this.$("#languages-table").addClass("hidden"),this.$(".codepair-languages").removeClass("active"),this.$(".codepair-sample-problem").addClass("active")},LanguageEnvironmentCollectionView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)({showml:this.showml,isrecruit:this.isrecruit,collection:this.collection.toJSON()})),this},LanguageEnvironmentCollectionView}(Backbone.View),HR=null!=(ref=window.HR)?ref:{},HR.LanguageEnvironmentCollectionView=LanguageEnvironmentCollectionView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,ProblemSetterView,ref;return ProblemSetterView=function(superClass){function ProblemSetterView(){return ProblemSetterView.__super__.constructor.apply(this,arguments)}return extend(ProblemSetterView,superClass),ProblemSetterView.prototype.template="problem-setter",ProblemSetterView.prototype.className="problem-setter-view",ProblemSetterView.prototype.initialize=function(options){return this.section=options.section},ProblemSetterView.prototype.render=function(){var that;return $(this.el).html(HR.appController.template(this.template,this)),this.section&&this.$("#"+this.section).length>0&&(that=this,setTimeout(function(){return $("body,html").animate({scrollTop:$("#"+that.section).offset().top-10},800)},800)),this},ProblemSetterView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ProblemSetterView=ProblemSetterView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,PsLeaderboardView,ref;return PsLeaderboardView=function(superClass){function PsLeaderboardView(){return PsLeaderboardView.__super__.constructor.apply(this,arguments)}return extend(PsLeaderboardView,superClass),PsLeaderboardView.prototype.template="ps-leaderboard",PsLeaderboardView.prototype.className="ps-leaderboard-view",PsLeaderboardView.prototype.initialize=function(options){var that;return this.section=options.section,that=this,this.listenTo(this.model,"change",this.render)},PsLeaderboardView.prototype.events={"click a.select-domain":"selectDomain"},PsLeaderboardView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)({model:this.model.toJSON()})),this},PsLeaderboardView.prototype.selectDomain=function(e){var val;return e.preventDefault(),val=$(e.currentTarget).parent().data("id"),this.$(".main-leaderboard").addClass("hidden"),$(".main-leaderboard[data-id="+val).removeClass("hidden"),$(".select-domain").removeClass("fill-green"),$(".select-domain[data-id="+val+"]").addClass("fill-green")},PsLeaderboardView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.PsLeaderboardView=PsLeaderboardView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var APIView,HR,ref;return APIView=function(superClass){function APIView(){return APIView.__super__.constructor.apply(this,arguments)}return extend(APIView,superClass),APIView.prototype.initialize=function(){return APIView.__super__.initialize.apply(this,arguments),this.consumers=new HR.APIConsumerCollection,this.errors=[],this.renderConsumers(),this.apiResponseTemplate=_.template("<div class='api-response-wrapper' style='padding: 10px;'> <dl class='api-response'> <dt>URI</dt> <dd><%= data.uri %></dd> <dt>Request Method</dt> <dd><%= data.method %></dd> <dt>Response Code</dt> <dd><%= data.code %></dd> <dt>Response Headers</dt> <dd><%= data.headers %></dd> <dt>Response Body</dt> <dd><pre><%= _.escape(data.response) %></pre></dd> </dl></div>")},APIView.prototype.template="api",APIView.prototype.className="api-view",APIView.prototype.events={"click .try-languages-btn":"tryLanguages","click .try-submission-btn":"trySubmission","click #genkey-api-btn":"genKey"},APIView.prototype.render=function(){var profile;return profile=HR.profile(),$(this.el).html(HR.appController.template(this.template,this)({consumers:this.consumers.toJSON(),errors:this.errors,isLoggedIn:profile.isLoggedIn()})),this},APIView.prototype.renderConsumers=function(){return this.consumers.fetch({success:function(_this){return function(){return _this.render()}}(this)})},APIView.prototype.genKey=function(){return this.errors=[],this.consumers.create({name:this.$("#genkey-app-name").val(),description:this.$("#genkey-app-description").val(),website:this.$("#genkey-app-website").val()},{success:function(_this){return function(){return _this.renderConsumers()}}(this),error:function(_this){return function(modl,xhr,options){return _this.errors=$.parseJSON(xhr.responseText).errors,_this.renderConsumers()}}(this)})},APIView.prototype.tryLanguages=function(){return this.$(".try-languages-btn").attr("disabled","disabled").html("Requesting..."),$.ajax("api/shiv/languages",{data:{request_format:this.$("#api-languages-format").val()},context:this,success:function(data,textStatus,jqXHR){return this.$("#api-languages-output").html(this.apiResponseTemplate({data:data}))},error:function(){return this.$("#api-languages-output").html("Failed")},complete:function(){return this.$(".try-languages-btn").removeAttr("disabled").html("Try it!")}})},APIView.prototype.trySubmission=function(){return this.$(".try-submission-btn").attr("disabled","disabled").html("Requesting..."),$.ajax("api/shiv/submission",{type:"POST",data:{request_format:this.$("#api-submission-format").val(),source:this.$("#api-submission-source").val(),lang:this.$("#api-submission-language").val(),testcases:this.$("#api-submission-testcases").val(),callback_url:this.$("#api-submission-callbackurl").val(),wait:this.$("#api-submission-wait").val()},context:this,success:function(data,textStatus,jqXHR){return this.$("#api-submission-output").html(this.apiResponseTemplate({data:data}))},error:function(){return this.$("#api-submission-output").html("Failed")},complete:function(){return this.$(".try-submission-btn").removeAttr("disabled").html("Try it!")}})},APIView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.APIView=APIView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var APIHomeView,HR,ref;return APIHomeView=function(superClass){function APIHomeView(){return APIHomeView.__super__.constructor.apply(this,arguments)}return extend(APIHomeView,superClass),APIHomeView.prototype.template="apihome",APIHomeView.prototype.className="apihome-view",APIHomeView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},APIHomeView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.APIHomeView=APIHomeView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,NvNLeaderboardView,ref;return NvNLeaderboardView=function(superClass){function NvNLeaderboardView(){return NvNLeaderboardView.__super__.constructor.apply(this,arguments)}return extend(NvNLeaderboardView,superClass),NvNLeaderboardView.prototype.template="nvn-leaderboard",NvNLeaderboardView.prototype.className="nvn-leaderboard-view",NvNLeaderboardView.prototype.initialize=function(options){return this.listenTo(this.collection,"reset",this.render),this.collection.fetch()},NvNLeaderboardView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)({leaderboard:this.collection.toJSON(),kind:this.collection.kind})),HR.util.pagination(this.$(".pagination-wrapper"),this.collection.getTotal(),"/"+this.collection.pageURL()+"/",this.collection.getCurrentPage()),this},NvNLeaderboardView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.NvNLeaderboardView=NvNLeaderboardView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var CompaniesView,HR,ref;return CompaniesView=function(superClass){function CompaniesView(){return CompaniesView.__super__.constructor.apply(this,arguments)}return extend(CompaniesView,superClass),CompaniesView.prototype.template="companies",CompaniesView.prototype.className="companies-view",CompaniesView.prototype.initialize=function(options){return null==options&&(options={}),hr_metrics.externalService("track","ViewCompanies",{})},CompaniesView.prototype.render=function(){var profile;return HR.appController.setTitle("Companies"),profile=HR.profile(),$(this.el).html(HR.appController.template(this.template,this)({companies:this.collection.toJSON()})),this},CompaniesView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.CompaniesView=CompaniesView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,SupportView,ref;return SupportView=function(superClass){function SupportView(){return SupportView.__super__.constructor.apply(this,arguments)}return extend(SupportView,superClass),SupportView.prototype.template="support",SupportView.prototype.className="support-view",SupportView.prototype.events={"change select#category":function(e){var $form,categories,category,k,options,select,sub,sub_categories,v;if(select=$(e.target),categories=window.HR.supportConfig.get("categories"),sub_categories=null,category=parseInt(select.find(":selected").attr("value")),$form=$("form#support-form"),category){select.removeClass("error");for(k in categories)if(v=categories[k],v.id===category){sub_categories=v.sub_categories;break}return sub=$form.find("div.sub_categories"),sub_categories.length<1?void sub.html("").addClass("hide"):(options='<div class="row">Select a sub category <span class="required-field">*</span><br>',sub_categories.forEach(function(x){return options+='<div class="span-xs-16 span8">',options+='<input name="sub_categories[]" type="checkbox" class="inline sub_category" value="'+x.id+'">',options+='<label class="inline">'+x.title+"</option>",options+="</div>"}),options+="</div>",sub.html(options),sub.removeClass("hide"),$("input.sub_category").off("change").on("change",function(){return $("div.sub_categories label").removeClass("error")}))}},"click button.support-button":"submit_form","change textarea#description":function(e){var description;return description=$(e.target),description.hasClass("error")?description.removeClass("error"):void 0}},SupportView.prototype.render=function(){var HR;return HR=window.HR||{},HR.supportConfig=this.model,$(this.el).html(HR.appController.template(this.template,this)(this.model.toJSON())),$('input[name="tags"]').select2({tags:!0,tokenSeparators:[","," "],containerCssClass:"custom-select2"}),this},SupportView.prototype.submit_form=function(e){var $form,$submit,category,description,form_data,has_sub_categories,invalid,sub_categories;return e.preventDefault(),$form=$("form#support-form"),$submit=$(e.currentTarget),"disabled"!==$submit.attr("disabled")?(category=$form.find("select#category"),has_sub_categories=$form.find('[type="checkbox"][name="sub_categories[]"]').length,sub_categories=$form.find('[type="checkbox"][name="sub_categories[]"]:checked'),description=$form.find("textarea#description"),invalid=!0,category.find(":selected").attr("value")&&description.attr("value")&&(!has_sub_categories||has_sub_categories&&sub_categories.length)?invalid=!1:(""===description.attr("value")&&description.addClass("error"),category.find(":selected").attr("value")||category.addClass("error"),!sub_categories.length>0&&$form.find("div.sub_categories label").addClass("error")),invalid?void 0:(description.removeClass("error"),category.removeClass("error"),$form.find("div.sub_categories label").removeClass("error"),$submit.attr("disabled","disabled").html("Sending Your Request"),$form.find(".alert.error").hide(),form_data=$form.serialize(),$.ajax({url:"/rest/support",type:"POST",data:form_data,success:function(data){var confirmationdialog,error,key,ref,value;if($submit.removeAttr("disabled").html("Submit"),data.status)return confirmationdialog=HR.util.ShowConfirmationDialog({title:"Support request created",body:"Thank you for reaching out to us. We will try to resolve your request at the earliest.",buttons:[{name:"Ok",callback:function(confirmationdialog){return confirmationdialog.destroy(),$form.trigger("reset"),$form.find("#category").trigger("change"),$('input[name="tags"]').select2("val",null),$form.find('[type="hidden"][name="sub_categories[]"]').remove(),$form.find('[type="hidden"][name="category"]').remove(),$form.find('[name="sub_categories[]"]').attr("checked",!1).attr("disabled",!1),$form.find('[name="category"]').attr("disabled",!1),$form.find('[name="contests[]"]').attr("checked",!1),$form.find('[name="challenges[]"]').attr("checked",!1)}}]}),confirmationdialog.render();if(0===data.errors.length)error="Unknown Error";else{error="<ul style='text-align: left; margin-left: 30px;'>",ref=data.errors;for(key in ref)value=ref[key],error+="<li>"+key+": "+value[0]+"</li>";error+="</ul>"}return $form.find(".alert.error").show().html(error).parent().show()}}))):void 0},SupportView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.SupportView=SupportView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,TermsOfServiceView,ref;return TermsOfServiceView=function(superClass){function TermsOfServiceView(){return TermsOfServiceView.__super__.constructor.apply(this,arguments)}return extend(TermsOfServiceView,superClass),TermsOfServiceView.prototype.template="terms-of-service",TermsOfServiceView.prototype.className="terms-of-service-view",TermsOfServiceView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},TermsOfServiceView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.TermsOfServiceView=TermsOfServiceView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,TOSChangeAnnouncementView,ref;return TOSChangeAnnouncementView=function(superClass){function TOSChangeAnnouncementView(){return TOSChangeAnnouncementView.__super__.constructor.apply(this,arguments)}return extend(TOSChangeAnnouncementView,superClass),TOSChangeAnnouncementView.prototype.template="tos-change-announcement",TOSChangeAnnouncementView.prototype.className="tos-change-announcement-view",TOSChangeAnnouncementView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},TOSChangeAnnouncementView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.TOSChangeAnnouncementView=TOSChangeAnnouncementView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,OverallLeaderboardView,ref;return OverallLeaderboardView=function(superClass){function OverallLeaderboardView(){return OverallLeaderboardView.__super__.constructor.apply(this,arguments)}return extend(OverallLeaderboardView,superClass),OverallLeaderboardView.prototype.template="leaderboard-overall",OverallLeaderboardView.prototype.className="leaderboard-overall-view container",OverallLeaderboardView.prototype.events={"click .js-leaderboard-tab":"changeTab","click .js-weekly":"changeWeeklyTab"},OverallLeaderboardView.prototype.initialize=function(options){return null==options&&(options={}),this.level=options.level,this.listenTo(this.collection,"reset",this.render),this.weekly_type="today",this.weekly_collection={},this.weekly_cache={},this.fetchWeeklyLeaderboard()},OverallLeaderboardView.prototype.changeTab=function(e){var new_level;return e.preventDefault(),new_level=$(e.currentTarget).attr("data-level"),this.level!==new_level?(this.$("a[data-level="+this.level+"]").parent().removeClass("active"),this.$("a[data-level="+new_level+"]").parent().addClass("active"),this.level=new_level,HR.router.navigate("/leaderboard/level/"+new_level,!1),this.collection=HR.collection("leaderboard"),this.collection.setPage(1),this.collection.setContestSlug("master"),this.collection.setLevel(this.level),this.collection.cached(),this.listenTo(this.collection,"reset",this.render),this.render()):void 0},OverallLeaderboardView.prototype.changeWeeklyTab=function(e){var new_type;return e.preventDefault(),new_type=$(e.currentTarget).attr("data-type"),this.weekly_type!==new_type?(this.$("a[data-type="+this.weekly_type+"]").parent().removeClass("active"),this.$("a[data-type="+new_type+"]").parent().addClass("active"),this.weekly_type=new_type,this.fetchWeeklyLeaderboard()):void 0},OverallLeaderboardView.prototype.processBlank=function(){var blankDiv;return blankDiv=this.$("#blank-reason-container .blank-reason"),this.collection.length>0?(blankDiv.parent().hide(),!1):(_.isBoolean(this.collection.sync_status)?this.collection.available?blankDiv.html("Sorry, we require a few more submissions before we generate the leaderboard."):blankDiv.html("We are currently generating the leaderboard, please bear with us."):blankDiv.html(HR.appController.viewLoader(64)),this.$("#blank-reason-container").show(),this.$("#leaders").hide(),!0)},OverallLeaderboardView.prototype.render=function(){var leadersDiv,that;return $(this.el).html(HR.appController.template(this.template,this)({level:this.level,current_hacker:this.collection.current_hacker,has_weekly_leaderboard:!1,weekly_contest:this.collection.weekly_contest,weekly_type:this.weekly_type})),this.renderWeekly(),this.processBlank()?this:(this.collection.sync_status&&(leadersDiv=$(),that=this,_.each(this.collection.models,function(model){var _view;return _view=new HR.OverallLeaderboardListView({leader:model}),that.add_subview(_view),leadersDiv.push(_view.render().el)}),this.$("#leaders").append(leadersDiv)),this.collection.available&&HR.util.pagination(this.$(".pagination-wrapper"),this.collection.getTotal(),this.collection.pageURL()+"/",this.collection.getCurrentPage(),this.collection,this.collection.limit,10,"backbone",!1),this)},OverallLeaderboardView.prototype.fetchWeeklyLeaderboard=function(){var that;return that=this,this.weekly_cache[this.weekly_type]?(this.weekly_collection=this.weekly_cache[this.weekly_type],this.renderWeekly()):(this.weekly_collection={},that.renderWeekly(),$.ajax({url:"rest/leaderboard/"+this.weekly_type,success:function(data){return that.weekly_collection=data,that.weekly_cache[that.weekly_type]=data,that.renderWeekly()}}))},OverallLeaderboardView.prototype.createLeader=function(leader){return"<div class='leaderboard-overall-list-view'> <div class='row padding-small top bottom' style='height: 38px'> <div class='span-flex-2 text-center'> <p>"+leader.rank+"</p> </div> <div class='span-flex-10'> <p> <a class='backbone cursor leaderboard-hackername rg_"+leader.level+"' data-action='hacker-modal' rel='tooltip' data-value='"+leader.hacker+"' href='/"+leader.hacker+"' target='_blank' data-analytics='LeaderboardListUserName' data-attr1='"+leader.hacker+"' data-attr7='"+leader.level+"' data-attr8='"+leader.rank+"' data-attr10='"+leader.score.toFixed(2)+"'> <img class='avatar' width='30' height='30' src='"+leader.avatar+"' onerror='this.onerror=null; this.src='https://d3rpyts3de3lx8.cloudfront.net/hackerrank/assets/gravatar.jpg';'> "+leader.hacker+" </a> </p> </div> <div class='span-flex-4'> <p>"+leader.score.toFixed(2)+"</p> </div> </div> </div>"},OverallLeaderboardView.prototype.renderWeekly=function(){var blankDiv,leadersDiv,that;if(this.$(".js-weekly-leaderboard").length>0)return blankDiv=this.$("#blank-reason-container2 .blank-reason"),this.$("#leaders2").html(""),that=this,this.weekly_collection.models?this.weekly_collection.available?(blankDiv.parent().hide(),leadersDiv=$(),_.each(this.weekly_collection.models,function(model){return $("#leaders2").append(that.createLeader(model))})):(blankDiv.html("No challenge at this time."),blankDiv.parent().show()):(blankDiv.html(HR.appController.viewLoader(64)),blankDiv.parent().show())},OverallLeaderboardView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.OverallLeaderboardView=OverallLeaderboardView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,OverallLeaderboardListView,ref;return OverallLeaderboardListView=function(superClass){function OverallLeaderboardListView(){return OverallLeaderboardListView.__super__.constructor.apply(this,arguments)}return extend(OverallLeaderboardListView,superClass),OverallLeaderboardListView.prototype.template="leaderboard-overall-list",OverallLeaderboardListView.prototype.className="leaderboard-overall-list-view",OverallLeaderboardListView.prototype.initialize=function(options){return this.leader=options.leader,this.profile=HR.profile(),this.extra_column=options.extra_column,this.type=options.type,HR.profile().isLoggedIn()?this.hacker=HR.profile().get("username"):this.hacker=null},OverallLeaderboardListView.prototype.getTooltip=function(data){var html,short;return short={ai:"AI",fp:"FP",algorithms:"AL"},html="",_.each(data,function(item){return html+=short[item.track_slug]+" - "+item.score.toFixed(2)+"</br>"}),html},OverallLeaderboardListView.prototype.isCurrentHacker=function(){return this.profile.isLoggedIn()&&this.leader?parseInt(this.leader.get("hacker_id"))===this.profile.get("id"):!1},OverallLeaderboardListView.prototype.render=function(){var tooltip;return tooltip=null,this.leader.get("breakdown")&&(tooltip=this.getTooltip(this.leader.get("breakdown"))),$(this.el).html(HR.appController.template(this.template,this)({leader:this.leader.toJSON(),extra_column:this.extra_column,is_current_hacker:this.isCurrentHacker(),type:this.type,tooltip:tooltip})),this},OverallLeaderboardListView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.OverallLeaderboardListView=OverallLeaderboardListView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,LeaderboardMainView2,ref;return LeaderboardMainView2=function(superClass){function LeaderboardMainView2(){return LeaderboardMainView2.__super__.constructor.apply(this,arguments)}return extend(LeaderboardMainView2,superClass),LeaderboardMainView2.prototype.template="leaderboard-main2",LeaderboardMainView2.prototype.className="leaderboard-main-view container",LeaderboardMainView2.prototype.events={"click .js-leaderboard-tab":"changeTab",'change select[name="leaderboard-filter"]':"updateColumnFilter","click .filters-close":"closeFilter","click .leaderboard-header-dropdown":"showHeaderFilter","click .find-myself":"findMyself","click .track-selection-link":"showTrackMenu","click .leaderboard-menu .practice":"selectLeaderboard","click .leaderboard-menu .contest":"selectLeaderboard","blur .leaderboard-menu":"closeTrackMenu"},LeaderboardMainView2.prototype.filters=["school","country","company","hacker"],LeaderboardMainView2.prototype.initialize=function(options){return null==options&&(options={}),this.level=this.collection.level,this.type=this.collection.type,this.track=this.collection.track,this.elo_version=this.collection.elo_version,this.viewColumn="country",this._cookiename="ldr_cl",HR.appView.cookie({cookiename:this._cookiename})&&(this.viewColumn=HR.appView.cookie({cookiename:this._cookiename})),this.scores=[],this.listenTo(this.collection,"reset",this.render),this.initRecommendation(),LeaderboardMainView2.__super__.initialize.call(this,options)},LeaderboardMainView2.prototype.initRecommendation=function(){return this.recommendation_view?this.recommendation_view.setModel({type:this.type,track:this.track}):this.recommendation_view=new HR.LeaderboardRecommendationView({type:this.type,track:this.track}),this.assign({"div.recommendation":this.recommendation_view})},LeaderboardMainView2.prototype.fetchCollection=function(){var oldFilters;return oldFilters=this.collection.filters,this.collection=HR.collection("track-leaderboard"),this.collection.setPage(1),this.collection.setLevel(this.level),this.collection.setTrack(this.track),this.collection.setType(this.type),this.collection.filters=oldFilters,this.collection.elo_version=this.elo_version,this.collection.cached(),this.listenTo(this.collection,"reset",this.render),HR.router.navigate(this.collection.pageURL()+("/"+this.collection.page),!1),this.render(),this.initRecommendation()},LeaderboardMainView2.prototype.findMyself=function(){var body,dialog,location;return this.collection.current_hacker&&this.collection.current_hacker.location_on_leaderboard?(location=this.collection.current_hacker.location_on_leaderboard,this.collection.setPage(location.page),this.collection.setLevel(location.level),this.level=location.level,this.collection.cached({fetch:!0}),hr_metrics.track("Click","LeaderboardMainFindMyRank",{attribute1:this.track,attribute2:this.activeFilter}),HR.router.navigate(this.collection.pageURL()+("/"+this.collection.page+"#myself"),!1)):(body=this.activeFilter&&this.filterValue?"You are not in the filtered leaderboard. Try clearing the filter to see your global rank. <br><br><a href='/scoring' target='_blank' dataAnalytics='LeaderboardMainMyRankLearnScoring'>Click here</a> to learn more about scoring</a>.":"You are not in the leaderboard yet. <br><br><a href='/scoring' target='_blank' dataAnalytics='LeaderboardMainMyRankLearnScoring'>Click here</a> to learn more about scoring</a>.",dialog=HR.util.ShowDialog({title:"Find My Rank",body:body}),dialog.render()),this},LeaderboardMainView2.prototype.closeTrackMenu=function(e){return this.$(".leaderboard-menu").fadeOut(300)},LeaderboardMainView2.prototype.showTrackMenu=function(e){var el,that;return e.preventDefault(),el=this.$(".leaderboard-menu"),that=this,el.is(":visible")?el.fadeOut(300):(el.removeClass("hidden"),el.fadeIn(200,function(){return that.$(".leaderboard-menu").focus()}))},LeaderboardMainView2.prototype.selectLeaderboard=function(e){var val;return e.preventDefault(),val=$(e.currentTarget).attr("data-val"),this.$(".leaderboard-menu").hide(),this.changeTrack(val.split("-")[0],val.split("-").splice(1).join("-"))},LeaderboardMainView2.prototype.setBreadcrumb=function(){if(HR.appView.setBreadcrumb("global","Leaderboard","/leaderboard"),this.track){if(this.track_name=this.$(".leaderboard-menu-dropdown-text").html(),"General"===this.track_name)return HR.appView.setBreadcrumb("primary-track",this.track_name,"/");if(this.track_name)return HR.appView.setBreadcrumb("primary-track",this.track_name,"/domains/"+this.track)}},LeaderboardMainView2.prototype.changeTab=function(e){var new_level,old_level;return e.preventDefault(),new_level=$(e.currentTarget).attr("data-level"),this.level!==new_level?(this.$("a[data-level="+this.level+"]").parent().removeClass("active"),this.$("a[data-level="+new_level+"]").parent().addClass("active"),old_level=this.level,this.level=new_level,this.fetchCollection(),hr_metrics.track("Click","LeaderboardMainChangeTab",{attribute1:this.track,attribute7:new_level,attribute8:old_level})):void 0},LeaderboardMainView2.prototype.setFilter=function(value){return this.collection.addFilter(this.activeFilter,value),this.collection.cached({fetch:!0}),this.filterValue=value,this.$("#leaders").html(HR.appController.viewLoader(64)),HR.router.navigate(this.collection.pageURL()+("/"+this.collection.page),!1),
  hr_metrics.track("Click","LeaderboardMainSetFilter",{attribute1:this.track,attribute2:this.activeFilter,attribute3:value})},LeaderboardMainView2.prototype.filterInputKeyup=function(e){var input,value;return input=$(e.currentTarget),13===e.keyCode?(value=input.val().replace(/</g,"").replace(/>/g,""),input.attr("disabled",!0),1!==this.collection.page&&this.collection.setPage(1),this.setFilter(value)):void 0},LeaderboardMainView2.prototype.closeFilter=function(e){return e.preventDefault(),this.collection.clearFilters(),this.activeFilter=null,this.filterValue=null,this.collection.cached({fetch:!0}),hr_metrics.track("Click","LeaderboardMainCloseFilter",{attribute1:this.track,attribute2:this.activeFilter}),HR.router.navigate(this.collection.pageURL()+("/"+this.collection.page),!1)},LeaderboardMainView2.prototype.changeFilter=function(filter){return this.collection.clearFilters(),this.activeFilter=filter,this.$(".toggle-leaderboard-title").html(""+this.activeFilter)},LeaderboardMainView2.prototype.changeTrack=function(newType,newTrack){var oldTrack;if(this.track!==newTrack||this.type!==newType)return oldTrack=this.track,this.track=newTrack,this.type=newType,"domain"===this.type?this.level=90:this.level=1,this.fetchCollection(),hr_metrics.track("LeaderboardMainChangeTrack",newTrack,{attribute1:oldTrack})},LeaderboardMainView2.prototype.updateColumnFilter=function(e){var column;return e.preventDefault(),column=this.$('select[name="leaderboard-filter"]').val(),this.viewColumn=column,HR.appView.cookie({cookiename:this._cookiename,set_value:this.viewColumn}),this.filterValue?this.closeFilter(e):this.render()},LeaderboardMainView2.prototype.showHeaderFilter=function(e){var _typeaheadOnselect,container,filter,filterHtml,include_location,input,target,that;return e.preventDefault(),target=$(e.target),container=target.parents(".hf-container"),filter=container.data("filter"),this.resetHeaderFilter(),filterHtml=this.getHeaderFilter(filter),container.append(filterHtml),that=this,filterHtml.find(".hf-close").on("click",function(_this){return function(e){return e.preventDefault(),that.resetHeaderFilter()}}(this)),that=this,input=this.$("input#filter_"+filter),input.focus(),this.changeFilter(filter),that=this,_typeaheadOnselect=function(val){return that.$(input).val(val),that.filterInputKeyup({currentTarget:this.$element,keyCode:13}),val},"hacker"===filter?this.setupFindUser(input):(include_location="school"===this.activeFilter,this.$(input).completer(this.activeFilter,{updater:_typeaheadOnselect},include_location))},LeaderboardMainView2.prototype.hideHeaderFilter=function(e){return 27===e.keyCode?this.resetHeaderFilter():void 0},LeaderboardMainView2.prototype.resetHeaderFilter=function(){var filterHtml;return filterHtml=this.$(".header-filter"),filterHtml.detach(),this.$("#hf-block").append(filterHtml)},LeaderboardMainView2.prototype.processBlank=function(){var blankDiv;return blankDiv=this.$("#blank-reason-container .blank-reason"),this.collection.length>0?(blankDiv.parent().hide(),!1):(_.isBoolean(this.collection.sync_status)?this.collection.available?blankDiv.html("Sorry, we do not have enough data to generate the leaderboard."):blankDiv.html("We are currently generating the leaderboard, please bear with us."):blankDiv.html(HR.appController.viewLoader(64)),this.$("#blank-reason-container").show(),this.$("#leaders").hide(),!0)},LeaderboardMainView2.prototype.renderScores=function(){var that;if(!(this.scores.count>0||this.rendering_score)&&HR.profile().isLoggedIn())return that=this,this.rendering_score=!0,$.ajax({url:"/rest/hackers/me/scores_elo",success:function(data){return that.scores=data,that.rendering_score=!1,that.render()}})},LeaderboardMainView2.prototype.render=function(){var _filterValue,filterValue,hasFilter,i,j,keys,leadersDiv,len,len1,level_to_title,ref,score,span_width,that,track,tracks,viewed;for(tracks=[{slug:"algorithms",name:"Algorithms","short":"AL"},{slug:"mathematics",name:"Mathematics","short":"MA"},{slug:"ai",name:"Artificial Intelligence","short":"AI"},{slug:"miscellaneous",name:"Miscellaneous","short":"MI"},{slug:"fp",name:"Functional Programming","short":"FP"},{slug:"shell",name:"The Linux Shell","short":"SH"}],i=0,len=tracks.length;len>i;i++)for(track=tracks[i],track.slug===this.track&&(this.track_name=track.name),ref=this.scores,j=0,len1=ref.length;len1>j;j++)score=ref[j],score.slug===track.slug&&(score["short"]=track["short"]);return level_to_title=["O(1)","O(logN)","O(N)","O(N<sup>2</sup>)","O(2<sup>N</sup>)"],span_width=12,hasFilter=!1,this.activeFilter&&this.filterValue&&(hasFilter=this.activeFilter),_filterValue=this.filterValue,this.filterValue&&this.filterValue.length>25&&(_filterValue=this.filterValue.slice(0,23)+"..."),viewed=!HR.profile().isLoggedIn()||HR.profile().get("has_viewed_new_leaderboard"),$(this.el).html(HR.appController.template(this.template,this)({level:this.level,track:this.track,track_name:this.track_name,type:this.type,scores:this.scores,tracks:tracks,level_to_title:level_to_title,span_width:span_width,extra_column:this.viewColumn,activeFilter:this.activeFilter,filterValue:_filterValue,hasFilter:hasFilter,viewed:viewed})),this.initRecommendation(),that=this,_.each($(".span1-3.hover"),function(obj){return $(obj).children().data("val").toString()===that.type+"-"+that.track?$(obj).addClass("highlight"):void 0}),this.setBreadcrumb(),this.$('select[name="leaderboard-filter"]').select2({minimumResultsForSearch:-1}),keys=_.keys(this.collection.filters),keys.length>0&&(keys.length>0&&(this.activeFilter=keys[0]),filterValue=this.collection.filters[this.activeFilter],this.setFilter(filterValue)),this.processBlank()?("domain"===this.type&&this.renderSelfView(),this):(this.collection.sync_status&&(leadersDiv=$(),that=this,this.$("#leaders").html(""),_.each(this.collection.models,function(model){var _view;return _view=new HR.OverallLeaderboardListView({leader:model,extra_column:that.viewColumn,type:that.type}),that.add_subview(_view),leadersDiv.push(_view.render().el)}),this.$("#leaders").append(leadersDiv),this.renderSelfView(),this.collection.available&&HR.util.pagination(this.$(".pagination-wrapper"),this.collection.getTotal(),this.collection.pageURL()+"/",this.collection.getCurrentPage(),this.collection,this.collection.limit,10,"backbone",!1)),this.$(".show-tip").tooltip({placement:"bottom"}),this)},LeaderboardMainView2.prototype.renderSelfView=function(){var selfView;return this.collection.current_hacker?(selfView=new HR.OverallLeaderboardListView({leader:new HR.LeaderboardModel(this.collection.current_hacker),extra_column:this.viewColumn,type:this.type}),this.$("#leader-self").html(selfView.render().el),this.$("#leader-self").show()):void 0},LeaderboardMainView2.prototype.setupFindUser=function(el){var that;return el.length>0?(that=this,el.autocomplete({minLength:2,appendTo:"#leaderboard-autocomplete",source:function(request,response){return $.ajax({url:"/rest/hackers/autocomplete?limit=4",data:{q:request.term},success:function(data){return response(data)}})},select:function(event,ui){return that.$("input#filter_hacker").val(ui.item.value),that.findUser(ui.item.value)}}).data("ui-autocomplete")._renderItem=function(ul,item){return $("<li></li>").data("ui-autocomplete-item",item).append($("<a></a>").append($("<div class='hacker-container'> <div class='hacker-avatar'> <img height='25' width='25' class='pull-left avatar profile_avatar' onerror=\"this.src='https://d3rpyts3de3lx8.cloudfront.net/hackerrank/assets/gravatar.jpg';\" src='/rest/hackers/"+$.trim(item.value)+"/avatar'> </div> <div class='hacker-details'> <p class='hacker-username'>"+item.value+"</p> </div> </div>"))).appendTo(ul)}):void 0},LeaderboardMainView2.prototype.findUser=function(value){return this.collection.clearFilters(),this.activeFilter="hacker",this.setFilter(value)},LeaderboardMainView2.prototype.getHeaderFilter=function(filter){var el;return el=this.$("#hf-block").find(".header-filter"),el.find("._filter").text(filter),el.find("input").attr("id","filter_"+filter).attr("data-filter",filter),el.detach(),el},LeaderboardMainView2}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.LeaderboardMainView2=LeaderboardMainView2})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,QuoraLeaderboardView,ref;return QuoraLeaderboardView=function(superClass){function QuoraLeaderboardView(){return QuoraLeaderboardView.__super__.constructor.apply(this,arguments)}return extend(QuoraLeaderboardView,superClass),QuoraLeaderboardView.prototype.template="quora-leaderboard",QuoraLeaderboardView.prototype.className="leaderboard-view container",QuoraLeaderboardView.prototype.initialize=function(options){return null==options&&(options={}),this.round=options.round,this.profile=HR.profile(),this.listenTo(this.profile,"sync",this.loggedIn)},QuoraLeaderboardView.prototype.loggedIn=function(){return Backbone.history.loadUrl()},QuoraLeaderboardView.prototype.render=function(){var dialog;return this.profile.isLoggedIn()?$(this.el).html(HR.appController.template(this.template,this)({round:this.round})):this.dialogShown||(dialog=HR.util.ShowLoginDialog({title:"Please login or register to continue"}),dialog.render(),this.dialogShown=!0),this},QuoraLeaderboardView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.QuoraLeaderboardView=QuoraLeaderboardView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,LeaderboardRecommendationView,ref;return LeaderboardRecommendationView=function(superClass){function LeaderboardRecommendationView(){return LeaderboardRecommendationView.__super__.constructor.apply(this,arguments)}return extend(LeaderboardRecommendationView,superClass),LeaderboardRecommendationView.prototype.template="leaderboard-recommendation",LeaderboardRecommendationView.prototype.initialize=function(options){return null==options&&(options={}),this.type=options.type,this.track=options.track,this.getModel(),this.listenTo(this.model,"reset",this.render),this.listenTo(this.model,"change",this.render),this},LeaderboardRecommendationView.prototype.events={"click .recommend-challenge-click":"trackRecommendationClick"},LeaderboardRecommendationView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)({recommendation:this.recommendation})),this},LeaderboardRecommendationView.prototype.setModel=function(options){return this.track!==options.track||this.type!==options.type?(this.track=options.track,this.type=options.type,this.getModel()):void 0},LeaderboardRecommendationView.prototype.getModel=function(){var that;return that=this,this.model=new HR.RecommendationModel({track_slug:this.track,type:"contest"===this.type?"contest":"challenge"}),this.model.disableThrobber=!0,this.model.fetch({success:function(){var difficulty,epoch_starttime,max_score,preview,subtitle,title,type,url;return that.model.status?("contest"===that.type?(epoch_starttime=that.model.get("epoch_starttime"),subtitle=moment.unix(epoch_starttime).format("MMMM DD"),title="Upcoming Contest",moment.unix(epoch_starttime)<moment()&&(title="Ongoing Contest"),url="/"+that.model.get("slug"),type="Contest",preview=that.model.get("description_html")):(difficulty=that.model.get("difficulty_name"),max_score=that.model.get("max_score"),subtitle=difficulty+" - "+max_score+"pts",title="Solve this challenge to improve your rank",url=that.model.get("url"),type="Challenge",preview=that.model.get("preview")),that.recommendation={title:title,name:that.model.get("name"),slug:that.model.get("slug"),subtitle:subtitle,preview:preview,url:url,type:type}):that.recommendation=null,that.render()}})},LeaderboardRecommendationView.prototype.trackRecommendationClick=function(e){var data,ltype,obj,type;if(this.recommendation)return type=this.recommendation.type,ltype=type.toLowerCase(),obj={click_element:type+"-Inside",recommendation_type:"Leaderboard-"+type},obj["recommended_"+ltype+"_name"]=this.recommendation.name,obj["recommended_"+ltype+"_slug"]=this.recommendation.slug,data=obj,hr_metrics.externalService("track","RecommendationClick",data)},LeaderboardRecommendationView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.LeaderboardRecommendationView=LeaderboardRecommendationView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,InboxView,ref;return InboxView=function(superClass){function InboxView(){return InboxView.__super__.constructor.apply(this,arguments)}return extend(InboxView,superClass),InboxView.prototype.template="inbox",InboxView.prototype.className="inbox-view",InboxView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this)),this},InboxView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.InboxView=InboxView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,MessageThreadListView,ref;return MessageThreadListView=function(superClass){function MessageThreadListView(){return MessageThreadListView.__super__.constructor.apply(this,arguments)}return extend(MessageThreadListView,superClass),MessageThreadListView.prototype.template="messagethread-list",MessageThreadListView.prototype.className="messagethread-list-view",MessageThreadListView.prototype.initialize=function(options){return this.thread=options.thread,this.parent=options.parent,this.listenTo(this.model,"reset",this.render),this.listenTo(this.model,"change",this.render),this.max_message_length=90},MessageThreadListView.prototype.render=function(){var _model,last_message;return _model=$.extend(!0,{},this.model.toJSON()),_model.active=parseInt(_model.id)===parseInt(this.parent.thread_id),last_message=_model.last_message,last_message.id||(last_message.message=_.escape(last_message.message)),_model.last_message.receiver_id===(_model.user1||{}).id?(_model.receiver=_model.user1,_model.sender=_model.user2):(_model.receiver=_model.user2,_model.sender=_model.user1),$(this.el).html(HR.appController.template(this.template,this)({model:_model,profile:HR.profile().toJSON(),max_message_length:this.max_message_length})),this},MessageThreadListView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.MessageThreadListView=MessageThreadListView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,MessageThreadView,ref;return MessageThreadView=function(superClass){function MessageThreadView(){return MessageThreadView.__super__.constructor.apply(this,arguments)}return extend(MessageThreadView,superClass),MessageThreadView.prototype.template="messagethread",MessageThreadView.prototype.className="messagethread-view",MessageThreadView.prototype.events={"click div[data-thread-id]":"viewThread","click .hr_send_new_message":"newMessage","click a.js-more":"loadMoreThreads"},MessageThreadView.prototype.initialize=function(options){return this.active_thread_id=options.active_thread_id,this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"add",this.onAdd),this.listenTo(this.collection,"remove",this.onRemove),this.messages_view={},this.messages_collection={},this.threads_view={}},MessageThreadView.prototype.render=function(){return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this},MessageThreadView.prototype.renderView=function(){var model;return this.has_template&&($(this.el).html(this._template({has_more:this.collection.has_more&&this.collection.length>=10})),this.collection.comparator=function(val){return-new Date(val.get("last_message").created_at).getTime()},!this.fetching)?(this.fetching=!0,model=this.collection.findWhere({id:parseInt(this.active_thread_id)}),model?this.collection.remove(model):(model=new HR.MessageThreadModel,model.set("id",parseInt(this.active_thread_id))),model.fetch({success:function(_this){return function(m){return m.id&&_this.collection.add(m),_this.renderSubviews()}}(this),error:function(_this){return function(){return _this.renderSubviews()}}(this)}),this.fetching=!1):void 0},MessageThreadView.prototype.renderSubviews=function(){var that;return that=this,0===this.collection.length?(this.$(".threads-list-wrap").html("<p class='gray'>You have no messages</p>"),this.$(".messaging_content").html("<p class='gray'>No Conversation Selected</p>"),void(HR.util&&HR.util.ajaxmsg&&HR.util.ajaxmsg("",!1,!0,.001))):(this.thread_id||(this.thread_id=this.active_thread_id||this.collection.first().get("id")),this.showThread(),this.$(".threads-list-wrap").html(""),_.each(this.collection.models,function(model){return that.threads_view[model.get("id")]=new HR.MessageThreadListView({model:model,parent:this}),that.add_subview(that.threads_view[model.get("id")]),this.$(".threads-list-wrap").append("<div data-thread-id='"+model.get("id")+"'></div>"),that.threads_view[model.get("id")].setElement(this.$("div[data-thread-id="+model.get("id")+"]")).render()},this))},MessageThreadView.prototype.renderMessagesView=function(){var base,name;return(base=this.messages_view)[name=this.thread_id]||(base[name]=new HR.MessageView({collection:this.messages_collection[this.thread_id],parent:this.threads_view[this.thread_id],parent2:this})),this.$(".messaging_content").html(""),this.messages_view[this.thread_id].setElement(this.$(".messaging_content")).render()},MessageThreadView.prototype.showThread=function(){var that;return that=this,this.messages_collection[this.thread_id]?that.renderMessagesView():(this.messages_collection[this.thread_id]=new HR.collection("messages"),this.messages_collection[this.thread_id].thread_id=this.thread_id,this.messages_collection[this.thread_id].fetch({success:function(){return that.renderMessagesView()}})),this.readThread(this.thread_id)},MessageThreadView.prototype.viewThread=function(e){var $el;return $el=$(e.currentTarget),this.thread_id=$el.attr("data-thread-id"),this.showThread(),Backbone.history.navigate("/inbox/thread/"+this.thread_id),this.$("div li.active").removeClass("active"),this.$("div[data-thread-id="+this.thread_id+"] li").addClass("active")},MessageThreadView.prototype.sortByDate=function(a,b){return new Date(a.get("last_message").created_at)<new Date(b.get("last_message").created_at)},MessageThreadView.prototype.readThread=function(thread_id){return this.collection.findWhere({id:parseInt(thread_id)})?this.collection.findWhere({id:parseInt(thread_id)}).markAsRead({on_success:function(){return HR.appView.navigationView.fetchMessageCount()}}):void 0},MessageThreadView.prototype.rearrangeThread=function(id){var tempModel;return tempModel=this.threads_view[id].model,this.collection.remove(tempModel),this.collection.add(tempModel,{at:0})},MessageThreadView.prototype.onAdd=function(model){return 1===this.collection.length&&this.$(".threads-list-wrap").html(""),this.threads_view[model.get("id")]=new HR.MessageThreadListView({model:model,parent:this}),$(".threads-list-wrap").prepend("<div data-thread-id='"+model.get("id")+"'></div>"),this.threads_view[model.get("id")].setElement($("div[data-thread-id="+model.get("id")+"]")).render()},MessageThreadView.prototype.onRemove=function(model){var element;return element=this.$("div[data-thread-id="+model.get("id")+"]"),element.remove()},MessageThreadView.prototype.newMessage=function(e){var dialog;return e.preventDefault(),dialog=new HR.util.ShowMessageDialog,dialog.render()},MessageThreadView.prototype.loadMoreThreads=function(){var newCollection;return HR.cachedMessagesCollection?(newCollection=new HR.MessageThreadCollection,newCollection.setFrom(HR.cachedMessagesCollection.length),newCollection.fetch({success:function(){return _.each(newCollection.models,function(model){return HR.cachedMessagesCollection.add(model)}),HR.cachedMessagesCollection.has_more=newCollection.has_more,HR.appView.navigationView.message_view&&HR.appView.navigationView.message_view.render(),HR.cachedMessageView?HR.cachedMessageView.render():void 0}})):void 0},MessageThreadView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.MessageThreadView=MessageThreadView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,MessageListView,ref;return MessageListView=function(superClass){function MessageListView(){return MessageListView.__super__.constructor.apply(this,arguments)}return extend(MessageListView,superClass),MessageListView.prototype.template="message-list",MessageListView.prototype.className="message-list-view",MessageListView.prototype.events={"click a.mark-message-spam":"markSpam","click a.unmark-message-spam":"unmarkSpam"},MessageListView.prototype.markSpam=function(e){var error_cb,success_cb,that,user_id;return user_id=HR.profile().id,that=this,this.thread.user1.id===user_id||this.thread.user2.id===user_id?($(e.currentTarget).html("Marking As Spam"),success_cb=function(){return $(e.currentTarget).html("Marked As Spam"),$(e.currentTarget).removeClass("mark-message-spam"),$(e.currentTarget).addClass("unmark-message-spam"),that.$(".message_body").addClass("spam")},error_cb=function(){return $(e.currentTarget).html("Mark As Spam")},this.model.mark_as_spam(success_cb,error_cb)):void 0},MessageListView.prototype.unmarkSpam=function(e){var error_cb,success_cb,that,user_id;return user_id=HR.profile().id,that=this,this.thread.user1.id===user_id||this.thread.user2.id===user_id?($(e.currentTarget).html("Unmarking As Spam"),success_cb=function(){return $(e.currentTarget).html("Mark As Spam"),$(e.currentTarget).removeClass("unmark-message-spam"),$(e.currentTarget).addClass("mark-message-spam"),that.$(".message_body").removeClass("spam")},error_cb=function(){return $(e.currentTarget).html("Marked As Spam")},this.model.unmark_as_spam(success_cb,error_cb)):void 0},MessageListView.prototype.initialize=function(options){return this.thread=options.thread,this.listenTo(this.model,"render",this.render)},MessageListView.prototype.nl2br=function(str){var breakTag;return breakTag="<br />",(str+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+breakTag+"$2")},MessageListView.prototype.render=function(){var _model;return _model=this.model.toJSON(),_model.is_spam=this.model.spam(),this.model.get("id")?_model.message=this.nl2br(_model.message):_model.message=this.nl2br(_.escape(_model.message)),_model.receiver_id===this.thread.user1.id?(_model.receiver=this.thread.user1,_model.sender=this.thread.user2):(_model.receiver=this.thread.user2,_model.sender=this.thread.user1),$(this.el).html(HR.appController.template(this.template,this)({model:_model}))},MessageListView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.MessageListView=MessageListView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,MessageView,ref;return MessageView=function(superClass){function MessageView(){return MessageView.__super__.constructor.apply(this,arguments)}return extend(MessageView,superClass),MessageView.prototype.template="message",MessageView.prototype.className="message-view",MessageView.prototype.events={"click .hr_send":"sendMessage","click .hr_load_more":"loadMore","keydown .hr_message_text":"keyPressed","change .hr_message_text":"updateCharacterCount","keyup .hr_message_text":"updateCharacterCount","paste .hr_message_text":"updateCharacterCount"},MessageView.prototype.maxMessageLength=950,MessageView.prototype.initialize=function(options){return this.local_id=0,this.messages={},this.parent=options.parent,this.parent2=options.parent2,this.listenTo(this.collection,"add",this.onAdd),this.listenTo(this.collection,"remove",this.onRemove),this.collection.length>0?this.parent.model.set("last_message",this.collection.first().toJSON()):void 0},MessageView.prototype.render=function(){var func;if(parseInt(this.parent.model.get("id"))===parseInt(this.parent2.thread_id))return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),func=function(){return $(".hr_message_text").focus()},setTimeout(func,1)},MessageView.prototype.renderView=function(){var scrolldown;return this.has_template&&($(this.el).html(this._template({has_more:this.collection.has_more})),this.renderSubviews()),scrolldown=function(){return $(".message_history").scrollTop($(".message_history")[0].scrollHeight)},setTimeout(scrolldown,0),this.updateCharacterCount()},MessageView.prototype.prependElement=function(model){var id,thread;if(parseInt(this.parent.model.get("id"))===parseInt(this.parent2.thread_id))return thread=new HR.MessageListView({model:model,thread:this.collection.thread,parent:this}),this.add_subview(thread),id=model.get("id")||model.get("local_id"),this.messages[id]=thread,this.$(".message_list").prepend("<div data-id='"+id+"'></div>"),thread.setElement(this.$("div[data-id="+id+"]")).render(),this.from_bottom||(this.from_bottom=0),$(".message_history").scrollTop($(".message_history")[0].scrollHeight-this.from_bottom)},MessageView.prototype.appendElement=function(model){var id,thread;if(parseInt(this.parent.model.get("id"))===parseInt(this.parent2.thread_id))return thread=new HR.MessageListView({model:model,thread:this.collection.thread,parent:this}),this.add_subview(thread),id=model.get("id")||model.get("local_id"),this.messages[id]=thread,this.$(".message_list").append("<div data-id='"+id+"'></div>"),thread.setElement(this.$("div[data-id="+id+"]")).render(),this.from_bottom||(this.from_bottom=0),$(".message_history").scrollTop($(".message_history")[0].scrollHeight-this.from_bottom)},MessageView.prototype.renderSubviews=function(){var that;return that=this,this.collection.sync_status?(this.$(".message_list").html(""),_.each(this.collection.models,function(model){return that.prependElement(model)},this)):void 0},MessageView.prototype.loadMore=function(){var newCollection,that;if(parseInt(this.parent.model.get("id"))===parseInt(this.parent2.thread_id)&&!this.loading_more)return this.loading_more=!0,that=this,this.from_bottom=$(".message_history")[0].scrollHeight,this.collection.length>0?(newCollection=new HR.collection("messages"),newCollection.thread_id=this.collection.thread_id,newCollection.setUntil(this.collection.last().get("id")),newCollection.fetch({success:function(){var index;return that.loading_more=!1,that.collection.has_more=newCollection.has_more,index=0,_.each(newCollection.models,function(model){return that.ignore=!0,that.collection.add(model),that.ignore=!1,that.prependElement(model),index++}),that.collection.has_more===!1?$(".hr_load_more").hide():void 0},error:function(){return that.loading_more=!1}})):void 0},MessageView.prototype.keyPressed=function(e){return 13!==e.keyCode||e.shiftKey||(e.preventDefault(),this.charactersLeft()>=0&&this.sendMessage()),this.updateCharacterCount()},MessageView.prototype.updateCharacterCount=function(){return this._updateCharacterCount||(this._updateCharacterCount=_.throttle(function(_this){return function(){var $send_btn,char_left;return char_left=_this.charactersLeft(),$send_btn=_this.$(".messaging_respond .hr_send"),0>char_left?$send_btn.attr("disabled",!0):$send_btn.attr("disabled")&&$send_btn.attr("disabled",!1),_this.$(".messaging_respond .characters_left").html(""+char_left)}}(this),50)),this._updateCharacterCount()},MessageView.prototype.charactersLeft=function(){return this.maxMessageLength-this.$(".hr_message_text").val().length},MessageView.prototype.sendMessage=function(){var data,model,that;if(parseInt(this.parent.model.get("id"))===parseInt(this.parent2.thread_id)&&""!==$(".hr_message_text").val())return this.from_bottom=0,that=this,model=new HR.MessageModel,data={sender_id:this.collection.thread.user1.id,receiver_id:this.collection.thread.user2.id,message:$(".hr_message_text").val()},model.set("message",data.message),model.set("sender_id",data.sender_id),model.set("receiver_id",data.receiver_id),model.set("created_at",new Date),that.collection.add(model,{at:0}),$(".hr_message_text").val(""),model.save(data,{success:function(resp){var restrictionDialog;return model.status?(model.set("created_at",resp.get("created_at")),that.messages[model.get("local_id")].render()):model.status===!1?(restrictionDialog=HR.util.ShowDialog({body:model.error,title:"Account Restricted",events:{"click .close-messaging-restriction-dialog":function(){return restrictionDialog.destroy()}}}).render(),that.messages[model.get("local_id")].destroy(),that.collection.remove(model,{at:0})):void 0}})},MessageView.prototype.onAdd=function(model){return this.ignore?void 0:(model.set("local_id",this.local_id),this.parent2.rearrangeThread(this.parent.model.get("id")),this.local_id-=1,this.appendElement(model),this.parent.model.set("last_message",model.toJSON()),this.parent.render())},MessageView.prototype.onRemove=function(model){return this.parent2.render(),this.parent.render()},MessageView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.MessageView=MessageView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,NavigationMessageView,ref;return NavigationMessageView=function(superClass){function NavigationMessageView(){return NavigationMessageView.__super__.constructor.apply(this,arguments)}return extend(NavigationMessageView,superClass),NavigationMessageView.prototype.template="navigation-message",NavigationMessageView.prototype.initialize=function(options){return this.collection=HR.cachedMessagesCollection,this.thread_views={},this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"remove",this.onRemove),this.listenTo(this.collection,"add",this.onAdd)},NavigationMessageView.prototype.render=function(){var that;return $(this.el).html(HR.appController.template(this.template,this,!1)),that=this,0===this.collection.length?this.$(".hr_nav_messages_list").html("<div class='no-propagation text-center txt-navy' style='padding: 30px 0px 30px 0px; font-size:16px'>You have no unread messages.</div>"):(this.$(".hr_nav_messages_list").html(""),_.each(this.collection.models,function(model){return that.thread_views[model.get("id")]||(that.thread_views[model.get("id")]=new HR.NavigationMessageListView({model:model})),that.add_subview(that.thread_views[model.get("id")]),that.$(".hr_nav_messages_list").append(that.thread_views[model.get("id")].render().el)}))},NavigationMessageView.prototype.onAdd=function(model){return this.thread_views[model.get("id")]=new HR.NavigationMessageListView({model:model}),this.$(".hr_nav_messages_list").prepend(this.thread_views[model.get("id")].render().el)},NavigationMessageView.prototype.onRemove=function(model){return this.thread_views[model.get("id")].remove()},NavigationMessageView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.NavigationMessageView=NavigationMessageView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);
  return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,NavigationMessageListView,ref;return NavigationMessageListView=function(superClass){function NavigationMessageListView(){return NavigationMessageListView.__super__.constructor.apply(this,arguments)}return extend(NavigationMessageListView,superClass),NavigationMessageListView.prototype.template="navigation-message-list",NavigationMessageListView.prototype["class"]="navigation-message-list-view",NavigationMessageListView.prototype.events={"click a.message_status":"markAsRead","click li.notify_item":"goToThread"},NavigationMessageListView.prototype.initialize=function(){return this.listenTo(this.model,"change",this.render),this.max_message_length=60},NavigationMessageListView.prototype.goToThread=function(e){return"I"!==e.target.tagName||"icon-reply"===e.target.className?(HR.router.navigate("/inbox/thread/"+this.model.get("id"),{trigger:!0}),$(".notify_dropdown").removeClass("open"),hr_metrics.track("Click","NavBarMessageDropDownClick")):void 0},NavigationMessageListView.prototype.markAsRead=function(e){return"mark as read"===$(e.currentTarget).attr("data-original-title")?this.model.markAsRead({on_success:function(){return HR.appView.navigationView.fetchMessageCount()}}):this.model.markAsUnread()},NavigationMessageListView.prototype.render=function(){var last_message,model;return model=$.extend(!0,{},this.model),last_message=model.get("last_message"),last_message.id||(last_message.message=_.escape(last_message.message)),$(this.el).html(HR.appController.template(this.template,this,!1)({model:model,max_message_length:this.max_message_length})),this.delegateEvents(),this},NavigationMessageListView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.NavigationMessageListView=NavigationMessageListView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,NavigationNotificationView,ref;return NavigationNotificationView=function(superClass){function NavigationNotificationView(){return NavigationNotificationView.__super__.constructor.apply(this,arguments)}return extend(NavigationNotificationView,superClass),NavigationNotificationView.prototype.template="navigation-notification",NavigationNotificationView.prototype.events={"click .hr_archive_all":"archiveAll","click .no-propagation":"stopPropagation","click li[data-id]":"clickNotification"},NavigationNotificationView.prototype.initialize=function(options){return HR.cachedNotificationsCollection?this.collection=HR.cachedNotificationsCollection:(this.collection=HR.collection("notifications"),this.collection.unread_only=!0,HR.cachedNotificationsCollection=this.collection,this.collection.cached({silent:!0})),this.list_views={},this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"add",this.render),this.listenTo(this.collection,"remove",this.onRemove)},NavigationNotificationView.prototype.showLoader=function(){var loader;return loader=$(HR.appController.viewLoader(32)),loader.css({"padding-top":"20px","padding-bottom":"20px"}),this.$(".hr_nav_notifications_list").html(loader)},NavigationNotificationView.prototype.archiveAll=function(e){var newCollection,notif_ids,that;return e.stopPropagation(),this.collection.sync_status?(notif_ids=[],_.each(this.collection.models,function(model){return notif_ids.push(model.get("id"))}),that=this,newCollection=HR.collection("notifications"),newCollection.unread_only=!0,newCollection.offset=this.collection.length,this.collection.reset(),this.showLoader(),newCollection.fetch({success:function(resp){return $.ajax({type:"POST",url:"/rest/contests/master/notifications/archive_all",data:{notif_ids:notif_ids},success:function(resp){return HR.appView.navigationView.updateNotificationsCount(resp.unseen_count)}}),_.each(resp.models,function(model){return that.collection.add(model)}),that.collection.has_more=newCollection.has_more,that.render()},error:function(){return that.render()}})):void 0},NavigationNotificationView.prototype.stopPropagation=function(e){return e.stopPropagation()},NavigationNotificationView.prototype.clickNotification=function(e){var category,id,model,that,url;return $(e.target).hasClass("backbone")?void 0:(id=parseInt($(e.currentTarget).attr("data-id")),model=this.collection.findWhere({id:id}),model&&model.markRead(),category=$(e.currentTarget).attr("data-category"),that=this,url="page-notification-company"===category||"hacker-follow-notification"===category||"new-challenge"===category||"contest-announcements"===category||"special-announcement"===category?$(e.currentTarget).attr("data-url"):"/notifications/notif_id/"+id,HR.router.navigate(url,!0),hr_metrics.track("Click","NavBarNotificationsDropDownClick",{attribute1:category,attribute2:url,attribute7:model.get("broadcast_id")}),!1)},NavigationNotificationView.prototype.render=function(){var handleScroll,that;return this.collection.sync_status?(that=this,handleScroll=function(){var element,loader,newCollection,pos;return element=$(".hr_nav_notifications_list"),pos=element.scrollTop(),pos+element.height()===element[0].scrollHeight&&that.collection.has_more&&!that.loading_more?(that.loading_more=!0,loader=$(HR.appController.viewLoader(32)),loader.css({"padding-top":"20px","padding-bottom":"20px"}),element.append(loader),newCollection=HR.collection("notifications"),newCollection.unread_only=!0,newCollection.offset=that.collection.length,newCollection.fetch({success:function(resp){return _.each(resp.models,function(model){return that.collection.add(model)}),that.collection.has_more=newCollection.has_more,that.loading_more=!1,loader.remove()},error:function(){return loader.remove()}})):void 0},this.$(".hr_nav_notifications_list").scroll(handleScroll),0===this.collection.length?this.$(".hr_nav_notifications_list").html("<div class='no-propagation emptyState_container msA text-center'><p>You have no unread notifications</p></div>"):(that=this,this.$(".hr_nav_notifications_list").html(""),this.collection.models.length>0&&this.resetNotificationCount(),_.each(this.collection.models,function(model,index){var seconds_ago;return model.get("notification_status")<2&&(that.list_views[model.get("id")]||(that.listview=new HR.NavigationNotificationListView({model:model}),that.list_views[model.get("id")]=that.listview),that.add_subview(that.listview),that.$(".hr_nav_notifications_list").append(that.list_views[model.get("id")].render().el),0===model.notification_status||-2===model.notification_status)?(seconds_ago=parseInt(((new Date).getTime()-1e3*model.created_at_epoch)/1e3),hr_metrics.track("notificationViewed",model.category,{attribute7:index,attribute9:seconds_ago})):void 0})),this):void this.showLoader()},NavigationNotificationView.prototype.onRemove=function(model){return 0===this.collection.length&&(this.collection.sync_status=!1,this.collection.cached({fetch:!0})),this.list_views[model.get("id")].remove(),this.render()},NavigationNotificationView.prototype.resetNotificationCount=function(){var that;return this.marking_seen||""===$.trim(HR.appView.navigationView.$(".hr_notifications_count").html())?void 0:(this.marking_seen=!0,that=this,$.ajax({type:"POST",url:"/rest/contests/master/notifications/mark_seen",success:function(resp){return that.marking_seen=!1,HR.appView.navigationView.updateNotificationsCount(0)}}))},NavigationNotificationView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.NavigationNotificationView=NavigationNotificationView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,NavigationNotificationListView,ref;return NavigationNotificationListView=function(superClass){function NavigationNotificationListView(){return NavigationNotificationListView.__super__.constructor.apply(this,arguments)}return extend(NavigationNotificationListView,superClass),NavigationNotificationListView.prototype.template="navigation-notification-list",NavigationNotificationListView.prototype.events={"click a.close":"archive"},NavigationNotificationListView.prototype.initialize=function(){return this.listenTo(this.model,"destroy",this.remove)},NavigationNotificationListView.prototype.archive=function(e){return e.stopPropagation(),this.model.markRead()},NavigationNotificationListView.prototype.render=function(){return $(this.el).html(HR.appController.template(this.template,this,!1)({model:this.model.toJSON()})),this},NavigationNotificationListView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.NavigationNotificationListView=NavigationNotificationListView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,TeamView,ref;return TeamView=function(superClass){function TeamView(){return TeamView.__super__.constructor.apply(this,arguments)}return extend(TeamView,superClass),TeamView.prototype.template="team",TeamView.prototype.className="team-view",TeamView.prototype.initialize=function(options){return this.action=options.action||"create",this.contest_slug=options.contest_slug,this.contest_slug&&(this.contest=new HR.ContestModel({slug:this.contest_slug}),this.contest.fetch({cached:!0}),this.listenTo(this.contest,"sync",this.render)),this.model?(this.listenTo(this.model,"sync",this.render),this.model.fetch({cached:!0})):void 0},TeamView.prototype.events={"click a[data-toggle=tab]":"changeTab","keyup input#name":"updateHandle","keyup input#slug":"enableSave","click button.team-submit":"updateTeam","click button.add-member-submit":"addMember","click button.remove-member":"removeMember","click button.approve-me":"approveMe"},TeamView.prototype.render=function(){var can_access_members_page,member_ids,that;return this.contest_slug&&this.contest.sync_status&&!this.contest.get("team_event")&&HR.router.navigate("/contests/"+this.contest_slug,!0),this.hacker=HR.profile(),member_ids=this.model?_.map(this.model.members().models,function(model){return model.get("hacker_id")}):[],this.model&&_.size(this.model.attributes)>0&&this.model.sync_status&&this.model.get("manager_id")!==this.hacker.get("id")&&(can_access_members_page="members"===this.action&&-1!==member_ids.indexOf(this.hacker.get("id")),"view"===this.action||can_access_members_page||(this.contest_slug?HR.router.navigate("/contests/"+this.contest_slug+"/teams/"+this.model.get("id")+"/view",!0):HR.router.navigate("/teams/"+this.model.get("id")+"/view",!0))),this.render_locked||($(this.el).html(HR.appController.template(this.template,this)({team:this.model,hacker:this.hacker,action:this.action,member_ids:member_ids,contest:this.contest,contest_slug:this.contest_slug})),"create"!==this.action||this.contest_slug||(that=this,this.$("input#contest_id").select2({width:"off",minimumInputLength:1,query:function(query){return $.ajax("/rest/contests/team_events",{success:function(data){return query.callback(data),that.enableSave()}})}}))),this},TeamView.prototype.destroy=function(){return this.$("input#contest_id").select2("close"),TeamView.__super__.destroy.call(this)},TeamView.prototype.changeTab=function(e){var tab;return e.preventDefault(),"create"!==this.action?$(e.currentTarget).hasClass("active")?void 0:(tab=$(e.currentTarget).parent().attr("data-action"),this.contest_slug?HR.router.navigate("/contests/"+this.contest_slug+"/teams/"+this.model.get("id")+"/"+tab,!0):HR.router.navigate("/teams/"+this.model.get("id")+"/"+tab,!0)):void 0},TeamView.prototype.updateHandle=function(e){return this.$("input#slug").val(HR.util.slugify($(e.currentTarget).val(),"_")),this.enableSave(e)},TeamView.prototype.enableSave=function(e){return this.$("button.team-submit").removeClass("disabled")},TeamView.prototype.updateTeam=function(e){var allowed_fields,that;return e.preventDefault(),$(e.currentTarget).hasClass("disabled")?void 0:($(e.currentTarget).html("Saving...").addClass("disabled"),this.$("article#details p.success").addClass("hide").html(""),this.$("article#details p.error").addClass("hide").html(""),this.$("article#details small.error").html(""),allowed_fields=["name","slug"],"create"!==this.action||this.contest_slug||allowed_fields.push("contest_id"),this.model||(this.model=new HR.TeamModel),this.contest_slug&&this.model.set("contest_id",this.contest.get("id")),_.each(allowed_fields,function(field){return this.model.set(field,this.$("article#details form input#"+field).val())},this),"create"!==this.action||this.contest_slug||this.model.get("contest_id")?(that=this,this.render_locked=!0,this.model.save(null,{success:function(model,resp,options){return model.status?"details"===that.action?that.$("article#details p.success").removeClass("hide").html("Changes have been saved successfully"):"create"===that.action&&HR.router.navigate((that.contest_slug?"/contests/"+that.contest_slug:"")+("/teams/"+model.get("id")+"/members"),!0):(model.errors._global?that.$("article#details p.error").removeClass("hide").html(model.errors._global):that.$("article#details p.error").removeClass("hide").html("There was an error").show(),_.each(model.errors,function(value,key){return"_global"!==key?that.$("article#details input#"+key).parent().find(".error").html(value):void 0})),$(e.currentTarget).html("Save").addClass("disabled")}})):($(e.currentTarget).html("Save"),void this.$("article#details form input#contest_id").parent().find(".error").html("Must select a valid contest which allows teams")))},TeamView.prototype.addMember=function(e){var team_member,that;return e.preventDefault(),this.$("input.add-member-username").val()?(team_member=new HR.TeamMemberModel,team_member.set("team_id",this.model.get("id")),team_member.set("username",this.$("input.add-member-username").val()),that=this,team_member.save(null,{success:function(model,resp,options){return model.status?(that.model.members().add(model),that.render_locked=!1,that.model.fetch()):(model.errors._global?that.$("article#members p.error").removeClass("hide").html(_.escape(model.errors._global)):that.$("article#members p.error").removeClass("hide").html("There was an error").show(),_.each(model.errors,function(value,key){return"_global"!==key?that.$("article#members input#"+key).parent().find(".error").html(_.escape(value[0])):void 0}))}})):void 0},TeamView.prototype.approveMe=function(e){var dialog,that;return e.preventDefault(),$(e.currentTarget).hasClass("disabled")?void 0:($(e.currentTarget).addClass("disabled"),that=this,dialog=HR.util.ShowConfirmationDialog({title:"Approve Membership.",body:"Are you sure?",onDestroy:function(){return $(e.currentTarget).removeClass("disabled")},buttons:[{name:"Yes",callback:function(dialog){var btn,member_hacker_id,team_member;return btn=this,team_member=that.model.members().get($(e.currentTarget).attr("data-id")),member_hacker_id=team_member.get("hacker_id"),that.model.members().remove(team_member),team_member.approve({success:function(response){return response.status?(btn.setInactive(),dialog.destroy(),that.render_locked=!1,that.model.fetch()):(btn.setActive(),btn.setFailedMsg(response.message))}})}},{name:"No",callback:function(dialog){return this.setInactive(),dialog.destroy()}}]}),dialog.render())},TeamView.prototype.removeMember=function(e){var dialog,that;return e.preventDefault(),$(e.currentTarget).hasClass("disabled")?void 0:($(e.currentTarget).addClass("disabled"),that=this,dialog=HR.util.ShowConfirmationDialog({title:"Confirm Removal",body:"Are you sure?",onDestroy:function(){return $(e.currentTarget).removeClass("disabled")},buttons:[{name:"Yes",callback:function(dialog){var btn,member_hacker_id,team_member;return btn=this,team_member=that.model.members().get($(e.currentTarget).attr("data-id")),member_hacker_id=team_member.get("hacker_id"),that.model.members().remove(team_member),team_member.destroy({success:function(model,response){var hacker;return response.status?(btn.setInactive(),dialog.destroy(),hacker=HR.profile(),hacker.get("id")===member_hacker_id?HR.router.navigate("/settings/teams",!0):(that.render_locked=!1,that.model.fetch())):(btn.setActive(),btn.setFailedMsg(response.errors._global))}})}},{name:"No",callback:function(dialog){return this.setInactive(),dialog.destroy()}}]}),dialog.render())},TeamView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.TeamView=TeamView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var EditorialView,HR,ref;return EditorialView=function(superClass){function EditorialView(){return EditorialView.__super__.constructor.apply(this,arguments)}return extend(EditorialView,superClass),EditorialView.prototype.template="editorial",EditorialView.prototype.className="editorial-view container",EditorialView.prototype.eager_load_asset_list=["compound/challenge-views","compound/forum-views","compound/submission-views"],EditorialView.prototype.initialize=function(options){return this.challenge=options.challenge,this.current_hacker=options.current_hacker,this.listenTo(this.model,"reset",this.render),this.listenTo(this.model,"change",this.render),this.listenTo(this.challenge,"reset",this.render),this.listenTo(HR.profile(),"sync",this.render),this.render()},EditorialView.prototype.events={"click a.play-video-button":"playVideo"},EditorialView.prototype.playVideo=function(e){var iframe_html,video_id;return video_id=$(e.currentTarget).attr("data-video-id"),this.$("div.video-button-container[data-video-id="+video_id+"]").hide(),iframe_html='<iframe id="player-'+video_id+'" type="text/html" width="800" height="450" class="block-center"\n  src="https://www.youtube.com/embed/'+video_id+"?enablejsapi=1&version=3&autoplay=1&rel=0&origin="+encodeURIComponent(document.location.protocol+"//"+document.location.host)+'"\n  frameborder="0" allowfullscreen=""></iframe>',this.$("div.video-container[data-video-id="+video_id+"]").html(iframe_html)},EditorialView.prototype.renderView=function(){return this.model.sync_status?($(this.el).html(HR.appController.template(this.template,this)({model:this.model.toJSON(),challenge:this.challenge.toJSON(),current_hacker:this.current_hacker.toJSON(),challenge_slug:this.challenge.get("slug")})),HR.util.updateExternalLinks(this.$(".editorial-container"))):void 0},EditorialView.prototype.render=function(){var dialog;return this.challenge.sync_status?(HR.profile()&&HR.profile().isLoggedIn()?this.challenge.get("is_solution_unlocked")||this.challenge.get("solved")?this.renderView():this.confirmationShown||(HR.util.confirm({message:"Do you want to unlock and read the editorial? If you do, your score will not be counted toward your progress.",okCallback:function(_this){return function(){return _this.model.set("unlock",!0),_this.model.fetch({success:function(model){return _this.challenge.set("is_solution_unlocked",!0,{silent:!0}),_this.challenge.trigger("unlockEditorial"),_this.challenge.flush(),_this.renderView()}})}}(this),cancelCallback:function(_this){return function(){return _this.confirmationShown=!1}}(this)}),this.confirmationShown=!0):this.dialogShown||(dialog=HR.util.ShowLoginDialog({title:"Please login or register to read the editorial"}),dialog.render(),this.dialogShown=!0),this):this},EditorialView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.EditorialView=EditorialView})}.call(this),function(){var bind=function(fn,me){return function(){return fn.apply(me,arguments)}},extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var ExpertSolutionView,HR,ref;return ExpertSolutionView=function(superClass){function ExpertSolutionView(){return this.renderForum=bind(this.renderForum,this),this.setupEditor=bind(this.setupEditor,this),this.updateLanguage=bind(this.updateLanguage,this),this.updateOrFindLanguage=bind(this.updateOrFindLanguage,this),this.refreshView=bind(this.refreshView,this),ExpertSolutionView.__super__.constructor.apply(this,arguments)}return extend(ExpertSolutionView,superClass),ExpertSolutionView.prototype.template="expert-solution",ExpertSolutionView.prototype.className="expert-solution-view container",ExpertSolutionView.prototype.initialize=function(options){return this.challenge=options.challenge,this.contest=options.contest,this.profile=options.profile,this.model=HR.model("expert-solution",{challenge_slug:this.challenge.get("slug"),contest_slug:this.contest.get("slug")}).cached(),this.current_hacker=options.current_hacker,this.comment_collection=options.comment_collection,this.listenTo(this.model,"reset",this.render),this.listenTo(HR.profile(),"sync",this.render),"undefined"==typeof window.warnalias&&(window.warnalias=console.warn.bind(console),console.warn=function(text){return 0!==text.indexOf("FIREBASE")||-1===text.indexOf("permission_denied")?warnalias.apply(this,arguments):void 0}),this.initializeVariables()},ExpertSolutionView.prototype.initializeVariables=function(){return this.code="",this.firepadDoc=null,this.firebaseDoc=null,this.editor=null,this.language="cpp",this.cursorStart=0,this.currentLine=1,this.liveCodingSetup=!1,this.timeoutSet=null},ExpertSolutionView.prototype.refreshView=function(){return this.stopListening(this.model),this.timeoutSet&&clearTimeout(this.timeoutSet),this.initializeVariables(),this.model=null,this.model=new HR.ExpertSolutionModel({challenge_slug:this.challenge.get("slug"),contest_slug:this.contest.get("slug")}),this.model.fetch(),this.listenTo(this.model,"change",this.render)},ExpertSolutionView.prototype.setupLiveCoding=function(){return this.model&&this.model.get("id")?(this.model.get("ongoing")||this.model.get("codepair_slug"))&&this.model.get("started")?(this.liveCodingSetup=!0,this.firebaseDoc=new Firebase(this.model.editorPath()),this.firebaseDoc.authWithCustomToken(this.model.get("token"),function(_this){return function(error,result){return error?console.log("Firebase Permission Denied"):_this.setupEditor()}}(this)),this.languageRef=this.firebaseDoc.child("settings/language"),this.languageRef.on("value",this.updateOrFindLanguage),this.editorRef=this.firebaseDoc.child("editor")):this.$(".live-coding-editor-loading").addClass("hidden"):void 0},ExpertSolutionView.prototype.updateOrFindLanguage=function(snapshot){return snapshot&&this.language!==snapshot&&(this.language=snapshot.val(),this.updateLanguage()),this.language},ExpertSolutionView.prototype.updateLanguage=function(){return this.editor?(this.$(".language-content").html(lang_display_mapping[this.language]),HR.appController.loadCodeMirrorMode(this.language,function(_this){return function(){return _this.editor.setOption("mode",lang_mime_mapping[_this.language])}}(this))):void 0},ExpertSolutionView.prototype.setupEditor=function(){var codeArea,editorOptions;return this.$("#live-code-container").length>0?(codeArea=this.$("#live-code-container")[0],editorOptions={lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,mode:lang_mime_mapping[this.language],indentUnit:4,styleActiveLine:!0,readOnly:!0,value:this.code},HR.appController.loadCodeMirrorMode(this.language,function(_this){return function(){return _this.$("#live-code-container").html(""),_this.code?_this.editor.getDoc().setValue(_this.code):void 0}}(this)),this.firepadDoc=Firepad.fromCodeMirror(this.editorRef,codeArea),this.firepadDoc.on("ready",function(_this){return function(){var opt,val;_this.editor=_this.firepadDoc.editor_,codeArea.appendChild(_this.editor.display.wrapper);for(opt in editorOptions)val=editorOptions[opt],_this.editor.setOption(opt,val);return _this.updateLanguage(),_this.showEditor()}}(this))):void 0},ExpertSolutionView.prototype.showEditor=function(){return this.$(".live-coding-editor-container").removeClass("hidden"),this.$(".live-coding-editor-loading").addClass("hidden")},ExpertSolutionView.prototype.renderForum=function(){var challenge_slug,contest_slug,that;return that=this,challenge_slug=this.challenge.get("slug"),contest_slug=this.challenge.get("contest_slug"),HR.requires(["compound/forum-views"],function(_this){return function(){return _this.commentsView||(_this.commentsView=new HR.ChallengeCommentsView({challenge:_this.challenge,collection:_this.comment_collection,profile:_this.profile,contest:_this.contest,sort_type:"Recent",expert_tab_embed:!0}),_this.add_subview(_this.commentsView)),_this.assign({".commentsView":_this.commentsView})}}(this))},ExpertSolutionView.prototype.render=function(){var ref;return this.model&&this.model.get("id")&&($(this.el).html(HR.appController.template(this.template,this)({model:this.model.toJSON(),_model:this.model,language:lang_display_mapping[this.language]})),this.liveCodingSetup||this.setupLiveCoding(),0<=(ref=this.model.get("seconds_to_start"))&&3600>=ref&&(this.timeoutSet||(this.model.get("seconds_to_start")<10?this.timeoutSet=setTimeout(this.refreshView,1e3*(this.model.get("seconds_to_start")+2)):this.timeoutSet=setTimeout(this.refreshView,500*this.model.get("seconds_to_start")))),this.model.get("seconds_to_start")<=0&&this.renderForum()),this},ExpertSolutionView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.ExpertSolutionView=ExpertSolutionView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var BadgeProgressView,HR,ref;return BadgeProgressView=function(superClass){function BadgeProgressView(){return BadgeProgressView.__super__.constructor.apply(this,arguments)}return extend(BadgeProgressView,superClass),BadgeProgressView.prototype.template="badge-progress",BadgeProgressView.prototype.initialize=function(options){return this.track=options.track,this.listenTo(HR.profile(),"change:scores",this.render)},BadgeProgressView.prototype.trackScore=function(){return HR.profile().get("scores")?HR.profile().get("scores")[this.track]:null},BadgeProgressView.prototype.badge=function(){return this.trackScore()&&this.trackScore().practice?this.trackScore().practice.badge:null},BadgeProgressView.prototype.hasEntryBadge=function(){return null!==this.badge()&&void 0!==this.badge()},BadgeProgressView.prototype.badgeProgress=function(){return this.trackScore()?this.trackScore().practice.badge_progress:null},BadgeProgressView.prototype.service_status=function(){return this.trackScore?this.trackScore().practice.service_status:!0},BadgeProgressView.prototype.completion=function(){var i,len,next,ref,score,total;if(this.badgeProgress()){if(this.hasEntryBadge()){for(next=0,ref=this.badge().limits,i=0,len=ref.length;len>i;i++)if(score=ref[i],null!==score&&score/100>this.badgeProgress().total_score){next=score/100;break}return 0===next?100:parseFloat(100*this.badgeProgress().total_score)/next}return score=Math.min(this.badgeProgress().total_score,this.badgeProgress().min_total_score),total=this.badgeProgress().min_total_score,_.each(_.keys(this.badgeProgress().chapter_scores),function(_this){return function(chapter){return total+=_this.badgeProgress().min_chapter_score,score+=Math.min(_this.badgeProgress().chapter_scores[chapter],_this.badgeProgress().min_chapter_score)}}(this)),parseFloat(100*score)/total}return 0},BadgeProgressView.prototype.todo=function(){var html,i,len,next,ref,score;if(html="",this.hasEntryBadge()){for(next=0,ref=this.badge().limits,i=0,len=ref.length;len>i;i++)if(score=ref[i],null!==score&&score/100>this.badgeProgress().total_score){next=score/100;break}next>this.badgeProgress().total_score&&(html+="Earn "+(next-this.badgeProgress().total_score).round(2)+" more score to reach the next badge level!")}else this.badgeProgress().total_score<this.badgeProgress().min_total_score&&(html+="Earn "+(this.badgeProgress().min_total_score-this.badgeProgress().total_score).round(2)+" more points in <strong>"+this.trackScore().name+"</strong><br>"),html+="Earn more points in following sub-domain(s)<br>",_.each(_.keys(this.badgeProgress().chapter_scores),function(_this){return function(chapter){return _this.badgeProgress().chapter_scores[chapter]<_this.badgeProgress().min_chapter_score?html+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>"+chapter+"</strong>: "+(_this.badgeProgress().min_chapter_score-_this.badgeProgress().chapter_scores[chapter]).round(2)+" pts<br>":void 0}}(this));return html},BadgeProgressView.prototype.render=function(){return this.badgeProgress()&&$(this.el).html(HR.appController.template(this.template,this)({completion:this.completion(),todo:this.todo(),has_entry_badge:this.hasEntryBadge(),badge:this.badge(),service_status:this.service_status()})),this},BadgeProgressView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.BadgeProgressView=BadgeProgressView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty,indexOf=[].indexOf||function(item){for(var i=0,l=this.length;l>i;i++)if(i in this&&this[i]===item)return i;return-1};jQuery(function(){var HR,RegisterForContestView,ref;return RegisterForContestView=function(superClass){function RegisterForContestView(){return RegisterForContestView.__super__.constructor.apply(this,arguments)}return extend(RegisterForContestView,superClass),RegisterForContestView.prototype.template="dashboard/contestregistration",RegisterForContestView.prototype.className="contest-register-view",RegisterForContestView.prototype.initialize=function(options){var that;return this.contest=options.contest,this.contest_slug=options.slug,this.profile=options.profile,this.model=options.model,this.current_width=25,this.prevSection="information",this.newSection="",that=this,this.model.fetch({cached:!0}),this.nav_bar_items=["information","connect","interests","register"],this.nav_bar_label_mapping={information:"Information",team:"Team",connect:"Connect",interests:"Interests",register:"Finish"},this.listenTo(this.contest,"reset",this.render),this.listenTo(this.contest,"change",this.render),this.listenTo(this.model,"reset",this.render),this.listenTo(this.model,"change",this.render)},RegisterForContestView.prototype.events={"change .hacker-field":"saveHackerData","change .hacker-custom-field":"saveHackerCustomData","click input[type=checkbox].hacker-custom-field":"saveHackerCustomData","click #register-contest":"contestSignup","click #enter-contest":"contestEnter","change .interests select":"saveHackerInterests","change #extra_trends":"saveExtraHackerTrends","change input#school":"changeSchool","click .next-section":"gotoNextSection","click #show-more-interests":"showMoreInterests","change #graduation_year":"updateCollegeYear","keyup input.required, textarea.required, select.required":"removeError"},RegisterForContestView.prototype.contestEnter=function(e){return e.preventDefault(),this.checkReqdFields()?(hr_metrics.track("Click","enterWithAdditionalDetails",{attribute1:this.profile.username}),this.saveHackerConestInvite(),HR.router.navigate("/contests/"+this.contest_slug,{trigger:!0})):void this.scrollTo("#information")},RegisterForContestView.prototype.showMoreInterests=function(){return $(".interests").removeClass("hidden"),$("#show-more-interests").addClass("hidden")},RegisterForContestView.prototype.fixHeader=function(){var $stickyBody,$stickyEl,$window,elTop;return $window=$(window),$stickyEl=this.$("#js-regHead"),$stickyBody=this.$("#js-regBody"),elTop=$stickyEl.offset().top,$window.scroll(function(){var $windowTop;return $windowTop=$window.scrollTop(),$stickyEl.toggleClass("fix",$windowTop>elTop),$stickyBody.toggleClass("pad",$windowTop>elTop)})},RegisterForContestView.prototype.gotoNextSection=function(e){
  var $element,idNextSection;return this.checkReqdFields()?($element=$(e.currentTarget),idNextSection=$element.data("next-section"),"#team"===idNextSection||this.checkTeam()?($(".optional-nav").removeClass("disabled"),$element.data("can-skip-next")&&("#connect"===idNextSection&&this.model.get("hacker_invites_count")>0&&(idNextSection="#interests"),"#interests"===idNextSection&&(this.hackerTrendPresent()||this.hackerInterestPresent())&&(idNextSection="#register")),"#connect"===idNextSection&&this.schoolFriendsView.render(),this.newSection=idNextSection.replace("#",""),this.trackMetric($element[0].id,this.prevSection,this.newSection),this.prevSection=this.newSection,$(idNextSection).hasClass("hidden")&&($(idNextSection).removeClass("hidden"),100!==this.current_width&&(this.current_width+=this.single_slider_width),"#register"===idNextSection&&(this.current_width=100),$(".progress-bar").css("width",this.current_width+"%"),$(".progress-number").css("left",this.current_width+"%").text(this.current_width+"%")),$(".registration-nav a").removeClass("active"),$("#nav-"+idNextSection.replace("#","")).addClass("active"),$("#skip").removeClass("hidden"),("#information"===idNextSection||"#register"===idNextSection||"#team"===idNextSection)&&$("#skip").addClass("hidden"),$("#skip-this").attr("data-next-section",$(idNextSection).find(".next-section").attr("data-next-section")),this.scrollTo(idNextSection)):void this.scrollTo("#team")):void this.scrollTo("#information")},RegisterForContestView.prototype.checkReqdFields=function(){var $element,complete,ele,i,len,ref;for(complete=!0,ref=$("input.required, select.required, textarea.required"),i=0,len=ref.length;len>i;i++)ele=ref[i],$element=this.$(ele),null===$element.val()||!$element.val().toString().trim()&&!this.$("#s2id_"+ele.id).hasClass("disabled")?($element.select2("container").addClass("error"),complete=!1):$element.select2("container").hasClass("error")&&$element.select2("container").removeClass("error");return complete?this.$("#error-msg").addClass("hidden"):(this.$("#error-msg").removeClass("hidden"),this.$("#register-contest").removeAttr("disabled"),this.$("#register-contest").html("Register")),complete},RegisterForContestView.prototype.checkTeam=function(){return this.contest.get("team_event")&&this.registerTeamView?this.registerTeamView.checkTeam():!0},RegisterForContestView.prototype.fields=function(){var custom_additional_details_data,data,default_additional_select2_options,that;return data=[{label:"HackerRank Username",slug:"username-field",value:this.profile.get("username"),required:!0,disabled:!0,model:this.model,wrapper_add_class:"span8"},{label:"Email Address",slug:"email-field",value:this.profile.get("email"),required:!0,disabled:!0,model:this.model,wrapper_add_class:"span8"},{label:"First Name",slug:"personal_first_name",value:this.profile.get("personal_first_name"),required:!0,add_class:"hacker-field",model:this.model,wrapper_add_class:"span8"},{label:"Last Name",slug:"personal_last_name",value:this.profile.get("personal_last_name"),required:!0,add_class:"hacker-field",model:this.model,wrapper_add_class:"span8"}],that=this,this.model.get("default_additional_details")&&(default_additional_select2_options=this.option_values(),this.model.get("default_additional_details").forEach(function(field){var options;return field={label:field[1],slug:field[0],value:that.profile.get(field[0]),required:field[2],add_class:"hacker-field",model:that.model,wrapper_add_class:"span8"},("address"===field.slug||"short_bio"===field.slug)&&(field.type="textarea"),"school"===field.slug&&(field.type="select2",field.select2_options=HR.util.getSelect2Options("school"),field.disable_autosave=!0),"country"===field.slug&&(field.type="select2",field.select2_options=HR.util.country_select2_options),["tsize","college_majors","college_year","graduation_year"].indexOf(field.slug)>-1&&(field.type="select2",options=[],default_additional_select2_options[field.slug]&&default_additional_select2_options[field.slug].forEach(function(option){return options.push({id:option,text:option})}),"college_majors"===field.slug?field.select2_options={data:options,multiple:!0}:field.select2_options={data:options}),data.push(field)})),this.model.get("custom_additional_details")&&(custom_additional_details_data=this.model.get("hacker_registration_custom_data"),this.model.get("custom_additional_details").forEach(function(field){var opt,ref;return field.add_class="hacker-custom-field",field.value=custom_additional_details_data[field.slug],field.required=field.mandatory,field.model=that.model,field.wrapper_add_class="span8","dropdown"===field.type&&(opt=[],field.allowed_values&&(ref=field.value,indexOf.call(field.allowed_values,ref)<0&&(field.value=null),field.allowed_values.forEach(function(val){return opt.push({id:val,text:val})})),field.type="select2",field.select2_options={data:opt}),"checkbox"===field.type&&(field.inline=!0),data.push(field)})),data},RegisterForContestView.prototype.render=function(){return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this},RegisterForContestView.prototype.renderView=function(){var fields_container,index,odd_inputs_filler,that;if(!this.profile.isLoggedIn())return void this.ShowLoginDialog();if(this.contest.sync_status&&this.model.sync_status)return this.contest.get("has_codesprint_reg_page")||HR.router.navigate("/"+this.contest_slug,{trigger:!0,replace:!0}),this.contest.get("team_event")&&this.nav_bar_items.splice(1,0,"team"),this.total_nav_items=this.nav_bar_items.length,this.single_slider_width=Math.ceil(100/this.total_nav_items),this.current_width=this.single_slider_width,$(this.el).html(this._template({profile:this.profile.toJSON(),model:this.model.toJSON(),contest_slug:this.contest_slug,option_values:this.option_values(),contest:this.contest.toJSON(),nav_bar_items:this.nav_bar_items,nav_bar_label_mapping:this.nav_bar_label_mapping,single_slider_width:this.single_slider_width,view:this})),odd_inputs_filler='<div class="formgroup span8 invisible">\n  <label>empty</label>\n  <input type="text">\n</div>',fields_container=$(),this.$(".js-fields-wrapper").append('<div class="row">'),index=0,_.each(this.fields(),function(field){var _view;if("checkbox"!==field.type)return _view=new HR.GenericInputView({field:field}),fields_container.push(_view.render().el),index++,index%2===0?(this.$(".js-fields-wrapper").find("div.row:last").append(fields_container),this.$(".js-fields-wrapper").append('<div class="row">'),fields_container=$()):void 0},this),fields_container.children().length?(this.$(".js-fields-wrapper").find("div.row:last").append(fields_container),this.$(".js-fields-wrapper").find("div.row:last").append(odd_inputs_filler)):this.$(".js-fields-wrapper").find("div.row:last").remove(),fields_container=$(),this.$(".js-fields-wrapper").append('<div class="row">'),index=0,_.each(this.fields(),function(field){var _view;if("checkbox"===field.type)return _view=new HR.GenericInputView({field:field}),fields_container.push(_view.render().el),index++,index%2===0?(this.$(".js-fields-wrapper").find("div.row:last").append(fields_container),this.$(".js-fields-wrapper").append('<div class="row">'),fields_container=$()):void 0},this),fields_container.children().length?(this.$(".js-fields-wrapper").find("div.row:last").append(fields_container),this.$(".js-fields-wrapper").find("div.row:last").append(odd_inputs_filler)):this.$(".js-fields-wrapper").find("div.row:last").remove(),this.$("input#company").completer("company"),that=this,$("select").select2({placeholder:"",allowClear:!0}),$("input[type='checkbox']").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green"}),$("input[type='radio']").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green"}),that=this,this.$(".trends input[type=checkbox]").on("ifChecked",function(e){var position,trend_id;return trend_id=$(e.currentTarget).attr("data-trend-id"),position=$(e.currentTarget).attr("data-position"),that.saveHackerTrend(trend_id,position,!0)}),this.$(".trends input[type=checkbox]").on("ifUnchecked",function(e){var position,trend_id;return trend_id=$(e.currentTarget).attr("data-trend-id"),position=$(e.currentTarget).attr("data-position"),that.saveHackerTrend(trend_id,position,!1)}),this.$(".companies input[type=checkbox]").on("ifChecked",function(e){var company_id,position;return company_id=$(e.currentTarget).attr("data-company-id"),position=$(e.currentTarget).attr("data-position"),that.followCompany(company_id,position,!0)}),this.$(".companies input[type=checkbox]").on("ifUnchecked",function(e){var company_id,position;return company_id=$(e.currentTarget).attr("data-company-id"),position=$(e.currentTarget).attr("data-position"),that.followCompany(company_id,position,!1)}),this.$("input[type=checkbox].hacker-custom-field").on("ifToggled",function(e){return that.saveHackerCustomData()}),this.$("input[type=checkbox]#jobs_consent").on("ifToggled",function(e){return that.updateHackerJobsConsent()}),this.$("input[type=checkbox]#contest_email_pref").on("ifToggled",function(e){return that.updateHackerEmailPref()}),this.schoolFriendsCollection||(this.schoolFriendsCollection=new HR.HackerSchoolFriendsCollection),this.schoolFriendsCollection.setContestSlug(this.contest_slug),this.schoolFriendsCollection.fetch(),this.schoolFriendsView||(this.schoolFriendsView=new HR.SchoolFriendsView({profile:HR.profile(),collection:this.schoolFriendsCollection,contest:this.contest})),this.assign({".reg-friendsinvite":this.schoolFriendsView}),this.contest.get("team_event")&&(this.registerTeamView||(this.registerTeamView=new HR.RegisterTeamView({profile:HR.profile(),collection:this.schoolFriendsCollection,contest:this.contest,parent_model:this.model,parent:this})),this.assign({".register-team":this.registerTeamView})),this.add_subview(this.registerTeamView),this.fixHeader(),this.updateCollegeYear(),this},RegisterForContestView.prototype.option_values=function(){var option_values;return option_values={},option_values.tsize=["S","M","L","XL","XXL"],option_values.college_year=["Freshman","Sophomore","Junior","Senior","Graduate"],option_values.graduation_year=this.getGraduationYearValues(),option_values.college_majors=this.model.get("majors"),option_values.yearsOfExp=[[0,"--"],[1,"&lt; 1 year"],[2,"1 - 2 years"],[3,"&gt; 2 years"]],option_values.interestLevels=[[0,"--"],[1,"Not Interested"],[2,"Sort of Interested"],[3,"Very Interested"]],option_values},RegisterForContestView.prototype.setSchool=function(school){return $(this.el).find("input#school").val(school),$(this.el).find("#s2id_school .select2-choice span").text(school)},RegisterForContestView.prototype.ShowLoginDialog=function(){var _timeoutFn;if(!this.dialog)return _timeoutFn=function(_this){return function(){return HR.profile().isLoggedIn()?(_this.model.fetch(),_this.renderView()):setTimeout(_timeoutFn,100)}}(this),this.dialog=HR.util.ShowLoginDialog({error_message:"Please sign up or log in to register for "+this.contest_slug,success_callback:function(){return setTimeout(_timeoutFn,100)}}),this.dialog.render()},RegisterForContestView.prototype.changeSchool=function(e){var $element,new_value;return $element=$(e.currentTarget),new_value=$element.val(),this.schoolFriendsView.showLoader(),this.schoolFriendsView.updateSchool(new_value),this.schoolFriendsCollection.fetch({success:function(_this){return function(){return _this.schoolFriendsView.render()}}(this)})},RegisterForContestView.prototype.saveHackerData=function(e){var $element,isDefault,name,select2_data,val;return $element=$(e.currentTarget),$element?(val=$element.data("select2")?$element.select2("val"):$element.val(),name=$element.attr("id"),"school"===name&&(select2_data=$element.select2("data"),isDefault=!!select2_data["default"])?(this.setSchool(this.profile.get("school")),void HR.util.changeSelect2SchoolDialog("school",val,function(_this){return function(data){return _this.setSchool(data.entity_name),_this.profile.set("school",data.entity_name,{silent:!0}),_this.profile.save({silent:!0})}}(this))):(this.profile.set($element.attr("id"),val,{silent:!0}),this.profile.save({silent:!0}))):void 0},RegisterForContestView.prototype.contestSignup=function(e){var $element,contest_slug,current_text,that;return e.preventDefault(),$element=$(e.currentTarget),"disabled"!==$element.attr("disabled")?this.checkReqdFields()?(hr_metrics.track("Click","registerWithAdditionalDetails",{attribute1:this.profile.username}),this.updateHackerEmailPref(),current_text=$element.html(),this.model.get("additional_details_filled")?$element.html("Updating..."):$element.html("Signing up..."),$element.attr("disabled","disabled"),contest_slug=this.contest_slug,that=this,$.ajax({type:"POST",beforeSend:function(xhr){return xhr.setRequestHeader("X-CSRF-Token",$('meta[name="csrf-token"]').attr("content"))},url:"/rest/contests/"+contest_slug+"/signup",data:{contest_crp:$.cookie(contest_slug+"_crp"),jobs_consent:this.jobsConsentValue(),invite_hackers:this.schoolFriendsView.getHackers()},success:function(data){var body,form_properties,options,profile;return data.status?data.country_allowed?(that.gotoNextSection(e),that.model.get("additional_details_filled")?$element.html("Successfully Updated"):$element.html("Successfully Registered")):(form_properties={},options={title:"Country Not Allowed",width:400},body='<div class="block-center text-center">\n  Sorry, it seems like you are trying to access the contest from '+data.current_country+".\n  But this contest is only available for users who live in "+data.allowed_countries+".\n</div>",options.body=body,new HR.util.ShowDialog(options,form_properties).render(),$element.html(current_text),$element.removeAttr("disabled")):(profile=HR.profile(),profile.isLoggedIn()?alert(data.message):new HR.util.ShowLoginDialog({error_message:data.message}).render(),$element.html(current_text),$element.removeAttr("disabled"))}})):void this.scrollTo("#information"):void 0},RegisterForContestView.prototype.saveHackerInterests=function(e){var $element,interest,interests;return $element=$(e.currentTarget),$element?(interests=this.model.get("interests"),interest=interests[parseInt($element.attr("data-position"))],interest[$element.attr("data-attr")]=parseInt($element.val()),this.model.set("interests",interests),this.model.patch({interests:JSON.stringify([interest])})):void 0},RegisterForContestView.prototype.saveHackerCustomData=function(e){var data;return data={},_.each(this.$(":input.hacker-custom-field"),function(field){var $element,key,value;return $element=this.$(field),key=$element.attr("id"),$element&&(value="checkbox"===$element.data("type")?$element.is(":checked"):$element.val()),data[key]=value}),this.model.patch({registration_custom_data:data})},RegisterForContestView.prototype.saveHackerTrend=function(trend_id,position,exists){var trend,trends;return trends=this.model.get("trends"),trend=trends[position],trend.exists=exists,this.model.set("trends",trends),this.model.patch({trends:JSON.stringify([trend])})},RegisterForContestView.prototype.followCompany=function(company_id,position,following){var companies,company;return companies=this.model.get("companies"),company=companies[position],company.following=following,this.model.set("companies",companies),this.model.patch({companies:JSON.stringify([company])})},RegisterForContestView.prototype.saveExtraHackerTrends=function(){var additional_trends;return additional_trends=$("#extra_trends").val(),this.model.set("additional_trends",additional_trends,{silent:!0}),this.model.patch({additional_trends:additional_trends})},RegisterForContestView.prototype.trackMetric=function(id,prev,next){return hr_metrics.track("Click",id,{attribute1:prev,attribute2:next})},RegisterForContestView.prototype.scrollTo=function(id){return $("html, body").animate({scrollTop:$(id).offset().top-170},1e3)},RegisterForContestView.prototype.updateCollegeYear=function(e){var $element,gradYears,out_of_range_years,val;return $element=this.$("#graduation_year"),this.$("input#college_year").length<1?void 0:(val=$element.val(),gradYears=this.getGraduationYearValues(),out_of_range_years=[_.first(gradYears),_.last(gradYears)],indexOf.call(out_of_range_years,val)>=0?(this.$("input#college_year").select2("enable",!1),setTimeout(function(_this){return function(){return _this.$("#s2id_college_year").addClass("disabled")}}(this),0)):(this.$("input#college_year").select2("enable",!0),this.$("#s2id_college_year").removeClass("disabled")))},RegisterForContestView.prototype.saveHackerConestInvite=function(){var hackers;return hackers=this.schoolFriendsView.getHackers(),this.model.patch({hacker_contest_invites:hackers})},RegisterForContestView.prototype.updateHackerJobsConsent=function(){var jobs_consent;return jobs_consent=this.jobsConsentValue(),this.model.patch({hacker_jobs_consent:jobs_consent})},RegisterForContestView.prototype.getGraduationYearValues=function(){var current_year,i,ref,ref1,start_year,to_year,year,year_values;for(year_values=[],current_year=parseInt(HR.util.getCurrentYear()),start_year=current_year-10,to_year=current_year+10,year=i=ref=start_year,ref1=to_year;ref1>=ref?ref1>=i:i>=ref1;year=ref1>=ref?++i:--i)year_values.push(year.toString());return year_values},RegisterForContestView.prototype.getSelect2Data=function(values){return{data:_.map(values,function(value){return{id:value,text:value}})}},RegisterForContestView.prototype.updateHackerEmailPref=function(){var contest_email_pref;if(!(this.$("#contest_email_pref").length<1))return contest_email_pref=this.$("#contest_email_pref").is(":checked"),this.model.patch({contest_email_pref:contest_email_pref})},RegisterForContestView.prototype.jobsConsentValue=function(){return this.$("#jobs_consent").is(":checked")},RegisterForContestView.prototype.hackerTrendPresent=function(){return _.some(this.model.get("trends"),function(trend){return trend.exists})},RegisterForContestView.prototype.hackerInterestPresent=function(){return _.some(this.model.get("interests"),function(interest){return 0!==interest.experience_level||0!==interest.interest_level})},RegisterForContestView.prototype.removeError=function(e){return $(e.currentTarget).select2("container").removeClass("error")},RegisterForContestView.prototype.nextSection=function(currentSection){var index;return index=this.nav_bar_items.indexOf(currentSection),index>-1&&index<this.nav_bar_items.length?this.nav_bar_items[index+1]:void 0},RegisterForContestView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.RegisterForContestView=RegisterForContestView})}.call(this),function(){jQuery(function(){var HR,changeSelect2SchoolDialog,ref;return changeSelect2SchoolDialog=function(entity_type,entity_name,successCallback,cancelCallback){var dialog;return null==entity_name&&(entity_name=""),null==successCallback&&(successCallback=null),null==cancelCallback&&(cancelCallback=null),dialog=new HR.util.ShowFormDialog({title:"Add a new "+entity_type+":",width:650,fullwidth:!0,label_width:5,fields:[{name:"entity_name",title:"Name*",value:entity_name,type:"text"},{name:"url",title:"Official Website",type:"text"}],buttons:[{name:"Add","class":"btn-primary hr-dialog-button",callback:function(dialog){var data;return data={},_.each(dialog.$form().serializeArray(),function(x){return data[x.name]=x.value}),data.entity_name?!HR.util.badURLValidator(data.url)&&data.url?(dialog.form_unset_alert(),void dialog.form_set_error("The URL is invalid")):(successCallback&&successCallback(data),dialog.destroy()):(dialog.form_unset_alert(),void dialog.form_set_error("A required field is empty"))}},{name:"Cancel","class":"hr-dialog-button",callback:function(dialog){return cancelCallback&&cancelCallback(),dialog.destroy()}}]}),dialog.render()},HR=null!=(ref=window.HR)?ref:{},HR.util||(HR.util={}),HR.util.changeSelect2SchoolDialog=changeSelect2SchoolDialog})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,SchoolFriendsView,ref;return SchoolFriendsView=function(superClass){function SchoolFriendsView(){return SchoolFriendsView.__super__.constructor.apply(this,arguments)}return extend(SchoolFriendsView,superClass),SchoolFriendsView.prototype.template="dashboard/schoolfriends",SchoolFriendsView.prototype.className="school-friend-view",SchoolFriendsView.prototype.initialize=function(options){return this.contest=options.contest,this.profile=options.profile,this.collection=options.collection,this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"change",this.render)},SchoolFriendsView.prototype.events=function(){return{"click .load-more-friends":"loadMoreNonParticipatingFriends","change input.select-hacker":"selectFriendToInvite","change input#select-all":"selectAllFriendsToInvite"}},SchoolFriendsView.prototype.loadMoreNonParticipatingFriends=function(e){var that;return e.preventDefault(),hr_metrics.track("ContestPageLoadMoreFriends",window.location.pathname,{attribute1:this.contest.get("name"),attribute2:this.collection.offset,attribute3:this.collection.limit,attribute4:this.collection.total}),that=this,this.collection.setOffset(this.collection.offset+this.collection.limit),this.collection.fetch({remove:!1,success:function(){return that.render(),that.$(".content-wrapper").scrollTop(215*(that.collection.offset/that.collection.limit-1))}})},SchoolFriendsView.prototype.selectAllFriendsToInvite=function(e){var checkbox,checkboxes,that;return checkbox=this.$("#select-all:checked"),checkboxes=this.$(".select-hacker"),this.invite_hackers=[],hr_metrics.track("ContestRegSelectAllFriends",window.location.pathname,{attribute1:this.contest.get("name"),attribute2:checkbox.length}),1===checkbox.length?(that=this,checkboxes.attr("checked",!0),_.each(checkboxes,function(_c){return that.invite_hackers.push($(_c).attr("value"))})):checkboxes.attr("checked",!1)},SchoolFriendsView.prototype.selectFriendToInvite=function(e){var checkboxes,that;return checkboxes=this.$(".select-hacker:checked"),this.invite_hackers=[],hr_metrics.track("ContestRegSelectFriend",window.location.pathname,{attribute1:this.contest.get("name")}),that=this,_.each(checkboxes,function(checkbox){return that.invite_hackers.push($(checkbox).attr("value"))}),checkboxes.length!==this.$(".select-hacker")?this.$("#select-all").attr("checked",!1):void 0},SchoolFriendsView.prototype.updateSchool=function(school){var that;return that=this,this.collection.setSchool(school),this.collection.fetch({reset:!0,success:function(){return that.render()}})},SchoolFriendsView.prototype.render=function(){return this.has_template?this.renderView():HR.appController.getTemplate(this.template,function(template){return this._template=template,this.has_template=!0,this.renderView()},this),this},SchoolFriendsView.prototype.renderView=function(){return this.collection.sync_status?($(this.el).html(this._template({profile:this.profile.toJSON(),collection:this.collection.toJSON(),contest:this.contest.toJSON(),_collection:this.collection})),this.$(".badge input[type='checkbox']").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green"}),this):void 0},SchoolFriendsView.prototype.showLoader=function(){return $(this.el).html(HR.appController.viewLoader(64))},SchoolFriendsView.prototype.getContestUrl=function(){return document.location.host+"/"+this.contest.get("slug")},SchoolFriendsView.prototype.getHackers=function(){return this.invite_hackers},SchoolFriendsView.prototype.trackMetric=function(data){return hr_metrics.track("Click",data)},SchoolFriendsView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.SchoolFriendsView=SchoolFriendsView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var HR,RegisterTeamView,ref;return RegisterTeamView=function(superClass){function RegisterTeamView(){return RegisterTeamView.__super__.constructor.apply(this,arguments)}return extend(RegisterTeamView,superClass),RegisterTeamView.prototype.template="dashboard/register-team",RegisterTeamView.prototype.className="register-team-view",RegisterTeamView.prototype.initialize=function(options){return null==options&&(options={}),this.parent_model=options.parent_model,this.contest=options.contest,this.parent=options.parent,this.hacker=HR.profile(),this.model=new HR.TeamModel,this.parent_model.get("team")&&this.model.set(this.parent_model.get("team")),this.listenTo(this.model,"change",this.render)},RegisterTeamView.prototype.events={"keyup input#team-name":"updateHandle","keyup input#team-slug":"enableSave","click button.team-save":"updateTeam","click button.add-member-submit":"addMember","click button.remove-member":"removeMember","click button.approve-me":"approveMe","hover button.team-save":"toggleGreen"},RegisterTeamView.prototype.render=function(){var member_ids;return member_ids=this.model.member_ids(),$(this.el).html(HR.appController.template(this.template,this)({team:this.model,hacker:this.hacker,member_ids:member_ids,isManager:this.isManager()})),this.$("input.add-member-username").completer("hacker"),this.updateSingleMemberOpt(),this.$("input[type='checkbox']").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green"}),this.$("input[type=checkbox]#single-member-opt").on("ifToggled",function(_this){return function(e){return _this.updateSingleMemberOpt()}}(this)),this},RegisterTeamView.prototype.toggleGreen=function(e){var $button;return $button=$(e.currentTarget),$button.hasClass("disabled")?void 0:$button.toggleClass("btn-primary")},RegisterTeamView.prototype.updateSingleMemberOpt=function(){var single_member_opt;return single_member_opt=this.$("#single-member-opt").is(":checked"),this.model.set({single_member_opt:single_member_opt},{silent:!0}),this.model.isNew()?void 0:(this.model.save({silent:!0}),this.parent.$el.find(".team-next-section").removeClass("disabled"))},RegisterTeamView.prototype.updateHandle=function(e){return this.$("input#team-slug").val(HR.util.slugify($(e.currentTarget).val(),"_")),this.enableSave(e)},RegisterTeamView.prototype.enableSave=function(e){return this.$("button.team-save").removeClass("disabled")},RegisterTeamView.prototype.updateTeam=function(e){var $element,$response_element,current_text,data,that;return e.preventDefault(),$element=$(e.currentTarget),$element.hasClass("disabled")?void 0:(current_text=$element.html(),$element.html("Saving...").addClass("disabled"),data={contest_id:this.contest.get("id"),name:this.$("#team-name").val(),slug:this.$("#team-slug").val()},this.model.set(data,{silent:!0}),$response_element=$(".team-update-response"),$response_element.removeClass("error success"),$response_element.addClass("hide"),that=this,this.model.save(null,{success:function(model,resp,options){return model.status?($response_element.removeClass("hide").addClass("success").html("Team Updated."),that.checkTeam(),that.updateSingleMemberOpt()):($response_element.removeClass("hide").addClass("error"),model.errors._global?$response_element.html(model.errors._global):_.each(model.errors,function(value,key){return"_global"!==key?$response_element.html(key+" - "+value):void 0})),$element.html(current_text).addClass("disabled").removeClass("btn-primary")}}))},RegisterTeamView.prototype.addMember=function(e){var $response_element,team_member,that;return e.preventDefault(),this.$("input.add-member-username").val()?(team_member=new HR.TeamMemberModel,team_member.set("team_id",this.model.get("id")),team_member.set("username",this.$("input.add-member-username").val()),that=this,$response_element=this.$(".team-add-member-response"),$response_element.addClass("hide").removeClass("error success"),team_member.save(null,{success:function(model,resp,options){return model.status?(that.model.members().add(model),that.render_locked=!1,that.model.fetch()):($response_element.removeClass("hide").addClass("error"),model.errors._global?$response_element.html(_.escape(model.errors._global)):_.each(model.errors,function(value,key){return"_global"!==key?$response_element.html(_.escape(value[0])):void 0}))}})):void 0},RegisterTeamView.prototype.approveMe=function(e){var $element,member_hacker_id,team_member,that;return e.preventDefault(),$element=$(e.currentTarget),$element.hasClass("disabled")?void 0:($element.addClass("disabled"),that=this,team_member=this.model.members().get($element.data("id")),member_hacker_id=team_member.get("hacker_id"),team_member.approve({success:function(response){return response.status?(that.model._members=null,that.model.fetch()):void 0}}))},RegisterTeamView.prototype.removeMember=function(e){var $element,dialog,that;return e.preventDefault(),$element=$(e.currentTarget),$element.hasClass("disabled")?void 0:($element.addClass("disabled"),that=this,dialog=HR.util.ShowConfirmationDialog({title:"Confirm Removal",body:"Are you sure?",onDestroy:function(){return $element.removeClass("disabled")},buttons:[{name:"Yes",callback:function(dialog){var btn,member_hacker_id,team_member;return btn=this,team_member=that.model.members().get($element.data("id")),member_hacker_id=team_member.get("hacker_id"),that.model.members().remove(team_member),team_member.destroy({success:function(model,response){return response.status?(btn.setInactive(),dialog.destroy(),member_hacker_id===that.hacker.get("id")?(that.model=new HR.TeamModel,that.render(),that.listenTo(that.model,"change",that.render)):that.model.fetch()):(btn.setActive(),btn.setFailedMsg(response.errors._global))}})}},{name:"No",callback:function(dialog){return this.setInactive(),dialog.destroy()}}]}),dialog.render())},RegisterTeamView.prototype.isManager=function(){return this.model.isNew()?!0:this.hacker.get("id")===this.model.get("manager_id")},RegisterTeamView.prototype.checkTeam=function(){return this.model.isNew()?(this.$("#team-error-msg").removeClass("hide"),!1):!0},RegisterTeamView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.RegisterTeamView=RegisterTeamView})}.call(this),function(){var bind=function(fn,me){return function(){return fn.apply(me,arguments)}},extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var CategoryLeaderboardView,HR,ref;return CategoryLeaderboardView=function(superClass){function CategoryLeaderboardView(){return this.showFormulaDialog=bind(this.showFormulaDialog,this),CategoryLeaderboardView.__super__.constructor.apply(this,arguments)}return extend(CategoryLeaderboardView,superClass),CategoryLeaderboardView.prototype.template="category-leaderboard",CategoryLeaderboardView.prototype.className="leaderboard-view container",CategoryLeaderboardView.prototype.formula_template="category-leaderboard-help",CategoryLeaderboardView.prototype.initialize=function(options){return null==options&&(options={}),this.type=options.type,this.contest=options.contest,this.collection||(this.collection=new HR.CategoryLeaderboardCollection({contest_slug:options.contest_slug,page:options.page||1,type:this.type}),this.collection.cached(),this.listenTo(this.collection,"reset",this.render)),this.getFormulaTemplate()},CategoryLeaderboardView.prototype.events={"click .formula-help":"renderFormulaExplaination"},CategoryLeaderboardView.prototype.render=function(){var $blankDiv,message;return this.setBreadcrumb(),this.collection&&this.collection.sync_status&&($(this.el).html(HR.appController.template(this.template,this)({collection:this.collection.toJSON(),type:this.type,config:this.collection.config||{}})),$blankDiv=this.$("#blank-reason-container .blank-reason"),this.collection.length>0?this.$("#blank-reason-container").hide():(message="We are currently generating the leaderboard, please bear with us.",_.isBoolean(this.collection.sync_status)?this.collection.available&&(message=this.collection.total>0?"It seems like you have reached the end of the leaderboard. Why not <a href='"+this.collection.pageURL()+"' class='backbone'>go back?</a>":"The leaderboard seems to be empty. It seems like there are not enough submissions."):message=HR.appController.viewLoader(64),$blankDiv.html(message),this.$("#leader").hide(),this.$("#blank-reason-container").show()),
  HR.util.pagination(this.$(".pagination-wrapper"),this.collection.getTotal(),this.collection.pageURL()+"/",this.collection.getCurrentPage(),this.collection,this.collection.limit,5,"backbone",!1)),this},CategoryLeaderboardView.prototype.setBreadcrumb=function(){return this.contest&&this.contest.sync_status&&"master"!==this.contest.get("slug")?(HR.appView.setBreadcrumb("global","All Contests","/contests"),HR.appView.setBreadcrumb("contest",this.contest.get("name"),"/contests/"+this.contest.get("slug")+"/challenges")):void 0},CategoryLeaderboardView.prototype.renderFormulaExplaination=function(){return this.getFormulaTemplate(this.showFormulaDialog)},CategoryLeaderboardView.prototype.showFormulaDialog=function(){var $dialog,body;return body=this._formula_template({type:this.type,config:this.collection.config||{}}),$dialog=new HR.util.ShowDialog({title:this.type.toTitleCase()+" Leaderboard Calculation Formula",body:body,width:800,maxheight:window.innerHeight-240,buttons:[{name:"Close",callback:function(dialog){return this.setInactive(),dialog.destroy()}}]}),$dialog.render()},CategoryLeaderboardView.prototype.getFormulaTemplate=function(callback){return null==callback&&(callback=function(){}),this.has_formula_template?callback():HR.appController.getTemplate(this.formula_template,function(_this){return function(template){return _this.has_formula_template=!0,_this._formula_template=template,callback()}}(this),this)},CategoryLeaderboardView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.CategoryLeaderboardView=CategoryLeaderboardView})}.call(this),function(){var extend=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child},hasProp={}.hasOwnProperty;jQuery(function(){var GenericInputView,HR,ref;return GenericInputView=function(superClass){function GenericInputView(){return GenericInputView.__super__.constructor.apply(this,arguments)}return extend(GenericInputView,superClass),GenericInputView.prototype.className="generic-input-view",GenericInputView.prototype.initialize=function(options){return null==options&&(options={}),this.field=options.field},GenericInputView.prototype.render=function(){var base,events,templates;return templates={},events={},templates.text='<div class="formgroup horizontal <% if (field.required) { %>input-required<% } %> <% if (field.wrapper_add_class) { %><%- field.wrapper_add_class %><% } %>">\n  <div class="block span10">\n    <label for="<%- field.slug %>"><%- field.label %><% if (field.required) { %><span class="required-indicator">*</span><% } %>\n      <% if (field.hint) { %>\n        <span class="sub-help <% if (field.hint.length>50) { %>hint-block<% } %>">(<%- field.hint %>)</span>\n      <% } %>\n    </label>\n    <div class="input-v2-wrapper">\n      <input class="input-v2 <% if (field.required) { %>required<% } %> <% if (field.add_class) { %><%- field.add_class %><% } %>" id="<%- field.slug %>"\n        <% if (field.disabled) { %>disabled="disabled"<% } %>\n        value="<% if (field.value) {\n          %><%- field.value %><% } %>"\n        <% if (field.placeholder) { %> placeholder="<%- field.placeholder %>"<% } %>\n        type="text" data-analytics="GenericInput"\n        data-attr1="<%- field.slug %>" data-attr2="text" >\n      <img class="input-v2-loader-image hide"\n        src="<%- asset_path(\'ajax-view-loader.gif\') %>">\n      <i class="icon--single icon-ok-circled\n        input-v2-state-icon-font hide"></i>\n      <i class="icon--single icon-minus-circled\n        input-v2-state-icon-font hide"\n        style="color: red;"></i>\n    </div>\n    <div class="sub-help input-v2-error"></div>\n  </div>\n</div>',events.text={},events.text.bootstrap=function(_this){return function(){var changed,old_value;return old_value=_this.field.value,changed=!1,_this.$("input").keyup(function(e){return _this.timer&&clearTimeout(_this.timer),_this.$(".input-v2-error").html("").hide(),_this.$(".icon-ok-circled").addClass("hide"),_this.$(".icon-minus-circled").addClass("hide"),_this.$(".input-v2-loader-image").addClass("hide"),_this.$(e.currentTarget).removeClass("errored"),(old_value||"")===_this.$(e.currentTarget).val()?(changed=!1,_this.$(e.currentTarget).removeClass("changed")):_this.field.required&&old_value&&!_this.$(e.currentTarget).val()?(changed=!1,_this.$(e.currentTarget).removeClass("changed"),_this.$(e.currentTarget).addClass("errored")):(changed=!0,_this.$(e.currentTarget).addClass("changed"))}),_this.$("input").focusout(function(e){var new_value,options;if(changed){if(options={},options.success=function(data){return _this.$(".input-v2-loader-image").addClass("hide"),changed=!1,$(e.currentTarget).removeClass("changed"),old_value=$(e.currentTarget).val(),data.model&&data.model.errors[_this.field.slug]?($(e.currentTarget).addClass("errored"),_this.$(".input-v2-error").html(_.escape(data.model.errors[_this.field.slug])||"Error Occured! Please try again!").show(),_this.$("input").val(data.model[_this.field.slug]),_this.$(".icon-minus-circled").removeClass("hide")):(_this.$(".icon-ok-circled").removeClass("hide"),_this.timer=setTimeout(function(){return _this.$(".icon-ok-circled").addClass("hide")},1500),_this.field.success_callback?_this.field.success_callback(_this,data):void 0)},options.error=function(err_msg){return _this.$(".input-v2-loader-image").addClass("hide"),$(e.currentTarget).removeClass("changed"),$(e.currentTarget).addClass("errored"),_this.$(".icon-minus-circled").removeClass("hide"),_this.$(".input-v2-error").html(err_msg||"Error Occured! Please try again!").show()},new_value=$(e.currentTarget).val(),!_this.field.disable_autosave)return _this.$(".input-v2-loader-image").removeClass("hide"),_this.field.model.persist(_this.field.slug,new_value,options)}else if(_this.field.required&&!$(e.currentTarget).val())return _this.$(e.currentTarget).addClass("errored"),_this.$(".icon-minus-circled").removeClass("hide")})}}(this),templates.textarea='<div class="formgroup horizontal <% if (field.required) { %>input-required<% } %> <% if (field.wrapper_add_class) { %><%- field.wrapper_add_class %><% } %>">\n  <div class="block span10">\n    <label for="<%- field.slug %>"><%- field.label %><% if (field.required) { %><span class="required-indicator">*</span><% } %>\n      <% if (field.hint) { %>\n        <span class="sub-help">(<%- field.hint %>)</span>\n      <% } %>\n    </label>\n    <div class="input-v2-wrapper">\n      <textarea class="input-v2 <% if (field.required) { %>required<% } %> <% if (field.add_class) { %><%- field.add_class %><% } %>" id="<%- field.slug %>"\n        data-analytics="GenericInput" <% if (field.maxlength) { %> maxlength="<%- field.maxlength %>" <% } %>\n        data-attr1="<%- field.slug %>" data-attr2="text" ><% if (field.value) {\n         %><%- field.value %><% } %></textarea>\n      <img class="input-v2-loader-image hide"\n        src="<%- asset_path(\'ajax-view-loader.gif\') %>">\n      <i class="icon--single icon-ok-circled\n        input-v2-state-icon-font hide"></i>\n      <i class="icon--single icon-minus-circled\n        input-v2-state-icon-font hide"\n        style="color: red;"></i>\n      <% if (field.maxlength) { %>\n        <div class="pull-right fnt-sz-small" id="text-remaining-chars">\n          <% if (field.value) { %>\n            <%- (field.maxlength - field.value.length) %> characters remaining\n          <% } else {%>\n            <%- field.maxlength %> characters remaining\n          <% } %>\n        </div>\n      <% } %>\n    </div>\n    <div class="sub-help input-v2-error"></div>\n  </div>\n</div>',events.textarea={},events.textarea.bootstrap=function(_this){return function(){var changed,old_value;return old_value=_this.field.value,changed=!1,_this.$("textarea").keyup(function(e){return _this.timer&&clearTimeout(_this.timer),_this.$(".input-v2-error").html("").hide(),_this.$(".icon-ok-circled").addClass("hide"),_this.$(".icon-minus-circled").addClass("hide"),_this.$(".input-v2-loader-image").addClass("hide"),_this.$(e.currentTarget).removeClass("errored"),(old_value||"")===$(e.currentTarget).val()?(changed=!1,$(e.currentTarget).removeClass("changed")):(changed=!0,$(e.currentTarget).addClass("changed"))}),_this.$("textarea").focusout(function(e){var new_value,options;return changed&&(options={},options.success=function(){return _this.$(".input-v2-loader-image").addClass("hide"),_this.$(".icon-ok-circled").removeClass("hide"),changed=!1,$(e.currentTarget).removeClass("changed"),old_value=$(e.currentTarget).val(),_this.timer=setTimeout(function(){return _this.$(".icon-ok-circled").addClass("hide")},1500)},options.error=function(err_msg){return _this.$(".input-v2-loader-image").addClass("hide"),$(e.currentTarget).removeClass("changed"),$(e.currentTarget).addClass("errored"),_this.$(".icon-minus-circled").removeClass("hide"),_this.$(".input-v2-error").html(err_msg||"Error Occured! Please try again!").show()},new_value=$(e.currentTarget).val(),!_this.field.disable_autosave)?(_this.$(".input-v2-loader-image").removeClass("hide"),_this.field.model.persist(_this.field.slug,new_value,options)):void 0})}}(this),templates.checkbox='<div class="formgroup horizontal <% if (field.wrapper_add_class) { %><%- field.wrapper_add_class %><% } %>">\n  <div class="block span10">\n    <div class="input-v2-wrapper">\n      <div class="block msT msB msR position-relative" <% if (field.inline) { %> style="display: inline-block;" <% } %>>\n        <div class="icheck-overlay hide"></div>\n        <input id="<%- field.slug %>" type="checkbox"\n          <% if (field.checked) { %>checked<% } %>\n          class="hidden-checkbox <% if (field.add_class) { %><%- field.add_class %><% } %>" data-analytics="GenericInput"\n          data-attr1="<%- field.slug %>" data-attr2="checkbox" />\n      </div>\n      <label for="<%- field.slug %>" <% if (field.inline) { %> style="display: inline-block; vertical-align: top;" <% } %>>\n        <%- field.label %><img class="input-v2-checkbox-loader-image hide position-relative"\n          src="<%- asset_path(\'ajax-view-loader.gif\') %>">\n        <i class="icon--single icon-ok-circled\n          input-v2-checkbox-state-icon-font hide"></i>\n        <i class="icon--single icon-minus-circled\n          input-v2-checkbox-state-icon-font hide"\n          style="color: red;"></i>\n        <div class="sub-help input-v2-checkbox-error"></div>\n      </label>\n      <% if (field.disclaimer) { %>\n        <span class="aside msT mlB fnt-sz-small"><%- field.disclaimer %></span>\n      <% } %>\n    </div>\n  </div>\n</div>',events.checkbox={},events.checkbox.bootstrap=function(_this){return function(){var onChangeEvent,onRevertEvent;return _this.$("input[type=checkbox].hidden-checkbox").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",increaseArea:"20%"}),onRevertEvent=function(old_value,new_value){return _this.field.onChange&&_this.field.onChange(old_value,new_value),old_value?_this.$("input[type=checkbox].hidden-checkbox").iCheck("check",function(){return _this.disabled=!1,_this.$(".icheck-overlay").addClass("hide")}):_this.$("input[type=checkbox].hidden-checkbox").iCheck("uncheck",function(){return _this.disabled=!1,_this.$(".icheck-overlay").addClass("hide")})},onChangeEvent=function(new_value,old_value){var options;return _this.disabled=!0,_this.$(".icheck-overlay").removeClass("hide"),_this.field.onChange&&_this.field.onChange(new_value,old_value),_this.timer&&clearTimeout(_this.timer),_this.$(".input-v2-checkbox-error").html("").hide(),_this.$(".icon-ok-circled").addClass("hide"),_this.$(".icon-minus-circled").addClass("hide"),options={},options.success=function(){return _this.$(".input-v2-checkbox-loader-image").addClass("hide"),_this.$(".icon-ok-circled").removeClass("hide"),_this.timer=setTimeout(function(){return _this.$(".icon-ok-circled").addClass("hide")},1500),_this.disabled=!1,_this.$(".icheck-overlay").addClass("hide")},options.error=function(err_msg){return _this.$(".input-v2-checkbox-loader-image").addClass("hide"),_this.$(".icon-minus-circled").removeClass("hide"),_this.$(".input-v2-checkbox-error").html(err_msg||"Error Occured! Please try again!").show(),onRevertEvent(old_value,new_value)},_this.field.disable_autosave?void 0:(_this.$(".input-v2-checkbox-loader-image").removeClass("hide"),_this.field.model.persist(_this.field.slug,new_value,options))},_this.$("input[type=checkbox].hidden-checkbox").on("ifChecked",function(e){return _this.disabled?void 0:onChangeEvent(!0,!1)}),_this.$("input[type=checkbox].hidden-checkbox").on("ifUnchecked",function(e){return _this.disabled?void 0:onChangeEvent(!1,!0)})}}(this),templates.select2='<div class="formgroup horizontal <% if (field.required) { %>input-required<% } %> <% if (field.wrapper_add_class) { %><%- field.wrapper_add_class %><% } %>">\n  <div class="block span10">\n    <label for="<%- field.slug %>"><%- field.label %><% if (field.required) { %><span class="required-indicator">*</span><% } %>\n      <% if (field.hint) { %>\n        <span class="sub-help <% if (field.hint.length>50) { %>hint-block<% } %>" >(<%- field.hint %>)</span>\n      <% } %>\n    </label>\n    <div class="input-v2-wrapper">\n      <input class="input-v2 <% if (field.required) { %>required<% } %> <% if (field.add_class) { %><%- field.add_class %><% } %>" id="<%- field.slug %>"\n      value="<% if (field.value) {\n        %><%- field.value %><% } %>"\n      type="text"  data-analytics="GenericInput"\n        data-attr1="<%- field.slug %>" data-attr2="select2" >\n      <img class="input-v2-select2-loader-image hide"\n        src="<%- asset_path(\'ajax-view-loader.gif\') %>">\n      <i class="icon--single icon-ok-circled\n        input-v2-select2-state-icon-font hide"></i>\n      <i class="icon--single icon-minus-circled\n        input-v2-select2-state-icon-font hide"\n        style="color: red;"></i>\n    </div>\n    <div class="sub-help input-v2-error"></div>\n  </div>\n</div>',events.select2={},events.select2.bootstrap=function(_this){return function(){var old_value;return old_value=_this.field.value||"",_this.$("input#"+_this.field.slug).select2(_this.field.select2_options),_this.field.value&&(_this.$("input#"+_this.field.slug).val(_this.field.value),_this.$("#s2id_"+_this.field.slug+" .select2-choice span").text(_this.field.value)),_this.$("input#"+_this.field.slug).on("change",function(resp,added,removed){var new_value,options;return old_value===resp.val||(_this.$(".input-v2-select2-loader-image").addClass("hide"),_this.$(".icon-minus-circled").addClass("hide"),_this.$(".icon-ok-circled").addClass("hide"),_this.$(".input-v2-error").html("").hide(),_this.$("#s2id_"+_this.field.slug+" .select2-choice").removeClass("changed"),_this.$("#s2id_"+_this.field.slug+" .select2-choice").removeClass("errored"),_this.$("#s2id_"+_this.field.slug+" .select2-choice").parent().removeClass("error"),_this.timer&&clearTimeout(_this.timer),new_value=resp.val,_this.$("#s2id_"+_this.field.slug+" .select2-choice").addClass("changed"),options={},options.success=function(){return _this.$(".input-v2-select2-loader-image").addClass("hide"),_this.$(".icon-ok-circled").removeClass("hide"),_this.$("#s2id_"+_this.field.slug+" .select2-choice").removeClass("changed"),old_value=resp.val,_this.timer=setTimeout(function(){return _this.$(".icon-ok-circled").addClass("hide")},1500)},options.error=function(err_msg){return _this.$(".input-v2-select2-loader-image").addClass("hide"),_this.$("#s2id_"+_this.field.slug+" .select2-choice").removeClass("changed"),_this.$("#s2id_"+_this.field.slug+" .select2-choice").addClass("errored"),_this.$(".icon-minus-circled").removeClass("hide"),_this.$(".input-v2-error").html(err_msg||"Error Occured! Please try again!").show()},_this.field.disable_autosave)?void 0:(_this.$(".input-v2-select2-loader-image").removeClass("hide"),_this.field.model.persist(_this.field.slug,new_value,options))})}}(this),templates.upload='<div class="formgroup horizontal">\n  <div class="block span10">\n    <label for="<%- field.slug %>"><%- field.label %>\n      <% if (field.hint) { %>\n        <span class="sub-help">(<%- field.hint %>)</span>\n      <% } %>\n    </label>\n    <div class="input-v2-upload-wrapper">\n      <a class="btn btn-small no-select download\n        <% if (!field.value) { %>hide<% } %>"\n        href="<% if (field.value) {\n          %><%- field.value %><% } %>"\n        target="_blank" data-analytics="GenericInput"\n        data-attr1="<%- field.slug %>" data-attr2="downloadbtn">\n          <i class="icon--single icon-download"></i> Download\n      </a>\n      <% if (field.preview) { %>\n        <a class="btn btn-small no-select preview\n          <% if (!field.value) { %>hide<% } %>"\n          data-href="<% if (field.value) {\n            %><%- field.value %><% } %>" class="preview-file"\n          data-action="<%- field.preview %>"\n          data-analytics="GenericInput" data-attr1="<%- field.slug %>"\n          data-attr2="previewbtn">\n            <i class="icon--single icon-eye"></i> Preview\n        </a>\n      <% } %>\n      <a class="btn btn-small no-select remove\n        <% if (!field.value) { %>hide<% } %>"\n        data-slug="<%- field.slug %>" data-analytics="GenericInput"\n        data-attr1="<%- field.slug %>" data-attr2="removebtn">\n          <i class="icon--single icon-trash"></i> Remove\n      </a>\n      <a class="btn btn-small no-select upload"\n        data-analytics="GenericInput" data-attr1="<%- field.slug %>"\n        data-attr2="uploadbtn">\n        <i class="icon--single icon-upload"></i> Upload\n      </a>\n      <input class="hide" type="file" id="<%- field.slug %>">\n      <img class="input-v2-upload-loader-image hide"\n        src="<%- asset_path(\'ajax-view-loader.gif\') %>">\n      <i class="icon--single icon-ok-circled\n        input-v2-upload-state-icon-font hide"></i>\n      <i class="icon--single icon-minus-circled\n        input-v2-upload-state-icon-font hide"\n        style="color: red;"></i>\n      <div class="sub-help input-v2-upload-error"></div>\n    </div>\n  </div>\n</div>',events.upload={},events.upload.bootstrap=function(_this){return function(){var persist_options,reset_view;return _this.$(".preview").click(function(e){var data_href,dialog_options;return"gdocs"===$(e.currentTarget).attr("data-action")?(data_href=encodeURIComponent($(e.currentTarget).attr("data-href")),dialog_options={title:_this.field.label,body:"<iframe src='https://docs.google.com/viewer?"+("url="+data_href+"&embedded=true' width='600' ")+"height='780' style='border: none;'></iframe>",width:600,nopadding:!0},new HR.util.ShowDialog(dialog_options,{}).render()):void 0}),reset_view=function(){return _this.$(".input-v2-upload-loader-image").addClass("hide"),_this.$(".icon-minus-circled").addClass("hide"),_this.$(".icon-ok-circled").addClass("hide"),_this.$(".input-v2-upload-error").html("").hide(),_this.timer?clearTimeout(_this.timer):void 0},persist_options={},persist_options.success=function(data){return data&&data.model&&data.model.errors&&(data.model.errors[_this.field.slug]||data.model.errors[_this.field.slug_out])?void persist_options.error(data.model.errors[_this.field.slug]||data.model.errors[_this.field.slug_out]):(_this.$(".input-v2-upload-loader-image").addClass("hide"),_this.$(".icon-ok-circled").removeClass("hide"),_this.timer=setTimeout(function(){return _this.$(".icon-ok-circled").addClass("hide")},1500),data.model[_this.field.slug_out]?(_this.$(".upload").removeAttr("disabled"),_this.$(".download").attr("href",data.model[_this.field.slug_out]).show(),_this.$(".preview").attr("data-href",data.model[_this.field.slug_out]).show(),_this.$(".remove").show()):(_this.$(".remove").removeAttr("disabled"),_this.$(".download").removeAttr("href").hide(),_this.$(".preview").removeAttr("data-href").hide(),_this.$(".remove").hide()))},persist_options.error=function(err_msg){return _this.$(".input-v2-upload-loader-image").addClass("hide"),_this.$(".icon-minus-circled").removeClass("hide"),_this.$(".upload").removeAttr("disabled"),_this.$(".input-v2-upload-error").html(_.escape(err_msg)||"Error Occured! Please try again!").show()},_this.$(".remove").click(function(e){return"disabled"!==_this.$(".remove").attr("disabled")?(_this.$(".remove").attr("disabled","disabled"),reset_view(),_this.field.disable_autosave?void 0:(_this.$(".input-v2-upload-loader-image").removeClass("hide"),_this.field.model.persist(_this.field.slug_out,null,persist_options))):void 0}),_this.$(".upload").click(function(e){return _this.$("input#"+_this.field.slug).click()}),_this.$("input#"+_this.field.slug).change(function(e){var form_data,that;if("disabled"!==_this.$(".upload").attr("disabled"))return _this.$(".upload").attr("disabled","disabled"),e.currentTarget.files[0]?(reset_view(),form_data=new FormData,form_data.append(_this.field.slug,e.currentTarget.files[0]),_this.field.disable_autosave||(_this.$(".input-v2-upload-loader-image").removeClass("hide"),_this.field.model.persist(form_data,$.extend(persist_options,{slug_out:_this.field.slug_out}))),that=_this):void _this.$(".upload").removeAttr("disabled")})}}(this),templates.mkdToolBar="<div class='mkd-container'>\n  <div class='mkd-button-bar'>\n    <ul class='row'>\n      <li class='span1 inactive' title=\"Strong <strong>\">\n       <span id='bold'></span>\n      </li>\n      <li class='span1 inactive' title=\"Emphasis <em>\">\n       <span id='italics'></span>\n      </li>\n      <li class='span1 inactive custom' title=\"Numbered List <om>\">\n        <span id='numberedList'></span>\n      </li>\n      <li class='span1 inactive custom' title=\"Bulleted List <um>\">\n        <span id='bulletedList'></span>\n      </li>\n      <li class='span1 inactive custom' title=\"Image <img>\">\n        <span id='image'></span>\n      </li>\n      <li class='span1 inactive custom' title=\"link\">\n        <span id='link'></span>\n      </li>\n      <li class='span1 inactive custom' title=\"code\">\n        <span id='code'></span>\n      </li>\n      <% if(field.showPreviewButton){ %>\n      <li class='span2 pull-right' style=\"padding-top: 4px;\" >\n        <button class=\"js-preview btn btn-small\">Preview</button>\n      </li>\n      <%}%>\n      <% if(field.helpText && field.helpText.trim() != ''){ %>\n      <span class=\"help-prompt msT pull-right\"><i class=\"icon-help-circled icon-single\"></i><span class=\"help-text\"><%= field.helpText %></span></span>\n      <%}%>\n    </ul>\n  </div>\n  <textarea style=\"display:none;\"></textarea>\n  <div class='loading-editor-msg text-center'>\n    <span>\n      Loading editor...\n    </span>\n  </div>\n</div",events.mkdToolBar={},events.mkdToolBar.bootstrap=function(_this){return function(){var initializeToolBar,that;return that=_this,that.preview=function(e){},that.getEditor=function(){},initializeToolBar=function(){var afterCm,parentView;if(null!=that.markdownHelper){if(null!=that.$el.find(".CodeMirror").get(0))return that.preview=function(e){return that.markdownHelper.preview(e)},that.getEditor=function(){return that.markdownHelper.editor},void $(that.el).find(".loading-editor-msg").hide();$(that.el).html(_.template(templates[that.field.type])({field:that.field}))}return that.field.params.$textarea=that.$el.find("textarea").get(0),$(that.el).find(".loading-editor-msg").hide(),that.markdownHelper=new HR.util.MarkdownToolbarHelper(that.field.params),that.$el.find(".mkd-button-bar li span").click(function(e){return that.markdownHelper._apply(e)}),that.preview=function(e){return that.markdownHelper.preview(e)},that.getEditor=function(){return that.markdownHelper.editor},afterCm=that.field.params.afterCodemirrorLoadCallback,parentView=that.field.params.parentView,setTimeout(function(){return $(that.el).find(".js-preview").click(function(e){return that.markdownHelper.preview(e)}),$(that.el).find(".CodeMirror").click(function(){return that.markdownHelper.editor.focus()}),null!=afterCm&&afterCm.apply(parentView),that.getEditor().on("focus",function(){return that.$el.find(".CodeMirror-scroll").css("max-height","none")})},0)},HR.requires(["codemirror_basic","compound/markdownhelper"],function(){return initializeToolBar()})}}(this),(base=this.field).type||(base.type="text"),$(this.el).html(_.template(templates[this.field.type])({field:this.field})),events[this.field.type]&&events[this.field.type].bootstrap&&events[this.field.type].bootstrap(),this},GenericInputView.prototype.on_focus=function(){var that;return that=this,this.$(".comment-editor").removeClass("comment-editor-not-focused"),_.each([".expert-checkbox",".markdown-hint",".post-button-wrap"],function(el){return that.$(el).show()}),$(".forum-button-bar li").removeClass("inactive")},GenericInputView}(window.HR.GenericView),HR=null!=(ref=window.HR)?ref:{},HR.GenericInputView=GenericInputView})}.call(this);