'
};
})
.directive("ngScrollToAndFocus", function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.on("click", function (event) {
event.preventDefault();
var dataTarget = element.data('target');
$('html, body').animate({
scrollTop: $(dataTarget + ":visible").offset().top - 10 // 10 px pad
}, 500);
$(dataTarget).focus();
});
}
};
})
.directive("ngScrollToAndExpand", function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var scrollToId = element.data('scroll-target'),
expandId = attrs.ngScrollToAndExpand;
element.off('click').on('click', function () {
$('html, body').animate({
scrollTop: $(scrollToId).offset().top
}, 500, function () {
$(expandId).collapse('show');
$('[data-target="' + expandId + '"]').removeClass('collapsed');
});
});
}
};
})
.directive("ngApplyRemainingBalance", ["$timeout", "applyRemainingBalanceService", "ccRewardsService", "featureService", function (timeout, applyRemainingBalanceService, ccRewardsService, featureService) {
return {
priority: 100,
restrict: 'A',
template: '{{label.labelMsg}}',
link: function (scope, element, attrs) {
var showMessaging = function () {
scope.currencyFormatSettings = scope.currencyFormatSettings || { precision: 2, decimal: '.' };
var pendingTotal = +applyRemainingBalanceService.calculatePendingTotal(scope.currencyFormatSettings), // '+' forces this to be treated as a number
orderTotal = +applyRemainingBalanceService.getOrderTotal(scope),
diff = applyRemainingBalanceService.jsMathAdd([orderTotal, -pendingTotal], scope.currencyFormatSettings['precision']);
$('.overAvailCredit').addClass('ng-hide');
$('.arbMsg').find('a').addClass('ng-hide');
if ($('input.amount-field:visible').length > 1) {
$('.editable-amount').each(function () {
var maxLimitField = $(this).find('input[name="item.MaxLimit"]'),
availableCredit = +applyRemainingBalanceService.getAvailableCredit(maxLimitField),
amountField = $(this).find('input.amount-field'),
fieldAmount = applyRemainingBalanceService.convertToDecimalPrice(amountField.val(), scope.currencyFormatSettings['decimal']),
fieldAmountPlusDiff = applyRemainingBalanceService.jsMathAdd([diff, fieldAmount], scope.currencyFormatSettings['precision']);
if (availableCredit > 0) {
if (fieldAmount <= availableCredit) {
if (fieldAmountPlusDiff <= availableCredit) {
if (pendingTotal < orderTotal) {
$(this).find('a.addBalance').removeClass('ng-hide');
}
else if (pendingTotal > orderTotal && fieldAmount > 0) {
$(this).find('a.subExtra').removeClass('ng-hide');
}
}
else if (fieldAmountPlusDiff > availableCredit && fieldAmount !== availableCredit) {
$(this).find('a.useAvailCredit').removeClass('ng-hide');
}
}
else if (fieldAmount > availableCredit) {
$(this).parent().find('.overAvailCredit').removeClass('ng-hide');
$(this).find('a.useAllCredit').removeClass('ng-hide');
}
else if (fieldAmount > orderTotal) {
$(this).find('a.subExtra').removeClass('ng-hide');
}
}
else if (pendingTotal < orderTotal) {
$(this).find('a.addBalance').removeClass('ng-hide');
}
else if (fieldAmount > 0 && (pendingTotal > orderTotal)) {
$(this).find('a.subExtra').removeClass('ng-hide');
}
});
}
};
var editableAmountElement = element.closest('.editable-amount');
editableAmountElement.find('input.amount-field')
.on('click', function () {
if ($(this).val() === '0') {
$(this).select();
}
});
editableAmountElement.off('blur change', '.amount-field')
.on('blur change', '.amount-field', function () {
showMessaging();
if (featureService.IsEnabled("EnableCreditCardPayWithPoints")) {
var amountField = editableAmountElement.find('input.amount-field');
applyRemainingBalanceService.updateDataModelAmount(scope, amountField.val());
scope.$root.$apply(function() {
ccRewardsService.HandleAppliedRewardsForSplitPay(scope);
});
}
});
editableAmountElement.off('click', 'a.subExtra, a.addBalance')
.on('click', 'a.subExtra, a.addBalance', function () {
var amountField = editableAmountElement.find('input.amount-field'),
newAmount = applyRemainingBalanceService.updateAmount(scope, amountField.val()).toFixed(scope.currencyFormatSettings['precision']).toString();
applyRemainingBalanceService.updateDataModelAmount(scope, newAmount);
amountField.trigger('change');
showMessaging();
});
editableAmountElement.off('click', 'a.useAvailCredit, a.useAllCredit')
.on('click', 'a.useAvailCredit, a.useAllCredit', function () {
var maxLimitField = $(this).closest('.editable-amount').find('input[name="item.MaxLimit"]'),
availableCredit = applyRemainingBalanceService.getAvailableCredit(maxLimitField).toFixed(scope.currencyFormatSettings['precision']).toString();
applyRemainingBalanceService.updateDataModelAmount(scope, availableCredit);
editableAmountElement.find('input.amount-field').trigger('change');
showMessaging();
});
var timer = timeout(showMessaging, 500);
scope.$on("$destroy", function (event) {
timeout.cancel(timer);
});
}
};
}])
/*
ngMoreLess Directive
shows more or less action for a list\string.
-------------------------------------
Attributes:
collection: ---pass collection (array of object)
text: --------pass string(string)
limit: -----pass integer to limit no of list items/characters to be shown(list/string)
keyToDisplay -----pass name of property to be displayed in the list.(list)
isList-------pass bool, true for list type, false for string type(list/string)
moreLabel----------pass label for more text
lessLabel---------pas lael for less text
*/
.directive("ngMoreLess",["featureService", function (featureService) {
return {
restrict: 'A',
scope: {
collection: "=",
text: "=",
limit: "=",
keyToDisplay: "@",
imageToDisplay: "@",
isList: "=",
moreLabel: "@",
lessLabel: "@",
showEditItem: "=",
editItem:"&editItemAttr"
},
template: '' +
'
' +
'
' +
'' +
'
{{item[keyToDisplay]}}
' +
'
' +
'
' +
'' +
'
{{item[keyToDisplay]}}
' +
'
' +
'
' +
'{{lessLabel}}' +
'{{moreLabel}}',
link: function (scope, element) {
var ftEnabled = featureService.IsEnabled("EnableEditForItemDescriptionAndImage");
scope.edit = function () {
if (ftEnabled && scope.showEditItem) {
scope.editItem();
}
}
if (ftEnabled && scope.showEditItem) {
element.find(".textDiv").toggleClass("cursorPointer")
.attr('tabIndex', 0)
.attr("role", "link")
.bind("keydown keypress", function (event) {
if (event.which === 13) {
scope.editItem();
};
});
}
if (scope.isList) {
if (scope.collection.length > scope.limit) {
element.children().last().toggleClass("ng-hide");
}
} else {
var text = typeof scope.text == 'undefined' ? "" : scope.text;
if (text.length > scope.limit) {
element.children().last().toggleClass("ng-hide");
var indexOfWhiteSpace = text.lastIndexOf(" ", scope.limit);
var textA = text.substring(0, indexOfWhiteSpace);
var textB = text.substring(indexOfWhiteSpace);
element.find(".textDiv").html('' + textA + '...' + textB + '');
} else {
element.find(".textDiv").html(text);
}
}
element.children('a.moreLess').off().on('click', function (eventObj) {
var hiddenElement = element.find('.hiddenElement');
hiddenElement.toggleClass("ng-hide");
});
}
};
}])
.directive("ngAddHtml", ["$compile", function (compile) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var dataTesttIdPart = attrs.ngChildDataTestid ? (' data-testid="' + attrs.ngChildDataTestid + '"') : '';
element.html(compile('
' + attrs.ngAddHtml + '
')(scope));
}
};
}])
.directive("ngAdjustDropdown", function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
// when dropdown meets edge of window, move it to the left
var dropdown = $(element).find('.dropdown-menu'),
initDropdownLeft = dropdown.css('left'),
initDropdownRight = dropdown.css('right'),
resizeTimer = null;
var fixDropdownX = function () {
dropdown.css({ 'left': initDropdownLeft, 'right': initDropdownRight });
var dropdownWidth = Math.ceil(dropdown.outerWidth()),
containerWidth = Math.ceil(element.outerWidth());
if (dropdownWidth > containerWidth) {
dropdownWidth = containerWidth; // ensure the dropdown never goes past the left of the screen
}
var dropdownLeft = Math.ceil(dropdown.offset().left),
dropdownRight = dropdownLeft + dropdownWidth,
containerLeft = Math.ceil(element.offset().left),
containerRight = containerLeft + containerWidth;
if (dropdownRight > containerRight) {
var newDropdownLeft = containerRight - dropdownRight;
dropdown.css({ 'left': newDropdownLeft, 'right': initDropdownRight });
}
};
$(element).find('.dropdown-menu').parent().on('shown.bs.dropdown', function () {
fixDropdownX();
});
var createFixDropdownTimer = function (milliSecs) {
if (resizeTimer !== null) window.clearTimeout(resizeTimer);
resizeTimer = window.setTimeout(function () {
fixDropdownX();
}, milliSecs);
};
$(window).resize(function () {
if ($('.dropdown-menu:visible').length > 0) {
createFixDropdownTimer(200);
}
});
}
};
})
.directive("ngHrefTargetBlank", function () {
return {
restrict: 'A',
compile: function (element) {
var elems = (element.prop("tagName") === 'A') ? element : element.find('a');
elems.attr("target", "_blank");
}
};
})
.directive("ngHrefTargetSelf", function () {
return {
restrict: 'A',
compile: function (element) {
var elems = (element.prop("tagName") === 'A') ? element : element.find('a');
elems.attr("target", "_self");
}
};
})
.directive("ngValidatecpfcnpj", ["cpfcnpjValidationService", function (cpfcnpjValidationService) {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
element.bind('blur', function (e) {
var status = cpfcnpjValidationService.ValidateCpfCnpj(element);
// set the validity.
ngModel.$setValidity('cpfcnpj', status);
});
}
};
}])
.directive("ngPostalcodeaddress", ["postalAddressValidationService", "featureService", function (postalAddressValidationService, featureService) {
return {
priority: 100,
restrict: 'A',
scope: false,
link:
function (scope, iElement, attrs) {
iElement.on("blur",
function () {
if (featureService.IsEnabled("EnableReceitaZipCodeFederalNotification")) {
waitForToolTip(1000);
}
if (featureService.IsEnabled("GoogleAutoCompleteEnabled")) {
postalAddressValidationService.GetValidateShippingAddress(iElement, scope, attrs.sourceContact);
}
else {
if (!featureService.IsEnabled("GoogleAutoCompleteEnabled")) {
postalAddressValidationService.GetAddressByPostalCode(iElement, scope, attrs.sourceContact);
}
if (featureService.IsEnabled("SuframaBenefits")) {
postalAddressValidationService.GetAddressByPostalCode(iElement, scope, attrs.sourceContact);
}
}
});
if (featureService.IsEnabled("EnableReceitaZipCodeFederalNotification")) {
var waitForToolTip = function dellayForTooltip(milliseconds) {
const date = Date.now();
var currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
}
}
};
}]).directive("ngValidateaustralianbusinessnumber", function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
element.bind('blur', function (e) {
var result = true;
if (element[0].attributes['ng-validateaustralianbusinessnumber'].value.toLowerCase() == "true") {
var abn = element[0].value;
if (abn) {
var weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];
abn = abn.replaceAll(/[^\d]/, '');
if (abn.length === 11) {
var sum = 0, weight, digit;
for (var index = 0; index <= weights.length - 1; index++) {
weight = weights[index];
digit = abn[index] - (index ? 0 : 1);
sum += weight * digit;
}
result = sum % 89 === 0;
} else {
result = false;
}
}
}
ngModel.$setValidity('australianbusinessnumber', result);
});
}
};
}).directive("ngPhoneformatvalidate", ["phoneNumberValidationService", function (phoneNumberValidationService) {
return {
restrict: 'A',
link:
function (scope, element, attrs) {
element.bind("blur",
function () {
phoneNumberValidationService.ValidateAndFormatPhoneNumber(element, attrs.sourceContact, attrs.phoneType);
});
}
};
}])
.directive("ngPostalcodeformat", function ($parse) {
return {
restrict: 'A', template: "
{{code.replace(regex, '$1-$2')}}
",
scope: { code: '=ngPostalcodeformat' },
replace: true,
link:
function (scope, element, attrs) {
scope.regex = /^(\d{3})(\d{4})$/;
}
};
}).directive("ngBillofentryvalidate", ["billOfEntryValidationService", function (billOfEntryValidationService) {
return {
restrict: 'A',
link:
function (scope, element, attrs) {
element.bind("blur",
function () {
billOfEntryValidationService.ValidateBillOfEntry(element);
});
}
};
}]).directive('dacomDynamicUrl', function () {
return {
restrict: 'A',
link: function postLink(scope, element, attrs) {
element.attr('src', scope.DataModel.DacomDataModel.DacomUrl);
}
};
}).directive('maskingInfo', function () {
return {
restrict: 'A', template: "
{{code}}
",
scope: {
code: '=maskingInfo'
},
replace: true,
link: function (scope, element, attrs) {
var maskedInfo = scope.code.replace(/(\B[\S])\B/g, "*");
scope.code = maskedInfo;
}
};
}).directive('ngRepeatClickHandler', function () {
return {
compile: function (element, attr) {
return function link(scope, element, attr) {
element.on('click', function (event) {
scope.$apply(function () {
scope.$eval(attr.ngRepeatClickHandler, {
$event: event
});
});
});
};
}
};
}).directive("ngValidatePanNumber", function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
element.bind('blur', function (e) {
var result = true;
var pan = element[0].value;
if (pan) {
if (pan.length === 10) {
var regex = "/^([A-Za-z]{5}\d{4}[A-Za-z]{1})/";
if (pan.match(regex))
result = false;
}
}
ngModel.$setValidity('pannumber', result);
});
}
};
}).directive("ngValidateCompanyExtraFields", function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
scope.$watch(function (scope) { return scope.DataModel.IsZeroSegmentOrderForHome },
function (isOrderForHome) {
if (isOrderForHome) {
element.removeClass("ng-required");
document.getElementById(attrs.id).required = false;
if ($(attrs.id)[0] != undefined && $(attrs.id)[0].classList != undefined) {
$(attrs.id)[0].classList.remove("requiredField");
$(attrs.id)[0].classList.add("stp-hide-asterisk");
}
}
else {
element.addClass("ng-required");
document.getElementById(attrs.id).required = true;
if ($('label[for="' + attrs.id + '"]')[0] != undefined && $('label[for="' + attrs.id + '"]')[0].classList != undefined) {
$('label[for="' + attrs.id + '"]')[0].classList.add("requiredField");
$('label[for="' + attrs.id + '"]')[0].classList.remove("stp-hide-asterisk");
}
}
scope.DataModel.ShippingContact.ZerosegmentValidation = isOrderForHome;
scope.DataModel.BillingContact.ZerosegmentValidation = isOrderForHome;
}
);
}
};
}).directive("ngItemLevelEdd", function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var selectedDate = scope.EstimatedDeliveryDateDataModel.SelectedEstimatedDeliveryDate;
if (selectedDate && scope.EstimatedDeliveryDateDataModel.EstimatedDeliveryDates.length > 0 && scope.EstimatedDeliveryDateDataModel.EstimatedDeliveryDates[0] !== selectedDate) {
scope.EstimatedDeliveryDateDataModel.disableselectedShiftTimeDropdown = false;
}
else {
scope.EstimatedDeliveryDateDataModel.disableselectedShiftTimeDropdown = true;
}
if (selectedDate && scope.EstimatedDeliveryDateDataModel.EstimatedDeliveryDates.length > 0 && (!scope.EstimatedDeliveryDateDataModel.EstimatedDeliveryDates.indexOf(selectedDate) > -1)) {
scope.EstimatedDeliveryDateDataModel.SelectedEstimatedDeliveryDate = scope.EstimatedDeliveryDateDataModel.EstimatedDeliveryDates[0];
scope.EstimatedDeliveryDateDataModel.SelectedShiftTime = scope.deliveryShifts[0].Value;
scope.EstimatedDeliveryDateDataModel.disableselectedShiftTimeDropdown = true;
}
}
};
}).directive("ngValidateissuebank", function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
var cardType = scope.$parent.item.CardTypeCode;
scope.DataModel.SavedCardTypeCode = cardType;
}
}
}).directive('contenteditable', ['$sce', function ($sce) {
return {
restrict: 'A', // only activate on element attribute
require: '?ngModel', // get a hold of NgModelController
link: function (scope, element, attrs, ngModel) {
if (!ngModel) return; // do nothing if no ng-model
// Specify how UI should be updated
ngModel.$render = function () {
element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));
read(); // initialize
};
// Listen for change events to enable binding
element.on('blur keyup change', function () {
scope.$evalAsync(read);
});
// Write data to the model
function read() {
var html = element.html();
// When we clear the content editable the browser leaves a behind
// If strip-br attribute is provided then we strip this out
if (attrs.stripBr && html == ' ') {
html = '';
}
ngModel.$setViewValue(html);
}
}
};
}]).directive('ngBindHtmlCompile', ["$compile",function ($compile) {
return {
restrict: 'A',
replace: true,
link: function (scope, element, attrs) {
scope.$watch(attrs.ngBindHtmlCompile, function (html) {
$compile(element.html(html && html.toString()).contents())(scope);
}, true);
}
};
}]).directive('ngDisplayRatings', function () {
return {
restrict: 'A',
replace: true,
link: function (scope, element, attrs) {
scope.ShowHideRatingsSection(element);
}
};
}).directive("ngPostalcodeforstateandcity", ["postalAddressValidationService", "featureService", function (postalAddressValidationService, featureService) {
return {
priority: 100,
restrict: 'A',
scope: false,
link:
function (scope, iElement, attrs) {
iElement.on("blur",
function () {
if (!featureService.IsEnabled("GoogleAutoCompleteEnabled")) {
if (featureService.IsEnabled("StateandCityfromPostalcode")) {
postalAddressValidationService.GetStateAndCityByPostalCode(iElement, scope, attrs.sourceContact, null);
}
}
else {
if (attrs.sourceContact == "ShippingContact" && scope.DataModel.ShippingContact.PostalCode) {
scope.ValidateShippingAddress(iElement[0].value, true);
}
}
});
}
};
}]).directive("ngCityaddresschange", ["featureService", function (featureService) {
return {
priority: 100,
restrict: 'A',
scope: false,
link:
function (scope, iElement, attrs) {
iElement.on("blur",
function () {
if (featureService.IsEnabled("SuframaBenefits")) {
scope.ValidateSuframaStatesWithCity(true);
}
});
}
};
}]).directive("ngAllowOnlyNumber", function () {
return {
restrict: 'A',
link:
function (scope, element) {
function isNumberKey(event) {
var charCode = (event.which) ? event.which : event.keyCode;
if (charCode === 46) {
return false;
}
if (charCode !== 46 && charCode > 31 && charCode !== 190 && charCode !== 188
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
element.on("keypress", function (event) {
if (isNumberKey(event)) {
return true;
}
return false;
});
}
};
}).directive("ngAllowOnlyAlphaNumeric", function () {
return {
restrict: 'A',
link:
function (scope, element) {
function isSpecialCharKey(event) {
var charCode = (event.which) ? event.which : event.keyCode;
return ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123) || charCode == 8 || charCode == 32 || (charCode >= 48 && charCode <= 57));
}
element.on("keypress", function (event) {
if (isSpecialCharKey(event)) {
return true;
}
return false;
});
}
};
}).directive('ngBindHtmlUnsafe', function ($parse, $compile) {
return function ($scope, $element, $attrs) {
var compile = function (newHTML) {
newHTML = $compile(newHTML)($scope);
$element.html('').append(newHTML);
};
var htmlName = $attrs.ngBindHtmlUnsafe;
$scope.$watch(htmlName, function (newHTML) {
if (!newHTML) return;
compile(newHTML);
});
};
}).directive("ngAutocompletebypostalcode", ["googleAutocompleteService", "featureService", "$timeout", function (googleAutocompleteService, featureService, timeout) {
if (featureService.IsEnabled("GoogleAutoCompleteEnabled")) {
return {
priority: 100,
restrict: 'A',
link:
function (scope, iElement, attrs) {
iElement.on("focus", googleAutocompleteService.geolocate),
$('#' + iElement[0].id).typeahead({
hint: false,
highlight: true,
minLength: 3
},
{
name: "states",
displayKey: "value",
async: true,
limit: 10,
source: googleAutocompleteService.getPlacePredictionsByPostalCode,
templates: {
header:
'
Suggestions
',
footer: '',
notFound: '
No Result Found
'
}
}).bind('typeahead:select',
function (ev, suggestion) {
googleAutocompleteService.fillAddressFieldsByPostalCode(suggestion.place_id, ev, attrs, $(this));
}),
// Note: autocomplete is bydefault set as off(when set from cshtml) which causes chrome to show the addresses which are stored in browser (Bug in chrome as well)
iElement.attr("autocomplete", "nofill");
}
};
}
}]);
;
'use strict';
angular.module('globalErrors', []).config(['$provide', '$httpProvider', '$compileProvider',
function ($provide, $httpProvider, $compileProvider) {
var elementsList = $();
var showMessage = function (content, time) {
$.each(elementsList, function (i, val) { val.empty(); });
$('')
.addClass('alert')
.addClass('error')
.appendTo(elementsList)
.html('
' + content + '
');
};
var isJson = function (inputValue) {
try {
if (inputValue instanceof Object) {
return true;
} else {
var returnObjType = (typeof JSON.parse(inputValue));
if (returnObjType === "int" || returnObjType === "string") {
return false;
}
else {
return true;
}
}
} catch (e) {
return false;
}
};
$provide.factory('globalErrorsInterceptor', ['$q', '$rootScope', 'cartJsLoggingService','initService',
function ($q, $rootScope, cartJsLoggingService,initService) {
var hideMessageAfter = 20000;
return {
'responseError': function (errorResponse) {
if ($rootScope.SuppressGlobalAjaxErrorHandler === true) {
return $q.reject(errorResponse);
}
var errorMessage = isJson(errorResponse.data) ? errorResponse.data.Message : errorResponse.data,
alertMessage = '';
var data = initService.Get();
if (data.netViewModel.CartSummaryViewModel) {
var errorSentence = data.netViewModel.CartSummaryViewModel.HttpErrorMessage;
if (errorSentence) {
var errorMessages = errorSentence.split("|");
var index, len;
var errResponseStatusString = errorResponse.status.toString();
len = errorMessages.length;
for (index = 0; index < len; index++) {
var fullErrorMessage = errorMessages[index];
var errorMsg = fullErrorMessage.split(":");
if (errorMsg[0] == errResponseStatusString) {
alertMessage = errorMsg[1];
break;
}
}
}
}
if (alertMessage) {
showMessage(alertMessage, hideMessageAfter);
cartJsLoggingService.logCustomMessage(alertMessage);
}
return $q.reject(errorResponse);
}
};
}
]);
$httpProvider.interceptors.push('globalErrorsInterceptor');
$compileProvider.directive('appMessages', function () {
var directiveDefinitionObject = {
link: function (scope, element, attrs) { elementsList.push($(element)); }
};
return directiveDefinitionObject;
});
}]);;
(function () {
var logoAnchor = $("a[data-stp-dell-logo]");
// Use commented line below to test without attribute.
//var logoAnchor = $(".navbar-brand a");
if (logoAnchor) {
logoAnchor.on("click", function (e) {
//Ensure there's a modal on the page
if ($("#dellLogoModal").length === 0) { return; }
e.preventDefault();
$("#dellLogoModal").modal('show');
});
}
}());;
/*All cart constants goes here...*/
angular.module('Dell.STP.Cart.Common',[]).constant('cartConstants',
{
TaxCategory: {
CPF : "cpf",
CNPJ : "cnpj",
CNPJTaxFree : "cnpj_tf"
},
ContactType: {
ShippingContact: "ShippingContact"
},
FeatureToggles: {
GetAddressByPostalCodeAvs: "GetAddressByPostalCodeAvs",
HideValidationSummaryInShippingPage: "HideValidationSummaryInShippingPage",
IovationFirstPartyScript: "IovationFirstPartyScript",
ShowSplitPayAsTabs: "ShowSplitPayAsTabs",
BuyAutoPilotEnabled: "BuyAutoPilotEnabled",
ShowRatingsAndReviews: "ShowRatingsAndReviews",
ShowThreeStepProgressBar: "ShowThreeStepProgressBar",
ExpressCheckoutWithFinance: "ExpressCheckoutWithFinance",
EnableBuyZeroSegment: "EnableBuyZeroSegment"
},
PayCode:
{
bitCoin: "BC",
payPal: "PY",
dellBusinessCreditNew: "OO",
dellBusinessCreditExisting: "OP",
purchaseOrder: "PO",
wireTransfer: "WT",
bankTransfer: "BT",
financingAndLease: "FL",
electronicFundsTransfer: "EFT",
dellAdvantageRewards: "EL",
boleto: "CH",
payPalCredit: "PD",
payWithMyBank : "PB",
dellPrefferedAccountNew: "PN",
dellPrefferedAccountExisting: "PP",
creditCard: "CC",
postPay: "ACCT",
boletoGpg: "AB",
pcaasPayNew: "LO",
pcaasPayExisting: "LP",
gPay: "GP",
aPay: "AP"
},
DaIncompatiblePaycodes: [
"BC", //bitCoin
"PO", //purchaseOrder,
"CH", //boleto, // not sure why this was added, need to check if brazil/boleto is required for DA flows
"PB", //payWithMyBank,
"GP", //Gpay
"AP", //Apay
],
CompanyStatus:
{
BEFORE: "FR",
AFTER: "BK"
},
DacomMessage: "dacom_message",
LocationSource: { User: "user", Authenticated: "authenticated", Unauthenticated: "unauthenticated" },
Regex: { OnlyDigitsBeforeDecimal: /[^0-9\.]+/g },
FREE: "FREE",
ClientAlertIds: {
paymentProcessorError: '5'
},
ErrorSeverity: {
error: 0,
warning: 1,
info: 2
},
ErrorCodes: {
googlePayErrorCode: '1512',
applePayErrorCode: '1513',
payWithMyBankError: '1514',
expressCheckoutError: '1515',
eolItemsAlertMessageError: '1516',
googleAutoCompleteError: '1517',
threeDSSecureError: '1518',
CartContentError: '1519'
},
Info: {
ThreeDS: '100',
ShippingContact: '105',
BillingContact: '106',
ReviewPage: '107',
CartContentPage: '109'
},
Warning: {
ThreeDS: '101',
ShippingContact: '102',
BillingContact: '103',
ReviewPage: '108',
CartContentPage: '110'
}
});;
'use strict';
angular.module('globalTracker', []).config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push(['$q',function ($q) {
return {
request: function (config) {
if (!(config.tracker)) {
config.tracker = 'globalTracker';
}
return $q.when(config);
}
};
}]);
}]);;
(function($) {
// @todo Document this.
$.extend($,{ placeholder: {
browser_supported: function() {
return this._supported !== undefined ?
this._supported :
( this._supported = !!('placeholder' in $('')[0]) );
},
shim: function(opts) {
var config = {
color: '#888',
cls: 'placeholder',
selector: 'input[placeholder], textarea[placeholder]'
};
$.extend(config,opts);
!this.browser_supported() && $(config.selector)._placeholder_shim(config);
}
}});
$.extend($.fn,{
_placeholder_shim: function(config) {
function calcPositionCss(target)
{
var op = $(target).offsetParent().offset();
var ot = $(target).offset();
return {
top: ot.top - op.top,
left: ot.left - op.left,
width: $(target).width()
};
}
return this.each(function() {
var $this = $(this);
if( $this.data('placeholder') ) {
var $ol = $this.data('placeholder');
$ol.css(calcPositionCss($this));
return true;
}
var possible_line_height = {};
if( !$this.is('textarea') && $this.css('height') != 'auto') {
possible_line_height = { lineHeight: $this.css('height'), whiteSpace: 'nowrap' };
}
var ol = $('')
.text($this.attr('placeholder'))
.addClass(config.cls)
.css($.extend({
position:'absolute',
display: 'inline',
'float':'none',
overflow:'hidden',
textAlign: 'left',
color: config.color,
cursor: 'text',
paddingTop: $this.css('padding-top'),
paddingRight: $this.css('padding-right'),
paddingBottom: $this.css('padding-bottom'),
paddingLeft: $this.css('padding-left'),
fontSize: $this.css('font-size'),
fontFamily: $this.css('font-family'),
fontStyle: $this.css('font-style'),
fontWeight: $this.css('font-weight'),
textTransform: $this.css('text-transform'),
backgroundColor: 'transparent',
zIndex: 99
}, possible_line_height))
.css(calcPositionCss(this))
.attr('for', this.id)
.data('target',$this)
.click(function(){
$(this).data('target').focus()
})
.insertBefore(this);
$this
.data('placeholder',ol)
.focus(function(){
ol.hide();
}).blur(function() {
ol[$this.val().length ? 'hide' : 'show']();
}).triggerHandler('blur');
$(window)
.resize(function() {
var $target = ol.data('target')
ol.css(calcPositionCss($target))
});
});
}
});
})(jQuery);
jQuery(document).add(window).bind('ready load', function() {
if (jQuery.placeholder) {
jQuery.placeholder.shim();
}
});;
"use strict";angular.module("placeholderShim",[]).directive("placeholder",function(){return jQuery.placeholder.browser_supported()?{}:function(n,t){var r={color:"#888",cls:"placeholder"},i=!1;t.is(":visible")&&(t._placeholder_shim(r),i=!0);n.$watch(function(){if(!i&&t.is(":visible")&&(t._placeholder_shim(r),i=!0),i&&!t.is(":focus")){var n=t.data("placeholder");t.val().length?n.hide():n.show()}})}});
//# sourceMappingURL=angular-placeholder-shim.min.js.map
;
/*
* promise-tracker - v1.3.3 - 2013-04-29
* http://github.com/ajoslin/angular-promise-tracker
* Created by Andy Joslin; Licensed under Public Domain
*/
angular.module('ajoslin.promise-tracker', []);
angular.module('ajoslin.promise-tracker')
/*
* Intercept all http requests that have a `tracker` option in their config,
* and add that http promise to the specified `tracker`
*/
//angular versions before 1.1.4 use responseInterceptor format
.factory('trackerResponseInterceptor', ['$q', 'promiseTracker', '$injector',
function($q, promiseTracker, $injector) {
//We use $injector get around circular dependency problem for $http
var $http;
return function spinnerResponseInterceptor(promise) {
if (!$http) $http = $injector.get('$http'); //lazy-load http
//We know the latest request is always going to be last in the list
var config = $http.pendingRequests[$http.pendingRequests.length-1];
if (config.tracker) {
promiseTracker(config.tracker).addPromise(promise, config);
}
return promise;
};
}])
.factory('trackerHttpInterceptor', ['$q', 'promiseTracker', '$injector',
function($q, promiseTracker, $injector) {
return {
request: function(config) {
if (config.tracker) {
var deferred = promiseTracker(config.tracker).createPromise(config);
config.$promiseTrackerDeferred = deferred;
}
return $q.when(config);
},
response: function(response) {
if (response.config.$promiseTrackerDeferred) {
response.config.$promiseTrackerDeferred.resolve(response);
}
return $q.when(response);
},
responseError: function(response) {
if (response.config.$promiseTrackerDeferred) {
response.config.$promiseTrackerDeferred.reject(response);
}
return $q.reject(response);
}
};
}])
.config(['$httpProvider', function($httpProvider) {
if ($httpProvider.interceptors) {
//Support angularJS 1.1.4: interceptors
$httpProvider.interceptors.push('trackerHttpInterceptor');
} else {
//Support angularJS pre 1.1.4: responseInterceptors
$httpProvider.responseInterceptors.push('trackerResponseInterceptor');
}
}])
;
angular.module('ajoslin.promise-tracker')
.provider('promiseTracker', function() {
/**
* uid(), from angularjs source
*
* A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
* characters such as '012ABC'. The reason why we are not using simply a number counter is that
* the number string gets longer over time, and it can also overflow, where as the nextId
* will grow much slower, it is a string, and it will never overflow.
*
* @returns string unique alpha-numeric string
*/
var uid = ['0','0','0'];
function nextUid() {
var index = uid.length;
var digit;
while(index) {
index--;
digit = uid[index].charCodeAt(0);
if (digit === 57 /*'9'*/) {
uid[index] = 'A';
return uid.join('');
}
if (digit === 90 /*'Z'*/) {
uid[index] = '0';
} else {
uid[index] = String.fromCharCode(digit + 1);
return uid.join('');
}
}
uid.unshift('0');
return uid.join('');
}
var trackers = {};
this.$get = ['$q', '$timeout', function($q, $timeout) {
var self = this;
function Tracker(options) {
options = options || {};
var self = this,
//Define our callback types. The user can catch when a promise starts,
//has an error, is successful, or just is done with error or success.
callbacks = {
start: [], //Start is called when a new promise is added
done: [], //Called when a promise is resolved (error or success)
error: [], //Called on error.
success: [] //Called on success.
},
trackedPromises = [];
//Allow an optional "minimum duration" that the tracker has to stay
//active for. For example, if minimum duration is 1000ms and the user
//adds three promises that all resolve after 650ms, the tracker will
//still count itself as active until 1000ms have passed.
self.setMinDuration = function(minimum) {
self._minDuration = minimum;
};
self.setMinDuration(options.minDuration);
//Allow an option "maximum duration" that the tracker can stay active.
//Ideally, the user would resolve his promises after a certain time to
//achieve this 'maximum duration' option, but there are a few cases
//where it is necessary anyway.
self.setMaxDuration = function(maximum) {
self._maxDuration = maximum;
};
self.setMaxDuration(options.maxDuration);
//## active()
//Returns whether the promiseTracker is active - detect if we're
//currently tracking any promises.
self.active = function() {
return trackedPromises.length > 0;
};
//## cancel()
//Resolves all the current promises, immediately ending the tracker.
self.cancel = function() {
angular.forEach(trackedPromises, function(deferred) {
deferred.resolve();
});
};
//Fire an event bound with #on().
//@param options: {id: uniqueId, event: string, value: someValue}
//Calls registered callbacks for `event` with params (`value`, `id`)
function fireEvent(options) {
angular.forEach(callbacks[options.event], function(cb) {
cb.call(self, options.value, options.id);
});
}
//Create a promise that will make our tracker active until it is resolved.
//@param startArg: params to pass to 'start' event
//@return deferred - our deferred object that is being tracked
function createPromise(startArg) {
//We create our own promise to track. This usually piggybacks on a given
//promise, or we give it back and someone else can resolve it (like
//with the httpResponseInterceptor).
//Using our own promise also lets us do things like cancel early or add
//a minimum duration.
var deferred = $q.defer();
var promiseId = nextUid();
trackedPromises.push(deferred);
fireEvent({
event: 'start',
id: promiseId,
value: startArg
});
//If the tracker was just inactive and this the first in the list of
//promises, we reset our 'minimum duration' and 'maximum duration'
//again.
if (trackedPromises.length === 1) {
if (self._minDuration) {
self.minPromise = $timeout(angular.noop, self._minDuration);
} else {
//No minDuration means we just instantly resolve for our 'wait'
//promise.
self.minPromise = $q.when(true);
}
if (self._maxDuration) {
self.maxPromise = $timeout(deferred.resolve, self._maxDuration);
}
}
//Create a callback for when this promise is done. It will remove our
//tracked promise from the array and call the appropriate event
//callbacks depending on whether there was an error or not.
function onDone(isError) {
return function(value) {
//Before resolving our promise, make sure the minDuration timeout
//has finished.
self.minPromise.then(function() {
fireEvent({
event: isError ? 'error' : 'success',
id: promiseId,
value: value
});
fireEvent({
event: 'done',
id: promiseId,
value: value
});
var index = trackedPromises.indexOf(deferred);
trackedPromises.splice(index, 1);
//If this is the last promise, cleanup the timeout
//for maxDuration so it doesn't stick around.
if (trackedPromises.length === 0 && self.maxPromise) {
$timeout.cancel(self.maxPromise);
}
});
};
}
deferred.promise.then(onDone(false), onDone(true));
return deferred;
}
//## addPromise()
//Adds a given promise to our tracking
self.addPromise = function(promise, startArg) {
var deferred = createPromise(startArg);
//When given promise is done, resolve our created promise
//Allow $then for angular-resource objects
(promise.$then || promise.then)(function success(value) {
deferred.resolve(value);
return value;
}, function error(value) {
deferred.reject(value);
return $q.reject(value);
});
return deferred;
};
//## createPromise()
//Create a new promise and return it, and let the user resolve it how
//they see fit.
self.createPromise = function(startArg) {
return createPromise(startArg);
};
//## on(), bind()
self.on = self.bind = function(event, cb) {
if (!callbacks[event]) {
throw "Cannot create callback for event '" + event +
"'. Allowed types: 'start', 'done', 'error', 'success'";
}
callbacks[event].push(cb);
return self;
};
self.off = self.unbind = function(event, cb) {
if (!callbacks[event]) {
throw "Cannot create callback for event '" + event +
"'. Allowed types: 'start', 'done', 'error', 'success'";
}
if (cb) {
var index = callbacks[event].indexOf(cb);
callbacks[event].splice(index, 1);
} else {
//Erase all events of this type if no cb specified to remvoe
callbacks[event].length = 0;
}
return self;
};
}
return function promiseTracker(trackerName, options) {
if (!trackers[trackerName]) {
trackers[trackerName] = new Tracker(options);
}
return trackers[trackerName];
};
}];
})
;
;
// Based on https://github.com/cgross/angular-busy and http://github.com/ajoslin/angular-promise-tracker
angular.module('cgBusy', ['ajoslin.promise-tracker']);
angular.module('cgBusy')
.directive('cgBusy', ['promiseTracker', "$rootScope",
function (promiseTracker, $rootScope) {
return {
restrict: 'A',
link: function (scope, element, attrs, fn) {
var options = scope.$eval(attrs.cgBusy);
if (typeof options === 'string') {
options = { tracker: options };
}
if (typeof options === 'undefined' || typeof options.tracker === 'undefined') {
options = { tracker: 'globalTracker' };
//throw new Error('Options for cgBusy directive must be provided (tracker option is required).');
}
if (!scope.$cgBusyTracker) {
scope.$cgBusyTracker = {};
}
scope.$cgBusyTracker[options.tracker] = promiseTracker(options.tracker);
function toBoolean(value) {
if (value && value.length !== 0) {
var v = value.toString().toLowerCase();
value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]');
} else {
value = false;
}
return value;
}
scope.$watch('$cgBusyTracker.' + options.tracker + '.active()', function (value) {
//$animate[toBoolean(value) ? 'removeClass' : 'addClass'](templateElement, 'ng-hide');
if (toBoolean(value)) {
$rootScope.loadingScreen.show();
} else {
if (!$rootScope.isPendingRedirect)
$rootScope.loadingScreen.hide();
}
});
}
};
}
]);
/*angular.module("cgBusy").run(["$templateCache", function($templateCache) {
$templateCache.put("angular-busy.html",
"
')
.appendTo($('body'))
.hide();
$rootScope.setWindowLocation = function (url, replace) {
$rootScope.loadingScreen.show();
if (replace) {
window.location.replace(url);
return;
}
window.location.href = url;
};
$scope.smoothScroll = function (hash) {
var href = (!hash) ? $(this).attr('href') : hash;
$('html, body').animate({
scrollTop: $(href).offset().top
}, 500);
};
$scope.Line1DisableRequired = true;
$scope.Line3DisableRequired = true;
$scope.CityDisableRequired = true;
$scope.StateDisbaleRequired = true;
$scope.Line2DisableRequired = true;
$scope.Line4DisableRequired = true;
if (window.location.href.toLowerCase().indexOf("edit") !==-1) {
$scope.Line1DisableRequired = false;
$scope.Line3DisableRequired = false;
$scope.CityDisableRequired = false;
$scope.StateDisbaleRequired = false;
$scope.Line2DisableRequired = false;
$scope.Line4DisableRequired = false;
}
var scrollTimer = null;
$scope.scrollToBtnAndTrigger = function (id, isClick) {
var $btn = $('a[data-target="' + id + '"]');
var idElement = $(id);
if (isClick && idElement.height() <= 0) {
$btn.click();
}
if (isClick) {
if (scrollTimer !== null) window.clearTimeout(scrollTimer);
scrollTimer = window.setTimeout(function () {
$('html, body').animate({
scrollTop: $btn.offset().top
}, 500);
}, 100);
} else if (isClick === false && idElement.height() <= 0) {
idElement.on('shown.bs.collapse', function () {
$('html, body').animate({
scrollTop: $btn.offset().top
}, 500);
});
}
};
$scope.IsDpaUser = Dell.Transactional.isDpaUser();
$scope.closeAndScrollTo = function (btnId, scrollToId) {
var btnIdElement = $(btnId);
if (btnIdElement.height() > 0) {
$('a[data-target="' + btnId + '"]').click();
}
var letMeAnimate = true;
btnIdElement.on('hidden.bs.collapse', function () {
if (letMeAnimate) {
$('html, body').animate({
scrollTop: $(scrollToId).offset().top
}, 500);
}
letMeAnimate = false;
});
};
$scope.showSecurityCodeInformationModal = function () {
$('#securityCodeInfoModal').modal(true);
};
$scope.showEstimatedDeliveryInformationModal = function () {
$('#estimateDeliveryModal').modal(true);
};
$scope.showImportantInformationModal = function () {
$('#importantInfoModal').modal(true);
};
$scope.showTotalPriceBreakdownModal = function () {
$('#totalPriceBreakdownModal').modal(true);
};
$scope.showAmexLearnMoreModal = function () {
$('#amexLearnMore').modal(true);
};
$scope.showSeeDetails = function () {
$('#dfsBanner').modal(true);
};
$scope.showUpiLearnMoreModal = function () {
$('#upiLearnMore').modal(true);
};
$scope.loadOffCanvasRight = function (sidebar, overlay) {
var _sidebar = document.getElementById(sidebar);
var _overlay = document.getElementById(overlay);
if (_sidebar !== null && _overlay !== null) {
_sidebar.style.display = "block";
_overlay.style.display = "block";
}
};
$scope.unLoadOffCanvasRight = function (sidebar, overlay) {
var _sidebar = document.getElementById(sidebar);
var _overlay = document.getElementById(overlay);
if (_sidebar !== null && _overlay !== null) {
_sidebar.style.display = "none";
_overlay.style.display = "none";
}
};
//func to redirect to learn page only
$scope.ComoRedirect = function (url, openNewTab, addOriginUrl) {
var redirectUrl = url;
if (addOriginUrl) {
redirectUrl = url + encodeURIComponent(location.href);
}
if (openNewTab) {
window.open(redirectUrl, "_blank");
return;
}
$rootScope.setWindowLocation(redirectUrl);
};
(function () { // hide placeholder attributes on Win7
if ($('body').hasClass('ie-mobile-7')) {
$('input').removeAttr('placeholder');
}
//console.log($scope.$cgBusyTracker);
})();
}]);
;
/*! =======================================================
VERSION 5.3.1
========================================================= */
/*! =========================================================
* bootstrap-slider.js
*
* Maintainers:
* Kyle Kemp
* - Twitter: @seiyria
* - Github: seiyria
* Rohit Kalkur
* - Twitter: @Rovolutionary
* - Github: rovolution
*
* =========================================================
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function (a, b) { if ("function" == typeof define && define.amd) define(["jquery"], b); else if ("object" == typeof module && module.exports) { var c; try { c = require("jquery") } catch (d) { c = null } module.exports = b(c) } else a.Slider = b(a.jQuery) }(this, function (a) { var b; return function (a) { "use strict"; function b() { } function c(a) { function c(b) { b.prototype.option || (b.prototype.option = function (b) { a.isPlainObject(b) && (this.options = a.extend(!0, this.options, b)) }) } function e(b, c) { a.fn[b] = function (e) { if ("string" == typeof e) { for (var g = d.call(arguments, 1), h = 0, i = this.length; i > h; h++) { var j = this[h], k = a.data(j, b); if (k) if (a.isFunction(k[e]) && "_" !== e.charAt(0)) { var l = k[e].apply(k, g); if (void 0 !== l && l !== k) return l } else f("no such method '" + e + "' for " + b + " instance"); else f("cannot call methods on " + b + " prior to initialization; attempted to call '" + e + "'") } return this } var m = this.map(function () { var d = a.data(this, b); return d ? (d.option(e), d._init()) : (d = new c(this, e), a.data(this, b, d)), a(this) }); return !m || m.length > 1 ? m : m[0] } } if (a) { var f = "undefined" == typeof console ? b : function (a) { console.error(a) }; return a.bridget = function (a, b) { c(b), e(a, b) }, a.bridget } } var d = Array.prototype.slice; c(a) }(a), function (a) { function c(b, c) { function d(a, b) { var c = "data-slider-" + b.replace(/_/g, "-"), d = a.getAttribute(c); try { return JSON.parse(d) } catch (e) { return d } } this._state = { value: null, enabled: null, offset: null, size: null, percentage: null, inDrag: !1, over: !1 }, "string" == typeof b ? this.element = document.querySelector(b) : b instanceof HTMLElement && (this.element = b), c = c ? c : {}; for (var f = Object.keys(this.defaultOptions), g = 0; g < f.length; g++) { var h = f[g], i = c[h]; i = "undefined" != typeof i ? i : d(this.element, h), i = null !== i ? i : this.defaultOptions[h], this.options || (this.options = {}), this.options[h] = i } "vertical" !== this.options.orientation || "top" !== this.options.tooltip_position && "bottom" !== this.options.tooltip_position ? "horizontal" !== this.options.orientation || "left" !== this.options.tooltip_position && "right" !== this.options.tooltip_position || (this.options.tooltip_position = "top") : this.options.tooltip_position = "right"; var j, k, l, m, n, o = this.element.style.width, p = !1, q = this.element.parentNode; if (this.sliderElem) p = !0; else { this.sliderElem = document.createElement("div"), this.sliderElem.className = "slider"; var r = document.createElement("div"); r.className = "slider-track", k = document.createElement("div"), k.className = "slider-track-low", j = document.createElement("div"), j.className = "slider-selection", l = document.createElement("div"), l.className = "slider-track-high", m = document.createElement("div"), m.className = "slider-handle min-slider-handle", m.setAttribute("role", "slider"), m.setAttribute("aria-valuemin", this.options.min), m.setAttribute("aria-valuemax", this.options.max), n = document.createElement("div"), n.className = "slider-handle max-slider-handle", n.setAttribute("role", "slider"), n.setAttribute("aria-valuemin", this.options.min), n.setAttribute("aria-valuemax", this.options.max), r.appendChild(k), r.appendChild(j), r.appendChild(l); var s = Array.isArray(this.options.labelledby); if (s && this.options.labelledby[0] && m.setAttribute("aria-labelledby", this.options.labelledby[0]), s && this.options.labelledby[1] && n.setAttribute("aria-labelledby", this.options.labelledby[1]), !s && this.options.labelledby && (m.setAttribute("aria-labelledby", this.options.labelledby), n.setAttribute("aria-labelledby", this.options.labelledby)), this.ticks = [], Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { for (g = 0; g < this.options.ticks.length; g++) { var t = document.createElement("div"); t.className = "slider-tick", this.ticks.push(t), r.appendChild(t) } j.className += " tick-slider-selection" } if (r.appendChild(m), r.appendChild(n), this.tickLabels = [], Array.isArray(this.options.ticks_labels) && this.options.ticks_labels.length > 0) for (this.tickLabelContainer = document.createElement("div"), this.tickLabelContainer.className = "slider-tick-label-container", g = 0; g < this.options.ticks_labels.length; g++) { var u = document.createElement("div"), v = 0 === this.options.ticks_positions.length, w = this.options.reversed && v ? this.options.ticks_labels.length - (g + 1) : g; u.className = "slider-tick-label", u.innerHTML = this.options.ticks_labels[w], this.tickLabels.push(u), this.tickLabelContainer.appendChild(u) } var x = function (a) { var b = document.createElement("div"); b.className = "tooltip-arrow"; var c = document.createElement("div"); c.className = "tooltip-inner", a.appendChild(b), a.appendChild(c) }, y = document.createElement("div"); y.className = "tooltip tooltip-main", y.setAttribute("role", "presentation"), x(y); var z = document.createElement("div"); z.className = "tooltip tooltip-min", z.setAttribute("role", "presentation"), x(z); var A = document.createElement("div"); A.className = "tooltip tooltip-max", A.setAttribute("role", "presentation"), x(A), this.sliderElem.appendChild(r), this.sliderElem.appendChild(y), this.sliderElem.appendChild(z), this.sliderElem.appendChild(A), this.tickLabelContainer && this.sliderElem.appendChild(this.tickLabelContainer), q.insertBefore(this.sliderElem, this.element), this.element.style.display = "none" } if (a && (this.$element = a(this.element), this.$sliderElem = a(this.sliderElem)), this.eventToCallbackMap = {}, this.sliderElem.id = this.options.id, this.touchCapable = "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch, this.tooltip = this.sliderElem.querySelector(".tooltip-main"), this.tooltipInner = this.tooltip.querySelector(".tooltip-inner"), this.tooltip_min = this.sliderElem.querySelector(".tooltip-min"), this.tooltipInner_min = this.tooltip_min.querySelector(".tooltip-inner"), this.tooltip_max = this.sliderElem.querySelector(".tooltip-max"), this.tooltipInner_max = this.tooltip_max.querySelector(".tooltip-inner"), e[this.options.scale] && (this.options.scale = e[this.options.scale]), p === !0 && (this._removeClass(this.sliderElem, "slider-horizontal"), this._removeClass(this.sliderElem, "slider-vertical"), this._removeClass(this.tooltip, "hide"), this._removeClass(this.tooltip_min, "hide"), this._removeClass(this.tooltip_max, "hide"), ["left", "top", "width", "height"].forEach(function (a) { this._removeProperty(this.trackLow, a), this._removeProperty(this.trackSelection, a), this._removeProperty(this.trackHigh, a) }, this), [this.handle1, this.handle2].forEach(function (a) { this._removeProperty(a, "left"), this._removeProperty(a, "top") }, this), [this.tooltip, this.tooltip_min, this.tooltip_max].forEach(function (a) { this._removeProperty(a, "left"), this._removeProperty(a, "top"), this._removeProperty(a, "margin-left"), this._removeProperty(a, "margin-top"), this._removeClass(a, "right"), this._removeClass(a, "top") }, this)), "vertical" === this.options.orientation ? (this._addClass(this.sliderElem, "slider-vertical"), this.stylePos = "top", this.mousePos = "pageY", this.sizePos = "offsetHeight") : (this._addClass(this.sliderElem, "slider-horizontal"), this.sliderElem.style.width = o, this.options.orientation = "horizontal", this.stylePos = "left", this.mousePos = "pageX", this.sizePos = "offsetWidth"), this._setTooltipPosition(), Array.isArray(this.options.ticks) && this.options.ticks.length > 0 && (this.options.max = Math.max.apply(Math, this.options.ticks), this.options.min = Math.min.apply(Math, this.options.ticks)), Array.isArray(this.options.value) ? (this.options.range = !0, this._state.value = this.options.value) : this.options.range ? this._state.value = [this.options.value, this.options.max] : this._state.value = this.options.value, this.trackLow = k || this.trackLow, this.trackSelection = j || this.trackSelection, this.trackHigh = l || this.trackHigh, "none" === this.options.selection && (this._addClass(this.trackLow, "hide"), this._addClass(this.trackSelection, "hide"), this._addClass(this.trackHigh, "hide")), this.handle1 = m || this.handle1, this.handle2 = n || this.handle2, p === !0) for (this._removeClass(this.handle1, "round triangle"), this._removeClass(this.handle2, "round triangle hide"), g = 0; g < this.ticks.length; g++) this._removeClass(this.ticks[g], "round triangle hide"); var B = ["round", "triangle", "custom"], C = -1 !== B.indexOf(this.options.handle); if (C) for (this._addClass(this.handle1, this.options.handle), this._addClass(this.handle2, this.options.handle), g = 0; g < this.ticks.length; g++) this._addClass(this.ticks[g], this.options.handle); this._state.offset = this._offset(this.sliderElem), this._state.size = this.sliderElem[this.sizePos], this.setValue(this._state.value), this.handle1Keydown = this._keydown.bind(this, 0), this.handle1.addEventListener("keydown", this.handle1Keydown, !1), this.handle2Keydown = this._keydown.bind(this, 1), this.handle2.addEventListener("keydown", this.handle2Keydown, !1), this.mousedown = this._mousedown.bind(this), this.touchCapable && this.sliderElem.addEventListener("touchstart", this.mousedown, !1), this.sliderElem.addEventListener("mousedown", this.mousedown, !1), "hide" === this.options.tooltip ? (this._addClass(this.tooltip, "hide"), this._addClass(this.tooltip_min, "hide"), this._addClass(this.tooltip_max, "hide")) : "always" === this.options.tooltip ? (this._showTooltip(), this._alwaysShowTooltip = !0) : (this.showTooltip = this._showTooltip.bind(this), this.hideTooltip = this._hideTooltip.bind(this), this.sliderElem.addEventListener("mouseenter", this.showTooltip, !1), this.sliderElem.addEventListener("mouseleave", this.hideTooltip, !1), this.handle1.addEventListener("focus", this.showTooltip, !1), this.handle1.addEventListener("blur", this.hideTooltip, !1), this.handle2.addEventListener("focus", this.showTooltip, !1), this.handle2.addEventListener("blur", this.hideTooltip, !1)), this.options.enabled ? this.enable() : this.disable() } var d = { formatInvalidInputErrorMsg: function (a) { return "Invalid input value '" + a + "' passed in" }, callingContextNotSliderInstance: "Calling context element does not have instance of Slider bound to it. Check your code to make sure the JQuery object returned from the call to the slider() initializer is calling the method" }, e = { linear: { toValue: function (a) { var b = a / 100 * (this.options.max - this.options.min); if (this.options.ticks_positions.length > 0) { for (var c, d, e, f = 0, g = 0; g < this.options.ticks_positions.length; g++) if (a <= this.options.ticks_positions[g]) { c = g > 0 ? this.options.ticks[g - 1] : 0, e = g > 0 ? this.options.ticks_positions[g - 1] : 0, d = this.options.ticks[g], f = this.options.ticks_positions[g]; break } if (g > 0) { var h = (a - e) / (f - e); b = c + h * (d - c) } } var i = this.options.min + Math.round(b / this.options.step) * this.options.step; return i < this.options.min ? this.options.min : i > this.options.max ? this.options.max : i }, toPercentage: function (a) { if (this.options.max === this.options.min) return 0; if (this.options.ticks_positions.length > 0) { for (var b, c, d, e = 0, f = 0; f < this.options.ticks.length; f++) if (a <= this.options.ticks[f]) { b = f > 0 ? this.options.ticks[f - 1] : 0, d = f > 0 ? this.options.ticks_positions[f - 1] : 0, c = this.options.ticks[f], e = this.options.ticks_positions[f]; break } if (f > 0) { var g = (a - b) / (c - b); return d + g * (e - d) } } return 100 * (a - this.options.min) / (this.options.max - this.options.min) } }, logarithmic: { toValue: function (a) { var b = 0 === this.options.min ? 0 : Math.log(this.options.min), c = Math.log(this.options.max), d = Math.exp(b + (c - b) * a / 100); return d = this.options.min + Math.round((d - this.options.min) / this.options.step) * this.options.step, d < this.options.min ? this.options.min : d > this.options.max ? this.options.max : d }, toPercentage: function (a) { if (this.options.max === this.options.min) return 0; var b = Math.log(this.options.max), c = 0 === this.options.min ? 0 : Math.log(this.options.min), d = 0 === a ? 0 : Math.log(a); return 100 * (d - c) / (b - c) } } }; if (b = function (a, b) { return c.call(this, a, b), this }, b.prototype = { _init: function () { }, constructor: b, defaultOptions: { id: "", min: 0, max: 10, step: 1, precision: 0, orientation: "horizontal", value: 5, range: !1, selection: "before", tooltip: "show", tooltip_split: !1, handle: "round", reversed: !1, enabled: !0, formatter: function (a) { return Array.isArray(a) ? a[0] + " : " + a[1] : a }, natural_arrow_keys: !1, ticks: [], ticks_positions: [], ticks_labels: [], ticks_snap_bounds: 0, scale: "linear", focus: !1, tooltip_position: null, labelledby: null }, getElement: function () { return this.sliderElem }, getValue: function () { return this.options.range ? this._state.value : this._state.value[0] }, setValue: function (a, b, c) { a || (a = 0); var d = this.getValue(); this._state.value = this._validateInputValue(a); var e = this._applyPrecision.bind(this); this.options.range ? (this._state.value[0] = e(this._state.value[0]), this._state.value[1] = e(this._state.value[1]), this._state.value[0] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[0])), this._state.value[1] = Math.max(this.options.min, Math.min(this.options.max, this._state.value[1]))) : (this._state.value = e(this._state.value), this._state.value = [Math.max(this.options.min, Math.min(this.options.max, this._state.value))], this._addClass(this.handle2, "hide"), "after" === this.options.selection ? this._state.value[1] = this.options.max : this._state.value[1] = this.options.min), this.options.max > this.options.min ? this._state.percentage = [this._toPercentage(this._state.value[0]), this._toPercentage(this._state.value[1]), 100 * this.options.step / (this.options.max - this.options.min)] : this._state.percentage = [0, 0, 100], this._layout(); var f = this.options.range ? this._state.value : this._state.value[0]; return b === !0 && this._trigger("slide", f), d !== f && c === !0 && this._trigger("change", { oldValue: d, newValue: f }), this._setDataVal(f), this }, destroy: function () { this._removeSliderEventHandlers(), this.sliderElem.parentNode.removeChild(this.sliderElem), this.element.style.display = "", this._cleanUpEventCallbacksMap(), this.element.removeAttribute("data"), a && (this._unbindJQueryEventHandlers(), this.$element.removeData("slider")) }, disable: function () { return this._state.enabled = !1, this.handle1.removeAttribute("tabindex"), this.handle2.removeAttribute("tabindex"), this._addClass(this.sliderElem, "slider-disabled"), this._trigger("slideDisabled"), this }, enable: function () { return this._state.enabled = !0, this.handle1.setAttribute("tabindex", 0), this.handle2.setAttribute("tabindex", 0), this._removeClass(this.sliderElem, "slider-disabled"), this._trigger("slideEnabled"), this }, toggle: function () { return this._state.enabled ? this.disable() : this.enable(), this }, isEnabled: function () { return this._state.enabled }, on: function (a, b) { return this._bindNonQueryEventHandler(a, b), this }, off: function (b, c) { a ? (this.$element.off(b, c), this.$sliderElem.off(b, c)) : this._unbindNonQueryEventHandler(b, c) }, getAttribute: function (a) { return a ? this.options[a] : this.options }, setAttribute: function (a, b) { return this.options[a] = b, this }, refresh: function () { return this._removeSliderEventHandlers(), c.call(this, this.element, this.options), a && a.data(this.element, "slider", this), this }, relayout: function () { return this._layout(), this }, _removeSliderEventHandlers: function () { this.handle1.removeEventListener("keydown", this.handle1Keydown, !1), this.handle2.removeEventListener("keydown", this.handle2Keydown, !1), this.showTooltip && (this.handle1.removeEventListener("focus", this.showTooltip, !1), this.handle2.removeEventListener("focus", this.showTooltip, !1)), this.hideTooltip && (this.handle1.removeEventListener("blur", this.hideTooltip, !1), this.handle2.removeEventListener("blur", this.hideTooltip, !1)), this.showTooltip && this.sliderElem.removeEventListener("mouseenter", this.showTooltip, !1), this.hideTooltip && this.sliderElem.removeEventListener("mouseleave", this.hideTooltip, !1), this.sliderElem.removeEventListener("touchstart", this.mousedown, !1), this.sliderElem.removeEventListener("mousedown", this.mousedown, !1) }, _bindNonQueryEventHandler: function (a, b) { void 0 === this.eventToCallbackMap[a] && (this.eventToCallbackMap[a] = []), this.eventToCallbackMap[a].push(b) }, _unbindNonQueryEventHandler: function (a, b) { var c = this.eventToCallbackMap[a]; if (void 0 !== c) for (var d = 0; d < c.length; d++) if (c[d] === b) { c.splice(d, 1); break } }, _cleanUpEventCallbacksMap: function () { for (var a = Object.keys(this.eventToCallbackMap), b = 0; b < a.length; b++) { var c = a[b]; this.eventToCallbackMap[c] = null } }, _showTooltip: function () { this.options.tooltip_split === !1 ? (this._addClass(this.tooltip, "in"), this.tooltip_min.style.display = "none", this.tooltip_max.style.display = "none") : (this._addClass(this.tooltip_min, "in"), this._addClass(this.tooltip_max, "in"), this.tooltip.style.display = "none"), this._state.over = !0 }, _hideTooltip: function () { this._state.inDrag === !1 && this.alwaysShowTooltip !== !0 && (this._removeClass(this.tooltip, "in"), this._removeClass(this.tooltip_min, "in"), this._removeClass(this.tooltip_max, "in")), this._state.over = !1 }, _layout: function () { var a; if (a = this.options.reversed ? [100 - this._state.percentage[0], this.options.range ? 100 - this._state.percentage[1] : this._state.percentage[1]] : [this._state.percentage[0], this._state.percentage[1]], this.handle1.style[this.stylePos] = a[0] + "%", this.handle1.setAttribute("aria-valuenow", this._state.value[0]), this.handle2.style[this.stylePos] = a[1] + "%", this.handle2.setAttribute("aria-valuenow", this._state.value[1]), Array.isArray(this.options.ticks) && this.options.ticks.length > 0) { var b = "vertical" === this.options.orientation ? "height" : "width", c = "vertical" === this.options.orientation ? "marginTop" : "marginLeft", d = this._state.size / (this.options.ticks.length - 1); if (this.tickLabelContainer) { var e = 0; if (0 === this.options.ticks_positions.length) "vertical" !== this.options.orientation && (this.tickLabelContainer.style[c] = -d / 2 + "px"), e = this.tickLabelContainer.offsetHeight; else for (f = 0; f < this.tickLabelContainer.childNodes.length; f++) this.tickLabelContainer.childNodes[f].offsetHeight > e && (e = this.tickLabelContainer.childNodes[f].offsetHeight); "horizontal" === this.options.orientation && (this.sliderElem.style.marginBottom = e + "px") } for (var f = 0; f < this.options.ticks.length; f++) { var g = this.options.ticks_positions[f] || this._toPercentage(this.options.ticks[f]); this.options.reversed && (g = 100 - g), this.ticks[f].style[this.stylePos] = g + "%", this._removeClass(this.ticks[f], "in-selection"), this.options.range ? g >= a[0] && g <= a[1] && this._addClass(this.ticks[f], "in-selection") : "after" === this.options.selection && g >= a[0] ? this._addClass(this.ticks[f], "in-selection") : "before" === this.options.selection && g <= a[0] && this._addClass(this.ticks[f], "in-selection"), this.tickLabels[f] && (this.tickLabels[f].style[b] = d + "px", "vertical" !== this.options.orientation && void 0 !== this.options.ticks_positions[f] ? (this.tickLabels[f].style.position = "absolute", this.tickLabels[f].style[this.stylePos] = g + "%", this.tickLabels[f].style[c] = -d / 2 + "px") : "vertical" === this.options.orientation && (this.tickLabels[f].style.marginLeft = this.sliderElem.offsetWidth + "px", this.tickLabelContainer.style.marginTop = this.sliderElem.offsetWidth / 2 * -1 + "px")) } } var h; if (this.options.range) { h = this.options.formatter(this._state.value), this._setText(this.tooltipInner, h), this.tooltip.style[this.stylePos] = (a[1] + a[0]) / 2 + "%", "vertical" === this.options.orientation ? this._css(this.tooltip, "margin-top", -this.tooltip.offsetHeight / 2 + "px") : this._css(this.tooltip, "margin-left", -this.tooltip.offsetWidth / 2 + "px"), "vertical" === this.options.orientation ? this._css(this.tooltip, "margin-top", -this.tooltip.offsetHeight / 2 + "px") : this._css(this.tooltip, "margin-left", -this.tooltip.offsetWidth / 2 + "px"); var i = this.options.formatter(this._state.value[0]); this._setText(this.tooltipInner_min, i); var j = this.options.formatter(this._state.value[1]); this._setText(this.tooltipInner_max, j), this.tooltip_min.style[this.stylePos] = a[0] + "%", "vertical" === this.options.orientation ? this._css(this.tooltip_min, "margin-top", -this.tooltip_min.offsetHeight / 2 + "px") : this._css(this.tooltip_min, "margin-left", -this.tooltip_min.offsetWidth / 2 + "px"), this.tooltip_max.style[this.stylePos] = a[1] + "%", "vertical" === this.options.orientation ? this._css(this.tooltip_max, "margin-top", -this.tooltip_max.offsetHeight / 2 + "px") : this._css(this.tooltip_max, "margin-left", -this.tooltip_max.offsetWidth / 2 + "px") } else h = this.options.formatter(this._state.value[0]), this._setText(this.tooltipInner, h), this.tooltip.style[this.stylePos] = a[0] + "%", "vertical" === this.options.orientation ? this._css(this.tooltip, "margin-top", -this.tooltip.offsetHeight / 2 + "px") : this._css(this.tooltip, "margin-left", -this.tooltip.offsetWidth / 2 + "px"); if ("vertical" === this.options.orientation) this.trackLow.style.top = "0", this.trackLow.style.height = Math.min(a[0], a[1]) + "%", this.trackSelection.style.top = Math.min(a[0], a[1]) + "%", this.trackSelection.style.height = Math.abs(a[0] - a[1]) + "%", this.trackHigh.style.bottom = "0", this.trackHigh.style.height = 100 - Math.min(a[0], a[1]) - Math.abs(a[0] - a[1]) + "%"; else { this.trackLow.style.left = "0", this.trackLow.style.width = Math.min(a[0], a[1]) + "%", this.trackSelection.style.left = Math.min(a[0], a[1]) + "%", this.trackSelection.style.width = Math.abs(a[0] - a[1]) + "%", this.trackHigh.style.right = "0", this.trackHigh.style.width = 100 - Math.min(a[0], a[1]) - Math.abs(a[0] - a[1]) + "%"; var k = this.tooltip_min.getBoundingClientRect(), l = this.tooltip_max.getBoundingClientRect(); k.right > l.left ? (this._removeClass(this.tooltip_max, "top"), this._addClass(this.tooltip_max, "bottom"), this.tooltip_max.style.top = "18px") : (this._removeClass(this.tooltip_max, "bottom"), this._addClass(this.tooltip_max, "top"), this.tooltip_max.style.top = this.tooltip_min.style.top) } }, _removeProperty: function (a, b) { a.style.removeProperty ? a.style.removeProperty(b) : a.style.removeAttribute(b) }, _mousedown: function (a) { if (!this._state.enabled) return !1; this._state.offset = this._offset(this.sliderElem), this._state.size = this.sliderElem[this.sizePos]; var b = this._getPercentage(a); if (this.options.range) { var c = Math.abs(this._state.percentage[0] - b), d = Math.abs(this._state.percentage[1] - b); this._state.dragged = d > c ? 0 : 1 } else this._state.dragged = 0; this._state.percentage[this._state.dragged] = b, this._layout(), this.touchCapable && (document.removeEventListener("touchmove", this.mousemove, !1), document.removeEventListener("touchend", this.mouseup, !1)), this.mousemove && document.removeEventListener("mousemove", this.mousemove, !1), this.mouseup && document.removeEventListener("mouseup", this.mouseup, !1), this.mousemove = this._mousemove.bind(this), this.mouseup = this._mouseup.bind(this), this.touchCapable && (document.addEventListener("touchmove", this.mousemove, !1), document.addEventListener("touchend", this.mouseup, !1)), document.addEventListener("mousemove", this.mousemove, !1), document.addEventListener("mouseup", this.mouseup, !1), this._state.inDrag = !0; var e = this._calculateValue(); return this._trigger("slideStart", e), this._setDataVal(e), this.setValue(e, !1, !0), this._pauseEvent(a), this.options.focus && this._triggerFocusOnHandle(this._state.dragged), !0 }, _triggerFocusOnHandle: function (a) { 0 === a && this.handle1.focus(), 1 === a && this.handle2.focus() }, _keydown: function (a, b) { if (!this._state.enabled) return !1; var c; switch (b.keyCode) { case 37: case 40: c = -1; break; case 39: case 38: c = 1 } if (c) { if (this.options.natural_arrow_keys) { var d = "vertical" === this.options.orientation && !this.options.reversed, e = "horizontal" === this.options.orientation && this.options.reversed; (d || e) && (c = -c) } var f = this._state.value[a] + c * this.options.step; return this.options.range && (f = [a ? this._state.value[0] : f, a ? f : this._state.value[1]]), this._trigger("slideStart", f), this._setDataVal(f), this.setValue(f, !0, !0), this._setDataVal(f), this._trigger("slideStop", f), this._layout(), this._pauseEvent(b), !1 } }, _pauseEvent: function (a) { a.stopPropagation && a.stopPropagation(), a.preventDefault && a.preventDefault(), a.cancelBubble = !0, a.returnValue = !1 }, _mousemove: function (a) { if (!this._state.enabled) return !1; var b = this._getPercentage(a); this._adjustPercentageForRangeSliders(b), this._state.percentage[this._state.dragged] = b, this._layout(); var c = this._calculateValue(!0); return this.setValue(c, !0, !0), !1 }, _adjustPercentageForRangeSliders: function (a) { if (this.options.range) { var b = this._getNumDigitsAfterDecimalPlace(a); b = b ? b - 1 : 0; var c = this._applyToFixedAndParseFloat(a, b); 0 === this._state.dragged && this._applyToFixedAndParseFloat(this._state.percentage[1], b) < c ? (this._state.percentage[0] = this._state.percentage[1], this._state.dragged = 1) : 1 === this._state.dragged && this._applyToFixedAndParseFloat(this._state.percentage[0], b) > c && (this._state.percentage[1] = this._state.percentage[0], this._state.dragged = 0) } }, _mouseup: function () { if (!this._state.enabled) return !1; this.touchCapable && (document.removeEventListener("touchmove", this.mousemove, !1), document.removeEventListener("touchend", this.mouseup, !1)), document.removeEventListener("mousemove", this.mousemove, !1), document.removeEventListener("mouseup", this.mouseup, !1), this._state.inDrag = !1, this._state.over === !1 && this._hideTooltip(); var a = this._calculateValue(!0); return this._layout(), this._setDataVal(a), this._trigger("slideStop", a), !1 }, _calculateValue: function (a) { var b; if (this.options.range ? (b = [this.options.min, this.options.max], 0 !== this._state.percentage[0] && (b[0] = this._toValue(this._state.percentage[0]), b[0] = this._applyPrecision(b[0])), 100 !== this._state.percentage[1] && (b[1] = this._toValue(this._state.percentage[1]), b[1] = this._applyPrecision(b[1]))) : (b = this._toValue(this._state.percentage[0]), b = parseFloat(b), b = this._applyPrecision(b)), a) { for (var c = [b, 1 / 0], d = 0; d < this.options.ticks.length; d++) { var e = Math.abs(this.options.ticks[d] - b); e <= c[1] && (c = [this.options.ticks[d], e]) } if (c[1] <= this.options.ticks_snap_bounds) return c[0] } return b }, _applyPrecision: function (a) { var b = this.options.precision || this._getNumDigitsAfterDecimalPlace(this.options.step); return this._applyToFixedAndParseFloat(a, b) }, _getNumDigitsAfterDecimalPlace: function (a) { var b = ("" + a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); return b ? Math.max(0, (b[1] ? b[1].length : 0) - (b[2] ? +b[2] : 0)) : 0 }, _applyToFixedAndParseFloat: function (a, b) { var c = a.toFixed(b); return parseFloat(c) }, _getPercentage: function (a) { !this.touchCapable || "touchstart" !== a.type && "touchmove" !== a.type || (a = a.touches[0]); var b = a[this.mousePos], c = this._state.offset[this.stylePos], d = b - c, e = d / this._state.size * 100; return e = Math.round(e / this._state.percentage[2]) * this._state.percentage[2], this.options.reversed && (e = 100 - e), Math.max(0, Math.min(100, e)) }, _validateInputValue: function (a) { if ("number" == typeof a) return a; if (Array.isArray(a)) return this._validateArray(a), a; throw new Error(d.formatInvalidInputErrorMsg(a)) }, _validateArray: function (a) { for (var b = 0; b < a.length; b++) { var c = a[b]; if ("number" != typeof c) throw new Error(d.formatInvalidInputErrorMsg(c)) } }, _setDataVal: function (a) { this.element.setAttribute("data-value", a), this.element.setAttribute("value", a), this.element.value = a }, _trigger: function (b, c) { c = c || 0 === c ? c : void 0; var d = this.eventToCallbackMap[b]; if (d && d.length) for (var e = 0; e < d.length; e++) { var f = d[e]; f(c) } a && this._triggerJQueryEvent(b, c) }, _triggerJQueryEvent: function (a, b) { var c = { type: a, value: b }; this.$element.trigger(c), this.$sliderElem.trigger(c) }, _unbindJQueryEventHandlers: function () { this.$element.off(), this.$sliderElem.off() }, _setText: function (a, b) { "undefined" != typeof a.innerText ? a.innerText = b : "undefined" != typeof a.textContent && (a.textContent = b) }, _removeClass: function (a, b) { for (var c = b.split(" "), d = a.className, e = 0; e < c.length; e++) { var f = c[e], g = new RegExp("(?:\\s|^)" + f + "(?:\\s|$)"); d = d.replace(g, " ") } a.className = d.trim() }, _addClass: function (a, b) { for (var c = b.split(" "), d = a.className, e = 0; e < c.length; e++) { var f = c[e], g = new RegExp("(?:\\s|^)" + f + "(?:\\s|$)"), h = g.test(d); h || (d += " " + f) } a.className = d.trim() }, _offsetLeft: function (a) { return a.getBoundingClientRect().left }, _offsetTop: function (a) { for (var b = a.offsetTop; (a = a.offsetParent) && !isNaN(a.offsetTop) ;) b += a.offsetTop; return b }, _offset: function (a) { return { left: this._offsetLeft(a), top: this._offsetTop(a) } }, _css: function (b, c, d) { if (a) a.style(b, c, d); else { var e = c.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function (a, b) { return b.toUpperCase() }); b.style[e] = d } }, _toValue: function (a) { return this.options.scale.toValue.apply(this, [a]) }, _toPercentage: function (a) { return this.options.scale.toPercentage.apply(this, [a]) }, _setTooltipPosition: function () { var a = [this.tooltip, this.tooltip_min, this.tooltip_max]; if ("vertical" === this.options.orientation) { var b = this.options.tooltip_position || "right", c = "left" === b ? "right" : "left"; a.forEach(function (a) { this._addClass(a, b), a.style[c] = "100%" }.bind(this)) } else "bottom" === this.options.tooltip_position ? a.forEach(function (a) { this._addClass(a, "bottom"), a.style.top = "22px" }.bind(this)) : a.forEach(function (a) { this._addClass(a, "top"), a.style.top = -this.tooltip.outerHeight - 14 + "px" }.bind(this)) } }, a) { var f = a.fn.slider ? "bootstrapSlider" : "slider"; a.bridget(f, b) } }(a), b });;
var app;
if (typeof cartApp != "undefined") {
app = cartApp;
} else if (typeof shopApp != "undefined") {
app = shopApp;
}
app.service("financeCalculatorService", ["$location", function ($location) {
var $this = this;
$this.dfsModel = {};
$this.isDFSContentLoaded = "";
$this.isDFSError = "";
$this.ErrorMessage = "";
$this.setHeight = function () {
var height = $(window).innerHeight() * .8;
$('#dfs-modal').css('max-height', height);
}
}]);
;
var app;
if (typeof cartApp != "undefined") {
app = cartApp;
} else if (typeof shopApp != "undefined") {
app = shopApp;
}
app.controller('financeCalculatorController', ['$scope', 'financeCalculatorService', function ($scope, financeCalculatorService) {
var defaultRate = "24.99";
var defaultAdditionalPayment = "50.0";
var minimumPayment = "0.0";
$scope.init = function () {
$scope.showLoading = true;
$scope.$watch(function () {
return financeCalculatorService.dfsModel;
}, function (newVal, oldVal) {
if (typeof newVal !== 'undefined') {
$scope.dfsModel = financeCalculatorService.dfsModel;
if (typeof $scope.dfsModel.Schedule !== 'undefined') {
$scope.interestRatesMaxCount = Object.keys($scope.dfsModel.Schedule[minimumPayment]).length - 1;
$scope.interestRates = Object.keys($scope.dfsModel.Schedule[minimumPayment])
.map(function (key) { return Number(key) });
} else {
$scope.interestRatesMaxCount = 11;
$scope.interestRates = [19.74, 19.99, 20.99, 21.99, 22.99, 23.99, 24.99, 25.99, 26.99, 27.99, 28.99, 29.99];
}
if ($(window).innerWidth() > 767) {
financeCalculatorService.setHeight();
}
if (typeof $scope.dfsModel.Content !== 'undefined') {
if ($scope.dfsModel.ShowCustomInterestRateSlider) {
$scope.showCustomInterestRateSlider();
}
$scope.calculateFieldValues();
$scope.showLoading = false;
$scope.waitForFinalEvent(function() {
angular.element("#shopCalculator").slider('refresh');
}, 10, $scope.fullDateString.getTime());
}
}
});
};
$scope.showCustomInterestRateSlider = function () {
var r = angular.element('#shopCalculatorSlider').slider({
max: $scope.interestRatesMaxCount,
min: 0,
step: 1,
value: 6,
precision: 2,
handle: 'custom',
tooltip: 'always',
formatter: function (val) {
var ir = $scope.interestRates[val];
angular.element('#shopCalculator').val(ir);
return ir + '%';
}
});
};
$scope.calculateFieldValues = function () {
$scope.getAdditionalDD();
$scope.getSubTotal();
$scope.getMinimumValues();
$scope.getAdditionalValues();
};
$scope.getRedirectUrl = function (url) {
var returnUrl = encodeURIComponent(window.location.href);
var newUrl = (url.indexOf("returnurl=") > -1) ?
url + returnUrl
: url.replace("returnurl%3d", "returnurl%3d" + encodeURIComponent(returnUrl));
window.location.href = newUrl;
};
$scope.getAdditionalDD = function () {
$scope.dropDownOptions = [];
if (typeof $scope.dfsModel.Content !== 'undefined') {
angular.forEach($scope.dfsModel.Content.AdditionalPaymentOptions, function (option) {
var dropdown = {};
dropdown.Label = option.DisplayText;
dropdown.Key = option.Value;
$scope.dropDownOptions.push(dropdown);
});
$scope.selectedTitle = $scope.dropDownOptions[2];
}
};
$scope.getSubTotal = function () {
if (typeof $scope.dfsModel.FinancedAmountDisplay !== 'undefined') {
var subtotal = $scope.dfsModel.FinancedAmountDisplay.split('$');
$scope.dfsModel.subTotalString = subtotal[1];
}
};
$scope.getMinimumValues = function () {
$scope.getMinimumPaymentValues(defaultRate);
};
$scope.getAdditionalValues = function () {
$scope.getAdditionalPaymentValues(defaultAdditionalPayment, defaultRate);
};
$scope.updateAdditionalPayments = function (percentage) {
var amount = $scope.selectedTitle.Key.toString() + ".0";
$scope.getAdditionalPaymentValues(amount, percentage);
};
$scope.updatePayments = function (percentage) {
if (typeof percentage == 'undefined') {
percentage = angular.element("#shopCalculator")[0].value;
}
if ($scope.dfsModel.ShowCustomInterestRateSlider) {
if ($.isNumeric(percentage) && $scope.interestRates.indexOf(parseFloat(percentage)) === -1) {
percentage = defaultRate;
}
}
$scope.getMinimumPaymentValues(percentage);
$scope.updateAdditionalPayments(percentage);
};
$scope.getMinimumPaymentValues = function (percentage) {
if (typeof $scope.dfsModel.Schedule !== 'undefined') {
var rewardsString = $scope.dfsModel.Content.ChartRewardsFormat;
$scope.dfsModel.minimumMonthlyPayment = $scope.dfsModel.Schedule[minimumPayment][percentage].FormattedMinimumPayment;
$scope.dfsModel.minimumPayoffTerm = $scope.dfsModel.Schedule[minimumPayment][percentage].PayoffTerm;
$scope.dfsModel.minimumTotalInterest = $scope.dfsModel.Schedule[minimumPayment][percentage].FormattedFinalAmount;
$scope.dfsModel.minimumRewards = rewardsString.format($scope.dfsModel.Schedule[minimumPayment][percentage].Rewards);
}
};
$scope.getAdditionalPaymentValues = function (amount, percentage) {
if (typeof $scope.dfsModel.Schedule !== 'undefined') {
var rewardsString = $scope.dfsModel.Content.ChartRewardsFormat;
$scope.dfsModel.additionalMonthlyPayment = $scope.dfsModel.Schedule[amount][percentage].FormattedMinimumPayment;
$scope.dfsModel.additionalPayoffTerm = $scope.dfsModel.Schedule[amount][percentage].PayoffTerm;
$scope.dfsModel.additionalTotalInterest = $scope.dfsModel.Schedule[amount][percentage].FormattedFinalAmount;
$scope.dfsModel.additionalRewards = rewardsString.format($scope.dfsModel.Schedule[amount][percentage].Rewards);
}
};
$scope.waitForFinalEvent = function () {
var b = {};
return function (c, d, a) {
b[a] && clearTimeout(b[a]);
b[a] = setTimeout(c, d);
};
}();
$scope.fullDateString = new Date();
angular.element("#shopCalculator").slider({
formatter: function(value) {
return value + '%';
},
tooltip: 'always',
precision: 2
});
angular.element(document).on('click', '#dfs-modal button.close', function () {
$scope.showLoading = true;
if ($scope.dfsModel.ShowCustomInterestRateSlider) {
$('#shopCalculatorSlider').slider('refresh');
}
});
}]);
;
var app;
if (typeof cartApp != "undefined") {
app = cartApp;
} else if (typeof shopApp != "undefined") {
app = shopApp;
}
app.factory('httpGetService', ["$http", function ($http) {
return {
getData: function (requestUrl) {
return $http({
url: requestUrl,
method: 'GET'
});
}
};
}]);
app.controller('financeStackController', ['$scope', 'httpGetService', '$rootScope', 'financeCalculatorService', function ($scope, httpGetService, $rootScope, financeCalculatorService) {
var dfsRequestUrl = '{0}financeschedule/getCalculator?financedPrice={1}';
$scope.init = function (apiUrl) {
$scope.apiUrl = apiUrl;
};
$scope.loadDFSContent = function (itemPrice) {
var dfsInputEle;
if ($('.dfs-input-value').length > 0) {
dfsInputEle = $('.dfs-input-value').get(0);
}
$scope.apiUrl = (typeof serverUrls != "undefined") ? serverUrls.apiServiceUrl : $scope.apiUrl;
var dfsInputVal = typeof dfsInputEle == "undefined" ? itemPrice : $(dfsInputEle).data('dfs-input');
httpGetService.getData(dfsRequestUrl.format($scope.apiUrl, dfsInputVal)).then(function onSuccess(response) {
var data = response.data;
financeCalculatorService.dfsModel = data;
financeCalculatorService.dfsModel.isDFSContentLoaded = true;
financeCalculatorService.dfsModel.isDFSError = false;
}, function onError(response) {
var e = response.data;
financeCalculatorService.dfsModel.isDFSContentLoaded = false;
financeCalculatorService.dfsModel.isDFSError = true;
financeCalculatorService.dfsModel.ErrorMessage = e.Message;
});
};
$scope.buildRedirectUrl = function (url) {
var returnUrl = encodeURIComponent(window.location.href);
var newUrl = (url.indexOf("returnurl=") > -1) ?
url + returnUrl
: url.replace("returnurl%3d", "returnurl%3d" + encodeURIComponent(returnUrl));
window.location.href = newUrl;
};
}]);
;
angular
.module("Dell.STP.Common.OffCanvas", [])
.service("offCanvasService", ['$route', '$location', '$rootScope', 'featureService', function ($route, $location, $rootScope, featureService) {
var internalFunc = function () { };
var makesServerReq = false;
return {
setFunc: function (passedFunc) { internalFunc = passedFunc; },
getFunc: function () { return internalFunc; },
getMakesServerReq: function () { return makesServerReq; },
setMakesServerReq: function (value) { return makesServerReq = value; },
resetLocation: function () {
if (window.location.hash.indexOf('#!/offcanvas/') !== -1) {
window.location.hash = "#"; // this is required for ie, chrome and all work without hash
// $route.reload();
$location.path("");
$location.replace();
return true;
}
return false;
},
show: function (path) {
window.scroll(0, 0);
$location.path('/offcanvas/' + path);
},
disable: function() {
$rootScope.disableOffCanvasNgView = true;
},
checkEncodeURI: function () {
if ($location.path().indexOf("/offcanvas") === 0) {
var url = $location.path().replace("/offcanvas/", "");
var decoded = decodeURIComponent(unescape(url))
return !(decoded == url);
}
return false;
}
};
}])
.directive("dellOffCanvas", ['$route', 'offCanvasService', '$rootScope', '$location', 'featureService'
, function ($route, offCanvasService, $rootScope, $location, featureService) {
return {
restrict: 'EA',
scope: {
containerSelector: '=',
initParams: '=',
init: '&',
postInit: '&',
hideOnTabletSelectors: '=',
hideOnMobileSelectors: '=',
hideSelectors: '=',
onShow: '&',
onHide: '&'
},
link: function (scope, element, attrs) {
$rootScope.$on('$routeChangeStart', function (event, next, current) {
var elem = $(element),
hrefVal = elem.attr('href');
if (featureService.IsEnabled("CheckOffCanvasDOMXSS")) {
//ASCR 13905935 fix : here in this method , the path is checked if anything encoded / double encoded is present after offcanvas,
// in case of XHR it will return true and location path will be reset
if (offCanvasService.checkEncodeURI()) {
offCanvasService.resetLocation();
}
}
if ($location.path() !== "" && $location.path().indexOf("/offcanvas") === 0 && hrefVal.indexOf($location.path()) !== -1) {
if (featureService.IsEnabled("ShowPopupOnOffCanvasShippingPage") && featureService.IsEnabled("CartFlyoutModalEnabled")) {
if (!document.querySelector("div.site-wrapper > #dellLogoModal")) {
angular.element("#site-wrapper").append(angular.element("#dellLogoModal"));
}
}
var offScreenFunc = function () {
$('#cartOffCanvas').css({ opacity: '0', marginLeft: '100%', marginRight: '100%' });
$(scope.hideOnMobileSelectors).addClass("hidden-xs");
$(scope.hideOnTabletSelectors).addClass("hidden-sm");
// this assumes there's only one selector to hide.
// it will need to be updated if there are more than one.
$(scope.hideSelectors)
.css({ marginLeft: '0', marginRight: '0', opacity: '100' })
.animate({ marginLeft: '-200%', marginRight: '200%', opacity: '0' }, 1000, function () {
$(this).hide();
$('#cartOffCanvas').css({ opacity: '100', marginLeft: '0', marginRight: '0' });
if ($(window).scrollTop() > 0) {
var ocScrollTop = $('#cartOffCanvas').offset().top;
$('html, body').animate({ scrollTop: ocScrollTop + 'px' });
};
});
scope.onShow();
};
var initFunc = scope.init();
if (initFunc) {
var ajaxFunc = function (additionalFunc) {
initFunc(scope.initParams).then(function (returnData) {
offScreenFunc();
scope.postInit()(returnData);
if (additionalFunc)
additionalFunc();
});
};
offCanvasService.setMakesServerReq(true);
offCanvasService.setFunc(ajaxFunc);
return;
}
offCanvasService.setMakesServerReq(false);
offScreenFunc();
} else {
if (current && current.$$route.originalPath.indexOf("/offcanvas") === 0 && hrefVal.indexOf(current.pathParams.name) !== -1) {
var revertOffScreen = function () {
$(scope.hideOnMobileSelectors).removeClass("hidden-xs");
$(scope.hideOnTabletSelectors).removeClass("hidden-sm");
$(scope.hideSelectors).show()
.css({ marginLeft: '-200%', marginRight: '200%', opacity: '0' })
.animate({ marginLeft: '0', marginRight: '0', opacity: '100' }, 1000, function () {
var posY = $(scope.hideSelectors).position().top;
if (window.pageYOffset > posY && $('aside').is(':visible')) {
$('html, body').animate({
scrollTop: posY
}, 500);
}
});
scope.onHide();
};
revertOffScreen();
$route.reload();
}
}
});
}
};
}])
.controller('OffCanvasController', ['offCanvasService', '$scope', 'featureService', function (offCanvasService, $scope, featureService) {
$scope.OffCanvasReadyToShow = false;
if (offCanvasService.getMakesServerReq()) {
offCanvasService.getFunc()(function () { $scope.OffCanvasReadyToShow = true; });
}
else {
$scope.OffCanvasReadyToShow = true;
if (featureService.IsEnabled("CheckOffCanvasDOMXSS")) {
//ASCR 13905935 fix : here in this method , the path is checked if anything encoded / double encoded is present after offcanvas,
// in case of XHR it will return true and location path will be reset
if (offCanvasService.checkEncodeURI()) {
$scope.OffCanvasReadyToShow = false;
offCanvasService.resetLocation();
}
}
}
}])
;;
angular.module('Dell.STP.AVS', [])
.factory("avsHandlerFactory", ['commonAvsStatusHandler', 'processingCompletedHandler', 'multipleSuggestionsHandler',
function (commonAvsStatusHandler, processingCompletedHandler, multipleSuggestionsHandler) {
var avsServiceConfig = {};
avsServiceConfig.AddressNotFound = commonAvsStatusHandler;
avsServiceConfig.InvalidCity = commonAvsStatusHandler;
avsServiceConfig.RecommendedAddress = commonAvsStatusHandler;
avsServiceConfig.CorrectedAddress = processingCompletedHandler;
avsServiceConfig.InvalidLine1 = multipleSuggestionsHandler;
avsServiceConfig.InvalidLine2 = multipleSuggestionsHandler;
avsServiceConfig.ServiceUnavailable = processingCompletedHandler;
avsServiceConfig.Line1Line2NotFound = commonAvsStatusHandler;
avsServiceConfig.InvalidLine1Template = "multiplesuggestions";
avsServiceConfig.InvalidLine2Template = "multiplesuggestions";
avsServiceConfig.InvalidCityTemplate = "addressnotfound";
return {
getHandler: function (statusCode, isSuggestionsEmpty) {
if ((statusCode === "InvalidLine1" || statusCode === "InvalidLine2") && isSuggestionsEmpty) return commonAvsStatusHandler;
else return avsServiceConfig[statusCode] ? avsServiceConfig[statusCode] : processingCompletedHandler;
},
getTemplate: function (statusCode, isSuggestionsEmpty) {
if (statusCode === "CorrectedAddress" || statusCode === "ServiceUnavailable") {
return ''; //No template for corrected address or service unavailable states.
}
var templateName = '';
if (((statusCode === "InvalidLine1" || statusCode === "InvalidLine2") && isSuggestionsEmpty) || statusCode === "Line1Line2NotFound") {
templateName = "addressnotfound";
} else {
templateName = avsServiceConfig[statusCode + 'Template']
? avsServiceConfig[statusCode + 'Template']
: statusCode.toLowerCase();
}
//return "/content1/templates/common/avs/" + templateName + ".html";
return templateName + ".html";
}
};
}]);
angular
.module('Dell.STP.AVS')
.service("commonAvsStatusHandler", function () {
this.handle = function (data, postValidate) {
return data;
}
})
.service("multipleSuggestionsHandler", ['$http', function ($http) {
this.handle = function (data) {
//for tealeaf, post an event in JSON format. This is just a Post and forget
var teaLeafData = { "Name": "AVS", "Content": "Multi_Suggestions" };
$http.post(window.location.origin + '/tltarget.aspx', teaLeafData)
.then(function onSuccess() { });
return data;
}
}])
.service("processingCompletedHandler", function () {
this.handle = function (data, postValidate) {
if (postValidate)
postValidate(data.Address ? data.Address : data.InputAddress);
data.processingCompleted = true;
return data;
}
})
.service('avsService', ['$http', 'urlResolverService', 'avsHandlerFactory', '$rootScope', function ($http, urlResolverService, avsHandlerFactory, $rootScope) {
this.validateAndHandle = function (inputAddress, postHandle, postValidate, suggestedAddress) {
var responseHandler = function (data, status, headers, config, statusText) {
$rootScope.SuppressGlobalAjaxErrorHandler = false;
if (status >= 500) {
data.StatusCode = "ServiceUnavailable";
data.InputAddress = data.InputAddress ? data.InputAddress : inputAddress;
}
var isSuggestionsEmpty = !data.Suggestions ? true : data.Suggestions.length === 0;
var handledData =
avsHandlerFactory
.getHandler(data.StatusCode, isSuggestionsEmpty)
.handle(data, postValidate);
var templateName = avsHandlerFactory.getTemplate(data.StatusCode, isSuggestionsEmpty);
if (postHandle)
postHandle(data, handledData, templateName);
};
var avsInput = suggestedAddress ? { Suggestion: suggestedAddress } : { Address: inputAddress };
$rootScope.SuppressGlobalAjaxErrorHandler = true;
var serviceurl = urlResolverService.Resolve("/addressverification");
$http.post(serviceurl, avsInput).then(function onSuccess(response) {
responseHandler(response.data, response.status, response.headers, response.config, response.statusText);
}, function onError(response) {
responseHandler(response.data, response.status, response.headers, response.config, response.statusText);
});
};
this.validateAndHandleStateNCityPostalcode = function (inputAddressStateAndCity, postHandleStateAndCity, postValidateStateAndCity, suggestedAddress) {
var successStateAndCityResponseHandler = function (data, status, headers, config, statusText) {
if (status == 200) {
data.StatusCode = "CorrectedAddress";
data.InputAddress = data;
}
var handledData =
avsHandlerFactory
.getHandler(data.StatusCode, true)
.handle(data, postValidateStateAndCity);
if (postHandleStateAndCity)
postHandleStateAndCity(data, handledData, "");
};
var errorStateAndCityResponseHandler = function (data, status, headers, config, statusText) {
// Since it is a silent failure so just logging the message to the browser console.
console.log(data.message);
};
var avsInputForStateNCity = { Address: inputAddressStateAndCity };
var serviceUrl = urlResolverService.Resolve("/PostalCode?postalCode=" + avsInputForStateNCity.Address.PostalCode + "&validStateNCityPostalCode=" + avsInputForStateNCity.Address.IsStateNCityPostalCodeEvent);
$http.get(serviceUrl)
.then(function onSuccess(response) {
successStateAndCityResponseHandler(response.data, response.status);
}, function onError(response) {
errorStateAndCityResponseHandler(response.data, response.status, response.headers, response.config, response.statusText);
});
};
}])
.service('avsUrlService', ['$injector', function ($injector) {
this.get = function () {
if (typeof serverUrls !== "undefined")
return serverUrls.apiServiceUrl;
var urlResolver = $injector.get('urlResolverService');
if (urlResolver)
return urlResolver.baseUrl();
return "";
};
}]);
;
/*AVS reusbale directive.Used by My Account and C&C*/
angular.module('Dell.STP.AVS')
.directive("stpAvs", function () {
return {
restrict: "EA",
template: '',
//tempalteUrl: getTemplateUrl(),
scope: {
address: "=",//input address.bound two way.
labels: "=", //localized labels to be displayed
serviceResponse: "=",
baseUrl: "@",
onUpdate: "&",//call back once the address is updated
onCancel: "&" //call back if the user cancels
},
link: function (scope, element, attr) {
},
controller: [
'$scope', 'avsService',
function ($scope, avsService) {
$scope.templateName = "";
$scope.getTemplateUrl = function () {
return $scope.templateName;
};
$scope.suggestAddresses = {
selectedIndex: -2,
validateAddress: function (suggestedAddress) {
if ((suggestedAddress.UserInput == '' || suggestedAddress.UserInput == null) && (suggestedAddress.InputType != 0)) {
suggestedAddress.showUserInputValidationMessage = true;
return;
} else {
suggestedAddress.showUserInputValidationMessage = false;
}
$scope.useThisAddressBtnEnabled = false;
validate($scope.validatedData.InputAddress, suggestedAddress);
}
}
/*validate the input address whenever it changes*/
/*
$scope.$watch("address", function () {
if ($scope.address && $scope.address != null)
validate(angular.copy($scope.address));
});
*/
var addressValidated = function (updatedAddress) {
$scope.useThisAddressBtnEnabled = false;
$scope.onUpdate({ updatedAddress: updatedAddress });
};
$scope.cancel = function() {
$scope.onCancel();
};
$scope.addressSelected = addressValidated;
var serviceResponseHandler = function (data, handledData, retTemplateName) {
$scope.validatedData = handledData;
$scope.templateName = retTemplateName;
$scope.useThisAddressBtnEnabled = true;
$scope.suggestAddresses.selectedIndex = "-2";
};
if ($scope.serviceResponse) {
var sr = $scope.serviceResponse;
serviceResponseHandler(sr.data,sr.handledData, sr.templateName);
//$scope.serviceResponse = null;
}
//API call to AVS
function validate(inputAddress, suggestedAddress) {
avsService.validateAndHandle(inputAddress, serviceResponseHandler, addressValidated, suggestedAddress);
return;
}
}]
};
});;
/*global $ */
var SHOP = window.SHOP || {};
SHOP.Transactional = SHOP.Transactional || {};
SHOP.Transactional.GiftCardModal = SHOP.Transactional.GiftCardModal || {};
(function ($) {
(function () {
var $this = this; // this === SHOP.Transactional.GiftCardModal
this.init = function () {
var url = '{0}/modalcontent?contentkey={1}';
$('body').on('click', 'a.giftcard.microcontent', function (e) {
e.preventDefault();
var giftcardKey = $(this).attr('rel').replace(/giftcard:/, '');
var requestUrl = (typeof serverUrls != "undefined") ? serverUrls.apiServiceUrl : $(this).data('api-url');
$.get(url.format(requestUrl, giftcardKey), function (data) {
if (data != null) {
var $giftCardModal = $('#modalcontent-modal');
$giftCardModal.find('.modal-header h3').text(data.ModalTitle);
$giftCardModal.find('.modal-footer').html(data.ModalFooter);
$giftCardModal.find('.modal-body').html(data.ModalText);
$giftCardModal.modal({ show: true });
}
});
});
};
this.onload = {
initialize: function () {
$this.init();
}
};
// Initialize namespace
// All functions within this namespace are called when the DOM is ready
// SHOP.Transactional.Utils.Initialize(this.onload);
}).call(SHOP.Transactional.GiftCardModal);
})(jQuery);;
(function() {
'use strict';
cartApp.controller('allcartsController', [
"$scope",
"$rootScope",
"cartService",
"$filter",
"initService",
function allcartsController($scope, $rootScope, cartService, $filter, initService) {
$scope.ReadyToShow = false;
$scope.RedirectToSavedList = function (listDataModel) {
var savedCartUrl = $scope.DataModel.SavedLists.SavedListLink + listDataModel.Id
+ "?ac=" + listDataModel.AccessCode;
$rootScope.setWindowLocation(savedCartUrl, false);
};
$scope.RedirectToCart = function (activeCartDataModel) {
activeCartDataModel.Link = activeCartDataModel.Link + "&ref=" + activeCartDataModel.Name.replace(" ", "").toLowerCase();
$rootScope.setWindowLocation(activeCartDataModel.Link, false);
};
$scope.NametoId = function (cartName) {
return cartName.replace(/\s+/g, '-').toLowerCase();
};
$scope.ShowHelpText = function() {
return $scope.DataModel.ActiveCarts.length > 1;
};
(function () {
(function (response) {
cartService.InitScope($scope, $rootScope, response, false);
$scope.DataModel = response.data;
$scope.ReadyToShow = true;
//scroll to Saved cart on redirect
if (window.location.hash.indexOf('saved-carts') > -1) {
setTimeout(function () {
$('html, body').animate({
scrollTop: $('#saved-carts').offset().top
}, 500);
}, 500);
}
})({ data: initService.Get() });
})();
}
]);
}());;
(function () {
'use strict';
cartApp.controller('savedcartController', [
"$scope",
"$rootScope",
"cartService",
"savedCartService",
"initService",
"featureService",
"contentsService",
function savedcartController($scope, $rootScope, cartService, savedCartService, initService, featureService, contentsService) {
$scope.ReadyToShow = true;
$scope.RemoveOverFlowAutoStyle = featureService.IsEnabled("RemoveOverFlowAutoStyle");
$scope.showPCaaSDisclaimer = function () { $('#pcaasDisclaimerModal').modal('show'); };
$scope.AddSavedCartToActiveCart = function () {
var successhandler = function (response) {
$scope.proceedToCart(response.data.itemsAddedCount);
};
var saveFunc = function () {
var savedItemIdentifiers = [];
angular.forEach($scope.DataModel.CartItems, function (value) {
this.push({ ConfigurationIdentifier: value.ConfigurationIdentifier, SavedExtendedProperties: value.SavedExtendedProperties, ItemId: value.Id, ItemType: value.ItemType });
}, savedItemIdentifiers);
savedCartService.AddSavedItemsToActiveCart($scope.DataModel.ListContext, savedItemIdentifiers, successhandler);
};
saveFunc();
};
$scope.addItemToActiveCart = function (item) {
var successhandler = function () {
angular.forEach($scope.DataModel.CartItems, function (value) {
if (value.Id === item.Id)
value.AddedToCart = true;
});
};
var saveFunc = function () {
var savedItemIdentifiers = [];
savedItemIdentifiers.push({ ConfigurationIdentifier: item.ConfigurationIdentifier, SavedExtendedProperties: item.SavedExtendedProperties, ItemId: item.Id, ItemType: item.ItemType });
savedCartService.AddSavedItemsToActiveCart($scope.DataModel.ListContext, savedItemIdentifiers, successhandler);
};
saveFunc();
};
$scope.ConfirmDeleteSavedCart = function() {
$('#deleteSavedCartModal').modal(true);
};
$scope.DeleteSavedCart = function() {
var successhandler = function() {
window.location.href = $scope.DataModel.CartNavigation.AllCartsLink.Url;
};
var errorhandler = function () {
$('#deleteSavedCartModal').modal('hide');
};
savedCartService.DeleteSavedList($scope.DataModel.SavedCartId, function () { successhandler(); }, function () { errorhandler(); });
};
$scope.proceedToCart = function (param) {
window.location.href = $scope.DataModel.CartLink;
if (param != undefined) {
window.location.href = $scope.DataModel.CartLink + '&ia=' + param;
}
};
$scope.configureBtoEolItem = function (param) {
if (typeof (param) !== "undefined" && param) {
if (!param.IsSeItem && param.EditItemUrl) {
param.EditItemUrl = contentsService.UpdateQueryString(param.EditItemUrl, "ref", "configuresavedbtoeolitem");
}
window.location = param.EditItemUrl;
}
};
(function () {
(function (response) {
cartService.InitScope($scope, $rootScope, response, false);
$scope.DataModel = response.data;
if (!$scope.DataModel.CartItems || $scope.DataModel.CartItems.length <= 0)
$scope.IsCartEmpty = true;
//angular.forEach($scope.DataModel.CartItems, function (value) {
// value.AddedToCart = false;
//});
// if there is a cart navigation dropdown populated, then add a CSS class to each "Add All Items to cart" and "Add item to cart" link, named dellmetrics-multi-segment-cart, only in the case where a customer will switch from one active cart to multiple active carts (i.e., from a saved cart in a different customer set)
var cn = $scope.DataModel.CartNavigation;
$scope.addItemsToCartDellMetricsClass = (cn.ActiveCarts.length === 1 && $scope.DataModel.CartLink !== cn.ActiveCarts[0].Url) ? 'dellmetrics-multi-segment-cart' : '';
// --- Feature toggles --- //
$scope.IsAltProdRecoEnabled = featureService.IsEnabled("AlternateProductRecommendation") && featureService.IsFeatureEnabled("AltProductRecommendationEnabled");
$scope.ShowUnitPricingForCartItems = featureService.IsEnabled("ShowUnitPricingForCartItems");
$scope.EnableNewEolCartPageDesign = featureService.IsEnabled("EnableNewEolCartPageDesign");
$scope.DisableCadence = featureService.IsEnabled("DisableCadence");
if ($scope.EnableNewEolCartPageDesign) {
if ($scope.DataModel && $scope.DataModel.RemovedCartItems && $scope.DataModel.RemovedCartItems.length > 0) {
$scope.HasRemovedCartItems = true;
}
else {
$scope.HasRemovedCartItems = false;
}
}
// --- Copying View Model --- //
if (typeof response.data.netViewModel !== "undefined") {
$scope.netViewModel = angular.copy(response.data.netViewModel);
} else {
$scope.netViewModel = {};
}
$scope.csViewModel = $scope.netViewModel.CartSummaryViewModel || {};
$scope.cartItemLabels = $scope.netViewModel.CartItem || {};
$scope.promotionalLabels = $scope.cartItemLabels.PromotionViewModel || {};
$scope.HasPCaaSItems = $scope.DataModel.HasPcaasItems;
$scope.HasNonPCaaSItems = $scope.DataModel.HasNonPcaasItems;
})({ data: initService.Get() });
})();
}
])
}());;
(function () {
'use strict';
cartApp.controller('emailController', [
"$scope",
"$rootScope",
"cartService",
"savedCartService",
"initService",
"featureService",
"contentsService",
function emailController($scope, $rootScope, cartService, savedCartService, initService, featureService, contentsService) {
$scope.ReadyToShow = true;
$scope.showPCaaSDisclaimer = function () { $('#pcaasDisclaimerModal').modal('show'); };
$scope.RemoveOverFlowAutoStyle = featureService.IsEnabled("RemoveOverFlowAutoStyle");
$scope.AddSavedCartToActiveCart = function () {
var successhandler = function (response) {
$scope.proceedToCart(response.data.itemsAddedCount);
};
var saveFunc = function () {
var savedItemIdentifiers = [];
angular.forEach($scope.DataModel.CartItems, function (value) {
this.push({ ConfigurationIdentifier: value.ConfigurationIdentifier, SavedExtendedProperties: value.SavedExtendedProperties, ItemId: value.Id, ItemType: value.ItemType });
}, savedItemIdentifiers);
savedCartService.AddSavedItemsToActiveCart($scope.DataModel.ListContext, savedItemIdentifiers, successhandler);
};
saveFunc();
};
$scope.addItemToActiveCart = function (item) {
var successhandler = function () {
angular.forEach($scope.DataModel.CartItems, function (value) {
if (value.Id === item.Id)
value.AddedToCart = true;
});
};
var saveFunc = function () {
var savedItemIdentifiers = [];
savedItemIdentifiers.push({ ConfigurationIdentifier: item.ConfigurationIdentifier, SavedExtendedProperties: item.SavedExtendedProperties, ItemId: item.Id, ItemType: item.ItemType });
savedCartService.AddSavedItemsToActiveCart($scope.DataModel.ListContext, savedItemIdentifiers, successhandler);
};
saveFunc();
};
$scope.proceedToCart = function (param) {
window.location.href = $scope.DataModel.CartLink;
if (param != undefined) {
window.location.href = $scope.DataModel.CartLink + '&ia=' + param;
}
};
$scope.configureBtoEolItem = function (param) {
if (typeof (param) !== "undefined" && param) {
if (!param.IsSeItem && param.EditItemUrl) {
param.EditItemUrl = contentsService.UpdateQueryString(param.EditItemUrl, "ref", "configureemailbtoeolitem");
}
window.location = param.EditItemUrl;
}
};
(function () {
(function (response) {
cartService.InitScope($scope, $rootScope, response, false);
$scope.DataModel = response.data;
if (!$scope.DataModel.CartItems || $scope.DataModel.CartItems.length <= 0)
$scope.IsCartEmpty = true;
var cn = $scope.DataModel.CartNavigation;
$scope.addItemsToCartDellMetricsClass = (cn.ActiveCarts.length === 1 && $scope.DataModel.CartLink !== cn.ActiveCarts[0].Url) ? 'dellmetrics-multi-segment-cart' : '';
// --- Feature Toggles --- //
$scope.IsAltProdRecoEnabled = featureService.IsEnabled("AlternateProductRecommendation") && featureService.IsFeatureEnabled("AltProductRecommendationEnabled");
$scope.ShowUnitPricingForCartItems = featureService.IsEnabled("ShowUnitPricingForCartItems");
$scope.EnableNewEolCartPageDesign = featureService.IsEnabled("EnableNewEolCartPageDesign");
if ($scope.EnableNewEolCartPageDesign) {
if ($scope.DataModel && $scope.DataModel.RemovedCartItems && $scope.DataModel.RemovedCartItems.length > 0) {
$scope.HasRemovedCartItems = true;
}
else {
$scope.HasRemovedCartItems = false;
}
}
// --- Copying View Model --- //
if (typeof response.data.netViewModel !== "undefined") {
$scope.netViewModel = angular.copy(response.data.netViewModel);
} else {
$scope.netViewModel = {};
}
$scope.csViewModel = $scope.netViewModel.CartSummaryViewModel || {};
$scope.cartItemLabels = $scope.netViewModel.CartItem || {};
$scope.promotionalLabels = $scope.cartItemLabels.PromotionViewModel || {};
$scope.HasPCaaSItems = $scope.DataModel.HasPcaasItems;
$scope.HasNonPCaaSItems = $scope.DataModel.HasNonPcaasItems;
})({ data: initService.Get() });
})();
}
])
}());
;
cartApp.service('emailService', ["$http", "urlResolverService", function emailService($http, urlResolverService) {
this.PostAbandonedCartEmail = function (personalizationDataModel, isConverted) {
if (isConverted) {
personalizationDataModel.AbandonedCartDataModel.Status = 1;/*Abandoned cart converted*/
}
personalizationDataModel.SavedList.ListType = 3;/*Abandoned cart*/
this.Post(personalizationDataModel);
};
this.Post = function (data) {
var serviceurl = urlResolverService.Resolve("/emailcart");
return $http.post(serviceurl, data);
};
}]);;
cartApp.service('savedCartService', ["$http", "urlResolverService",
"$filter",
function savedCartService($http, urlResolverService, $filter) {
//#region Save Cart
this.AddSavedItemsToActiveCart = function (listContext, savedItemIdentifiers, successhandler) {
var serviceurl = urlResolverService.Resolve("/lists");
serviceurl = serviceurl + "?cs=" + listContext.CustomerSet;
if (!!listContext.LinkNumber)
serviceurl = serviceurl + "&ln=" + listContext.LinkNumber;
return $http.post(serviceurl, $filter("json")(savedItemIdentifiers)).then(successhandler, null);
};
//#endregion Save Cart
//#region Delete Saved Cart
this.DeleteSavedList = function (savedCartId, successhandler, errorhandler) {
var serviceurl = urlResolverService.Resolve("/lists?id=" + savedCartId);
return $http['delete'](serviceurl)
.then(function onSuccess() {
successhandler();
}, function onError() {
errorhandler();
});
};
//#endregion Save Cart
}]);;
angular.module('zipCodePersistence', ['ngCookies'])
.service('zipCodePersistenceService', ['$cookies', 'cartConstants', 'errorLoggingService', function zipCodePersistenceService($cookies, cartConstants, errorLoggingService) {
// SHOP has a cfc-service that uses amplify
// CART is using cookies only, in order to be read across http/https
var getDecodedLocation = function() {
var encodedLocation = $cookies.location;
var MCMID = $cookies.s_ecid;
var decodedLocation = null;
if (encodedLocation) {
try {
decodedLocation = JSON.parse(decodeURIComponent(encodedLocation));
if (decodedLocation && decodedLocation.zipcode) {
var postalCodePatterns = /^(\d{5}(-\d{4})?|[A-Z]\d[A-Z] *\d[A-Z]\d)$|[a-zA-Z][0-9][a-zA-Z]( )?[0-9][a-zA-Z][0-9]/; //Works for CA and US
if (!(postalCodePatterns.test(decodedLocation.zipcode))) {
errorLoggingService.logWarning("cookie value is not in correct pattern - "+ MCMID);
decodedLocation.zipcode = null;
}
}
} catch (e) {
errorLoggingService.logWarning("Json Parse error for cookie value - " + MCMID );
}
}
return decodedLocation;
};
// Get zip code persisted from Browse path
this.getCfcZipCode = function () {
var zipcode = null;
var decodedLocation = getDecodedLocation();
if (decodedLocation && (decodedLocation.source === cartConstants.LocationSource.User || decodedLocation.source === cartConstants.LocationSource.Unauthenticated)) {
zipcode = decodedLocation.zipcode;
}
return zipcode;
};
// Set zip code persisted from Browse path
this.setCfcZipCode = function (postalCode, source) {
var decodedLocation = getDecodedLocation();
if (decodedLocation) {
decodedLocation.zipcode = postalCode;
decodedLocation.source = source || cartConstants.LocationSource.User;
document.cookie = "location=" + encodeURI(JSON.stringify(decodedLocation)) + ";path=/";
}
else {
var locationCookie = {};
locationCookie.source = source || cartConstants.LocationSource.User;
locationCookie.zipcode = postalCode;
document.cookie = "location=" + encodeURI(JSON.stringify(locationCookie)) + ";path=/";
}
};
// Update persisted zipcode if cookie exists
this.updateCfcZipCode = function (postalCode, source) {
var decodedLocation = getDecodedLocation();
if (decodedLocation && decodedLocation.zipcode) {
decodedLocation.zipcode = postalCode;
decodedLocation.source = source || cartConstants.LocationSource.User;
document.cookie = "location=" + encodeURI(JSON.stringify(decodedLocation)) + ";path=/";
}
};
this.getLocationData = function() {
return getDecodedLocation();
}
}]);
;
cartApp.service('threeDSecureAnalyticsService', [ function threeDSecureAnalyticsService() {
// This service is used to get/set a 3DS (3D Secure) card's payment order in local storage.
// Because we do not know if a card is 3DS-enabled after it's been through the 3DS modal,
// we're tracking 3DS-enabled credit card payments in local storage.
// Examples - when a customer pays with:
// A. 1 3DS-enabled credit card, 'tdscards' local storage will store "1".
// B. 0 3DS-enabled credit cards, 'tdscards' local storage will be cleared out.
// C. 3 different credit cards, where the 1st and 3rd are 3DS-enabled, but the 2nd is not, then 'tdscards' local storage will store "1, 3".
// Usages: Payments page, Confirmation page
// Note: there is a threeDSecureService that's specific to the Payments page. This version is for analytics.
// Get 3DS cards from local storage
// Return array of 3DS-enabled payment slots (e.g., ["1", "2", "3"])
this.get3dsCardSlots = function () {
if (amplify.store.localStorage !== undefined || amplify.store.sessionStorage !== undefined) {
if (typeof amplify.store().tdscards !== 'undefined') {
var tdsCards = amplify.store('tdscards').toString();
var tdsCardsArr = tdsCards.split(",");
return tdsCardsArr;
}
}
return [];
};
// Add 3DS card payment slot to local storage for tracking
// Send array of updated 3DS-enabled payment slots to set3dsCards
this.add3dsCard = function (newSlot) {
var cardSlots = this.get3dsCardSlots();
cardSlots.push(newSlot.toString());
this.set3dsCards(cardSlots);
};
// Remove 3DS card from local storage for tracking
// Send array of updated 3DS-enabled payment slots to set3dsCards
this.remove3dsCard = function (removeSlot) {
var cardSlots = this.get3dsCardSlots(),
len = cardSlots.length;
for (var i = 0; i < len; i++) {
if (cardSlots[i].toString() === removeSlot) {
cardSlots.splice(i, 1);
i--;
--len;
}
else if (+cardSlots[i] > +removeSlot) {
--cardSlots[i];
cardSlots[i] = cardSlots[i].toString();
}
}
this.set3dsCards(cardSlots);
};
// Set browser local storage with 3DS-enabled payment slots (e.g., "1, 2, 3")
this.set3dsCards = function (slots) {
if (slots.length <= 0)
slots = null; // set to null to clear out local storage
else
slots = slots.toString();
amplify.store('tdscards', slots, { expires: 4 * 1000 * 60 * 60 }); // keep for 4 hours (the same amount of time that order group keeps payment info)
}
}]);
;
(function() {
"use strict";
cartApp.service("cartSignInTrackingService",
function cartSignInTrackingService() {
var authentiationStorageKey = "cart:signininfo";
var additionalExpirationTimeSpan = 7200000;
var get = function() {
return JSON.parse(localStorage.getItem(authentiationStorageKey));
}
this.set = function(isCurrentlyAutenticated) {
if (typeof isCurrentlyAutenticated === "undefined" || !Modernizr.localstorage)
return;
var storedItem = get();
if (!storedItem || storedItem.expiresAt < Date.now())
localStorage.setItem(authentiationStorageKey,
JSON.stringify({
'isAutheticated': isCurrentlyAutenticated,
'expiresAt': Date.now() + additionalExpirationTimeSpan
}));
};
this.hasAlreadySignedIn = function() {
if (!Modernizr.localstorage) return false;
var item = get();
if (!item)
return false;
return item.isAutheticated;
};
});
}());
;
cartApp.service('postalAddressValidationService', ["avsUiService", "avsService", "cartConstants", "validationService", "$timeout", "featureService", "errorLoggingService", "cartConstants",
function postalAddressValidationService(avsUiService, avsService, cartConstants, validationService, $timeout, featureService, errorLoggingService, cartConstants) {
var setAddressFieldsDisabled = function (address, flag) {
address.AddressFieldDisabled = [];
address.AddressFieldDisabled.Line1 = flag;
address.AddressFieldDisabled.Line2 = flag;
address.AddressFieldDisabled.Line3 = flag;
address.AddressFieldDisabled.Line4 = flag;
address.AddressFieldDisabled.City = flag;
address.AddressFieldDisabled.State = flag;
}
var setAddressFieldsPossibleInvalidCity = function (address) {
address.AddressFieldDisabled = [];
address.AddressFieldDisabled.Line1 = (address.Line1.replace(/^\?/, "") !== "");
address.AddressFieldDisabled.Line2 = false;
address.AddressFieldDisabled.Line3 = !!address.Line3;
address.AddressFieldDisabled.Line4 = false;
address.AddressFieldDisabled.City = false;
address.AddressFieldDisabled.State = !!address.State;
}
var setAddressFieldsBasedOnValidatedAddress = function(address) {
address.AddressFieldDisabled = [];
address.AddressFieldDisabled.Line1 = (address.Line1.replace(/^\?/, "") !== "");
address.AddressFieldDisabled.Line2 = false;
address.AddressFieldDisabled.Line3 = !!address.Line3;
address.AddressFieldDisabled.Line4 = false;
address.AddressFieldDisabled.City = !!address.City;
address.AddressFieldDisabled.State = !!address.State;
}
var setAddressFieldsBasedOnValidatedAddressForStateAndCityFromPostalCode = function (address) {
address.AddressFieldDisabled = [];
address.AddressFieldDisabled.City = !!address.City;
address.AddressFieldDisabled.State = !!address.State;
}
var resetAddressFields = function (address) {
address.Line1 = "";
address.Line2 = "";
address.Line3 = "";
address.Line4 = "";
address.City = "";
address.State = "";
address.Region = "";
}
var resetAddressFieldsStateAndCityFromPostalCode = function (address) {
address.City = "";
address.State = "";
address.Region = "";
}
var reverseMapper = function (address, validatedAddress) {
if (validatedAddress) {
if (address) {
address.Line1 = validatedAddress.Line1;
address.Line2 = validatedAddress.Line2;
address.Line3 = validatedAddress.Line3;
address.City = validatedAddress.City;
address.State = validatedAddress.Region;
address.Country = validatedAddress.Country;
address.IsAddressVerified = true;
address.PostalCode = validatedAddress.PostalCode;
setAddressFieldsBasedOnValidatedAddress(address);
}
}
};
var reverseMapperForStateandCity = function (address, validatedAddress) {
if (validatedAddress) {
if (address) {
address.City = validatedAddress.Locality;
address.State = validatedAddress.Region;
address.Country = validatedAddress.CountryCode;
address.IsAddressVerified = true;
if (validatedAddress.PostalCode.trim()!=="") {
address.PostalCode = validatedAddress.PostalCode.trim();
}
setAddressFieldsBasedOnValidatedAddressForStateAndCityFromPostalCode(address);
}
}
};
var validateAddressFields = function () {
validationService.validateControls(
"input.validate-control:visible[afv-validate],select.validate-control:visible[afv-validate]");
};
this.GetValidateShippingAddress = function (iElemenVar, scope, sourceContact) {
//Get EDD for India & Brazil based on postal address.
if (scope.PostalCodePattern === null) {
scope.PostalCodePattern = $(iElemenVar[0]).attr("ng-pattern").replace(new RegExp('^/(.*?)/$'), '$1');
}
var regex = new RegExp(scope.PostalCodePattern);
var validate = regex.test($(iElemenVar[0]).val());
if (validate) {
scope.$apply(function () {
scope.ValidateShippingAddress($(iElemenVar[0]).val(), false);
});
}
}
this.GetAddressByPostalCode = function (iElemenVar, scope, sourceContact) {
if (!scope.PostalCodePattern) {
scope.PostalCodePattern = $(iElemenVar[0]).attr("ng-pattern").replace(new RegExp('^/(.*?)/$'), '$1');
}
scope.sourceContactPrefix = 'DataModel';
if (iElemenVar[0].id.substring(0, iElemenVar[0].id.indexOf('-')) === 'item') {
scope.sourceContactPrefix = 'item';
}
var address = scope[scope.sourceContactPrefix][sourceContact];
if (!featureService.IsEnabled(cartConstants.FeatureToggles.GetAddressByPostalCodeAvs)) {
setAddressFieldsDisabled(address, false);
$("#shipping-Contact-state").removeClass("shipping-dropdown-disabled");
return;
} else {
$("#shipping-Contact-state").addClass("shipping-dropdown-disabled");
var regex = new RegExp(scope.PostalCodePattern);
var validate = regex.test($(iElemenVar[0]).val());
if (validate) {
var postAddressSearch;
if (sourceContact && sourceContact === cartConstants.ContactType.ShippingContact) {
postAddressSearch = function () {
scope.ValidateShippingAddress($(iElemenVar[0]).val(), false);
}
}
if (featureService.IsEnabled("SuframaBenefits") && sourceContact === 'AddEditShippingAddress') {
postAddressSearch = function () {
scope.ValidateShippingAddress($(iElemenVar[0]).val(), false);
}
}
var mapperFunc = function () {
address.IsInvalidPostalCode = false;
if (scope.DataModel.ShippingAddressBookData)
scope.DataModel.ShippingAddressBookData.IsInvalidPostalCode = false;
address.Line1 = "";
address.Line2 = "";
address.Line3 = "";
address.Line4 = "";
address.City = "";
address.State = "";
address.Region = address.State;
if (address.Territory !== undefined &&
address.Territory !== null) {
address.Country = address.Territory;
}
return address;
};
var postVerification = function (validatedAddress) {
reverseMapper(address, validatedAddress);
};
var contactName = function (contact) {
if (sourceContact === "AddEditShippingAddress") {
return "ShippingAddressBookData";
}
else
return contact;
}
var createAlterts = function (contact) {
if (scope[scope.sourceContactPrefix] && !scope[scope.sourceContactPrefix][contact].Alerts) {
scope[scope.sourceContactPrefix][contact].Alerts = [];
}
};
var pushAlerts = function (contact, data, alerts) {
var exits = $.grep(scope[scope.sourceContactPrefix][contact].Alerts, function (a) {
return a.Message && a.Message === data.message;
});
if (exits && exits.length < 1) {
scope[scope.sourceContactPrefix][contact].Alerts.push(alerts);
}
};
var setPostalCodeStatus = function (contact, status) {
scope[scope.sourceContactPrefix][contact].IsInvalidPostalCode = status;
};
var addressToValidate = mapperFunc(sourceContact);
avsService.validateAndHandle(addressToValidate,
function (data) {
createAlterts(contactName(sourceContact));
var alerts = { Message: data.message };
pushAlerts(contactName(sourceContact), data, alerts);
if (data.StatusCode === "AddressNotFound") {
setPostalCodeStatus(contactName(sourceContact), true);
} else {
setPostalCodeStatus(contactName(sourceContact), false);
}
if (data.message !== undefined && data.message != "" && data.message != null) {
errorLoggingService.logWarning("AVS Response:" + JSON.stringify(data) + " , Country : " + data.InputAddress.Country, cartConstants.Warning.ShippingContact);
}
if ($('#spCityLengthErrorMessage')[0])
$('#spCityLengthErrorMessage').text('');
if (data.Suggestions &&
data.Suggestions.length > 0 &&
data.Suggestions[0] &&
data.Suggestions[0].SuggestedAddress) {
var suggestedAddress = data.Suggestions[0].SuggestedAddress;
address.IsInvalidPostalCode = false;
if (scope[scope.sourceContactPrefix].ShippingAddressBookData)
scope[scope.sourceContactPrefix].ShippingAddressBookData.IsInvalidPostalCode = false;
address.State = suggestedAddress.Region;
address.City = suggestedAddress.City.replace(";","'");
address.Line1 = suggestedAddress.Line1.replace(/^\?/, '');
address.Line3 = suggestedAddress.Line3;
if (data.Suggestions.length > 1) {
setAddressFieldsPossibleInvalidCity(address);
}
else {
if (featureService.IsEnabled("CityNameUpdateInCaseOfMaxLength")) {
var cityCtrl = $('#DataModel-ShippingContact-City')[0];
if (!cityCtrl) {
var addressControls = $('.validate-control');
for (var i = 0; i < addressControls.length; i++) {
if (addressControls[i].id.indexOf('City') > -1) {
cityCtrl = addressControls[i];
break;
}
}
}
if (cityCtrl && address.City.length > cityCtrl.maxLength && address.Country)
setAddressFieldsPossibleInvalidCity(address);
else
setAddressFieldsBasedOnValidatedAddress(address);
}
else
setAddressFieldsBasedOnValidatedAddress(address);
}
} else if (data.StatusCode !== "CorrectedAddress") {
resetAddressFields(address);
setAddressFieldsDisabled(address, data.StatusCode !== "ServiceUnavailable");
}
if (postAddressSearch && angular.isFunction(postAddressSearch))
postAddressSearch();
$timeout(function () { validateAddressFields(); });
},
postVerification);
} else {
address.IsInvalidPostalCode = false;
if (scope[scope.sourceContactPrefix].ShippingAddressBookData)
scope[scope.sourceContactPrefix].ShippingAddressBookData.IsInvalidPostalCode = false;
resetAddressFields(address);
setAddressFieldsDisabled(address, true);
if (address.Territory !== undefined &&
address.Territory !== null) {
address.Country = address.Territory;
}
}
}
};
this.GetStateAndCityByPostalCode = function (iElemenVar, scope, sourceContact,postalCode) {
var regex;
var address;
var validate;
if (postalCode === null) {
if (!scope.PostalCodePattern) {
scope.PostalCodePattern = $(iElemenVar[0]).attr("ng-pattern").replace(new RegExp('^/(.*?)/$'), '$1');
}
scope.sourceContactPrefix = 'DataModel';
address = scope[scope.sourceContactPrefix][sourceContact];
regex = new RegExp(scope.PostalCodePattern);
validate = regex.test($(iElemenVar[0]).val().trim());
} else {
if (postalCode !== null) {
scope.sourceContactPrefix = 'DataModel';
address = scope[scope.sourceContactPrefix][sourceContact];
validate = true;
}
}
if (validate) {
var postAddressSearch;
if (sourceContact && sourceContact === cartConstants.ContactType.ShippingContact) {
postAddressSearch = function () {
if (postalCode === null) {
scope.ValidateShippingAddress($(iElemenVar[0]).val(), false);
} else {
scope.DataModel.IsSameAsShipToAddress = true;
scope.editBillingAddress = false;
scope.showReadOnlyBilling = false;
scope.ValidateShippingAddress(postalCode, false);
}
}
}
var mapperFuncForStateNCity = function () {
address.IsInvalidPostalCode = false;
address.IsStateNCityPostalCodeEvent = true;
if (scope.DataModel.ShippingAddressBookData)
address.City = "";
address.State = "";
address.Region = address.State;
return address;
};
var postStateAndCityVerification = function (validatedAddress) {
reverseMapperForStateandCity(address, validatedAddress);
};
var addressToValidateStateNCity = mapperFuncForStateNCity(sourceContact);
avsService.validateAndHandleStateNCityPostalcode(addressToValidateStateNCity,
function (data) {
if (data != null && data !== "") {
if (data.StatusCode !== "CorrectedAddress") {
resetAddressFieldsStateAndCityFromPostalCode(address);
}
if (postAddressSearch && angular.isFunction(postAddressSearch))
postAddressSearch();
if (data.message !== undefined && data.message != "" && data.message != null)
errorLoggingService.logWarning("AVS Response:" + JSON.stringify(data) + " , Country : " + data.InputAddress.Country, cartConstants.Warning.ShippingContact);
} else {
resetAddressFieldsStateAndCityFromPostalCode(address);
}
},
postStateAndCityVerification);
} else {
address.IsInvalidPostalCode = false;
resetAddressFieldsStateAndCityFromPostalCode(address);
}
};
}]);
;
cartApp.service('phoneNumberValidationService', ["validationService", function phoneNumberValidationService(validationService) {
var phoneRegex = /^(\w+-\w+-\w+)$/;
var phoneSelector = "input.phone-validate-control";
var phoneInputSelector = "input.phone-control";
var getSourceContactSelector = function (inputSelector, sourceContact, phoneType) {
var sourceAttr = sourceContact ? "[source-contact='" + sourceContact + "']" : "";
var phoneAttr = phoneType ? "[phone-type='" + phoneType + "']" : "";
return (inputSelector + sourceAttr + phoneAttr);
};
var getFieldValue = function (inputSelector, fieldName) {
if (fieldName) {
return $(inputSelector + "[id*='" + fieldName + "']").val();
}
return $(inputSelector).val();
};
var formatNumber = function (areaCode, number1, number2) {
var num1 = number1 ? ("-" + number1) : "";
var num2 = number2 ? ("-" + number2) : "";
return (areaCode || "") + num1 + num2;
}
var setPhone = function (formattedNumber, phoneNumberSelector, inputSelector, elementValue) {
$(phoneNumberSelector).val(formattedNumber);
angular.element(phoneNumberSelector).controller('ngModel').$setViewValue(formattedNumber);
validationService.hideValidationMessages(phoneNumberSelector);
if (!elementValue) {
validationService.showClientValMessage($(phoneNumberSelector));
} else if ((!phoneRegex.test(formattedNumber)) || $(inputSelector).length === $(inputSelector + ".ng-dirty").length) {
validationService.showClientValMessage($(phoneNumberSelector));
}
}
var validatePhone = function (sourceContact, phoneType, elementValue) {
var phInputSelector = getSourceContactSelector(phoneInputSelector, sourceContact, phoneType);
if ($(phInputSelector + ":visible[afv-validate]").length > 0) {
var areaCode = getFieldValue(phInputSelector, "AreaCode");
var number1 = getFieldValue(phInputSelector, "Number1");
var number2 = getFieldValue(phInputSelector, "Number2");
var formattedPhoneNumber = formatNumber(areaCode, number1, number2);
setPhone(formattedPhoneNumber, getSourceContactSelector(phoneSelector, sourceContact, phoneType), phInputSelector, elementValue);
}
};
this.ValidateAndFormatPhoneNumber = function (element, sourceContact, phoneType) {
validatePhone(sourceContact, phoneType, getFieldValue(element));
};
this.ValidatePhoneFields = function () {
validatePhone("ShippingContact", "Phone");
validatePhone("ShippingContact", "AlternatePhone");
validatePhone("BillingContact", "Phone");
validatePhone("BillingContact", "AlternatePhone");
validatePhone("TaxInvoiceRequesteContact", "Phone");
validatePhone("TaxInvoiceRequesteContact", "AlternatePhone");
validatePhone("DirectorsDetails", "Phone");
validatePhone("UnifiedInvoiceContact", "Phone");
};
}]);;
(function () {
'use strict';
angular.module('globalErrors').service('cartJsLoggingService', ['$window', '$interval',
function cartJsLoggingService($window, $interval) {
// Cart Javascript Logging Service
// Log custom messages to Tealeaf and Splunk
// Usages: All Cart pages where error messages are displayed
var tempTealeafMessages = [];
this.logCustomMessage = function (message) {
// If TLT is available, log the custom message.
if ($window.hasOwnProperty('TLT') && typeof (TLT) === "object") {
TLT.logCustomEvent('RespCartEvent', { msg: message });
}
// If TLT is not available, log the custom message to a temporary array. Then when TLT becomes available, log it there.
else {
tempTealeafMessages.push(message);
}
// Also send message to Splunk
jsErrors.push({ message: 'RespCartMsg : ' + message, timestamp: Date.now() });
};
// Log Page-level alert messages
this.logAlerts = function (alertMessages) {
var alertsLength = alertMessages.length;
for (var i = 0; i < alertsLength; i++) {
this.logCustomMessage(alertMessages[i].Message);
}
};
// Check if the TLT object is available. If so, collect temporary messages in the
// tempTealeafMessages array and add them to the TLT object, to be collected by Tealeaf.
(function () {
var intCount = 0;
var tltInterval = $interval(function () {
if (($window.hasOwnProperty("TLT") && typeof (TLT) === "object")) {
// TLT object is available, so log tempTealeafMessages to Tealeaf.
for (var i = 0; i < tempTealeafMessages.length; i++) {
TLT.logCustomEvent('RespCartEvent', { msg: tempTealeafMessages[i] });
}
$interval.cancel(tltInterval);
} else if (intCount >= 10) {
$interval.cancel(tltInterval);
}
intCount++;
},
2000);
})();
return {
logCustomMessage: this.logCustomMessage,
logAlerts: this.logAlerts
};
}
]);
}());
;
cartApp.service('accountService', ["$http", "urlResolverService", function accountService($http, urlResolverService) {
//#region Create Account
this.CreateWithEmail = function (cartId) {
var serviceUrl = urlResolverService.Resolve("/account");
// return $http.post(serviceUrl, cartObj);
return $http({
method: 'POST',
url: serviceUrl,
data: JSON.stringify(cartId),
headers: {
'Content-type': 'application/json'
}
})
};
//#endregion Create Account
}]);;
cartApp.service('customerNumberService', ["$http", "urlResolverService"
, function customerNumberService($http, urlResolverService) {
this.AddCustomerNumber = function (customerNumberDataModel) {
var serviceUrl = urlResolverService.baseUrl("myaccount/customernumbermessage");
return $http.put(serviceUrl, customerNumberDataModel);
};
this.ClearForm = function (scope) {
scope.AddCustomerNumberErrorMessages = {};
scope.DataModel.CustomerNumberDataModel.CustomerNumber = "";
scope.DataModel.CustomerNumberDataModel.OrderNumber = "";
scope.DataModel.CustomerNumberDataModel.ZipCode = "";
};
}]);
;
cartApp.service("iovationFirstPartyService",
[
"featureService", "cartConstants",
function iovationFirstPartyService(featureService, cartConstants) {
var internalGetBlackboxData = function(makeIovationCall) {
try {
if (!featureService.IsEnabled(cartConstants.FeatureToggles.IovationFirstPartyScript) || !makeIovationCall) {
return { value: "", fullDataCollected: false };
}
var firstPartyScriptBlackbox = ((window.Dell || {}).IovationFirstPartyScript || {});
if (typeof firstPartyScriptBlackbox.getBlackboxData === "function")
return firstPartyScriptBlackbox.getBlackboxData();
} catch (e) {
//no need to check the exception
}
return { value: "", fullDataCollected: false };
}
var internalUpdateDataModelWithBlackBoxData = function(dataModel) {
if (!((dataModel || {}).IovationFirstPartyScriptCallTracker || {}).MakeIovationCall)
return;
var data = internalGetBlackboxData(true);
dataModel.IovationBlackboxData = dataModel.IovationBlackboxData || {};
dataModel.IovationBlackboxData.Value = data.value;
dataModel.IovationBlackboxData.FullDataCollected = data.fullDataCollected;
}
return {
getBlackboxData: internalGetBlackboxData,
updateDataModelWithBlackBoxData: internalUpdateDataModelWithBlackBoxData
}
}
]);;
angular.module('formatDateModule', [])
.service('FormatDateService', [function FormatDateService() {
this.formatDate = function (dateTime, culture) {
if (culture == null || culture === "")
return dateTime;
var options = { year: 'numeric', month: 'numeric', day: 'numeric' };
var formattedDateTime = new Date(dateTime).toLocaleDateString(culture, options);
return formattedDateTime;
}
}]);;
(function () {
"use strict";
cartApp.service("cartSummaryService", [
function () {
var $scope;
return {
init: function (scope) {
$scope = scope;
},
// Get Continue Button Label
getButtonValue: function () {
// Always use checkout as the button text for any cart type
if ($scope.DataModel.netViewModel) {
$scope.buttonText = $scope.DataModel.netViewModel.CartSummaryViewModel.WorkflowActionLabel;
if ($scope.DataModel.CartSummary.PcaasCartSummaryDatamodel.HasPcaasitem) {
// Check for the current workflow step and pcaas payment being applied
if ($scope.DataModel.WorkFlow.Current === 4 && !$scope.DataModel.WorkFlow.Pcaas.IsPcaasPaymentApplied) {
$scope.buttonText = $scope.DataModel.netViewModel.ApplyNowLabel;
}
}
}
},
// Show PcaaS Summary
showPcaasSummary: function () {
// Get Cart Type
if (this.getCartType().toLowerCase() === 'mixedcart') {
// Check for the current workflow step and pcaas payment being applied
if ($scope.DataModel && $scope.DataModel.WorkFlow && $scope.DataModel.WorkFlow.Current === 4 && $scope.DataModel.WorkFlow.Pcaas && $scope.DataModel.WorkFlow.Pcaas.IsPcaasPaymentApplied) {
return false;
}
return true;
}
// Handle simple cart case when payment is applied
if (this.getCartType().toLowerCase() === 'simplecart') {
return true;
}
return false;
},
showPcaasFindYourOffer: function () {
var showLabel = false;
return showLabel = ($scope.DataModel && $scope.DataModel.CartSummary && $scope.DataModel.CartSummary.PcaasCartSummaryDatamodel && $scope.DataModel.CartSummary.PcaasCartSummaryDatamodel.HasPcaasitem && $scope.DataModel.WorkFlow && $scope.DataModel.WorkFlow.Current === 4 && $scope.DataModel.WorkFlow.Pcaas && !$scope.DataModel.WorkFlow.Pcaas.IsPcaasPaymentApplied) ? true : false;
},
// Show Non-PcaaS Summary
showNonPcaasSummary: function () {
// Get Cart Type
if (this.getCartType().toLowerCase() === 'mixedcart') {
// Check for the current workflow step and pcaas payment being applied
if ($scope.DataModel.WorkFlow.Current === 4 && !$scope.DataModel.WorkFlow.Pcaas.IsPcaasPaymentApplied) {
return false;
}
return true;
}
// Handle NonPcaas cart - when payment is applied
if (this.getCartType().toLowerCase() === 'nonpcaascart') {
return true;
}
return false;
},
// Check the cart type
getCartType: function () {
if ($scope.DataModel && $scope.DataModel.CartSummary && $scope.DataModel.CartSummary.PcaasCartSummaryDatamodel && $scope.DataModel.CartSummary.PcaasCartSummaryDatamodel.HasPcaasitem) {
if ($scope.DataModel.CartSummary.PcaasCartSummaryDatamodel.HasNonPcaasitem) {
return "MixedCart";
}
return "SimpleCart";
}
return "NonPcaasCart";
}
};
}
]);
}());
;
(function () {
cartApp.service('postalCodeUpdateService',
[
"$http", "zipCodePersistenceService", "contentsService", "cartConstants", "featureService",
function ($http, zipCodePersistenceService, contentsService, cartConstants, featureService) {
var $scope;
var postalCodeUpdateCallBackOnSuccess = function (cartContentsData, source) {
if (!cartContentsData || !cartContentsData.data.CartSummary.CurrentPostalCode)
return;
var updatedPostalCode = cartContentsData.data.CartSummary.CurrentPostalCode;
$scope.DeliveryOptions.PostalCode = updatedPostalCode;
if (cartContentsData.PriceComponents && $scope.DataModel.CartSummary) {
$scope.DataModel.CartSummary.PriceComponents = cartContentsData.PriceComponents;
if (cartContentsData.LeadTimeInfo)
$scope.DataModel.CartSummary.LeadTimeInfo = cartContentsData.LeadTimeInfo;
if (cartContentsData.TaxBasedOn)
$scope.DataModel.CartSummary.TaxBasedOn = cartContentsData.TaxBasedOn;
if (cartContentsData.UnFormattedOrderAmount) {
$scope.DataModel.CartSummary.UnFormattedOrderAmount =
cartContentsData.UnFormattedOrderAmount;
}
}
$scope.DataModel.CartSummary.ShowInvalidPriceMessage = false;
$scope.showHidePostalCodeLink(false);
if ((zipCodePersistenceService.getLocationData() || {}).zipcode !== updatedPostalCode)
zipCodePersistenceService.setCfcZipCode(updatedPostalCode, source);
$scope.setDataPostal(cartContentsData);
};
var postalCodeUpdateCallBackOnError = function (message) {
$scope.GenericErrorMessage = message;
$scope.DeliveryOptions.ShowGenericErrorMessage = true;
};
var removeValidationMessages = function () {
$scope.DeliveryOptions.ShowErrorMessage = false;
$scope.DeliveryOptions.ShowGenericErrorMessage = false;
};
var internalShippingVisitedOrPaymentsComplete = function () {
if ($scope.DataModel && $scope.DataModel.WorkFlow) {
return $scope.DataModel.WorkFlow.IsShippingVisitedOrPaymentsComplete || $scope.DataModel.CartSummary.IsShippingVisitedOrPaymentComplete;
}
return false;
};
var verifyPostalCodeWithExisting = function (postalCode) {
var locationData = zipCodePersistenceService.getLocationData();
if (locationData && locationData.zipcode) {
if (postalCode === locationData.zipcode) {
return true;
}
}
return false;
};
var internalUpdatePostalCode = function (postalCode) {
removeValidationMessages();
//this will removed, post text box validation in UI - ngpattern and enable button based on that
if (verifyPostalCodeWithExisting(postalCode)) {
$scope.showHidePostalCodeLink(false);
return;
}
if (!postalCode || !postalCode.trim()) {
$scope.DeliveryOptions.ShowErrorMessage = true;
return;
}
contentsService.updatePostalCode(postalCode, postalCodeUpdateCallBackOnSuccess, postalCodeUpdateCallBackOnError);
};
var internalSavePostalCode = function (postalCode) {
removeValidationMessages();
//this will removed, post text box validation in UI - ngpattern and enable button based on that
if (!postalCode || !postalCode.trim()) {
$scope.DeliveryOptions.ShowErrorMessage = true;
return;
}
if (verifyPostalCodeWithExisting(postalCode)) {
$scope.showHidePostalCodeLink(false);
return;
}
contentsService.savePostalCode(
{ postalCode: postalCode, source: cartConstants.LocationSource.User },
postalCodeUpdateCallBackOnSuccess, postalCodeUpdateCallBackOnError);
};
var isLocationDataValid = function (locationData) {
return locationData && locationData.zipcode;
};
var shouldNotCallPostalCodeUpdateOnPageLoad = function (locationData) {
var locationDataValid = isLocationDataValid(locationData);
var noPostalCodeDataExistsOnClientAndServer =
!locationDataValid && $scope.DataModel && !$scope.DataModel.IsAuthenticated;
var noPostalCodeChangeObserved = locationDataValid &&
(($scope.DataModel || {}).CartSummary || {}).CurrentPostalCode === locationData.zipcode &&
(locationData.source === cartConstants.LocationSource.User ||
locationData.source === cartConstants.LocationSource.Authenticated ||
!$scope.DataModel.IsAuthenticated);
return internalShippingVisitedOrPaymentsComplete() ||
noPostalCodeChangeObserved ||
noPostalCodeDataExistsOnClientAndServer;
};
var internalSavePostalCodeOnPageLoad = function () {
if ((($scope.DataModel || {}).CartItems || {}).length <= 0 ||
!featureService.IsEnabled("CalculateTaxAndShipping")
)
return;
var postal = $scope.DataModel.LoggedinUserPostalcode;
var locationData = zipCodePersistenceService.getLocationData();
$scope.DeliveryOptions.PostalCode = locationData && locationData.zipcode ? locationData.zipcode : postal;
if (shouldNotCallPostalCodeUpdateOnPageLoad(locationData))
return;
contentsService.savePostalCode({
postalCode: (locationData || {}).zipcode ? locationData.zipcode : postal,
source: (locationData || {}).source
},
function (response) {
var source = (locationData || {}).source;
if ($scope.DataModel.IsAuthenticated &&
source === cartConstants.LocationSource.Unauthenticated)
source = cartConstants.LocationSource.Authenticated;
postalCodeUpdateCallBackOnSuccess(response, source);
});
};
return {
init: function (scope) {
$scope = scope;
},
savePostalCodeOnPageLoad: internalSavePostalCodeOnPageLoad,
savePostalCode: internalSavePostalCode,
updatePostalCode: internalUpdatePostalCode,
shippingVisitedOrPaymentsComplete: internalShippingVisitedOrPaymentsComplete
};
}
]);
}());
;
cartApp.service('paypalLightBoxService',
[
"urlResolverService", "cartConstants", "$http", "contentsService", function (urlResolverService, cartConstants, $http, contentsService) {
var $scope, $rootScope, serviceUrl, landingUrl, gpid, token;
var internalInit = function (scope, rootScope) {
$scope = scope;
$rootScope = rootScope;
landingUrl = urlResolverService.GetLandingUrl();
//light box flow disable on init, gets set to true if paypal script is loaded during renderButton().
$scope.paypalLightBoxEnabled = false;
};
var getToken = function(url, name) {
if (url) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^]*)"),
results = regex.exec(url);
return results === null ? null : results[1];
}
return '';
};
var triggerMetricListener = function(target) {
//simulate click on paypal omniture metrics CTA, as click on paypal lightbox does not trigger paypal express omniture event.(click event does not propogate above iframe)
$(target).click();
};
var activateResiliencyMode = function () {
//Resiliency mode!!!
//disable paypal light box flow, if there is error, exception on light box flow.
//express paypal lightbox disable
$scope.paypalLightBoxEnabled = false;
//payments page pyapal lightbox flow disable
$scope.isPaypalLightBoxSelected = false;
$scope.hideContinueButton = false;
$scope.$apply();
};
var createPayPalOrder = function (target) {
return $http.put(serviceUrl,
{
PendingPayment: {
LandingUrl: landingUrl,
PayCode: $scope.SelectedPaymentOption
? $scope.SelectedPaymentOption
: cartConstants.PayCode.payPal,
Amount: $scope.calculatedOrderAmount ? $scope.calculatedOrderAmount : 0
}
}).then(
function () { return ''; },
function (resp) {
if (resp && resp.status === 412) {
triggerMetricListener(target);
gpid = resp.data.Gpid;
token = getToken(resp.data.RedirectUrl, 'token');
return token;
}
if (resp && resp.status === 400) {
$scope.$broadcast('ValidationUrlErrorMsg', resp.data);
}
return '';
});
};
var logAndActivateResiliencyMode = function (err) {
console.log('Paypal LightBox Script | Error | ' + err);
activateResiliencyMode();
};
var renderButton = function (target) {
try {
if (typeof paypal != 'undefined' && paypal) {
//paypal lightbox is enabled if paypal script is loaded, and 'paypal' is defined
$scope.paypalLightBoxEnabled = true;
if ($(target).children().length <= 0) {
paypal.Buttons({
style: {
height: 35
},
fundingSource: paypal.FUNDING.PAYPAL,
createOrder: function (data, actions) {
if ($scope.enableBTOStopSellCheckOnCtaClick) {
return contentsService.CheckForEoledItem().then(
function (result) {
if (result && result.status && result.status === 200) {
result.ctaSource = "PayPalCheckoutCta";
$scope.$broadcast('ShowEolItemsMessage', result);
$scope.containsEolItems = true;
return '';
} else {
return createPayPalOrder(target);
}
},
function (error) {
if ($scope.ShowEmptyCartIdErrorMessage && error.status === 400) {
$scope.$broadcast('ShowEmptyCartIdMessage', error);
}
return '';
});
} else {
return createPayPalOrder(target);
}
},
onApprove: function (data, actions) {
$rootScope.loadingScreen.show();
window.location.replace(landingUrl + '?paycode=' + cartConstants.PayCode.payPal + '&profileid=&id=' + gpid);
},
onError: function (err) {
if ($scope.enableBTOStopSellCheckOnCtaClick) {
if ($scope.containsEolItems) {
$scope.containsEolItems = false;
} else {
logAndActivateResiliencyMode(err);
}
} else {
logAndActivateResiliencyMode(err);
}
}
}).render(target);
}
}
}
catch (error) {
console.log('Paypal LightBox Script | Error | ' + error);
activateResiliencyMode();
}
};
var renderCartPageLightBox = function() {
renderButton('#paypal-button-CartSummaryRight');
renderButton('#paypal-button-CartSummaryTop');
renderButton('#paypal-button-CartSummaryBottom');
};
var renderPaymentsPageLightBox = function () {
renderButton('#paypal-CartSummaryRight');
renderButton('#paypal-CartSummaryBottom-xs');
renderButton('#paypal-CartSummaryBottom-sm');
};
return {
initCartPageFlow: function(scope, rootScope) {
internalInit(scope, rootScope);
serviceUrl = urlResolverService.Resolve("/payments?currentStep=1");
renderCartPageLightBox();
},
initPaymentPageFlow: function (scope, rootScope) {
internalInit(scope, rootScope);
serviceUrl = urlResolverService.Resolve("/payments");
renderPaymentsPageLightBox();
}
};
}
]);;
(function(cartApp) {
cartApp.service('thirdPartyPaymentsLightBoxService', ['$rootScope', function thirdPartyPaymentsLightBoxService($rootScope) {
var popUpWindow, eventListener, messageEvent;
var openLightBoxPopUpWindow = function (url, title, w, h) {
w *= 0.70;
h *= 0.70;
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
popUpWindow = window.open('', title, 'dialog=yes, minimizable=no, toolbar=no, location=no, directories=no, status=no, ' +
'menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' +
w +
', height=' +
h +
', top=' +
top +
', left=' +
left);
popUpWindow.location = url;
}
var openLightBoxExperience= function(url, title, w, h, message) {
openLightBoxPopUpWindow(url, title, w, h);
$rootScope.loadingScreenLightBox.show();
$rootScope.loadingScreen.hide();
if (message) {
$("#loaderDivLightBox").find("p").text(message);
}
addEventHandlers();
}
function addEventHandlers() {
//Message handler to post the message from child to parent window
var messageHandler = function (e) {
if (e.data && e.data.indexOf("confirmation") > 0) {
popUpWindow.close();
window.location.replace(e.data);
}
}
function addMessenger() {
var eventMethod = window.addEventListener ? 'addEventListener' : 'attachEvent';
eventListener = window[eventMethod];
messageEvent = eventMethod === 'attachEvent' ? 'onmessage' : 'message';
// Listen to message from child window
eventListener(messageEvent, messageHandler, false);
}
function removeMessenger() {
$(window).off(messageEvent, messageHandler);
}
addMessenger();
//Close the child window when parent window is closed or reloaded
var onParentUnloadHandler = function(e) {
if (popUpWindow && !popUpWindow.closed) {
popUpWindow.close();
}
}
function addOnParentUnloadHandler() {
window.onbeforeunload = onParentUnloadHandler;
}
function removeOnParentUnloadHandler() {
$(window).off('onbeforeunload', onParentUnloadHandler);
}
addOnParentUnloadHandler();
//Re-focus the child window if parent window is clicked
var parentWindowClickEventHandler = function () {
popUpWindow.focus();
}
function addParentWindowClickEventHandler() {
$('#loaderDivLightBox').click(parentWindowClickEventHandler);
}
function removeParentWindowClickEventHandler() {
$('#loaderDivLightBox').off('click', parentWindowClickEventHandler);
}
addParentWindowClickEventHandler();
//Close the layout and pop up window if X is clicked
function closePopUp() {
$('#closeLoaderDivLightBox').click(onParentUnloadHandler);
}
function removeClosePopUpClickHandler() {
$('#closeLoaderDivLightBox').off('click',onParentUnloadHandler);
}
closePopUp();
//Keep polling to check if the child window is closed
var startInterval = setInterval(function() {
if (popUpWindow.closed) {
$rootScope.loadingScreenLightBox.hide();
if (startInterval) {
clearInterval(startInterval);
startInterval = undefined;
removeMessenger();
removeOnParentUnloadHandler();
removeParentWindowClickEventHandler();
removeClosePopUpClickHandler();
}
}
},
1000);
}
return {
OpenLightBoxExperience: openLightBoxExperience
}
}
]);
})(cartApp);
;
(function () {
'use strict';
// TODO: File name should match the service name
cartApp.service('googleAutocompleteService', ["featureService","validationService","cartConstants","errorLoggingService",
function googleAutocompleteService(featureService, validationService, cartConstants, errorLoggingService) {
var $scope;
var autoCompleteService;
var geocoderService;
var sourceContact;
var addressDataModel;
var localityExists;
var stateList;
var TerritoryList;
var addressComponent = {
street_number: 'short_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'short_name',
administrative_area_level_2: 'short_name',
country: 'long_name',
postal_code: 'short_name',
postal_town: 'long_name',
political: 'long_name'
};
var browserGeoLocation;
var radius;
//Method to set Address Fields
var setAddressFields = function (addressType, value, addressModel) {
switch (addressType) {
case "postal_code":
addressModel.PostalCode = value;
//Assigning value to control, as Postalcode value from datamodel was overriding during blur event
$("#DataModel-" + sourceContact + "-PostalCode").val(value);
$("#DataModel-" + sourceContact + "-PostalCode").blur();
break;
case "administrative_area_level_1":
addressModel.State = value;
addressModel.Line5 = value;
break;
case "locality":
addressModel.City = value;
localityExists = true;
break;
case "route":
addressModel.Line1 = addressModel.Line1 + " " + value;
break;
case "street_number":
addressModel.Line1 = value;
break;
case "country":
addressModel.Country = value;
SetTerritory(value, addressModel);
break;
case "postal_town":
if (!localityExists) {
addressModel.City = value;
}
break;
case "political":
if (featureService.IsEnabled("GetShortNameForJpState")) {
addressModel.Line3 = value + addressModel.Line3;
}
else {
addressModel.Line3 = value;
}
break;
case "administrative_area_level_2":
if (featureService.IsEnabled("GetShortNameForJpState")) {
addressModel.City = value + addressModel.City;
}
break;
default:
break;
}
};
var SetTerritory = function (country, addressModel) {
var isExists = false;
if (TerritoryList) {
for (var i = 0; i < TerritoryList.length; i++) {
if (TerritoryList[i].Value === country) {
addressModel.Territory = TerritoryList[i].Key;
isExists = true;
break;
}
}
if (!isExists) {
addressModel.Territory = "";
}
}
}
//Method to get StreetAddress Line1 max length and set Line1MaxLength, if Line address length is more than Max length
var setStreetAddress = function (element, streetAddress) {
var streetAddrCtrl = $('#' + element.id)[0];
if (streetAddress != null && streetAddress.length > streetAddrCtrl.maxLength) {
addressDataModel.Line1 = addressDataModel.Line1.substr(0, streetAddrCtrl.maxLength);
addressDataModel.Line1MaxLength = streetAddrCtrl.maxLength;
$scope.DataModel.isLine1MessageTrimmed = true;
}
}
//Method to Clear validation message if any exists
var validationForAutoFilledFields = function () {
$("#DataModel-" + sourceContact + "-Line1").blur();
$("#DataModel-" + sourceContact + "-PostalCode").blur();
//France bllackisted zip code error message removal if any, this functionallity currently exists only for shipping page
if (sourceContact == "ShippingContact" && featureService.IsEnabled("ExcludedZipCode") && $scope.DataModel.ExcludedZipCodes != null && $scope.DataModel.ExcludedZipCodes.indexOf(addressDataModel.PostalCode.substr(0, 3)) == -1 && $("#DataModel-" + sourceContact + "-PostalCode").val()) {
validationService.hideAllValidationAlerts("#DataModel-ShippingContact-PostalCode");
}
$("#DataModel-" + sourceContact + "-Line3").blur();
$("#DataModel-" + sourceContact + "-City").blur();
$("#DataModel-" + sourceContact + "-State").change();
$("#DataModel-" + sourceContact + "-Territory").change();
$("#DataModel-" + sourceContact + "-Line5").change();
}
//Method to Clear contactDataModel values
var clearAddressFields = function (addressModel) {
addressModel.Line1 = "";
addressModel.PostalCode = "";
addressModel.City = "";
addressModel.State = "";
addressModel.Territory = "";
addressModel.Line5 = "";
addressModel.Line3 = "";
addressModel.Country = "";
}
//Method to prevent default value selection for typeahead input control
var localpreventDefaultAddress = function (event, selectedValue, attr, isGooglePredictionsSelected) {
if ($scope.DataModel) {
getSourceContact(attr);
if (isGooglePredictionsSelected) {
event.typeahead('val', addressDataModel.Line1);
}
else {
event.typeahead('val', selectedValue);
}
}
};
var getStateAndTerriotyList = function (viewmodel) {
if (viewmodel) {
if (viewmodel.StateList != null && viewmodel.StateList.States.length > 0) {
stateList = viewmodel.StateList.States;
}
if (viewmodel.TerritoryList != null && viewmodel.TerritoryList.Territories.length > 0) {
TerritoryList = viewmodel.TerritoryList.Territories;
}
}
}
//Method to get respective datamodel and statelist
var getDataModel = function (sourceContact) {
if ($scope.DataModel) {
switch (sourceContact) {
case "ShippingContact":
addressDataModel = $scope.DataModel.ShippingContact;
getStateAndTerriotyList($scope.DataModel.netViewModel.ShippingContactViewModel);
break;
case "BillingContact":
addressDataModel = $scope.DataModel.BillingContact;
getStateAndTerriotyList($scope.DataModel.netViewModel.BillingContactViewModel);
break;
case "AddEditShippingAddress":
addressDataModel = $scope.DataModel.AddEditShippingAddress;
getStateAndTerriotyList($scope.DataModel.netViewModel.ShippingContactViewModel)
break;
case "AddEditBillingAddress":
addressDataModel = $scope.DataModel.AddEditBillingAddress;
getStateAndTerriotyList($scope.DataModel.netViewModel.BillingContactViewModel);
break;
default:
break;
}
}
}
//Generic for set the short name for state
var setShortName = function () {
var isshortNameExists = false;
for (var i = 0; i < stateList.length; i++) {
if (stateList[i].Key.toUpperCase().trim() === addressDataModel.State.toUpperCase()) {
addressDataModel.State = addressDataModel.State;
isshortNameExists = true;
break;
}
else if (stateList[i].Value.toUpperCase().trim() === addressDataModel.State.toUpperCase()) {
addressDataModel.State = stateList[i].Key;
isshortNameExists = true;
break;
}
}
if (!isshortNameExists) {
addressDataModel.State = "";
}
addressDataModel.Line5 = addressDataModel.State;
}
//Assigning short name for my and sg into datamodel
var SetShortNameForMyOrSg = function () {
if (stateList) {
var isStateExists = false;
for (var i = 0; i < stateList.length; i++) {
if (stateList[i].Value.toUpperCase().trim() === addressDataModel.State.toUpperCase() + ", " + addressDataModel.Country.toUpperCase()) {
addressDataModel.State = stateList[i].Key;
isStateExists = true;
break;
}
}
if (!isStateExists) {
addressDataModel.State = "";
}
}
}
var SetShortNameForJp = function () {
if (stateList) {
var isStateExists = false;
for (var i = 0; i < stateList.length; i++) {
if (stateList[i].Value && stateList[i].Value.trim() === addressDataModel.State) {
addressDataModel.State = stateList[i].Value;
addressDataModel.Line5 = stateList[i].Key;
isStateExists = true;
break;
}
}
if (!isStateExists) {
addressDataModel.State = "";
addressDataModel.Line5 = "";
}
}
}
//get shortname for my and sg,, as we have comma separated state list
var getShortNameForState = function () {
if (featureService.IsEnabled("GetShortNameForMyState")) {
SetShortNameForMyOrSg();
}
else if (featureService.IsEnabled("GetShortNameForSgState")) {
//Currently we have only one state in dropdown for SG, as we are getting empty value from google API we have done workaround for state
if (!addressDataModel.State) {
addressDataModel.State = addressDataModel.Country;
}
SetShortNameForMyOrSg();
}
else if (featureService.IsEnabled("GetShortNameForJpState")) {
SetShortNameForJp();
}
else if (stateList) {
setShortName();
}
}
//Method to get SourceContact and DataModel
var getSourceContact = function (attr) {
var attrList = attr.id.split('-');
sourceContact = attrList[1];
getDataModel(sourceContact);
}
//Displaying error message if Line1 length is more than control maxlength
var localdisplayLineTrimmedMessage = function (isLine1MessageTrimmed) {
if (isLine1MessageTrimmed) {
addressDataModel.ShowStressAddressTrimed = true;
$scope.DataModel.isLine1MessageTrimmed = false;
}
else {
addressDataModel.ShowStressAddressTrimed = false;
}
}
var localBrowserGeoLocation = function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
radius = position.coords.accuracy;
var latLang = new google.maps.LatLng(pos.lat, pos.lng);
browserGeoLocation = latLang;
//infoWindow.setPosition(pos);
//infoWindow.setContent('Location found.');
//infoWindow.open(map);
// map.setCenter(pos);
}, function errorCallback(err) {
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("ERROR in geolocation getCurrentPosition:" + err.message, cartConstants.ErrorCodes.googleAutoCompleteError);
});
} else {
// Browser doesn't support Geolocation
//handleLocationError(false, infoWindow, map.getCenter());
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("Browser doesn't support Geolocation:", cartConstants.ErrorCodes.googleAutoCompleteError);
}
}
var localGetPlacePredictions = function (query, process, processAsync) {
var returnData = [];
autoCompleteService.getPlacePredictions({
input: query,
location: browserGeoLocation,
radius: radius,
types: ['address'],
componentRestrictions: {
country: $scope.lwp.c
}
}, function (predictions, status) {
if (status != google.maps.places.PlacesServiceStatus.OK || !predictions) {
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("Error in Place Autocomplete Service predictions:" + status, cartConstants.ErrorCodes.googleAutoCompleteError);
return;
}
if (status == google.maps.places.PlacesServiceStatus.OK) {
processAsync($.map(predictions, function (prediction) {
return { place_id: prediction.place_id, value: prediction.description };
}));
}
});
}
var geoData = [{}];
var localFillAddressFields = function (placeId, ev, attr, currentElement) {
geocoderService.geocode({ 'placeId': placeId}, function (results, status) {
if (status === 'OK') {
if (results[0]) {
var addressDetails = results[0].address_components;
getSourceContact(attr);
clearAddressFields(addressDataModel);
for (var i = 0; i < addressDetails.length; i++) {
var addressType = addressDetails[i].types[0];
if (addressComponent[addressType]) {
var val = addressDetails[i][addressComponent[addressType]];
//Function for all the varities of address to assigning to respective fields
setAddressFields(addressType, val, addressDataModel);
}
}
localityExists = false;
getShortNameForState();
setStreetAddress(attr, addressDataModel.Line1);
var initialAddressLine = addressDataModel.Line1;
currentElement.typeahead('val', initialAddressLine);
validationForAutoFilledFields();
} else {
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("Geocoder No results found:" + status, cartConstants.ErrorCodes.googleAutoCompleteError);
}
} else {
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("Geocoder failed due to:" + status, cartConstants.ErrorCodes.googleAutoCompleteError);
}
});
};
//Function to get predictions from Google Places API using PostalCode
var localGetPlacePredictionsByPostalCode = function (query, process, processAsync) {
//Due to input masking we need to modify the value to get predictions from Google API
query = query.replaceAll('_', '');
autoCompleteService.getPlacePredictions({
input: query,
location: browserGeoLocation,
radius: radius,
types: ['(regions)'],
componentRestrictions: {
country: $scope.lwp.c
}
}, function (predictions, status) {
if (status != google.maps.places.PlacesServiceStatus.OK || !predictions) {
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("Error in Place Autocomplete Service predictions ByPostalCode:" + status, cartConstants.ErrorCodes.googleAutoCompleteError);
return;
}
if (status == google.maps.places.PlacesServiceStatus.OK) {
processAsync($.map(predictions, function (prediction) {
return { place_id: prediction.place_id, value: prediction.description };
}));
}
});
}
//Function to get details of selected address from Google Geocode API using PostalCode
var localFillAddressFieldsByPostalCode = function (placeId, ev, attr, currentElement) {
geocoderService.geocode({ 'placeId': placeId }, function (results, status) {
if (status === 'OK') {
if (results[0]) {
var addressDetails = results[0].address_components;
getSourceContact(attr);
clearAddressFields(addressDataModel);
for (var i = 0; i < addressDetails.length; i++) {
var addressType = addressDetails[i].types[0];
if (addressComponent[addressType]) {
var val = addressDetails[i][addressComponent[addressType]];
//Function for all the varities of address to assigning to respective fields
setAddressFields(addressType, val, addressDataModel);
}
}
localityExists = false;
getShortNameForState();
var initialPostalCode = addressDataModel.PostalCode;
currentElement.typeahead('val', initialPostalCode);
validationForAutoFilledFields();
} else {
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("Geocoder No results found ByPostalCode:" + status, cartConstants.ErrorCodes.googleAutoCompleteError);
}
} else {
if ($scope.ClientSideLoggingEnabled)
errorLoggingService.logError("Geocoder failed due to ByPostalCode:" + status, cartConstants.ErrorCodes.googleAutoCompleteError);
}
});
};
function localInit(scope, sourceContactType) {
if (google && google.maps && google.maps.places) {
$scope = scope;
// todo:FT here
// log maps version
console.log("Google Maps Api version:" + google.maps.version);
var lwp = Dell.Transactional.buildLightweightProfile();
$scope.lwp = lwp;
autoCompleteService = new google.maps.places.AutocompleteService();
geocoderService = new google.maps.Geocoder();
$scope.ClientSideLoggingEnabled = featureService.IsEnabled("ClientSideLoggingEnabled");
}
}
// ToDO: Geolocate via browser
return {
initAutocomplete: localInit,
getPlacePredictions: localGetPlacePredictions,
fillAddressFields: localFillAddressFields,
getPlacePredictionsByPostalCode: localGetPlacePredictionsByPostalCode,
fillAddressFieldsByPostalCode: localFillAddressFieldsByPostalCode,
geolocate: localBrowserGeoLocation,
preventDefaultAddress: localpreventDefaultAddress,
displayLineTrimmedMessage: localdisplayLineTrimmedMessage
};
}
]);
}());
;
'use strict';
cartApp.service('googleMapsApiInitService', ["$window", "$q", "customFieldService", "featureService", "cartConstants", "errorLoggingService",function googleMapsApiInitService($window, $q, customFieldService, featureService, cartConstants, errorLoggingService) {
function loadScript() {
try {
//TODO: Later when globaliization happens use this on url to control language
var us = Dell.Transactional.buildLightweightProfile();
var country = us.c;
var lang = us.l;
// use global document since Angular's $document is weak
var scriptTag = document.createElement('script');
var googleMapsApiPath = customFieldService.GetData("GoogleMapsApiKey");
scriptTag.src = "//maps.googleapis.com/maps/api/js?key={0}&libraries=places&language={1}&callback=initMap".format(googleMapsApiPath, lang);
document.body.appendChild(scriptTag);
}
catch (e) {
if (featureService.IsEnabled("ClientSideLoggingEnabled"))
errorLoggingService.logError("error in googleMapsApiInitService:" + e, cartConstants.ErrorCodes.googleAutoCompleteError);
}
}
var deferred = $q.defer();
$window.initMap = function () {
deferred.resolve();
}
if ($window.attachEvent) {
$window.attachEvent('onload', loadScript);
} else {
$window.addEventListener('load', loadScript, false);
}
return deferred.promise;
}]);;
"use strict";
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
!function (e, t) {
"object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports)) && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define("UIC", ["exports"], t) : t((e = e || self).UIC = {});
}(void 0, function (e) {
"use strict";
var t = document,
n = t.documentElement,
a = "undefined" != typeof global ? global : window,
i = "dds__",
r = "WebkitTransition" in n.style || "Transition".toLowerCase() in n.style,
s = "WebkitTransition" in n.style ? "Webkit".toLowerCase() + "TransitionEnd" : "Transition".toLowerCase() + "end",
o = "WebkitDuration" in n.style ? "Webkit".toLowerCase() + "TransitionDuration" : "Transition".toLowerCase() + "Duration",
l = /\b(top|bottom|left|right)+/,
d = /(IPhone)/i.test(navigator.platform),
c = (/iPad|iPhone|iPod|Macintosh/i.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 1) && !window.MSStream,
u = /msie|trident|Windows Phone/i.test(navigator.userAgent),
f = /Version\/[\d.]+.*Safari/i.test(navigator.userAgent),
p = /Edge\/\d./i.test(navigator.userAgent),
h = /firefox/i.test(navigator.userAgent),
v = (!window.chrome || !window.chrome.webstore && window.chrome.runtime, {
UP: 1,
RIGHT: 2,
DOWN: 3,
LEFT: 4,
NONE: 5
});
function m() {
var e = t.getElementById(i + "full-screen-overlay");
return e || (console.warn("OFF-CANVAS: Overlay requested. Corresponding HTML missing. Please apply id 'dds__full-screen-overlay' and class 'dds__overlay' to an empty div"), !1);
}
function g(e, t) {
return [].slice.call(e.getElementsByClassName(t));
}
function b(e, t) {
var n = t.charAt(0),
a = t.substr(1);
if ("." === n) {
if (e.nextElementSibling && e.nextElementSibling.classList) return e.nextElementSibling.classList.contains(a) ? e.nextElementSibling : b(e.nextElementSibling, t);
} else if ("#" === n) {
if (e.nextElementSibling && e.nextElementSibling.id) return e.nextElementSibling.id === a ? e.nextElementSibling : b(e.nextElementSibling, t);
} else if (e.nextElementSibling && e.nextElementSibling.tagName) return e.nextElementSibling.tagName.toLowerCase() === t.toLowerCase() ? e.nextElementSibling : b(e.nextElementSibling, t);
}
function y(e) {
return Array.prototype.slice.call(e.querySelectorAll("*:not([aria-expanded='false']) a[href],*:not([aria-expanded='false']) area[href],*:not([aria-expanded='false']) input:not([disabled]),*:not([aria-expanded='false']) select:not([disabled]),*:not([aria-expanded='false']) textarea:not([disabled]),*:not([aria-expanded='false']) button:not([disabled]):not(.dds__d-none), *:not([aria-expanded='false']) > .dds__accordion-card-body > ul > [tabindex='0']")).filter(L);
}
function L(e) {
for (; e && e !== t; e = e.parentElement) {
if (!e.parentElement) return e;
if (e.parentElement.classList.contains("dds__collapse") && "false" == e.parentElement.getAttribute("aria-expanded") || e.parentElement.classList.contains(i + "d-none")) return !1;
}
}
function w(e, n) {
var a = n.charAt(0),
i = n.substr(1);
if ("." === a) {
for (; e && e !== t; e = e.parentNode) {
if (null !== e.parentNode.querySelector(n) && e.classList.contains(i)) return e;
}
} else if ("#" === a) {
for (; e && e !== t; e = e.parentNode) {
if (e.id === i) return e;
}
} else for (; e && e !== t; e = e.parentNode) {
if (e.tagName && e.tagName.toLowerCase() === n.toLowerCase()) return e;
if (e.previousElementSibling && e.previousElementSibling.tagName.toLowerCase() === n.toLowerCase()) return e.previousElementSibling;
}
return !1;
}
function x(e, t, n) {
e.addEventListener(t, function a(i) {
n(i), e.removeEventListener(t, a, !1);
}, !1);
}
function E(e) {
var t = r ? a.getComputedStyle(e)[o] : 0;
return (t = "number" != typeof (t = parseFloat(t)) || isNaN(t) ? 0 : 1e3 * t) + 50;
}
function S(e, t) {
var n = 0,
a = E(e);
r && x(e, s, function (e) {
t(e), n = 1;
}), setTimeout(function () {
!n && t();
}, a);
}
function k(e, t, n, a) {
var i;
u ? (i = document.createEvent("CustomEvent")).initCustomEvent("uic" + e + t, !0, !0, a) : i = new CustomEvent("uic" + e + t, {
bubbles: !0,
detail: a
}), i.relatedTarget = n, n.dispatchEvent(i);
}
function C(e) {
e.focus ? e.focus() : e.setActive();
}
function A(e, i, r, s, o) {
var d = {
w: i.offsetWidth,
h: i.offsetHeight
};
o = "boolean" != typeof o || o;
var c,
u,
f,
p,
h,
v,
m,
g = n.clientWidth || t.body.clientWidth,
b = n.clientHeight || t.body.clientHeight,
y = e.getBoundingClientRect(),
L = s === t.body ? {
y: a.pageYOffset || n.scrollTop,
x: a.pageXOffset || n.scrollLeft
} : {
y: s.offsetTop + s.scrollTop,
x: s.offsetLeft + s.scrollLeft
},
w = e.offsetWidth,
x = e.offsetHeight,
E = i.classList.contains("dds__popover"),
S = i.querySelector(".dds__arrow"),
k = y.top + x / 2 - d.h / 2 < 0,
C = y.left + w / 2 - d.w / 2 < 0,
A = y.left + d.w / 2 + w / 2 >= g,
T = y.top + d.h / 2 + x / 2 >= b,
q = y.top - d.h < 0,
D = y.left - d.w < 0,
N = y.top + d.h + x >= b,
M = y.left + d.w + w >= g;
r = "right" === (r = "left" === (r = "bottom" === (r = "top" === (r = ("left" === r || "right" === r) && D && M ? m = "top" : r) && q ? "bottom" : r) && N ? "top" : r) && D ? "right" : r) && M ? "left" : r, -1 === i.className.indexOf(r) && (i.className = i.className.replace(l, r)), m && (d = {
w: i.offsetWidth,
h: i.offsetHeight
}), h = S.offsetWidth, v = S.offsetHeight;
var _ = y.left,
I = y.top;
o || ("left" === r ? _ = y.left + h : "right" === r ? _ = y.left - h : "top" === r ? I = y.top + v : "bottom" === r && (I = y.top - v)), "left" === r || "right" === r ? ("left" === r ? (u = _ + L.x - d.w - (E ? h : 3), window.addEventListener("resize", function () {
S.style.left = "initial";
})) : u = _ + w + (E ? 0 : 3), k ? (c = y.top + L.y, f = Math.abs(x / 2 - h)) : T ? (c = y.top - d.h + x + L.y, f = d.h - x / 2 - (E ? h : h / 2)) : (c = y.top - d.h / 2 + x / 2 + L.y, f = d.h / 2 - (E ? .9 * v : v / 2))) : "top" !== r && "bottom" !== r || (c = "top" === r ? I + L.y - d.h - (E ? v : 3) : I + x + L.y + (E ? 0 : 3), C ? (u = 0, p = y.left + w / 2 - (E ? h : h / 2)) : A ? (u = g - 1.01 * d.w, p = d.w - (g - y.left) + w / 2 - h / 2) : (u = y.left - d.w / 2 + w / 2 + L.x, p = d.w / 2 - h / 2)), i.style.top = c + "px", i.style.left = u + "px", f && (S.style.top = f + "px"), p && (S.style.left = p + "px");
}
function T(e) {
9 === e.keyCode && (document.body.classList.add("user-is-tabbing"), window.removeEventListener("keydown", T), window.addEventListener("mousedown", q));
}
function q(e) {
0 === e.x && 0 === e.y || (document.body.classList.remove("user-is-tabbing"), window.removeEventListener("mousedown", q), window.addEventListener("keydown", T));
}
function D(e) {
return "[object Object]" === Object.prototype.toString.call(e);
}
function N(e) {
return Array.isArray(e);
}
function M(e) {
var t = !1;
try {
t = JSON.parse(e);
} catch (e) {
return !1;
}
return !(null === t || !N(t) && !D(t)) && t;
}
function _(e, t, n) {
var a;
if (!e) return !1;
if (D(e)) for (a in e) {
Object.prototype.hasOwnProperty.call(e, a) && t.call(n, e[a], a);
} else {
if (!(e.length > 0)) return !1;
for (a = 0; a < e.length; a++) {
t.call(n, e[a], a);
}
}
}
function I(e, t) {
var n, a;
1 === t ? (n = 0, a = e.length) : -1 === t && (n = e.length - 1, a = -1);
for (var i = !0; i;) {
i = !1;
for (var r = n; r != a; r += t) {
if (e[r + t] && e[r].value > e[r + t].value) {
var s = e[r],
o = e[r + t],
l = s;
e[r] = o, e[r + t] = l, i = !0;
}
}
}
return e;
}
function P(e, n) {
var a,
i = t.createElement(e);
if (n && "object" == _typeof(n)) for (a in n) {
if ("html" === a) i.innerHTML = n[a]; else if ("aria_" === a.slice(0, 5) || "data_" === a.slice(0, 4)) {
var r = a.slice(0, 4) + "-" + a.slice(5);
i.setAttribute(r, n[a]);
} else i.setAttribute(a, n[a]);
}
return i;
}
function H(e, t) {
_(N(t) ? t : [t], function (t) {
if (e.classList) e.classList.add(t); else {
var n = e.getAttribute("class");
n ? -1 == n.indexOf(t) && e.setAttribute("class", n + " " + t) : e.setAttribute("class", t);
}
});
}
function O(e, t) {
_(N(t) ? t : [t], function (t) {
if (e.classList) e.classList.remove(t); else {
var n = e.getAttribute("class").replace(t, "");
e.setAttribute("class", n);
}
});
}
function R(e, t, n) {
var a;
return function () {
var i = this,
r = arguments,
s = n && !a;
clearTimeout(a), a = setTimeout(function () {
a = null, n || e.apply(i, r);
}, t), s && e.apply(i, r);
};
}
function B(e, t) {
var n;
return _(e, function (e) {
t(e) && (n = e);
}), n;
}
function F(e, t) {
if (e) {
if (isNaN(e) && "string" != typeof e) return t || !1;
if ("string" == typeof e) {
if (isNaN(parseInt(e, 10))) return t || !1;
e = parseInt(e, 10);
}
return e;
}
return t;
}
function z(e, t) {
var n = e.dataset.options;
return n ? JSON.parse(n) : t;
}
function W(e, n) {
var a = t.createElementNS("http://www.w3.org/2000/svg", "svg");
for (var r in a.setAttribute("focusable", !1), H(a, i + "svg-icons"), H(a, i + "icon-svg"), N(e) || (e = [e]), _(e, function (e) {
var n = t.createElementNS("http://www.w3.org/2000/svg", "use");
n.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#" + i + e.name), H(n, [i + "svg-icons-item"]), H(n, i + "icon-svg-item"), n.setAttribute("tabindex", "-1"), e.show && H(n, [i + "show"]), a.appendChild(n);
}), n) {
Object.prototype.hasOwnProperty.call(n, r) && a.setAttribute(r, n[r]);
}
return a;
}
function V(e, t) {
if (_instanceof(e, NodeList)) _(e, function (e) {
V(e, t);
}); else if (t) for (; e.hasChildNodes();) {
e.removeChild(e.firstChild);
} else e.innerHTML = "";
}
function j(e) {
var n,
a = t.createElement("div");
return a.innerHTML = e, function e(t) {
_(t.childNodes, function (t) {
3 === t.nodeType && (n = t.data), e(t);
}, this);
}(a), n;
}
function U(e) {
e = _instanceof(e, HTMLElement) && e;
var t,
n = 0,
a = !1,
r = function r(e) {
var n = e.target.getAttribute("id"),
a = t.querySelector("#" + n + "Mask"),
i = t.querySelector("#" + n + "Mask i");
e.target.value != i.innerHTML && (e.target.value = s(e), a.innerHTML = function (e) {
var t = e.target.value;
return "" + t + "" + e.target.getAttribute("data-placeholder").substr(t.length);
}(e));
},
s = function s(e) {
var t,
n,
a,
i,
r,
s = e.target.getAttribute("data-charset"),
l = s || e.target.getAttribute("data-placeholder"),
d = e.target.value,
c = l.length,
u = "";
for (r = s ? d.replace(/\W/g, "") : d.replace(/\D/g, ""), t = 0, n = 0; t < c; t++) {
a = !isNaN(parseInt(r[n])), i = !!r[n] && r[n].match(/[A-Z]/i);
var f = "XdDmMyY9".indexOf(l[t]) >= 0,
p = "_".indexOf(l[t]) >= 0;
if (f && a || s && p && i) u += r[n++]; else {
if (!s && !a && f || s && (p && !i || f && !a)) return u;
u += l[t];
}
if (null == r[n]) break;
}
return e.target.getAttribute("data-valid-example") ? o(e, u) : u;
},
o = function o(e, t) {
var n = e.target.getAttribute("data-valid-example"),
a = new RegExp(e.target.getAttribute("pattern")),
i = e.target.getAttribute("data-placeholder"),
r = t.length,
s = "";
if (1 == r && "MM" == i.toUpperCase().substr(0, 2)) return t > 1 && t < 10 && (t = "0" + t), t;
for (var o = r; o >= 0; o--) {
if (s = t + n.substr(t.length), a.test(s)) return t;
t = t.substr(0, t.length - 1);
}
return t;
};
if (!("InputMask" in e)) {
var l = e.parentNode;
a = !!e.value, l && l.classList.contains(i + "input-shell") || (!function (e) {
t = P("span", {
class: i + "input-shell"
}), n = e.getAttribute("set-cursor") ? isNaN(parseInt(e.getAttribute("set-cursor"))) ? n : 1 != parseInt(e.getAttribute("set-cursor")) ? n : 1 : n;
var r = P("span", {
aria_hidden: "true",
id: e.getAttribute("id") + "Mask"
}),
s = P("i"),
o = e.getAttribute("class"),
l = a ? e.value : e.getAttribute("placeholder"),
d = document.createTextNode(l),
c = b(e, "#" + e.getAttribute("id") + "Feedback");
e.setAttribute("maxlength", d.length), e.setAttribute("data-placeholder", l), e.removeAttribute("placeholder"), (!o || o && -1 === o.indexOf("masked")) && e.setAttribute("class", o + " masked"), r.appendChild(s), r.appendChild(d), t.appendChild(r), e.parentNode.insertBefore(t, e), t.appendChild(e), c && t.appendChild(c);
}(e), e.addEventListener("change", r, !1), e.addEventListener("keyup", r, !1), n > 0 && e.addEventListener("focus", function (t) {
for (var a = 0; a < n; a++) {
var i,
r = t.target.getAttribute("data-placeholder").charAt(a);
e.value += r, u ? (i = document.createEvent("KeyboardEvent")).initKeyboardEvent("keyup", !0, !0, null, r, null, "", !1, "") : i = new KeyboardEvent("keyup", {
bubbles: !0,
cancelable: !0,
char: r,
key: "[",
shiftKey: !0
}), e.dispatchEvent(i);
}
}, !1));
}
e.InputMask = self;
}
function Y(e, t) {
e = _instanceof(e, HTMLElement) && e, t = t || {}, e.dataset.type && (t.type = e.dataset.type), e.dataset.position && (t.position = e.dataset.position), e.dataset.top && (t.top = parseInt(e.dataset.top)), e.dataset.style && (t.style = e.dataset.style), t.type = t.type ? t.type : "single", t.style = t.style && "svg" === t.style ? t.style = "svg" : "button", t.position = t.position && "outset" === t.position ? "outset" : "inset", t.top = t.top && "number" == typeof t.top ? t.top : null, t.lazyload = !!t.lazyload && t.lazyload, t.responsive = !!t.responsive && t.responsive;
var n,
a,
r,
s,
o,
l,
d,
c,
f,
h,
v = !1,
m = !0,
g = !0,
b = 0,
y = R(function () {
if (E(), T(), A([l, d]), Math.abs(a.offsetLeft) + a.offsetWidth > r.width && l.hasAttribute("active")) {
var e = x();
a.style.left = e + "px";
}
}, 10),
L = function L(e) {
var t = !!e.target.classList.contains(i + "overflow-control-right");
w(t);
},
w = function w(e) {
var n = null;
if ("single" == t.type) {
if (e) {
m = !1;
var i = r.children[s + 1],
l = i.offsetLeft + i.offsetWidth - (Math.abs(a.offsetLeft) + a.offsetWidth);
s + 1 >= r.children.length - 1 && (g = !0), n = -1 * (Math.abs(a.offsetLeft) + l + ("inset" !== t.position || g ? 0 : c));
} else {
g = !1;
var d = r.children[o - 1];
o - 1 == 0 ? (m = !0, n = 0) : n = -1 * (d.offsetLeft - ("inset" !== t.position || m ? 0 : c));
}
} else if (e) n = x(); else if (g = !1, r.children[o].offsetLeft < a.offsetWidth) m = !0, n = 0; else {
var u = Math.abs(a.offsetLeft) - r.children[o - 1].offsetLeft,
f = a.offsetWidth - ("inset" === t.position ? c : 0) - r.children[o - 1].offsetWidth;
n = -1 * (Math.abs(a.offsetLeft) - (u + f));
}
a.style.left = n + "px", S(a, T);
},
x = function x() {
var e;
m = r.width < a.offsetWidth;
var n = null,
i = r.width - (Math.abs(a.offsetLeft) + a.offsetWidth);
if (a.offsetWidth >= i) {
g = !0;
var o = (e = r.children[r.children.length - 1]).offsetLeft + e.offsetWidth - (Math.abs(a.offsetLeft) + a.offsetWidth);
n = -1 * (Math.abs(a.offsetLeft) + o);
} else g = !1, n = -1 * ((e = r.children[s + 1]).offsetLeft - ("inset" !== t.position || g ? 0 : c));
return n;
},
E = function E() {
r.width = 0, r.children = [], _(a.children, function (e) {
r.width += e.offsetWidth + C(e), r.children.push(e);
}), r.width -= p ? r.children.length - 1 : 0;
},
C = function C(e) {
var t = e.currentStyle || window.getComputedStyle(e);
return u ? q(t.getPropertyValue("margin-left")) + q(t.getPropertyValue("margin-right")) : parseInt(t.marginLeft) + parseInt(t.marginRight);
},
A = function A(e) {
N(e) || (e = [e]), _(e, function (e) {
"button" === t.style && (e.style.height = r.children[0].offsetHeight + "px");
});
},
T = function T() {
o = null, s = null;
var p = !1,
y = (n.offsetWidth - r.width) / 2,
L = !1;
v && (L = function (e) {
return e < 0 ? (a.parentElement.classList.contains(i + "tabs-centered-container") && a.parentElement.classList.remove(i + "tabs-centered-container"), a.classList.contains(i + "tab-centered") && a.classList.remove(i + "tab-centered"), !1) : (a.parentElement.classList.contains(i + "tabs-centered-container") || a.parentElement.classList.add(i + "tabs-centered-container"), a.classList.contains(i + "tab-centered") || a.classList.add(i + "tab-centered"), a.style.left = "0px", !0);
}(y)), function (e, i) {
e ? (f = i > 0 ? 0 : i, h = n.offsetWidth, b = Math.floor(i)) : (f = Math.abs(a.offsetLeft), f += "inset" !== t.position || m ? 0 : c, h = f + a.offsetWidth);
}(L, y), _(r.children, function (e, t) {
var n;
n = L ? b + Math.floor(r.width / r.children.length) * t : e.offsetLeft, !p && n >= f && (o = t, p = !0), n + e.offsetWidth <= h && (s = t);
}), m = !(o > 0), (g = !(s < r.children.length - 1)) ? (d.removeAttribute("active"), u && v && m && M()) : d.hasAttribute("active") || (d.setAttribute("active", ""), u && v && (a.style.minWidth = "")), m ? l.removeAttribute("active") : l.hasAttribute("active") || l.setAttribute("active", ""), k("Overflow", "ChangeEvent", e, {
left: o,
right: s,
totalItems: r.children.length,
hasRightControl: d.hasAttribute("active"),
hasLeftControl: l.hasAttribute("active")
});
},
q = function q(e) {
if (e.indexOf("rem") > 0) {
var t = (e = e.split("rem")[0]) * parseFloat(getComputedStyle(document.documentElement).fontSize);
return t < 0 ? Math.floor(t) : Math.ceil(t);
}
return 0;
},
D = function D() {
var e = d.currentStyle || window.getComputedStyle(d, null);
c = u ? q(e.getPropertyValue("width")) : parseInt(e.getPropertyValue("width").match(/^\d.?/g)[0]);
},
M = function M() {
var e = 0;
_(a.querySelectorAll("LI"), function (t) {
e += 120 + C(t);
}), a.style.minWidth = e - 5 + "px";
},
I = function I() {
E(), function () {
(l = P("button", {
class: i + "overflow-control " + i + "overflow-control-left " + ("button" === t.style ? i + "overflow-control-btn" : i + "overflow-control-svg"),
tabIndex: "-1"
})).style.left = "outset" === t.position ? "-8px" : "0px", l.addEventListener("click", L, !1), (d = P("button", {
class: i + "overflow-control " + i + "overflow-control-right " + ("button" === t.style ? i + "overflow-control-btn" : i + "overflow-control-svg"),
tabIndex: "-1"
})).style.right = "outset" === t.position ? "-8px" : "0px", d.addEventListener("click", L, !1), t.top && (d.style.top = t.top + "px", l.style.top = t.top + "px");
var n = [l, d];
t.responsive || _(n, function (e) {
e.classList.add(i + "overflow-unresponsive");
}), A(n);
var a = W([{
name: "chevron-left",
show: !0
}], {
"aria-hidden": !0
});
H(a, i + "overflow-control-left");
var r = W([{
name: "chevron-right",
show: !0
}], {
"aria-hidden": !0
});
H(r, i + "overflow-control-right"), l.appendChild(a), d.appendChild(r), e.insertBefore(l, e.children[0]), e.insertBefore(d, e.children[1]), D();
}(), T(), s < r.children.length - 1 && d.setAttribute("active", ""), u && v && m && g && M(), window.addEventListener("resize", y, !1);
};
this.lazyLoad = function () {
"Overflow" in e && I();
}, this.getCurrentDetails = function () {
return {
left: o,
right: s,
totalItems: r.children.length,
hasRightControl: d.hasAttribute("active"),
hasLeftControl: l.hasAttribute("active")
};
}, this.clickRight = function () {
w(!0);
}, this.clickLeft = function () {
w(!1);
}, this.clickEnd = function () {
m = r.width < a.offsetWidth, g = !0, d.hasAttribute("active") && (a.style.left = -1 * (r.width - a.offsetWidth + ("inset" !== t.position || g ? 0 : c)) + "px"), d.removeAttribute("active"), S(a, T);
}, this.clickHome = function () {
m = !0, g = !1, l.hasAttribute("active") && (a.style.left = "0px"), l.removeAttribute("active"), S(a, T);
}, "Overflow" in e || (n = e, e.children[0].classList.contains(i + "tabs-centered-container") && (v = !0), n.style.overflow = "hidden", (a = n.querySelector("UL")).classList.add(i + "overflow-transition"), a.setAttribute("style", "position: relative; flex-wrap: nowrap; white-space: nowrap; left: 0px"), r = {}, t.lazyload || I()), e.Overflow = this;
}
function J(e, n) {
e = _instanceof(e, HTMLElement) && e, (n = z(e, n = n || {})).target = e.dataset.target ? e.dataset.target : n.target ? n.target : !(!e.href || !e.getAttribute("href")) && e.getAttribute("href"), n.parent = e.dataset.parent ? e.dataset.parent : !!n.parent && n.parent, function () {
if (!n.target || "#" !== n.target.charAt(0)) throw new Error("There was a problem found with target value, please correct and try again");
}();
var a,
r,
s,
o,
l = this,
d = null,
c = null,
u = function u(e, t) {
k("ShowHide", "HideEvent", e), e.isAnimating = !0, e.style.height = e.scrollHeight + "px", e.classList.remove(i + "collapse"), e.classList.remove(i + "show"), e.classList.add(i + "collapsing"), e.offsetWidth, e.style.height = "0rem", t.setAttribute("aria-expanded", "false"), S(e, function () {
e.isAnimating = !1, e.setAttribute("aria-expanded", "false"), e.classList.remove(i + "collapsing"), e.classList.add(i + "collapse"), e.style.height = "", k("ShowHide", "Hidden", e);
});
};
if (this.toggle = function (e) {
e && e.preventDefault(), c.classList.contains(i + "show") ? l.hide() : l.show();
}, this.hide = function () {
c.isAnimating || (u(c, e), e.classList.add(i + "collapsed"));
}, this.show = function () {
var t, s;
d && n.parent && (a = d.querySelector("." + i + "collapse." + i + "show"), r = a && (d.querySelector("[data-toggle='" + i + "collapse'][data-target='#" + a.id + "']") || d.querySelector("[data-toggle='" + i + "collapse'][href='#" + a.id + "']"))), (!c.isAnimating || a && !a.isAnimating) && (r && a !== c && (u(a, r), r.classList.add(i + "collapsed")), s = e, k("ShowHide", "ShowEvent", t = c), t.isAnimating = !0, t.classList.add(i + "collapsing"), t.classList.remove(i + "collapse"), t.style.height = t.scrollHeight + "px", t.children[0].focus(), s.setAttribute("aria-expanded", "true"), S(t, function () {
t.isAnimating = !1, t.setAttribute("aria-expanded", "true"), t.classList.remove(i + "collapsing"), t.classList.add(i + "collapse"), t.classList.add(i + "show"), t.style.height = "", k("ShowHide", "Shown", t);
}), e.classList.remove(i + "collapsed"));
}, !("Collapse" in e) && (e.addEventListener("click", l.toggle, !1), (c = t.getElementById(n.target.substr(1))) && (c.isAnimating = !1), d = n.parent && w(e, n.parent) || w(e, "." + i + "accordion"))) {
var f = d.querySelector(".dds__show-hide-container");
f && ((s = f.querySelector(".dds__show-all")) && s.addEventListener("click", function () {
e.classList.contains(i + "collapsed") && l.show();
}, !1), (o = f.querySelector(".dds__hide-all")) && o.addEventListener("click", function () {
e.classList.contains(i + "collapsed") || l.hide();
}, !1));
}
e.Collapse = l;
}
function K(e, n) {
e = _instanceof(e, HTMLElement) && e, (n = z(e, n = n || {})).persist = e.dataset.persist ? e.dataset.persist : !!n.persist && n.persist;
var a,
r,
s,
o,
l = this,
d = e.parentNode,
c = !1,
u = null,
f = d.querySelector("." + i + "button-dropdown-container"),
p = function p(e) {
("A" === e.tagName && e.href && "#" === e.href.slice(-1) || e.parentNode && "A" === e.parentNode.tagName && e.parentNode.href && "#" === e.parentNode.href.slice(-1)) && this.preventDefault();
},
h = function h() {
e.open ? (e.addEventListener("click", v, !1), e.addEventListener("keydown", g, !1), f.addEventListener("keydown", g, !1), f.addEventListener("click", v, !1), window.addEventListener("click", L, !0)) : (e.removeEventListener("click", v, !1), e.removeEventListener("keydown", g, !1), f.removeEventListener("keydown", g, !1), f.removeEventListener("click", v, !1), window.removeEventListener("click", L, !0));
},
v = function v(t) {
var a = t.target,
r = a && ("Dropdown" in a || "Dropdown" in a.parentNode);
(a !== f && !f.contains(a) || !n.persist && !r) && (u = a === e || e.contains(a) ? e : null, a.classList.contains(i + "disabled") || y(), e.focus(), p.call(t, a));
},
m = function m(t) {
if (u = e, c && "INPUT" === t.target.tagName) {
if (t.target.checked) o.push(t.target.name), t.target.parentElement.parentElement.setAttribute("aria-checked", "true"), k("Dropdown", "AddEvent", e, {
filters: o,
filter: t.target.name,
filterInput: t.target
}); else {
var n = o.indexOf(t.target.name);
o.splice(n, 1), t.target.parentElement.parentElement.setAttribute("aria-checked", "false"), k("Dropdown", "RemoveEvent", e, {
filters: o,
filter: t.target.name,
filterInput: t.target
});
}
l.recountChecked(), e.focus();
} else "BUTTON" != t.target.tagName && "BUTTON" != t.target.parentElement.tagName && "BUTTON" != t.target.parentElement.parentElement.tagName || (l.toggle(), p.call(t, t.target));
},
g = function g(e) {
var t = e.which || e.keyCode;
38 !== t && 40 !== t || e.preventDefault();
},
b = function b(n) {
var r = n.which || n.keyCode,
s = t.activeElement,
o = f.classList.contains(i + "show"),
d = s === e || s.parentNode === f,
c = f.contains(s),
p = s.parentNode === f || s.parentNode.parentNode === f;
if (p || o && d) {
!c || 13 !== r && 32 !== r || s.firstElementChild.click();
var h = a.indexOf(s);
h = 38 === r ? h >= 1 ? h - 1 : 0 : 40 === r ? h < a.length - 1 ? h + 1 : a.length - 1 : h, a[h] && C(a[h]);
}
(a.length && p || !a.length && (c || d) || !c) && e.open && 27 === r && (l.toggle(), u = null, e.focus()), o || p || 40 !== r && 13 !== r && 32 !== r || (n.preventDefault(), l.toggle(), a[0] && C(a[0]), u = null), o && (9 === r || n.shiftKey && 9 == n.keyCode) && (n.preventDefault(), l.toggle(), e.focus());
},
y = function y() {
k("DropDown", "HideEvent", e), f.classList.remove(i + "show"), d.classList.remove(i + "show"), e.setAttribute("aria-expanded", !1), k("DropDown", "Hidden", e), e.open = !1, setTimeout(function () {
h(), e.addEventListener("click", m, !1);
}, 100);
},
L = function L(e) {
d.contains(e.target) && d !== e.target || (y(), p.call(e, u));
};
if (this.toggle = function () {
d.classList.contains(i + "show") && e.open ? y() : (e.classList.contains(i + "btn-split-arrow") ? f.style.minWidth = d.offsetWidth + "px" : e.classList.contains(i + "btn") && (f.style.minWidth = e.offsetWidth + "px"), k("DropDown", "ShowEvent", e), f.classList.add(i + "show"), d.classList.add(i + "show"), e.setAttribute("aria-expanded", !0), k("DropDown", "Shown", e), e.open = !0, setTimeout(function () {
h();
}, 100));
}, this.recountChecked = function () {
r = e.parentElement.querySelectorAll("." + i + "form-check-input:checked").length, function () {
var t;
t = r > 0 ? " (" + r + ")" : " ";
var n = e.querySelector("." + i + "checked-presentation");
null != n ? (n.innerHTML = n.innerHTML.replace(s, t), s = t) : (n = P("span", {
class: i + "checked-presentation " + i + "ml-1",
html: t
}), s = n.innerHTML, e.querySelector(".dds__text-truncate").appendChild(n));
}();
}, !("Dropdown" in e)) {
e.open = !1, !("tabIndex" in f) && f.setAttribute("tabindex", "0"), e.addEventListener("click", m, !1), d.addEventListener("focusout", function (e) {
var n = e.relatedTarget ? e.relatedTarget : e.target ? e.target : t.activeElement;
e.currentTarget.contains(n) || (u = d = e.currentTarget.classList.contains(i + "btn-dropdown") ? e.currentTarget : e.currentTarget.parentNode, y(), p.call(e, u));
}, !0), e.addEventListener("keydown", b, !1), f.addEventListener("keydown", b, !1), e.parentElement.classList.contains("dds__multi-select") && (c = !0);
var w = f.children;
a = [], _(w, function (e) {
e.children.length && "LI" === e.children[0].tagName && !e.children[0].firstElementChild.classList.contains(i + "disabled") ? a.push(e.children[0]) : "LI" !== e.tagName || e.firstElementChild.classList.contains(i + "disabled") || a.push(e);
}), c && (_(a, function (e) {
e.firstElementChild.addEventListener("click", m, !0);
}), r = 0, o = []);
}
e.Dropdown = l;
}
function X(e, n) {
e = _instanceof(e, HTMLElement) && e, (n = z(e, n = n || {})).static = "static" === n.backdrop, n.target = e.dataset.target ? t.getElementById(e.dataset.target.substr(1)) : n.target ? t.getElementById(n.target.substr(1)) : null;
var a,
s,
o,
l = this,
d = n.target,
u = m(),
p = function p() {
a = y(d), d.firstFocusableEl = a[0], d.lastFocusableEl = a[a.length - 1];
},
v = function v(e) {
document.activeElement === d.firstFocusableEl && (e.preventDefault(), C(d.lastFocusableEl));
},
g = function g(e) {
var t,
n = d.querySelector("." + i + "offcanvas-modal-topbar");
if (n && (t = y(n = n.parentElement).length), document.activeElement === d.lastFocusableEl) e.preventDefault(), C(d.firstFocusableEl); else if (n && document.activeElement === a[t - 1] && 0 != d.scrollTop && a[t].getBoundingClientRect().y < parseInt(n.offsetHeight) && h) {
var r = d.querySelector("." + i + "modal-body"),
s = parseInt(r.clientHeight) - parseInt(window.innerHeight) - Math.abs(parseInt(a[t].getBoundingClientRect().y)) - parseInt(a[t].offsetHeight) - parseInt(n.offsetHeight);
d.scroll(0, s);
}
},
b = function b() {
d.classList.contains(i + "show") ? t.addEventListener("keydown", x, !1) : t.removeEventListener("keydown", x, !1);
},
L = function L() {
b(), C(d), d.loading ? d.focus() : (p(), a.length > 0 && C(a[0])), k("Modal", "Shown", d);
},
w = function w() {
setTimeout(function () {
d.style.display = "";
}, E(d)), e && C(e), d.classList.contains(i + "show") && b();
},
x = function x(e) {
l.keyboard && 27 == e.which && d.classList.contains(i + "show") && l.hide();
},
A = function A(e) {
d.classList.contains(i + "show") && (l.hide(), e.preventDefault());
};
if (this.toggle = function () {
d.classList.contains(i + "show") ? this.hide() : this.show();
}, this.show = function () {
k("Modal", "ShowEvent", d), u && !u.classList.contains(i + "show") ? (E(u), u.classList.add(i + "show"), u.removeAttribute("hidden"), "hidden" == u.style.visibility && (u.style.visibility = "")) : console.warn("MODAL: Overlay requested. Corresponding HTML missing. Please apply id 'dds__full-screen-overlay' and class 'dds__overlay' to an empty div"), n.static || window.addEventListener("click", function (e) {
d.classList.contains(i + "show") && e.target != d && !d.contains(e.target) && l.hide();
}, !1), t.body.style.paddingRight = o + s + "px", t.body.style.overflow = "hidden", t.documentElement.style.overflow = "hidden", d.style.display = "block", f && c && d.classList.add(i + "is-safari"), setTimeout(function () {
d.classList.add(i + "show");
}, 5), d.setAttribute("aria-hidden", !1), d.classList.contains(i + "fade") ? S(d, L) : L(), r && d.loading;
}, this.hide = function () {
k("Modal", "HideEvent", d), d.classList.remove(i + "show"), d.setAttribute("aria-hidden", !0), f && c && d.classList.contains(i + "is-safari") && d.classList.remove(i + "is-safari"), setTimeout(function () {
u && (u.classList.remove(i + "show"), u.setAttribute("hidden", "")), n.static || d.removeEventListener("click", function (e) {
e.target == d && l.hide();
}, !1), t.body.style.paddingRight = 0 == s ? "" : s + "px", t.body.style.overflow = "", 0 == t.body.style.length && t.body.removeAttribute("style"), t.documentElement.style.overflow = "", 0 == t.documentElement.style.length && t.documentElement.removeAttribute("style"), k("Modal", "Hidden", d);
}, E(d)), d.classList.contains(i + "fade") ? S(d, w) : w();
}, !("Modal" in e)) {
if (!d) return !1;
s = t.body.style.paddingRight ? t.body.style.paddingRight.split("px")[0] : 0, o = window.innerWidth - t.documentElement.clientWidth, d.loading = !!d.classList.contains(i + "loading-modal"), d.loading || (e.addEventListener("click", function (t) {
t.target !== e && t.target.parentElement !== e || d.classList.contains(i + "show") || (l.show(), t.preventDefault());
}, !1), d.addEventListener("keydown", function (e) {
if (!d.loading) switch (p(), 0 == a.length && e.preventDefault(), e.keyCode) {
case 9:
if (1 === a.length) {
e.preventDefault();
break;
}
e.shiftKey ? v(e) : g(e);
break;
case 27:
l.hide();
}
}), _(d.querySelectorAll("[data-dismiss='" + i + "modal']"), function (e) {
e.addEventListener("click", A, !1);
}));
}
e.Modal = l;
}
function G(e) {
e = _instanceof(e, HTMLElement) && e;
var t,
n,
a,
r = R(function (t) {
window.addEventListener("click", s, !0), 13 == t.keyCode && (k("FilterKeyword", "CreateEvent", e, {
filter: n.value
}), n.value = "", n.focus());
}, 50),
s = function s(e) {
a.contains(e.target) || (n.value = "", window.removeEventListener("click", s, !0));
};
"FilterKeyword" in e || (t = e.querySelector("." + i + "filter-btn"), n = e.querySelector("." + i + "filter-input"), a = e.querySelector("." + i + "filter-container"), t.addEventListener("click", function (a) {
a.target != t && !t.contains(a.target) || "" == n.value.trim() || (k("FilterKeyword", "CreateEvent", e, {
filter: n.value
}), n.value = "", n.focus(), window.removeEventListener("click", s, !0));
}, !0), n.addEventListener("keydown", r, !1)), e.FilterKeyword = this;
}
function Z() {
!function () {
var e,
t,
n = document.attachEvent,
a = !1;
if (!n) {
var i = (t = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (e) {
return window.setTimeout(e, 20);
}, function (e) {
return t(e);
}),
r = (e = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout, function (t) {
return e(t);
}),
s = function s(e) {
var t = e.__resizeTriggers__,
n = t.firstElementChild,
a = t.lastElementChild,
i = n.firstElementChild;
a.scrollLeft = a.scrollWidth, a.scrollTop = a.scrollHeight, i.style.width = n.offsetWidth + 1 + "px", i.style.height = n.offsetHeight + 1 + "px", n.scrollLeft = n.scrollWidth, n.scrollTop = n.scrollHeight;
},
o = function o(e) {
var t = this;
s(this), this.__resizeRAF__ && r(this.__resizeRAF__), this.__resizeRAF__ = i(function () {
(function (e) {
return e.offsetWidth != e.__resizeLast__.width || e.offsetHeight != e.__resizeLast__.height;
})(t) && (t.__resizeLast__.width = t.offsetWidth, t.__resizeLast__.height = t.offsetHeight, t.__resizeListeners__.forEach(function (n) {
n.call(t, e);
}));
});
},
l = !1,
d = "",
c = "animationstart",
u = "Webkit Moz O ms".split(" "),
f = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),
p = document.createElement("fakeelement");
if (void 0 !== p.style.animationName && (l = !0), !1 === l) for (var h = 0; h < u.length; h++) {
if (void 0 !== p.style[u[h] + "AnimationName"]) {
d = "-" + u[h].toLowerCase() + "-", c = f[h], l = !0;
break;
}
}
var v = "resizeanim",
m = "@" + d + "keyframes " + v + " { from { opacity: 0; } to { opacity: 0; } } ",
g = d + "animation: 1ms " + v + "; ";
}
window.addResizeListener = function (e, t) {
n ? e.attachEvent("onresize", t) : (e.__resizeTriggers__ || ("static" == getComputedStyle(e).position && (e.style.position = "relative"), function () {
if (!a) {
var e = (m || "") + ".resize-triggers { " + (g || "") + 'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
t = document.head || document.getElementsByTagName("head")[0],
n = document.createElement("style");
n.type = "text/css", n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e)), t.appendChild(n), a = !0;
}
}(), e.__resizeLast__ = {}, e.__resizeListeners__ = [], (e.__resizeTriggers__ = document.createElement("div")).className = "resize-triggers", e.__resizeTriggers__.innerHTML = '
', e.appendChild(e.__resizeTriggers__), s(e), e.addEventListener("scroll", o, !0), c && e.__resizeTriggers__.addEventListener(c, function (t) {
t.animationName == v && s(e);
})), e.__resizeListeners__.push(t));
}, window.removeResizeListener = function (e, t) {
n ? e.detachEvent("onresize", t) : (e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t), 1), e.__resizeListeners__.length || (e.removeEventListener("scroll", o), e.__resizeTriggers__ = !e.removeChild(e.__resizeTriggers__)));
};
}();
}
function $(e) {
e = _instanceof(e, HTMLElement) && e;
var n,
a,
r,
s = function s(n) {
var a = n.relatedTarget ? n.relatedTarget : t.activeElement;
e.contains(a) || e === a || o();
},
o = function o() {
e.style.zIndex = "-1000", e.style.opacity = "0", _(e.querySelectorAll("a." + i + "btn"), function (e) {
e.removeEventListener("click", l, !1);
}), e.removeEventListener("focusout", s);
},
l = function l(e) {
o();
var t = document.getElementById(e.target.getAttribute("href").substr(1));
0 !== (n = t.getAttribute("tabIndex")) && t.setAttribute("tabIndex", "0"), t.addEventListener("focusout", d, !1), setTimeout(function () {
t.focus();
}, 100), "true" === e.target.getAttribute("data-inset") ? (r = !0, a = t.style.border, setTimeout(function () {
t.style.border = "2px inset #000000";
}, 10)) : r = !1;
},
d = function d(e) {
r && (e.target.style.border = a), 0 !== n && (null == n ? e.target.removeAttribute("tabIndex") : e.target.setAttribute("tabIndex", n)), e.target.removeEventListener("focusout", d, !1);
};
"NavSkip" in e || e.addEventListener("focusin", function (t) {
(e === t.target || e.contains(t.target)) && (e.style.zIndex = "1080", e.style.opacity = "1", _(e.querySelectorAll("a." + i + "btn"), function (e) {
e.addEventListener("click", l, !1);
})), e.addEventListener("focusout", s);
}), e.NavSkip = this;
}
function Q(e, n) {
var a = (e = _instanceof(e, HTMLElement) && e).dataset.page;
if (a && (n = JSON.parse(a)), (n = n || {}).items = F(n.items, 1), n.filter = !!e.classList.contains(i + "pagination-justified-filter"), n.pageText = "string" == typeof n.pageText ? n.pageText : "Page", n.itemsPerPageText = "string" == typeof n.itemsPerPageText ? n.itemsPerPageText : "Items per page", n.perPageSelect = n.perPageSelect ? n.perPageSelect : [12, 24, 48, 96], N(n.perPageSelect)) {
if ("number" == typeof n.perPageSelect[0]) n.perPageSelect = n.perPageSelect.map(function (e) {
return e = Math.abs(parseInt(e));
}); else {
if (!F(n.perPageSelect[0])) throw new Error("Invalid perPageSelect. Should be a non-empty array of integer");
n.perPageSelect = n.perPageSelect.map(function (e) {
return e = Math.abs(parseInt(e));
});
}
} else n.perPageSelect = [12, 24, 28, 96];
n.perPage = n.perPageSelect.indexOf(n.perPage) > -1 ? F(n.perPage) : n.perPageSelect[0], n.hidePages = !(!n.hidePages || "boolean" != typeof n.hidePages) && n.hidePages, n.external = null != n.external && "boolean" == typeof n.external && n.external, n.buttonLabelLeft = n.buttonLabelLeft ? n.buttonLabelLeft : "Previous", n.buttonLabelRight = n.buttonLabelRight ? n.buttonLabelRight : "Next", n.disablePaginationInput = null != n.disablePaginationInput && "boolean" == typeof n.disablePaginationInput && n.disablePaginationInput, n.showTotal = !(!n.showTotal || "string" != typeof n.showTotal) && n.showTotal;
var r,
s,
o,
l,
d,
c,
f,
p,
h,
v,
m = this,
g = "{total}{pager}{select}",
b = n.buttonLabelLeft,
y = n.buttonLabelRight,
L = n.perPage,
w = function w(t) {
for (var a, i = (a = t.target.dataset.page ? t.target : t.target.parentNode).getAttribute("aria-label"), s = r.querySelectorAll("button"), o = 0; o < s.length; o++) {
if (a === s[o]) {
s[o];
break;
}
}
n.external ? k("Pagination", "PageChangeEvent", e, {
page: a.dataset.page,
perPage: n.perPage,
pages: d
}) : a.dataset.page && m.page(a.dataset.page), r.querySelector('[aria-label="' + i + '"]').focus();
},
x = function x(t) {
if (13 == t.keyCode) {
t.target.value <= d && t.target.value > 0 ? n.external ? k("Pagination", "PageChangeEvent", e, {
page: t.target.value,
perPage: n.perPage,
pages: d
}) : m.page(t.target.value) : t.target.value = s;
var a = t.target.tagName;
_(t.target.classList, function (e) {
a += "." + e;
}), r.querySelector(a).focus();
}
},
E = function E(e) {
e.target.value != s ? e.target.value = s : e.preventDefault();
},
S = function S(t) {
if (t.target.value != n.perPage) {
o = n.perPage, n.perPage = parseInt(t.target.value), n.external ? (C(), k("Pagination", "PerPageChangeEvent", e, {
page: s,
perPage: n.perPage,
pages: d
})) : q();
var a = t.target.tagName;
_(t.target.classList, function (e) {
a += "." + e;
}), e.querySelector(a).focus();
}
},
C = function C() {
var t = s;
if (l) s = l, l = null; else if (o) {
var a = (t - 1) * o + 1;
s = Math.ceil(a / n.perPage), o = null;
} else c && s > c && (s = c);
p = 1 === s, h = s === f, t != s && k("Pagination", "PageUpdateEvent", e, {
page: s,
perPage: n.perPage,
pages: d
});
},
A = function A() {
var e = P("li", {
class: i + "pagination-input-ctnr"
});
n.hidePages && e.classList.add(i + "d-none");
var t = P("label", {
html: n.pageText
}),
a = P("input", {
class: i + "form-control " + i + "text-center",
type: "text",
value: s,
"aria-label": "Page " + s + " of " + (c || d)
});
a.disabled = n.disablePaginationInput;
var r = P("label", {
html: "of " + (c || d)
});
return e.appendChild(t), e.appendChild(a), e.appendChild(r), e;
},
T = function T(e, t, n) {
var a,
r = P("li"),
s = P("button", {
class: e + " " + i + "pager-link",
"aria-label": n,
"data-page": t
}),
o = P("span", {
html: n
});
return s.appendChild(o), n === b ? ((a = W([{
name: "chevron-left",
show: !0
}])).setAttribute("name", "chevron-left"), s.insertBefore(a, o), p && s.setAttribute("disabled", "")) : n === y && ((a = W([{
name: "chevron-right",
show: !0
}])).setAttribute("name", "chevron-right"), s.appendChild(a), h && s.setAttribute("disabled", "")), r.appendChild(s), r;
},
q = function q() {
var a, o;
n.items < n.perPage ? r.classList.add(i + "pagination-hidden") : r.classList.contains(i + "pagination-hidden") && r.classList.remove(i + "pagination-hidden"), a = n.items < n.perPage ? 1 : Math.ceil(n.items / n.perPage), d ? c = f = a : d = f = a, C(), v = [A()], function () {
var a = d,
i = c || d;
if (V(r, u), i > 1) {
var o = t.createDocumentFragment(),
l = p ? 1 : s - 1,
f = h ? i : s + 1;
o.appendChild(T("dds__btn dds__btn-secondary dds__page-item", l, b)), _(v, function (e) {
o.appendChild(e);
}), o.appendChild(T("dds__btn dds__btn-secondary dds__page-item", f, y)), r.appendChild(o.cloneNode(!0)), _(r.querySelectorAll("li"), function (e) {
var t = e.querySelector("input");
e.querySelector("button") && e.addEventListener("click", w, !0), t && (t.addEventListener("keydown", x, !1), t.addEventListener("focusout", E, !1));
});
}
(i != a || c) && (d = i, c = null, k("Pagination", "PerPageUpdateEvent", e, {
page: s,
perPage: n.perPage,
pages: d
}));
}(), n.filter && function () {
var t = e.querySelector("." + i + "perpage");
if (t && V(t, u), 0 !== n.items && (d > 1 || 0 !== n.perPageSelect.indexOf(n.perPage))) {
var a = P("select", {
class: i + "form-control"
});
_(n.perPageSelect, function (e) {
var t;
t = e == n.perPage ? new Option(e, e, !0, !0) : new Option(e, e, !1, !1), a.add(t);
});
var r = P("label", {
html: n.itemsPerPageText
});
t.innerHTML = "", t.appendChild(a), t.appendChild(r), a.addEventListener("change", S, !1);
}
}(), n.showTotal && (V(o = e.querySelector("." + i + "pagination-total-items"), u), o.appendChild(P("span", {
html: n.items + " " + n.showTotal
})));
};
this.page = function (e) {
if (!(l = F(e)) || l == s || l > d || l < 0) return !1;
q();
}, this.perPage = function (e) {
var t = F(e);
if (!t) return !1;
n.perPage = t, q();
}, this.addItems = function (e) {
var t = F(e);
if (!t) return !1;
n.items += t, q();
}, this.removeItems = function (e) {
var t = F(e);
if (!t) return !1;
n.items -= t, q();
}, this.setItems = function (e) {
var t = F(e);
if (null == t || null == t) return !1;
n.items = t, 0 === n.items && (n.perPage = L, o = null), q();
}, this.pages = function () {
return d;
}, "Pagination" in e || (s = 1, function () {
if (n.showTotal) {
var t = P("div", {
class: i + "pagination-total-items"
}),
a = P("span", {
html: n.items + " " + n.showTotal
});
t.appendChild(a), g = g.replace("{total}", t.outerHTML);
} else g = g.replace("{total}", "");
var s = P("ul", {
class: i + "pagination-list",
role: "presentation"
});
if (g = g.replace("{pager}", s.outerHTML), n.filter) {
var o = "";
g = g.replace("{select}", o);
} else g = g.replace("{select}", "");
e.innerHTML = g, r = e.querySelector("." + i + "pagination-list"), n.items < n.perPage && r.classList.add(i + "pagination-hidden"), q();
}()), e.Pagination = m;
}
function ee(e) {
this.swap = function (t) {
if (t.length && 2 === t.length) {
var n = [];
_(e.headings, function (e, t) {
n.push(t);
});
var a = t[0],
i = t[1],
r = n[i];
n[i] = n[a], n[a] = r, this.order(n);
}
}, this.order = function (t) {
var n,
a,
i,
r,
s,
o,
l,
d = [[], [], [], []];
_(t, function (t, i) {
s = e.headings[t], o = "false" !== s.getAttribute("data-sortable"), (n = s.cloneNode(!0)).originalCellIndex = i, n.sortable = o, d[0].push(n), e.hiddenColumns.indexOf(t) < 0 && ((a = s.cloneNode(!0)).originalCellIndex = i, a.sortable = o, d[1].push(a));
}), _(e.data, function (n, a) {
i = n.cloneNode(), r = n.cloneNode(), i.dataIndex = r.dataIndex = a, e.expandable && (i.details = r.details = n.details), null !== n.searchIndex && void 0 !== n.searchIndex && (i.searchIndex = r.searchIndex = n.searchIndex), _(t, function (t) {
(l = n.cells[t].cloneNode(!0)).data = n.cells[t].data, i.appendChild(l), e.hiddenColumns.indexOf(t) < 0 && ((l = n.cells[t].cloneNode(!0)).data = n.cells[t].data, r.appendChild(l));
}), d[2].push(i), d[3].push(r);
}), e.headings = d[0], e.activeHeadings = d[1], _(e.headings, function (t) {
(t.classList.contains("desc") || t.classList.contains("asc")) && (e.lastTh = t);
}), e.data = d[2], e.activeRows = d[3];
}, this.hide = function (t) {
t.length && (_(t, function (t) {
e.hiddenColumns.indexOf(t) < 0 && e.hiddenColumns.push(t);
}), this.rebuild());
}, this.show = function (t) {
var n;
t.length && (_(t, function (t) {
(n = e.hiddenColumns.indexOf(t)) > -1 && e.hiddenColumns.splice(n, 1);
}), this.rebuild());
}, this.visible = function (t) {
var n;
return t = t || e.headings.map(function (e) {
return e.originalCellIndex;
}), isNaN(t) ? N(t) && (n = [], _(t, function (t) {
n.push(e.hiddenColumns.indexOf(t) < 0);
})) : n = e.hiddenColumns.indexOf(t) < 0, n;
}, this.add = function (t) {
var n,
a = this,
i = P("th");
if (!e.headings.length) return e.insert({
headings: [t.heading],
rows: t.rows.map(function (e) {
return [e];
})
}), void this.rebuild();
t.heading.nodeName ? i.appendChild(t.heading) : i.innerHTML = t.heading, e.headings.push(i), _(e.data, function (e, i) {
t.data[i] && (n = P("td"), t.data[i].nodeName ? n.appendChild(t.data[i]) : n.innerHTML = t.data[i], n.data = n.innerHTML, t.render && (n.innerHTML = t.render.call(a, n.data, n, e)), e.appendChild(n));
}), t.type && i.setAttribute("data-type", t.type), t.format && i.setAttribute("data-format", t.format), Object.prototype.hasOwnProperty.call(t, "sortable") && (i.sortable = t.sortable, i.setAttribute("data-sortable", !0 === t.sortable ? "true" : "false")), this.rebuild(), e.renderHeader();
}, this.remove = function (t) {
N(t) ? (t.sort(function (e, t) {
return t - e;
}), _(t, function (e) {
this.remove(e);
}, this)) : (e.headings.splice(t, 1), _(e.data, function (e) {
e.removeChild(e.cells[t]);
})), this.rebuild();
}, this.sort = function (t, n) {
if (e.hasHeadings && (t < 0 || t > e.activeHeadings.length - 1)) return !1;
e.sorting = !0;
var a,
i,
r = [],
s = [],
o = [],
l = 0,
d = 0,
c = e.activeHeadings[t];
r = e.data, t = c.originalCellIndex, _(r, function (e) {
var n,
a,
i = e.cells[t];
n = (a = i.hasAttribute("data-content") ? i.getAttribute("data-content") : i.data).replace(/(\$|,|\s|%)/g, ""), "date" === c.getAttribute("data-type") && (n = Date.parse(a)).isNaN && (n = 0), parseFloat(n) == n ? o[d++] = {
value: Number(n),
row: e
} : s[l++] = {
value: a.toLowerCase(),
row: e
};
}), c.classList.contains("asc") || "desc" == n ? (a = I(s, -1), i = I(o, -1)) : (a = I(o, 1), i = I(s, 1)), this.updateSortDirection(c, n), e.lastTh = c, r = a.concat(i), e.data = [], e.selectedRows = [];
var u = [];
_(r, function (t, n) {
e.data.push(t.row), null !== t.row.searchIndex && void 0 !== t.row.searchIndex && u.push(n);
}, e), e.searchData = u, this.rebuild();
}, this.updateSortDirection = function (t, n) {
t.classList.contains("asc") || "desc" == n ? (t.classList.remove("asc"), t.classList.add("desc"), t.setAttribute("aria-sort", "descending")) : (t.classList.remove("desc"), t.classList.add("asc"), t.setAttribute("aria-sort", "ascending")), e.lastTh && t != e.lastTh && (e.lastTh.classList.remove("desc"), e.lastTh.classList.remove("asc"));
}, this.rebuild = function () {
var t,
n,
a,
i,
r = [];
e.activeRows = [], e.activeHeadings = [], _(e.headings, function (t, n) {
t.originalCellIndex = n, t.sortable = "false" !== t.getAttribute("data-sortable"), e.hiddenColumns.indexOf(n) < 0 && e.activeHeadings.push(t);
}), _(e.data, function (s, o) {
t = s.cloneNode(), n = s.cloneNode(), t.dataIndex = n.dataIndex = o, t.details = n.details = s.details, null !== s.searchIndex && void 0 !== s.searchIndex && (t.searchIndex = n.searchIndex = s.searchIndex), _(s.cells, function (r) {
(a = r.cloneNode(!0)).data = r.data, t.appendChild(a), e.hiddenColumns.indexOf(r.cellIndex) < 0 && ((i = r.cloneNode(!0)).data = r.data, n.appendChild(i));
}), r.push(t), e.activeRows.push(n);
}), e.data = r;
};
}
function te(e) {
this.build = function (t) {
var n,
a = P("tr"),
i = e.headings;
return i.length || (i = t.map(function () {
return "";
})), _(t, function (e) {
e.indexOf("table-cmplx-accordion-btn") > -1 || e.indexOf("table-cmplx-row-select") > -1 ? ((n = P("tr")).innerHTML = e, a.appendChild(n.firstChild)) : ((n = P("td")).innerHTML = e, n.data = e, n.setAttribute("data-content", j(e)), a.appendChild(n));
}), t.details && (a.details = t.details), a;
}, this.render = function (e) {
return e;
}, this.add = function (t, n) {
N(t) && (N(t[0]) ? _(t, function (t, a) {
n[a] && (t.details = n[a]), e.data.push(this.build(t));
}, this) : (n && (t.details = n[0]), e.data.push(this.build(t))), e.data.length && (e.hasRows = !0), this.update());
}, this.remove = function (t) {
N(t) ? (t.sort(function (e, t) {
return t - e;
}), _(t, function (t) {
e.data.splice(t, 1);
})) : e.data.splice(t, 1), this.update();
}, this.update = function () {
var t = 0;
_(e.data, function (e) {
1 != e.children.length && (e.dataIndex = t++);
});
};
}
window.addEventListener("keydown", T), e.Alert = function (e) {
e = _instanceof(e, HTMLElement) && e;
var t = this,
n = e.querySelector("." + i + "close-x"),
a = e.querySelector("." + i + "dismiss"),
r = function r(e) {
(n === e.target || n.contains(e.target) || a === e.target || a.contains(e.target)) && t.toggle();
};
this.toggle = function () {
e && ("true" === e.getAttribute("aria-expanded") ? (e.setAttribute("aria-expanded", "false"), a.focus(), k("Alert", "DismissEvent", e)) : (e.setAttribute("aria-expanded", "true"), n.focus(), k("Alert", "OpenEvent", e)));
}, "Alert" in e || (n.addEventListener("click", r, !1), a.addEventListener("click", r, !1)), e.Alert = t;
}, e.BarSelect = function (e) {
e = _instanceof(e, HTMLElement) && e;
var t = null,
n = 0,
a = function a(_a) {
var r = _a.target.classList.contains(i + "bar-select") ? _a.target.querySelector("input") : "LABEL" == _a.target.tagName ? _a.target.previousElementSibling : _a.target;
n = parseInt(r.getAttribute("value")), _(t, function (e) {
parseInt(e.querySelector("input").getAttribute("value")) <= n ? (e.classList.remove(i + "bar-select-hover"), e.classList.add(i + "bar-select-selected")) : (e.classList.remove(i + "bar-select-hover"), e.classList.remove(i + "bar-select-selected"));
}), k("BarSelect", "SelectedValue", e, {
value: n
});
},
r = function r(e) {
var a = e.target.classList.contains(i + "bar-select") ? e.target.querySelector("input") : "LABEL" == e.target.tagName ? e.target.previousElementSibling : e.target;
n = parseInt(a.getAttribute("value")), _(t, function (e) {
parseInt(e.querySelector("input").getAttribute("value")) <= n ? e.classList.add(i + "bar-select-hover") : e.classList.remove(i + "bar-select-hover");
});
},
s = function s(e) {
var t = e.currentTarget.nextElementSibling;
o(t) || t.scrollIntoView(!1);
},
o = function o(e) {
var t = e.getBoundingClientRect();
return t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth);
};
"BarSelect" in e || (t = e.querySelectorAll("." + i + "bar-select"), e.addEventListener("mouseout", function () {
_(t, function (e) {
e.classList.remove(i + "bar-select-hover");
});
}, !1), _(t, function (e) {
e.addEventListener("click", a, !1), e.addEventListener("mouseover", r, !1), (u || h) && e.querySelector("input").addEventListener("focusin", s, !1);
})), e.BarSelect = this;
}, e.Button = function (e) {
e = _instanceof(e, HTMLElement) && e;
var n,
a,
r,
s,
o,
l,
d = !1,
c = "checked",
u = function u(e) {
var t = "LABEL" === e.target.tagName ? e.target : "LABEL" === e.target.parentNode.tagName ? e.target.parentNode : null;
if (t) {
var n = g(e.target.parentNode, "btn"),
a = t.getElementsByTagName("INPUT")[0];
a && ("checkbox" === a.type && (a.checked ? (t.classList.remove(i + "active"), a.getAttribute(c), a.removeAttribute(c), a.checked = !1) : (t.classList.add(i + "active"), a.getAttribute(c), a.setAttribute(c, c), a.checked = !0), d || (d = !0)), "radio" !== a.type || d || a.checked || (t.classList.add(i + "active"), a.setAttribute(c, c), a.checked = !0, d = !0, _(n, function (e) {
var n = e.getElementsByTagName("INPUT")[0];
e !== t && e.classList.contains(i + "active") && (t.classList.remove(i + "active"), n.removeAttribute(c), n.checked = !1);
})), setTimeout(function () {
d = !1;
}, 50));
}
};
if (!("Button" in e)) if (e.classList.contains(i + "btn-toggle-container")) {
if (l = "LABEL" === e.firstElementChild.tagName ? e.querySelector("." + i + "btn-toggle") : e, s = l.querySelector("." + i + "toggle-txt-off"), r = l.querySelector("." + i + "toggle-txt-on"), o = l.querySelector("." + i + "toggle-circle"), "SPAN" === e.firstElementChild.tagName) {
s.style.display = "block", r.style.display = "block";
var f = s.getBoundingClientRect().width,
p = r.getBoundingClientRect().width;
s.removeAttribute("style"), r.removeAttribute("style"), a = Math.max(f, p), l.style.width = a + 24 + "px";
}
n = l.getBoundingClientRect().width - 28, "true" === l.getAttribute("aria-checked") && (o.style.transform = "translateX(" + n + "px)"), l.style.visibility = "visible", e.addEventListener("click", function () {
"true" === l.getAttribute("aria-checked") ? (o.style.transform = "translateX(0px)", setTimeout(function () {
l.setAttribute("aria-checked", "false");
}, E(o) / 2 - 25), s.setAttribute("aria-hidden", "false"), r.setAttribute("aria-hidden", "true"), k("ButtonToggle", "Off", e)) : (o.style.transform = "translateX(" + n + "px)", setTimeout(function () {
l.setAttribute("aria-checked", "true");
}, E(o) / 2 - 25), s.setAttribute("aria-hidden", "true"), r.setAttribute("aria-hidden", "false"), k("ButtonToggle", "On", e));
});
} else e.addEventListener("click", u, !1), e.hasAttribute("tabindex") && e.addEventListener("keyup", function (e) {
32 === (e.which || e.keyCode) && e.target === t.activeElement && u(e);
}, !1), e.addEventListener("keydown", function (e) {
32 === (e.which || e.keyCode) && e.preventDefault();
}, !1), _(g(e, i + "btn"), function (e) {
!e.classList.contains(i + "active") && e("hasAttribute")("checked") && e.classList.add(i + "active");
});
e.Button = this;
}, e.ButtonFilter = function (e) {
e = _instanceof(e, HTMLElement) && e;
var t,
n,
a = null,
r = function r(e) {
var r = e.currentTarget;
e.preventDefault(), r != a && (n = r, (t = a).label && (t.label.classList.remove(i + "active"), n.label.classList.add(i + "active")), t.input && (t.input.removeAttribute("checked"), n.input.setAttribute("checked", "")), t.classList.remove(i + "active"), n.classList.add(i + "active"), a = n, k("ButtonFilter", "Click", n.label, {
target: n.label.dataset.filterValue
}));
};
if (!("ButtonFilter" in e)) {
var s = e.querySelectorAll("." + i + "filter-item");
a = e.querySelector("." + i + "active");
for (var o = 0; o < s.length; o++) {
s[o].addEventListener("focusin", r, !1), s[o].label = s[o].querySelector("." + i + "btn-filter"), s[o].input = s[o].querySelector("." + i + "btn-input");
}
}
e.ButtonFilter = self;
}, e.Carousel = function (e, s) {
e = _instanceof(e, HTMLElement) && e, (s = z(e, s = s || {})).interval = e.dataset.interval ? F(e.dataset.interval, 5e3) : F(s.interval, 5e3), s.pause = e.dataset.pause ? "hover" === e.dataset.pause && e.dataset.pause : "hover" === s.pause && s.pause, s.keyboard = e.dataset.keyboard ? "true" === e.dataset.keyboard : "true" === s.keyboard, s.mosaic = !1;
var o = "visible",
l = window.matchMedia("(max-width: 767.98px)"),
d = "onmouseleave" in t ? ["mouseenter", "mouseleave"] : ["mouseover", "mouseout"],
c = this,
f = !1,
h = e.index = 0,
m = e.timer = 0,
b = !1,
y = g(e, i + "carousel-item"),
L = y.length,
w = this.direction = "left",
x = g(e, i + "carousel-control-prev")[0],
S = g(e, i + "carousel-control-next")[0],
C = e.querySelector("." + i + "carousel-indicators"),
A = C && C.getElementsByTagName("LI") || [],
T = e.querySelector("." + i + "carousel-indicators-btn"),
q = T && T.getElementsByTagName("LI") || [],
D = C || T,
N = A.length > 0 ? A : q;
if (!(L < 2)) {
var M = function M() {
!1 === s.interval || e.classList.contains("paused") || (e.classList.add("paused"), !b && R(m));
},
I = function I() {
!1 !== s.interval && e.classList.contains("paused") && (e.classList.remove("paused"), !b && R(m), !b && c.cycle());
},
P = function P(e) {
if (e.preventDefault(), !b) {
var t = e.target;
if (!t || t.classList.contains(i + "active") || !t.getAttribute("data-slide-to")) return !1;
h = parseInt(t.getAttribute("data-slide-to"), 10), f = !0, c.slideTo(h);
}
},
H = function H(e) {
if (e.preventDefault(), !b) {
var t = e.currentTarget || e.srcElement;
t === S ? h++ : t === x && h-- , c.slideTo(h);
}
},
O = function O(e) {
_(N, function (e) {
e.classList.remove(i + "active");
}), N[e] && N[e].classList.add(i + "active");
},
R = function R(e) {
clearInterval(e), e = null;
};
this.cycle = function () {
f ? m && R(m) : (m && R(m), m = setInterval(function () {
var t, i;
t = e.getBoundingClientRect(), i = a[innerHeight] || n.clientHeight, t.top <= i && t.bottom >= 0 && (h++ , c.slideTo(h));
}, s.interval));
}, this.slideTo = function (t) {
if (!b) {
var n = this.getActiveIndex();
if (n !== t) if (w = n < t ? "right" : "left", t < 0 ? t = L - 1 : t >= L && (t = 0), h = t, k("Carousel", "SlideEvent", e, {
direction: w,
"slide-to": t
}), b = !0, R(m), O(t), r && e.classList.contains("slide")) {
"right" === w ? (y[t].classList.add(i + "carousel-item-next"), y[t].offsetWidth, y[t].classList.add(i + "carousel-item-left"), y[n].classList.add(i + "carousel-item-left")) : (y[t].classList.add(i + "carousel-item-prev"), y[t].offsetWidth, y[t].classList.add(i + "carousel-item-right"), y[n].classList.add(i + "carousel-item-right"));
var a = E(y[t]);
b && setTimeout(function () {
b = !1, y[t].classList.add(i + "active"), y[n].classList.remove(i + "active"), y[t].classList.remove(i + "carousel-item-next"), y[t].classList.remove(i + "carousel-item-prev"), y[t].classList.remove(i + "carousel-item-left"), y[t].classList.remove(i + "carousel-item-right"), y[n].classList.remove(i + "carousel-item-left"), k("Carousel", "SlideEvent", e, {
direction: w,
"slide-to": t
}), "hidden" !== o && s.interval && !e.classList.contains("paused") ? c.cycle() : "hidden" === o && M();
}, a);
} else y[t].classList.add(i + "active"), y[t].offsetWidth, y[n].classList.remove(i + "active"), setTimeout(function () {
b = !1, s.interval && !e.classList.contains("paused") && c.cycle(), k("Carousel", "SlideEvent", e, {
direction: w,
"slide-to": t
});
}, 100);
}
}, this.getActiveIndex = function () {
return y.indexOf(g(e, i + "carousel-item " + i + "active")[0]) || 0;
}, "Carousel" in e || (e.classList.contains(i + "mosaic") && (s.mosaic = !0), t.addEventListener("visibilitychange", function () {
"hidden" === o && "visible" === document.visibilityState && I(), o = document.visibilityState;
}), s.pause && s.interval && ((!s.mosaic || s.mosaic && l.matches) && (e.addEventListener(d[0], M, !1), e.addEventListener(d[1], I, !1), e.addEventListener("touchstart", M, !1), e.addEventListener("touchend", I, !1)), s.mosaic && (u && function (e) {
for (var t = 0; t < e.length; t++) {
var n = e[t].querySelector("img.dds__card-img-top");
n && (e[t].querySelector("div.dds__card-img-top").style.backgroundImage = "url('" + n.src + "')", n.style.display = "none", e[t].parentNode.classList.add("dds__background-img"));
}
}(y), l.matches || (f = !0), l.addListener(function (t) {
M(), t.matches ? (f = !1, e.addEventListener(d[0], M, !1), e.addEventListener(d[1], I, !1), e.addEventListener("touchstart", M, !1), e.addEventListener("touchend", I, !1), I()) : (f = !0, e.removeEventListener(d[0], M, !1), e.removeEventListener(d[1], I, !1), e.removeEventListener("touchstart", M, !1), e.removeEventListener("touchend", I, !1));
}))), function (e, t) {
var n = new Object();
n.start = {
x: 0,
y: 0
}, n.end = {
x: 0,
y: 0
}, n.params = {
min: {
x: 50,
y: 90
},
max: {
x: 95,
y: 100
}
};
var a = function a(e) {
return p || u ? {
screenX: e.screenX,
screenY: e.screenY
} : e.touches[0];
},
i = function i(e) {
var t = a(e);
n.start.x = n.end.x = t.screenX, n.start.y = n.end.y = t.screenY;
},
r = function r(e) {
var t = a(e);
n.end.x = t.screenX, n.end.y = t.screenY;
},
s = function s() {
(n.end.x - n.params.min.x > n.start.x || n.end.x + n.params.min.x < n.start.x) && n.end.y < n.start.y + n.params.max.y && n.start.y > n.end.y - n.params.max.y && (n.end.x > n.start.x ? n.direction = v.RIGHT : n.direction = v.LEFT), (n.end.y - n.params.min.y > n.start.y || n.end.y + n.params.min.y < n.start.y) && n.end.x < n.start.x + n.params.max.x && n.start.x > n.end.x - n.params.max.x && (n.end.y > n.start.y ? n.direction = v.DOWN : n.direction = v.UP), n.direction !== v.NONE && "function" == typeof t && t(e, n.direction), n.direction = v.NONE;
};
p ? (e.addEventListener("mousedown", i), e.addEventListener("mousemove", r), e.addEventListener("mouseup", s)) : u ? (e.addEventListener("pointerdown", i), e.addEventListener("pointermove", r), e.addEventListener("pointerup", s)) : (e.addEventListener("touchstart", i), e.addEventListener("touchmove", r), e.addEventListener("touchend", s));
}(e, function (e, t) {
switch (t) {
case v.LEFT:
c.slideTo(h + 1);
break;
case v.RIGHT:
c.slideTo(h - 1);
}
}), S && S.addEventListener("click", H, !1), x && x.addEventListener("click", H, !1), D && D.addEventListener("click", P, !1), C || _(N, function (e) {
_(e.children, function (e) {
e.addEventListener("click", P);
}), e.addEventListener("click", P);
}), !0 === s.keyboard && a.addEventListener("keydown", function (e) {
if (!b) {
switch (e.which) {
case 39:
h++;
break;
case 37:
h--;
break;
default:
return;
}
c.slideTo(h);
}
}, !1), c.getActiveIndex() < 0 && (y[length] && y[0].classList.add(i + "active"), N[length] && O(0)), s.interval && c.cycle()), e.Carousel = c;
}
}, e.Collapse = J, e.ContactDrawer = function (e, t) {
e = _instanceof(e, HTMLElement) && e, (t = z(e, t = t || {})).openTime = t.openTime ? t.openTime : 5e3, t.closedTime = t.closedTime ? t.closedTime : 7e3, t.transitionTime = t.transitionTime ? t.transitionTime : 500;
var n = this,
a = e.querySelector("." + i + "drawer-tab"),
r = e.querySelector("." + i + "close-x"),
s = e.querySelector("." + i + "drawer-content"),
o = !0,
l = !1,
d = function d(e) {
e.preventDefault(), l || (l = !0), f();
},
c = function c() {
o = !0, e.classList.add(i + "drawer-open"), k("ContactDrawer", "OpenEvent", e), s.hidden = !1, s.setAttribute("aria-hidden", !1);
},
u = function u() {
o = !1, e.classList.remove(i + "drawer-open"), k("ContactDrawer", "CloseEvent", e), setTimeout(function () {
s.hidden = !0;
}, t.transitionTime), s.setAttribute("aria-hidden", !0);
},
f = function f() {
o ? u() : c();
};
this.timerAction = function () {
l || (o ? (u(), t.closedTime && setTimeout(function () {
return n.timerAction();
}, t.closedTime)) : (c(), t.openTime && setTimeout(function () {
return n.timerAction();
}, t.openTime)));
}, "ContactDrawer" in e || (a.addEventListener("click", d, !1), r.addEventListener("click", d, !1), function () {
var e = s.dataset.contactDrawer;
if (e) {
var n = JSON.parse(e);
n && (n.OpenTimeInSeconds && (t.openTime = 1e3 * n.OpenTimeInSeconds), n.CloseTimeInSeconds && (t.closedTime = 1e3 * n.CloseTimeInSeconds), n.TransitionTimeInMilliseconds && (t.transitionTime = n.TransitionTimeInMilliseconds));
}
}(), t.transitionTime > t.openTime || t.transitionTime > t.closedTime || e && (e.style.transition = "all " + t.transitionTime + "ms ease")), l || n.timerAction(), e.ContactDrawer = n;
}, e.DatePicker = function (e, t) {
e = _instanceof(e, HTMLElement) && e, (t = z(e, t = t || {})).dateFilter = !!t.datesFilter && t.datesFilter, t.pastDates = !!t.pastDates && t.pastDates, t.defaultDate = t.defaultDate ? t.defaultDate : "", t.availableWeekDays = t.availableWeekDays ? t.availableWeekDays : [{
day: "monday"
}, {
day: "tuesday"
}, {
day: "wednesday"
}, {
day: "thursday"
}, {
day: "friday"
}, {
day: "saturday"
}, {
day: "sunday"
}], t.notBeforeDate = t.notBeforeDate ? t.notBeforeDate : null, t.notAfterDate = t.notAfterDate ? t.notAfterDate : null, t.button_prev = t.button_prev ? t.button_prev : null, t.button_next = t.button_next ? t.button_next : null;
var n,
a,
r = e.querySelector("." + i + "datepicker-btn"),
s = e.getAttribute("data-target"),
o = e.querySelector("." + i + "form-control"),
l = e.querySelector(s),
d = e.querySelector("." + i + "datepicker-btn"),
c = null,
u = null,
f = new Date(),
h = new Date(),
v = null,
m = new Date(),
g = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
b = Object.freeze({
TAB: 9,
ENTER: 13,
ESC: 27,
SPACE: 32,
PAGEUP: 33,
PAGEDOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
}),
L = function L() {
n = y(l);
},
x = function x() {
if (l.classList.contains(i + "d-none")) {
l.classList.remove(i + "d-none");
var t = o.value;
if (t && o.validity.valid && I(new Date(t))) {
a = new Date(t), f = new Date(t), m.getFullYear() != a.getFullYear() && m.setFullYear(a.getFullYear()), m.getMonth() != a.getMonth() && m.setMonth(a.getMonth()), D();
var n = e.querySelector('[data-calendar-date="' + a + '"]');
if (!n.classList.contains(i + "datepicker-date-disabled")) {
n.classList.add(i + "datepicker-date-selected");
var r = n.querySelector("." + i + "datepicker-calendar-day");
r.removeAttribute("tabindex"), r.focus();
}
f = new Date(a.getTime());
} else q();
l.addEventListener("focusout", E, !1);
} else l.classList.add(i + "d-none"), A(), d.focus(), l.removeEventListener("focusout", E, !1);
},
E = function E() {
setTimeout(function () {
!l || l.contains(document.activeElement) || r.contains(document.activeElement) || (x(), r.focus());
}, 10);
},
S = function S(e) {
return ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"][e];
},
C = function C(e) {
var n = !0,
r = document.createElement("div"),
s = document.createElement("button");
s.setAttribute("tabindex", "-1"), s.setAttribute("type", "button"), s.innerHTML = e.getDate(), s.addEventListener("keydown", F, !1), s.className = i + "datepicker-calendar-day", r.className = i + "datepicker-date", r.setAttribute("data-calendar-date", e);
var o = t.availableWeekDays.filter(function (t) {
return t.day === e.getDay() || t.day === S(e.getDay());
});
e.getMonth() != m.getMonth() && r.classList.add(i + "datepicker-date-outdated"), m.getTime() <= h.getTime() - 1 && !t.pastDates ? (r.classList.add(i + "datepicker-date-disabled"), s.setAttribute("disabled", "")) : t.datesFilter ? (t.notBeforeDate && e <= t.notBeforeDate && (n = !1), t.notAfterDate && e > t.notAfterDate && (n = !1), o.length && n ? (r.classList.add(i + "datepicker-date-active"), r.setAttribute("data-calendar-data", JSON.stringify(o[0])), r.setAttribute("data-calendar-status", "active")) : (r.classList.add(i + "datepicker-date-disabled"), s.setAttribute("disabled", ""))) : (r.classList.add(i + "datepicker-date-active"), r.setAttribute("data-calendar-status", "active")), a && e.toString() == a.toString() && !r.classList.contains(i + "datepicker-date-disabled") && r.classList.add(i + "datepicker-date-selected"), e.toString() != f.toString() || r.classList.contains(i + "datepicker-date-disabled") || (r.classList.add(i + "datepicker-date-temp-selected"), s.removeAttribute("tabindex")), r.appendChild(s), u.appendChild(r);
},
A = function A() {
_(e.querySelectorAll("." + i + "datepicker-date-selected"), function (e) {
e.classList.remove(i + "datepicker-date-selected");
});
},
T = function T() {
_(e.querySelectorAll("." + i + "datepicker-date-temp-selected"), function (e) {
e.classList.remove(i + "datepicker-date-temp-selected"), e.firstElementChild.setAttribute("tabindex", "-1");
});
},
q = function q() {
a = null, t.defaultDate = B(t.defaultDate), h = B(h), f = new Date(t.defaultDate.getTime()), m.getFullYear() != f.getFullYear() && m.setFullYear(f.getFullYear()), m.getMonth() != f.getMonth() && m.setMonth(f.getMonth()), D();
var n = e.querySelector('[data-calendar-date="' + f + '"]');
n.classList.add(i + "datepicker-date-temp-selected");
var r = n.querySelector("." + i + "datepicker-calendar-day");
r.removeAttribute("tabindex"), r.focus();
},
D = function D() {
P();
var n = m.getMonth();
v.innerHTML = g[m.getMonth()] + " " + m.getFullYear();
var r = new Date(m.getTime());
r.setDate(r.getDate() - 1), t.notBeforeDate && r <= t.notBeforeDate || !t.pastDates && r.getTime() <= h.getTime() - 1 ? (t.button_prev.classList.add(i + "disabled"), t.button_prev.setAttribute("disabled", "")) : (t.button_prev.classList.remove(i + "disabled"), t.button_prev.removeAttribute("disabled"));
var s = m.getDay();
if (s > 0) for (var o = s; o > 0; o--) {
var l = new Date(m.getTime());
l.setDate(m.getDate() - o), C(l);
}
for (; m.getMonth() === n;) {
C(m), m.setDate(m.getDate() + 1);
}
var d = new Date(m.getTime());
t.notAfterDate && d > t.notAfterDate ? (t.button_next.classList.add(i + "disabled"), t.button_next.setAttribute("disabled", "")) : (t.button_next.classList.remove(i + "disabled"), t.button_next.removeAttribute("disabled")), m.setDate(m.getDate() - 1);
var c = 6 - m.getDay();
if (c > 0) for (var u = 1; u <= c; u++) {
var f = new Date(m.getTime());
f.setDate(m.getDate() + u), C(f);
}
m.setDate(1), _(e.querySelectorAll("[data-calendar-status=active]"), function (e) {
e.addEventListener("click", function () {
A(), T();
var e = this.dataset;
this.classList.add(i + "datepicker-date-selected"), a = new Date(e.calendarDate), H();
});
}), L();
},
N = function N(e) {
e && e.preventDefault(), m.setMonth(m.getMonth() - 1), D();
},
M = function M(e) {
e && e.preventDefault(), m.setMonth(m.getMonth() + 1), D();
},
I = function I(e) {
return !(0 == t.availableWeekDays.filter(function (t) {
return t.day === e.getDay() || t.day === S(e.getDay());
}).length || t.notBeforeDate && e <= t.notBeforeDate || t.notAfterDate && e > t.notAfterDate || !t.pastDates && e.getTime() <= h.getTime() - 1);
},
P = function P() {
u.innerHTML = "";
},
H = function H() {
o.value = ("0" + (a.getMonth() + 1)).slice(-2) + "/" + ("0" + a.getDate()).slice(-2) + "/" + a.getFullYear();
var t = document.createEvent("Event");
t.initEvent("change", !1, !1), o.dispatchEvent(t), o.focus(), k("DatePicker", "SelectedDate", e, {
date: a
}), x();
},
O = function O(t, n) {
f = R(t, n);
var a = e.querySelector('[data-calendar-date="' + t + '"]');
a && (a.children[0].setAttribute("tabindex", "-1"), a.classList.remove(i + "datepicker-date-temp-selected"));
var r = e.querySelector('[data-calendar-date="' + f + '"]').querySelector("." + i + "datepicker-calendar-day");
r.removeAttribute("tabindex"), r.parentElement.classList.add(i + "datepicker-date-temp-selected"), r.focus();
},
R = function R(n, a) {
var i = n < a ? 1 : -1;
return e.querySelector(":not(.dds__datepicker-date-disabled):not(.dds__datepicker-date-outdated)[data-calendar-date='" + a + "']") ? a : t.notBeforeDate && a <= t.notBeforeDate ? n : t.notAfterDate && a >= t.notAfterDate ? n : a.getTime() <= h.getTime() - 1 && !t.pastDates ? n : a.getMonth() != n.getMonth() ? (1 == i && M(), -1 == i && N(), e.querySelector(":not(.dds__datepicker-date-disabled)[data-calendar-date='" + a + "']") ? a : (n = new Date(a.getTime()), a.setDate(a.getDate() + i), R(n, a))) : (n = new Date(a.getTime()), a.setDate(a.getDate() + i), R(n, a));
},
B = function B(e) {
if (I(e)) return e;
var t = new Date(e.getTime());
t.setDate(t.getDate() + 1);
var n = new Date(e.getTime());
n.setDate(n.getDate() - 1);
var a = R(e, t);
a.getMonth() > e.getMonth() && (N(), T());
var i = R(e, n);
if (a.getMonth() > e.getMonth()) return i;
if (i.getMonth() < e.getMonth()) return M(), T(), a;
var r = Math.abs(e.getDate() - a.getDate()),
s = Math.abs(e.getDate() - i.getDate());
if (0 == s && 0 == r) {
for (var o = new Date(e.getTime()), l = new Date(e.getTime()); !I(o) && !I(l);) {
o.getMonth() == e.getMonth() && o.setDate(o.getDate() - 1), l.getMonth() == e.getMonth() && l.setDate(l.getDate() + 1);
}
return I(o) ? o : l;
}
return 0 == s ? a : 0 == r ? i : r < s ? a : i;
},
F = function F(t) {
var a = new Date(f.getTime());
switch (t.keyCode) {
case b.UP:
t.preventDefault(), f.setDate(f.getDate() - 7), O(a, f);
break;
case b.DOWN:
t.preventDefault(), f.setDate(f.getDate() + 7), O(a, f);
break;
case b.LEFT:
t.preventDefault(), f.setDate(f.getDate() - 1), O(a, f);
break;
case b.RIGHT:
t.preventDefault(), f.setDate(f.getDate() + 1), O(a, f);
break;
case b.ESC:
var r = e.querySelector("." + i + "datepicker-date-selected");
r && (r.classList.remove(i + "datepicker-date-selected"), r.children[0].setAttribute("tabindex", "-1")), x();
break;
case b.TAB:
if (1 === n.length) {
t.preventDefault();
break;
}
t.shiftKey ? document.activeElement === n[0] && (t.preventDefault(), n[n.length - 1].focus()) : document.activeElement === n[n.length - 1] && (t.preventDefault(), n[0].focus());
}
},
W = function W(e) {
switch (e.keyCode) {
case b.ESC:
x();
break;
case b.TAB:
if (1 === n.length) {
e.preventDefault();
break;
}
e.shiftKey ? document.activeElement === n[0] && (e.preventDefault(), n[n.length - 1].focus()) : document.activeElement === n[n.length - 1] && (e.preventDefault(), n[0].focus());
}
},
V = function V() {
I(new Date(o.value)) && "block" == getComputedStyle(j).display ? (j.style.display = "none", o.setCustomValidity("")) : I(new Date(o.value)) || "none" != getComputedStyle(j).display || (j.style.display = "block", o.setCustomValidity("Invalid Date"));
};
if (this.init = function () {
!function () {
e.querySelector(s).innerHTML = '
', e.querySelector("." + i + "datepicker-week").innerHTML = "SUNMONTUEWEDTHUFRISAT";
var t = e.querySelector("." + i + "calendar-buttons");
t.innerHTML = '', t.querySelector("." + i + "btn-secondary").addEventListener("click", x, !1), t.querySelector("." + i + "btn-secondary").addEventListener("keydown", W, !1);
}(), t.button_prev = document.querySelector(s + " [data-calendar-toggle=previous]"), t.button_next = document.querySelector(s + " [data-calendar-toggle=next]"), u = document.querySelector(s + " [data-calendar-area=month]"), v = document.querySelector(s + " [data-calendar-label=month]"), m.setDate(1), D(), t.button_prev.addEventListener("click", function () {
N(), T();
var e = new Date(f.getTime());
e.setMonth(e.getMonth() - 1), f.getMonth() === e.getMonth() && e.setDate(0), O(e, B(e)), t.button_prev.classList.contains(i + "disabled") || t.button_prev.focus();
}, !1), t.button_next.addEventListener("click", function () {
M(), T();
var e = new Date(f.getTime());
e.setMonth(e.getMonth() + 1), e.getMonth() - f.getMonth() >= 2 && e.setDate(0), O(e, B(e)), t.button_next.classList.contains(i + "disabled") || t.button_next.focus();
}, !1), t.button_prev.addEventListener("keydown", W, !1), t.button_next.addEventListener("keydown", W, !1);
}, this.destroy = function () {
t.button_prev.removeEventListener("click", N, !1), t.button_next.removeEventListener("click", M, !1), t.button_prev.removeEventListener("keydown", W, !1), t.button_next.removeEventListener("keydown", W, !1), P(), document.querySelector(s).innerHTML = "";
}, this.reset = function () {
this.destroy(), this.init();
}, !("DatePicker" in e)) {
if (null == r) throw new Error("There was a problem found with date picker button, please correct and try again");
if (null == s) throw new Error("There was a problem found with date picker target, please correct and try again");
if (null == l) throw new Error("There was a problem found with calendar, please correct and try again");
if (m.setHours(0, 0, 0, 0), h.setHours(0, 0, 0, 0), r.addEventListener("click", x, !1), p && (r.addEventListener("click", V, !1), o.addEventListener("focusout", V, !1)), t.defaultDate || (t.defaultDate = new Date(), t.defaultDate.setHours(0, 0, 0, 0)), o.hasAttribute("placeholder") || (console.warn("Placeholder was not set. Please set a placeholder value if you plan to use form validation. Setting to default placeholder value."), o.setAttribute("placeholder", "__/__/____")), o) {
new U(o);
var j = e.querySelector("." + i + "invalid-feedback");
o.addEventListener("change", V, !1);
}
(c = w(e, "FORM")).addEventListener("submit", function (e) {
!1 === c.checkValidity() && (_(c, function (e) {
if ("INPUT" == e.tagName) {
var t = c.querySelector("#" + e.getAttribute("id") + "Feedback");
setTimeout(function () {
e.classList.contains("dds__datepicker-input") && (I(new Date(o.value)) ? e.setCustomValidity("") : e.setCustomValidity("Invalid Date")), e.validity.valid ? (t && "block" == getComputedStyle(t).display && (t.style.display = "none"), e.setAttribute("aria-invalid", "false"), e.setAttribute("aria-describedby", "")) : (t && "block" != getComputedStyle(t).display && (t.style.display = "block"), e.setAttribute("aria-invalid", "true"), e.setAttribute("aria-describedby", e.getAttribute("id") + "Feedback"));
}, 10);
}
}), e.preventDefault(), e.stopPropagation()), c.classList.add("dds__was-validated");
}), this.init(), L();
}
e.DatePicker = this;
}, e.Dropdown = K, e.FilmstripCarousel = function (e, t) {
e = _instanceof(e, HTMLElement) && e, (t = z(e, t = t || {})).lazyload = "boolean" == typeof t.lazyload && t.lazyload;
var n,
a,
r,
s = {},
o = function o(e) {
s.detail = e.detail, d();
},
l = function l(t) {
t.preventDefault();
var a = t.target;
a && "BUTTON" === a.parentElement.tagName && (a = a.parentElement), n && (n.classList.remove(i + "active"), n.setAttribute("aria-pressed", "false")), a.classList.add(i + "active"), a.setAttribute("aria-pressed", "true"), n = a, k("FilmstripCarousel", "ItemClick", e, {
target: a.dataset.filterValue
});
},
d = function d() {
if (a) {
var e = s.detail.hasRightControl ? s.detail.right + 1 : s.detail.totalItems,
t = s.detail.hasLeftControl ? s.detail.left + 1 : 1;
a.innerHTML = "Viewing " + t + (t < e ? " - " + e : "") + " of " + s.detail.totalItems + " items ";
}
};
this.lazyLoad = function () {
t.lazyload && s ? (s.lazyLoad(), s.detail = s.getCurrentDetails(), d(), r.addEventListener("uicOverflowChangeEvent", o, !1), k("FilmstripCarousel", "LazyLoadEvent", e, {
success: !0
})) : k("FilmstripCarousel", "LazyLoadEvent", e, {
success: !1,
msg: "Carousel cannot be lazy loaded. Check usage or avoid mulitple lazy loads."
});
}, "Filmstrip" in e || (a = e.parentElement.querySelector("DIV.dds__items-view"), _(e.querySelector("UL").querySelectorAll("LI BUTTON"), function (e) {
e.classList.contains(i + "active") && (n = e), e.addEventListener("click", l, !1);
}), (r = w(e, "." + i + "container-overflow")) && (s = new Y(r, {
position: "outset",
style: "svg",
top: 50,
lazyload: t.lazyload
}), t.lazyload || (s.detail = s.getCurrentDetails(), d(), r.addEventListener("uicOverflowChangeEvent", o, !1)))), e.Filmstrip = self;
}, e.FilterCollection = function (e) {
e = _instanceof(e, HTMLElement) && e;
var t,
n,
s,
o,
l,
d,
c,
u,
f,
p,
h,
v,
m,
g,
b,
L,
x,
E = !0,
S = [],
A = [],
T = [],
q = [],
D = !1,
N = !1,
M = window.matchMedia("(max-width: 767.98px)"),
I = window.matchMedia("(max-width: 991.98px)"),
O = function O(t) {
if ("uicDropdownAddEvent" === t.type || "uicFilterKeywordCreateEvent" === t.type) D ? te(t.detail.filter, t.detail.filterInput) : ne(t.detail.filter, t.detail.filterInput); else {
var n = t.srcElement;
"INPUT" != n.tagName && (n = "SPAN" === n.tagName && "INPUT" === n.previousElementSibling.tagName ? n.previousElementSibling : n.querySelector("input")), ne(n.nextElementSibling.innerText, n), (!E && e.getBoundingClientRect().y && e.getBoundingClientRect().y < 0 || e.getBoundingClientRect().top && e.getBoundingClientRect().top < 0) && e.scrollIntoView({
behavior: "smooth"
});
}
},
R = function R(n) {
(n.target == o || o.contains(n.target) || n.target === s || s.contains(n.target)) && de(!1), _(t.querySelectorAll("button." + i + "filter-item"), function (e) {
Q(e);
}), l.classList.add(i + "d-none"), E && $(), oe(), k("FilterCollection", "RemoveAllEvent", e, {
filters: le()
});
},
F = function F(n) {
if ("uicDropdownAddEvent" === n.type || "uicDropdownRemoveEvent" === n.type) {
if (!0 === n.detail.filterInput.checked) O(n); else {
var a = t.querySelector("#" + n.detail.filter.replace(/\s/g, "").toLowerCase());
Q(a), S && 0 === S.length && (de(!1), k("FilterCollection", "RemoveAllEvent", e, {
filters: le()
}));
}
} else if ("click" === n.type) {
n.preventDefault();
var r = n.srcElement;
"INPUT" != r.tagName && (r = "SPAN" === r.tagName && "INPUT" === r.previousElementSibling.tagName ? r.previousElementSibling : r.querySelector("input")), r.hasAttribute("disabled") || r.classList.contains(i + "disabled") || setTimeout(function () {
if (r.checked ? r.checked = !1 : r.checked = !0, !0 === r.checked) O(n); else {
var a = r.name.toLowerCase(),
i = t.querySelector('[value="' + a + '"]');
Q(i), S && 0 === S.length && (de(!1), k("FilterCollection", "RemoveAllEvent", e, {
filters: le()
}));
}
}, 25);
}
},
z = function z(t) {
var n = t.target.classList.contains("." + i + "filter-item") ? t.target : w(t.target, "." + i + "filter-item");
if (S.length && 1 === S.length) R(t), l.classList.add(i + "d-none"), q[0] ? C(q[0]) : C(g[0]); else {
var a = n.previousElementSibling && n.previousElementSibling.classList.contains(i + "filter-item") ? n.previousElementSibling : n.nextElementSibling && n.nextElementSibling.classList.contains(i + "filter-item") ? n.nextElementSibling : q ? q[0] : g[0];
setTimeout(function () {
Q(n), k("FilterCollection", "RemoveEvent", e, {
filters: le(),
removedFilter: n.innerText
}), C(a);
}, 50);
}
},
V = function V(e) {
var t = e.target.id.replace("OffCanvas", ""),
a = document.getElementById(t);
if (!e.target.hasAttribute("disabled") && !e.target.classList.contains(i + "disabled")) {
if (e.target.checked) te(e.target.name, a), de(!0); else {
var r,
s = e.target.name.toLowerCase();
r = n.querySelector('[value="' + s + '"]');
var o = B(A, function (e) {
return e.innerText.toLowerCase().replace(/\s/g, "") == r.innerText.toLowerCase().replace(/\s/g, "");
}),
l = A.indexOf(o);
A.splice(l, 1), r && setTimeout(function () {
n.removeChild(r);
}, 1);
}
re(e.target);
}
},
j = function j() {
_(e.querySelectorAll("." + i + "modal-offcanvas input." + i + "form-check-input"), function (e) {
e.checked = !1, e.parentElement.setAttribute("aria-checked", "false"), re(e);
}), _(e.querySelectorAll("." + i + "modal-offcanvas button." + i + "filter-item"), function (e) {
n.removeChild(e);
}), A = [], de(!1);
},
U = function U(e) {
var t = e.target.classList.contains("." + i + "filter-item") ? e.target : w(e.target, "." + i + "filter-item"),
a = B(A, function (e) {
return e.value.toLowerCase().replace(/\s+/g, "") === t.innerText.toLowerCase().replace(/\s+/g, "");
});
a.offCanvasOrigin && (a.offCanvasOrigin.checked = !1, a.offCanvasOrigin.parentElement.setAttribute("aria-checked", "false"), re(a.offCanvasOrigin));
var r = A.indexOf(a);
A.splice(r, 1), t.nextElementSibling ? t.nextElementSibling.focus() : t.previousElementSibling && t.previousElementSibling.classList.contains(i + "filter-item") ? t.previousElementSibling.focus() : C(y(d)[0]), n.contains(t) && setTimeout(function () {
n.removeChild(t);
}, 1);
},
Y = function Y() {
(u = Math.min(u + f, m.length - 1)) === m.length - 1 && p.classList.add(i + "d-none"), ce(u), setTimeout(function () {
C(m[u].querySelector("." + i + "btn-secondary"));
}, 1);
},
Z = function Z(e, t) {
return e.filter(function (e) {
return e.value === t;
}).length > 0;
},
$ = function $() {
_(g, function (t) {
if (t.querySelector("." + i + "checked-presentation") && t.firstElementChild.removeChild(t.querySelector("." + i + "checked-presentation")), t.getAttribute("data-filter") == i + "multi-select") {
var n = t.getAttribute("data-target");
_(e.querySelector(n).children, function (e) {
e.querySelector("input").checked = !1;
});
}
});
},
Q = function Q(a) {
if (null != a) {
var i = a.innerText,
r = S.filter(function (e) {
return i = i.toLowerCase().replace(/\n/g, ""), e.value === i;
});
if (!(r.length < 1)) {
var s = r[0];
"INPUT" === s.origin.tagName && !0 === s.origin.checked && (s.origin.checked = !1), s.offCanvasOrigin && "INPUT" === s.offCanvasOrigin.tagName && !0 === s.offCanvasOrigin.checked && (s.offCanvasOrigin.checked = !1, s.offCanvasOrigin.parentElement.setAttribute("aria-checked", "false"), re(s.offCanvasOrigin)), E || se(s.origin);
var o,
l,
d = a.value.toLowerCase();
if (t.contains(a)) {
if (t.removeChild(a), l = n.querySelector('[value="' + d + '"]'), n.contains(l)) {
n.removeChild(l);
var c = B(A, function (e) {
return e.value === i.toLowerCase().replace(/\n/g, "");
});
o = A.indexOf(c), A.splice(o, 1);
}
} else if (n.contains(a) || null != t.querySelector("#" + a.id)) {
var u = t.querySelector("#" + a.id);
t.removeChild(u);
}
o = S.indexOf(r[0]), S.splice(o, 1), (!E && e.getBoundingClientRect().y && e.getBoundingClientRect().y < 0 || e.getBoundingClientRect().top && e.getBoundingClientRect().top < 0) && e.scrollIntoView({
behavior: "smooth"
}), 0 === S.length && de(!1), _(T, function (e) {
e.recountChecked();
});
}
}
},
ee = function ee() {
p = P("div", {
class: i + "col-xs-12 " + i + "col-sm-6 " + i + "col-md-4 " + i + "col-lg-3"
});
var e = P("button", {
class: i + "filter-btn-show " + i + "btn " + i + "btn-secondary " + i + "d-flex",
id: "showMorefilters",
html: "Show More Filters"
});
e.addEventListener("click", Y, !1), p.appendChild(e), v.appendChild(p);
},
te = function te(e, t) {
if (!ie(e.value ? e.value : e, !0)) {
var a,
i = !1;
null == t && (t = ""), "object" == _typeof(e) ? a = e.cloneNode(!0) : (e[0].match(/\d/) && (e = "digit".concat(e), i = !0), e = e.replace(/\s+/g, " ").trim(), a = ae(e, !0, i)), N || (a.addEventListener("click", U, !1), n.appendChild(a));
var r = e.value ? e.value : e.replace(/^digit/, "");
if (D) {
var s = t.id + "OffCanvas",
o = document.getElementById(s);
a.value = t.name ? t.name.toLowerCase() : r.toLowerCase(), a.origin = t, a.offCanvasOrigin = o, A.push(a);
}
}
},
ne = function ne(e, n) {
var a = !1;
if (null == n && (n = ""), e[0].match(/\d/) && (e = "digit".concat(e), a = !0), e = e.replace(/\s+/g, " ").trim(), !ie(e, !1)) {
S.length <= 0 && l.classList.remove(i + "d-none"), s.classList.contains(i + "d-none") && de(!0);
var r = ae(e, !0, a),
o = n.id + "OffCanvas",
d = document.getElementById(o);
r.origin = n, r.offCanvasOrigin = d, r.value = n.name ? n.name.toLowerCase() : e.replace(/^digit/, "").toLowerCase(), r.addEventListener("click", z, !1), D || (S.push(r), d && (d.checked = !0, d.parentElement.setAttribute("aria-checked", "true"), re(d)), E ? t.insertBefore(r, s) : (t.appendChild(r), se(n)), N || te(r, r.origin), oe(), k("FilterCollection", "CreateEvent", r, {
filters: le(),
addedFilter: r.innerText
}));
}
},
ae = function ae(e, t, n) {
var a = e;
n && (a = e.replace(/^digit/, ""));
var r = e.replace(/([^A-Za-z0-9._:\/-])/g, ""),
s = P("button", {
class: i + "filter-item " + i + "btn " + i + "btn-secondary " + i + "btn-sm " + i + "text-truncate",
id: r.toLowerCase().replace(/\s/g, "").trim()
}),
o = P("label", {
html: a,
class: i + "text-truncate"
});
if (s.appendChild(o), t) {
var l = W([{
name: "close-x",
show: !0
}]);
H(l, i + "svg-close-x"), H(l, i + "align-self-center"), H(l, i + "m1-1"), l.setAttribute("tabindex", "-1"), l.setAttribute("focusable", "false"), l.setAttribute("aria-label", "filter-close"), s.appendChild(l);
}
return s;
},
ie = function ie(t, n) {
var s = n ? A : S,
o = n ? d : e;
return null == t || "" == t ? (console.warn("Not a valid filter tag"), !0) : !!Z(s, t.toLowerCase()) && (_(o.querySelectorAll(".dds__filter-item"), function (e) {
var n, s;
e.value.toLowerCase() == t.toLowerCase() && (e.classList.add(i + "shakey"), setTimeout(function () {
e.classList.remove(i + "shakey");
}, (n = e, s = r ? a.getComputedStyle(n).animationDuration : 0, 50 + (s = "number" != typeof (s = parseFloat(s)) || isNaN(s) ? 0 : 1e3 * s))));
}), console.warn("This filter has already been added"), !0);
},
re = function re(t) {
var n,
a = w(t, "." + i + "collapse").id,
r = e.querySelector("[data-target='#" + a + "']"),
s = w(t, "." + i + "accordion-card-body").querySelectorAll("." + i + "form-check-input:checked").length;
n = s > 0 ? "(" + s + ")" : " ";
var o = r.querySelector("." + i + "checked-presentation");
null != o ? o.innerHTML = n : (o = P("span", {
class: i + "checked-presentation " + i + "ml-1",
html: n
}), r.appendChild(o));
},
se = function se(t) {
if (t) {
var n,
a = w(t, "." + i + "collapse").id,
r = e.querySelector("[data-target='#" + a + "']"),
s = w(t, "." + i + "secondary-accordion").querySelectorAll("." + i + "form-check-input:checked").length;
n = s > 0 ? "(" + s + ")" : " ";
var o = r.querySelector("." + i + "checked-presentation");
null != o ? o.innerHTML = n : (o = P("span", {
class: i + "checked-presentation " + i + "ml-1 " + i + "font-weight-bold",
html: n
}), r.insertBefore(o, r.querySelector("." + i + "arrow-tri-solid-right")));
} else q.forEach(function (e) {
var t,
n = e.parentNode.querySelectorAll("." + i + "form-check-input:checked").length;
t = n > 0 ? "(" + n + ")" : " ";
var a = e.querySelector("." + i + "checked-presentation");
null != a ? a.innerHTML = t : (a = P("span", {
class: i + "checked-presentation " + i + "ml-1",
html: t
}), e.querySelector("span").appendChild(a));
});
},
oe = function oe() {
var t,
n = S.length,
a = e.querySelectorAll("." + i + "filter-btn-mobile")[0];
t = n > 0 ? "(" + n + ")" : " ";
var r = a.querySelector("." + i + "checked-presentation");
null != r ? r.innerHTML = t : (r = P("span", {
class: i + "checked-presentation " + i + "ml-1",
html: t
}), a.appendChild(r));
},
le = function le() {
var e = [];
return _(S, function (t) {
e.push(t.value);
}), e;
},
de = function de(t) {
x && !E && (s = e.querySelector("." + i + "filter-label-results ." + i + "filter-btn-clear")), 1 == t && s.classList.contains(i + "d-none") ? (o.classList.remove(i + "d-none"), s.classList.add(i + "d-flex"), s.classList.remove(i + "d-none"), s.addEventListener("click", R, !1), s.addEventListener("touchstart", R, !1)) : 0 == t & !s.classList.contains(i + "d-none") && (o.classList.add(i + "d-none"), s.classList.remove(i + "d-flex"), s.classList.add(i + "d-none"), s.removeEventListener("click", R, !1), s.removeEventListener("touchstart", R, !1));
},
ce = function ce(e) {
var t;
if (m[e].classList.contains(i + "d-none")) for (t = 0; t <= e; t++) {
m[t].classList.remove(i + "d-none");
} else for (t = e + 1; t < m.length; t++) {
m[t].classList.add(i + "d-none");
}
};
if (this.updateResultsLabel = function (t) {
t && "string" == typeof t ? e.querySelector("#resultCount").innerText = t : console.warn("This is not a valid input for updateResultsLabel.");
}, !("FilterCollection" in e)) {
if (e.classList.contains(i + "filter-collection-vertical") && (E = !1), s = E ? e.querySelector("." + i + "filter-collection-wrapper ." + i + "filter-btn-clear") : M.matches ? e.querySelector("." + i + "filter-label-results ." + i + "filter-btn-clear") : e.querySelector("." + i + "filter-collector-accordion ." + i + "filter-btn-clear"), v = e.querySelector("." + i + "filter-input-container"), m = v.querySelectorAll("div." + i + "btn-dropdown"), g = e.querySelectorAll("[data-filter]"), b = e.getAttribute("data-target"), null == (L = e.querySelector(b))) return console.error("Found no filter collection to output results to."), !1;
if (null == g) return console.error("Found no data-filter element(s) available to use"), !1;
if (e.querySelector("." + i + "filter-btn-mobile")) {
var ue = e.querySelector("." + i + "filter-btn-mobile");
h = new X(ue), ue.addEventListener("click", function () {
D = !0, A = S.slice();
}), d = e.querySelector("." + i + "modal-offcanvas"), e.querySelectorAll("[data-toggle='" + i + "collapse']") && _(e.querySelectorAll("[data-toggle='" + i + "collapse']"), function (e) {
new J(e);
}), d.querySelector("." + i + "text-right ." + i + "btn-primary") && d.querySelector("." + i + "text-right ." + i + "btn-primary").addEventListener("click", function () {
N = !0, D = !1, A.length > 1 && l.classList.remove(i + "d-none"), _(A, function (e) {
if (!Z(S, e.value.toLowerCase())) {
var n = e.cloneNode(!0);
n.origin = e.origin, n.offCanvasOrigin = e.offCanvasOrigin, n.value = e.value, n.addEventListener("click", z, !1), E ? t.insertBefore(n, s) : t.appendChild(n), n.origin && (n.origin.checked = !0, n.origin.parentElement.setAttribute("aria-checked", "true"));
}
}), _(S.slice(), function (e) {
if (!Z(A, e.value.toLowerCase())) {
var t = B(S, function (t) {
return t.value === e.value;
});
Q(t);
}
}), S = A.slice(), N = !1, S.length > 0 ? (l.classList.remove(i + "d-none"), de(!0)) : (l.classList.add(i + "d-none"), de(!1)), oe(), E ? _(T, function (e) {
e.recountChecked();
}) : se(), h.hide(), k("FilterCollection", "UpdateEvent", e, {
filters: le()
});
}), d.querySelector("." + i + "text-right ." + i + "dds__btn-secondary-primary") && d.querySelector("." + i + "text-right ." + i + "dds__btn-secondary").addEventListener("click", R), d.querySelector("." + i + "text-right ." + i + "btn-secondary") && (o = d.querySelector("." + i + "text-right ." + i + "btn-secondary")).addEventListener("click", j, !1), d.querySelector("[data-dismiss]") && d.querySelector("[data-dismiss]").addEventListener("click", function () {
j(), _(S, function (e) {
e.offCanvasOrigin ? e.offCanvasOrigin.click() : te(e, e.origin);
}), 0 === S.length && de(!1), D = !1;
}, !1), _(d.querySelectorAll("." + i + "form-check-input"), function (e) {
e.addEventListener("click", V, !1);
});
}
if (E) if (I.matches) {
if (I.matches && g.length > 6) {
for (f = 3, fe = 1 + (u = 3); fe < m.length; fe++) {
m[fe].classList.add(i + "d-none");
}
ee();
}
} else if (g.length > 8) {
f = 4;
for (var fe = 1 + (u = 5); fe < m.length; fe++) {
m[fe].classList.add(i + "d-none");
}
ee();
}
_(g, function (e) {
var t = e.getAttribute("data-filter");
if (t == i + "keyword-filter") new G(c = e), c.addEventListener("uicFilterKeywordCreateEvent", O, !1); else if (t == i + "multi-select") {
var n = e;
T.push(new K(e)), n.addEventListener("uicDropdownAddEvent", F, !1), n.addEventListener("uicDropdownRemoveEvent", F, !1);
} else t == i + "secondary-accordion" && (q.push(e), _(e.parentNode.querySelectorAll("." + i + "form-check"), function (e) {
e.addEventListener("click", F, !0);
}));
}), t = L.querySelector("div." + i + "filter-results"), n = e.querySelector("div." + i + "modal-offcanvas div." + i + "filter-results"), l = e.querySelector("label." + i + "filter-label-results"), E && I.addListener(function (e) {
var t;
if (e.matches) f = 3, (t = 3 * Math.max(Math.ceil((u + 1) / 4), 2) - 2) < m.length - 1 && p.classList.remove(i + "d-none"), ce(u = t - 1); else {
if (f = 4, u === m.length) return;
(t = 4 * Math.max(Math.ceil((u + 1) / 3), 2) - 2) > m.length - 1 && (t = m.length, p.classList.add(i + "d-none")), ce(u = t - 1);
}
}), M.addListener(function (t) {
t.matches ? t.matches && !E && (x = !0, s.classList.contains("dds__d-flex") ? (s.classList.remove("dds__d-flex"), s.classList.add("dds__d-none"), (s = e.querySelector(".dds__filter-label-results .dds__filter-btn-clear")).classList.remove("dds__d-none"), s.classList.add("dds__d-flex")) : s = e.querySelector(".dds__filter-label-results .dds__filter-btn-clear"), s.addEventListener("click", R, !1), s.addEventListener("touchstart", R, !1)) : (h.hide(), x = !1, E || (s.classList.contains("dds__d-flex") ? (s.classList.remove("dds__d-flex"), s.classList.add("dds__d-none"), (s = e.querySelector("." + i + "filter-collector-accordion ." + i + "filter-btn-clear")).classList.remove("dds__d-none"), s.classList.add("dds__d-flex")) : s = e.querySelector("." + i + "filter-collector-accordion ." + i + "filter-btn-clear"), s.addEventListener("click", R, !1), s.addEventListener("touchstart", R, !1))), oe();
});
}
e.FilterCollection = this;
}, e.FilterKeyword = G, e.Form = function (e) {
e = _instanceof(e, HTMLElement) && e;
var n = function n(e) {
var n = t.getElementById(e.target.dataset.target);
n ? "password" === n.type ? n.type = "text" : n.type = "password" : console.warn("The target password field does not exist.");
};
"Form" in e || (e.querySelectorAll("input") && _(e.querySelectorAll("input"), function (e) {
e.classList.contains(i + "input-masked") && new U(e);
}), e.addEventListener("submit", function (t) {
!1 === e.checkValidity() && (_(e, function (t) {
if ("INPUT" == t.tagName) {
var n = e.querySelector("#" + t.getAttribute("id") + "Feedback");
setTimeout(function () {
t.validity.valid ? (n && "block" == getComputedStyle(n).display && (n.style.display = "none"), t.setAttribute("aria-invalid", "false"), t.setAttribute("aria-describedby", "")) : (n && "block" != getComputedStyle(n).display && (n.style.display = "block"), t.setAttribute("aria-invalid", "true"), t.setAttribute("aria-describedby", t.getAttribute("id") + "Feedback"));
}, 10);
}
}), t.preventDefault(), t.stopPropagation()), e.classList.add("dds__was-validated");
}), _(g(e, i + "form-check-input"), function (e) {
e && e.dataset.target && e.addEventListener("click", n);
})), e.Form = this;
}, e.LinkPicker = function (e) {
var t = (e = _instanceof(e, HTMLElement) && e).querySelector('select[name="LinkPicker_Interest"]'),
n = e.querySelector('select[name="LinkPicker_ToUse"]'),
a = JSON.parse(t.getAttribute("data-select")),
i = JSON.parse(n.getAttribute("data-select")),
r = e.querySelector('button[name="LinkPicker_Find"]'),
s = function s(e) {
if (e.target === t) {
0 === t.selectedIndex ? (n.disabled = !0, n.classList.add("dds__disabled")) : (n.disabled = !1, n.classList.remove("dds__disabled"));
var a = i.ToUse[t.value];
o(n, !0), l(n, a), r.classList.add("dds__disabled");
} else 0 === n.selectedIndex ? (r.disabled = !0, r.classList.add("dds__disabled")) : (r.disabled = !1, r.classList.remove("dds__disabled"));
},
o = function o(e, t) {
var n;
if (t) for (var a = (n = e.getElementsByTagName("optgroup")).length; a; a--) {
e.removeChild(n[a - 1]);
}
for (a = e.options.length; a; a--) {
e.options[a - 1].parentNode.removeChild(e.options[a - 1]);
}
},
l = function l(e, t) {
var n,
a,
i = document.createDocumentFragment(),
r = [];
function s(e) {
for (var t, n = document.createDocumentFragment(), a = 0, i = e.text.length; a < i; a++) {
(t = P("option")).appendChild(document.createTextNode(e.text[a])), e.value && (t.value = e.value[a]), n.appendChild(t);
}
return n;
}
if (t.text) a = s(t), i.appendChild(a); else {
for (var o in t) {
Object.prototype.hasOwnProperty.call(t, o) && r.push(o);
}
_(r, function (e) {
n = P("optgroup", {
label: e
}), i.appendChild(n), a = s(t[e]), n.appendChild(a);
});
}
e.appendChild(i);
};
if (!("LinkPicker" in e)) {
l(t, a), t.selectedIndex = 0, t.addEventListener("change", s, !1), n.addEventListener("change", s, !1), r.addEventListener("click", function () {
var e = n.options[n.selectedIndex].value;
r.setAttribute("href", e), r.click();
}, !1);
var d = i.ToUse[t.value];
l(n, d);
}
e.LinkPicker = this;
}, e.Masthead = function (e) {
var n,
a,
r,
s,
o = (e = _instanceof(e, HTMLElement) && e).querySelector("." + i + "msthd-bottom"),
l = ["mouseenter", "mouseleave"],
u = e.querySelector("[data-target=msthd-signin-ctnr] ." + i + "msthd-label") ? e.querySelector("[data-target=msthd-signin-ctnr] ." + i + "msthd-label").innerHTML : "Sign In",
p = window.matchMedia("(max-width: 991.98px)"),
h = function h(e) {
e.preventDefault();
var t = "LI" === e.target.tagName ? e.target : w(e.target, "LI");
D(t), e.stopPropagation();
},
v = function v(e) {
e.preventDefault();
var t = "UL" === e.target.tagName ? e.target : w(e.target, "UL");
D(t), e.stopPropagation();
},
g = function g(e) {
var n = e.currentTarget,
a = e.relatedTarget ? e.relatedTarget : t.activeElement;
e.currentTarget.contains(a) || (T(n), a.classList.contains(i + "msthd-menu-link") || A());
},
b = function b(e) {
e.preventDefault(), C(), e.stopPropagation();
},
y = function y(e) {
var n,
a = e.target ? e.target : t.activeElement,
r = a.parentNode,
s = r.querySelector("ul") ? r.querySelector("ul") : void 0,
o = r.classList.contains(i + "msthd-menu-top-item");
switch (e.keyCode) {
case 37:
e.preventDefault(), o ? r.previousElementSibling && (n = r.previousElementSibling.querySelector("a")) && n.focus() : r.classList.contains(i + "msthd-menu-item-img") && r.previousElementSibling ? r.previousElementSibling.querySelector("a").focus() : (l = T(r)).classList.contains(i + "msthd-menu-top-item") ? l.previousElementSibling ? l.previousElementSibling.querySelector("a").focus() : l.querySelector("a").focus() : (l.querySelector("a").focus(), D(l));
break;
case 38:
e.preventDefault(), o || (r.previousElementSibling && (n = r.previousElementSibling.querySelector("a")) ? n.focus() : r.parentNode.lastElementChild.querySelector("a").focus());
break;
case 39:
if (e.preventDefault(), o) r.nextElementSibling && (n = r.nextElementSibling.querySelector("a")) && n.focus(); else if (a.querySelector("svg")) q([r, s, a]), o || D(r), s.querySelector("a").focus(); else if (r.classList.contains(i + "msthd-menu-item-img") && r.nextElementSibling) r.nextElementSibling.querySelector("a").focus(); else {
do {
r = l = T(r);
} while (!r.classList.contains(i + "msthd-menu-top-item"));
r.nextElementSibling ? r.nextElementSibling.querySelector("a").focus() : r.querySelector("a").focus();
}
break;
case 40:
e.preventDefault(), o ? s ? (q([r, s, a]), s.querySelector("a").focus(), C()) : r.focus() : r.nextElementSibling && (n = r.nextElementSibling.querySelector("a")) ? n.focus() : r.parentNode.firstElementChild.querySelector("a").focus();
break;
case 27:
do {
var l = T(r);
r = l;
} while (!r.classList.contains(i + "msthd-menu-top-item"));
r.querySelector("a").focus();
break;
case 13:
case 32:
s && (r.hasAttribute("active") ? (T(r), D(s)) : (q([r, s, a]), C(), o || D(r)), s.querySelector("a").focus());
}
},
L = function L(e) {
var a,
i = "BUTTON" === e.target.tagName || "A" === e.target.tagName ? e.target : e.target.parentNode,
r = i.dataset.target,
s = t.getElementById(r);
if (n) {
a = n;
var o = t.getElementById(n),
l = w(o, "BUTTON");
M(l, o);
}
a != r && N(r, i, s);
},
x = function x(e) {
if (n) {
var a = t.getElementById(n),
i = w(a, "button");
a.contains(e.target) || i.contains(e.target) || M(i, a);
}
},
E = function E(e) {
var a = e.relatedTarget ? e.relatedTarget : e.target;
if (n) {
var i = t.getElementById(n),
r = w(i, "button");
if (a === r) return;
i.contains(a) ? window.addEventListener("click", x, !1) : M(r, i);
}
},
S = function S(e) {
if (n) {
switch (e.keyCode) {
case 37:
case 38:
case 39:
case 40:
e.preventDefault();
}
var a = t.getElementById(n),
i = w(a, "button");
27 == e.keyCode ? (M(i, a), i.focus()) : e.shiftKey && 9 == e.keyCode && e.target === a.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex='0']")[0] && M(i, a);
}
},
C = function C() {
s ? s.classList.contains(i + "show") || s.classList.add(i + "show") : console.error("Please put the overlay in place!");
},
A = function A() {
s ? s.classList.contains(i + "show") && s.classList.remove(i + "show") : console.error("Please put the overlay in place!");
},
T = function T(e) {
var t = "LI" === e.tagName ? e.parentNode : e,
n = t.parentNode,
a = n.querySelector("a");
return t.hasAttribute("style") && t.removeAttribute("style"), n.removeAttribute("active"), t.removeAttribute("active"), a.removeAttribute("active"), a.setAttribute("aria-expanded", "false"), n;
},
q = function q(e) {
_(e, function (e) {
e.setAttribute("active", ""), "A" === e.tagName && e.setAttribute("aria-expanded", "true");
});
},
D = function D(e) {
var t,
n,
a,
r,
s,
o = [];
if (!e.classList.contains(i + "msthd-menu-item-img")) if ("LI" === e.tagName ? (t = e.parentNode, n = e.querySelector("ul") ? e.querySelector("ul") : void 0) : t = e, r = (a = t.parentNode.parentNode.classList.contains(i + "msthd-menu-top") ? void 0 : t.parentNode.parentNode) ? a.parentNode.parentNode.classList.contains(i + "msthd-menu-top") ? void 0 : a.parentNode.parentNode : void 0, a || t.hasAttribute("style") && t.removeAttribute("style"), n && n.classList.contains(i + "msthd-menu-tier-img")) {
var l = t.getBoundingClientRect().bottom,
d = t.offsetHeight,
c = n.getBoundingClientRect().bottom,
u = n.offsetHeight;
d < u && (t.hasAttribute("style") && t.removeAttribute("style"), t.setAttribute("style", "height: " + u + "px")), l < c && (n.hasAttribute("style") && n.removeAttribute("style"), n.setAttribute("style", "bottom: -4px"));
} else t.hasAttribute("style") && t.removeAttribute("style"), n && n.hasAttribute("style") && n.removeAttribute("style"), a && a.hasAttribute("style") && a.removeAttribute("style"), r && r.hasAttribute("style") && r.removeAttribute("style"), t && o.push(t.offsetHeight), n && o.push(n.offsetHeight), a && o.push(a.offsetHeight), r && o.push(r.offsetHeight), (s = Math.max.apply(this, o)) > 0 && (t.setAttribute("style", "height: " + s + "px"), n && n.setAttribute("style", "height: " + s + "px"), a && a.setAttribute("style", "height: " + s + "px"), r && r.setAttribute("style", "height: " + s + "px"));
},
N = function N(t, a, r) {
n = t, a.classList.add(i + "active"), a.setAttribute("aria-expanded", "true"), r.classList.add(i + "active"), r.classList.contains(i + "msthd-offcanvas-menu") ? (I(r, !0), k("Masthead", "OffCanvasOpen", e)) : (r.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex='0']")[0].focus(), r.addEventListener("focusout", E, !0), r.addEventListener("keydown", S, !1));
},
M = function M(t, a) {
n = null, window.removeEventListener("click", x, !1), t.classList.remove(i + "active"), t.setAttribute("aria-expanded", "false"), a.classList.contains(i + "msthd-offcanvas-menu") ? (I(a, !1), k("Masthead", "OffCanvasClose", e)) : (a.removeEventListener("focusout", E, !0), a.removeEventListener("keydown", S, !1)), a.classList.remove(i + "active");
},
I = function I(e, n) {
n ? (e && (e.hidden = !1), t.body.classList.add(i + "active"), r && !r.classList.contains(i + "show") && (r.classList.add(i + "show"), r.hidden = !1), window.addEventListener("click", x, !1), window.addEventListener("touchstart", x, !1)) : (e && (e.hidden = !0), t.body.classList.remove(i + "active"), r && r.classList.contains(i + "show") && (r.classList.remove(i + "show"), r.hidden = !0), window.removeEventListener("touchstart", x, !1));
};
this.logIn = function (t) {
var n = e.querySelector("." + i + "msthd-icon-ctnr[data-target='msthd-signin-ctnr']"),
a = n.querySelector("." + i + "badge"),
r = n.querySelector("." + i + "msthd-label");
a.hidden && (a.hidden = !1), r && (r.innerHTML = t), n.setAttribute("data-target", "msthd-signout-ctnr");
}, this.logOut = function () {
var t = e.querySelector("." + i + "msthd-icon-ctnr[data-target='msthd-signout-ctnr']"),
n = t.querySelector("." + i + "badge"),
a = t.querySelector("." + i + "msthd-label");
n.hidden || (n.hidden = !0), a && (a.innerHTML = u), t.setAttribute("data-target", "msthd-signin-ctnr");
}, this.cartCount = function (t) {
var n = e.querySelector("." + i + "msthd-icon-ctnr[data-target='msthd-cart-ctnr']").querySelector("." + i + "badge");
t && t > 0 ? (n.hidden && (n.hidden = !1), n.innerHTML = t) : (n.hidden = !0, n.innerHTML = 0);
}, "Masthead" in e || (document.addEventListener("uicLeftNavCloseEvent", function (e) {
M(e.detail.button, e.detail.container);
}), _(e.querySelectorAll("button." + i + "msthd-icon-ctnr", "a." + i + "msthd-icon-ctnr"), function (e) {
e.dataset.toggle && e.dataset.toggle === i + "msthd-offcanvas" && (a = e), "msthd-country-ctnr" === e.dataset.target ? new K(e) : e.addEventListener("click", L, !1);
}), a && (r = m(), t.body.classList.contains(i + "body-off-canvas") || t.body.classList.add(i + "body-off-canvas"), d && f && e.querySelector("." + i + "msthd-offcanvas-menu").classList.add(i + "safari-fix"), _(e.querySelectorAll("[data-toggle='dds__collapse']"), function (e) {
new J(e);
}), p.addListener(function () {
if (!p.matches && n) {
var e = t.getElementById(n),
a = w(e, "BUTTON");
M(a, e);
}
})), o && (s = t.getElementById(i + "msthd-overlay"), _(o.querySelectorAll("." + i + "msthd-menu-ctnr"), function (e) {
e.classList.contains(i + "msthd-menu-tier-img") || (e.addEventListener(l[0], v, !1), e.addEventListener(l[1], v, !1)), e.addEventListener("blur", g, !0);
}), _(o.querySelectorAll("." + i + "msthd-menu-top-item > a"), function (e) {
e.addEventListener("keydown", y, !1);
}), _(o.querySelectorAll("." + i + "msthd-menu-item , ." + i + "msthd-menu-item-img"), function (e) {
e.querySelector("a").addEventListener("keydown", y, !1), e.addEventListener(l[0], h, !1), e.addEventListener(l[1], h, !1);
}), (o = e.querySelector("." + i + "msthd-menu-top")).addEventListener(l[0], b, !1), c && o.addEventListener("touchstart", b, !1), o.addEventListener(l[1], function (e) {
e.preventDefault(), A(), e.stopPropagation();
}, !1), c && window.addEventListener("touchstart", function (e) {
document.querySelector("." + i + "msthd-menu-top").contains(e.target) || A();
}, !1))), e.Masthead = this;
}, e.Modal = X, e.NavAnchored = function (e) {
e = _instanceof(e, HTMLElement) && e;
var n,
a,
r,
s,
o,
l,
d,
p,
h,
v = null,
m = !1,
g = !1,
b = window.matchMedia("(max-width: 767.98px)"),
L = function L(t) {
if (v = t.target, g = !1, b.matches && r && !r.classList.contains(i + "show")) {
k(v);
for (var a = 0; a < n.length; a++) {
var s = n[a];
a == v.idx ? U(s) : Y(s);
}
t.preventDefault();
} else window.addEventListener("scroll", w, !1), m || (u ? e.scrollIntoView(!0) : e.scrollIntoView({
behavior: "smooth"
})), u ? d[v.idx].scrollIntoView(!0) : d[v.idx].scrollIntoView({
behavior: "smooth"
});
},
w = function w() {
var e = window.pageYOffset;
x(e), g || window.requestAnimationFrame(V);
},
x = function x(t) {
var n,
a = p.getBoundingClientRect().bottom;
t > l && 0 <= a ? m || (u && ((n = P("div", {
class: i + "nav-spacer"
})).style.height = e.offsetHeight + "px", H(e), e.parentElement.insertBefore(n, e)), e.style.zIndex = 1030, e.classList.add(i + "active"), m = !0) : m && (u && ((n = e.parentElement.querySelector("." + i + "nav-spacer")) && e.parentElement.removeChild(n), O()), e.style.zIndex = "", e.classList.remove(i + "active"), m = !1);
},
E = function E(e) {
r.classList.contains(i + "show") && (A(), e.preventDefault(), C(v));
},
S = function S(e) {
switch (e.keyCode) {
case 9:
if (1 === o.length) {
e.preventDefault();
break;
}
e.shiftKey ? M(e) : I(e);
break;
case 27:
A(), C(v);
}
},
k = function k(e) {
T(e), r.style.display = "block", r.setAttribute("aria-hidden", !1), q(), r.classList.add(i + "show"), f && c && r.classList.add(i + "is-safari"), t.body.classList.add(i + "modal-open"), (s = r && r.querySelector("[data-dismiss='" + i + "modal']")).addEventListener("click", E, !1), N(), setTimeout(function () {
C(s);
}, 50), r.addEventListener("keydown", S);
},
A = function A() {
r.classList.add(i + "slide-right"), r.classList.remove(i + "show"), r.setAttribute("aria-hidden", !0), f && c && r.classList.contains(i + "is-safari") && r.classList.remove(i + "is-safari"), setTimeout(function () {
D(), t.body.classList.remove(i + "modal-open"), s && s.removeEventListener("click", E, !1);
}, 200);
},
T = function T(e) {
var t = e.getAttribute("aria-controls"),
n = document.getElementById(t).innerHTML;
r.querySelector("." + i + "modal-body").innerHTML = n;
},
q = function q() {
C(r);
},
D = function D() {
r.style.display = "";
},
N = function N() {
o = y(r), r.firstFocusableEl = o[0], r.lastFocusableEl = o[o.length - 1];
},
M = function M(e) {
document.activeElement === r.firstFocusableEl && (e.preventDefault(), C(r.lastFocusableEl));
},
I = function I(e) {
document.activeElement === r.lastFocusableEl && (e.preventDefault(), C(r.firstFocusableEl));
},
H = function H(t) {
e.style.width = t.offsetWidth + "px";
},
O = function O() {
e.style.width = "";
},
B = R(function () {
m ? H(e.parentElement) : O();
}, 10),
F = function F(e) {
e = e || 0;
for (var t = 0; t < d.length; t++) {
if (d[t].getBoundingClientRect().top + e > 0) return t;
}
return d.length >= 1 ? d.length : 1;
},
z = function z(e) {
var t = e.target;
if (g = !0, 9 == e.keyCode && !b.matches) {
var n = F(-5) - 1;
n = n < 0 ? 0 : n, u ? d[t.idx].scrollIntoView(!0) : d[t.idx].scrollIntoView({
behavior: "smooth"
}), j(a[n], a[t.idx]);
}
g = !1;
},
W = function W(e) {
var t = e.keyCode,
i = e.target.idx;
switch (t) {
case 9:
var r;
e.shiftKey || (b.matches ? (e.preventDefault(), C(h)) : (g = !0, _(d, function (e, t) {
t >= i && e.focusableEls.length > 0 && !r && (r = e.focusableEls);
}), r ? (e.preventDefault(), C(r[0])) : h && (e.preventDefault(), C(h))));
break;
case 13:
case 32:
e.preventDefault(), g = !1, C(e.target), e.target.click();
break;
case 35:
e.preventDefault(), C(n[a.length - 1]), n[a.length - 1].click();
break;
case 36:
e.preventDefault(), C(n[0]), n[0].click();
break;
case 39:
e.preventDefault(), i === n.length - 1 ? C(n[0]) : C(n[i + 1]);
break;
case 37:
e.preventDefault(), C(0 === i ? n[n.length - 1] : n[i - 1]);
}
},
V = function V() {
var e = F(-5) - 1;
e = e < 0 ? 0 : e;
for (var t = 0; t < n.length; t++) {
var a = n[t];
m ? t == e ? U(a) : Y(a) : 0 == t ? U(a) : Y(a);
}
return a;
},
j = function j(e, t) {
Y(e), U(t);
},
U = function U(e) {
e.setAttribute("tabindex", "0"), e.classList.add(i + "active"), e.setAttribute("aria-selected", "true");
},
Y = function Y(e) {
e.setAttribute("tabindex", "-1"), e.classList.remove(i + "active"), e.setAttribute("aria-selected", "false");
},
J = function J() {
e.setAttribute("style", "display: none !important;"), _(d, function (e) {
e.setAttribute("style", "display: block;");
});
};
if (!("Nav" in e)) {
r = e.dataset.target && t.getElementById(e.dataset.target.substr(1)), p = e.nextElementSibling, a = e.querySelectorAll("li button"), l = e.getBoundingClientRect().top, n = [], d = [], u && window.addEventListener("resize", B, !1);
for (var K = 0; K < a.length; K++) {
a[K].idx = K, n.push(a[K]), n[K].addEventListener("click", L, !1), n[K].addEventListener("keydown", W, !1);
var X = document.getElementById(a[K].dataset.target.slice(1));
X.scrollTop += e.offsetHeight, X.focusableEls = y(X), _(X.focusableEls, function (e) {
e.addEventListener("keyup", z, !1), e.idx = K;
}), d.push(X);
}
0 == d[d.length - 1].focusableEls.length && t.addEventListener("DOMContentLoaded", function () {
h = function e(n) {
for (; n && n !== t; n = n.nextElementSibling) {
if (!n.nextElementSibling) return e(n.parentElement);
if ("none" != window.getComputedStyle(n.nextElementSibling).getPropertyValue("display")) {
if (-1 != ["A", "AREA", "INPUT", "SELECT", "TEXTAREA", "BUTTON"].indexOf(n.nextElementSibling.tagName) && n.nextElementSibling.tabIndex >= 0) return n.nextElementSibling;
var a = y(n.nextElementSibling);
if (a && a.length > 0) return a[0];
}
}
}(X);
}), b.matches ? (window.removeEventListener("scroll", w, !1), r || J()) : window.addEventListener("scroll", w, !1), b.addListener(function () {
if (b.matches) {
e.classList.remove(i + "active");
var t = e.parentElement.querySelector("." + i + "nav-spacer");
t && e.parentElement.removeChild(t), window.removeEventListener("scroll", w, !1), r || J();
} else e.removeAttribute("style"), window.addEventListener("scroll", w, !1), r && A();
});
}
e.Nav = this;
}, e.NavLeft = function (e, n) {
if (e = _instanceof(e, HTMLElement) && e, (n = z(e, n = n || {})).menu = e.dataset.menu ? e.dataset.menu : n.menu ? n.menu : "navLeft-list", n.main = e.dataset.main ? e.dataset.main : n.main ? n.main : null, n.suffix = e.dataset.suffix ? e.dataset.suffix : n.suffix ? n.suffix : null, n.arrows = e.dataset.arrows ? e.dataset.arrows : n.arrows ? n.arrows : "right", n.selected = e.dataset.selected ? e.dataset.selected : n.selected ? n.selected : null, n.altmenu = e.dataset.altmenu ? e.dataset.altmenu : n.altmenu ? n.altmenu : null, n.replace = e.dataset.replace ? "true" == e.dataset.replace : !!n.replace && "true" == n.replace, !n.main) throw new Error("Left Nav 'main' option must be set.");
var a,
r,
s,
o,
l,
d,
c,
f,
p,
h,
v,
m,
g = [],
b = "navLeft-list" === n.menu,
L = function L() {
if (d) {
v = (v = document.documentElement.clientHeight - d.getBoundingClientRect().top) < 0 ? 0 : v;
var t = document.documentElement.clientHeight - v;
v > 0 && (c.style.height = e.style.height = t + "px", f.style.top = t / 2 - f.getBoundingClientRect().height / 2 + "px"), l && (v > 0 && (l.style.bottom = v + "px"), r.style.maxHeight = document.documentElement.clientHeight - l.getBoundingClientRect().height - p + "px");
}
},
E = function E() {
var t;
a && (h = a.getBoundingClientRect().height, window.pageYOffset > h ? (e.style.top = "0px", I() ? (c.style.height = e.style.height = document.documentElement.clientHeight - v + "px", f.style.top = document.documentElement.clientHeight / 2 - f.getBoundingClientRect().height / 2 - v / 2 + "px") : (c.style.height = e.style.height = document.documentElement.clientHeight + "px", f.style.top = document.documentElement.clientHeight / 2 - f.getBoundingClientRect().height / 2 + "px")) : (e.style.top = h - window.pageYOffset + "px", I() ? (t = parseInt(window.getComputedStyle(e).height, 10) - (h - window.pageYOffset), c.style.height = e.style.height = t + "px") : (t = document.documentElement.clientHeight - h + window.pageYOffset, c.style.height = e.style.height = t + "px"), f.style.top = t / 2 - f.getBoundingClientRect().height / 2 + "px"));
},
S = function S(e) {
e && ("right" === n.arrows ? _(e, function (e) {
H(e, i + "navLeft-button-optionRight");
}) : "center" === n.arrows && _(e, function (e) {
H(e, i + "navLeft-button-optionCenter"), e.children[1].after(e.children[0]);
}));
},
A = function A() {
L(), E();
},
T = function T() {
var t = a.querySelector("." + i + "msthd-offcanvas-menu"),
n = a.querySelector("[data-toggle='" + i + "msthd-offcanvas']");
k("LeftNav", "CloseEvent", e, {
button: n,
container: t
});
},
q = function q(e) {
switch (e.keyCode) {
case 9:
if (1 === m.length) {
e.preventDefault();
break;
}
e.shiftKey ? D(e) : N(e);
break;
case 27:
T();
}
},
D = function D(e) {
t.activeElement === m[0] && (e.preventDefault(), m[m.length - 1].focus());
},
N = function N(e) {
t.activeElement === m[m.length - 1] && (e.preventDefault(), m[0].focus());
},
M = function M(e) {
switch (e.keyCode) {
case 27:
T();
}
},
I = function I() {
return !!d && t.body.offsetHeight >= d.getBoundingClientRect().top;
};
if (!("NavLeft" in e)) {
var R = 0;
if (r = e.querySelector("." + i + "navLeft"), s = t.getElementById(n.main), c = e.querySelector("." + i + "navLeft-border"), f = e.querySelector("." + i + "navLeft-btn-toggle"), window.addEventListener("scroll", A), window.addEventListener("resize", A), (n.menu.length > 0 || n.altmenu.length > 0) && (t.addEventListener("uicMastheadOffCanvasOpen", function () {
_(m, function (e) {
e.addEventListener("keydown", q, !1);
}), _(o.leftMenu.querySelectorAll("li a"), function (e) {
e.addEventListener("keydown", M), e.addEventListener("click", T);
}), _(o.leftMenu.querySelectorAll("li button"), function (e) {
e.addEventListener("keydown", M);
}), t.body.classList.contains("user-is-tabbing") && setTimeout(function () {
C(m[0]);
}, 200);
}, !1), t.addEventListener("uicMastheadOffCanvasClose", function () {
var e, n, r;
_(m, function (e) {
e.removeEventListener("keydown", q, !1);
}), _(o.leftMenu.querySelectorAll("li a"), function (e) {
e.removeEventListener("keydown", M), e.removeEventListener("click", T);
}), _(o.leftMenu.querySelectorAll("li button"), function (e) {
e.removeEventListener("keydown", M);
}), t.body.classList.contains("user-is-tabbing") && setTimeout(function () {
C(a.querySelector("[data-toggle='" + i + "msthd-offcanvas']"));
}, 200), e = a.querySelector("[data-toggle='" + i + "msthd-offcanvas']").getAttribute("aria-label") + " " + a.querySelector("[data-toggle='" + i + "msthd-offcanvas']").getAttribute("aria-expanded"), r = Math.floor(999999999 * Math.random()) + 1, document.body.appendChild(P("div", {
style: "position:absolute; left:-1000px; width: 0px; height: 0px;",
id: "ariaAnnouncement" + r,
"aria-live": "assertive"
})), n = document.getElementById("ariaAnnouncement" + r), window.setTimeout(function () {
n.textContent = e;
}, 15), window.setTimeout(function () {
n.parentElement.removeChild(n);
}, 5e3);
}, !1)), f.addEventListener("click", function () {
e.classList.contains(i + "active") ? (O(e, i + "active"), O(s, i + "active"), O(f.querySelector("svg"), i + "rotate-180"), f.setAttribute("aria-expanded", "true")) : (H(e, i + "active"), H(s, i + "active"), H(f.querySelector("svg"), i + "rotate-180"), f.setAttribute("aria-expanded", "false")), setTimeout(function () {
L(), E();
}, 200);
}), !b) {
if (!t.getElementById(n.menu)) throw new Error("Element not found by ID ('" + n.menu + "') for left nav menu choices.");
t.getElementById(n.menu).hidden = !0;
}
if (n.altmenu) {
if (!t.getElementById(n.altmenu)) throw new Error("Element not found by ID ('" + n.altmenu + "') for left nav (offcanvas) menu choices.");
t.getElementById(n.altmenu).hidden = !0;
}
if (H(s, i + "body-ml-20"), n.suffix && (l = t.getElementById(n.suffix), e.querySelector("nav").appendChild(l), H(l, i + "navLeft-suffix")), b || (_(t.getElementById("navLeft-list").querySelectorAll("li"), function (e) {
e.parentElement.removeChild(e);
}), _(t.querySelectorAll("#" + n.menu + ">ul>li").length ? t.querySelectorAll("#" + n.menu + ">ul>li") : t.querySelectorAll("#" + n.menu + ">li"), function (t) {
e.querySelector("." + i + "navLeft-list").appendChild(t);
}), t.getElementById(n.menu).parentElement.removeChild(t.getElementById(n.menu))), n.replace) {
var B = t.querySelector("." + i + "msthd-navbar-bottom");
B && B.parentElement.removeChild(B);
}
S(e.querySelectorAll("." + i + "accordion button")), n.altmenu && S(document.getElementById(n.altmenu).querySelectorAll("." + i + "accordion button"));
var F = function F() {
d = t.querySelector("footer"), a = t.querySelector("header"), p = d.getBoundingClientRect().height, function () {
if (!b || n.altmenu) {
if (!(o = {
mastheadMend: a.querySelectorAll("." + i + "msthd-offcanvas-menu")[0],
parent: void 0,
storedId: void 0,
leftMenu: e.querySelectorAll("." + i + "msthd-offcanvas-menu")[0]
}).mastheadMend) throw new Error("Left Nav cannot initialize without a masthead component in the header element.");
o.parent = o.mastheadMend.parentElement, o.storedId = o.mastheadMend.id, o.parent.removeChild(o.mastheadMend), o.leftMenu.id = o.storedId, o.parent && o.parent.appendChild(o.leftMenu);
}
}(), b && !n.altmenu || (n.altmenu ? (_(t.getElementById(n.altmenu).children, function (e) {
o.leftMenu.querySelector("ul").appendChild(e.cloneNode(!0));
}), t.getElementById(n.altmenu).parentElement.removeChild(t.getElementById(n.altmenu))) : _(e.querySelectorAll("." + i + "navLeft-list>li"), function (e) {
o.leftMenu.querySelector("ul").appendChild(e.cloneNode(!0));
}), _(o.leftMenu.querySelectorAll("." + i + "accordion"), function (e) {
e.id = e.id + "-offCanvas", e.querySelector("." + i + "accordion-btn").setAttribute("data-parent", e.querySelector("." + i + "accordion-btn").getAttribute("data-parent").substr(1) + "-offCanvas");
}), _(o.leftMenu.querySelectorAll("." + i + "accordion-card-header"), function (e) {
e.id = e.id + "-offCanvas", e.nextElementSibling.setAttribute("aria-labelledby", e.nextElementSibling.getAttribute("aria-labelledby") + "-offCanvas");
}), _(o.leftMenu.querySelectorAll("." + i + "collapse"), function (e) {
e.id = e.id + "-offCanvas", e.previousElementSibling.querySelector("." + i + "accordion-btn") && (e.previousElementSibling.querySelector("." + i + "accordion-btn").setAttribute("data-target", e.previousElementSibling.querySelector("." + i + "accordion-btn").getAttribute("data-target") + "-offCanvas"), e.previousElementSibling.querySelector("." + i + "accordion-btn").setAttribute("aria-controls", e.previousElementSibling.querySelector("." + i + "accordion-btn").getAttribute("aria-controls") + "-offCanvas"));
}), _(o.leftMenu.querySelectorAll("a"), function (e) {
e.id && (e.id = e.id + "-offCanvas");
}), m = y(t.querySelector("." + i + "msthd-top ." + i + "navLeft")), _(o.leftMenu.querySelectorAll("[data-toggle='" + i + "collapse']"), function (e) {
new J(e);
})), L(), E(), e.style.top = h, u || Promise.all(Array.from(t.images).filter(function (e) {
e.complete;
}).map(function (e) {
new Promise(function (t) {
e.onload = e.onerror = t;
});
})).then(function () {
L(), E();
}), n.selected && _(t.querySelectorAll("a[href*='" + n.selected + "']"), function (e) {
var t = e.parentElement.previousElementSibling;
t && "li" === t.tagName.toLowerCase() && H(t, i + "navLeft-link-selectedPrev"), H(e.parentElement, i + "navLeft-link-selected");
var n = w(e, "." + i + "accordion");
do {
g.push(n), n = w(n.parentElement, "." + i + "accordion");
} while (n);
g = g.reverse();
}), n.selected && (_(g, function (e) {
var t = e.querySelector("." + i + "accordion-btn"),
n = e.querySelector("." + i + "accordion-btn i"),
a = e.querySelector("." + i + "collapse");
t.setAttribute("aria-expanded", !0), H(n, i + "navLeft-icon-rotate"), x(t, "click", function (e) {
_(w(e.target, "." + i + "accordion").querySelectorAll("." + i + "accordion-btn i"), function (e) {
O(e, i + "navLeft-icon-rotate");
});
}), a.setAttribute("aria-expanded", !0), H(a, i + "show");
}), setTimeout(function () {
_(e.querySelectorAll("." + i + "navLeft-list"), function (e) {
var t = e.querySelector("." + i + "navLeft-link-selected");
t && t.scrollIntoView();
});
}, 500)), Z(), addResizeListener(s, A);
},
W = function W() {
if (!(R < 5e3)) throw new Error("Unable to initialize Left Nav component due to page load timeout.");
t.querySelector("footer") && t.querySelector("header") ? setTimeout(F, 50) : setTimeout(W, 50), R += 50;
};
W();
}
e.NavLeft = this;
}, e.NavSkip = $, e.Pagination = Q, e.Popover = function (e, n) {
e = _instanceof(e, HTMLElement) && e, (n = z(e, n = n || {})).delay = e.dataset.delay ? parseInt(e.dataset.delay) : n.delay ? parseInt(n.delay) : 10, n.title = e.dataset.title ? e.dataset.title : n.data_title ? n.data_title : null, n.content = e.dataset.content ? e.dataset.content : n.data_content ? n.data_content : null, n.placement = e.dataset.placement ? e.dataset.placement : n.data_placement ? n.data_placement : null, n.container = e.dataset.container ? e.dataset.container : n.container ? n.container : t.body, function () {
if (null == n.title || "" === n.title) throw new Error("There was a problem found with title value, please correct and try again");
if (null == n.content || "" === n.content) throw new Error("There was a problem found with content value, please correct and try again");
if (null == n.placement) throw new Error("There was a problem found with placement value, please correct and try again");
var t = w(e, "." + i + "modal-offcanvas");
if (t) n.container = t; else {
var a = w(e, ".fixed-top");
if (a) n.container = a; else {
var r = w(e, ".fixed-bottom");
r && (n.container = r);
}
}
}();
var r = this,
s = t.body,
o = m(),
l = null,
d = null,
c = !0,
u = window.matchMedia("(max-width: 767.98px)"),
f = null,
p = null,
h = function h(e) {
setTimeout(function () {
r.toggle(), e.preventDefault();
}, n.delay);
},
v = function v(a) {
setTimeout(function () {
f && !f.contains(t.activeElement) ? (r.hide(), e.focus(), t.activeElement.removeEventListener("focusout", v, !1), a.preventDefault()) : t.activeElement.addEventListener("focusout", v, !1);
}, n.delay);
},
g = function g(t) {
f && f.contains(t.target) && (t.target === d || d.contains(t.target)) && (r.hide(), e.focus(), t.preventDefault());
},
b = function b(t) {
27 === t.keyCode && "keydown" === t.type ? (e.focus(), r.hide(), t.preventDefault()) : 13 === t.keyCode && "keydown" === t.type ? t.currentTarget.classList.contains(i + "close") && (r.hide(), e.focus(), t.preventDefault()) : 9 === t.keyCode & "keydown" === t.type && t.shiftKey && t.srcElement.classList.contains(i + "popover") && (r.hide(), e.focus(), t.preventDefault());
},
y = function y() {
c ? A(e, f, n.placement, s) : f.style.cssText = "";
},
L = function L() {
f.addEventListener("blur", v, !1), k("Popver", "Shown", e);
},
x = function x() {
f.removeEventListener("blur", v, !1), u.matches && p ? e.parentNode.removeChild(p) : s.removeChild(f), f = null, t.body.classList.remove(i + "modal-open"), k("Popover", "Hidden", e);
},
E = function E(e) {
c = !e.matches;
};
this.toggle = function () {
null === f ? r.show() : r.hide();
}, this.show = function () {
setTimeout(function () {
var c, v, m, w, x;
null === f && (m = null, w = null, x = null, f = P("div", {
class: i + "modal-dialog",
tabindex: "0",
role: "dialog"
}), m = P("div", {
class: i + "popover-dialog"
}), f.appendChild(m), l = P("div", {
class: i + "arrow"
}), f.appendChild(l), w = P("div", {
class: i + "popover-title-container " + i + "d-flex"
}), m.appendChild(w), c = P("h3", {
class: i + "popover-header " + i + "bold-16",
html: n.title
}), w.appendChild(c), x = P("div", {
class: i + "popover-body"
}), v = P("p", {
html: n.content
}), m.appendChild(x), x.appendChild(v), d = P("button", {
class: i + "close " + i + "icons " + i + "close-x " + i + "position-absolute",
tabindex: "0",
aria_label: "Close Popover",
data_dismiss: i + "popover"
}), w.appendChild(d), u.matches ? ((p = P("div", {
class: i + "modal"
})).style.display = "block", t.body.classList.add(i + "modal-open"), p.appendChild(f), e.parentNode.insertBefore(p, e)) : s.insertBefore(f, s.firstChild), f.style.display = "block", f.setAttribute("class", i + "popover " + i + "bs-popover-" + n.placement + " " + i + "fade " + i + "show " + i + "rounded-0"), o ? (o.classList.add(i + "show"), o.removeAttribute("hidden"), o.style.visibility = "hidden") : console.warn("POPOVER: Overlay requested. Corresponding HTML missing. Please apply 'dds__overlay' to a div"), y(), !f.classList.contains(i + "show") && f.classList.add(i + "show"), f.focus(), e.removeEventListener("click", h, !1), window.addEventListener("click", g, !1), f.addEventListener("keydown", b, !1), a.addEventListener("resize", r.toggle, !1), k("Popover", "ShowEvent", e), S(f, L));
}, n.delay);
}, this.hide = function () {
o && o.classList.remove(i + "show"), setTimeout(function () {
f && null !== f && f.classList.contains(i + "show") && (k("Popover", "HideEvent", e), window.removeEventListener("click", g, !1), f.removeEventListener("keydown", b, !1), a.removeEventListener("resize", r.toggle, !1), f.classList.remove(i + "show"), S(f, x), e.addEventListener("click", h, !1));
}, n.delay);
}, this.update = function () {
y();
}, "Popover" in e || (e.addEventListener("click", h, !1), E(u), u.addListener(E)), e.Popover = r;
}, e.ProductStack = function (e, t) {
e = _instanceof(e, HTMLElement) && e, (t = z(e, t = t || {})).lazyload = "boolean" == typeof t.lazyload && t.lazyload, t.type = t.type ? t.type : "single";
var n,
a,
r,
s,
o,
l,
d,
c,
h = function h(e) {
var n = s;
if ("page" == t.type) {
var l = Math.ceil((r.scrollLeft - 5) / s) + 1,
d = Math.floor((r.scrollLeft + r.offsetWidth + 5) / s);
n = d - l <= 0 ? s : s * (d - l + 1);
}
e.target.classList.contains(i + "overflow-control-right") || e.target.parentElement.classList.contains(i + "overflow-control-right") ? a + n < s * o.length - r.offsetWidth - 1 ? a += n : a = s * o.length - r.offsetWidth : a - n > 1 ? a -= n : a = 0, u || f || p ? r.scrollLeft = a : r.scroll({
top: 0,
left: a,
behavior: "smooth"
}), m();
},
v = function v() {
e.getElementsByTagName("style")[0].innerHTML = "", s = o[0].parentElement.offsetWidth, _(o[0].sections, function (t) {
var n = "." + t.className.replace(/\s/g, "."),
a = e.querySelectorAll(n);
if (a.length > 1) {
var i = 0;
_(a, function (e) {
a.style && a.removeAttribute("style"), e.offsetHeight > i ? i = e.offsetHeight : 0 == e.offsetHeight && (e.nextElementSibling.style.visibility = "hidden");
});
var r = e.getElementsByTagName("style")[0].innerHTML;
e.getElementsByTagName("style")[0].innerHTML = r + "#" + c + " " + n + "{ height: " + i + "px }";
}
});
},
m = function m() {
if (n) {
var t = Math.ceil((r.scrollLeft - 5) / s) + 1,
a = Math.floor((r.scrollLeft + r.offsetWidth + 5) / s);
_(n, function (e) {
e.innerHTML = "" + t + (t < a ? " - " + Math.min(a, o.length) : "") + " of " + o.length + "";
}), k("ProductStack", "ChangeEvent", e, {
left: t,
right: a,
totalItems: o.length
}), _(d, t <= 1 ? function (e) {
e.setAttribute("disabled", "");
} : function (e) {
e.removeAttribute("disabled");
}), a >= o.length ? _(l, function (e) {
e.setAttribute("disabled", "");
}) : _(l, function (e) {
e.removeAttribute("disabled");
}), l[0].disabled && d[0].disabled ? (_(l, function (e) {
e.style.display = "none";
}), _(d, function (e) {
e.style.display = "none";
}), _(n, function (e) {
e.style.display = "none";
})) : (_(l, function (e) {
e.style.display = "block";
}), _(d, function (e) {
e.style.display = "block";
}), _(n, function (e) {
e.style.display = "block";
}));
}
};
if (this.lazyLoad = function () {
t.lazyload ? (v(), m(), k("ProductStack", "LazyLoadEvent", e, {
success: !0
})) : k("ProductStack", "LazyLoadEvent", e, {
success: !1,
msg: "Carousel cannot be lazy loaded. Check usage or avoid mulitple lazy loads."
});
}, !("ProductStack" in e)) {
c = e.id ? e.id : "product-stack";
var g = P("style");
g.type = "text/css", e.insertBefore(g, e.firstElementChild), _(o = e.querySelectorAll("UL." + i + "product-stack"), function (e) {
e.sections = [];
var t = 0;
_(e.children, function (n) {
"LI" == n.tagName && (n.classList.add(i + "ps-row-" + t++), e.sections.push(n));
});
}), n = e.parentElement.querySelectorAll("DIV." + i + "items-view"), (r = e.querySelector("." + i + "product-stack-wrapper")).addEventListener("scroll", R(function () {
r.scrollLeft != a && (m(), a = r.scrollLeft);
}), 15), window.addEventListener("load", v, !1), window.addEventListener("resize", R(function () {
v(), m();
}, 15)), s = e.querySelector("." + i + "product-stack").parentElement.offsetWidth, _(l = e.querySelectorAll("[data-toggle='" + i + "product-stack-control-right']"), function (e) {
e.addEventListener("click", h, !0);
}), _(d = e.querySelectorAll("[data-toggle='" + i + "product-stack-control-left']"), function (e) {
e.addEventListener("click", h, !0), e.setAttribute("disabled", "");
}), p && (l[0].addEventListener("keydown", function (e) {
setTimeout(function () {
13 != e.keyCode && 32 != e.keyCode || !l[0].disabled || (e.preventDefault(), d[0].focus());
}, 100);
}, !1), d[0].addEventListener("keydown", function (e) {
setTimeout(function () {
13 != e.keyCode && 32 != e.keyCode || !d[0].disabled || (e.preventDefault(), l[0].focus());
}, 100);
}, !1), d[1].addEventListener("keydown", function (e) {
setTimeout(function () {
13 != e.keyCode && 32 != e.keyCode || !d[1].disabled || (e.preventDefault(), l[1].focus());
}, 100);
}, !1), l[1].addEventListener("keydown", function (e) {
setTimeout(function () {
13 != e.keyCode && 32 != e.keyCode || !l[1].disabled || (e.preventDefault(), d[1].focus());
}, 100);
}, !1)), a = r.scrollLeft, m();
}
e.ProductStack = self;
}, e.Progress = function (e, t) {
e = _instanceof(e, HTMLElement) && e, (t = z(e, t = t || {})).showText = e.dataset.showtext ? "true" == e.dataset.showtext : "true" == t.showtext, t.timeToComplete = e.dataset.timeToComplete ? F(e.dataset.timeToComplete, 1e4) : F(t.timeToComplete, 1e4);
var n = t.timeToComplete,
a = 0;
"Progress" in e || setInterval(function () {
a < 100 ? (a += .25, e.style.width = a + "%", e.setAttribute("aria-valuenow", Math.round(a))) : (e.style.width = "100%", clearInterval(void 0)), t.showText && (e.innerHTML = a < 100 ? Math.round(a) + "%" : "100%");
}, n / 400), e.Progress = self;
}, e.SkipNav = $, e.Slider = function (e, n) {
e = _instanceof(e, HTMLElement) && e;
var a = !1,
r = e.dataset.slider;
r && (n = JSON.parse(r), a = !0);
var s = n || {};
s.animate = "boolean" != typeof s.animate || s.animate, s.animationDuration = "number" == typeof s.animationDuration ? s.animationDuration : 300, s.ort = s.orientation && "vertical" === s.orientation ? 1 : 0, s.dir = s.direction ? "rtl" === s.direction ? 1 : 0 : 1 == s.ort ? 1 : 0, s.singleStep = "number" == typeof s.step ? s.step : void 0, s.percision = "number" == typeof s.percision ? s.percision > 2 ? 2 : s.percision : 0, s.behaviour = s.behaviour ? s.behaviour : "tap", s.margin = "number" == typeof s.margin ? s.margin : 1, s.limit = "number" == typeof s.limit ? s.limit : 0, s.padding = s.padding ? s.padding : 0, s.tooltips = "boolean" != typeof s.tooltips || s.tooltips, s.content = "string" == typeof s.content && s.content, s.showRange = "boolean" == typeof s.showRange && s.showRange, s.format = "object" == _typeof(s.format) ? s.format : void 0, s.ariaFormat = "object" == _typeof(s.ariaFormat) ? s.ariaFormat : void 0;
var o,
l,
d,
c,
f,
p,
h,
v,
m,
g,
b,
y,
L,
w,
x,
E,
S = {},
C = {},
A = !u,
T = [],
q = [],
D = 0,
M = [],
I = [],
H = 1 == s.dir || 1 == s.ort ? 0 : 100,
O = void 0 !== e.style.msTransform,
R = void 0 !== e.style.transform ? "transform" : O ? "msTransform" : "webkitTransform",
B = {
to: function to(e) {
return void 0 !== e && e.toFixed(s.percision);
},
from: Number
},
F = function F() {
var t = De();
Array.isArray(t) || (t = ne(t));
for (var n = 0; n < t.length; n++) {
t[n] = "string" == typeof t[n] ? t[n] : s.format.to(t[n]);
}
var a = null;
a = 1 == f.length ? I : M;
for (var i = 0; a.length > i; i++) {
a[i].innerHTML = t[0];
}
if (f.length > 1) for (var r = 0; I.length > r; r++) {
I[r].innerHTML = t[1];
}
var o = {};
t[1] ? (o.min = t[0], o.max = t[1]) : o.value = t[0], k("Slider", "SlideEnd", e, o);
},
z = function z(e) {
e.currentTarget.classList.add(i + "slider-active");
},
W = function W(e) {
e.currentTarget.classList.remove(i + "slider-active");
},
V = function V(e) {
var t = T[e],
n = d.getNearbySteps(t),
a = q[e],
i = n.thisStep.step,
r = null;
if (s.snap) return [a - n.stepBefore.startValue || null, n.stepAfter.startValue - a || null];
!1 !== i && a + i > n.stepAfter.startValue && (i = n.stepAfter.startValue - a), r = a > n.thisStep.startValue ? n.thisStep.step : !1 !== n.stepBefore.step && a - n.stepBefore.highestStep, 100 === t ? i = null : 0 === t && (r = null);
var o = d.countStepDecimals();
return null !== i && !1 !== i && (i = Number(i.toFixed(o))), null !== r && !1 !== r && (r = Number(r.toFixed(o))), [r, i];
},
j = function j(e, t) {
C[e] = C[e] || [], C[e].push(t), "update" === e.split(".")[0] && f.forEach(function (e, t) {
ue("update", t);
});
},
U = function U(e, t) {
var n = P("div", {
class: t || ""
});
return e.appendChild(n), n;
},
Y = function Y(e, t) {
"mouseout" === e.type && "HTML" === e.target.nodeName && null === e.relatedTarget && K(e, t);
},
J = function J(e, t) {
var n = (s.dir ? -1 : 1) * (e.calcPoint - t.startCalcPoint),
a = 100 * n / t.baseSize;
se(n > 0, a, t.locations, t.handleNumbers);
},
K = function K(n, a) {
a.handle && (a.handle.classList.remove(i + "slider-active"), D -= 1), a.listeners.forEach(function (e) {
t.removeEventListener(e[0], e[1]);
}), 0 === D && (o.classList.remove(i + "slider-drag"), ce(), n.cursor && (e.style.cursor = "")), a.handleNumbers.forEach(function (e) {
ue("change", e), ue("set", e), ue("end", e);
});
},
X = function X(n, a) {
if (a.handleNumbers.some(Q)) return !1;
var r;
1 === a.handleNumbers.length && (r = f[a.handleNumbers[0]].children[0], D += 1, r.classList.add(i + "slider-active")), n.stopPropagation();
var s = [],
l = ke(v.move, t, J, {
target: n.target,
handle: r,
listeners: s,
startCalcPoint: n.calcPoint,
baseSize: Se(),
pageOffset: n.pageOffset,
handleNumbers: a.handleNumbers,
buttonsProperty: n.buttons,
locations: T.slice()
}),
d = ke(v.end, t, K, {
target: n.target,
handle: r,
listeners: s,
doNotReject: !0,
handleNumbers: a.handleNumbers
}),
c = ke("mouseout", t, Y, {
target: n.target,
handle: r,
listeners: s,
doNotReject: !0,
handleNumbers: a.handleNumbers
});
s.push.apply(s, l.concat(d, c)), n.cursor && (e.style.cursor = getComputedStyle(n.target).cursor, f.length > 1 && o.classList.add(i + "slider-drag")), a.handleNumbers.forEach(function (e) {
ue("start", e);
});
},
G = function G(e) {
e.stopPropagation();
var t = Ae(e.calcPoint),
n = Te(t);
if (!1 === n) return !1;
C.snap || ae(o, i + "slider-tap", s.animationDuration), le(n, t, !0, !0), ce(), ue("slide", n, !0), ue("update", n, !0), ue("change", n, !0), ue("set", n, !0), C.snap && X(e, {
handleNumbers: [n]
});
},
Z = function Z(e, t) {
return !!s.tooltips[t] && U(e.firstChild, i + "slider-tooltip");
},
$ = function $() {
return o.hasAttribute("disabled");
},
Q = function Q(e) {
return f[e].hasAttribute("disabled");
},
ee = function ee(e) {
var t = U(h, i + "slider-origin"),
n = U(t, i + "slider-handle");
return U(n, i + "slider-touch-area"), n.setAttribute("data-handle", e), n.setAttribute("tabindex", "0"), n.addEventListener("keydown", function (t) {
return function (e, t) {
if ($() || Q(t)) return !1;
var n = ["Left", "Right"],
a = ["Down", "Up"],
i = ["PageDown", "PageUp"],
r = ["Home", "End"];
s.dir && !s.ort ? n.reverse() : s.ort && !s.dir && (a.reverse(), i.reverse());
var o,
l = e.key.replace("Arrow", ""),
c = l === i[0],
u = l === i[1],
f = l === a[0] || l === n[0] || c,
p = l === a[1] || l === n[1] || u,
h = l === r[1];
if (!(f || p || l === r[0] || h)) return !0;
if (e.preventDefault(), p || f) {
var v = f ? 0 : 1,
m = V(t)[v];
if (null === m) return !1;
!1 === m && (m = _e.getDefaultStep(T[t], f, 10)), (u || c) && (m *= 5), m = Math.max(m, 1e-7), m *= f ? -1 : 1, o = q[t] + m;
} else o = h ? s.spectrum.xVal[s.spectrum.xVal.length - 1] : s.spectrum.xVal[0];
return le(t, d.toStepping(o), !0, !0), ue("slide", t), ue("update", t), ue("change", t), ue("set", t), !1;
}(t, e);
}), n.setAttribute("role", "slider"), n.setAttribute("aria-orientation", s.ort ? "vertical" : "horizontal"), 1 == s.handles ? n.classList.add(i + "slider-handle-upper") : 0 === e ? n.classList.add(i + "slider-handle-lower") : n.classList.add(i + "slider-handle-upper"), t;
},
te = function te(e, t) {
return !!t && U(e, i + "slider-connect");
},
ne = function ne(e) {
return Array.isArray(e) ? e : [e];
},
ae = function ae(e, t, n) {
n > 0 && (e.classList.add(t), setTimeout(function () {
e.classList.remove(t);
}, n));
},
ie = function ie(e) {
var t = (e = String(e)).split(".");
return t.length > 1 ? t[1].length : 0;
},
re = function re(e) {
return Math.max(Math.min(e, 100), 0);
},
se = function se(e, t, n, a) {
var i = n.slice(),
r = [!e, e],
s = [e, !e];
a = a.slice(), e && a.reverse(), a.length > 1 ? a.forEach(function (e, n) {
var a = fe(i, e, i[e] + t, r[n], s[n], !1);
!1 === a ? t = 0 : (t = a - i[e], i[e] = a);
}) : r = s = [!0];
var o = !1;
a.forEach(function (e, a) {
o = le(e, n[e] + t, r[a], s[a]) || o;
}), o && a.forEach(function (e) {
ue("update", e), ue("slide", e);
});
},
oe = function oe(e, t) {
return s.dir ? 100 - e - t : e;
},
le = function le(e, t, n, a) {
return !1 !== (t = fe(T, e, t, n, a, !1)) && (function (e, t) {
T[e] = t, q[e] = d.fromStepping(t);
var n = "translate(" + pe(oe(t, 0) - H + "%", "0") + ")";
f[e].style[R] = n, de(e), de(e + 1);
}(e, t), !0);
},
de = function de(e) {
if (c[e]) {
var t = 0,
n = 100;
0 !== e && (t = T[e - 1]), e !== c.length - 1 && (n = T[e]);
var a = n - t,
i = "translate(" + pe(oe(t, a) + "%", "0") + ")",
r = "scale(" + pe(a / 100, "1") + ")";
c[e].style[R] = i + " " + r;
}
},
ce = function ce() {
p.forEach(function (e) {
var t = T[e] > 50 ? -1 : 1,
n = 3 + (f.length + t * e);
f[e].style.zIndex = n;
});
},
ue = function ue(e, t, n) {
Object.keys(C).forEach(function (a) {
var i = a.split(".")[0];
e === i && C[a].forEach(function (e) {
e.call(self, q.map(s.format.to), t, q.slice(), n || !1, T.slice());
});
});
},
fe = function fe(e, t, n, a, i, r) {
return f.length > 1 && !S.unconstrained && (a && t > 0 && (n = Math.max(n, e[t - 1] + s.margin)), i && t < f.length - 1 && (n = Math.min(n, e[t + 1] - s.margin))), f.length > 1 && s.limit && (a && t > 0 && (n = Math.min(n, e[t - 1] + s.limit)), i && t < f.length - 1 && (n = Math.max(n, e[t + 1] - s.limit))), s.padding && (0 === t && (n = Math.max(n, s.padding[0])), t === f.length - 1 && (n = Math.min(n, 100 - s.padding[1]))), n = d.getStep(n), !((n = re(n)) === e[t] && !r) && n;
},
pe = function pe(e, t) {
var n = s.ort;
return (n ? t : e) + ", " + (n ? e : t);
},
he = function he(e, t) {
return null === e || !1 === e || void 0 === e ? T[t] : ("number" == typeof e && (e = String(e)), e = s.format.from(e), !1 === (e = d.toStepping(e)) || isNaN(e) ? T[t] : e);
},
ve = function ve(e, t) {
return 100 / (t - e);
},
me = function me(e, t) {
return 100 * t / (e[1] - e[0]);
},
ge = function ge(e, t) {
return me(e, e[0] < 0 ? t + Math.abs(e[0]) : t - e[0]);
},
be = function be(e, t, n, a) {
if (100 === a) return a;
var i = Ee(a, e),
r = e[i - 1],
s = e[i];
return n ? a - r > (s - r) / 2 ? s : r : t[i - 1] ? e[i - 1] + function (e, t) {
return Math.round(e / t) * t;
}(a - e[i - 1], t[i - 1]) : a;
},
ye = function ye(e, t, n) {
var a;
if ("number" == typeof t && (t = [t]), !N(t)) throw new Error("Slider 'range' contains invalid value.");
if (a = "min" === e ? 0 : "max" === e ? 100 : parseFloat(e), !we(a) || !we(t[0])) throw new Error("Slider 'range' value isn't numeric.");
n.xPct.push(a), n.xVal.push(t[0]), a ? n.xSteps.push(!isNaN(t[1]) && t[1]) : isNaN(t[1]) || (n.xSteps[0] = t[1]), n.xHighestCompleteStep.push(0);
},
Le = function Le(e, t, n) {
if (t) if (n.xVal[e] !== n.xVal[e + 1]) {
n.xSteps[e] = me([n.xVal[e], n.xVal[e + 1]], t) / ve(n.xPct[e], n.xPct[e + 1]);
var a = (n.xVal[e + 1] - n.xVal[e]) / n.xNumSteps[e],
i = Math.ceil(Number(a.toFixed(3)) - 1),
r = n.xVal[e] + n.xNumSteps[e] * i;
n.xHighestCompleteStep[e] = r;
} else n.xSteps[e] = n.xHighestCompleteStep[e] = n.xVal[e];
},
we = function we(e) {
return "number" == typeof e && !isNaN(e) && isFinite(e);
},
xe = function xe(e, t) {
return t * (e[1] - e[0]) / 100 + e[0];
},
Ee = function Ee(e, t) {
for (var n = 1; e >= t[n];) {
n += 1;
}
return n;
},
Se = function Se() {
var e = h.getBoundingClientRect(),
t = "offset" + ["Width", "Height"][s.ort];
return 0 === s.ort ? e.width || h[t] : e.height || h[t];
},
ke = function ke(e, t, n, a) {
var r = function r(_r) {
return !!(_r = Ce(_r, a.pageOffset, a.target || t)) && !($() && !a.doNotReject) && !(o.classList.contains(i + "slider-tap") && !a.doNotReject) && !(e === v.start && void 0 !== _r.buttons && _r.buttons > 1) && (!a.hover || !_r.buttons) && (A || _r.preventDefault(), _r.calcPoint = _r.points[s.ort], void n(_r, a));
},
l = [];
return e.split(" ").forEach(function (e) {
t.addEventListener(e, r, !!A && {
passive: !0
}), l.push([e, r]);
}), l;
},
Ce = function Ce(e, n, a) {
var i,
r,
s = 0 === e.type.indexOf("touch"),
o = 0 === e.type.indexOf("mouse"),
l = 0 === e.type.indexOf("pointer");
if (s) {
var d = function d(e) {
return e.target === a || a.contains(e.target);
};
if ("touchstart" === e.type) {
var c = Array.prototype.filter.call(e.touches, d);
if (c.length > 1) return !1;
i = c[0].pageX, r = c[0].pageY;
} else {
var u = Array.prototype.find.call(e.changedTouches, d);
if (!u) return !1;
i = u.pageX, r = u.pageY;
}
}
return n = n || Me(t), (o || l) && (i = e.clientX + n.x, r = e.clientY + n.y), e.pageOffset = n, e.points = [i, r], e.cursor = o || l, e;
},
Ae = function Ae(e) {
var t,
n,
a,
i,
r,
o,
l = 100 * (e - (t = h, n = s.ort, a = t.getBoundingClientRect(), i = t.ownerDocument, r = i.documentElement, o = Me(i), /webkit.*Chrome.*Mobile/i.test(navigator.userAgent) && (o.x = 0), n ? a.top + o.y - r.clientTop : a.left + o.x - r.clientLeft)) / Se();
return l = re(l), s.dir ? 100 - l : l;
},
Te = function Te(e) {
var t = 100,
n = !1;
return f.forEach(function (a, i) {
if (!Q(i)) {
var r = Math.abs(T[i] - e);
(r < t || 100 === r && 100 === t) && (n = i, t = r);
}
}), n;
},
qe = function qe() {
var e, t, n;
m && (t = (e = "update.tooltips") && e.split(".")[0], n = t && e.substring(t.length), Object.keys(C).forEach(function (e) {
var a = e.split(".")[0],
i = e.substring(a.length);
t && t !== a || n && n !== i || delete C[e];
}), m.forEach(function (e) {
e && Ne(e);
}), m = null);
},
De = function De() {
var e = q.map(s.format.to);
return 1 === e.length ? q[0] : e;
},
Ne = function Ne(e) {
e.parentElement.removeChild(e);
},
Me = function Me(e) {
var t = void 0 !== window.pageXOffset,
n = "CSS1Compat" === (e.compatMode || "");
return {
x: t ? window.pageXOffset : n ? e.documentElement.scrollLeft : e.body.scrollLeft,
y: t ? window.pageYOffset : n ? e.documentElement.scrollTop : e.body.scrollTop
};
};
function _e(e, t, n) {
var a;
this.xPct = [], this.xVal = [], this.xSteps = [n || !1], this.xNumSteps = [!1], this.xHighestCompleteStep = [], this.snap = t;
var i = [];
for (a in e) {
Object.prototype.hasOwnProperty.call(e, a) && i.push([e[a], a]);
}
for (i.length && "object" == _typeof(i[0][0]) ? i.sort(function (e, t) {
return e[0][0] - t[0][0];
}) : i.sort(function (e, t) {
return e[0] - t[0];
}), a = 0; a < i.length; a++) {
ye(i[a][1], i[a][0], this);
}
for (this.xNumSteps = this.xSteps.slice(0), a = 0; a < this.xNumSteps.length; a++) {
Le(a, this.xNumSteps[a], this);
}
}
if (_e.prototype.getMargin = function (e) {
var t = this.xNumSteps[0];
if (t && e / t % 1 != 0) throw new Error("Slider 'limit', 'margin' and 'padding' must be divisible by step.");
return 2 === this.xPct.length && me(this.xVal, e);
}, _e.prototype.toStepping = function (e) {
return e = function (e, t, n) {
if (n >= e.slice(-1)[0]) return 100;
var a = Ee(n, e),
i = e[a - 1],
r = e[a],
s = t[a - 1],
o = t[a];
return s + ge([i, r], n) / ve(s, o);
}(this.xVal, this.xPct, e);
}, _e.prototype.fromStepping = function (e) {
return function (e, t, n) {
if (n >= 100) return e.slice(-1)[0];
var a = Ee(n, t),
i = e[a - 1],
r = e[a],
s = t[a - 1],
o = t[a];
return xe([i, r], (n - s) * ve(s, o));
}(this.xVal, this.xPct, e);
}, _e.prototype.getStep = function (e) {
return e = be(this.xPct, this.xSteps, this.snap, e);
}, _e.prototype.getDefaultStep = function (e, t, n) {
var a = Ee(e, this.xPct);
return (100 === e || t && e === this.xPct[a - 1]) && (a = Math.max(a - 1, 1)), (this.xVal[a] - this.xVal[a - 1]) / n;
}, _e.prototype.getNearbySteps = function (e) {
var t = Ee(e, this.xPct);
return {
stepBefore: {
startValue: this.xVal[t - 2],
step: this.xNumSteps[t - 2],
highestStep: this.xHighestCompleteStep[t - 2]
},
thisStep: {
startValue: this.xVal[t - 1],
step: this.xNumSteps[t - 1],
highestStep: this.xHighestCompleteStep[t - 1]
},
stepAfter: {
startValue: this.xVal[t],
step: this.xNumSteps[t],
highestStep: this.xHighestCompleteStep[t]
}
};
}, _e.prototype.countStepDecimals = function () {
var e = this.xNumSteps.map(ie);
return Math.max.apply(null, e);
}, _e.prototype.convert = function (e) {
return this.getStep(this.toStepping(e));
}, !("Slider" in e)) {
!function () {
if (!s.range) throw new RangeError("There was a problem found with the range option values, please correct and try again!");
if ("object" != _typeof(s.range) || N(s.range)) throw new Error("Slider 'range' is not an object.");
if (void 0 === s.range.min && (s.range.min = 0), void 0 === s.range.max) throw new Error("Slider Missing 'max' in 'range'.");
if (s.range.min === s.range.max) throw new Error("Slider 'range' 'min' and 'max' cannot be equal.");
if (d = new _e(s.range, s.snap, s.singleStep), s.start) {
var e = ne(s.start);
if (!Array.isArray(e) || !e.length) throw new Error("Slider 'start' option is incorrect.");
s.handles = e.length, s.start = e;
} else s.range.min && s.range.max ? (s.start = [s.range.min, s.range.max], s.handles = 2) : (s.start = s.range.max, s.handles = 1);
if (s.behaviour) {
if ("string" != typeof s.behaviour) throw new Error("Slider 'behaviour' must be a string containing options.");
var t = s.behaviour.indexOf("tap") >= 0,
n = s.behaviour.indexOf("drag") >= 0,
i = s.behaviour.indexOf("fixed") >= 0,
o = s.behaviour.indexOf("snap") >= 0,
l = s.behaviour.indexOf("hover") >= 0,
c = s.behaviour.indexOf("unconstrained") >= 0;
if (i && 2 !== (void 0).handles) throw new Error("Slider 'fixed' behaviour must be used with 2 handles");
if (c && ((void 0).margin || (void 0).limit)) throw new Error("Slider 'unconstrained' behaviour cannot be used with margin or limit");
S = {
tap: t || o,
drag: n,
fixed: i,
snap: o,
hover: l,
unconstrained: c
};
}
if (0 == S.fixed && function (e) {
if (0 !== s.margin && (s.margin = d.getMargin(e), !s.margin)) throw new Error("Slider 'margin' option is only supported on linear sliders.");
}(s.margin), s.limit = d.getMargin(s.limit), s.padding) {
if ("number" == typeof s.padding && !Array.isArray(s.padding)) throw new Error("Slider 'padding' option must be numeric or array of exactly 2 numbers.");
if (Array.isArray(s.padding) && 2 != s.padding.length && "number" == typeof s.padding[0] && "number" == typeof s.padding[1]) throw new Error("Slider 'padding' option must be numeric or array of exactly 2 numbers.");
if (0 === s.padding) return;
if (Array.isArray(s.padding) || (s.padding = [s.padding]), s.padding = [d.getMargin(s.padding[0]), d.getMargin(s.padding[1])], !1 === s.padding[0] || !1 === s.padding[1]) throw new Error("Slider 'padding' option is only supported on linear sliders.");
if (s.padding[0] < 0 || s.padding[1] < 0) throw new Error("Slider 'padding' option must be a positive number(s).");
if (s.padding[0] + s.padding[1] > 100) throw new Error("Slider 'padding' option must not exceed 100% of the range.");
}
if (s.tooltips) {
var u;
if (!1 === s.tooltips) return;
if (!0 === s.tooltips) {
u = [];
for (var p = 0; p < s.handles; p++) {
u.push(!0);
}
} else {
if ((u = ne(s.tooltips)).length !== f) throw new Error("Slider must pass a formatter for all handles.");
u.forEach(function (e) {
if ("boolean" != typeof e && ("object" != _typeof(e) || "function" != typeof e.to)) throw new Error("Slider 'tooltips' must be passed a formatter or 'false'.");
});
}
s.tooltips = u;
}
if (!s.format) if (a) {
var h = JSON.parse(r);
if (h.format) {
var v;
if (v = h.format.indexOf("(") > -1 ? h.format.substring(0, h.format.indexOf("(")).trim() : h.format, !window[v]) throw new Error("The supplied format function " + h.format + " could not be accessed, please verify and try again!");
s.format = window[v];
} else s.format = B;
} else s.format = B;
if (!s.ariaFormat) if (a) {
if ((h = JSON.parse(r)).ariaFormat) {
if (v = h.ariaFormat.indexOf("(") > -1 ? h.ariaFormat.substring(0, h.ariaFormat.indexOf("(")).trim() : h.ariaFormat, !window[v]) throw new Error("The supplied format function " + h.ariaFormat + " could not be accessed, please verify and try again!");
s.ariaFormat = window[v];
} else s.ariaFormat = s.format;
} else s.ariaFormat = s.format;
if (s.format && (!s.format.to || !s.format.from)) throw new Error("The supplied format function " + s.format + " is missing required method to or from, please verify and try again!");
if (s.ariaFormat && (!s.ariaFormat.to || !s.ariaFormat.from)) throw new Error("The supplied format function " + s.format + " is missing required method to or from, please verify and try again!");
}(), 1 == s.ort && e.classList.add(i + "align-items-center"), s.content && function () {
var n = P("div", {
class: i + "text-no-wrap " + i + "mb-3" + (1 == s.ort ? " " + i + "d-flex " + i + "flex-column " + i + "align-items-center" : "")
}),
a = t.createTextNode(s.content);
if (n.appendChild(a), e.insertBefore(n, e.firstChild), s.showRange) {
var r = P("span", {
html: " ( " + s.format.to(s.range.min) + " - " + s.format.to(s.range.max) + " )"
});
n.appendChild(r);
}
}(), function () {
if (l = e.querySelector("." + i + "slider-container"), 1 == s.ort && l.classList.add(i + "slider-container-vertical"), 1 == s.handles) {
var t = l.querySelector("." + i + "slider-wrapper");
t.classList.remove(i + "slider-wrapper"), t.classList.add(i + "slider-wrapper-single");
}
}(), v = window.navigator.pointerEnabled ? {
start: "pointerdown",
move: "pointermove",
end: "pointerup"
} : window.navigator.msPointerEnabled ? {
start: "MSPointerDown",
move: "MSPointerMove",
end: "MSPointerUp"
} : {
start: "mousedown touchstart",
move: "mousemove touchmove",
end: "mouseup touchend"
}, o = e.querySelector("." + i + "slider-target"), h = function () {
0 === s.dir ? o.classList.add(i + "slider-ltr") : o.classList.add(i + "slider-rtl"), 0 === s.ort ? o.classList.add(i + "slider-horizontal") : o.classList.add(i + "slider-vertical");
var e = U(o, i + "slider-base");
return e.setAttribute("tabindex", "0"), e.setAttribute("aria-label", (s.content ? s.content : "Slider") + " " + s.format.to(s.range.min) + " to " + s.format.to(s.range.max)), e;
}(), function () {
var e,
t = U(h, i + "slider-connects");
f = [], c = [], p = [], e = 1 === s.handles ? [!0, !1] : [!1, s.range, !1], c.push(te(t, e[0]));
for (var n = 0; n < s.handles; n++) {
f.push(ee(n)), p[n] = n, c.push(te(t, e[n + 1]));
}
}(), (E = S).fixed || f.forEach(function (e, t) {
ke(v.start, e.children[0], X, {
handleNumbers: [t]
});
}), E.tap && ke(v.start, h, G, {}), E.hover, E.drag && c.forEach(function (e, t) {
if (!1 !== e && 0 !== t && t !== c.length - 1) {
var n = f[t - 1],
a = f[t],
r = [e];
e.classList.add(i + "slider-draggable"), E.fixed && (r.push(n.children[0]), r.push(a.children[0])), r.forEach(function (e) {
ke(v.start, e, X, {
handles: [n, a],
handleNumbers: [t - 1, t]
});
});
}
}), function (e, t) {
var n = ne(e),
a = void 0 === T[0];
t = void 0 === t || !!t, s.animate && !a && ae(o, i + "slider-tap", s.animationDuration), p.forEach(function (e) {
le(e, he(n[e], e), !0, !1);
}), p.forEach(function (e) {
le(e, T[e], !0, !0);
}), ce(), p.forEach(function (e) {
ue("update", e), null !== n[e] && t && ue("set", e);
});
}(s.start), s.tooltips && function () {
var e, t, n, a;
qe(), m = f.map(Z), j("update.tooltips", function (e, t, n) {
if (m[t]) {
var a = e[t];
!0 !== s.tooltips[t] && (a = s.tooltips[t].to(n[t])), m[t].innerHTML = a;
}
}), 1 == s.ort && (e = f[0].querySelector("." + i + "slider-tooltip"), t = f[0].querySelector("div." + i + "slider-handle"), n = {
w: e.offsetWidth,
h: e.offsetHeight
}, a = t.getBoundingClientRect(), n.w < 50 && (n.w = 50), a.left - n.w < 0) && _(f, function (e) {
e.querySelector("." + i + "slider-tooltip").style.right = "auto", e.querySelector("." + i + "slider-tooltip").style.left = "120%";
});
}(), j("update", function (e, t, n, a, i) {
p.forEach(function (e) {
var t = f[e],
a = fe(T, e, 0, !0, !0, !0),
r = fe(T, e, 100, !0, !0, !0),
o = i[e],
l = s.ariaFormat.to(n[e]);
a = d.fromStepping(a).toFixed(s.percision), r = d.fromStepping(r).toFixed(s.percision), o = d.fromStepping(o).toFixed(s.percision), t.children[0].setAttribute("aria-valuemin", a), t.children[0].setAttribute("aria-valuemax", r), t.children[0].setAttribute("aria-valuenow", o), t.children[0].setAttribute("aria-valuetext", l);
});
}), j("end", F), w = s.format.to(s.range.min), x = s.format.to(s.range.max), 1 == f.length ? (b = P("div", {
class: i + "slider-max"
}), (L = U(b)).innerHTML = x, I.push(L)) : (g = P("div", {
class: i + "slider-min"
}), (y = U(g)).innerHTML = w, M.push(y), b = P("div", {
class: i + "slider-max"
}), (L = U(b)).innerHTML = x, I.push(L)), 0 === s.ort ? (g && l.insertBefore(g, l.childNodes[0]), l.appendChild(b)) : (g && l.appendChild(g), l.insertBefore(b, l.childNodes[0]));
for (var Ie = 0; Ie < f.length; Ie++) {
f[Ie].firstChild.addEventListener("focus", z, !1), f[Ie].firstChild.addEventListener("blur", W, !1), f[Ie].addEventListener("keyup", F, !1);
}
e.addEventListener("click", F, !1);
}
e.Slider = self;
}, e.Spinbox = function (e, t) {
e = _instanceof(e, HTMLElement) && e, (t = z(e, t = t || {})).spinmin = e.dataset.spinmin ? F(e.dataset.spinmin, 0) : F(t.spinmin, 0), t.spindefault = e.dataset.spindefault ? F(e.dataset.spindefault, 0) : F(t.spindefault, 0), t.spinmax = e.dataset.spinmax ? F(e.dataset.spinmax, 100) : F(t.spinmax, 100), t.spinstep = e.dataset.spinstep ? F(e.dataset.spinstep, 1) : F(t.spinstep, 1);
var n = "";
if (isNaN(t.spinmin) && (n += "Min value is not a number.\n"), isNaN(t.spinmax) && (n += "Max value is not a number.\n"), isNaN(t.spindefault) ? n += "Default value is not a number.\n" : (t.spindefault < t.spinmin || t.spindefault > t.spinmax) && (n += "Default value falls outside of the min max values.\n"), isNaN(t.spinstep) && (n += "Step value is not a number.\n"), n.length) throw new Error(n);
var a,
r,
s,
o = R(function (e) {
var n = e.which ? e.which : e.keyCode;
if (a.value.length > t.spinmax.length || n > 31 && (n < 48 || n > 57)) {
if (13 == n) a.blur(); else {
if (0 == a.value.length && t.spinmin < 0 && 45 == n) return;
e.preventDefault();
}
} else {
var i = a.value;
parseInt(i) > t.spinmax ? (a.value = t.spinmax, e.preventDefault()) : parseInt(i) < t.spinmin ? (a.value = t.spinmin, e.preventDefault()) : "-" == a.value && 48 == e.charCode ? e.preventDefault() : 13 == n ? (Math.abs(parseInt(a.value)) % t.spinstep > 0 && (a.value = parseInt(a.value) - Math.abs(parseInt(a.value)) % t.spinstep), a.blur()) : a.setAttribute("aria-valuenow", a.value + e.key);
}
}, 500),
l = function l(e, n) {
var i;
(i = n === s ? parseInt(a.value) - t.spinstep : parseInt(a.value) + t.spinstep) < t.spinmin || i > t.spinmax || (a.value = i, a.setAttribute("aria-valuenow", i), d());
},
d = function d() {
a.value == t.spinmin || parseInt(a.value) - t.spinstep < t.spinmin ? s.setAttribute("disabled", "") : s.hasAttribute("disabled") && s.removeAttribute("disabled"), a.value == t.spinmax || parseInt(a.value) + t.spinstep > t.spinmax ? r.setAttribute("disabled", "") : r.hasAttribute("disabled") && r.removeAttribute("disabled");
};
if (!("Spinbox" in e)) {
(a = e.querySelector("." + i + "spinbox-input")).addEventListener("keypress", o), a.addEventListener("keyup", d), a.addEventListener("focusout", function () {
if (0 != a.value.length && "-" != a.value && /^\d+$/.test(a.value)) {
if (parseInt(a.value) < t.spinmin) a.value = t.spinmin; else if (parseInt(a.value) > t.spinmax) a.value = t.spinmax; else if (Math.abs(parseInt(a.value)) % t.spinstep > 0) a.value = parseInt(a.value) - Math.abs(parseInt(a.value)) % t.spinstep; else if (a.value.match(/^0+/g)) {
var e = a.value.match(/^0+/g),
n = a.value.replace(e, "");
0 == n.length ? a.value = "0" : a.value = n;
}
} else a.value = t.spindefault;
d();
}), e.addEventListener("keydown", function (e) {
switch (e.keyCode) {
case 35:
e.preventDefault(), a.value = t.spinmax;
break;
case 36:
e.preventDefault(), a.value = t.spinmin;
break;
case 38:
e.preventDefault(), a.value.length ? r.click() : (a.value = t.spinmin + 1, a.setAttribute("aria-valuenow", a.value));
break;
case 40:
e.preventDefault(), s.click();
break;
case 37:
case 39:
e.preventDefault();
}
}), a.value = t.spindefault, a.setAttribute("aria-valuenow", t.spindefault), a.setAttribute("aria-valuemin", t.spinmin), a.setAttribute("aria-valuemax", t.spinmax);
var c = e.querySelectorAll("button." + i + "spinbox-btn");
e.classList.contains(i + "spinbox-horizontal") ? (s = c[0], r = c[1]) : (s = c[1], r = c[0]), s.addEventListener("click", function (e) {
l(0, s);
}), r.addEventListener("click", function (e) {
l(0, r);
}), d();
}
e.Spinbox = this;
}, e.Tab = function (e, n) {
e = _instanceof(e, HTMLElement) && e, (n = z(e, n = n || {})).lazyload = "boolean" == typeof n.lazyload && n.lazyload;
var a,
r,
s,
o,
l,
d,
u,
p,
h,
v = this,
m = null,
g = 35,
b = 36,
L = 37,
x = 38,
E = 39,
S = 40,
A = 46,
T = {
37: -1,
38: -1,
39: 1,
40: 1
},
q = function q(e) {
p.detail = e.detail;
},
D = function D(e) {
switch (e.keyCode) {
case 9:
if (1 === u.length) {
e.preventDefault();
break;
}
e.shiftKey ? function (e) {
document.activeElement === r.firstFocusableEl && (e.preventDefault(), C(r.lastFocusableEl));
}(e) : function (e) {
document.activeElement === r.lastFocusableEl && (e.preventDefault(), C(r.firstFocusableEl));
}(e);
break;
case 27:
v.hide(), C(m);
}
},
N = function N(e) {
var t = e.keyCode,
n = !1;
"vertical" == a.getAttribute("aria-orientation") ? t !== x && t !== S || (e.preventDefault(), n = !0) : t !== L && t !== E || (e.preventDefault(), n = !0), n && M(e);
},
M = function M(e) {
var t = e.keyCode;
if (_(s, function (e) {
e.addEventListener("focus", F);
}), T[t]) {
var n = e.target;
if (void 0 !== n.index) if (s[n.index + T[t]]) {
var a = n.index + T[t];
p && (a < p.detail.left ? p.clickLeft() : a > p.detail.right && p.clickRight()), setTimeout(function () {
C(s[a]);
}, 125);
} else t === L || t === x ? (p && p.clickEnd(), O()) : t !== E && t != S || (p && p.clickHome(), H());
}
},
I = function I(e, t) {
t = t || !0, P(e), e.removeAttribute("tabindex"), e.setAttribute("aria-selected", "true");
var n = e.getAttribute("aria-controls");
e.classList.add(i + "active"), document.getElementById(n).classList.add(i + "active"), document.getElementById(n).classList.add(i + "show"), t && C(e);
},
P = function P(e) {
l = function (e) {
var t = e.getAttribute("aria-controls");
return document.getElementById(t).parentElement.querySelectorAll("." + i + "tab-pane");
}(e), _(s, function (e) {
e.setAttribute("tabindex", "-1"), e.setAttribute("aria-selected", "false"), e.removeEventListener("focus", F), e.classList.remove(i + "active"), e.classList.remove(i + "show");
}), _(l, function (e) {
e.classList.remove(i + "active"), e.classList.remove(i + "show");
});
},
H = function H() {
C(s[0]);
},
O = function O() {
C(s[s.length - 1]);
},
R = function R(e) {
var t = e.target;
null !== t.getAttribute("data-deletable") && (B(e), t.index - 1 < 0 ? I(s[0]) : I(s[t.index - 1]));
},
B = function B(e) {
var t = e.target,
n = document.getElementById(t.getAttribute("aria-controls"));
t.parentElement.removeChild(t), n.parentElement.removeChild(n);
},
F = function F(e) {
var t = e.target;
setTimeout(W, d, t);
},
W = function W(e) {
e === document.activeElement && I(e, !1);
},
V = function V(e) {
r.classList.contains(i + "show") && (v.hide(), e.preventDefault(), C(m));
},
j = function j() {
r.classList.contains(i + "show") && window.matchMedia("(min-width: 767.98px)").matches && (v.hide(), window.removeEventListener("resize", j, !1));
};
this.show = function () {
window.innerWidth > 767.98 || (function () {
var e = r.querySelector("." + i + "modal-body");
e.firstElementChild && e.removeChild(e.firstElementChild);
var t = w(event.target, "." + i + "tab-link").getAttribute("aria-controls"),
n = document.getElementById(t);
setTimeout(function () {
var t = n.cloneNode(!0);
e.appendChild(t);
}, 50);
}(), r.style.display = "block", r.setAttribute("aria-hidden", !1), C(r), r.classList.add(i + "show"), f && c && r.classList.add(i + "is-safari"), t.body.classList.add(i + "modal-open"), (o = r && r.querySelector("[data-dismiss='" + i + "modal']")).addEventListener("click", V, !1), window.addEventListener("resize", j, !1), u = y(r), r.firstFocusableEl = u[0], r.lastFocusableEl = u[u.length - 1], setTimeout(function () {
C(o);
}, 50), r.addEventListener("keydown", D));
}, this.hide = function () {
r.classList.add(i + "slide-right"), r.classList.remove(i + "show"), r.setAttribute("aria-hidden", !0), f && c && r.classList.contains(i + "is-safari") && r.classList.remove(i + "is-safari"), setTimeout(function () {
r.style.display = "", t.body.classList.remove(i + "modal-open"), o.removeEventListener("click", V, !1);
}, 200), r.removeEventListener("keydown", D);
}, this.lazyLoad = function () {
n.lazyload && p && !p.detail ? (p.lazyLoad(), p.detail = p.getCurrentDetails(), h.addEventListener("uicOverflowChangeEvent", q, !1), k("Tab", "LazyLoadEvent", e, {
success: !0
})) : k("Tab", "LazyLoadEvent", e, {
success: !1,
msg: "Tab cannot be lazy loaded. Check usage or avoid mulitple lazy loads."
});
}, "Tab" in e || (a = function (e) {
for (; e && e.parentNode;) {
if ((e = e.parentNode).getAttribute("role") && "tablist" == e.getAttribute("role")) return e;
}
return null;
}(e), r = e.dataset.target && t.getElementById(e.dataset.target.substr(1)), d = function () {
var e = 0;
if (a.hasAttribute("data-delay")) {
var t = a.getAttribute("data-delay");
e = t || 300;
}
return e;
}(), s = function () {
for (var e = a.querySelectorAll("." + i + "tab-link"), t = 0; t < e.length; t++) {
e[t].index = t;
}
return e;
}(), e.addEventListener("keydown", function (e) {
switch (e.keyCode) {
case g:
e.preventDefault(), p && p.clickEnd(), I(s[s.length - 1]);
break;
case b:
e.preventDefault(), p && p.clickHome(), I(s[0]);
break;
case x:
case S:
N(e);
break;
case L:
case E:
N(e);
}
}), e.addEventListener("keyup", function (e) {
switch (e.keyCode) {
case A:
R(e);
}
}), e.addEventListener("click", function (t) {
var n = t.target;
n === e && r && !r.classList.contains(i + "show") && t.preventDefault(), v.show(), m = w(n, "." + i + "tab-link"), I(m, !1);
}), (h = w(e, "." + i + "container-overflow")) && ("overflow" in a ? p = a.overflow : (p = new Y(h, {
lazyload: n.lazyload
}), n.lazyload || (p.detail = p.getCurrentDetails(), h.addEventListener("uicOverflowChangeEvent", q)), a.overflow = p))), e.Tab = v;
}, e.Table = function (e, n) {
function a(e, t) {
var n = "",
a = e.match(/\{((\w*|\d*):?)+\}/g);
(a.length < 1 || a.length > 3) && (n += "Custom layout for row " + t + " was delared with an incorrect set of elements!\n");
var i = 0,
r = ["placeholder", "actions", "settings", "search"];
return _(a, function (e) {
var a = e.replace(/\{|\}/g, "").split(":");
-1 !== a.indexOf("placeholder") || e.match(/\{[A-Z,a-z]+:[1,2,3](:(start|center|end))*\}/g) || (n += "Custom layout for row " + t + " has an element " + e + ", which has been declared incorrectly!\n"), -1 === o.indexOf(a[0]) && !window[a[0]] && r.indexOf(a[0]) < 0 && (n += "Custom layout for row " + t + " has an element with custom function '" + a[0] + "' that is not accessible or dosen't exist!\n"), isNaN(a[1].substring(0, 1)) || (i += +a[1].substring(0, 1));
}), 3 != i && (n += "Custom layout for row " + t + " is configured with grid length '" + i + "', which needs to add up to '3'!\n"), n;
}
var r = (e = _instanceof(e, HTMLElement) ? e : void 0).dataset.tableData;
r && (n = JSON.parse(r));
var s = {},
o = ["{actions:1:start}", "{search:1:center}", "{settings:1:end}"];
if (s.sort = "boolean" == typeof n.sort && n.sort, s.expand = "boolean" == typeof n.expand && n.expand, s.expand && (s.expandIcon = n.expandIcon && "string" == typeof n.expandIcon ? n.expandIcon : "arrow-tri-solid-right", s.expandIcon.indexOf(i) > -1 && (s.expandIcon = s.expandIcon.split(i)[1])), s.showTotal = "string" == typeof n.showTotal && n.showTotal, s.condensed = "boolean" == typeof n.condensed && n.condensed, s.fixedColumns = "boolean" == typeof n.fixedColumns && n.fixedColumns, s.fixedHeight = "boolean" == typeof n.fixedHeight && n.fixedHeight, s.header = "boolean" != typeof n.header || n.header, s.text = {}, s.text.apply = n.text && n.text.apply && "string" == typeof n.text.apply ? n.text.apply : "Apply", s.text.cancel = n.text && n.text.cancel && "string" == typeof n.text.cancel ? n.text.cancel : "Cancel", s.text.exportCsv = n.text && n.text.export && "string" == typeof n.text.export ? n.text.exportCsv : "Export as csv", s.text.exportJson = n.text && n.text.exportJson && "string" == typeof n.text.exportJson ? n.text.exportJson : "Export as json", s.text.delete = n.text && n.text.delete && "string" == typeof n.text.delete ? n.text.delete : "Delete", s.text.noEntries = n.text && n.text.noEntries && "string" == typeof n.text.noEntries ? n.text.noEntries : "No entries found", s.text.import = n.text && n.text.import && "string" == typeof n.text.import ? n.text.import : "Import", s.text.print = n.text && n.text.print && "string" == typeof n.text.print ? n.text.print : "Print", s.text.columns = n.text && n.text.columns && "string" == typeof n.text.columns ? n.text.columns : "Columns", s.text.batchActions = n.text && n.text.batchActions && "string" == typeof n.text.batchActions ? n.text.batchActions : "Batch Actions", s.text.chooseActions = n.text && n.text.chooseAction && "string" == typeof n.text.chooseAction ? n.text.chooseAction : "Choose Actions", s.showData = !r || "boolean" != typeof n.showData || n.showData, s.search = "boolean" != typeof n.search || n.search, s.search && (s.text.search = {}, s.text.search.label = !(!n.text || !n.text.search || "string" != typeof n.text.search.label) && n.text.search.label, s.text.search.placeholder = !(!n.text || !n.text.search || "string" != typeof n.text.search.placeholder) && n.text.search.placeholder), s.settings = "boolean" != typeof n.settings || n.settings, s.import = "boolean" != typeof n.import || n.import, s.print = "boolean" != typeof n.print || n.print, s.column = "boolean" != typeof n.column || n.column, s.exportDetails = "boolean" != typeof n.exportDetails || n.exportDetails, s.actionsSelectFilters = [s.text.exportCsv, s.text.exportJson, "hr", s.text.delete], _(n.additionalActions, function (e) {
if (e.js) {
var t = e.js;
if (e.js.indexOf("(") > -1 ? t = e.js.substring(0, e.js.indexOf("(")).trim() : e.js += "()", !window[t]) throw new Error("The additional action function " + e.js + " could not be accessed, please verify and try again!");
s.actionsSelectFilters.splice(e.pos, 0, e);
} else s.actionsSelectFilters.splice(e.pos, 0, e);
}), s.select = "boolean" != typeof n.select || n.select, s.select || o.splice(o.indexOf("{actions:1:start}"), 1, "{placeholder:1:start}"), s.search || o.splice(o.indexOf("{search:1:center}"), 1, "{placeholder:1:center}"), s.settings || o.splice(o.indexOf("{settings:1:end}"), 1, "{placeholder:1:end}"), n.layout) {
var l = 0,
d = "";
if (n.layout.row1 && (d += a(n.layout.row1, "one"), l++), n.layout.row2 && (d += a(n.layout.row2, "two"), l++), 0 === l && (d += "Custom layout was configured to have no Rows, which it needs to have at least 1!\n"), d.length > 0) throw new Error(d);
}
if (s.layout = n.layout ? n.layout : {
row2: o.join("")
}, N(n.perPageSelect)) {
if ("number" == typeof n.perPageSelect[0]) s.perPageSelect = n.perPageSelect.map(function (e) {
return e = Math.abs(parseInt(e));
}); else {
if (!F(n.perPageSelect[0])) throw new Error("Invalid perPageSelect. Should be a non-empty array of integer");
s.perPageSelect = n.perPageSelect.map(function (e) {
return e = Math.abs(parseInt(e));
});
}
} else s.perPageSelect = [12, 24, 48, 96];
if (s.perPage = s.perPageSelect.indexOf(n.perPage) > -1 ? F(n.perPage) : s.perPageSelect[0], s.origPerPage = s.perPage, s.items = F(n.items, 0), s.buttonLabelLeft = n.buttonLabelLeft && "string" == typeof n.buttonLabelLeft ? n.buttonLabelLeft : "Previous", s.buttonLabelRight = n.buttonLabelRight && "string" == typeof n.buttonLabelRight ? n.buttonLabelRight : "Next", s.disablePaginationInput = null !== n.disablePaginationInput && "boolean" == typeof n.disablePaginationInput && n.disablePaginationInput, s.data = {}, !n.data) {
var c = "Missing data parameters for table!";
return console.error(c), k("Table", "Error", ae, {
msg: c
}), !1;
}
if (!n.data.headings) return c = "Missing data.headings parameters for table!", console.error(c), k("Table", "Error", ae, {
msg: c
}), !1;
if (s.data.headings = n.data.headings, !n.data.columns) return c = "Missing data.columns parameters for table!", console.error(c), k("Table", "Error", ae, {
msg: c
}), !1;
if (s.data.columns = n.data.columns, !n.data.rows) return c = "Missing data.rows parameters for table!", console.error(c), k("Table", "Error", ae, {
msg: c
}), !1;
s.data.rows = n.data.rows, s.labels = {
noRows: s.text.noEntries
}, s.showData || delete e.dataset.tableData;
var u,
f,
h,
v,
m,
g,
y,
L,
x,
E,
S,
C,
A,
T,
q,
I,
R,
B,
z,
U,
Y,
J,
X,
G,
Z,
$,
ne = this,
ae = e,
ie = !0,
re = !1,
se = [],
oe = !1,
le = function le(e) {
if ("mouse" === e.pointerType) return !1;
e.preventDefault();
var t,
n = 0;
if ("touchstart" !== e.type && "pointerdown" !== e.type || (G = "pointerdown" === e.type ? e.clientY - n : e.touches[0].clientY - n, "LI" != (U = e.target).tagName && (U = w(U, "." + i + "table-cmplx-drag-li")), U.dataTransfer = {}, U.dataTransfer.data = U.outerHTML, Z = U.offsetTop), "touchmove" === e.type || "pointermove" === e.type) {
e.preventDefault();
var a = !1;
if (L || p ? ($ = e.clientY - G, U.addEventListener("pointerleave", ce)) : $ = e.touches[0].clientY - G, 0 === (n = $)) return !1;
U || "LI" != (U = e.target).tagName && (U = w(U, "." + i + "table-cmplx-drag-li")), t = Z + $, U.style.transform = "translate3d(0, " + n + "px, 0)", U.style.opacity = .5, oe = !0, _(se, function (e) {
var n = e.offsetTop < U.offsetTop,
a = e.offsetTop > U.offsetTop,
r = e.offsetTop < t,
s = e.offsetTop > t;
s && n || r && a ? s ? e.previousElementSibling ? t > e.previousElementSibling.offsetTop ? (e.classList.contains(i + "border-bottom-black") && e.classList.remove(i + "border-bottom-black"), e.classList.add(i + "border-top-black")) : e.classList.contains(i + "border-top-black") ? e.classList.remove(i + "border-top-black") : e.classList.contains(i + "border-bottom-black") && e.classList.remove(i + "border-bottom-black") : t < 0 && e.classList.add(i + "border-top-black") : r && (e.nextElementSibling ? t < e.nextElementSibling.offsetTop ? (e.classList.contains(i + "border-top-black") && e.classList.remove(i + "border-top-black"), e.classList.add(i + "border-bottom-black")) : e.classList.contains(i + "border-bottom-black") ? e.classList.remove(i + "border-bottom-black") : e.classList.contains(i + "border-top-black") && e.classList.remove(i + "border-top-black") : t > e.offsetTop && e.classList.add(i + "border-bottom-black")) : n && e.nextElementSibling && e.nextElementSibling.offsetTop > t && !e.nextElementSibling.classList.contains(i + "table-cmplx-drag-li") ? e.classList.add(i + "border-bottom-black") : s && a && t > e.previousElementSibling.offsetTop && e.previousElementSibling.classList.contains(i + "table-cmplx-li") ? e.classList.add(i + "border-top-black") : e.classList.contains(i + "border-top-black") ? e.classList.remove(i + "border-top-black") : e.classList.contains(i + "border-bottom-black") && e.classList.remove(i + "border-bottom-black");
});
}
if ("touchend" === e.type || "pointerup" === e.type) {
G = $, a = !1, U || "LI" != (U = e.target).tagName && (U = w(U, "." + i + "table-cmplx-drag-li")), t = Z + $, oe ? (_(se, function (e) {
if (e != U) {
var n = e.offsetTop < U.offsetTop,
r = e.offsetTop > U.offsetTop,
s = e.offsetTop < t,
o = e.offsetTop > t;
(o && n || s && r || e.nextElementSibling && n && e.nextElementSibling.offsetTop > t && !e.nextElementSibling.classList.contains(i + "table-cmplx-drag-li") || o && r && t > e.previousElementSibling.offsetTop && e.previousElementSibling.classList.contains(i + "table-cmplx-li")) && (o && n || o && r && t > e.previousElementSibling.offsetTop && e.previousElementSibling.classList.contains(i + "table-cmplx-li") ? (a = !0, e.previousElementSibling ? t > e.previousElementSibling.offsetTop && de(U, a, e) : !e.previousElementSibling && t < 0 && de(U, a, e)) : (s && r || n && e.nextElementSibling && e.nextElementSibling.offsetTop > t && !e.nextElementSibling.classList.contains(i + "table-cmplx-drag-li")) && (e.nextElementSibling && t < e.nextElementSibling.offsetTop ? de(U, a, e) : !e.nextElementSibling && t > e.offsetTop && de(U, a, e)), e.classList.remove(i + "border-top-black"), e.classList.remove(i + "border-bottom-black"), y.orderChanged = !0);
}
}), U.hasAttribute("style") && U.removeAttribute("style"), oe = !1) : U.querySelector("input").checked ? U.querySelector("input").checked = !1 : U.querySelector("input").checked = !0;
var r = y.querySelector("." + i + "btn-primary");
r.disabled && r.removeAttribute("disabled"), (L || p) && U.removeEventListener("pointerleave", ce);
}
},
de = function de(e, t, n) {
var a = e.querySelector("input").checked;
setTimeout(function () {
var i,
r = e.dataTransfer.data;
e.parentNode.removeChild(e), t ? (n.insertAdjacentHTML("beforebegin", r), i = n.previousSibling) : (n.insertAdjacentHTML("afterend", r), i = n.nextSibling), se.push(i), se = se.filter(function (t) {
return t != e;
}), a && (i.querySelector("input").checked = !0), ye(i);
}, 50);
},
ce = function ce(e) {
setTimeout(function () {
"LI" != (U = e.relatedTarget).tagName && (U = w(U, "." + i + "table-cmplx-drag-li")), U.hasAttribute("style") && U.removeAttribute("style"), _(se, function (e) {
e.classList.contains(i + "border-top-black") ? e.classList.remove(i + "border-top-black") : e.classList.contains(i + "border-bottom-black") && e.classList.remove(i + "border-bottom-black");
});
}, 50);
},
ue = function ue(e) {
if (e.stopPropagation(), "dragstart" === e.type && ((U = e.target).dataTransfer = {}, U.dataTransfer.data = U.outerHTML), "dragover" === e.type) {
var t = e.target;
if ("LI" != t.tagName && (t = w(t, "." + i + "table-cmplx-drag-li")), U != t) return e.preventDefault && e.preventDefault(), t.classList.add(i + "border-bottom-black"), t.previousElementSibling && t.previousElementSibling.classList.contains(i + "border-bottom-black") && t.previousElementSibling.classList.remove(i + "border-bottom-black"), t.nextElementSibling && t.nextElementSibling.classList.contains(i + "border-bottom-black") && t.nextElementSibling.classList.remove(i + "border-bottom-black"), !1;
}
if ("dragleave" === e.type) {
var n = e.target;
if ("LI" != n.tagName && (n = w(n, "." + i + "table-cmplx-drag-li")), U != n) return e.preventDefault && e.preventDefault(), n.classList.remove(i + "border-bottom-black"), !1;
}
if ("drop" === e.type) {
e.stopPropagation && e.stopPropagation();
var a = e.target;
if ("LI" != a.tagName && (a = w(a, "." + i + "table-cmplx-drag-li")), U != a) {
var r = U.querySelector("input"),
s = !!r && r.checked,
o = U.dataTransfer.data;
U.parentNode.removeChild(U), a.insertAdjacentHTML("afterend", o);
var l = a.nextSibling;
s && (l.querySelector("input").checked = !0), ye(l), a.classList.remove(i + "border-bottom-black"), y.orderChanged = !0;
var d = y.querySelector("." + i + "btn-primary");
d.disabled && d.removeAttribute("disabled");
}
return !1;
}
},
fe = function fe(e) {
var t = e.target,
n = new FileReader(),
a = "",
i = "";
if (t.files && t.files[0]) {
if (t.files[0].type && "application/json" !== t.files[0].type) {
if (!t.files[0].type || "application/vnd.ms-excel" !== t.files[0].type && "text/csv" !== t.files[0].type) {
var r = "The file type for the file selected was not recognizable!";
console.error(r), k("Table", "Error", ae, {
msg: r
});
} else i = "csv";
} else i = "json";
n.onload = function (e) {
a = e.target.result, "json" === i && (M(a) || (r = "The file type for the supplied file was not recognizable!", console.error(r), k("Table", "Error", ae, {
msg: r
})));
var n = {
type: i,
data: a,
headings: !0
};
ne.import(n), t.value = "";
}, n.readAsText(t.files[0]);
}
e.preventDefault();
},
pe = function pe(e) {
var t = {};
s.expand && s.select ? t.skipColumn = [0, 1] : (s.expand || s.select) && (t.skipColumn = [0]), e.innerHTML === s.text.exportCsv ? t.type = "csv" : t.type = "json", ne.export(t);
},
he = function he() {
ne.delete();
},
ve = function ve(e) {
if (s.select) {
var t = v.querySelector("[data-target='#cmplxTablesActions']");
"checked" === e || "indeterminate" === e && t.disabled ? t.removeAttribute("disabled") : "unchecked" !== e || t.disabled || t.setAttribute("disabled", "");
}
},
me = function me(e, t) {
s.sort && t.hasAttribute("data-sortable") && (s.items > 0 && s.items != ae.activeRows.length ? (ne.deleteAll(), xe().updateSortDirection(ae.activeHeadings[ae.activeHeadings.indexOf(t)], t.classList.contains("asc") ? "asc" : "desc")) : (xe().sort(ae.activeHeadings.indexOf(t)), Y = t.originalCellIndex, ne.update(), e.preventDefault()), k("Table", "SortEvent", ae, {
column: ae.activeHeadings.indexOf(t),
direction: t.classList.contains("asc") ? "ascending" : "descending",
currentPage: E,
perPage: s.perPage
})), t.focus();
},
ge = function ge(e) {
if (e.classList.contains(i + "table-cmplx-accordion-btn")) {
var t = e.parentNode.parentNode;
if (ae.data[t.dataIndex].details) {
var n = t.nextElementSibling.children[0];
n.classList.contains(i + "show") ? (n.classList.remove(i + "show"), e.classList.add(i + "collapsed"), e.setAttribute("aria-expanded", !1)) : (n.classList.add(i + "show"), e.classList.remove(i + "collapsed"), e.setAttribute("aria-expanded", !0));
} else _(e.querySelector("svg").childNodes, function (e) {
if (e.getAttribute("class").indexOf(i + "show") > -1) {
if (O(e, i + "show"), -1 != e.getAttribute("xlink:href").indexOf(i + "loading-sqrs")) {
var t = w(e, "tr");
ae.activeRows[t.dataIndex].event = "ExpandCancelEvent", k("Table", "ExpandCancelEvent", ae, {
rowId: t.dataIndex
});
}
} else if (H(e, i + "show"), -1 != e.getAttribute("xlink:href").indexOf(i + "loading-sqrs")) {
t = w(e, "tr"), ae.activeRows[t.dataIndex].event = "ExpandStartEvent";
var n = [];
_(ae.data[t.dataIndex].cells, function (e, t) {
if (s.expand && s.select) {
if (t >= 2) {
var a = '"' + I[t] + '": "' + (e.hasAttribute("data-content") ? e.getAttribute("data-content") : e.textContent) + '"';
n.push(a);
}
} else s.expand || s.select ? t >= 1 && (a = '"' + I[t] + '": "' + (e.hasAttribute("data-content") ? e.getAttribute("data-content") : e.textContent) + '"', n.push(a)) : (a = '"' + I[t] + '": "' + (e.hasAttribute("data-content") ? e.getAttribute("data-content") : e.textContent) + '"', n.push(a));
}), k("Table", "ExpandStartEvent", ae, {
rowId: t.dataIndex,
content: n
});
}
});
}
},
be = function be() {
var e = [];
_(x[E - 1], function (t) {
t.classList.contains("selected") && e.push(t.dataIndex);
}), e.length > 0 ? (ae.selectedRows = [], ae.selectedRows = e) : ae.selectedRows = [];
},
ye = function ye(e) {
e.addEventListener("dragstart", ue, !1), e.addEventListener("dragover", ue, !1), e.addEventListener("dragleave", ue, !1), e.addEventListener("drop", ue, !1), L || p ? (e.addEventListener("pointerdown", le, !1), e.addEventListener("pointerup", le, !1), e.addEventListener("pointermove", le, !1), p && e.addEventListener("click", function (e) {
"touch" === e.pointerType && e.preventDefault();
})) : (e.addEventListener("touchstart", le, !1), e.addEventListener("touchend", le, !1), e.addEventListener("touchmove", le, !1));
},
Le = function Le(e, t) {
for (var n in t) {
if (Object.prototype.hasOwnProperty.call(t, n)) {
var a = t[n];
a && D(a) ? (e[n] = e[n] || {}, Le(e[n], a)) : e[n] = a;
}
}
return e;
},
we = function we() {
var e = 0;
return ae.expand && e++ , ae.select && e++ , e;
},
xe = function xe(e) {
return new ee(ae, e);
},
Ee = function Ee(e) {
return new te(ae, e);
},
Se = function Se() {
q.length && _(ae.data, function (e) {
_(e.cells, function (t, n) {
q.indexOf(n) > -1 && _(T, function (n) {
n.columns === t.cellIndex && (t.innerHTML = n.renderer.call(ne, t.data, t, e));
});
});
});
},
ke = function ke(e, t, n, a) {
var r = i + "table-cmplx-row-details";
n && (r = n + " " + r), a && (r += " selected");
var s = P("tr", {
class: r
}),
o = P("td", {
class: i + "table-complx-details",
colspan: t
}),
l = P("div", {
class: i + "table-complx-details-body"
});
return e.details ? l.innerHTML = e.details : e.details = !1, o.appendChild(l), s.appendChild(o), s;
},
Ce = function Ce() {
var e = P("td"),
t = P("button", {
class: i + "table-cmplx-accordion-btn " + i + "collapsed",
"aria-expanded": !1,
"aria-label": "expand details"
}),
n = W([{
name: s.expandIcon,
show: !0
}, {
name: "loading-sqrs",
show: !1
}]);
return t.appendChild(n), e.appendChild(t), e;
},
Ae = function Ae() {
var e = P("td", {
class: i + "table-cmplx-row-select"
}),
t = P("input", {
type: "checkbox",
title: "row select"
});
return e.appendChild(t), e;
},
Te = function Te(e) {
var t = "
";
return t += e, t += "
", _(e.match(/\{((\w*|\d*):?)+\}/g), function (e) {
var n = e,
a = e.replace(/[{,}]/g, "").split(":");
switch (a[0]) {
case "actions":
t = t.replace(n, De(a[1], a[2]));
break;
case "search":
t = t.replace(n, Ne(a[1], a[2]));
break;
case "settings":
t = t.replace(n, Me(a[1], a[2]));
break;
case "placeholder":
t = t.replace(n, _e(a[1]));
break;
default:
var r = "
";
r += window[a[0]]() + "
", t = t.replace(n, r);
}
}), t;
},
qe = function qe(e, t) {
return P("button", {
class: i + "dropdown-item",
role: "menuitem",
onclick: t || "javascript: void(0);",
html: e,
tabindex: "-1"
});
},
De = function De(e, t) {
var n;
if (s.select) {
n = "
");
var a = P("div", {
class: i + "table-cmplx-action"
}),
r = P("label", {
class: i + "table-cmplx-action-label",
html: s.text.batchActions,
for: J + "BatchActions"
});
a.appendChild(r);
var o = P("div", {
class: i + "mb-0 " + i + "btn-dropdown"
}),
l = P("button", {
id: J + "BatchActions",
class: i + "btn " + i + "btn-secondary " + i + "table-cmplx-action-button",
tabindex: "0",
"data-toggle": i + "dropdown",
"data-target": "#cmplxTablesActions",
"aria-expanded": "false",
"aria-controls": "cmplxTablesActions",
html: s.text.chooseActions
}),
d = W([{
name: "arrow-tri-solid-right",
show: !0
}]),
c = d.getAttribute("class");
d.setAttribute("class", c + " " + i + "arrow-tri-solid-right"), l.appendChild(d), o.appendChild(l);
var u = P("ul", {
id: "cmplxTablesActions",
class: i + "button-dropdown-container " + i + "collapse",
role: "menu"
});
_(s.actionsSelectFilters, function (e) {
if ("hr" === e) u.appendChild(P(e, {
class: i + "dropdown-divider"
})); else {
var t,
n = P("li", {
class: i + "dropdown-list-item",
role: "none presentation",
tabindex: "0"
});
t = "string" == typeof e ? qe(e) : qe(e.html, e.js), n.appendChild(t), u.appendChild(n);
}
}), l.setAttribute("disabled", ""), o.appendChild(u), a.appendChild(o), n += a.outerHTML + "
";
} else n = "";
return n;
},
Ne = function Ne(e, t) {
var n;
if (s.search) {
n = "
");
var a = P("div", {
class: i + "table-cmplx-input-group"
}),
r = P("div", {
class: i + "table-cmplx-search"
}),
o = W([{
name: "search",
show: !0
}]),
l = P("input", {
type: "search",
class: i + "form-control ",
"aria-label": "search"
});
if (s.text.search.placeholder && l.setAttribute("placeholder", s.text.search.placeholder), r.appendChild(l), r.appendChild(o), s.text.search.label) {
var d = P("label", {
for: X + "Search",
html: s.text.search.label
});
l.setAttribute("id", X + "Search"), a.appendChild(d), a.appendChild(r), n += a.outerHTML + "
";
} else n += r.outerHTML + "
";
} else n = "";
return n;
},
Me = function Me(e, t) {
var n;
if (s.settings) {
n = "
");
var a = "
";
if (s.import) {
a += "", a += "";
}
s.print && (a += ""), s.column && (a += ""), a += y = '', n += (a += "
") + "
";
} else n = "";
return n;
},
_e = function _e(e) {
return "";
},
Ie = function Ie() {
if (ae.hasRows && S) {
var e,
n,
a = E - 1,
r = t.createDocumentFragment(),
o = x[a];
ae.hasHeadings && (V(h, L), _(ae.activeHeadings, function (t) {
s.select && _(t.children, function (a) {
a && a.classList.contains(i + "table-cmplx-select-all") && (e = a, n = t.originalCellIndex, o.selected ? (e.checked = !0, e.state = "checked") : (e.checked = !1, e.state = "unchecked"));
}), t.hasAttribute("data-sortable") && t.originalCellIndex != Y && t.setAttribute("aria-sort", "none"), h.appendChild(t);
}, this));
var l = 0;
_(o, function (t, a) {
t.removeAttribute("class");
var o = !1;
if (s.select && ae.data[t.dataIndex].cells[n].querySelector("input[type='checkbox']").checked && (t.classList.add("selected"), o = !0, l++ , e.checked || (e.indeterminate = !0, e.state = "indeterminate")), ae.classList.contains(i + "table-striped")) {
var d = a % 2 > 0 ? i + "table-cmplx-row-odd" : i + "table-cmplx-row-even";
t.classList.add(d);
}
if (r.appendChild(Ee().render(t)), s.expand) {
t.querySelector("." + i + "table-cmplx-accordion-btn").classList.add(i + "collapsed");
var c = ke(t, ae.headings.length, d, o);
c.children[0].classList.remove(i + "show"), r.appendChild(c);
}
}, this), s.select && (l === o.length ? (e.indeterminate = !1, e.checked = !0, e.state = "checked") : 0 === l && s.select && (e.indeterminate = !1, e.checked = !1, e.state = "unchecked"), ve(e.state)), ne.clear(r);
} else z && 0 == S ? ae.hasHeadings && (V(h, L), _(ae.activeHeadings, function (e) {
h.appendChild(e);
}, this)) : ne.clear();
ie || ze();
},
Pe = function Pe() {
I = [], ae.headings && ae.headings.length && _(ae.headings, function (e, t) {
if (I[t] = e.textContent, e.sortable = e.hasAttribute("data-sortable"), e.originalCellIndex = t, s.sort && e.sortable) {
var n = P("label", {
class: i + "table-cmplx-sorter",
html: e.textContent
});
e.textContent = "", e.setAttribute("tabindex", "0"), e.appendChild(n);
}
}), Fe();
},
He = function He(e) {
var t = 0;
return _(ae.activeHeadings, function (n) {
_(n.children, function (a) {
a.classList.contains(e) && (t = n.originalCellIndex);
});
}), t;
},
Oe = function Oe() {
if (s.select) {
var e = v.querySelector("#cmplxTablesActions");
e.addEventListener("keydown", function (e) {
if (13 == e.keyCode) {
e.preventDefault();
var t = e.target.querySelector("button");
t.innerHTML === s.text.delete ? he() : t.innerHTML !== s.text.exportCsv && t.innerHTML !== s.text.exportJson || pe(e.target);
}
}), e.addEventListener("mousedown", function (e) {
e.preventDefault();
var t = e.target;
t.innerHTML === s.text.delete ? he() : t.innerHTML !== s.text.exportCsv && t.innerHTML !== s.text.exportJson || pe(e.target);
});
}
if (s.search && (B = v.querySelector("." + i + "table-cmplx-search").querySelector("input[type=search]")) && (B.addEventListener("keyup", function (e) {
ne.search(B.value), e.preventDefault();
}, !1), B.addEventListener("mouseup", function (e) {
setTimeout(function () {
ne.search(B.value);
}, 100), e.preventDefault();
}, !1)), s.settings) {
var t = v.querySelector("." + i + "table-cmplx-settings");
if (s.column) {
var n = t.querySelector("button[aria-label='table settings columns']");
n.addEventListener("click", function (e) {
y.classList.contains(i + "show") ? y.classList.remove(i + "show") : (Be(), y.classList.add(i + "show"), y.addEventListener("click", function (e) {
var n = e.target;
if ("button" === n.nodeName.toLowerCase()) !function (e) {
if (e.innerHTML === s.text.cancel) y.classList.remove(i + "show"); else if (e.innerHTML === s.text.apply) {
if (y.orderChanged) {
for (var t = [], n = 0; n < we(); n++) {
t.push(n);
}
_(y.getElementsByTagName("ul"), function (e) {
_(e.children, function (e) {
_(ae.headings, function (n) {
e.querySelectorAll("label")[0].textContent === n.textContent && t.push(n.originalCellIndex);
});
});
}), y.orderChanged = !1, xe().order(t), ne.update();
}
_(y.getElementsByTagName("ul"), function (e) {
_(e.children, function (e) {
var t = e.querySelector("input[type='checkbox']");
t && t.checked ? _(ae.headings, function (t) {
e.querySelectorAll("label")[0].textContent === t.textContent && (xe().show([t.originalCellIndex]), ne.update());
}) : t && !t.checked && _(ae.headings, function (t) {
e.querySelectorAll("label")[0].textContent === t.textContent && (xe().hide([t.originalCellIndex]), ne.update());
});
}), z && ne.search(B.value);
}), re = !1, Pe(), y.classList.remove(i + "show");
}
}(n), t.querySelector("button[aria-label='table settings columns']").focus(); else if ("input" === n.nodeName.toLowerCase()) {
var a = y.querySelector("." + i + "btn-primary");
a.disabled && a.removeAttribute("disabled");
}
})), e.preventDefault();
}, !1);
}
if (s.print && (n = t.querySelector("button[aria-label='table settings print']")).addEventListener("click", function (e) {
ne.print(), e.preventDefault();
}, !1), s.import) {
var a = t.querySelector("." + i + "table-cmplx-file-import");
a.addEventListener("change", fe, !1), (n = t.querySelector("button[aria-label='table settings import']")).addEventListener("click", function (e) {
a.click(), e.preventDefault();
}, !1);
}
}
v.addEventListener("keydown", function (e) {
var t = e.target;
"th" === t.nodeName.toLowerCase() && 13 === e.keyCode && me(e, t), "button" === t.nodeName.toLowerCase() && 13 === e.keyCode && (ge(t), e.preventDefault());
}, !1), v.addEventListener("click", function (e) {
var t = e.target;
t.classList.contains(i + "table-cmplx-sorter") && me(e, t.parentNode), "button" === t.nodeName.toLowerCase() && (ge(t), e.preventDefault()), "input" === t.nodeName.toLowerCase() && "checkbox" === t.type && function (e) {
if (s.select && e.classList.contains(i + "table-cmplx-select-all")) {
if (ae.hasRows) {
var t = He(i + "table-cmplx-select-all"),
n = e.checked;
n && "indeterminate" !== e.state ? (e.state = "checked", n = !0) : (n = !1, e.checked = !1, e.state = "unchecked"), _(x[E - 1], function (a) {
if (1 != a.cells.length) {
var i = a.cells[t].querySelector("input[type='checkbox']"),
r = ae.data[a.dataIndex].cells[t].querySelector("input[type='checkbox']");
n ? (r.checked = i.checked = !0, ae.selectedRows.push(a.dataIndex), a.classList.add("selected"), s.expand && a.nextElementSibling.classList.add("selected"), e.state = "checked") : (r.checked = i.checked = !1, ae.selectedRows.pop(a.dataIndex), a.classList.remove("selected"), s.expand && a.nextElementSibling.classList.remove("selected"));
}
}), x[E - 1].selected = e.checked, ve(e.state);
} else e.checked = !1;
} else if (s.select && e.parentNode.classList.contains(i + "table-cmplx-row-select")) {
t = He(i + "table-cmplx-select-all");
var a = w(e, "tr");
if (e.checked) {
if (ae.data[a.dataIndex].cells[t].querySelector("input[type='checkbox']").checked = !0, a.classList.add("selected"), s.expand && a.nextElementSibling.classList.add("selected"), 0 === ae.selectedRows.length) ae.selectedRows.push(a.dataIndex); else {
for (var r = [], o = 0; o < ae.selectedRows.length; o++) {
var l = ae.selectedRows[o],
d = ae.selectedRows[o - 1],
c = ae.selectedRows[o + 1];
a.dataIndex < l && (void 0 === d || a.dataIndex > d) && -1 === r.indexOf(a.dataIndex) ? (r.push(a.dataIndex), r.push(l)) : a.dataIndex > l && (void 0 === c || a.dataIndex < c) && -1 === r.indexOf(a.dataIndex) ? (r.push(l), r.push(a.dataIndex)) : r.push(l);
}
r.length > 0 && (ae.selectedRows = r);
}
} else ae.data[a.dataIndex].cells[t].querySelector("input[type='checkbox']").checked = !1, a.classList.remove("selected"), s.expand && a.nextElementSibling.classList.remove("selected"), ae.selectedRows = ae.selectedRows.filter(function (e) {
if (e != a.dataIndex) return "" + e;
}), _(ae.activeHeadings[t].children, function (e) {
e && e.classList.contains(i + "table-cmplx-select-all") && (e.checked = !1);
});
var u = v.querySelector("." + i + "table-cmplx-select-all");
ae.selectedRows.length === s.perPage || ae.selectedRows.length === x[E - 1].length ? (u.indeterminate = !1, u.state = "checked", u.checked = !0) : ae.selectedRows.length > 0 ? (u.state = "indeterminate", u.indeterminate = !0) : (u.state = "unchecked", u.indeterminate = !1), ve(u.state);
}
}(t);
}, !1);
},
Re = function Re() {
_(ae.data, function (e) {
_(e.cells, function (e) {
e.data = e.innerHTML;
});
}), s.data.columns && ae.headings.length && _(s.data.columns, function (e) {
if (N(e.select) || (e.select = [e.select]), Object.prototype.hasOwnProperty.call(e, "render") && ("function" == typeof e.render || "string" == typeof e.render && window[e.render])) {
var t = parseInt(e.select) + we();
q = q.concat(t), T.push({
columns: t,
renderer: window[e.render]
});
}
_(e.select, function (t) {
var n = ae.headings[we() + t];
e.type && n.setAttribute("data-type", e.type), e.format && n.setAttribute("data-format", e.format), s.sort && (Object.prototype.hasOwnProperty.call(e, "sortable") && e.sortable && (n.setAttribute("data-sortable", ""), n.setAttribute("aria-sort", "none")), Object.prototype.hasOwnProperty.call(e, "sort") && (n.setAttribute("data-sortable", ""), n.setAttribute("aria-sort", "none"))), Object.prototype.hasOwnProperty.call(e, "fixed") && n.setAttribute("data-fixed", e.fixed), Object.prototype.hasOwnProperty.call(e, "control") && n.setAttribute("data-control", e.control), Object.prototype.hasOwnProperty.call(e, "hidden") && e.hidden && (xe().hide([we() + t]), ne.update()), Object.prototype.hasOwnProperty.call(e, "sort") && 1 == e.select.length && (Y = we() + e.select[0], xe().sort(Y, e.sort), ne.update(), k("Table", "SortEvent", ae, {
column: Y,
direction: "asc" === e.sort ? "ascending" : "descending",
currentPage: E,
perPage: s.perPage
}));
});
}), ae.hasRows && (_(ae.data, function (e, t) {
e.dataIndex = t, _(e.cells, function (e) {
e.data = e.innerHTML;
});
}), Se(), xe().rebuild(), ne.update()), Pe();
},
Be = function Be() {
V(y, L);
var e = P("div", {
class: i + "table-cmplx-column-cntr"
}),
t = P("ul");
if (_(ae.headings, function (n, a) {
if (a >= we() && (!n.dataset.fixed || "false" !== n.dataset.control)) {
var r, s;
n.dataset.fixed ? r = P("li", {
class: i + "table-cmplx-li"
}) : (r = P("li", {
class: i + "table-cmplx-drag-li",
draggable: !0
}), s = W([{
name: "handle",
show: !0
}]), ye(r), se.push(r));
var o = P("label", {
for: a,
class: i + "text-truncate"
}),
l = P("span");
if ("false" !== n.dataset.control) {
var d = P("input", {
id: a,
type: "checkbox"
});
d.checked = xe().visible(a), o.appendChild(d);
} else l.style.marginLeft = "1.75rem";
l.innerHTML = n.textContent, o.appendChild(l), s && r.appendChild(s), r.appendChild(o), t.appendChild(r), e.appendChild(t);
}
}), 0 === e.querySelectorAll("ul").length) {
var n = P("span", {
class: i + "text-wrap",
html: "Cannot rearrange or turn columns on/off."
});
e.appendChild(n);
}
var a = P("div", {
class: i + "row " + i + "no-gutters"
}),
r = P("button", {
class: i + "btn " + i + "btn-secondary",
html: s.text.cancel
}),
o = P("button", {
class: i + "btn " + i + "btn-primary",
html: s.text.apply,
disabled: ""
});
a.appendChild(r), a.appendChild(o), e.appendChild(a), y.appendChild(e);
},
Fe = function Fe() {
if (R = ae.getBoundingClientRect(), s.fixedColumns && ae.activeHeadings && ae.activeHeadings.length && !re) {
var e,
t = !1,
n = 0;
if (ae.tHead) {
_(ae.activeHeadings, function (e) {
e.style.maxWidth = "", e.style.width = "";
});
var a,
i = !1;
_(ae.activeHeadings, function (e, t) {
if (0 == t && s.expand && !a) a = !0, e.style.maxWidth = "20px", e.style.width = "20px", n += 20; else if (0 != t && 1 != t || !s.select || i) {
var r = e.offsetWidth / (R.width - n) * 100;
e.style.width = r + "%";
} else i = !0, e.style.maxWidth = "20px", e.style.width = "20px", n += 20;
});
} else {
e = [], t = P("thead");
var r = P("tr");
_(ae.tBodies[0].rows[0].cells, function () {
var t = P("th");
r.appendChild(t), e.push(t);
}), t.appendChild(r), ae.insertBefore(t, u);
var o = [];
_(e, function (e, t) {
if (0 == t && s.expand) n += 20; else if (0 != t && 1 != t || !s.select) {
var a = e.offsetWidth / (R.width - n) * 100;
o.push(a);
} else n += 20;
}, this), _(ae.data, function (e) {
_(e.cells, function (e, t) {
0 == t && s.expand ? e.style.width = "20px" : 0 != t && 1 != t || !s.select ? xe().visible(we() + e.cellIndex) && (e.style.width = o[t] + "%") : e.style.width = "20px";
}, this);
}, this), ae.removeChild(t);
}
re = !0;
}
},
ze = function ze() {
s.fixedHeight && (m.style.height = null, R = m.getBoundingClientRect(), m.style.height = R.height + "px"), ie = s.origPerPage <= ae.activeRows.length && s.perPage == s.origPerPage;
},
We = function We(e) {
var t = [];
if (D(e)) {
if (e.headings && !ae.hasHeadings && !ae.hasRows) {
var n,
a = P("tr");
_(e.headings, function (e) {
n = P("th", {
html: e
}), a.appendChild(n);
}), f.appendChild(a), h = a, ae.headings = [].slice.call(h.cells), ae.hasHeadings = !0;
}
e.rows && N(e.rows) && _(e.rows, function (n, a) {
for (var i = [], r = 0; r < I.length; r++) {
i.push(r);
}
var o = 0,
l = [];
if (s.expand && (l[0] = Ce().outerHTML, o++ , delete i[0]), s.select) {
var d = Ae().outerHTML;
s.expand ? (l[1] = d, o++ , delete i[1]) : (l[0] = d, o++);
}
_(n, function (t, n) {
var a;
e.headings ? (a = I.indexOf(e.headings[n]), delete i[a]) : a = n, a > -1 && (l[a] = t);
});
for (var c = 0; c < i.length; c++) {
i[c] && (l[i[c]] = "");
}
if (l.length == (e.headings ? I.length : o + I.length)) t.push(l); else {
var u = "Row found at index, [ " + a + " ] that did not match the current headers.";
console.error(u), k("Table", "Error", ae, {
msg: u
});
}
});
}
if (t.length) {
if (e.details ? Ee().add(t, e.details) : Ee().add(t), xe().rebuild(), z) {
var i = v.querySelector("input[type='search']").value;
ne.search(i);
} else !s.items > 0 && A.addItems(t.length);
ae.hasRows = !0;
}
Fe(), Se(), xe().rebuild(), ne.update(), ie || ze();
};
if (s.header || (s.sort = !1), null === ae.tHead && (!s.data || s.data && !s.data.headings) && (s.sort = !1), ae.tBodies.length && !ae.tBodies[0].rows.length && s.data && !s.data.rows) throw new Error("You seem to be using the data option, but you've not defined any rows.");
if (this.expandRow = function (e) {
var t = F(e, 0);
if ("number" == typeof t) {
var n = ae.activeRows[t].querySelector("." + i + "table-cmplx-accordion-btn");
ge(n);
}
return !1;
}, this.update = function () {
v.classList.remove(i + "table-cmplx-empty"), function () {
var e = s.perPage,
t = ae.activeRows;
z && (t = [], _(ae.searchData, function (e) {
t.push(ae.activeRows[e]);
}, this)), x = t.map(function (n, a) {
return a % e == 0 ? t.slice(a, a + e) : null;
}).filter(function (e) {
return e;
}), S = x.length;
}(), Ie(), ae.sorting = !1, Ee().update(), ae.hasRows ? (be(), ae.setAttribute("aria-rowcount", ae.activeRows.length)) : ae.setAttribute("aria-rowcount", 0), ae.setAttribute("aria-colcount", ae.activeHeadings.length), k("Table", "UpdateEvent", ae);
}, this.search = function (e) {
return !!ae.hasRows && (_(ae.activeRows, function (e) {
var t = e.querySelector("." + i + "table-cmplx-accordion-btn");
t && !t.classList.contains(i + "collapsed") && t.classList.add(i + "collapsed");
}), e = e.toLowerCase(), E = 1, z = !0, ae.searchData = [], e.length ? (this.clear(), _(ae.data, function (t, n) {
var a = ae.searchData.indexOf(t) > -1;
e.split(" ").reduce(function (e, n) {
for (var a = !1, i = null, r = we(); r < t.cells.length; r++) {
if (((i = t.cells[r]).hasAttribute("data-content") ? i.getAttribute("data-content") : i.textContent).toLowerCase().indexOf(n) > -1 && xe().visible(i.cellIndex)) {
a = !0;
break;
}
}
return e && a;
}, !0) && !a ? (t.searchIndex = n, ae.searchData.push(n)) : t.searchIndex = null;
}, this), v.classList.add("search-results"), ae.searchData.length ? this.update() : (v.classList.remove("search-results"), this.setMessage(s.labels.noRows)), A.setItems(ae.searchData.length), void k("Table", "SearchEvent", ae, {
query: e,
searchData: ae.searchData
})) : (z = !1, this.update(), A.setItems(ae.activeRows.length), k("Table", "SearchEvent", ae, {
query: e,
searchData: ae.searchData
}), v.classList.remove("search-results"), !1));
}, this.page = function (e) {
var t;
if ((t = isNaN(e) ? e : parseInt(e, 10)) == E || t > x.length || t < 0) return !1;
E = t, Ie(), be(), s.items > 0 && A.page(t), k("Table", "PageChangedEvent", ae, {
currentPage: E
});
}, this.perPage = function (e) {
var t, n, a;
t = isNaN(e.perPage) ? e.perPage : parseInt(e.perPage, 10), n = isNaN(e.page) ? e.page : parseInt(e.page, 10), a = isNaN(e.pages) ? e.perPage : parseInt(e.pages, 10), s.perPage != t && (s.perPage = t, S = a, E = n, this.update(), s.items > 0 && A.perPage(t), ie || ze());
}, this.refresh = function () {
s.search && (B.value = "", z = !1), E = 1, this.update(), k("Table", "RefreshEvent", ae);
}, this.clear = function (e) {
u && V(u, L);
var n = u;
if (u || (n = ae), e) if ("string" == typeof e) {
var a = t.createDocumentFragment();
a.innerHTML = e, n.appendChild(a);
} else n.appendChild(e);
}, this.export = function (e) {
if (!ae.hasHeadings && !ae.hasRows) return !1;
var t,
n,
a,
i,
r = ae.activeHeadings,
o = [],
l = [];
if (!D(e)) return !1;
var d = Le({
download: !0,
skipColumn: [],
lineDelimiter: "\n",
columnDelimiter: ",",
tableName: "myTable",
replacer: null,
space: 4
}, e);
return !(!d.type || (s.select ? _(ae.selectedRows, function (e) {
o = o.concat(ae.activeRows[e]);
}) : o = d.currentPage ? o.concat(x[E - 1]) : o.concat(ae.activeRows), !o.length)) && ("txt" === d.type || "csv" === d.type ? (o.unshift(h), a = "", _(o, function (e) {
for (n = 0; n < (s.exportDetails ? e.cells.length + 1 : e.cells.length); n++) {
var t;
n === e.cells.length ? (t = o.indexOf(e) > 0 ? ae.data[o.indexOf(e) - 1].details ? ae.data[o.indexOf(e) - 1].details : null : "Details") && ((t = (t = (t = (t = t.trim()).replace(/\s{2,}/g, " ")).replace(/\n/g, " ")).replace(/"/g, '""')).indexOf(",") > -1 && (t = '"' + t + '"'), a += t + d.columnDelimiter) : n < e.cells.length && d.skipColumn.indexOf(r[n].originalCellIndex) < 0 && xe(r[n].originalCellIndex).visible() && ((t = (t = (t = (t = (t = e.cells[n].getAttribute("data-content") ? e.cells[n].getAttribute("data-content") : e.cells[n].textContent).trim()).replace(/\s{2,}/g, " ")).replace(/\n/g, " ")).replace(/"/g, '""')).indexOf(",") > -1 && (t = '"' + t + '"'), a += t + d.columnDelimiter);
}
a = a.trim().substring(0, a.length - 1), a += d.lineDelimiter;
}), a = a.trim().substring(0, a.length - 1), d.download && (a = "data:text/csv;charset=utf-8," + a)) : "json" === d.type && (_(o, function (e, n) {
for (l[n] = l[n] || {}, t = 0; t < (s.exportDetails ? r.length + 1 : r.length); t++) {
t === r.length ? ae.data[o.indexOf(e)].details && (l[n].Details = ae.data[o.indexOf(e)].details) : t < e.cells.length && d.skipColumn.indexOf(r[t].originalCellIndex) < 0 && xe(r[t].originalCellIndex).visible() && (l[n][r[t].textContent] = e.cells[t].getAttribute("data-content") ? e.cells[t].getAttribute("data-content") : e.cells[t].textContent);
}
}), a = JSON.stringify(l, d.replacer, d.space), d.download && (a = "data:application/json;charset=utf-8," + a)), d.download && (d.filename = d.filename || "datatable_export", d.filename += "." + d.type, i = P("a", {
href: a = encodeURI(a),
download: d.filename
}), u.appendChild(i), i.click(), u.removeChild(i)), a);
}, this.import = function (e) {
var t = !1;
if (!D(e)) return !1;
if ((e = Le({
lineDelimiter: "\n",
columnDelimiter: ","
}, e)).data.length || D(e.data)) {
if ("csv" === e.type) {
t = {
rows: [],
details: [],
headings: []
};
var n = e.data.split(e.lineDelimiter);
if (n.length) if (e.skipColumn = [], e.details = -1, _(n[0].replace(/\r?\n|\r/g, "").split(e.columnDelimiter), function (n, a) {
I.indexOf(n) < 0 ? "Details" != n ? e.skipColumn.push(a) : e.details = a : t.headings.push(n);
}), t.headings) n.shift(), _(n, function (n, a) {
n = n.replace(/\r?\n|\r/g, ""), t.rows[a] = [], _(n.split(e.columnDelimiter), function (n, i) {
-1 == e.skipColumn.indexOf(i) && e.details != i ? t.rows[a].push(n) : e.details == i && (t.details[a] = n);
});
}); else {
var a = "Supplied text/csv file does not contain the correct Header row!";
console.error(a), k("Table", "Error", ae, {
msg: a
});
}
} else if ("json" === e.type) {
var i = M(e.data);
if (i) {
if (t = {
rows: [],
details: [],
headings: []
}, N(i)) {
var r = 0;
_(i, function (e) {
t.rows[r] = [], t.details[r] = "", _(e, function (e, n) {
I.indexOf(n) < 0 ? "Details" === n && (t.details[r] = e) : (t.headings.indexOf(n) < 0 && t.headings.push(n), t.rows[r].push(e));
}), r++;
});
} else a = "That's not valid JSON array data!", console.error(a), k("Table", "Error", ae, {
msg: a
});
} else a = "That's not valid JSON!", console.error(a), k("Table", "Error", ae, {
msg: a
});
} else {
if (!D(e.data)) return new Error("");
(t = e.data).details = [], _(t.rows, function (e, n) {
t.rows[n] = e.data, t.details.push(e.details);
});
}
t && We(t);
}
return !1;
}, this.print = function () {
var e = ae.activeHeadings,
t = ae.activeRows,
n = window.open(),
a = n.document,
i = a.createElement("table"),
r = a.createElement("thead"),
s = a.createElement("tbody"),
o = a.createElement("tr");
_(e, function (e) {
var t = a.createElement("th");
t.appendChild(a.createTextNode(e.textContent)), o.appendChild(t);
}), r.appendChild(o), _(t, function (e) {
var t = a.createElement("tr");
_(e.cells, function (e) {
var n = a.createElement("td");
n.appendChild(a.createTextNode(e.textContent)), t.appendChild(n);
}), s.appendChild(t);
}), i.appendChild(r), i.appendChild(s), a.body.appendChild(i), n.print();
}, this.setMessage = function (e) {
var t = I.length;
v.classList.add(i + "table-cmplx-empty"), this.clear(P("tr", {
html: '
' + e + "
"
})), ie || ze();
}, this.insertDetails = function (e, t) {
var n = ae.activeRows[e];
if ("ExpandCancelEvent" == n.event) return !1;
var a = !1;
ae.classList.contains(i + "table-striped") && (a = e % 2 > 0 ? i + "table-cmplx-row-odd" : i + "table-cmplx-row-even"), ae.data[e].details = n.details = t, ke(n, ae.headings.length, a);
var r = n.cells[0].querySelector("." + i + "table-cmplx-accordion-btn");
return _(n.cells[0].querySelectorAll("use"), function (e) {
-1 != e.getAttribute("xlink:href").indexOf(i + "loading-sqrs") ? O(e, i + "show") : (H(e, i + "show"), r.classList.remove(i + "collapsed"), r.setAttribute("aria-expanded", !0));
}), this.update(), k("Table", "ExpandEndEvent", ae, {
rowId: e
}), !0;
}, this.delete = function () {
if (0 == ae.selectedRows.length) return !1;
if (Ee().remove(ae.selectedRows), xe().rebuild(), A.removeItems(ae.selectedRows.length), s.items > 0 && (s.items -= ae.selectedRows.length), 0 == ae.activeRows.length) {
ae.hasRows = !1;
var e = h.cells[He(i + "table-cmplx-select-all")].querySelector("input[type='checkbox']");
e.checked && (e.checked = !1, e.state = "unchecked"), ve(e.state);
}
if (z) {
var t = v.querySelector("input[type='search']").value,
n = ae.searchData.length;
ae.searchData = [], z = !1, n == ae.selectedRows.length ? (v.querySelector("input[type='search']").value = "", this.update()) : this.search(t);
} else this.update();
ae.selectedRows = [], ae.hasRows || this.setMessage(s.labels.noRows), k("Table", "DeleteEvent", ae, {
rowIds: ae.selectedRows
});
}, this.deleteAll = function () {
if (0 == ae.data.length) return !1;
if (ae.data = [], x = [], E = 1, Ee().update(), xe().rebuild(), s.items = 0, s.perPage = s.origPerPage, A.setItems(0), ae.hasRows = !1, s.select) {
var e = h.cells[He(i + "table-cmplx-select-all")].querySelector("input[type='checkbox']");
(e.checked || "indeterminate" === e.state) && (e.click(), e.checked = !1, e.state = "unchecked"), ve(e.state);
}
z && (z = !1, v.querySelector("input[type='search']").value = ""), this.update(), this.setMessage(s.labels.noRows), k("Table", "DeleteAllEvent", ae);
}, this.setItems = function (e) {
var t = F(e);
if (!t || 0 != s.items) return !1;
s.items = t, A.setItems(s.items);
}, !("Table" in e)) {
var Ve = window.crypto || window.msCrypto;
if (J = Ve.getRandomValues(new Uint32Array(10))[0], s.text.search.label && (X = Ve.getRandomValues(new Uint32Array(10))[0]), ae.data = null, ae.hasRows = !1, ae.headings = [], ae.hasHeadings = !1, L = !!/(msie|trident)/i.test(navigator.userAgent), E = 1, T = [], q = [], ae.activeHeadings = [], ae.sorting = !1, ae.searchData = [], ae.hiddenColumns = [], s.select && (ae.selectedRows = []), function () {
var t = "";
if (s.data && function () {
var e = !1,
t = !1;
if (ae.data = ae.data || s.data, ae.data.headings) {
e = P("thead");
var n = P("tr");
if (s.expand) {
var a = P("th", {
title: "expand details"
});
n.appendChild(a), ae.expand = s.expand;
}
s.select && ((a = P("th")).appendChild(P("input", {
type: "checkbox",
class: i + "table-cmplx-select-all",
title: "select all rows"
})), n.appendChild(a), ae.select = s.select), _(ae.data.headings, function (e) {
var t = P("th", {
scope: "col",
html: e
});
n.appendChild(t);
}), e.appendChild(n);
}
ae.data.rows && ae.data.rows.length && (t = P("tbody"), _(ae.data.rows, function (e, n) {
if (e.dataIndex = n, ae.data.headings && s.data.headings.length !== e.data.length) throw new Error("Row found at index, [ " + n + " ] that does not match the number of headings supplied.");
var a = P("tr");
s.expand && a.appendChild(Ce()), s.select && a.appendChild(Ae()), _(e.data, function (e) {
var t = P("td", {
html: e
});
t.setAttribute("data-content", j(e)), a.appendChild(t);
}), t.appendChild(a), e.details && (a.details = e.details), s.expand && t.appendChild(ke(a, ae.headings.length));
})), e && (null !== ae.tHead && ae.removeChild(ae.tHead), ae.appendChild(e)), t && (ae.tBodies.length && ae.removeChild(ae.tBodies[0]), ae.appendChild(t));
}(), u = ae.tBodies[0], f = ae.tHead, u || (u = P("tbody"), ae.appendChild(u)), ae.hasRows = u.rows.length > 0, !f) {
var n = P("thead"),
a = P("tr");
ae.hasRows && (_(u.rows[0].cells, function () {
a.appendChild(P("th"));
}), n.appendChild(a)), f = n, ae.insertBefore(f, u);
}
ae.hasHeadings = f.rows.length > 0, ae.hasHeadings && (h = f.rows[0], ae.headings = [].slice.call(h.cells)), s.header || f && ae.removeChild(ae.tHead), v = P("div", {
class: i + "table-cmplx-wrapper"
}), s.layout.row1 && (t += Te(s.layout.row1)), s.layout.row2 && (t += Te(s.layout.row2)), t += "", t += "
", t += "
", ae.hasHeadings && Pe(), ae.classList.add(i + "table-cmplx"), v.innerHTML = t, m = v.querySelector("." + i + "table-cmplx-container"), g = v.querySelector("." + i + "table-cmplx-bottom"), s.pagination = !!b(e, ".dds__pagination"), s.pagination && (C = b(e, ".dds__pagination"), g.appendChild(C)), y = v.querySelector("[data-toggle='data-column-box']"), ae.parentNode.replaceChild(v, ae), m.appendChild(ae), R = ae.getBoundingClientRect(), ae.data = [], ae.activeRows = [];
var r = 0;
_(u.rows, function (e, t) {
s.expand ? t % 2 == 0 && (e.dataIndex = r++ , ae.activeRows.push(e), ae.data.push(e)) : (e.dataIndex = t, ae.activeRows.push(e), ae.data.push(e));
}, !0), ae.activeHeadings = ae.headings.slice(), ne.update(), Re(), Fe(), s.condensed && v.querySelector("." + i + "table-cmplx").classList.add(i + "condensed"), s.fixedHeight && (s.origPerPage > ae.activeRows.length ? ie = !1 : ze()), Oe();
}(), s.pagination) {
var je = s.items > 0 ? s.items : ae.activeRows.length;
A = new Q(C, {
perPageSelect: s.perPageSelect,
perPage: s.perPage,
items: je,
pageText: n.text && n.text.pageText,
itemsPerPageText: n.text && n.text.itemsPerPageText,
hidePages: n.hidePages,
external: 0 != s.items,
buttonLabelLeft: s.buttonLabelLeft,
buttonLabelRight: s.buttonLabelRight,
disablePaginationInput: s.disablePaginationInput,
showTotal: s.showTotal
}), 0 == s.items ? (C.parentNode.addEventListener("uicPaginationPageUpdateEvent", function (e) {
ne.page(e.detail.page);
}, !1), C.parentNode.addEventListener("uicPaginationPerPageUpdateEvent", function (e) {
ne.perPage(e.detail);
}, !1)) : (C.parentNode.addEventListener("uicPaginationPageChangeEvent", function (e) {
if (ae.activeRows.length < e.detail.page * e.detail.perPage) {
var t = e.detail.page * e.detail.perPage - ae.activeRows.length;
e.detail.page * e.detail.perPage > s.items && (t = s.items - ae.activeRows.length), t > 0 ? k("Table", "NewPageEvent", ae, {
page: e.detail.page,
rows: t
}) : ne.page(e.detail.page);
} else ne.page(e.detail.page);
}, !1), C.parentNode.addEventListener("uicPaginationPerPageChangeEvent", function (e) {
if (e.detail.page * e.detail.perPage > ae.activeRows.length) {
var t = e.detail.page * e.detail.perPage - ae.activeRows.length;
e.detail.page * e.detail.perPage <= s.items ? k("Table", "MoreRowsEvent", ae, {
page: e.detail.page,
perPage: e.detail.perPage,
rows: t
}) : ne.perPage(e.detail);
} else ne.perPage(e.detail);
}, !1));
}
s.condensed && v.querySelector("." + i + "table-cmplx").classList.add(i + "condensed"), _(v.querySelectorAll('[data-toggle="dds__dropdown"]'), function (e) {
e.classList.contains(i + "table-cmplx-action-button") && new K(e);
});
}
e.Table = ne;
}, e.Tooltip = function (e, n) {
e = _instanceof(e, HTMLElement) && e, (n = z(e, n = n || {})).title = e.dataset.title ? e.dataset.title : n.data_title ? n.data_title : null, n.animation = n.animation && "boolean" === n.animation ? n.animation : !(!n.animation || n.animation !== i + "fade") && i + "fade", n.placement = e.dataset.placement ? e.dataset.placement : n.data_placement ? n.data_placement : null, n.delay = e.dataset.delay ? F(e.dataset.delay, 60) : F(n.delay, 60), n.container = e.dataset.container ? e.dataset.container : n.container ? n.container : t.body, function () {
if (null == n.title) throw new Error("There was a problem found with title value, please correct and try again");
if (null == n.placement) throw new Error("There was a problem found with placement value, please correct and try again");
var t = w(e, "." + i + "modal-offcanvas");
if (t) n.container = t; else {
var a = w(e, ".fixed-top");
if (a) n.container = a; else {
var r = w(e, ".fixed-bottom");
r && (n.container = r);
}
}
}();
var r,
s,
o = this,
l = "onmouseleave" in t ? ["mouseenter", "mouseleave"] : ["mouseover", "mouseout"],
c = function c() {
a.addEventListener("resize", o.hide, !1), k("Tooltip", "Shown", e);
},
u = function u() {
a.removeEventListener("resize", o.hide), k("Tooltip", "Hidden", e);
};
this.show = function () {
setTimeout(function () {
r.setAttribute("style", ""), s.setAttribute("style", ""), A(e, r, n.placement, n.container, !0), !r.classList.contains(i + "show") && r.classList.add(i + "show"), k("Tooltip", "ShowEvent", e), n.animation ? S(r, c) : c();
}, n.delay);
}, this.hide = function (a) {
var s = t.activeElement;
a && (s = a.relatedTarget), !s !== r && r.contains(s) || setTimeout(function () {
r && r.classList.contains(i + "show") && (k("Tooltip", "HideEvent", e), r.classList.remove(i + "show"), n.animation ? S(r, u) : u());
}, n.delay);
}, this.toggle = function () {
r ? o.hide() : o.show();
}, "Tooltip" in e || (e.setAttribute("data-original-title", n.title), e.removeAttribute("title"), e.addEventListener(l[0], o.show, !1), e.addEventListener("focusin", o.show, !1), e.addEventListener(l[1], o.hide, !1), e.addEventListener("focusout", o.hide, !1), e.addEventListener("keydown", function (e) {
var t = e.which || e.keyCode;
27 === t ? o.hide(e) : 13 === t && o.show();
}, !1), d && f && (e.addEventListener("click", o.show, !1), e.addEventListener("blur", o.hide, !1)), r || (function () {
for (var e = n.title.replace(/[\s\W]/g, "").toLowerCase().substring(0, 15), a = e, o = 1; t.getElementById(a);) {
a = e + o, o++;
}
(r = P("div", {
role: "tooltip",
aria_describedby: a
})).style.top = "0px", s = P("div", {
class: i + "arrow " + i + "position-absolute " + i + "d-block"
}), r.appendChild(s);
var l = P("div", {
class: i + "tooltip-inner " + i + "text-center",
html: n.title,
id: a
});
r.appendChild(l), n.container.appendChild(r), r.setAttribute("class", i + "tooltip " + i + "bs-tooltip-" + n.placement + " " + n.animation + " " + i + "position-absolute " + i + "d-block " + i + "m-0 " + i + "break-word");
}(), r.addEventListener("mouseleave", o.hide, !1))), e.Tooltip = o;
}, e.handleFirstTab = T, e.loadURLSVGs = function (e, n) {
var a = function a(e) {
if (e.length > 0 && !Array.isArray(e) && (e = new Array(e)), !e || e.length < 1) return console.error("The File path(s) supplied were either empty or null."), !1;
var n, a, i;
Array.prototype.forEach.call(e, function (r) {
var s = new XMLHttpRequest();
s.addEventListener("error", function () {
console.error("The File path supplied [ " + e + " ] was invalid.");
}), s.addEventListener("load", function () {
4 == s.readyState && 200 == s.status && function (e) {
if (e.match(/
"); k.attr({ id: I, matches: "matches", active: "activeIdx", select: "select(activeIdx)", query: "query", position: "position" }), angular.isDefined(s.typeaheadTemplateUrl) && k.attr("template-url", s.typeaheadTemplateUrl); var H = function () { M.matches = [], M.activeIdx = -1 }, q = function (t) { return I + "-option-" + t }; M.$watch("activeIdx", function (t) { 0 > t ? c.removeAttr("aria-activedescendant") : c.attr("aria-activedescendant", q(t)) }); var U = function (t) { var e = { $viewValue: t }; v(l, !0), a.when(x.source(l, e)).then(function (a) { var i = t === d.$viewValue; if (i && u) if (a.length > 0) { M.activeIdx = b ? 0 : -1, M.matches.length = 0; for (var n = 0; n < a.length; n++)e[x.itemName] = a[n], M.matches.push({ id: q(n), label: x.viewMapper(M, e), model: a[n] }); M.query = t, M.position = $ ? o.offset(c) : o.position(c), M.position.top = M.position.top + c.prop("offsetHeight") } else H(); i && v(l, !1) }, function () { H(), v(l, !1) }) }; H(), M.query = void 0; var A, E = function (t) { A = i(function () { U(t) }, f) }, C = function () { A && i.cancel(A) }; d.$parsers.unshift(function (t) { return u = !0, t && t.length >= h ? f > 0 ? (C(), E(t)) : U(t) : (v(l, !1), C(), H()), m ? t : t ? void d.$setValidity("editable", !1) : (d.$setValidity("editable", !0), t) }), d.$formatters.push(function (t) { var e, a, i = {}; return g ? (i.$model = t, g(l, i)) : (i[x.itemName] = t, e = x.viewMapper(l, i), i[x.itemName] = void 0, a = x.viewMapper(l, i), e !== a ? e : t) }), M.select = function (t) { var e, a, n = {}; n[x.itemName] = a = M.matches[t].model, e = x.modelMapper(l, n), w(l, e), d.$setValidity("editable", !0), y(l, { $item: a, $model: e, $label: x.viewMapper(l, n) }), H(), i(function () { c[0].focus() }, 0, !1) }, c.bind("keydown", function (t) { 0 !== M.matches.length && -1 !== p.indexOf(t.which) && (-1 != M.activeIdx || 13 !== t.which && 9 !== t.which) && (t.preventDefault(), 40 === t.which ? (M.activeIdx = (M.activeIdx + 1) % M.matches.length, M.$digest()) : 38 === t.which ? (M.activeIdx = (M.activeIdx > 0 ? M.activeIdx : M.matches.length) - 1, M.$digest()) : 13 === t.which || 9 === t.which ? M.$apply(function () { M.select(M.activeIdx) }) : 27 === t.which && (t.stopPropagation(), H(), M.$digest())) }), c.bind("blur", function () { u = !1 }); var S = function (t) { c[0] !== t.target && (H(), M.$digest()) }; n.bind("click", S), l.$on("$destroy", function () { n.unbind("click", S), $ && _.remove() }); var _ = t(k)(M); $ ? n.find("body").append(_) : c.after(_) } } }]).directive("typeaheadPopup", function () { return { restrict: "EA", scope: { matches: "=", query: "=", active: "=", position: "=", select: "&" }, replace: !0, templateUrl: "template/typeahead/typeahead-popup.html", link: function (t, e, a) { t.templateUrl = a.templateUrl, t.isOpen = function () { return t.matches.length > 0 }, t.isActive = function (e) { return t.active == e }, t.selectActive = function (e) { t.active = e }, t.selectMatch = function (e) { t.select({ activeIdx: e }) } } } }).directive("typeaheadMatch", ["$http", "$templateCache", "$compile", "$parse", function (t, e, a, i) { return { restrict: "EA", scope: { index: "=", match: "=", query: "=" }, link: function (n, o, r) { var p = i(r.templateUrl)(n.$parent) || "template/typeahead/typeahead-match.html"; t.get(p, { cache: e }).success(function (t) { o.replaceWith(a(t.trim())(n)) }) } } }]).filter("typeaheadHighlight", function () { function t(t) { return t.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1") } return function (e, a) { return a ? ("" + e).replace(new RegExp(t(a), "gi"), "$&") : e } }), angular.module("ui.bootstrap.position", []).factory("$position", ["$document", "$window", function (t, e) { function a(t, a) { return t.currentStyle ? t.currentStyle[a] : e.getComputedStyle ? e.getComputedStyle(t)[a] : t.style[a] } function i(t) { return "static" === (a(t, "position") || "static") } var n = function (e) { for (var a = t[0], n = e.offsetParent || a; n && n !== a && i(n);)n = n.offsetParent; return n || a }; return { position: function (e) { var a = this.offset(e), i = { top: 0, left: 0 }, o = n(e[0]); o != t[0] && (i = this.offset(angular.element(o)), i.top += o.clientTop - o.scrollTop, i.left += o.clientLeft - o.scrollLeft); var r = e[0].getBoundingClientRect(); return { width: r.width || e.prop("offsetWidth"), height: r.height || e.prop("offsetHeight"), top: a.top - i.top, left: a.left - i.left } }, offset: function (a) { var i = a[0].getBoundingClientRect(); return { width: i.width || a.prop("offsetWidth"), height: i.height || a.prop("offsetHeight"), top: i.top + (e.pageYOffset || t[0].documentElement.scrollTop), left: i.left + (e.pageXOffset || t[0].documentElement.scrollLeft) } }, positionElements: function (t, e, a, i) { var n, o, r, p, l = a.split("-"), c = l[0], s = l[1] || "center"; n = i ? this.offset(t) : this.position(t), o = e.prop("offsetWidth"), r = e.prop("offsetHeight"); var d = { center: function () { return n.left + n.width / 2 - o / 2 }, left: function () { return n.left }, right: function () { return n.left + n.width } }, u = { center: function () { return n.top + n.height / 2 - r / 2 }, top: function () { return n.top }, bottom: function () { return n.top + n.height } }; switch (c) { case "right": p = { top: u[s](), left: d[c]() }; break; case "left": p = { top: u[s](), left: n.left - o }; break; case "bottom": p = { top: u[c](), left: d[s]() }; break; default: p = { top: n.top - r, left: d[s]() } }return p } } }]), angular.module("ui.bootstrap.bindHtml", []).directive("bindHtmlUnsafe", function () { return function (t, e, a) { e.addClass("ng-binding").data("$binding", a.bindHtmlUnsafe), t.$watch(a.bindHtmlUnsafe, function (t) { e.html(t || "") }) } }), angular.module("template/typeahead/typeahead-match.html", []).run(["$templateCache", function (t) { t.put("template/typeahead/typeahead-match.html", '') }]), angular.module("template/typeahead/typeahead-popup.html", []).run(["$templateCache", function (t) { t.put("template/typeahead/typeahead-popup.html", '
\n
\n \n
\n
\n') }]);;
var emailTypeahead = angular.module('emailTypeahead', ['ui.bootstrap']);;
emailTypeahead
.controller('emailTypeaheadCtrl', ['$scope', function ($scope) {
var _this = this;
var emailDomains = [];
var suggestionsProp = '';
var inputProp = '';
function setSuggestions(suggestions) {
$scope[suggestionsProp] = suggestions;
}
function calculateSuggestions(newValue) {
var suggestions;
if (newValue && newValue.indexOf('@') >= 0
&& newValue.indexOf('@') < newValue.length - 1) {
var inputDomain = newValue.substr(newValue.indexOf('@') + 1).toLowerCase();
suggestions = emailDomains.filter(function (domain) {
return domain.toLowerCase().indexOf(inputDomain) === 0 && domain.length > inputDomain.length;
});
suggestions = suggestions.map(function (suggestion) {
var inputUsername = newValue.substring(0, newValue.indexOf('@'));
return inputUsername + '@' + suggestion;
});
}
else {
suggestions = [];
}
setSuggestions(suggestions);
}
_this.calculateSuggestions = calculateSuggestions;
_this.init = function (domains, suggestions, input) {
emailDomains = domains || [];
suggestionsProp = suggestions;
inputProp = input;
setSuggestions([]);
$scope.$watch(inputProp, function (newValue) {
calculateSuggestions(newValue)
});
};
}]);;
emailTypeahead
.directive("emailTypeahead", ['$parse', function ($parse) {
return {
restrict: 'A',
controller: 'emailTypeaheadCtrl',
link: function (scope, element, attrs, ctrl) {
var emailDomains = $parse(attrs['emailDomains'])(scope);
var suggestionsProp = attrs['emailSuggestions'];
var inputProp = attrs['ngModel'];
ctrl.init(emailDomains, suggestionsProp, inputProp);
var ngModelController = element.controller('ngModel');
element.bind('input', function (evt) {
ngModelController.$setViewValue(element.val());
ctrl.calculateSuggestions(element.val());
});
}
};
}]);;
var tabbedPaymentTypes = angular.module('tabbedPaymentTypes', []);;
tabbedPaymentTypes
.value('showTabs', {
lg: 5,
md: 5,
sm: 5,
xs: 3
});;
tabbedPaymentTypes
.controller('tabbedPaymentTypesCtrl', [
'$scope', 'showTabs', 'googlePayService',
'paymentsFilterationService',
'cartConstants', 'applePayService', 'featureService', 'corePaymentsService',
function ($scope, showTabs, googlePayService,
paymentsFilterationService, cartConstants, applePayService, featureService, corePaymentsService) {
var _this = this;
function filterAvailablePaymentOptions(paymentOptions) {
var visiblePaymentOptions = [],
hasSavedPayments,
ccIndex = null;
paymentsFilterationService
.filterNoncompatiblePaymentOptions(
paymentOptions,
cartConstants.PayCode.gPay,
googlePayService.getReadytoPayState());
paymentsFilterationService
.filterNoncompatiblePaymentOptions(
paymentOptions,
cartConstants.PayCode.aPay,
applePayService.getApayState());
// Map out visiblePaymentOptions without IsHidden items.
for (var i = 0; i < paymentOptions.length; i++) {
var option = paymentOptions[i];
if (option.IsHidden) {
continue;
}
if (option.PayCode === "SAVED") {
hasSavedPayments = true;
}
// If there's saved cards we need to
// remember this node to change it's label.
if (option.PayCode === "CC") {
ccIndex = visiblePaymentOptions.length;
}
visiblePaymentOptions.push(option);
}
if (hasSavedPayments && ccIndex !== null) {
visiblePaymentOptions[ccIndex].Label = $scope.addCreditCardLabel;
}
return visiblePaymentOptions;
}
var availablePaymentOptions = filterAvailablePaymentOptions($scope.availablePaymentOptions);
var setSubHeadlabel = function () {
for (var i = 0; i < availablePaymentOptions.length; i++) {
var option = availablePaymentOptions[i];
if (option.PayCode === $scope.selectedPaymentOption)
$scope.subheadLabel = option.Label;
}
};
function setTabsArray(mediaQuery) {
setTabsArray.lastMediaQuery = mediaQuery;
$scope.removeMoreTabPaymentOption = featureService.IsEnabled("RemoveMoreTabPaymentOption");
var tabsArry = [],
dropDownArry = [],
maxTabsAllowed = showTabs[mediaQuery],
moreTabNeeded = availablePaymentOptions.length > maxTabsAllowed && !$scope.removeMoreTabPaymentOption,
paymentTabsCountBeforeMore = moreTabNeeded ? maxTabsAllowed - 1 : availablePaymentOptions.length,
doesMoreTabRequireNewBadge = false;
for (var i = 0; i < paymentTabsCountBeforeMore; i++) {
tabsArry.push(availablePaymentOptions[i]);
}
if (moreTabNeeded) {
tabsArry.push({
isMoreTab: true
});
for (var i = paymentTabsCountBeforeMore; i < availablePaymentOptions.length; i++) {
dropDownArry.push(availablePaymentOptions[i]);
if (!doesMoreTabRequireNewBadge && availablePaymentOptions[i].IsRequiredToShowNewBadge) {
doesMoreTabRequireNewBadge = true;
}
}
}
$scope.tabsModel = {
tabsArry: tabsArry,
dropDownArry: dropDownArry,
cssMediaClass: "bp-" + mediaQuery,
doesMoreTabRequireNewBadge: doesMoreTabRequireNewBadge
};
}
$scope.$watch("availablePaymentOptions",
function (newValue) {
availablePaymentOptions = filterAvailablePaymentOptions(newValue);
setTabsArray(setTabsArray.lastMediaQuery);
}, true);
// Tab click passthrough
$scope.selectPaymentType = function (payCode, isMore, subheadLabel) {
// This calls the function in the parent scope via attr to isolated scope
$scope.showPaymentView({ payCode: payCode });
$scope.moreTabSelected = (isMore) ? true : false;
$scope.subheadLabel = subheadLabel;
};
$scope.moreTabSelected = false;
_this.MappedPaymentOptionByScreenWidth = function (mediaQuery) {
setTabsArray(mediaQuery);
};
$scope.$watch('selectedPaymentOption', function (newValue, oldValue, scope) {
var shouldSelect = false;
for (var i = 0; i < scope.tabsModel.dropDownArry.length; i++) {
if (newValue === scope.tabsModel.dropDownArry[i].PayCode) {
shouldSelect = true;
break;
}
}
$scope.moreTabSelected = shouldSelect;
setSubHeadlabel();
});
$scope.showMessage = function () {
var showCcBanner = false;
if ($scope.selectedPaymentOption === "SAVED" && featureService.IsEnabled("EnableCCTokenization")
&& $scope.savedPaymentErrorMessage ) {
showCcBanner = $scope.getCCInformationBanner();
}
return $scope.showDelayedWarning() || $scope.showPaymentRedirectionMessage() || showCcBanner;
};
$scope.showDelayedWarning = function () {
return $scope.showThirdPartyDelayedDeliveryWarningForPayment
&& $scope.thirdPartyDelayedDeliveryMessage
&& $scope.showMessageForSelectedPayCode($scope.thirdPartyDelayedDeliveryWarningEnabledPayCodes);
};
$scope.showPaymentRedirectionMessage = function () {
return $scope.showThirdPartyPaymentRedirectionMessage
&& $scope.thirdPartyPaymentRedirectionMessage
&& $scope.showMessageForSelectedPayCode($scope.thirdPartyPaymentRedirectionMessageEnabledPayCodes);
};
$scope.getCCInformationBanner = function () {
return corePaymentsService.showCCInformationBanner();
};
$scope.showMessageForSelectedPayCode = function (enabledPayCodes) {
if ($scope.selectedPaymentOption && $scope.selectedPaymentOption.trim().length > 0) {
if (enabledPayCodes && enabledPayCodes.length > 0) {
var payCodes = enabledPayCodes.toLowerCase().split("|");
return payCodes.indexOf($scope.selectedPaymentOption.toLowerCase()) > -1;
}
}
return false;
};
setSubHeadlabel();
}]);
;
/*global cartApp*/
cartApp.service('googlePayAddressMapperService', ['globalizationService', 'errorLoggingService', 'cartConstants', function (globalizationService, errorLoggingService, cartConstants) {
var mapAddress,
nameType = {
FirstName: "FN",
MiddleName: "MN",
LastName: "LN"
};
mapAddress = function (gpayAddress, contactType, email) {
var address = getAddress(gpayAddress, contactType);
if (address && email) {
address.Email = email;
}
if (address.LastName == null) {
errorLoggingService.logInfo("Google Pay | Last name is null in " + contactType, cartConstants.ErrorCodes.googlePayErrorCode);
}
return address;
}
function getAddress(gPayAddress, contactType) {
var address = null;
if (gPayAddress) {
var nameSplit = gPayAddress.name.split(' ');
address = {
FirstName: getName(nameSplit, nameType.FirstName),
MiddleInitial: getName(nameSplit, nameType.MiddleName),
LastName: getName(nameSplit, nameType.LastName),
Line1: gPayAddress.address1,
Line2: gPayAddress.address2,
Line3: gPayAddress.address3,
City: gPayAddress.locality,
State: gPayAddress.administrativeArea,
Country: globalizationService.getDellCountryCode(gPayAddress.countryCode),//need this, as our backend doestnot use iso code for some countries . eg UK instead of GB
PostalCode: gPayAddress.postalCode,
Phone: getPhoneNumber(gPayAddress),
ContactType: contactType
}
}
return address;
}
function getName(nameSplit, type) {
if (nameSplit && nameSplit.length > 0) {
switch (type) {
case nameType.FirstName:
var firstName;
if (nameSplit.length > 2) {
angular.forEach(nameSplit, function (val, index) {
if (index != nameSplit.length - 1) {
if (firstName) {
firstName += " " + val;
}
else {
firstName = val;
}
}
});
}
else {
firstName = nameSplit[0] || null;
}
return firstName;
case nameType.MiddleName:
return null;
case nameType.LastName:
return nameSplit.length > 1 ? nameSplit[nameSplit.length - 1] : null;;
}
}
return null;
}
function getPhoneNumber(address) {
var phone = {};
var phoneNumberMaxLength = globalizationService.getPhoneNumberMaxLength();;
phoneNumberMaxLength =
(isNaN(phoneNumberMaxLength) ?
parseInt(phoneNumberMaxLength) :
phoneNumberMaxLength) || 10;
if (address && address.phoneNumber && !isNaN(phoneNumberMaxLength)) {
var formattedPhoneNumber = (typeof address.phoneNumber === 'string') ?
address.phoneNumber.replace(/\D/g, '') :
address.phoneNumber.toString();
if (formattedPhoneNumber.length >= phoneNumberMaxLength) {
var splitLength = formattedPhoneNumber.length - phoneNumberMaxLength;
phone.PhoneNumber = formattedPhoneNumber.substr(splitLength);
phone.AreaCode = formattedPhoneNumber.substr(0, splitLength) || null;
}
else {
phone = {
AreaCode: null,
PhoneNumber: formattedPhoneNumber
};
}
}
return phone;
}
return {
mapAddress: mapAddress
};
}
]); ;
/*global cartApp*/
(function () {
'use strict';
cartApp.service('googlePayService', [
'cartConstants', '$filter',
'corePaymentsService', 'applyPaymentService',
'googlePayAddressMapperService', 'globalizationService',
'errorLoggingService', 'contentsService', 'featureService',
function (
cartConstants, $filter,
corePaymentsService, applyPaymentService,
googlePayAddressMapperService, globalizationService,
errorLoggingService, contentsService, featureService) {
var googlePayClient, init, createAndAddButton,
isGpayInitialized, getReadytoPayState,
gPayConfiguration, allowedNetworks, allowedAuthMethods,
baseCardPaymentMethod, googlePayBaseConfiguration,
tokenizationSpecification, cardPaymentMethod, merchantInfo,
paymentDataRequest, $scope, $rootScope,
buttonCreationStatus = {}, readytoPayState = false,
isComponentInitialized = false, isExpressCheckout,
clientSideAlerts, verifyGpayDeviceCompatablity,
resetAndCreateButton, orderTotalCallback, isGPayAvailableInPaymentOptions = false,
contactType = {
shipping: "SHIPPING",
billing: "BILLING"
};
init = function (scope, rootscope, isExpress) {
//To prevent reinitialization on Gpay tab revisit
if (!isComponentInitialized) {
isExpressCheckout = isExpress;
$scope = scope;
$rootScope = rootscope;
if ($scope.AvailablePaymentOptions &&
$filter('filter')($scope.AvailablePaymentOptions, { PayCode: cartConstants.PayCode.gPay }, true)[0]) {
isGPayAvailableInPaymentOptions = true;
}
if (featureService.IsEnabled("GPayExpress") || isGPayAvailableInPaymentOptions) {
if (window.google) {
retriveGPayConfig();
configureGPay();
googlePayClient = new google.payments.api.PaymentsClient({
environment: gPayConfiguration.environment,
paymentDataCallbacks: getPaymentCallbacks()
});
applyPaymentService.init($scope, $rootScope)
$scope.DisableThirdPartyPaymentButton = false;
isComponentInitialized = true;
}
else {
logError("Google script - Pay.js is not available");
}
}
}
}
getReadytoPayState = function () {
//This is to retrive ready to pay state
return readytoPayState;
}
createAndAddButton = function (buttonIds, orderDetailsCallback) {
if (buttonIds === undefined ||
buttonIds === null ||
buttonIds.length === 0) {
logError('Button details are not available to create Gpay button.');
return;
}
orderTotalCallback = orderDetailsCallback;
angular.forEach(buttonIds, function (id) {
createButton(id);
});
if (document.getElementsByClassName("gpay-card-info-iframe").length > 0) {
$(".gpay-card-info-iframe").attr("aria-hidden", "true");
}
};
isGpayInitialized = function () {
return isComponentInitialized;
};
verifyGpayDeviceCompatablity = function (callback) {
if (isComponentInitialized) {
googlePayClient.isReadyToPay(googlePayBaseConfiguration)
.then(function (response) {
if (response.result) {
setGpayState(response);
if (angular.isFunction(callback)) {
callback();
}
} else {
logError("Unable to pay using Google Pay");
}
})
.catch(function (err) {
logError("Error determining readiness to use Google Pay: " + JSON.stringify(err));
});
}
};
resetAndCreateButton = function (buttonIds, callback) {
var resetStatus = false;
angular.forEach(buttonIds, function (id) {
var node = document.getElementById(id);
if (node && node.childElementCount === 0) {
buttonCreationStatus[id] = false;
resetStatus = true;
}
});
if (resetStatus) {
verifyGpayDeviceCompatablity(callback)
}
};
function isExpress() {
return isExpressCheckout || false;
};
function getPaymentCallbacks() {
var callbacks = {
onPaymentAuthorized: onPaymentAuthorized
};
if (isExpress()) {
callbacks.onPaymentDataChanged = onPaymentDataChanged
}
return callbacks;
};
function getCallbackIntents() {
var callbackIntents = [];
if (isExpress()) {
callbackIntents.push("SHIPPING_ADDRESS");
}
if (gPayConfiguration.callbackIntents && gPayConfiguration.callbackIntents.authorization) {
callbackIntents.push(gPayConfiguration.callbackIntents.authorization);
}
else {
logError("authorization callback intent is not available in gPayConfiguration - " + JSON.stringify(gPayConfiguration));
}
return callbackIntents;
};
function getGoogleShippingAddressParameters() {
return {
allowedCountryCodes: [globalizationService.getIsoCountryCode().toUpperCase()],
phoneNumberRequired: true //Todo-gpay: get it from gpay configuration
};
};
function onPaymentDataChanged(intermediatePaymentData) {
return new Promise(function (resolve, reject) {
var paymentDataRequestUpdate = {};
paymentDataRequestUpdate.newTransactionInfo = paymentDataRequest.transactionInfo;
resolve(paymentDataRequestUpdate);
});
}
function setGpayState(response) {
if (response && response.result) {
readytoPayState = response.result;
}
};
function retriveGPayConfig() {
var vendorData =
$filter('filter')($scope.DataModel.ThirdPartyPaymentVendorDatas || {},
{ Paycode: cartConstants.PayCode.gPay }, true)[0];
if (vendorData && vendorData.ScriptData) {
try {
gPayConfiguration = JSON.parse(vendorData.ScriptData);
clientSideAlerts = vendorData.ClientSideAlerts
} catch (e) {
logError("Error parsing Googlepay configuration - " + e);
}
}
else {
logError("Unable to retrive Gpay configuration from ThirdPartyPaymentVendorData - " +
JSON.stringify($scope.DataModel.ThirdPartyPaymentVendorDatas));
}
};
function configureGPay() {
if (gPayConfiguration) {
//This configures gpay
allowedNetworks = gPayConfiguration.availableCards;
allowedAuthMethods = gPayConfiguration.allowedAuthMethods
baseCardPaymentMethod = {
type: gPayConfiguration.baseCardPaymentMethod.type,
parameters: {
allowedCardNetworks: allowedNetworks,
allowedAuthMethods: allowedAuthMethods
}
};
googlePayBaseConfiguration = {
apiVersion: parseInt(gPayConfiguration.apiVersion),
apiVersionMinor: parseInt(gPayConfiguration.apiVersionMinor),
allowedPaymentMethods: [baseCardPaymentMethod]
};
tokenizationSpecification = {
type: gPayConfiguration.tokenizationSpecification.type,
parameters: gPayConfiguration.tokenizationSpecification.parameters
};
cardPaymentMethod = {
type: gPayConfiguration.baseCardPaymentMethod.type,
tokenizationSpecification: tokenizationSpecification,
parameters: {
allowedCardNetworks: allowedNetworks,
allowedAuthMethods: allowedAuthMethods,
billingAddressRequired: isExpress(),
billingAddressParameters: {
format: "FULL",
phoneNumberRequired: isExpress()
}
}
};
merchantInfo = {
merchantId: gPayConfiguration.merchantInfo.merchantId,
merchantName: gPayConfiguration.merchantInfo.merchantName
};
paymentDataRequest = Object.assign({}, googlePayBaseConfiguration, {
allowedPaymentMethods: [cardPaymentMethod],
merchantInfo: merchantInfo,
shippingAddressRequired: isExpress(),
callbackIntents: getCallbackIntents(),
shippingAddressParameters: getGoogleShippingAddressParameters(),
transactionInfo: getGoogleTransactionInfo(),
emailRequired: true
});
}
else {
logError("Unable to configure google pay client. Gpay Configuration is not available.");
}
};
function createButton(id) {
var node = document.getElementById(id);
buttonCreationStatus = buttonCreationStatus === undefined ? handleNullReference(node) : buttonCreationStatus;
//This is to prevert creating button again once created
if (!buttonCreationStatus[id]) {
var googlePayButton = googlePayClient.createButton({
buttonColor: gPayConfiguration.buttonColor,
buttonType: getButtonType(gPayConfiguration.buttonType),
onClick: onGooglePaymentsButtonClicked
});
node.appendChild(googlePayButton);
buttonCreationStatus[id] = true
}
};
function getButtonType(buttonConfig) {
var defaultType = 'long';
var buttonType;
if (buttonConfig) {
buttonType = isExpress() ? buttonConfig.express : buttonConfig.regular
}
return buttonType || defaultType;
}
function handleNullReference(node) {
//This is a race condition which we don't expect to happen
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
return {};
};
function getGoogleTransactionInfo() {
return {
countryCode: globalizationService.getIsoCountryCode().toUpperCase(),
currencyCode: gPayConfiguration.currency.toUpperCase(),
totalPriceStatus: getPriceStatus()
};
};
function getPriceStatus() {
var priceStatus;
if (gPayConfiguration.priceStatus) {
priceStatus = isExpress() ? gPayConfiguration.priceStatus.express : gPayConfiguration.priceStatus.regular;
}
return priceStatus || "ESTIMATED";
}
function onGooglePaymentsButtonClicked() {
if ($scope.enableBTOStopSellCheckOnCtaClick) {
var loadingSpinner = $rootScope.loadingScreen.clone().appendTo($('body')).show();
contentsService.CheckForEoledItem().then(function(result) {
loadingSpinner.hide();
if (result && result.status && result.status === 200) {
result.ctaSource = "GooglePayCheckoutCta";
$scope.$broadcast('ShowEolItemsMessage', result);
} else {
googlePaymentsButtonClicked();
}
},
function (error) {
loadingSpinner.hide();
if ($scope.ShowEmptyCartIdErrorMessage && error.status === 400) {
$scope.$broadcast('ShowEmptyCartIdMessage', error);
} else {
googlePaymentsButtonClicked();
}
});
} else {
googlePaymentsButtonClicked();
}
}
function googlePaymentsButtonClicked() {
//Todo-gpay: Log transaction id
if (paymentDataRequest && paymentDataRequest.transactionInfo) {
paymentDataRequest.transactionInfo.totalPrice = orderTotalCallback()
paymentDataRequest.transactionInfo.transactionId =
(((new Date()).getTime()) * Math.floor(Math.random() * 100)).toString();
var checkoutPath = isExpress() ? "Express Checkout" : "Regular Checkout";
errorLoggingService.logInfo("Googlepay | User opted gpay in " + checkoutPath +
"with transcation ID :" + paymentDataRequest.transactionInfo.transactionId,
cartConstants.ErrorCodes.googlePayErrorCode);
googlePayClient
.loadPaymentData(paymentDataRequest)
.then(function (paymentData) {
}).catch(function (err) {
toggleGpayButton(false);
if (!err ||
!err.statusCode ||
err.statusCode.toUpperCase() !== "CANCELED") {
alertAndLogError(err);
}
else {
errorLoggingService.logInfo("Googlepay | User cancelled gpay. Transcation ID :" +
paymentDataRequest.transactionInfo.transactionId,
cartConstants.ErrorCodes.googlePayErrorCode);
}
});
}
else {
var error = "Unable to open GPay Popup. Invalid paymentDataRequest - "
+ JSON.stringify(paymentDataRequest);
alertAndLogError(error);
}
}
function toggleGpayButton(isDisabled) {
$scope.DisableThirdPartyPaymentButton = isDisabled;
if (!$scope.$$phase) {
$scope.$apply();
}
}
function onPaymentAuthorized(paymentData) {
return new Promise(function (resolve, reject) {
processPayment(paymentData)
.then(function () {
resolve({ transactionState: 'SUCCESS' });
})
.catch(function (error) {
resolve({
transactionState: 'ERROR',
error: {
intent: 'PAYMENT_AUTHORIZATION',
message: error.message,
reason: 'PAYMENT_DATA_INVALID'
}
});
});
});
};
function processPayment(paymentData) {
//Todo-gpay: Handle success and failure. Its dummy handler for to pass through.
return new Promise(function (resolve, reject) {
setTimeout(function () {
internalProcessPayment(paymentData);
resolve({});
}, 800);
});
};
function expressPostFailureHandler(data) {
alertAndLogError(data);
}
function internalProcessPayment(googlePaymentData) {
var paymentData = {
Amount: globalizationService.getAmountInCurrentLocaleFormat(paymentDataRequest.transactionInfo.totalPrice),
PayCode: cartConstants.PayCode.gPay,
SecureToken: googlePaymentData.paymentMethodData.tokenizationData.token,
CardNumber: googlePaymentData.paymentMethodData.info.cardDetails,
TransactionId: paymentDataRequest.transactionInfo.transactionId,
WalletEmail: googlePaymentData.email
};
errorLoggingService.logInfo("Googlepay | User successfully authenticate gpay. Transcation ID :" +
paymentData.TransactionId,
cartConstants.ErrorCodes.googlePayErrorCode);
try {
if (isExpress()) {
toggleGpayButton(true);
paymentData.BillingContact = googlePayAddressMapperService.mapAddress(googlePaymentData.paymentMethodData.info.billingAddress, contactType.billing, googlePaymentData.email);
paymentData.ShippingContact = googlePayAddressMapperService.mapAddress(googlePaymentData.shippingAddress, contactType.shipping, googlePaymentData.email);
paymentData.IsExpress = true;
paymentData.LandingUrl = $scope.AdditionalParams.ThreeDSecureLandingUrl;
var postData = {
PendingPayment: paymentData
};
applyPaymentService.applyThirdPartyExpressPayment(postData, expressPostFailureHandler);
}
else {
corePaymentsService.updatePendingPayment(paymentData);
applyPaymentService.applyPayment();
}
} catch (e) {
alertAndLogError(e);
}
};
//We need to refactor and put as new service if this logic expands
function alertAndLogError(error) {
$scope.DisableThirdPartyPaymentButton = false;
var paymentProcessorError = $filter('filter')(clientSideAlerts || {},
{ Id: cartConstants.ClientAlertIds.paymentProcessorError }, true)[0];
if (paymentProcessorError) {
var alert = $filter('filter')($scope.DataModel.Alerts || {},
{ Id: paymentProcessorError.Id }, true)[0];
if (alert === undefined) {
$scope.DataModel.Alerts.push({
Id: paymentProcessorError.Id,
Title: paymentProcessorError.Title,
HtmlMessage: paymentProcessorError.HtmlMessage
});
}
}
logError(error);
if (!$scope.$$phase) {
$scope.$apply();
}
};
//Todo-gpay: Make sure that its captured in splunk
function logError(error) {
errorLoggingService.logError(error, cartConstants.ErrorCodes.googlePayErrorCode);
};
return {
init: init,
createAndAddButton: createAndAddButton,
getReadytoPayState: getReadytoPayState,
isGpayInitialized: isGpayInitialized,
verifyGpayDeviceCompatablity: verifyGpayDeviceCompatablity,
resetAndCreateButton: resetAndCreateButton
};
}
]);
}());;
/*global cartApp*/
(function () {
'use strict';
cartApp.service('applePayHelperService', ['$filter', 'globalizationService', 'cartConstants', 'errorLoggingService', 'contentsService',
function ($filter, globalizationService, cartConstants, errorLoggingService, contentsService) {
var getShippingContactErrors;
var getBillingContactErrors;
var aPayConfiguration;
var aPayValidationMessages;
var lineItems = [], previousPostalCode;
var getScope;
var code = {
shippingContactInvalid: "shippingContactInvalid",
billingContactInvalid: "billingContactInvalid"
}
var contactField = {
name: "name",
locality: "locality",
administrativeArea: "administrativeArea",
country: "country",
emailAddress: "emailAddress",
postalCode: "postalCode",
phoneNumber: "phoneNumber"
}
function getShippingContactErrors(shippingContact) {
var errors = getContactErrors(code.shippingContactInvalid, shippingContact);
var validationFields = aPayConfiguration.fieldsToValidate.split('|');
var emailAddress = shippingContact.emailAddress;
var phoneNumber = shippingContact.phoneNumber;
if (validationFields.includes('EM') && emailAddress === "") {
errors.push(getApplePayError(code.shippingContactInvalid,
contactField.emailAddress,
aPayValidationMessages.email));
}
if (validationFields.includes('PH') && phoneNumber === "") {
errors.push(getApplePayError(code.shippingContactInvalid,
contactField.phoneNumber,
aPayValidationMessages.phoneNumber));
}
return errors;
};
function getBillingContactErrors(billingContact) {
return getContactErrors(code.billingContactInvalid, billingContact);
};
function retriveAPayConfig(getScopeCallBack) {
if (getScopeCallBack) {
getScope = getScopeCallBack;
var scope = getScope();
var vendorData =
$filter('filter')(scope.DataModel.ThirdPartyPaymentVendorDatas || {},
{ Paycode: cartConstants.PayCode.aPay },
true)[0];
if (vendorData && vendorData.ScriptData) {
try {
var aPayClientData = JSON.parse(vendorData.ScriptData);
aPayConfiguration = aPayClientData.customFieldSettings;
aPayValidationMessages = aPayClientData.validationErrorMessages;
} catch (e) {
errorLoggingService.logError("Error parsing apple pay configuration - " + e, cartConstants.ErrorCodes.applePayErrorCode);
}
}
return aPayConfiguration;
}
}
function getContactErrors(code, contact) {
var firstName = contact.givenName;
var lastName = contact.familyName;
var city = contact.locality;
var state = contact.administrativeArea;
var postalCode = contact.postalCode;
var countryCode = contact.countryCode;
var phoneNumber = contact.phoneNumber;
var errors = [];
var validationFields = aPayConfiguration.fieldsToValidate.split('|');
if (validationFields.includes('CN') && countryCode != aPayConfiguration.countryCode) {
errors.push(getApplePayError(code,
contactField.country,
aPayValidationMessages.country));
}
if (validationFields.includes('PH') && phoneNumber) {
var minLength = globalizationService.getPhoneNumberMinLength() + globalizationService.getAreaCodeMinLength();
var phone = getPhoneNumber(contact);
if (phone.PhoneNumber && phone.PhoneNumber.length < minLength) {
errors.push(getApplePayError(code,
contactField.phoneNumber,
aPayValidationMessages.phoneNumber));
}
}
if (validationFields.includes('FN') && firstName === "") {
errors.push(getApplePayError(code,
contactField.name,
aPayValidationMessages.firstName));
}
if (validationFields.includes('LN') && lastName === "") {
errors.push(getApplePayError(code,
contactField.name,
aPayValidationMessages.lastName));
}
if (validationFields.includes('CT') && city === "") {
errors.push(getApplePayError(code,
contactField.locality,
aPayValidationMessages.city));
}
if (validationFields.includes('ST') && state === "") {
errors.push(getApplePayError(code,
contactField.administrativeArea,
aPayValidationMessages.state));
}
if (validationFields.includes('PC') && postalCode === "") {
errors.push(getApplePayError(code,
contactField.postalCode,
aPayValidationMessages.postalCode));
}
return errors;
}
function getApplePayError(code, contactField, message) {
return new ApplePayError(code, contactField, message);
}
function calculateTaxAndShipping(event, callback) {
var scope = getScope();
var completeShippingContactRequest = { errors: [], newShippingMethods: [], newTotal: getTotal(), newLineItems: lineItems };
//TODO - APAY : Including country wide taxing price break up like UK which is available in TotalPriceBreakdown
if (scope.DataModel.CartSummary.TotalPriceBreakdown.HasValues) {
// If no postal code is available then set lineitems to blank
completeShippingContactRequest.newLineItems = [];
callback(completeShippingContactRequest);
return;
}
if (!previousPostalCode && !scope.DataModel.TaxAndShipping.PostalCode) {
contentsService.savePostalCode(
{ PostalCode: event.shippingContact.postalCode, source: cartConstants.LocationSource.User },
postalUpdateSuccess,
postalUpdateError
);
}
else { // PriceComponentType = 5 implies Tax component
if (event.shippingContact.postalCode.toString() === scope.DataModel.TaxAndShipping.PostalCode && scope.DataModel.CartSummary.PriceComponents.some(function (pc) { return pc.PriceComponentType === 5; })) {
// when updated line items are available in scope then set them
completeShippingContactRequest = setLineItemDetails(scope.DataModel.CartSummary, completeShippingContactRequest, true);
callback(completeShippingContactRequest);
}
else if (event.shippingContact.postalCode === previousPostalCode) {
callback(completeShippingContactRequest);
}
else {
contentsService.updatePostalCode(event.shippingContact.postalCode.toString(), postalUpdateSuccess, postalUpdateError);
}
}
previousPostalCode = event.shippingContact.postalCode;
function postalUpdateSuccess(response) {
completeShippingContactRequest = setLineItemDetails(response, completeShippingContactRequest, true);
callback(completeShippingContactRequest);
}
function postalUpdateError(e) {
callback(completeShippingContactRequest);
errorLoggingService.logError(e, cartConstants.ErrorCodes.applePayErrorCode);
}
}
function setLineItemDetails(response, request, isExpress) {
if (isExpress) {
request.newLineItems = []; // reset the line items to fill in new details
} else {
request.lineItems = []; // setting up lineitems for Regular checkout
}
if (response && response.PriceComponents) {
response.PriceComponents.forEach(function (item) {
switch (item.PriceComponentType) {
// 0 is for the sub total as per OG
// 1 is for shipping , 5 for tax
case 0:
case 1:
case 5:
var lineItem = {
label: item.Name,
amount: item.DecimalAmount
};
if (isExpress) {
lineItem.type = aPayConfiguration.type;
request.newLineItems.push(lineItem);
} else {
request.lineItems.push(lineItem);
}
break;
case 7:
if (isExpress) {
request.newTotal.amount = item.DecimalAmount;
}
break;
default:
break;
}
});
}
lineItems = request.newLineItems; // set the lineitems for future use
return request;
}
function mapContact(paymentDetails, contactType) {
return {
FirstName: paymentDetails[contactType].givenName,
LastName: paymentDetails[contactType].familyName,
Line1: paymentDetails[contactType].addressLines[0],
Line2: paymentDetails[contactType].addressLines[1]
? paymentDetails[contactType].addressLines[1]
: null,
City: paymentDetails[contactType].locality,
State: paymentDetails[contactType].administrativeArea,
Country:
globalizationService.getDellCountryCode(paymentDetails[contactType]
.countryCode), //need this, as our backend doestnot use iso code for some countries . eg UK instead of GB
PostalCode: paymentDetails[contactType].postalCode,
Phone: (paymentDetails[contactType].phoneNumber != undefined &&
paymentDetails[contactType].phoneNumber != null)
? getPhoneNumber(paymentDetails[contactType])
: getPhoneNumber(paymentDetails.shippingContact),
Email: (paymentDetails[contactType].emailAddress != undefined &&
paymentDetails[contactType].emailAddress != null)
? paymentDetails[contactType].emailAddress
: paymentDetails.shippingContact.emailAddress,
ContactType: contactType
};
}
function getPhoneNumber(address) {
var phone = {};
var phoneNumberMaxLength = globalizationService.getPhoneNumberMaxLength();;
phoneNumberMaxLength =
(isNaN(phoneNumberMaxLength) ?
parseInt(phoneNumberMaxLength) :
phoneNumberMaxLength) || 10;
if (address && address.phoneNumber && !isNaN(phoneNumberMaxLength)) {
var formattedPhoneNumber = (typeof address.phoneNumber === 'string') ?
address.phoneNumber.replace(/\D/g, '') :
address.phoneNumber.toString();
if (formattedPhoneNumber.length >= phoneNumberMaxLength) {
var splitLength = formattedPhoneNumber.length - phoneNumberMaxLength;
phone.PhoneNumber = formattedPhoneNumber.substr(splitLength);
phone.AreaCode = formattedPhoneNumber.substr(0, splitLength) || null;
}
else {
phone = {
AreaCode: null,
PhoneNumber: formattedPhoneNumber
};
}
// For any country where area code is mandatory, it needs to be set otherwise user will end up in shipping page. ex: DE
var areaCodeMinLength = globalizationService.getAreaCodeMinLength();
if (areaCodeMinLength > 0 && (!phone.AreaCode || phone.AreaCode.length < areaCodeMinLength) && phone.PhoneNumber.length > areaCodeMinLength) {
phone.AreaCode = phone.PhoneNumber.substr(0, areaCodeMinLength);
phone.PhoneNumber = phone.PhoneNumber.substr(areaCodeMinLength);
}
}
return phone;
}
function getApplePayRequest(isExpress) {
// For express checkout, pass the billing and shipping contract as well to capture on the payment sheet
var request = {
countryCode: aPayConfiguration.countryCode,
currencyCode: aPayConfiguration.currencyCode,
supportedNetworks: aPayConfiguration.supportedNetworks,
merchantCapabilities: aPayConfiguration.merchantCapabilities,
total: getTotal()
};
if (isExpress) {
request.requiredBillingContactFields = aPayConfiguration.requiredBillingContactFields;
request.requiredShippingContactFields = aPayConfiguration.requiredShippingContactFields;
} else {
var scope = getScope();
if (!scope.DataModel.CartSummary.TotalPriceBreakdown.HasValues) {
setLineItemDetails(scope.DataModel.CartSummary, request, isExpress);
}
}
return request;
}
function getTotal() {
var scope = getScope();
// set the total first for reuse during the tax calculations
return {
label: aPayConfiguration.merchantInfo.displayName,
amount: scope.DataModel.CartSummary.EntireOrderTotalAmount,
type: aPayConfiguration.type
};
}
return {
getShippingContactErrors: getShippingContactErrors,
getBillingContactErrors: getBillingContactErrors,
calculateTaxAndShipping: calculateTaxAndShipping,
mapContact: mapContact,
getApplePayRequest: getApplePayRequest,
retriveAPayConfig: retriveAPayConfig,
getTotal: getTotal
};
}
]);
})();;
/*global cartApp*/
(function() {
'use strict';
cartApp.service('applePayService',
['cartConstants', 'errorLoggingService', 'paymentsService', 'corePaymentsService', 'applyPaymentService', 'applePayHelperService', 'globalizationService', 'contentsService',
function (cartConstants, errorLoggingService, paymentsService, corePaymentsService, applyPaymentService, applePayHelperService, globalizationService, contentsService) {
var setApayState,
getApayState,
verifyApayBrowserAndDeviceCompatibility,
createAndAddButton,
buttonCreationStatus = {},
IsApayCompatible = false,
isComponentInitialized = false,
isExpressCheckout,
aPayConfiguration,
resetAllButtons,
$rootScope,
lwp = Dell.Transactional.buildLightweightProfile();
function init(isExpress, rootScope, getScopeCallBack) {
try {
//set the apay compatibility status first
this.verifyApayBrowserAndDeviceCompatibility();
// set subtotal if availale
if (!isComponentInitialized && this.getApayState()) {
$rootScope = rootScope;
isExpressCheckout = isExpress;
aPayConfiguration = applePayHelperService.retriveAPayConfig(getScopeCallBack);
applyPaymentService.init(getScopeCallBack(), $rootScope);
isComponentInitialized = true;
}
} catch (e) {
errorLoggingService.logError(e.message, cartConstants.ErrorCodes.applePayErrorCode);
}
}
setApayState = function(state) {
IsApayCompatible = state;
};
getApayState = function() {
return IsApayCompatible;
};
verifyApayBrowserAndDeviceCompatibility = function() {
if (window.ApplePaySession && ApplePaySession.canMakePayments()) {
setApayState(true);
} else {
setApayState(false);
}
};
resetAllButtons = function(buttonIds) {
var resetStatus = false;
angular.forEach(buttonIds,
function(id) {
var node = document.getElementById(id);
if (node && node.childElementCount === 0) {
buttonCreationStatus[id] = false;
resetStatus = true;
}
});
return resetStatus;
};
createAndAddButton = function(buttonIds) {
angular.forEach(buttonIds,
function(id) {
createButton(id);
});
}
function createButton(id) {
var node = document.getElementById(id);
buttonCreationStatus =
buttonCreationStatus === undefined ? handleNullReference(node) : buttonCreationStatus;
//This is to prevent creating button again once created
if (!buttonCreationStatus[id]) {
var button = document.createElement("button");
button.lang = lwp.l;
button.onclick = showAppleSheet;
if (isExpressCheckout) {
button.className = "apple-pay-express-checkout-button apple-pay-button-black-with-text";
} else {
button.className = "apple-pay-button-with-text apple-pay-button-black-with-text";
}
node.appendChild(button);
buttonCreationStatus[id] = true;
}
};
function handleNullReference(node) {
//This is a race condition which we don't expect to happen
while (node.hasChildNodes()) {
node.removeChild(node.firstChild);
}
return {};
}
function showAppleSheet() {
if ($scope.enableBTOStopSellCheckOnCtaClick) {
var loadingSpinner = $rootScope.loadingScreen.clone().appendTo($('body')).show();
contentsService.CheckForEoledItem().then(function (result) {
loadingSpinner.hide();
if (result && result.status && result.status === 200) {
result.ctaSource = "ApplePayCheckoutCta";
$scope.$broadcast('ShowEolItemsMessage', result);
} else {
initializeApplePaySheet();
}
},
function (error) {
loadingSpinner.hide();
if ($scope.ShowEmptyCartIdErrorMessage && error.status === 400) {
$scope.$broadcast('ShowEmptyCartIdMessage', error);
} else {
initializeApplePaySheet();
}
});
} else {
initializeApplePaySheet();
}
}
function initializeApplePaySheet() {
addAnEventToGlassBox("callinitiated");
var request = applePayHelperService.getApplePayRequest(isExpressCheckout);
var session = new ApplePaySession(aPayConfiguration.apiVersion, request);
if (session) {
handleApplePayEvents(session); //handle all Apple events
beginAPaySession(session, 300, 0);
}
}
function beginAPaySession(session, delay, retryCount) {
if (retryCount <= 2) {
try {
session.begin();
addAnEventToGlassBox("opened");
} catch (e) {
addAnEventToGlassBox(["failedtoopen|retry", e.message]);
errorLoggingService.logError(e.message, cartConstants.ErrorCodes.applePayErrorCode);
setTimeout(beginAPaySession(session, delay, ++retryCount), delay);
}
} else {
// TODO-APay : Code to show generic error message banner
}
}
function addAnEventToGlassBox(trackingContext) {
if (_detector) {
_detector.triggerCustomEvent("ApplePay_PaymentSheet", trackingContext);
}
}
function handleApplePayEvents(appleSession) {
// apple events
// This is the first event that Apple triggers to validate the session from API server
appleSession.onvalidatemerchant = function(event) {
validateMerchantSession(event.validationURL,
function (merchantSession) {
appleSession.completeMerchantValidation(merchantSession);
});
}
appleSession.onpaymentauthorized = function(event) {
if (isExpressCheckout) {
var errors = [];
var shippingContactErrors = applePayHelperService.getShippingContactErrors(
event.payment
.shippingContact);
var billingContactErrors = applePayHelperService.getBillingContactErrors(
event.payment
.billingContact);
errors = shippingContactErrors.concat(billingContactErrors);
// errors will occur only during express check out due to address capture
if (errors.length > 0) {
var errorMessage = "";
$(errors).each(function() {
errorMessage += this.code + " : " + this.message + " ; ";
});
addAnEventToGlassBox(["paymentauthorization|failed", errorMessage]);
appleSession.completePayment({
status: 1, //STATUS_FAILURE
errors: errors
});
return;
}
}
appleSession.completePayment({
status: 0 //STATUS_SUCCESS
});
//TODO-APAY: incase of failure show error banner
internalProcessPayment(event.payment);
}
if (isExpressCheckout) {
appleSession.onshippingcontactselected = function (event) {
applePayHelperService.calculateTaxAndShipping(event, function (update) {
appleSession.completeShippingContactSelection(update);
});
};
}
};
function validateMerchantSession(appleUrl, callback) {
addAnEventToGlassBox("merchantvalidation|start");
paymentsService.ValidateMerchantForApplePay(appleUrl).then(function onSuccess(response) {
callback(response.data);
addAnEventToGlassBox("merchantvalidation|end");
}, function onError(error) {
addAnEventToGlassBox(["merchantvalidation|failed", error.data.Message]);
errorLoggingService.logError(error.data.Message, cartConstants.ErrorCodes.applePayErrorCode);
});
}
function internalProcessPayment(paymentDetails) {
var cardNumber;
var displayName = paymentDetails.token.paymentMethod.displayName.match(/(\d+)/g);
if (displayName == null) {
cardNumber = paymentDetails.token.paymentMethod.displayName;
} else {
cardNumber = displayName[0];
}
var appleData = {
Amount: globalizationService.getAmountInCurrentLocaleFormat(applePayHelperService.getTotal().amount),
PayCode: cartConstants.PayCode.aPay,
CardNumber: cardNumber
}
//This If condition is to test on simulator
if (paymentDetails.token.paymentData) {
appleData.SecureToken = JSON.stringify({ token: paymentDetails.token }), // need this explicit assignment to avoid addl details being passed during express checkout.
appleData.TransactionId = paymentDetails.token.paymentData.header.transactionId;
} else {
appleData.SecureToken = "SecureToken";
appleData.TransactionId = "54321";
}
if (isExpressCheckout) {
addAnEventToGlassBox("expressregister|start");
appleData.ShippingContact = applePayHelperService.mapContact(paymentDetails, "shippingContact");
appleData.BillingContact = applePayHelperService.mapContact(paymentDetails, "billingContact");
appleData.IsExpress = true;
applyPaymentService.applyThirdPartyExpressPayment({ PendingPayment: appleData });
addAnEventToGlassBox("expressregister|end");
} else {
addAnEventToGlassBox("register|start");
corePaymentsService.updatePendingPayment(appleData);
applyPaymentService.applyPayment();
addAnEventToGlassBox("register|end");
}
};
return {
init: init,
setApayState: setApayState,
getApayState: getApayState,
verifyApayBrowserAndDeviceCompatibility: verifyApayBrowserAndDeviceCompatibility,
createAndAddButton: createAndAddButton,
resetAllButtons: resetAllButtons
};
}
]);
})();
;
var installmentTable = angular.module('installmentTable', []);;
installmentTable
.directive("installmentTable", function () {
return {
restrict: 'E',
scope: {
installmentTable: "="
},
template: '
' +
' ' +
' ' +
'
',
link: function (scope, element, attrs, ctrl) {
var headline = element.find('[stp-id="installmentHeadline"]');
headline.text(attrs.tableHeadline);
}
};
});;
tabbedPaymentTypes
.directive("tabbedPaymentTypes", ["$timeout", "$window", function ($timeout, $window) {
return {
restrict: 'E',
scope: {
// These map to attributes stored in the html tag
// which has access to that pages scope
showPaymentView: "&",
availablePaymentOptions: "=",
addCreditCardLabel: "@",
moreLabel: "@",
selectedPaymentOption: "@",
disableTitle: "@",
thirdPartyDelayedDeliveryWarningEnabledPayCodes: "@",
thirdPartyPaymentRedirectionMessageEnabledPayCodes: "@",
thirdPartyPaymentRedirectionMessage: "@",
thirdPartyDelayedDeliveryMessage: "@",
showThirdPartyPaymentRedirectionMessage: "=",
showThirdPartyDelayedDeliveryWarningForPayment: "=",
savedPaymentErrorMessage : "@"
},
controller: 'tabbedPaymentTypesCtrl',
template: '
',
link: function (scope, element, attrs, ctrl) {
// Discover what bootstrap media query is in effect
var mediaStateWrap = element.find(".mediaStateWrapForTabbedPayment"),
storedMediaValue = returnMediaElement();
// Init controller with current media query
ctrl.MappedPaymentOptionByScreenWidth(returnMediaElement());
// On resize check if media query has changed and publish the new size
angular.element($window).bind('resize', function () {
var currentMediaValue = returnMediaElement();
if (currentMediaValue != storedMediaValue) {
$timeout(function () {
ctrl.MappedPaymentOptionByScreenWidth(currentMediaValue);
}, 0);
storedMediaValue = currentMediaValue;
}
});
function returnMediaElement() {
var mediaElements = mediaStateWrap.find("i");
// There is only 4 elements in this loop
for (var i = 0; i < mediaElements.length; i++) {
var $mediaElement = $(mediaElements[i]);
if ($mediaElement.is(":visible")) {
return $mediaElement.attr("data-media-query");
}
}
//if above for loop doesnt return a value, set lg by default
return "lg";
}
}
};
}]);;
var designatedCarrier = angular.module('designatedCarrier', []);;
designatedCarrier
.controller('designatedCarrierCtrl', ['$scope', function ($scope) {
this.clearOrderLevelDesignatedCarrier = function (designatedCarrierOrderLevelModel) {
var keyNamesArry = ["Name", "AccountNumber", "DeliveryMethod"];
for (var i = 0; i < keyNamesArry.length; i++) {
designatedCarrierOrderLevelModel[keyNamesArry[i]] = null;
}
}
}]);;
designatedCarrier
.directive("designatedCarrier", function () {
return {
restrict: 'E',
controller: 'designatedCarrierCtrl',
scope: {
designatedCarrierDataModel: "=",
designatedCarrierOrderLevelModel: "=",
templateType: "@"
},
templateUrl: 'embedded.designatedCarrierTemplate.html',
link: function (scope, element, attrs, ctrl) {
if (scope.templateType === "itemLevel") {
var count = 0;
// If any change is made to item level DC values clear order level DC
scope.$watch('designatedCarrierDataModel', function (newValue, oldValue, scope) {
// To avoid clearing order level DC when model first instantiates ignore the first time,
// then don't run it again.
if (count === 1) {
ctrl.clearOrderLevelDesignatedCarrier(scope.designatedCarrierOrderLevelModel);
}
count++;
}, true);
}
}
};
});;
var showHideSavings = angular.module('showHideSavings', []);;
showHideSavings
.controller('showHideSavingsCtrl', [ '$scope', function($scope) {
var initSliderHeight;
function setContentHeight (height) {
return $scope.item.expandSavings ? height : '0px';
};
$scope.toggleExpandCollapseSavings = function () {
$scope.item.expandSavings = !$scope.item.expandSavings;
$scope.item.sliderHeight = setContentHeight(initSliderHeight);
};
this.init = function (height) {
initSliderHeight = height || 'auto';
$scope.item.sliderHeight = setContentHeight(initSliderHeight);
};
}]);;
showHideSavings
.directive("showHideSavings", ['$timeout', 'featureService', function ($timeout, featureService) {
return {
restrict: 'E',
controller: 'showHideSavingsCtrl',
template: '
{{subscription.RenewalPrice}}/{{subscription.Cadence}} x {{item.Quantity}}
{{subscription.RenewalPrice}} x {{subscription.Duration}} {{subscription.ProSupportCadence}} = {{subscription.TCVPerUnitLabel}}
{{subscription.BuySubscriptionsDetailsTitle}}
{{subscription.TCVFormattedRenewalPrice}} x {{subscription.Duration}} {{subscription.ProSupportCadence}} x {{item.Quantity}} = {{subscription.TCVFinalValue}}
{{subscription.BuySubscriptionsTitle}}
{{subscription.OptionDescription}}
{{subscription.OptionPrice}}
{{subscription.RenewalPrice}}/{{subscription.Cadence}} x {{item.Quantity}}