/*! Copyright (c) Epic Systems Corporation 2012 - 2018 */
var WP=WP||{};void 0===WP.FdiUtils&&(WP.FdiUtils={}),WP.FdiUtils.handleFDILink=function WP$FdiUtils$handleFDILink(e){var t,i,n;t=$afe.jq(e.target),e.preventDefault(),(i=t.closest("[data-fdi-context]")).length>0&&(n=i.safeAttr("data-fdi-context"),WP.FdiUtils.ExecuteFDILink(n))},WP.FdiUtils.ExecuteFDILink=function WP$FdiUtils$ExecuteFDILink(e){var t,i,n,d,o,l,a,r,c;o="",""!==e&&(i=(t=JSON.parse(e)).fdi,n=t.csn,d=t.ord,l=t.DocumentID,a=t.eptId,r=t.orgId,c=t.overrideMode,delete t.fdi,delete t.csn,delete t.ord,delete t.DocumentID,delete t.eptId,delete t.orgId,delete t.overrideMode,o=WP.FdiUtils.buildFDILinkParamString(i,n,d,t,l,a,r,c)),getCSRFTokenAsQS((function(e){$.ajax({url:makeLink("Extensibility/Redirection/FdiData"+o),type:"POST",dataType:"json",data:e,success:function(e){WP.FdiUtils.fdiJSONSuccess(e,o)}})}))},WP.FdiUtils.fdiJSONSuccess=function WP$FdiUtils$fdiJSONSuccess(e,t){var i,n,d,o;switch(i=e.url,n=e.launchmode,o=e.IsFdiPost,4===n&&(i=makeLink(i)),o&&(i=makeLink("Extensibility/Redirection/FdiRedirection"+t)),n){case 1:case 4:window.location.href=i;break;default:null!=(d=openWindow(i,"","",null,!0,!1,!0))&&void 0!==d||WP.DOM.Browser.isIE||WP.DOM.Browser.isLegacyEdge||WP.FdiUtils.PopupBlocked(i)}},WP.FdiUtils.PopupBlocked=function WP$FdiUtils$PopupBlocked(e){var t;$$WP.Strings.setDefaultNamespace("Global"),(t=new $$WPComp.MessageComponent({TitleText:$$WP.Strings.get("BlockedPopupTitle"),Message:$$WP.Strings.get("BlockedPopupMessageWithLink"),ToolbarButtons:[new $$WPComp.ComplexObjects.Button($$WP.Strings.get("BlockedPopupLaunchBtnTitle"),null,"completeworkflow","LaunchLink"),new $$WPComp.ComplexObjects.Button($$WP.Strings.get("BlockedPopupCancelBtnTitle"),null,"cancelworkflow","")],IsCloseable:!0})).addEventListener("click",$.proxy(this.LaunchClickHandler,this,e)),$$WPUtil.quickPopup(t)},WP.FdiUtils.LaunchClickHandler=function WP$FdiTuils$LaunchClickHandler(e,t){t&&t.dataId&&"toolbarLaunchLink"===t.dataId&&openWindow(e,"","",null,!0,!1,!0)},WP.FdiUtils.buildFDILinkParamString=function WP$FdiUtils$buildFDILinkParamString(e,t,i,n,d,o,l,a){var r;return r="",e?(r=$$WPUtil.addUrlParameter(r,"fdi",encodeURIComponent(e)),t&&(r=$$WPUtil.addUrlParameter(r,"csn",encodeURIComponent(t))),i&&(r=$$WPUtil.addUrlParameter(r,"ord",encodeURIComponent(i))),$.isEmptyObject(n)||(r=$$WPUtil.addUrlParameter(r,"extra",encodeURIComponent(JSON.stringify(n)))),d&&(r=$$WPUtil.addUrlParameter(r,"DocumentID",encodeURIComponent(d))),o&&(r=$$WPUtil.addUrlParameter(r,"eptID",encodeURIComponent(o))),l&&(r=$$WPUtil.addUrlParameter(r,"orgID",encodeURIComponent(l))),a&&(r=$$WPUtil.addUrlParameter(r,"overrideMode",encodeURIComponent(a))),r):""};