function log(n){var t=(new Date).getTime(),i=t-LastTimestamp;LastTimestamp=t;console.log(i+": "+n)}function fixConsole(n){typeof console=="undefined"&&(console={});typeof console.log=="undefined"&&(console.log=n?function(n){alert(n)}:function(){});typeof console.dir=="undefined"&&(console.dir=n?function(n){alert("DIR: "+n)}:function(){})}function readCookie(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i>>0,typeof n!="function")throw new TypeError(n+" is not a function");for(arguments.length>1&&(f=arguments[1]),r=new Array(u),t=0;t{stickyObserverFrame&&cancelAnimationFrame(stickyObserverFrame),stickyObserverFrame=requestAnimationFrame(()=>{stickyObserverFrame=null,positionBottomSticky()})});stickyObserver.observe(t);n.length&&stickyObserver.observe(n[0]);const r=t.children;for(let n of r)n.classList.contains("sticky-nav-bottom-section-container")||stickyObserver.observe(n);positionBottomSticky()}}function positionBottomSticky(){const t=$(".open-product"),n=$(".sticky-nav-bottom-section-container");if(t.length&&n.length&&!n.is(":empty")){const i=t[0],u=n.outerHeight(),f=i.scrollHeight-i.clientHeight>=1;if(f){n.removeClass("sticky-nav-static");return}const r=t.children().not(".sticky-nav-bottom-section-container").last();if(r.length>0){const t=i.getBoundingClientRect(),f=r[0].getBoundingClientRect(),e=t.bottom-u,o=f.bottom>e+1;n.toggleClass("sticky-nav-static",!o)}}}function splitAndTrim(n){for(var t=n.split(","),i=0;it?.control?.id==n),f&&(o=f.control,e=getParentGridId(o),e!=null&&(s="div.bpControl.grid-view#ctl"+e+" table.bpTable",r=$(s).DataTable(),r.rows({order:"current",search:"applied"}).every(function(t,i,u){var o=this.data(),s=Object.values(o).some(t=>t.id==n),f,e;if(s)return f=r.page.info().length,e=Math.floor(u/f),r.page(e).draw(!1),!1})))):focusedView.GoToControl(n);else{for(i=-1,t=0;t=quoteParameters.tabs[t].start&&n<=quoteParameters.tabs[t].end&&(i=t);i!=-1&&i!=CurrentTabIndex?$("#heading"+i).click():log("Control not found:"+n)}doScroll("#ctl"+n,0)}else log("Failed to scroll to control. Controls is outside the range of valid controls :"+n)}function doScroll(n,t){if(t<15)if($(n).length>0){$(n).parents(".panel-collapse").collapse("show");var r=CONFIG?.EnableHeader?160:100,i=$("#accordion"),u=i.scrollTop(),f=$(n).offset().top,e=u+f-r;i.stop().animate({scrollTop:e},{duration:2e3,easing:"swing",complete:function(){setElementFocus(n)}});highlightElement(n)}else t++,setTimeout(doScroll,1e3,n,t);else log("Failed to find control "+n+" in "+t)}function removeClass(n){$(n).removeClass("bp-has-error")}function highlightElement(n){$(n).addClass("bg-fade");$(n).addClass("bp-has-error");setTimeout(removeClass,2500,n)}function setElementFocus(n){var r=$(n).find("*").filter(function(){return isFocusable(this)}),i,t;if(r.length<=0){log(`Failed to find focusable child on element ${n}`);return}if(i=r.first(),t=tinyMCE.get(i.attr("id")),!t){i.focus();return}if(!t.initialized){t.on("init",function(){t.focus()});return}t.focus()}function isFocusable(n){return $(n).prop("disabled")!==!0&&$(n).prop("readonly")!==!0&&typeof n.focus=="function"&&n.tabIndex>=0}function removeKey(n,t){const i=n.indexOf(t);return i>-1&&n.splice(i,1),n}function deepEqual(n,t,i){if(typeof n!=typeof t)return!1;if(typeof n=="undefined")return!0;const u=Object.keys(n),f=Object.keys(t);typeof i=="undefined"&&(i=[]);for(var r=0;r0&&r.each(function(){var n=this.value;$(this).inputmask(u);$(this)[0].value=parseFloat(n);$(this).removeClass("changed")});$(i).length>0&&setTimeout(()=>ApplyCurrencyMasks(n),0)}function buildNumberMask(n){var o=quoteParameters.locale.replace("_","-"),s=`${o}|${n}`,i,f,c,e,r,h,u,t;if(maskCache.has(s))return maskCache.get(s);i={alias:"decimal",autoUnmask:!0,unmaskAsNumber:!0};try{f=new Intl.NumberFormat(o,{style:"decimal",minimumFractionDigits:n})}catch(l){log(l);f=new Intl.NumberFormat(o,{style:"decimal"})}c=f.resolvedOptions();i.digits=c.minimumFractionDigits;e="0";for(r=f.formatToParts("-99999.99"),h=!1,t=0;t0)for(i.digitsOptional=!1,e+=i.radixPoint,t=0;t0&&setTimeout(()=>ApplyNumberMasks(n),0)}function DrawStages(){var t,r,n,i,u,f,e,o;if(typeof quoteParameters.stages!="undefined")if(t=$("#xaitCPQ-single-page-container-fluid div.XaitCPQStages"),r=typeof quoteParameters.currentStage!="undefined",t.length!==1&&($("#xaitCPQ-single-page-container-fluid").prepend('
<\/div>'),$("#main").addClass("with-stages"),t=$("#xaitCPQ-single-page-container-fluid div.XaitCPQStages")),t.length===1)for(n=0;n<\/div>'),o=' {3}
{2} <\/div>
<\/div><\/span>'.format(n,f,quoteParameters.stages[n],e),$(t).append(o),u&&(r=!1));else log("Stage container not found.")}function doSliders(){}function isHtml(n){return/<[^>]*>/g.test(n)}function stringContainsClass(n,t,i=false,r=false){return n!=undefined?(n=n.replace(/,/g," "),classes=n.split(" "),i?classes.some(n=>n.startsWith(t)):r?classes.some(n=>t.includes(n)):classes.includes(t)):!1}function getClassStartingWith(n,t){if(n!=undefined){n=n.replace(/,/g," ");classes=n.split(" ");var i=classes.find(n=>n.startsWith(t));return i!=null?i:""}return""}function callCancel(){let n=Host+"/Cancel.aspx";log("Calling cancel: "+n);navigator.sendBeacon(n)}function storeFocusedControl(){let n=$(document.activeElement).closest(".bpControl");if(n.length>0){FocusedControlId=n.attr("id").substring(3);let r=document.activeElement.selectionStart,u=document.activeElement.selectionEnd;CursorLocationStart=r;CursorLocationEnd=u;let t=$(document.activeElement),i=t.attr("id");if(FocusedElementIndex=null,t.hasClass("value")){if(FocusedElementType="value",i){let n=i.match(/^value\d+-(\d+)$/);n&&(FocusedElementIndex=parseInt(n[1],10))}}else FocusedElementType=t.hasClass("selectable")?"selectable":t.hasClass("quantity")?"quantity":null}}function restoreFocus(){var r,n,f,i,u,t;if(FocusedControlId!=null){if($("#ctl"+FocusedControlId).closest(".section-modal").length>0){CursorLocationStart=null;CursorLocationEnd=null;FocusedControlId=null;FocusedElementType=null;return}if(r=$("#ctl"+FocusedControlId),n=null,FocusedElementType&&(FocusedElementIndex!==null&&(f="#"+FocusedElementType+FocusedControlId+"-"+FocusedElementIndex,n=$(f).filter(":visible")),!n||n.length===0))for(i=[],FocusedElementType==="value"?i=["input.value","textarea.value","select.value"]:FocusedElementType==="selectable"?i=["input.selectable"]:FocusedElementType==="quantity"&&(i=["input.quantity"]),t=0;t0)break;if(!n||n.length===0)for(u=["input.value, textarea.value, select.value","input.selectable","input.quantity"],t=0;t0)break;if(n&&n.length>0&&(n.focus(),CursorLocationStart!==null&&CursorLocationEnd!==null))try{n.is("input, textarea")&&typeof n[0].setSelectionRange=="function"&&n[0].setSelectionRange(CursorLocationStart,CursorLocationEnd)}catch(e){}CursorLocationStart=null;CursorLocationEnd=null;FocusedControlId=null;FocusedElementType=null;FocusedElementIndex=null}}function controlValuesMatchForUpdate(n,t){let i=!1;return n.type==="numberedit"?Number(t)===Number(n.value)&&(i=!0):t==n.value&&(i=!0),i}function getGlobals(){try{Globals=JSON.parse(localStorage.getItem("globals"))}catch(n){console.error("Error parsing globals from localStorage:",n)}return Globals}function updateGlobals(n){Globals=n;localStorage.setItem("globals",JSON.stringify(n))}function refreshTokenIfNeeded(){return getGlobals(),Promise.resolve()}function userIsLoggedOut(){$("#status-dialog").is(":visible")||(CONFIG.HideEmergencySaveButton?displayDialog("Session Expired","Your session has expired or you have been logged out. Please login again to continue.",!0,!1,!0,null,UserLoggedOutDisplayLogin,"","Login"):displayDialog("Session Expired","Your session has expired or you have been logged out. Please save or login again to continue.",!0,!0,!0,UserLoggedOutSave,UserLoggedOutDisplayLogin,"Save and Close","Login"))}function UserLoggedOutSave(n){n.preventDefault();EmergencySaveInProgress=!0;closePleaseWait();save()}function checkLoggedInStatus(){if(EmergencySaveInProgress||!CONFIG.CPQIntegratedSecurity||getGlobals()?.currentUser?.tokenExpires){$("#SessionIframe").remove();const n=CONFIG.DebugShowQMSIframe,t=addIframeToDOM("/session-handler",n);closePleaseWait()}else userIsLoggedOut(),setTimeout(checkLoggedInStatus,1e3)}function UserLoggedOutDisplayLogin(n){n.preventDefault();var i=CONFIG.CPQHost+"login?ReturnUrl=",t=window.open("/login?returnUrl=/close-after-login","_blank");t&&(t.focus(),t.onclose=function(){var n=getGlobals()?.currentUser?.tokenExpires;n?closePleaseWait():console.log("Login window closed without new token.")})}function addIframeToDOM(n,t){const i=document.createElement("iframe");return i.src=n,i.width="120",i.height="120",i.id="SessionIframe",i.style.border="none",t||(i.style.position="absolute",i.style.top="-9999px",i.style.left="-9999px"),document.body.appendChild(i),i}function debounce(n,t){let i;return function(...r){const u=this;clearTimeout(i);i=setTimeout(()=>{n.apply(u,r)},t)}}function restructureFlatTree(n){const t=new Map,i=[];for(const i of n)i.nodes=[],t.set(i.nodeId,i);for(const r of n)if(r.parentId&&t.has(r.parentId)){const n=t.get(r.parentId);n.nodes.push(r)}else i.push(r);for(const t of n)t.nodes.length>1&&t.nodes.sort((n,t)=>n.index-t.index);return i}function htmlEncode(n){var t=document.createElement("div");return t.appendChild(document.createTextNode(n)),t.innerHTML}function htmlDecode(n){if(typeof n!="string"||n.indexOf("&")===-1)return n;var t=document.createElement("textarea");return t.innerHTML=n,t.value}function getInitials(n){const t=n?.trim()?.split(/\s+/);if(t==null||t.length===0||t[0]==="")return"?";const i=t[0].charAt(0);if(t.length>1){const n=t[t.length-1].charAt(0);return(i+n).toUpperCase()}return i.toUpperCase()}function stripBraces(n){return n.replaceAll("{","").replaceAll("}","")}function pingError(n){n.statusText==="timeout"||n.statusText==="error"?(pingRetryTimeout=connectionLostPingRetryTimeout,TotalMissedPings++,MissedSeqPings++,log("Missed: "+MissedSeqPings),signalMissedPing(),MissedSeqPings===3&&displayFailedConnectionDialog()):log("Failed ping reason:"+n.statusText)}function pingSuccess(){pingRetryTimeout=defaultPingRetryTimeout;MissedSeqPings=0;SuccessfulPings++;closeFailedConnectionDialog();connectionLost&&connectionRestored()}function displayFailedConnectionDialog(){DisplayingDisconnectionMessage=!0;displayDialog("","You appear to be disconnected from the Internet. Please check your connection.",!1,!1,!1)}function closeFailedConnectionDialog(){DisplayingDisconnectionMessage&&(DialogWasAlreadyOpen?($("#progress p.messageText").text(LastMessageFromOpenDialog),DialogWasAlreadyOpen=!1,LastMessageFromOpenDialog=""):closePleaseWait(),DisplayingDisconnectionMessage=!1);$("#poorInternet").remove()}function signalMissedPing(){connectionLost=!0;$("#xaitCPQ-single-page-container-fluid").after("
Internet Connection Lost.<\/div>");$("#poorInternet").fadeOut(7e3,function(){$("#poorInternet").remove()})}function connectionRestored(){connectionLost=!1;$("#xaitCPQ-single-page-container-fluid").after("
Internet Connection Restored.<\/div>");$("#connectionRestored").fadeOut(7e3,function(){$("#connectionRestored").remove()})}function salesforceLogin(n,t,i,r,u,f,e,o,s,h,c){try{$("#bpGeneralParams").hide();displayPleaseWaitMessage("Please wait, logging in.");SetHostUrl();$.type(CONFIG.ShowLogo)==="boolean"&&CONFIG.ShowLogo?$("#logo").attr("src",Host+"/"+$("#logo").attr("src")):$("#logo").remove();$('link[rel=stylesheet][href$="extended.css"]').remove();returnUrlBackup=i;var l="/api/login.aspx";$.type(CONFIG.UseProxy)=="string"&&(l=CONFIG.UseProxy);SalesforceQuoteID=t;$.ajax({type:"GET",cache:!1,datatype:"json",url:Host+l,data:{ProductCode:n,QuoteId:t,ReturnUrl:i,ServerURL:r,SessionId:u,Mode:f,Action:o,Language:e,UpdateQuoteStructure:s,Approved:h,ActiveProduct:c,Template:ConfigObj.Template},error:ajaxQuoteError,success:loginResult,timeout:15e4})}catch(a){ErrorHandler.handleError(a,"salesforceLogin",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to login via Salesforce."})}}function StartXaitCPQ(n){try{n.SuccessCallback&&(SuccessCallback=n.SuccessCallback);n.CancelCallback&&(CancelCallback=n.CancelCallback);XaitStyleName=n.Style;XaitUserGroupGuid=n.UserGroup;clientDivId=n.DivId;$("#"+clientDivId).append(getIndexHtml);$("#"+clientDivId).css("position","relative");$("#bpGeneralParams").hide();$.type(CONFIG.ShowLogo)==="boolean"&&CONFIG.ShowLogo?$("#logo").attr("src",Host+"/"+$("#logo").attr("src")):$("#logo").remove();displayPleaseWaitMessage("Please wait, logging in.");Host=n.CPQAddress;returnUrlBackup=n.ReturnUrl;$.ajax({type:"GET",cache:!1,datatype:"json",url:Host+"/api/login.aspx",data:{ProductCode:n.ProductCode,Quote:n.QuoteId,ReturnUrl:n.ReturnUrl,Mode:n.Mode,Action:n.Action,Language:n.Language,UpdateQuoteStructure:n.UpdateQuoteStructure,PriceBand:n.PriceBand,Template:n.Template},error:ajaxQuoteError,success:loginResult,timeout:15e4})}catch(t){ErrorHandler.handleError(t,"StartXaitCPQ",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to start the configuration. Please refresh the page or contact support if this continues."})}}function getBranding(){$.ajax({type:"GET",cache:!1,datatype:"json",url:Host+"/api/getBranding.aspx",data:{Style:XaitStyleName,UserGroupGuid:XaitUserGroupGuid,Container:clientDivId},error:ajaxQuoteError,success:getBrandingResult,timeout:15e5})}function getBrandingResult(n){var t,i;n.CPQ!==""&&(t='<\/link>',$("head").append(t));n.Custom!==""&&(i='<\/link>',$("head").append(i))}function loginResult(n){n.Success?(SessionID=n.Session,Host=Host+"/(S("+SessionID+"))",closePleaseWait(),readyToGo()):displayErrorDialog("Error",n.ErrorMessage,!0,!0,!1)}function initialiseCurrentUser(){try{var n=ReadLocalStorage("globals");n&&(Globals=JSON.parse(n))}catch(t){console.log(t)}}function readyToGo(){var n,t;try{log("readyToGo called.");try{sessionStorage.clear()}catch(u){log("Session Storage unavailable.")}window.onMenuTreeReady=()=>{console.log("React Menu Tree is ready. Performing initial refresh."),window.refreshTree(),delete window.onMenuTreeReady};initialiseCurrentUser();SetHostUrl();getBranding();$.type(CONFIG.ShowLogo)==="boolean"&&CONFIG.ShowLogo?$("#logo").attr("src",Host+"/"+$("#logo").attr("src")):$("#logo").remove();CONFIG.EnableHeader||($("nav").css("display","none"),$("body").css("margin-top","0"),$("#xaitCPQ-single-page-container-fluid").css("margin-top","0"),$("#main").addClass("hidden-navbar"));CONFIG.CPQIntegratedSecurity||$("#main").addClass("hidden-coworking-ui");CONFIG.DisableConfiguratorSidePadding||($("body").css("padding-left","0"),$("body").css("padding-right","0"));fixConsole(!1);CONFIG.MainColumnWidth!==undefined?$("#main").addClass("col-md-"+CONFIG.MainColumnWidth):$("#main").addClass("col-md-12");CONFIG.MainColumnWidth!==undefined?$("#title").parent().addClass("col-md-"+CONFIG.MainColumnWidth):$("#title").parent().addClass("col-md-12");CONFIG.StartSideMenuCollapsed&&showNavigation(!1);jQuery.fn.reverse=[].reverse;SetupMainButtons();AddNextTab();AddSaveAndContinueButton();SetupImageButtons();AjaxSetup();iePolyfil();DisableUpdate=!1;ready=!1;try{InlineSave=!(CONFIG.InlineSave===undefined||CONFIG.InlineSave===!1)}catch(f){InlineSave=!1}displayPleaseWait();window.addEventListener("message",function(n){n.origin===window.location.origin&&(n.data==="refresh-failed"?(console.log("QMS failed to refresh the token."),userIsLoggedOut(),setTimeout(checkLoggedInStatus,1e3)):n.data==="refresh-success"&&console.log("QMS successfully refreshed the token."))});const i=CONFIG.DebugShowQMSIframe,r=addIframeToDOM("/session-handler",i);console.log("Iframe added:",r);requestSessionId();$('[data-toggle="tooltip"]').tooltip({container:"body",trigger:"manual"});n=ParseBool(ReadLocalStorage("hamburgerOpen"));n&&(n=JSON.parse(decodeURIComponent(n)),$('#floating-options [data-toggle="tooltip"]').tooltip("destroy"),t=$(".floating-button").parent(),t.hasClass("disabled")||(n===!0?(t.addClass("active"),setTimeout(function(){$('#floating-options [data-toggle="tooltip"]').tooltip()},500)):t.removeClass("active")))}catch(i){ErrorHandler.handleError(i,"readyToGo",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Failed to render configuration during startup."})}}function SetupLookupSelect(n,t,i,r){var u,h,s,c;try{var f=n.Values,o=n.Count,e=$("#lookupDialogValue.selectized");$(".lds-ellipsis").addClass("hidden");$("#lookupDialogValue + .selectize-control.hidden").removeClass("hidden");e.length>0?(u=e[0].selectize,u.clear(),u.clearOptions(),f.forEach(n=>{u.addOption(n)}),f.length==0&&(u.addOption({name:DEFAULT_LOOKUP_NO_RESULTS,textString:DEFAULT_LOOKUP_NO_RESULTS}),u.addItem(DEFAULT_LOOKUP_NO_RESULTS)),r&&u.addItem(DEFAULT_LOOKUP_SELECTED_VALUE)):($("#lookupDialogValue").selectize({plugins:["select_on_focus"],valueField:"name",labelField:"textString",searchField:["textString","name"],maxOptions:1e10,options:f}),r&&(u=$("#lookupDialogValue.selectized")[0].selectize,u.addItem(DEFAULT_LOOKUP_SELECTED_VALUE)));e=$("#lookupDialogValue.selectized");controls[t]&&(h=controls[t].control.value,s=Object.keys(e[0].selectize.options).filter(n=>n==h),s.length>0&&e[0].selectize.addItem(s[0]));o>-1&&f.length!=o&&(c=`
Showing ${f.length} of ${o} records. ${f.length==o?"":"Please use a more specific filter."}
`,$("#lookupDialogValue + .selectize-control").after(c))}catch(l){ErrorHandler.handleError(l,"SetupLookupSelect",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to show searchable dropdowns. "+CONTACT_SUPPORT_MSG})}}function SetupImageButtons(){CONFIG.ImageButtons&&($("#bpSaveButton").val(""),$("#bpResetButton").val(""),$("#bpAddButton").val(""),CONFIG.NextInsteadOfSave&&$("#bpNextButton").val(""))}function SetupMainButtons(){$("#bpSaveButton").val(CONFIG.SaveButtonCaption);$("#bpSaveButtonMobile").attr("title",CONFIG.SaveButtonCaption);Mode==1&&CONFIG.ResetButton&&($("#bpSaveButton").after(''),$("#bpResetButton").bind("click",reset));Mode==1&&CONFIG.ShowAddButton&&($("#bpSaveButton").after(''),$("#bpAddButton").bind("click",add));$("#bpSaveButton").bind("click",save);$("#bpSaveButtonMobile").bind("click",save);$("#bpSaveButtonMobile").on("touchend",save);$("#bpCancelButton").bind("click",cancel);$("#bpCancelButton").on("touchend",cancel);$("#bpCancelButtonMobile").bind("click",cancel);$("#bpCancelButtonMobile").on("touchend",cancel)}function requestActiveProduct(){return $.ajax({type:"GET",url:Host+"/ActiveProduct.aspx?"+(new Date).getTime(),data:"",datatype:"text",error:ajaxQuoteError,timeout:15e5})}function requestQuote(){return appInsights.startTrackEvent("LoadQuote"),$.ajax({type:"GET",url:Host+"/Quote.aspx?"+(new Date).getTime(),data:"",datatype:"text",error:ajaxErrorWithExternalPost,success:loadQuoteParametersIntoSession,timeout:15e5})}function ajaxErrorWithExternalPost(n,t,i,r,u,f,e){if(StopRequestingLoadUpdates=!0,n.status==409)DisableBeforeUnload=!0,displayDialog("Busy","This quote is currently being saved by another user. Please wait and retry after a while.",!1,!0,!1,goToReturn,null,"Close");else{var o={error:extractFriendlyErrorMessage(n)};window.parent.postMessage(o,"*");ajaxQuoteError(n,t,i,r,u,f,e)}}function extractFriendlyErrorMessage(n){var t=n?n.responseText:"",i;if(typeof t=="string"&&t.length>0&&isJson(t))try{if(i=JSON.parse(t),i&&typeof i=="object"&&i.Message)return i.Message}catch(r){}return t}function requestQuoteAndActive(){$.when(requestQuote(),requestActiveProduct()).then((n,t)=>gotQuoteParameters(n,t,!0))}function gotQuoteParameters(n,t,i){var o,u,e,r;try{if(window.dispatchEvent(loadedQuote),appInsights.stopTrackEvent("LoadQuote"),StopRequestingLoadUpdates=!0,o="tabs-",Array.isArray(n)&&(n=n[0]),typeof t!="undefined"&&gotQuoteActiveQuote(t[0]),u=!0,typeof n=="string"){n=n.replace(String.fromCharCode(10),"\n");n=n.replace("'","'");try{quoteParameters=cleanProductGuids(JSON.parse(n))}catch(f){ready=!0;displayErrorDialog("Error","Error getting quote data. "+n,!0,!0,!1);appInsights.trackException(f);u=!1}}else quoteParameters=cleanProductGuids(n);if(u){try{RequestedTab=quoteParameters.activeTab==undefined?0:quoteParameters.activeTab}catch(f){RequestedTab=0}if(Mode=quoteParameters.mode,focusedView.ShouldBeFocusedView()?(FocusedView=!0,$("head").append(''),$("#main").addClass("hidden"),$("#title").addClass("hidden"),focusedView.RenderTreeView(i)):$("div#accordion").removeClass("pull-right"),UpdateBasket(),getBranding(),RequestedTab==0&&StartProduct!=undefined&&StartProduct!="")if(e=/[^0-9]/,e.test(StartProduct))for(r=0;rThere are no configurable items on this quote. Please add some to continue.<\/h3>"),clearBusy(),closePleaseWait(),eventHandlers.bindEventHandlers();else{for(r=0;r0&"eParameters.tabs[RequestedTab].end==="-1"&&(RequestedTab=1,CurrentTabIndex=1),quoteParameters.tabs.length>0&&requestCurrentProductJSON(RequestedTab)):requestQuoteItems()}}}catch(f){ErrorHandler.handleError(f,"gotQuoteParameters",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Failed during loading quote parameters."})}}function updateNavMenu(){var t,n,i,r;try{t=focusedView.GetPhases();t.sort(function(n,t){return n.layoutorder-t.layoutorder});n=$("#header-nav-items");n.empty();i=[];r=null;t.forEach(function(t){var f,u;if(t.product.showinheadermenu){const s="header-nav-selected",{id:l,headermenutext:a,headermenuicon:o,headermenuiconposition:v,headermenuicononly:h}=t.product;f=a?.length>0?a:t.name;const y=n=>{var t=`icon-${n}`,r=v?.trim()?.length>0,i=f?.length>0&&!h?`padding`:"";return n=="left"&&o&&!r?``:o&&v?.trim()?.toLowerCase()===n?``:""},c=focusedView.IsCurrentProduct(t),e=t.phaseIndex,p=y("left"),w=f&&!h?`${f}`:"",b=y("right"),d=h?"icon-only-width":"",k=`${p}${w}${b}`;if(u=n.find(`li[product-id="${l}"]`),u.length)u.data("navPhaseId",e),u.attr("data-nav-phase-id",e),u.html(`${k}`),c?u.addClass(s):u.removeClass(s);else{const n=c?s:"";u=$(`
  • ${k}
  • `)}n.append(u);i.push({value:e,text:f,html:`${p}${w}${b}`});c&&(r=e)}});checkNavOverflow();updateNavSelect(i,r)}catch(u){ErrorHandler.handleError(u,"updateNavMenu",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to show top navigation menu. "+CONTACT_SUPPORT_MSG})}}function updateNavSelect(n,t){var i,u,f,r;try{if(i=$("#nav-dropdown-select"),i.length===0)return;if(u=n.map(function(n){return{value:n.value.toString(),text:n.text,html:n.html}}),!i.hasClass("selectized")){i.empty();u.forEach(function(n){i.append(new Option(n.text,n.value))});f=i.selectize({options:u,valueField:"value",labelField:"text",searchField:["text"],sortField:[],dropdownParent:"body",placeholder:"Select configurable item",closeAfterSelect:!0,render:{option:function(n,t){var i=n.html||t(n.text||"");return'
    '+i+"<\/div>"},item:function(n,t){var i=n.html||t(n.text||"");return'
    '+i+"<\/div>"}},onChange:function(n){if(n){var t=parseInt(n,10);isNaN(t)||focusedView.ShowPhase(t,function(){scrollToSelectedPhase();setNavSelectValue(t)})}}})[0].selectize;t!==null&&t!==undefined&&f.setValue(t.toString(),!0);return}r=i[0].selectize;r.clear(!0);r.clearOptions();r.addOption(u);r.refreshOptions(!1);t!==null&&t!==undefined?r.setValue(t.toString(),!0):r.clear(!0)}catch(e){ErrorHandler.handleError(e,"updateNavSelect",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to show top navigation menu product dropdown. "+CONTACT_SUPPORT_MSG})}}function setNavSelectValue(n){try{if(n===null||n===undefined)return;var t=$("#nav-dropdown-select");if(!t.length)return;t.hasClass("selectized")&&t[0].selectize?t[0].selectize.setValue(n.toString(),!0):t.val(n)}catch(i){ErrorHandler.handleError(i,"setNavSelectValue",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to set top navigation menu product dropdown value. "+CONTACT_SUPPORT_MSG})}}function checkNavOverflow(){try{var i=$("#header-nav-wrapper"),r=$("#header-nav-items"),n=r.find("li"),t=$("#nav-dropdown-select-container");if(i.removeClass("is-collapsed"),n.length===0){t.addClass("hidden");return}var u=n.first().offset().top,f=n.last().offset().top,e=f>u;e?(i.addClass("is-collapsed"),t.removeClass("hidden")):t.addClass("hidden")}catch(o){ErrorHandler.handleError(o,"checkNavOverflow",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to update top navigation menu. "+CONTACT_SUPPORT_MSG})}}function scrollToSelectedPhase(){try{const t=$("#focusedNav0"),i=t.find(".selected"),n=t.parent();if(i.length===0||n.length===0)return;const r=n.scrollTop(),u=i.position().top,f=r+u;n.animate({scrollTop:f},300)}catch(n){ErrorHandler.handleError(n,"scrollToSelectedPhase",{level:ErrorHandler.ErrorLevel.WARNING,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to scroll to the selected item in the navigation menu. You can still navigate normally. "+CONTACT_SUPPORT_MSG})}}function toggleBasket(){var n=$(".basket-contents");n.hasClass("in")?(n.css("display","none"),n.removeClass("in")):($(".basket-contents").addClass("in"),$(".basket-contents").css("display","block"))}function UpdateBasket(){var r,t;if(focusedView.ShowBasket()){var i=quoteParameters.basket,u=focusedView.ShouldBeFocusedView(),n="";u||(n="non-focused");$("#basket").length==0&&(r='<\/span>'.format(n),$("#xaitCPQ-single-page-container-fluid #title").append(r));$(".basket-contents").length==0?(t=BuildBasket(i,!0,n),$("#main").append(t),setTimeout(()=>eventHandlers.BindBasketClickEvents(),200)):(t=BuildBasket(i,!1,n),$(".basket-contents").html(t))}}function BuildBasket(n,t,i){var r,o,f,e,u,s;try{if(r="",t&&(r+='
    '.format(i)),r+=`
    Basket
    `,r+='
    ',o=0,f=new Intl.NumberFormat(quoteParameters.locale.replace("_","-"),{style:"currency",currency:quoteParameters.tabs[CurrentTabIndex].currency}),Array.isArray(n)&&n.length>0)for(e=0;e
    ${u.Name}
    ${u.Quantity} x ${f.format(u.Price)}
    Subtotal: ${f.format(u.Total)}
    `,u.showdelete&&(r+=`
    `),r+=`
    `;else r+=`
    No items in basket
    `;return r+="<\/div><\/div>",s="",focusedView.ShowBasketSaveClose()&&(s='
    `))),d.html(h),c.modal({backdrop:"static",keyboard:!1}),setTimeout(()=>{c.css("display")=="none"&&c.css("display","block"),c.addClass("in")},0),$("#status-dialog").hasClass("in")&&($("#status-dialog").modal("hide"),$("#status-dialog").removeClass("in"))),r||u){if(v.removeClass("hidden"),l=v.find("#dialog-cancel"),a=v.find("#dialog-ok"),u?(l.removeClass("hidden"),l.text(s)):l.addClass("hidden"),r?(a.removeClass("hidden"),a.text(o)):a.addClass("hidden"),f!=undefined&&f!=null&&r)$(a).on("click",f);else $(a).unbind();if(e!=undefined&&e!=null&&u)$(l).on("click",e);else $(l).unbind()}else v.addClass("hidden")}catch(g){ErrorHandler.handleError(g,"gotCurrentProductJSON",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Failed to render after retrieving product JSON."},!0)}}function closeDialog(n=null){var t=$("#status-dialog"),i=t.attr("data-controlId");i==undefined?(t.modal("hide"),t.removeClass("in")):n!=null&&i==n&&(t.modal("hide"),t.removeClass("in"),t.removeAttr("data-controlId"))}function displayPleaseWaitMessage(n,t){displayDialog(n,'
    <\/i><\/div>',!1,!1,!1,null,null,null,null,t)}function updatePleaseWaitMessage(n){displayDialog(null,n,!1,!1,!1)}function updatePleaseWaitMessageWithHtml(n){displayDialog(null,n,!1,!1,!1)}function displayPleaseWait(){displayPleaseWaitMessage("Loading, Please Wait.")}function shouldShowConfirmationModal(n){return n&&typeof n.hasClass=="function"?n.hasClass(ControlStyleClasses.ButtonConfirmation):!1}function returnFocus(){try{$(currentFocus).focus()}catch(n){console.log("Tried to return focus to "+currentFocus+" failed.")}}function closePleaseWait(n=null){console.log("Closing Please Wait.");closeDialog(n);setTimeout("$('div.modal-backdrop').remove()",250);$("div.modal-backdrop").remove();setTimeout(function(){$(".floating-button").blur()},0)}function DisplayError(n){DisplayMessage("Error",n,!0)}function DisplayMessage(n,t,i){displayDialog(n,t,i,!0,!1)}function coworkingUnlockQuote(n){var f;try{n!==undefined&&n.preventDefault();var u=!!quoteParameters.opened,r=quoteParameters.canoverridestatuslock!=undefined,e=r?quoteParameters.canoverridestatuslock:!1,i=quoteParameters.quotestatus,t=[];r&&e&&!u&&(i?.length>0?(t.push(`

    This quote has been locked due to its current status being set to ${i}.

    `),t.push(`

    Unlocking a ${i} quote can cause consistency and traceability issues with the process.

    `)):t.push(`

    This quote has been locked due to its current status. Unlocking a locked quote can cause consistency and traceability issues with the process.

    `));u&&!r&&(t.push(`

    The user ${lockStatus.lockUser.name} is also currently accessing this quote. Please confirm that the other user is not still making changes before unlocking this quote.

    `),t.push(`

    Unlocking a quote can overwrite other user's changes if they're still configuring. Only do this if you're sure the other users are not still active.

    `));u&&r&&(i?.length>0?t.push(`

    This quote has been locked due to its current status being set to ${i}`):t.push(`

    This quote has been locked due to its current status`),t.push(`, and is being viewed by ${lockStatus.lockUser.name}.

    `),t.push(`

    Unlocking a quote that is locked due to status may cause consistency and traceability issues.

    `),t.push(`

    Please confirm with ${lockStatus.lockUser.name} that they are finished with their changes to prevent loss of data.

    `));f=t.join("");showConfirmModal(function(){$("#confirmation-dialog").find("#dialog-ok").off("click");$("#confirmation-dialog").find("#dialog-ok").prop("disabled",!0);$("#confirmation-dialog").find("#dialog-cancel").off("click");$("#confirmation-dialog").find("#dialog-cancel").prop("disabled",!0);var n="?start={0}&end={1}".format(quoteParameters.tabs[CurrentTabIndex].start,quoteParameters.tabs[CurrentTabIndex].end);$.ajax({type:"POST",url:Host+"/Update.aspx"+n,data:'{"id": -3, "value": "unlock"}',datatype:"text",error:ajaxErrorWithExternalPost,success:function(n){$("#confirmation-dialog").modal("hide");gotUpdateJSON(n);$("#bpSaveButtonMobile").parent().css("display","list-item");$("#bpSaveAndContinueButtonMobile").parent().css("display","list-item");$("#bpSaveButtonMobile").show();$("#bpSaveAndContinueButtonMobile").show();$("#bpUnlockButton").parent().css("display","none");$("#locked-message").remove();moveButtonsToFab();setCurrentUserLock(!0)},timeout:15e4})},f,!0)}catch(o){ErrorHandler.handleError(o,"coworkingUnlockQuote",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to unlock quote. "+CONTACT_SUPPORT_MSG})}}function SaveAndContinue(n){try{if(n!==undefined&&n.preventDefault(),isQuoteLockedForCurrentUser())return;eventHandlers.executeSequentialUpdates();clearErrors();appInsights.startTrackEvent("SaveAndContinue");Busy||updateBusy||updateQueue.length>0?(log("SaveAndContinue Waiting on busy"),appInsights.trackTrace({message:"SaveAndContinue Waiting on busy"}),displayPleaseWaitMessage("Waiting for update to complete before saving, please wait."),setTimeout("SaveAndContinue()",250)):(displayPleaseWaitMessage("Saving, please wait."),setBusy(),CurrentSaveFunction=ContinueSaveAndContinue,checkScriptAllowsSave())}catch(t){ErrorHandler.handleError(t,"SaveAndContinue",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to save quote. "+CONTACT_SUPPORT_MSG})}}function ContinueSaveAndContinue(){$.ajax({url:Host+"/api/Save.aspx?inline=true&SaveAndContinue=true",error:function(n,t,i){ajaxQuoteError(n,t,i)},success:function(n){var t=!0,i="";try{json=JSON.parse(n)}catch(r){t=!1;i=r.message}t?displayDialog("Status","Quote Saved",!0,!0,!1):displayErrorDialog("Error","Unable to save.
    Message: "+i,!0,!0,!1)},timeout:6e5,dataType:"text",complete:function(){var n={quote:quoteParameters.quoteid,numberOfProducts:quoteParameters.tabs.length};appInsights.stopTrackEvent("SaveAndContinue",n);clearBusy()}})}function AddSaveAndContinueButton(){var n=!1,u,r,t,i;try{CONFIG.SaveAndContinueButton!=undefined&&CONFIG.SaveAndContinueButton==!0&&(n=!0)}catch(e){n=!1}if(n){var f=$("#controlButtons"),t=$("#floating-options"),i='<\/span> Save & Continue<\/a>';f.find("#bpCancelButton").before(i);u='
  • <\/span><\/a><\/li>';t.find("#bpCancelButtonMobile").parent().before(u);$("#bpSaveAndContinueButton").click(SaveAndContinue);$("#bpSaveAndContinueButtonMobile").click(SaveAndContinue);$("#bpSaveAndContinueButtonMobile").on("touchend",SaveAndContinue)}r=!1;typeof CONFIG.ShowCheckButton!="undefined"&&(r=CONFIG.ShowCheckButton);r&&(t=$("#floating-options"),i='
  • <\/span><\/a><\/li>',t.find("#bpCancelButtonMobile").parent().before(i),$("#bpCheckButtonMobile").bind("click",getErrors))}function gotQuoteActiveQuote(n){var t=!0;if(typeof n=="string"){n=n.replace(String.fromCharCode(10),"\n");t=!0;try{Active=JSON.parse(n)}catch(i){t=!1}}t&&Active&&Active.ActiveProduct!=""&&(StartProduct=Active.ActiveProduct)}function gotJSON(n){var i,t,r,f;try{if(console.log("gotJSON()"),i=!1,typeof n=="string"&&(i=!0,n=n.replace(String.fromCharCode(10),"\n")),t=!0,r=[],typeof CONFIG.GetValuesInSetsOf==undefined||isNaN(CONFIG.GetValuesInSetsOf)){try{controls=JSON.parse(n)}catch(u){ready=!0;displayErrorDialog("Error","Error getting initial quote values. "+n,!0,!0,!1);t=!1}t&&(f=AddControlsToTabs(controls),eventHandlers.bindEventHandlers());finishedGettingJSON(t)}else if(i&&n==="[]"||!i&&n.length===0)eventHandlers.bindEventHandlers(),finishedGettingJSON(t),doWarnings();else{CONFIG.DynamicProperties?gotUpdateJSON(n):requestNextJson();try{r=i?JSON.parse(n):n}catch(u){ready=!0;displayErrorDialog("Error","Error getting initial quote values. "+n,!0,!0,!1);t=!1}controls===undefined&&(controls=[]);controls=controls.concat(r);AddControlsToTabs(r)}}catch(u){ErrorHandler.handleError(u,"gotJSON",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to show form fields for selected item. "+CONTACT_SUPPORT_MSG})}}function requestNextJson(){try{ChunkOffset++;$.ajax({type:"GET",url:Host+"/QuoteItem.aspx?"+(new Date).getTime(),data:"qty="+CONFIG.GetValuesInSetsOf+"&offset="+ChunkOffset,datatype:"text",error:ajaxQuoteError,success:gotJSON,timeout:15e4})}catch(n){ErrorHandler.handleError(n,"requestNextJson",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to retrieve the next set of quote values. "+CONTACT_SUPPORT_MSG})}}function finishedGettingJSON(){try{eventHandlers.bindBootstrapEvents();eventHandlers.bindKeyHandlers();Mode==0&&($("#bpSaveButton").attr("disabled","disabled"),$("#bpSaveButtonMobile").attr("disabled","disabled"),$("#bpSaveButton").hide(),$("#bpSaveButtonMobile").hide(),$("#bpSaveAndContinueButtonMobile").hide(),$("input.bpGeneralQty").attr("disabled","disabled"));ready=!0;$("#myForm").show();CONFIG.DuplicateTabParamsToBottom!=undefined&&CONFIG.DuplicateTabParamsToBottom==!0&&jQuery("#bpGeneralParams").clone(!0,!0).appendTo("#myForm");clearBusy();for(var n=0;n.clickableErrorMessage",function(){var n=$(this).data("bpcontrol");return $("#bp-clickable-error-"+n).find('[data-notify="dismiss"]').trigger("click"),scrollToControl(n),!1});DrawStages();setTimeout(function(){updateWarningsOnSections()},100)}catch(t){ErrorHandler.handleError(t,"finishedGettingJSON",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to update quote after getting items. "+CONTACT_SUPPORT_MSG})}}function doLightbox(){try{$("a[data-type=image]").magnificPopup({type:"image",closeOnContentClick:!0,closeBtnInside:!1,fixedContentPos:!0,mainClass:"mfp-no-margins mfp-with-zoom",image:{verticalFit:!0},zoom:{enabled:!0,duration:300}})}catch(n){ErrorHandler.handleError(n,"doLightbox",{level:ErrorHandler.ErrorLevel.WARNING,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to show lightbox. "+CONTACT_SUPPORT_MSG})}}function saveAllowed(){forceQuoteConsistency=!0;try{forceQuoteConsistency=CONFIG.ForceQuoteConsistency!=undefined?CONFIG.ForceQuoteConsistency:!0}catch(t){forceQuoteConsistency=!0}if(forceQuoteConsistency){for(var n=0;n1)return!1;return!0}return!0}function TabConsistent(n){try{if(CONFIG.ForceTabConsistency){for(var t=0;t'),$("#bpNextButton").click(NextPressed))}function handleTabNext(){try{if(CONFIG.NextInsteadOfSave){var n=$("#tabs").tabs("option","selected");n==NumberOfTabs-1?($("#bpSaveButton").css("display",""),$("#bpNextButton").css("display","none")):($("#bpNextButton").css("display",""),$("#bpSaveButton").css("display","none"))}DoToolTips()}catch(t){}}function NextPressed(){try{Busy?setTimeout("NextPressed()",250):(CurrentTab=$("#tabs").tabs("option","selected"),TabConsistent(CurrentTab)?($("#tabs").tabs("select",CurrentTab+1),handleTabNext()):displayErrorDialog("Error",CONFIG.TabChangingErrorMessage,!0,!0,!1))}catch(n){ErrorHandler.handleError(n,"NextPressed",{level:ErrorHandler.ErrorLevel.WARNING,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable go to next item."})}}function cancel(n){try{n.preventDefault()}catch(n){}try{eventHandlers.executeSequentialUpdates();showConfirmModal(function(){clearErrors();$(".floating-button").addClass("disabled");$("#bpSaveButton").attr("disabled","disabled");$("#bpSaveButtonMobile").attr("disabled","disabled");$("#bpCancelButton").attr("disabled","disabled");$("#bpCancelButtonMobile").attr("disabled","disabled");Busy?(log("Cancel Waiting on busy"),setTimeout(function(){cancel()},250)):(DisableUpdate=!1,ready=!1,$.ajax({type:"GET",url:Host+"/Cancel.aspx",datatype:"text",error:ajaxQuoteError,success:cancelled}))})}catch(t){ErrorHandler.handleError(t,"cancel",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to exit quote. "+CONTACT_SUPPORT_MSG})}}function checkScriptAllowsSave(){try{if(typeof CONFIG.BypassCheckCanClose!="undefined"&&CONFIG.BypassCheckCanClose)CurrentSaveFunction();else{var n="";CONFIG.DynamicProperties&&(n="?start={0}&end={1}".format(quoteParameters.tabs[CurrentTabIndex].start,quoteParameters.tabs[CurrentTabIndex].end));$.ajax({type:"GET",url:Host+"/api/CheckCanSave.aspx"+n,datatype:"json",error:function(n,t,i){ajaxQuoteError(n,t,i)},success:gotAllowedSaveResult})}}catch(t){ErrorHandler.handleError(t,"checkScriptAllowsSave",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to check if save is allowed. "+CONTACT_SUPPORT_MSG})}}function checkScriptAllowsSaveAndClose(){try{if(typeof CONFIG.BypassCheckCanClose!="undefined"&&CONFIG.BypassCheckCanClose)CurrentSaveFunction();else{var n="";CONFIG.DynamicProperties&&(n="?start={0}&end={1}".format(quoteParameters.tabs[CurrentTabIndex].start,quoteParameters.tabs[CurrentTabIndex].end));$.ajax({type:"GET",url:Host+"/api/CheckCanClose.aspx"+n,datatype:"json",error:function(n,t,i){ajaxQuoteError(n,t,i)},success:gotAllowedSaveResult})}}catch(t){ErrorHandler.handleError(t,"checkScriptAllowsSaveAndClose",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to check if save is allowed. "+CONTACT_SUPPORT_MSG})}}function gotAllowedSaveResult(n){try{n.CanClose?(n.ResultJson.length!==0&&gotUpdateJSON(n.ResultJson),CurrentSaveFunction()):(appInsights.trackTrace({message:"Not allowed to save."}),typeof n.CanClose=="undefined"&&log("Failed to report from checkcanclose: "+n),n.ErrorMessage!=""?(clearBusy(),displayErrorDialog("Error","Error when checking we are allowed to save. Error reported was: {0}".format(n.errorMessage),!0,!0,!1)):n.ResultJson!=""?gotUpdateJSON(n.ResultJson):(clearBusy(),displayErrorDialog("Error","The script has reported that this product is not allowed to save, but has not sent a reason.",!0,!0,!1)))}catch(t){ErrorHandler.handleError(t,"gotAllowedSaveResult",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to update quote after save. "+CONTACT_SUPPORT_MSG})}}function continueSaving(){try{saveAllowed()?(DuplicateIpnList=DuplicateCheck(),DuplicateIpnList==""?($(".floating-button").addClass("disabled"),$("#bpSaveButton").attr("disabled","disabled"),$("#bpSaveButtonMobile").attr("disabled","disabled"),$("#bpCancelButton").attr("disabled","disabled"),$("#bpCancelButtonMobile").attr("disabled","disabled"),displayPleaseWaitMessage("Saving, please wait."),DisableUpdate=!1,ready=!1,Errors=[],appInsights.startTrackEvent("Save"),InlineSave?$.ajax({url:Host+"/api/Save.aspx?inline=true",error:function(n,t,i){ajaxQuoteError(n,t,i)},success:saved,timeout:3e5,dataType:"text"}):$.ajax({url:Host+"/api/Save.aspx",error:function(n,t,i){ajaxQuoteError(n,t,i)},success:saved,timeout:3e5,dataType:"text"})):displayErrorDialog("Error","You may not have duplicate products. The duplicate IPNs are:\n "+DuplicateIpnList,!0,!0,!1)):(displayErrorDialog("Error",'Please ensure all required questions have been answered. These are marked with a <\/i>',!0,!0,!1),clearBusy())}catch(n){ErrorHandler.handleError(n,"continueSaving",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Unable to finish saving. "+CONTACT_SUPPORT_MSG});clearBusy()}}function save(n){try{try{n.preventDefault()}catch(n){}if(isQuoteLockedForCurrentUser())return;eventHandlers.executeSequentialUpdates();clearErrors();log("Save Start");appInsights.startTrackEvent("CompleteSave");Busy||updateBusy||updateQueue.length>0?(log("Save Waiting on busy"),appInsights.trackTrace({message:"Save waiting on busy"}),setTimeout(function(){save()},250)):(displayPleaseWaitMessage("Saving, please wait.."),setBusy(),CurrentSaveFunction=continueSaving,SaveAndCloseInProgress=!0,checkScriptAllowsSaveAndClose())}catch(t){ErrorHandler.handleError(t,"save",{level:ErrorHandler.ErrorLevel.ERROR,category:ErrorHandler.ErrorCategory.GENERAL,userMessage:"Failed to initiate save. Please try again."});clearBusy();closePleaseWait()}}function displayRetryDialog(){$("body").append('