function formatLocation(n,t){var i="";return n&&n.trim().length>0&&t&&t.trim().length>0?i=n+", "+t:n&&n.trim().length>0?i=n:t&&t.trim().length>0&&(i=t),i}function formatNumber(n,t){var i=$.extend({thousandSeparator:",",decimalSeparator:"."},t),r=function(n){n+="";for(var r=n.split(i.decimalSeparator),t=r[0],f=r.length>1?i.decimalSeparator+r[1]:"",u=/(\d+)(\d{3})/;u.test(t);)t=t.replace(u,"$1"+i.thousandSeparator+"$2");return t+f};return r(n)}var Loop=window.Loop||{};Loop.viewModels=Loop.viewModels||{};Loop.viewModels.Brick=function(n){function y(n){Array.isArray(n)?n.length===0?t(Loop.Enum.BrickDataStatus.LoadedWithoutContent):t(Loop.Enum.BrickDataStatus.LoadedWithContent):n?t(Loop.Enum.BrickDataStatus.LoadedWithContent):t(Loop.Enum.BrickDataStatus.LoadedWithoutContent)}function p(n,r,u,f,e){return e=e!==undefined?e:!0,i(""),v.loadStatus={url:n.url(),callback:r},Loop.Core.Ajax.loadData({endpoint:n,successCallback:function(n){typeof r=="function"&&r(n)},errorCallback:function(n,r){e&&t(Loop.Enum.BrickDataStatus.LoadedWithErrors);i(r);typeof u=="function"&&u(n,r)},preventModalOnError:!1,timeout:f,withCredentials:n?n.withCredentials:!1})}function w(n,i,r,u){Loop.Core.Ajax.deleteData({endpoint:n,inputData:i,successCallback:function(n){typeof r=="function"&&r(n)},errorCallback:function(n,i){typeof u=="function"&&(t(Loop.Enum.BrickDataStatus.LoadedWithErrors),u(n,i))},withCredentials:n?n.withCredentials:!1})}function b(n,r,u,f,e){Loop.Core.Ajax.createData({endpoint:n,inputData:r,successCallback:function(n){typeof u=="function"&&u(n)},errorCallback:function(n,r){t(Loop.Enum.BrickDataStatus.LoadedWithErrors);e!==!0&&i(r);typeof f=="function"&&f(n,r)},withCredentials:n?n.withCredentials:!1})}function k(n,r,u,f,e){Loop.Core.Ajax.updateData({endpoint:n,inputData:r,successCallback:function(n){typeof u=="function"&&u(n)},errorCallback:function(n,r){t(Loop.Enum.BrickDataStatus.LoadedWithErrors);e!==!0&&i(r);typeof f=="function"&&f(n,r)},withCredentials:n?n.withCredentials:!1})}var t=ko.observable(Loop.Enum.BrickDataStatus.NotInitialized),f=ko.observable(Loop.Enum.BrickDataStatus.NotInitialized),e=ko.observable(Loop.Enum.BrickDataStatus.NotInitialized),u=Loop.Configuration.profile.ProfileUserId,o=Loop.Configuration.LoggedUserId,r=ko.observable(!1),i=ko.observable(),s=ko.observable(!1),h=ko.observable(!1),c=ko.observable(),l=ko.observable(!1),a=ko.observable(!0),v=this;return n=n||"brick-generic",t.subscribe(function(n){f(n)},this,"beforeChange"),u===o&&u!==undefined&&r(!0),{updateStatusByContent:y,loadData:p,updateData:k,createData:b,deleteData:w,userID:u,ownProfile:r,status:t,previousStatus:f,isDataLoaded:ko.computed(function(){return!(t()===Loop.Enum.BrickDataStatus.NotInitialized||t()===Loop.Enum.BrickDataStatus.Loading)},this),hasContent:ko.computed(function(){return t()===Loop.Enum.BrickDataStatus.LoadedWithContent},this),noContent:ko.computed(function(){return t()===Loop.Enum.BrickDataStatus.LoadedWithoutContent},this),noContentOwnProfile:ko.computed(function(){return t()===Loop.Enum.BrickDataStatus.LoadedWithoutContent&&r()},this),noContentOtherProfile:ko.computed(function(){return t()===Loop.Enum.BrickDataStatus.LoadedWithoutContent&&!r()},this),errorMessage:i,isVisible:s,isDisabled:h,bodyTemplate:c,showNoContentOtherProfile:!0,showErrorMessages:!0,isInSideBar:l,disableOnEdit:a,elementId:n,dataTestId:n,brickLoadedCallback:undefined,brickVisibleStatus:e,allowEmptyCase:!0}};Loop=window.Loop||{};Loop.viewModels=Loop.viewModels||{};Loop.viewModels.BrickConfig=function(n){var t=this;return t.viewModel=n.viewModel,t.alternative=n.alternative,t.templateId=n.templateId,t.templateName=n.templateName,t.sizes=n.sizes,t.id=n.id||"",t.dataTestId=n.dataTestId,t.initParams=n.initParams,t.hideDOM=n.hideDOM||!1,t.initCalled=!1,n.dataTestId||(t.dataTestId=t.templateId),t.templateId=t.templateId+"_"+Math.floor((Math.random()+1)*1e4),t};Loop=window.Loop||{};Loop.viewModels=Loop.viewModels||{};Loop.viewModels.BrickDispatcher=function(){function u(n){var t=null;if(n.rowsLayout&&n.columnsLayout){t=new Error("rowsLayout and columnsLayout cannot be present together to be able to render bricks");t.name="brickDispatcherError:mixedLayouts";throw t;}if(!n.rowsLayout&&!n.columnsLayout){t=new Error("rowsLayout or columnsLayout must be present to be able to render bricks");t.name="brickDispatcherError:layoutNotPresent";throw t;}}function r(n){var t=[];return n.xs&&t.push("col-xs-"+n.xs),n.sm&&t.push("col-sm-"+n.sm),n.md&&t.push("col-md-"+n.md),n.lg&&t.push("col-lg-"+n.lg),t.join(" ").trim()}function f(n){var t="#back-burner > #"+n.templateId;return n.hideDOM&&$(t).length>0}function e(n,t,i){var u="",f=[],e="";n.sizes&&f.push(r(n.sizes));f.length>0&&(e="class='"+f.join(" ")+"'");u="<div "+e+' id="'+n.templateId+'" data-bind="template: { name: \''+n.templateName+"', data: viewModel";t&&n.viewModel.reloadAfterRender?u=u+", afterRender:function(element,data){data.reloadAfterRender(element,data)}":!t&&n.viewModel.afterRender&&(u=u+", afterRender:function(element,data){data.afterRender(element,data)}");u=u+' }" data-test-id="'+n.dataTestId+'"><\/div>';$("#"+i).append(u)}function t(n,i,r){var u,o,s=!1;n.viewModel.templateId=n.templateId;s=f(n);n.dispatcherAlreadyLoaded||(n.dispatcherAlreadyLoaded=!1);s?$("#"+n.templateId).appendTo("#"+r):e(n,n.dispatcherAlreadyLoaded,r);n.alternative&&(t(n.alternative,!1,r),n.viewModel.brick.statusSubscription||(n.viewModel.brick.statusSubscription=n.viewModel.brick.status.subscribe(function(t){t===Loop.Enum.BrickDataStatus.NotAvailable&&(n.alternative.viewModel.init(n.alternative.initParams),n.alternative.initCalled=!0)})));u=n.viewModel.brick.status();o=n.viewModel.brick.previousStatus();u!==Loop.Enum.BrickDataStatus.NotAvailable&&o!==Loop.Enum.BrickDataStatus.RunningInBackground&&(u===Loop.Enum.BrickDataStatus.Hidden?(n.viewModel.reload&&n.viewModel.reload(n.initParams),n.viewModel.brick.status(o)):u===Loop.Enum.BrickDataStatus.ReadyToReload?n.viewModel.reload&&n.viewModel.reload(n.initParams):u!==Loop.Enum.BrickDataStatus.RunningInBackground&&(n.initCalled||(n.viewModel.init(n.initParams),n.initCalled=!0)));s?n.dispatcherAlreadyLoaded&&n.viewModel.reloadAfterRender&&n.viewModel.reloadAfterRender():ko.applyBindings(n,document.getElementById(n.templateId));n.dispatcherAlreadyLoaded=!0}function i(n){n.viewModel.brick.status()!==Loop.Enum.BrickDataStatus.NotAvailable&&n.viewModel.brick.status()!==Loop.Enum.BrickDataStatus.NotInitialized&&n.viewModel.brick.status(Loop.Enum.BrickDataStatus.Hidden);n.hideDOM?$("#"+n.templateId).appendTo("#back-burner"):$("#"+n.templateId).remove();n.alternative&&i(n.alternative);n.viewModel.onHideBrick&&n.viewModel.onHideBrick()}var n=this;n.loadConfiguration=function(t){n.bricksConfig=t};n.loadAllBricks=function(){$("#tab-pane").html("");n.bricksConfig.forEach(function(n,i){if(u(n),n.columnsLayout){var f="divPlaceHolderRowColumn_"+i;$("#tab-pane").append("<div class='row' id='"+f+"'><\/div>");n.columnsLayout.forEach(function(n,u){var e="divPlaceHolderColumn_"+i+"_"+u,o=r(n.columnSizes);$("#"+f).append("<div id='"+e+"' class='"+o+"'><\/div>");n.bricks.forEach(function(n){t(n,!0,e)})})}else n.rowsLayout&&n.rowsLayout.forEach(function(n,r){var u="divPlaceHolderRow_"+i+"_"+r;$("#tab-pane").append("<div id='"+u+"' class='row'><\/div>");n.bricks.forEach(function(n){if(n.sizes)t(n,!0,u);else throw"[brickDispatcher] brick config must include sizes object to be rendered in a row layout";})})});n.alreadyLoaded=!0};n.hideAllBricks=function(){n.bricksConfig.forEach(function(n){n.columnsLayout?n.columnsLayout.forEach(function(n){n.bricks.forEach(function(n){i(n)})}):n.rowsLayout&&n.rowsLayout.forEach(function(n){n.bricks.forEach(function(n){i(n)})})})};n.alreadyLoaded=!1};Loop=window.Loop||{};Loop.Models=Loop.Models||{};Loop.Models.PeriodDate=function(n,t){function r(){i.date="";i.month="";i.year=""}var i=this;i.date=null;i.month=null;i.year=null;i.format=t;i.setDate=function(n){if(i.isValidDate(n))if(i.format!==Loop.Helpers.PeriodDateHelper.Empty){r();var t=new Date(Date.parse(n));i.format===Loop.Helpers.PeriodDateHelper.DateMonthYear?(i.date=t.getDate(),i.month=t.getMonth()+1,i.year=t.getFullYear()):i.format===Loop.Helpers.PeriodDateHelper.MonthYear?(i.month=t.getMonth()+1,i.year=t.getFullYear()):i.format===Loop.Helpers.PeriodDateHelper.Year&&(i.year=t.getFullYear())}else r();else i.format=Loop.Helpers.PeriodDateHelper.Empty,r()};i.isValidDate=function(n){var t=!1;return isNaN(Date.parse(n))||(t=new Date(n).getFullYear()!==1),t};i.getPeriodDateAsString=function(){var n=Loop.Helpers.PeriodDateHelper.GetAsPeriod(i.date,i.month,i.year);return moment(n.Date).format("YYYY/MM/DD")};r();i.setDate(n)};Loop=window.Loop||{};Loop.viewControls=Loop.viewControls||{};Loop.viewControls.EditForm=function(n,t,i,r,u,f){function y(n){e.dataBackup=jQuery.extend(!0,{},ko.toJS(n))}function p(n,t){o=t;e.dataItem=n;e.dataIndex=parseInt(o.attr("data-index"),10);e.divID=e.getEditItemDivID();var i=$('<div id="'+e.divID+'">'+l+"<\/div>");i.appendTo(t);typeof u=="function"&&u();e.dataItem&&e.dataItem.isEditing(!1);ko.applyBindings(e,$("#"+e.divID)[0]);e.dataItem&&e.dataItem.isEditing(!0)}function w(){return e.dataItem.IsNew?$("#"+v).attr("id"):o.attr("id")}function a(){o=null;e.dataItem=null;e.dataBackup=null;e.dataIndex=-1;e.resetButtons();s=null;c=null}var e=this,l=null,o=null,v=null,s=null,c=null,h=null;e.dataBackup=null;e.divID=null;n&&(l=$("#"+n).html());e.setDataItem=function(n,t,i){n&&t&&(Loop.Common.DeactivateAllIcons(t.attr("id"),n),y(n),p(n,t));h=i};e.saveItem=function(n,i){h=null;s=$(i.target);s.prop("disabled",!0);typeof t=="function"&&t(n.dataItem,n.dataIndex)};e.cancelEdition=function(){h=null;typeof i=="function"&&i(e.dataBackup,e.dataIndex);e.disposeForm()};e.disposeForm=function(){var n;typeof r=="function"&&r();Loop.Common.ActivateAllIcons();o&&(n=w());a()};e.getEditItemDivID=function(){return o?o.attr("id")+"_EM":null};e.deleteItem=function(n,t){h=null;c=$(t.target);c.prop("disabled",!0);typeof f=="function"&&f(n.dataItem,n.dataIndex)};e.resetButtons=function(n,t){n=n||!1;s&&(s.text("Save"),n&&s.removeAttr("disabled"));c&&n&&c.removeAttr("disabled");t&&(h=t)};e.trackingData=function(){return{actionReferral:h}};a()};Loop=window.Loop||{};Loop.Helpers=Loop.Helpers||{};Loop.Helpers.PeriodDateHelper=function(){};Loop.Helpers.PeriodDateHelper.DateMonthYear=0;Loop.Helpers.PeriodDateHelper.MonthYear=1;Loop.Helpers.PeriodDateHelper.Year=2;Loop.Helpers.PeriodDateHelper.Empty=3;Loop.Helpers.PeriodDateHelper.FormatDate=function(n,t){var i;switch(t){case Loop.Helpers.PeriodDateHelper.Empty:i="";break;case Loop.Helpers.PeriodDateHelper.DateMonthYear:i=moment(n).format("D MMM YYYY");break;case Loop.Helpers.PeriodDateHelper.MonthYear:i=moment(n).format("MMM YYYY");break;case Loop.Helpers.PeriodDateHelper.Year:i=moment(n).format("YYYY");break;default:i=moment(n).format("MMM YYYY")}return i};Loop.Helpers.PeriodDateHelper.isValidNumber=function(n){return!isNaN(n)&&n!==null&&n!==undefined&&n!==""};Loop.Helpers.PeriodDateHelper.GetAsPeriod=function(n,t,i){var u=Loop.Helpers.PeriodDateHelper.isValidNumber(n),f=Loop.Helpers.PeriodDateHelper.isValidNumber(t),e=Loop.Helpers.PeriodDateHelper.isValidNumber(i),r=Loop.Helpers.PeriodDateHelper.DateMonthYear;if(u||(n=1),f||(t=1),!e)throw new Error("Invalid year");if(moment(n+"-"+t+"-"+i,"DD-MM-YYYY").isValid())return u||(r=Loop.Helpers.PeriodDateHelper.MonthYear),f||(r=Loop.Helpers.PeriodDateHelper.Year),{Date:new Date(Date.parse(i+"/"+t+"/"+n)),Format:r};r=Loop.Helpers.PeriodDateHelper.Empty;throw new Error('Invalid inputs to create a date object. Inputs: "'+n+"-"+t+"-"+i+'"');};Loop.Helpers.PeriodDateHelper.IsValidYear=function(n){var t=!1;return Loop.Helpers.PeriodDateHelper.isValidNumber(n)&&(t=!0),t};Loop=window.Loop||{};Loop.Helpers=Loop.Helpers||{};Loop.Helpers.SelectDate=function(n){function i(){var n=Loop.Helpers.PeriodDateHelper.Empty;t.Year()>0&&(n=t.Month()>0?t.Day()>0?Loop.Helpers.PeriodDateHelper.DateMonthYear:Loop.Helpers.PeriodDateHelper.MonthYear:Loop.Helpers.PeriodDateHelper.Year);t.Format(n)}function r(){var n=t.Day()!==undefined?t.Day():1,i=t.Month()!==undefined?t.Month()-1:0,r=t.Year()!==undefined?t.Year():1970;isNaN(n)&&(n=undefined);t.Date(new Date(r,i,n));t.Month()===undefined||t.Date().getMonth()===undefined||isNaN(t.Date().getMonth())||t.Date().getMonth()===t.Month()-1||t.Day(undefined)}function u(n){if(n!==undefined){t.Date(new Date(n.Date));switch(n.Format){case Loop.Helpers.PeriodDateHelper.Year:t.Year(t.Date().getFullYear());break;case Loop.Helpers.PeriodDateHelper.MonthYear:t.Month(t.Date().getMonth()+1);t.Year(t.Date().getFullYear());break;case Loop.Helpers.PeriodDateHelper.DateMonthYear:t.Day(t.Date().getDate());t.Month(t.Date().getMonth()+1);t.Year(t.Date().getFullYear())}t.Format(n.Format);t.updateDate()}else t.Format(Loop.Helpers.PeriodDateHelper.Empty),t.updateDate()}function f(){var r=t.dateErrorCode().errorCode,n=0,i=!1;return t.Date()>new Date?n=Loop.Enum.SelectDateErrors.DateInFuture:t.Day()===undefined&&t.Month()===undefined&&t.Year()===undefined?n=0:t.Day()!==undefined&&t.Month()===undefined&&t.Year()!==undefined?n=Loop.Enum.SelectDateErrors.MonthNotSet:t.Day()===undefined&&isNaN(t.Day())||t.Month()!==undefined||t.Year()!==undefined?t.Day()===undefined&&t.Month()!==undefined&&t.Year()===undefined?n=Loop.Enum.SelectDateErrors.SetYear:t.Day()!==undefined&&t.Month()!==undefined&&t.Year()===undefined&&(n=Loop.Enum.SelectDateErrors.SetYear):n=Loop.Enum.SelectDateErrors.SetMonthAndYear,r!==n.errorCode&&(t.dateErrorCode(n),t.dateErrorCode.valueHasMutated()),t.dateErrorCode()===0&&(i=!0),i}var t=this;t.Date=ko.observable();t.Day=ko.observable();t.Month=ko.observable();t.Year=ko.observable();t.Format=ko.observable();t.updateDate=function(){t.getDays();i();r();f()};t.getDays=function(){var r=t.Day(),i=new Date(t.Year(),t.Month(),0).getDate(),n,u=[];if(isNaN(i))for(n=1;n<=31;n+=1)u.push(n);else for(n=1;n<=i;n+=1)u.push(n);return r===undefined?t.Day(undefined):r<=i||isNaN(i)?t.Day(r):t.Day(i),u};t.getMonths=function(){for(var t=[],n=1;n<13;n+=1)t.push(n);return t};t.getYears=function(){for(var t=[],n=(new Date).getFullYear();n>(new Date).getFullYear()-100;n=n-1)t.push(n);return t};t.getDayName=function(n){return n.length<2&&(n="0"+n),n};t.getMonthName=function(n){return["January","February","March","April","May","June","July","August","September","October","November","December"][n-1]};t.dateErrorCode=ko.observable("");u(n)};Loop=window.Loop||{};Loop.helpers=Loop.helpers||{};Loop.helpers.UserProfileViewModelHelper=function(){return{getLocation:function(n,t){return t===undefined||t.trim()===""?n!==undefined&&n.trim()!==""?n:"":[t,n].join(", ")},getFullName:function(n,t,i){return n===undefined&&(n=""),t===undefined&&(t=""),i===undefined&&(i=""),[n,t,i].join(" ")}}}();Loop=Loop||{};Loop.Helpers=Loop.Helpers||{};Loop.Helpers.SanitizePublications=function(n,t){function r(n,t){n.formattedPublicationDate=moment(t).format("DD MMM YYYY");n.formattedPublicationDate==="Invalid date"&&(n.formattedPublicationDate="")}function i(n,t,i){return typeof t=="object"?t[i]:n}$.each(n,function(n,u){u.Title||(u.Title="");u.Authors===undefined&&(u.Authors=[]);u.AuthorList=new Loop.Core.Authors.AuthorList({authorList:u.Authors,enableLinks:typeof t=="boolean"?t:!0,extendDataOnDialog:!1});u.JournalId=i(u.JournalId,u.Journal,"JournalId");u.JournalShortName=i(u.JournalShortName,u.Journal,"JournalShortName");u.Source=i(u.Source,u.Journal,"Source");u.TotalViews=i(u.TotalViews,u.Impact,"TotalViews");u.JournalShortName===undefined&&(u.JournalShortName="");u.Source===undefined&&(u.Source="",u.Journal&&u.Journal.Name&&(u.Source=u.Journal.Name));u.DisplayPublicationSource=u.ArticleId!==0?u.JournalId?u.Source.length>0?u.Source:u.JournalShortName:u.Source!==""?u.Source:u.JournalShortName:u.Source;u.Doi===undefined&&(u.Doi="");u.DoiLink=u.Doi;u.formattedPublicationDate="";u.PublicationDate!==undefined&&u.PublicationDate!==null?r(u,u.PublicationDate):u.Date!==undefined&&u.Date!==null&&r(u,u.Date);u.TotalViews===undefined&&(u.TotalViews="0")})};Loop=window.Loop||{};Loop.constants=Loop.constants||{};Loop.constants.Events={FOLLOWING_FOLLOWER_VISIBILITY_CHANGED:"followingFollowersVisibilityChanged",USER_FOLLOW_STATE_CHANGED:"userFollowStateChanged",MODAL_DIALOG_DESTROY:"destroyDialog",PUBLICATIONS_COUNT_CHANGED:"publicationsCountChanged",ACTIVATE_ALL:"activateAll",DEACTIVATE_ALL:"deactivateAll",PYMK_VISIBILITY_CHANGED:"pymkVisibilityChanged",AUTHORING_NAMES_CHANGED:"authoringNamesChanged",BRIEF_BIO_MODIFIED:"briefBioModified",PROFILE_PICTURE_UPDATED:"profilePictureUpdated",PUBLICATION_CONFIRMED:"publicationConfirmed",PUBLICATION_REJECTED:"publicationRejected",PUBLICATIONS_UPDATED:"publicationsUpdated",EDIT_MODE_ACTIVATED:"editModeActivated",EDIT_MODE_DEACTIVATED:"editModeDeactivated",PYMK_USER_DISMISSED:"pymkUserDismissed",SOCIAL_BUTTON_SAVING:"socialButtonSaving",IMPACT_PUBLICATIONS_FOUND:"impactPublicationsFound",IMPACT_PUBLICATIONS_NOT_FOUND:"impactPublicationsNotFound",SPA_KO_BINDING_DONE:"SpaKoBindingDone",UPDATE_SUGGESTED_PUBLICATIONS:"updateSuggestedPublications",CONVERSATION_CREATED:"ConversationCreated",CONVERSATION_CLOSED:"ConversationClosed",CONVERSATION_MINIMIZED:"ConversationMinimized",CONVERSATION_REQUESTED:"ConversationRequested",CONVERSATION_SELECTED:"ConversationSelected",CONVERSATION_OPENED:"ConversationOpened",CONVERSATION_MESSAGE_SENT:"MessageSent",COMPOSE_PANEL_REQUESTED:"ComposePanelRequested",CONVERSATION_DISCARDED:"ConversationDiscarded",CONVERSATION_COMPOSE:"ConversationCompose",CONVERSATION_COMPOSE_REQUESTED:"ConversationComposeRequested",CONVERSATION_CONTROL_STATUS_CHANGED:"ConversatinControlStatusChanged",EDIT_BRIEF_BIO:"EditBriefBioEditorEvent",CREATE_ORGANIZATION_INIT:"CreateOrganizationInit",CREATE_ORGANIZATION_FINISHED:"CreateOrganizationFinished",NAVIGATION_WHILE_SAVING:"NavigationWhileSavingHappened",PRIMARY_AFFILIATION_CHANGED:"PrimaryAffiliationChanged",AFFILIATION_ADDED:"NewAffiliationAdded",AFFILIATION_EDITED:"AffiliationEdited",AFFILIATION_DELETED:"AffilitionDeleted",HEADER_SECTION_UPDATED:"HeaderSectionUpdated",VIEW_ALL_AFFILIATIONS_CLICKED:"ViweAllAffiliationsClicked",SNACKBAR_MESSAGE:"SnackBarMessage"};Loop=window.Loop||{};Loop.constants=Loop.constants||{};Loop.constants.Delays={REFRESH_PUBLICATION_DELAY:2e3};Loop=window.Loop||{};Loop.constants=Loop.constants||{};Loop.constants.tracking=Loop.constants.tracking||{};Loop.constants.tracking.DataTrack={SAVE_PROFILE_UPDATE:"save-profile-update",CANCEL_PROFILE_UPDATE:"cancel-profile-update"};Loop.constants.tracking.ActionReferral={ADD:"add",EDIT:"edit",REMOVE:"remove"};Loop=window.Loop||{};Loop.controls=Loop.controls||{};Loop.controls.Menu=function(n,t){function r(n,t,r,u){var f=this,e=n;f.trackingData=function(){return{actionReferral:"cog-menu"}};f.getID=function(){return e};f.optionText=t;f.dataTrack=u!==undefined?u:null;f.optionClick=function(){typeof r=="function"&&r();i.menuVisible(!1)}}var i=this,u=n;i.getID=function(){return u};i.getButtonID=function(){return"btn-"+u};i.options=ko.observableArray(t&&t.hasOwnProperty("length")?t:[]);i.visible=ko.observable(!1);i.menuVisible=ko.observable(!1);i.addOption=function(n,t,u,f){var e=new r(n,t,u,f);i.options.push(e)};i.insertOptionAt=function(n,t,u,f,e){var o=new r(t,u,f,e);i.options.splice(n,0,o)};i.replaceOptionAt=function(n,t,u,f,e){var o=new r(t,u,f,e);i.options.splice(n,1,o)};i.removeOption=function(n){i.options.splice(n,1)};i.showMenu=function(){i.menuVisible(!0)};i.toggleMenu=function(){i.menuVisible(!i.menuVisible())};$(document).on("click",function(n){i.visible()&&($(n.target).closest("#"+i.getID()).length||i.menuVisible(!1))})};Loop=window.Loop||{};Loop.viewModels=Loop.viewModels||{};Loop.viewModels.partials=Loop.viewModels.partials||{};Loop.viewModels.partials.BriefBioEditor=function(n){function u(n){var r=n,i;return n&&(i=t.toMarkdown(n),i||t.setText(""),r=i),r}var i=new Loop.markdownControl.toMD,r=n,t=this;t.control=null;t.stylesheets=["/Content/v5/fonts/font.css","/Content/v5/css/rich-text-editor.css"];t.start=function(n,i){t.control?(t.control.enable(),typeof n=="function"&&n(),t.setText(i),t.resize()):(t.control=new wysihtml5.Editor(r,{toolbar:"toolbar",stylesheets:t.stylesheets,parserRules:Loop.markdownControl.parserRules,sync:!0,useLineBreaks:!1,cleanUp:!0,autoLink:!1}).on("load",function(){setTimeout(function(){$(t.control.composer.iframe).autoResize&&$(t.control.composer.iframe).autoResize();typeof n=="function"&&n()},1e3)}),t.setText(i),t.control.enable())};t.getHTMLFromEditor=function(){var n=t.control.getValue();return t.control.parse(n)};t.getMarkdownFromEditor=function(){return u(t.getHTMLFromEditor())};t.toMarkdown=function(n){return i.toMD(n)};t.resize=function(){var n=$(t.control.composer.iframe);n.trigger("resize")};t.disableControl=function(){t.control.disable()};t.setText=function(n){t.control.setValue(n)}};Loop=window.Loop||{};Loop.viewModels=Loop.viewModels||{};Loop.viewModels.partials=Loop.viewModels.partials||{};Loop.viewModels.partials.TagsCloud=function(n,t){function u(){var t=this.visibleTags(),n,r,u;for(t.length=0,n=0;n<this.tags().length;n=n+1)r={text:this.tags()[n].text,ellipsis:!1,hidden:!1,escapedText:s(this.tags()[n].text)},!this.expanded&&i!==-1&&n>=i&&(r.hidden=!0),!this.expanded&&i!==-1&&n===i&&this.tags().length>i&&(u={text:"",escapedText:"",ellipsis:!0,hidden:!1},t.push(u)),t.push(r);this.visibleTags.valueHasMutated();h.call(this);c.call(this)}function o(){u.call(this)}function s(n){return n.replace(/'/g,"___").replace(/</g,"___").replace(/>/g,"___")}function h(){var n=this,t="#"+this.identifier+" [data-test-id='tags-list']";$(t).on("click",".ellipsis",function(){n.expandAll.call(n)})}function c(){var n=this,i="#"+this.identifier+" [data-test-id='tags-list']",t;r||(r=$(i).on("click","#delete-tag",function(){var i=ko.contextFor(this);n.beforeDeleteTagClickedCallback&&n.beforeDeleteTagClickedCallback();n.deleteTagClickedCallback&&(t=function(){n.deleteTagClickedCallback.call(this)});i&&n.deleteTag(i.$data,t)}))}function l(n){var t=this;return t.validationOptions.allowEmptyTags?"":n.text?"":t.validationOptions.blankNewTagMessage}function a(n){var t=this;return t.validationOptions.maxTagSize<0?"":n.text.length>t.validationOptions.maxTagSize?t.validationOptions.xxlNewTagMessage:void 0}function v(n){var t=this,i;return t.validationOptions.allowDuplicatedTags?"":(i=t.tags().filter(function(n){var t=this;return n.text&&f(n.text,t.text)},n),i.length>0?t.validationOptions.existingTagMessage:void 0)}function y(n){var t=this,i;return t.validationOptions.invalidCharacters.length===0?"":(i=new RegExp("["+t.validationOptions.invalidCharacters.join("|")+"|]"),n.text.match(i)!==null?t.validationOptions.invalidCharactersMessage:void 0)}function f(n,t){return n&&t?n.trim().toLowerCase().replace(/\s{2,}/g," ")===t.trim().toLowerCase().replace(/\s{2,}/g," "):!1}function p(){var n=this,t;return n.validationOptions.allowEmptyTags?"":(t=n.tags().filter(function(n){if(n.text){if(!n.text.trim().toLowerCase().replace(/\s{2,}/g," "))return"blank"}else return"blank"}),t.length>0?n.validationOptions.blankTagsMessage:void 0)}function w(){var n=this,t;return n.validationOptions.maxTagSize<0?"":(t=n.tags().filter(function(t){if(t.text&&t.text.length>n.validationOptions.maxTagSize)return t}),t.length>0?n.validationOptions.xxlTagsMessage:void 0)}function b(){var i=this,n,r,t;if(i.validationOptions.allowDuplicatedTags)return"";for(n=i.tags().map(function(n){if(n.text)return n.text.trim().toLowerCase().replace(/\s{2,}/g," ")}),n.sort(),r=[],t=0;t<n.length-1;t++)n[t+1]===n[t]&&r.push(n[t]);if(r.length>0)return i.validationOptions.duplicatedTagsMessage}function k(){var n=this;return n.validationOptions.allowEmptyCloud?"":n.tags().length===0?n.validationOptions.emptyCloudMessage:void 0}this.tags=n.tags;this.isEditing=n.isEditing;this.identifier=n.identifier;this.deleteTagClickedCallback=n.deleteTagClickedCallback;this.beforeDeleteTagClickedCallback=n.beforeDeleteTagClickedCallback;this.ownProfile=n.ownProfile;this.visibleTags=ko.observableArray();this.expanded=!1;var i=n.collapsedTags||15,e={allowEmptyCloud:!1,maxTagSize:256,allowDuplicatedTags:!1,allowEmptyTags:!1,avoidTagTextValidation:!0,invalidCharacters:[],blankNewTagMessage:Loop.constants.UIMessages.tagsCloudBlankNewTag,xxlNewTagMessage:Loop.constants.UIMessages.tagsCloudXXLNewTag(256),existingTagMessage:Loop.constants.UIMessages.tagsCloudTagExistingTag,invalidCharactersMessage:Loop.constants.UIMessages.tagsCloudTagHasInvalidCharacters([]),emptyCloudMessage:Loop.constants.UIMessages.tagsCloudEmptyCloud,xxlTagsMessage:Loop.constants.UIMessages.tagsCloudXXLTags(256),blankTagsMessage:Loop.constants.UIMessages.tagsCloudBlankTags,duplicatedTagsMessage:Loop.constants.UIMessages.tagsCloudDuplicatedTags},r;this.validationOptions=$.extend({},e,t||{});this.tags.subscribe(o,this,"change");this.expandAll=function(){this.expanded=!0;var t="#"+this.identifier+" [data-test-id='tags-list'] li.item-hidden",n="#"+this.identifier+" [data-test-id='tags-list'] .ellipsis";$(n).length>0&&$(n).slideUp(200).animate({opacity:"0"},200,function(){$(this).addClass("item-hidden")});$(t).not(n).slideDown(500,"easeInExpo").animate({opacity:"1"},200,function(){$(this).removeClass("item-hidden")})};this.reRender=function(){var n="#"+this.identifier+" [data-test-id='tags-list']";r=$(n).unbind("click");r=undefined;u.call(this)};this.addTag=function(n){var i=this,t;if(n=n||{},n.text=n.text.trim().replace(/\s{2,}/g," ")||"",n.escapedText=n.text.replace(/'/g,"___"),t=i.runAddValidations(n),t)return t;i.tags.push(n)};this.deleteTag=function(n,t){var r=this,u=n.text||"",i="#"+this.identifier+" [data-keyword='"+n.escapedText+"']";$(i+" p").animate({opacity:"0"},200);$(i).animate({width:"toggle",padding:"toggle"},350,function(){r.tags.remove(function(t){return t.text&&n.text&&f(t.text,n.text)||!t.text});t&&t()})};this.isCloudValid=function(){var t=this,n;return n=t.runCloudValidations(),n?n:void 0};this.getTagsContent=function(){return this.tags().map(function(n){if(n.text)return n.text})};this.runAddValidations=function(n){var i=this,t;return(n=n||{},n.text=n.text.trim().replace(/\s{2,}/g," ")||"",t=l.call(i,n),t)?t:(t=a.call(i,n),t)?t:(t=v.call(i,n),t)?t:(this.validationOptions.avoidTagTextValidation||(t=y.call(i,n)),t?t:void 0)};this.runCloudValidations=function(){var t=this,n;return(n=p.call(t),n)?n:(n=w.call(t),n)?n:(n=b.call(t),n)?n:(n=k.call(t),n?n:void 0)}}