(() => { function t(t) { (this.elem = jQuery(t)), (this.captureName = !!this.elem.data('capture-name') && this.elem.data('capture-name')), (this.iconColour = !!this.elem.data('icon-colour') && this.elem.data('icon-colour')), (this.stripe = !!this.elem.data('stripe') && this.elem.data('stripe')), this.stripe && (this.captureName = !1), this.initCardNumberInput(), this.initNameInput(), this.initExpiryMonthInput(), this.initExpiryYearInput(), this.initCvcInput(), this.elem.empty(), this.setupCardNumberInput(), this.setupNameInput(), this.setupExpiryInput(), this.setupCvcInput(), this.iconColour && this.setIconColour(this.iconColour), this.refreshCreditCardTypeIcon(); } !(function (e) { var r = { init: function () { return this.data('cardjs', new t(this)), this; }, cardNumber: function () { return this.data('cardjs').getCardNumber(); }, cardType: function () { return this.data('cardjs').getCardType(); }, name: function () { return this.data('cardjs').getName(); }, expiryMonth: function () { return this.data('cardjs').getExpiryMonth(); }, expiryYear: function () { return this.data('cardjs').getExpiryYear(); }, cvc: function () { return this.data('cardjs').getCvc(); }, }; e.fn.CardJs = function (t) { return r[t] ? r[t].apply(this, Array.prototype.slice.call(arguments, 1)) : 'object' != typeof t && t ? void e.error( 'Method ' + t + ' does not exist on jQuery.CardJs' ) : r.init.apply(this, arguments); }; })(jQuery), $(function () { $('.card-js').each(function (t, e) { $(e).CardJs(); }); }), (t.prototype.constructor = t), (t.KEYS = { 0: 48, 9: 57, NUMPAD_0: 96, NUMPAD_9: 105, DELETE: 46, BACKSPACE: 8, ARROW_LEFT: 37, ARROW_RIGHT: 39, ARROW_UP: 38, ARROW_DOWN: 40, HOME: 36, END: 35, TAB: 9, A: 65, X: 88, C: 67, V: 86, }), (t.CREDIT_CARD_NUMBER_DEFAULT_MASK = 'XXXX XXXX XXXX XXXX'), (t.CREDIT_CARD_NUMBER_VISA_MASK = 'XXXX XXXX XXXX XXXX'), (t.CREDIT_CARD_NUMBER_MASTERCARD_MASK = 'XXXX XXXX XXXX XXXX'), (t.CREDIT_CARD_NUMBER_DISCOVER_MASK = 'XXXX XXXX XXXX XXXX'), (t.CREDIT_CARD_NUMBER_JCB_MASK = 'XXXX XXXX XXXX XXXX'), (t.CREDIT_CARD_NUMBER_AMEX_MASK = 'XXXX XXXXXX XXXXX'), (t.CREDIT_CARD_NUMBER_DINERS_MASK = 'XXXX XXXX XXXX XX'), (t.prototype.creditCardNumberMask = t.CREDIT_CARD_NUMBER_DEFAULT_MASK), (t.CREDIT_CARD_NUMBER_PLACEHOLDER = 'Card number'), (t.NAME_PLACEHOLDER = 'Name on card'), (t.EXPIRY_MASK = 'XX / XXXX'), (t.EXPIRY_PLACEHOLDER = 'MM / YYYY'), (t.EXPIRY_USE_DROPDOWNS = !1), (t.EXPIRY_NUMBER_OF_YEARS = 10), (t.CVC_MASK_3 = 'XXX'), (t.CVC_MASK_4 = 'XXXX'), (t.CVC_PLACEHOLDER = 'CVC'), (t.CREDIT_CARD_SVG = ''), (t.LOCK_SVG = ''), (t.CALENDAR_SVG = ''), (t.USER_SVG = ''), (t.MAIL_SVG = ''), (t.INFORMATION_SVG = ''), (t.keyCodeFromEvent = function (t) { return t.which || t.keyCode; }), (t.keyIsCommandFromEvent = function (t) { return t.ctrlKey || t.metaKey; }), (t.keyIsNumber = function (e) { return t.keyIsTopNumber(e) || t.keyIsKeypadNumber(e); }), (t.keyIsTopNumber = function (e) { var r = t.keyCodeFromEvent(e); return r >= t.KEYS[0] && r <= t.KEYS[9]; }), (t.keyIsKeypadNumber = function (e) { var r = t.keyCodeFromEvent(e); return r >= t.KEYS.NUMPAD_0 && r <= t.KEYS.NUMPAD_9; }), (t.keyIsDelete = function (e) { return t.keyCodeFromEvent(e) == t.KEYS.DELETE; }), (t.keyIsBackspace = function (e) { return t.keyCodeFromEvent(e) == t.KEYS.BACKSPACE; }), (t.keyIsDeletion = function (e) { return t.keyIsDelete(e) || t.keyIsBackspace(e); }), (t.keyIsArrow = function (e) { var r = t.keyCodeFromEvent(e); return r >= t.KEYS.ARROW_LEFT && r <= t.KEYS.ARROW_DOWN; }), (t.keyIsNavigation = function (e) { var r = t.keyCodeFromEvent(e); return r == t.KEYS.HOME || r == t.KEYS.END; }), (t.keyIsKeyboardCommand = function (e) { var r = t.keyCodeFromEvent(e); return ( t.keyIsCommandFromEvent(e) && (r == t.KEYS.A || r == t.KEYS.X || r == t.KEYS.C || r == t.KEYS.V) ); }), (t.keyIsTab = function (e) { return t.keyCodeFromEvent(e) == t.KEYS.TAB; }), (t.copyAllElementAttributes = function (t, e) { $.each(t[0].attributes, function (t, r) { e.attr(r.nodeName, r.nodeValue); }); }), (t.numbersOnlyString = function (t) { for (var e = '', r = 0; r < t.length; r++) { var n = t.charAt(r); !isNaN(parseInt(n)) && (e += n); } return e; }), (t.applyFormatMask = function (t, e) { for (var r = '', n = 0, i = 0; i < e.length; i++) { var a = e[i]; if ('X' == a) { if (!t.charAt(n)) break; (r += t.charAt(n)), n++; } else r += a; } return r; }), (t.cardTypeFromNumber = function (t) { if (((e = new RegExp('^30[0-5]')), null != t.match(e))) return 'Diners - Carte Blanche'; if (((e = new RegExp('^(30[6-9]|36|38)')), null != t.match(e))) return 'Diners'; if (((e = new RegExp('^35(2[89]|[3-8][0-9])')), null != t.match(e))) return 'JCB'; if (((e = new RegExp('^3[47]')), null != t.match(e))) return 'AMEX'; if ( ((e = new RegExp('^(4026|417500|4508|4844|491(3|7))')), null != t.match(e)) ) return 'Visa Electron'; var e = new RegExp('^4'); return null != t.match(e) ? 'Visa' : ((e = new RegExp('^5[1-5]')), null != t.match(e) ? 'Mastercard' : ((e = new RegExp( '^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)' )), null != t.match(e) ? 'Discover' : '')); }), (t.caretStartPosition = function (t) { return 'number' == typeof t.selectionStart && t.selectionStart; }), (t.caretEndPosition = function (t) { return 'number' == typeof t.selectionEnd && t.selectionEnd; }), (t.setCaretPosition = function (t, e) { if (null != t) if (t.createTextRange) { var r = t.createTextRange(); r.move('character', e), r.select(); } else t.selectionStart ? (t.focus(), t.setSelectionRange(e, e)) : t.focus(); }), (t.normaliseCaretPosition = function (t, e) { var r = 0; if (0 > e || e > t.length) return 0; for (var n = 0; n < t.length; n++) { if (n == e) return r; 'X' == t[n] && r++; } return r; }), (t.denormaliseCaretPosition = function (t, e) { var r = 0; if (0 > e || e > t.length) return 0; for (var n = 0; n < t.length; n++) { if (r == e) return n; 'X' == t[n] && r++; } return t.length; }), (t.filterNumberOnlyKey = function (e) { var r = t.keyIsNumber(e), n = t.keyIsDeletion(e), i = t.keyIsArrow(e), a = t.keyIsNavigation(e), s = t.keyIsKeyboardCommand(e), p = t.keyIsTab(e); r || n || i || a || s || p || e.preventDefault(); }), (t.digitFromKeyCode = function (e) { return e >= t.KEYS[0] && e <= t.KEYS[9] ? e - t.KEYS[0] : e >= t.KEYS.NUMPAD_0 && e <= t.KEYS.NUMPAD_9 ? e - t.KEYS.NUMPAD_0 : null; }), (t.handleMaskedNumberInputKey = function (e, r) { t.filterNumberOnlyKey(e); var n = e.which || e.keyCode, i = e.target, a = t.caretStartPosition(i), s = t.caretEndPosition(i), p = t.normaliseCaretPosition(r, a), c = t.normaliseCaretPosition(r, s), o = a, u = t.keyIsNumber(e), h = t.keyIsDelete(e), d = t.keyIsBackspace(e); if (u || h || d) { e.preventDefault(); var l = $(i).val(), y = t.numbersOnlyString(l), m = t.digitFromKeyCode(n), C = c > p; C && (y = y.slice(0, p) + y.slice(c)), a != r.length && (u && l.length <= r.length && ((y = y.slice(0, p) + m + y.slice(p)), (o = Math.max( t.denormaliseCaretPosition(r, p + 1), t.denormaliseCaretPosition(r, p + 2) - 1 ))), h && (y = y.slice(0, p) + y.slice(p + 1))), 0 != a && d && !C && ((y = y.slice(0, p - 1) + y.slice(p)), (o = t.denormaliseCaretPosition(r, p - 1))), $(i).val(t.applyFormatMask(y, r)), t.setCaretPosition(i, o); } }), (t.handleCreditCardNumberKey = function (e, r) { t.handleMaskedNumberInputKey(e, r); }), (t.handleCreditCardNumberChange = function (t) {}), (t.handleExpiryKey = function (e) { t.handleMaskedNumberInputKey(e, t.EXPIRY_MASK); }), (t.prototype.getCardNumber = function () { return this.cardNumberInput.val(); }), (t.prototype.getCardType = function () { return t.cardTypeFromNumber(this.getCardNumber()); }), (t.prototype.getName = function () { return this.nameInput.val(); }), (t.prototype.getExpiryMonth = function () { return this.expiryMonthInput.val(); }), (t.prototype.getExpiryYear = function () { return this.expiryYearInput.val(); }), (t.prototype.getCvc = function () { return this.cvcInput.val(); }), (t.prototype.setIconColour = function (t) { this.elem.find('.icon .svg').css({ fill: t }); }), (t.prototype.setIconColour = function (t) { this.elem.find('.icon .svg').css({ fill: t }); }), (t.prototype.refreshCreditCardTypeIcon = function () { this.setCardTypeIconFromNumber( t.numbersOnlyString(this.cardNumberInput.val()) ); }), (t.prototype.clearCardTypeIcon = function () { this.elem .find('.card-number-wrapper .card-type-icon') .removeClass('show'); }), (t.prototype.setCardTypeIconAsVisa = function () { this.elem .find('.card-number-wrapper .card-type-icon') .attr('class', 'card-type-icon show visa'); }), (t.prototype.setCardTypeIconAsMasterCard = function () { this.elem .find('.card-number-wrapper .card-type-icon') .attr('class', 'card-type-icon show master-card'); }), (t.prototype.setCardTypeIconAsAmericanExpress = function () { this.elem .find('.card-number-wrapper .card-type-icon') .attr('class', 'card-type-icon show american-express'); }), (t.prototype.setCardTypeIconAsDiscover = function () { this.elem .find('.card-number-wrapper .card-type-icon') .attr('class', 'card-type-icon show discover'); }), (t.prototype.setCardTypeIconAsDiners = function () { this.elem .find('.card-number-wrapper .card-type-icon') .attr('class', 'card-type-icon show diners'); }), (t.prototype.setCardTypeIconAsJcb = function () { this.elem .find('.card-number-wrapper .card-type-icon') .attr('class', 'card-type-icon show jcb'); }), (t.prototype.setCardTypeIconFromNumber = function (e) { switch (t.cardTypeFromNumber(e)) { case 'Visa Electron': case 'Visa': this.setCardTypeAsVisa(); break; case 'Mastercard': this.setCardTypeAsMasterCard(); break; case 'AMEX': this.setCardTypeAsAmericanExpress(); break; case 'Discover': this.setCardTypeAsDiscover(); break; case 'Diners - Carte Blanche': case 'Diners': this.setCardTypeAsDiners(); break; case 'JCB': this.setCardTypeAsJcb(); break; default: this.clearCardType(); } }), (t.prototype.setCardMask = function (t) { (this.creditCardNumberMask = t), this.cardNumberInput.attr('maxlength', t.length); }), (t.prototype.setCvc3 = function () { this.cvcInput.attr('maxlength', t.CVC_MASK_3.length); }), (t.prototype.setCvc4 = function () { this.cvcInput.attr('maxlength', t.CVC_MASK_4.length); }), (t.prototype.clearCardType = function () { this.clearCardTypeIcon(), this.setCardMask(t.CREDIT_CARD_NUMBER_DEFAULT_MASK), this.setCvc3(); }), (t.prototype.setCardTypeAsVisa = function () { this.setCardTypeIconAsVisa(), this.setCardMask(t.CREDIT_CARD_NUMBER_VISA_MASK), this.setCvc3(); }), (t.prototype.setCardTypeAsMasterCard = function () { this.setCardTypeIconAsMasterCard(), this.setCardMask(t.CREDIT_CARD_NUMBER_MASTERCARD_MASK), this.setCvc3(); }), (t.prototype.setCardTypeAsAmericanExpress = function () { this.setCardTypeIconAsAmericanExpress(), this.setCardMask(t.CREDIT_CARD_NUMBER_AMEX_MASK), this.setCvc4(); }), (t.prototype.setCardTypeAsDiscover = function () { this.setCardTypeIconAsDiscover(), this.setCardMask(t.CREDIT_CARD_NUMBER_DISCOVER_MASK), this.setCvc3(); }), (t.prototype.setCardTypeAsDiners = function () { this.setCardTypeIconAsDiners(), this.setCardMask(t.CREDIT_CARD_NUMBER_DINERS_MASK), this.setCvc3(); }), (t.prototype.setCardTypeAsJcb = function () { this.setCardTypeIconAsJcb(), this.setCardMask(t.CREDIT_CARD_NUMBER_JCB_MASK), this.setCvc3(); }), (t.prototype.initCardNumberInput = function () { var e = this; (this.cardNumberInput = this.elem.find('.card-number')), this.cardNumberInput[0] ? this.cardNumberInput.detach() : (this.cardNumberInput = $( "" )), this.cardNumberInput.attr('type', 'tel'), this.cardNumberInput.attr('placeholder') || this.cardNumberInput.attr( 'placeholder', t.CREDIT_CARD_NUMBER_PLACEHOLDER ), this.cardNumberInput.attr( 'maxlength', this.creditCardNumberMask.length ), this.cardNumberInput.attr('x-autocompletetype', 'cc-number'), this.cardNumberInput.attr('autocompletetype', 'cc-number'), this.cardNumberInput.attr('autocorrect', 'off'), this.cardNumberInput.attr('spellcheck', 'off'), this.cardNumberInput.attr('autocapitalize', 'off'), this.cardNumberInput.keydown(function (r) { t.handleCreditCardNumberKey(r, e.creditCardNumberMask); }), this.cardNumberInput.keyup(function (t) { e.refreshCreditCardTypeIcon(); }), this.cardNumberInput.change(t.handleCreditCardNumberChange); }), (t.prototype.initNameInput = function () { (this.nameInput = this.elem.find('.name')), this.nameInput[0] ? ((this.captureName = !0), this.nameInput.detach()) : (this.nameInput = $("")), this.nameInput.attr('placeholder') || this.nameInput.attr('placeholder', t.NAME_PLACEHOLDER); }), (t.prototype.initExpiryMonthInput = function () { (this.expiryMonthInput = this.elem.find('.expiry-month')), this.expiryMonthInput[0] ? this.expiryMonthInput.detach() : (this.expiryMonthInput = $( "" )); }), (t.prototype.initExpiryYearInput = function () { (this.expiryYearInput = this.elem.find('.expiry-year')), this.expiryYearInput[0] ? this.expiryYearInput.detach() : (this.expiryYearInput = $( "" )); }), (t.prototype.initCvcInput = function () { (this.cvcInput = this.elem.find('.cvc')), this.cvcInput[0] ? this.cvcInput.detach() : (this.cvcInput = $("")), this.cvcInput.attr('type', 'tel'), this.cvcInput.attr('placeholder') || this.cvcInput.attr('placeholder', t.CVC_PLACEHOLDER), this.cvcInput.attr('maxlength', t.CVC_MASK_3.length), this.cvcInput.attr('x-autocompletetype', 'cc-csc'), this.cvcInput.attr('autocompletetype', 'cc-csc'), this.cvcInput.attr('autocorrect', 'off'), this.cvcInput.attr('spellcheck', 'off'), this.cvcInput.attr('autocapitalize', 'off'), this.cvcInput.keydown(t.filterNumberOnlyKey); }), (t.prototype.setupCardNumberInput = function () { this.stripe && this.cardNumberInput.attr('data-stripe', 'number'), this.elem.append("
"); var e = this.elem.find('.card-number-wrapper'); e.append(this.cardNumberInput), e.append(""), e.append(""), e.find('.icon').append(t.CREDIT_CARD_SVG); }), (t.prototype.setupNameInput = function () { if (this.captureName) { this.elem.append(""); var e = this.elem.find('.name-wrapper'); e.append(this.nameInput), e.append(""), e.find('.icon').append(t.USER_SVG); } }), (t.prototype.setupExpiryInput = function () { this.elem.append( "