easy_pay_u_latam 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +15 -0
  3. data/app/assets/javascripts/easy_pay_u_latam/application.js +2 -0
  4. data/app/assets/javascripts/easy_pay_u_latam/subscriptions/angular-card.js +222 -0
  5. data/app/assets/javascripts/easy_pay_u_latam/subscriptions/application.js +8 -0
  6. data/app/assets/javascripts/easy_pay_u_latam/subscriptions/card.js +2533 -0
  7. data/app/assets/javascripts/easy_pay_u_latam/subscriptions/controllers/Main.js +158 -0
  8. data/app/assets/javascripts/easy_pay_u_latam/subscriptions/controllers/Subscriptions.js +368 -0
  9. data/app/assets/javascripts/easy_pay_u_latam/subscriptions/country-picker.min.js +1 -0
  10. data/app/assets/stylesheets/easy_pay_u_latam/styles.css +4 -0
  11. data/app/assets/stylesheets/easy_pay_u_latam/subscriptions/application.scss +1 -0
  12. data/app/assets/stylesheets/easy_pay_u_latam/subscriptions/card.css +1 -0
  13. data/app/controllers/easy_pay_u_latam/api/v1/pay_u_cards_controller.rb +80 -0
  14. data/app/controllers/easy_pay_u_latam/api/v1/pay_u_clients_controller.rb +18 -0
  15. data/app/controllers/easy_pay_u_latam/api/v1/pay_u_subscriptions_controller.rb +56 -0
  16. data/app/views/easy_pay_u_latam/pay_u_payments/_dashboard.html.erb +15 -0
  17. data/app/views/easy_pay_u_latam/pay_u_payments/cards/_form.html.erb +81 -0
  18. data/app/views/easy_pay_u_latam/pay_u_payments/cards/_list.html.erb +54 -0
  19. data/app/views/easy_pay_u_latam/pay_u_payments/plans/_list.html.erb +30 -0
  20. data/app/views/easy_pay_u_latam/pay_u_payments/subscriptions/_actual.html.erb +54 -0
  21. data/app/views/easy_pay_u_latam/pay_u_payments/{index.html.erb → subscriptions/_form.html.erb} +0 -0
  22. data/app/views/easy_pay_u_latam/pay_u_payments/subscriptions/_list.html.erb +49 -0
  23. data/app/views/easy_pay_u_latam/pay_u_payments/subscriptions/_none.html.erb +0 -0
  24. data/app/views/easy_pay_u_latam/pay_u_payments/subscriptions/_show.html.erb +0 -0
  25. data/config/routes.rb +5 -0
  26. data/lib/easy_pay_u_latam.rb +6 -0
  27. data/lib/easy_pay_u_latam/r_api.rb +47 -0
  28. data/lib/easy_pay_u_latam/r_api/card.rb +102 -0
  29. data/lib/easy_pay_u_latam/r_api/client.rb +28 -0
  30. data/lib/easy_pay_u_latam/r_api/invoice.rb +53 -0
  31. data/lib/easy_pay_u_latam/r_api/invoice_service.rb +48 -0
  32. data/lib/easy_pay_u_latam/r_api/plan.rb +71 -0
  33. data/lib/easy_pay_u_latam/r_api/request.rb +133 -0
  34. data/lib/easy_pay_u_latam/r_api/subscription.rb +41 -0
  35. data/lib/easy_pay_u_latam/r_api/subscription_interceptor.rb +51 -0
  36. data/lib/easy_pay_u_latam/r_api/subscription_service.rb +208 -0
  37. data/lib/easy_pay_u_latam/version.rb +1 -1
  38. metadata +83 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d969f2bc7afeb37dc142814524bf4d6abe6535e3
4
- data.tar.gz: cc6bd094014b7d07cb7b600b2a9e3d2fe79bfe5e
2
+ SHA256:
3
+ metadata.gz: c08212451cfd2aeb7cb163142f777adc2c2dc450be6b67e5351d5460c8e8cb90
4
+ data.tar.gz: f3b0243c7acb9fe01469785e971999ef88c27958eed7977821ad9db7c7b9c8f7
5
5
  SHA512:
6
- metadata.gz: 7fc7b9ffdc11d00f4435977fbc363b27ef11561ae6514c0314445a3b004a136d8438cd16f8853ed63553e98b194aaf7aff360e99ea2ce28e62aafbd9738b7dd8
7
- data.tar.gz: efd2bce2c39ffd534fff19e5c51e5bcfbbaa2d40eea941329f82859b45ef0ea084a9d0cb31806424746bd05b96ecff20ad6ba8bf58b76266c55fed5d7819a6de
6
+ metadata.gz: 0451a45e206af40bfa978b331e81e7cbdb76bc7969c23d16ca6c19776defcef73fada8b6d1c0ebe91e525548038fce254ec91c0be8ce7fcf3d0854cfb41a6630
7
+ data.tar.gz: 1f478315511728b34dfd1ede054ef7a25dd75156fd6cc1361d93e3ca6334a7dd1876db58533ec83d0c044d752bd43a694687b9141cce9c937f5386596729041b
data/README.md CHANGED
@@ -28,6 +28,21 @@ If you want to reference the payments to a user, you can run the following migra
28
28
  $ rails g migration AddUserReferencesToEasyPayULatamPayuPayments user:references
29
29
  ```
30
30
 
31
+ Only run this when recurrent payments are ON, save the customer_id and default_credit_card for each user, you must run the following migration.
32
+ ```bash
33
+ $ rails g migration AddPayUFieldsToUsers payu_default_card:string payu_customer_id:string
34
+ ```
35
+
36
+ Only run this when recurrent payments are ON, extra fields for recurrent payments on payments table, you must run the following migration.
37
+ ```bash
38
+ $ rails g migration AddRecurrentPaymentsToEasyPayULatamPayuPayments payu_plan_id:string payu_plan_code:string payu_customer_id:string payu_subscription_id:string trial_days:integer payu_credit_card_token:string
39
+ ```
40
+
41
+ If you want to keep a reference to plans, before this you must have created a plan model on your project, you can run the following migration (User only when recurrent payments are ON).
42
+ ```bash
43
+ $ rails g migration AddPlanReferencesToPlan payu_plan_id:string payu_plan_code:string
44
+ ```
45
+
31
46
  Don't forget to mount Engine in your routes.rb
32
47
  ```ruby
33
48
  # config/routes.rb
@@ -1,2 +1,4 @@
1
1
  //= require jquery
2
2
  //= require bootstrap-sprockets
3
+ //= require sweetalert2
4
+ //= require sweet-alert2-rails
@@ -0,0 +1,222 @@
1
+ var hasRequire = window && window.angular ? false : typeof require === 'function';
2
+
3
+ (function (window, document, Card, angular, undefined) {
4
+ 'use strict';
5
+ angular
6
+ .module('gavruk.card', [])
7
+
8
+ .controller('CardCtrl', ['$scope', function ($scope) {
9
+ }])
10
+
11
+ .directive('card', ['$timeout', function ($timeout) {
12
+ return {
13
+ restrict: 'A',
14
+ scope: {
15
+ cardContainer: '@', // required
16
+ width: '@',
17
+ placeholders: '=',
18
+ options: '=',
19
+ messages: '=',
20
+ },
21
+ controller: 'CardCtrl',
22
+ link: function (scope, element, attributes, cardCtrl) {
23
+ var defaultPlaceholders = {
24
+ number: '•••• •••• •••• ••••',
25
+ name: 'Full Name',
26
+ expiry: '••/••',
27
+ cvc: '•••'
28
+ };
29
+ var defaultMessages = {
30
+ validDate: 'valid\nthru',
31
+ monthYear: 'month/year',
32
+ };
33
+ var defaultOptions = {
34
+ debug: false,
35
+ formatting: true
36
+ };
37
+
38
+ var placeholders = angular.extend(defaultPlaceholders, scope.placeholders);
39
+ var messages = angular.extend(defaultMessages, scope.messages);
40
+ var options = angular.extend(defaultOptions, scope.options);
41
+
42
+ var opts = {
43
+ form: '[name="' + attributes.name + '"]',
44
+
45
+ // a selector or jQuery object for the container
46
+ // where you want the card to appear
47
+ container: scope.cardContainer, // *required*
48
+
49
+ formSelectors: {},
50
+
51
+ width: options.width,
52
+
53
+ // Strings for translation - optional
54
+ messages: {
55
+ validDate: messages.validDate,
56
+ monthYear: messages.monthYear
57
+ },
58
+
59
+ // Default placeholders for rendered fields - options
60
+ placeholders: {
61
+ number: placeholders.number,
62
+ name: placeholders.name,
63
+ expiry: placeholders.expiry,
64
+ cvc: placeholders.cvc
65
+ },
66
+
67
+ formatting: options.formatting, // optional - default true
68
+ debug: options.debug // if true, will log helpful messages for setting up Card
69
+ };
70
+
71
+ opts.width = opts.width || scope.width || 350;
72
+
73
+ if (cardCtrl.numberInput && cardCtrl.numberInput.length > 0) {
74
+ opts.formSelectors.numberInput = 'input[name="' + cardCtrl.numberInput[0].name + '"]';
75
+ }
76
+ if (angular.isDefined(cardCtrl.expiryInput.combined)) {
77
+ opts.formSelectors.expiryInput = 'input[name="' + cardCtrl.expiryInput.combined[0].name + '"]';
78
+ } else if (angular.isDefined(cardCtrl.expiryInput.month) && angular.isDefined(cardCtrl.expiryInput.year)) {
79
+ opts.formSelectors.expiryInput = 'input[name="' + cardCtrl.expiryInput.month[0].name + '"], input[name="' + cardCtrl.expiryInput.year[0].name + '"]';
80
+ }
81
+ if (cardCtrl.cvcInput && cardCtrl.cvcInput.length > 0) {
82
+ opts.formSelectors.cvcInput = 'input[name="' + cardCtrl.cvcInput[0].name + '"]';
83
+ }
84
+ if (cardCtrl.nameInput && cardCtrl.nameInput.length > 0) {
85
+ opts.formSelectors.nameInput = 'input[name="' + cardCtrl.nameInput[0].name + '"]';
86
+ }
87
+
88
+ //Don't initialize card until angular has had a chance to update the DOM with any interpolated bindings
89
+ $timeout(angular.noop)
90
+ .then(function () {
91
+ new Card(opts);
92
+ });
93
+ }
94
+ };
95
+ }])
96
+
97
+ .directive('cardNumber', ['$compile', function ($compile) {
98
+ return {
99
+ restrict: 'A',
100
+ scope: {
101
+ ngModel: '='
102
+ },
103
+ require: [
104
+ '^card',
105
+ 'ngModel'
106
+ ],
107
+ link: function (scope, element, attributes, ctrls) {
108
+ var cardCtrl = ctrls[0];
109
+ cardCtrl.numberInput = element;
110
+ scope.$watch('ngModel', function (newVal, oldVal) {
111
+ if (!oldVal && !newVal) {
112
+ return;
113
+ }
114
+ if (oldVal === newVal && !newVal) {
115
+ return;
116
+ }
117
+
118
+ var evt = document.createEvent('HTMLEvents');
119
+ evt.initEvent('keyup', false, true);
120
+ element[0].dispatchEvent(evt);
121
+ });
122
+ }
123
+ };
124
+ }])
125
+
126
+ .directive('cardName', ['$compile', function ($compile) {
127
+ return {
128
+ restrict: 'A',
129
+ scope: {
130
+ ngModel: '='
131
+ },
132
+ require: [
133
+ '^card',
134
+ 'ngModel'
135
+ ],
136
+ link: function (scope, element, attributes, ctrls) {
137
+ var cardCtrl = ctrls[0];
138
+ cardCtrl.nameInput = element;
139
+ scope.$watch('ngModel', function (newVal, oldVal) {
140
+ if (!oldVal && !newVal) {
141
+ return;
142
+ }
143
+ if (oldVal === newVal && !newVal) {
144
+ return;
145
+ }
146
+
147
+ var evt = document.createEvent('HTMLEvents');
148
+ evt.initEvent('keyup', false, true);
149
+ element[0].dispatchEvent(evt);
150
+ });
151
+ }
152
+ };
153
+ }])
154
+
155
+ .directive('cardExpiry', ['$compile', function ($compile) {
156
+ return {
157
+ restrict: 'A',
158
+ scope: {
159
+ ngModel: '=',
160
+ type: '@cardExpiry'
161
+ },
162
+ require: [
163
+ '^card',
164
+ 'ngModel'
165
+ ],
166
+ link: function (scope, element, attributes, ctrls) {
167
+ var cardCtrl = ctrls[0];
168
+ var expiryType = scope.type || 'combined';
169
+ if (angular.isUndefined(cardCtrl.expiryInput)) {
170
+ cardCtrl.expiryInput = {};
171
+ }
172
+ cardCtrl.expiryInput[expiryType] = element;
173
+ scope.$watch('ngModel', function (newVal, oldVal) {
174
+ if (!oldVal && !newVal) {
175
+ return;
176
+ }
177
+ if (oldVal === newVal && !newVal) {
178
+ return;
179
+ }
180
+
181
+ var evt = document.createEvent('HTMLEvents');
182
+ evt.initEvent('keyup', false, true);
183
+ element[0].dispatchEvent(evt);
184
+ });
185
+ }
186
+ };
187
+ }])
188
+
189
+ .directive('cardCvc', ['$compile', function ($compile) {
190
+ return {
191
+ restrict: 'A',
192
+ scope: {
193
+ ngModel: '='
194
+ },
195
+ require: [
196
+ '^card',
197
+ 'ngModel'
198
+ ],
199
+ link: function (scope, element, attributes, ctrls) {
200
+ var cardCtrl = ctrls[0];
201
+ cardCtrl.cvcInput = element;
202
+ scope.$watch('ngModel', function (newVal, oldVal) {
203
+ if (!oldVal && !newVal) {
204
+ return;
205
+ }
206
+ if (oldVal === newVal && !newVal) {
207
+ return;
208
+ }
209
+
210
+ var evt = document.createEvent('HTMLEvents');
211
+ evt.initEvent('keyup', false, true);
212
+ element[0].dispatchEvent(evt);
213
+ });
214
+ }
215
+ };
216
+ }]);
217
+
218
+ })(window, window.document, hasRequire ? require('card') : window.Card, hasRequire ? require('angular') : window.angular);
219
+
220
+ if(typeof module !== 'undefined') {
221
+ module.exports = 'gavruk.card';
222
+ }
@@ -0,0 +1,8 @@
1
+ //= require angular
2
+ //= require angular-route
3
+ //= require angular-sanitize
4
+ //= require easy_pay_u_latam/subscriptions/country-picker.min
5
+ //= require easy_pay_u_latam/subscriptions/card
6
+ //= require easy_pay_u_latam/subscriptions/angular-card
7
+ //= require easy_pay_u_latam/subscriptions/controllers/Main
8
+ //= require easy_pay_u_latam/subscriptions/controllers/Subscriptions
@@ -0,0 +1,2533 @@
1
+ var card =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId])
11
+ /******/ return installedModules[moduleId].exports;
12
+
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ exports: {},
16
+ /******/ id: moduleId,
17
+ /******/ loaded: false
18
+ /******/ };
19
+
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.loaded = true;
25
+
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+
30
+
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+
37
+ /******/ // __webpack_public_path__
38
+ /******/ __webpack_require__.p = "";
39
+
40
+ /******/ // Load entry module and return exports
41
+ /******/ return __webpack_require__(0);
42
+ /******/ })
43
+ /************************************************************************/
44
+ /******/ ([
45
+ /* 0 */
46
+ /***/ (function(module, exports, __webpack_require__) {
47
+
48
+ /* WEBPACK VAR INJECTION */(function(global) {var Card, QJ, extend, payment,
49
+ bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
50
+
51
+ __webpack_require__(1);
52
+
53
+ QJ = __webpack_require__(5);
54
+
55
+ payment = __webpack_require__(6);
56
+
57
+ extend = __webpack_require__(7);
58
+
59
+ Card = (function() {
60
+ var bindVal;
61
+
62
+ Card.prototype.initializedDataAttr = "data-jp-card-initialized";
63
+
64
+ Card.prototype.cardTemplate = '' + '<div class="jp-card-container">' + '<div class="jp-card">' + '<div class="jp-card-front">' + '<div class="jp-card-logo jp-card-elo">' + '<div class="e">e</div>' + '<div class="l">l</div>' + '<div class="o">o</div>' + '</div>' + '<div class="jp-card-logo jp-card-visa">Visa</div>' + '<div class="jp-card-logo jp-card-visaelectron">Visa<div class="elec">Electron</div></div>' + '<div class="jp-card-logo jp-card-mastercard">Mastercard</div>' + '<div class="jp-card-logo jp-card-maestro">Maestro</div>' + '<div class="jp-card-logo jp-card-amex"></div>' + '<div class="jp-card-logo jp-card-discover">discover</div>' + '<div class="jp-card-logo jp-card-dinersclub"></div>' + '<div class="jp-card-logo jp-card-dankort"><div class="dk"><div class="d"></div><div class="k"></div></div></div>' + '<div class="jp-card-logo jp-card-jcb">' + '<div class="j">J</div>' + '<div class="c">C</div>' + '<div class="b">B</div>' + '</div>' + '<div class="jp-card-lower">' + '<div class="jp-card-shiny"></div>' + '<div class="jp-card-cvc jp-card-display">{{cvc}}</div>' + '<div class="jp-card-number jp-card-display">{{number}}</div>' + '<div class="jp-card-name jp-card-display">{{name}}</div>' + '<div class="jp-card-expiry jp-card-display" data-before="{{monthYear}}" data-after="{{validDate}}">{{expiry}}</div>' + '</div>' + '</div>' + '<div class="jp-card-back">' + '<div class="jp-card-bar"></div>' + '<div class="jp-card-cvc jp-card-display">{{cvc}}</div>' + '<div class="jp-card-shiny"></div>' + '</div>' + '</div>' + '</div>';
65
+
66
+ Card.prototype.template = function(tpl, data) {
67
+ return tpl.replace(/\{\{(.*?)\}\}/g, function(match, key, str) {
68
+ return data[key];
69
+ });
70
+ };
71
+
72
+ Card.prototype.cardTypes = ['jp-card-amex', 'jp-card-dankort', 'jp-card-dinersclub', 'jp-card-discover', 'jp-card-jcb', 'jp-card-laser', 'jp-card-maestro', 'jp-card-mastercard', 'jp-card-unionpay', 'jp-card-visa', 'jp-card-visaelectron', 'jp-card-elo'];
73
+
74
+ Card.prototype.defaults = {
75
+ formatting: true,
76
+ formSelectors: {
77
+ numberInput: 'input[name="number"]',
78
+ expiryInput: 'input[name="expiry"]',
79
+ cvcInput: 'input[name="cvc"]',
80
+ nameInput: 'input[name="name"]'
81
+ },
82
+ cardSelectors: {
83
+ cardContainer: '.jp-card-container',
84
+ card: '.jp-card',
85
+ numberDisplay: '.jp-card-number',
86
+ expiryDisplay: '.jp-card-expiry',
87
+ cvcDisplay: '.jp-card-cvc',
88
+ nameDisplay: '.jp-card-name'
89
+ },
90
+ messages: {
91
+ validDate: 'valid\nthru',
92
+ monthYear: 'month/year'
93
+ },
94
+ placeholders: {
95
+ number: '&bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull;',
96
+ cvc: '&bull;&bull;&bull;',
97
+ expiry: '&bull;&bull;/&bull;&bull;',
98
+ name: 'Full Name'
99
+ },
100
+ masks: {
101
+ cardNumber: false
102
+ },
103
+ classes: {
104
+ valid: 'jp-card-valid',
105
+ invalid: 'jp-card-invalid'
106
+ },
107
+ debug: false
108
+ };
109
+
110
+ function Card(opts) {
111
+ this.maskCardNumber = bind(this.maskCardNumber, this);
112
+ var toInitialize;
113
+ this.options = extend(true, this.defaults, opts);
114
+ if (!this.options.form) {
115
+ console.log("Please provide a form");
116
+ return;
117
+ }
118
+ this.$el = QJ(this.options.form);
119
+ if (!this.options.container) {
120
+ console.log("Please provide a container");
121
+ return;
122
+ }
123
+ this.$container = QJ(this.options.container);
124
+ toInitialize = QJ.isDOMElement(this.$container) ? this.$container : this.$container[0];
125
+ if (toInitialize.getAttribute(this.initializedDataAttr)) {
126
+ return;
127
+ }
128
+ toInitialize.setAttribute(this.initializedDataAttr, true);
129
+ this.render();
130
+ this.attachHandlers();
131
+ this.handleInitialPlaceholders();
132
+ }
133
+
134
+ Card.prototype.render = function() {
135
+ var $cardContainer, baseWidth, name, obj, ref, ref1, selector, ua;
136
+ QJ.append(this.$container, this.template(this.cardTemplate, extend({}, this.options.messages, this.options.placeholders)));
137
+ ref = this.options.cardSelectors;
138
+ for (name in ref) {
139
+ selector = ref[name];
140
+ this["$" + name] = QJ.find(this.$container, selector);
141
+ }
142
+ ref1 = this.options.formSelectors;
143
+ for (name in ref1) {
144
+ selector = ref1[name];
145
+ selector = this.options[name] ? this.options[name] : selector;
146
+ obj = QJ.find(this.$el, selector);
147
+ if (!obj.length && this.options.debug) {
148
+ console.error("Card can't find a " + name + " in your form.");
149
+ }
150
+ this["$" + name] = obj;
151
+ }
152
+ if (this.options.formatting) {
153
+ Payment.formatCardNumber(this.$numberInput);
154
+ Payment.formatCardCVC(this.$cvcInput);
155
+ Payment.formatCardExpiry(this.$expiryInput);
156
+ }
157
+ if (this.options.width) {
158
+ $cardContainer = QJ(this.options.cardSelectors.cardContainer)[0];
159
+ baseWidth = parseInt($cardContainer.clientWidth || window.getComputedStyle($cardContainer).width);
160
+ $cardContainer.style.transform = "scale(" + (this.options.width / baseWidth) + ")";
161
+ }
162
+ if (typeof navigator !== "undefined" && navigator !== null ? navigator.userAgent : void 0) {
163
+ ua = navigator.userAgent.toLowerCase();
164
+ if (ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1) {
165
+ QJ.addClass(this.$card, 'jp-card-safari');
166
+ }
167
+ }
168
+ if (/MSIE 10\./i.test(navigator.userAgent)) {
169
+ QJ.addClass(this.$card, 'jp-card-ie-10');
170
+ }
171
+ if (/rv:11.0/i.test(navigator.userAgent)) {
172
+ return QJ.addClass(this.$card, 'jp-card-ie-11');
173
+ }
174
+ };
175
+
176
+ Card.prototype.attachHandlers = function() {
177
+ var expiryFilters, numberInputFilters;
178
+ numberInputFilters = [this.validToggler('cardNumber')];
179
+ if (this.options.masks.cardNumber) {
180
+ numberInputFilters.push(this.maskCardNumber);
181
+ }
182
+ bindVal(this.$numberInput, this.$numberDisplay, {
183
+ fill: false,
184
+ filters: numberInputFilters
185
+ });
186
+ QJ.on(this.$numberInput, 'payment.cardType', this.handle('setCardType'));
187
+ expiryFilters = [
188
+ function(val) {
189
+ return val.replace(/(\s+)/g, '');
190
+ }
191
+ ];
192
+ expiryFilters.push(this.validToggler('cardExpiry'));
193
+ bindVal(this.$expiryInput, this.$expiryDisplay, {
194
+ join: function(text) {
195
+ if (text[0].length === 2 || text[1]) {
196
+ return "/";
197
+ } else {
198
+ return "";
199
+ }
200
+ },
201
+ filters: expiryFilters
202
+ });
203
+ bindVal(this.$cvcInput, this.$cvcDisplay, {
204
+ filters: this.validToggler('cardCVC')
205
+ });
206
+ QJ.on(this.$cvcInput, 'focus', this.handle('flipCard'));
207
+ QJ.on(this.$cvcInput, 'blur', this.handle('unflipCard'));
208
+ return bindVal(this.$nameInput, this.$nameDisplay, {
209
+ fill: false,
210
+ filters: this.validToggler('cardHolderName'),
211
+ join: ' '
212
+ });
213
+ };
214
+
215
+ Card.prototype.handleInitialPlaceholders = function() {
216
+ var el, name, ref, results, selector;
217
+ ref = this.options.formSelectors;
218
+ results = [];
219
+ for (name in ref) {
220
+ selector = ref[name];
221
+ el = this["$" + name];
222
+ if (QJ.val(el)) {
223
+ QJ.trigger(el, 'paste');
224
+ results.push(setTimeout(function() {
225
+ return QJ.trigger(el, 'keyup');
226
+ }));
227
+ } else {
228
+ results.push(void 0);
229
+ }
230
+ }
231
+ return results;
232
+ };
233
+
234
+ Card.prototype.handle = function(fn) {
235
+ return (function(_this) {
236
+ return function(e) {
237
+ var args;
238
+ args = Array.prototype.slice.call(arguments);
239
+ args.unshift(e.target);
240
+ return _this.handlers[fn].apply(_this, args);
241
+ };
242
+ })(this);
243
+ };
244
+
245
+ Card.prototype.validToggler = function(validatorName) {
246
+ var isValid;
247
+ if (validatorName === "cardExpiry") {
248
+ isValid = function(val) {
249
+ var objVal;
250
+ objVal = Payment.fns.cardExpiryVal(val);
251
+ return Payment.fns.validateCardExpiry(objVal.month, objVal.year);
252
+ };
253
+ } else if (validatorName === "cardCVC") {
254
+ isValid = (function(_this) {
255
+ return function(val) {
256
+ return Payment.fns.validateCardCVC(val, _this.cardType);
257
+ };
258
+ })(this);
259
+ } else if (validatorName === "cardNumber") {
260
+ isValid = function(val) {
261
+ return Payment.fns.validateCardNumber(val);
262
+ };
263
+ } else if (validatorName === "cardHolderName") {
264
+ isValid = function(val) {
265
+ return val !== "";
266
+ };
267
+ }
268
+ return (function(_this) {
269
+ return function(val, $in, $out) {
270
+ var result;
271
+ result = isValid(val);
272
+ _this.toggleValidClass($in, result);
273
+ _this.toggleValidClass($out, result);
274
+ return val;
275
+ };
276
+ })(this);
277
+ };
278
+
279
+ Card.prototype.toggleValidClass = function(el, test) {
280
+ QJ.toggleClass(el, this.options.classes.valid, test);
281
+ return QJ.toggleClass(el, this.options.classes.invalid, !test);
282
+ };
283
+
284
+ Card.prototype.maskCardNumber = function(val, el, out) {
285
+ var mask, numbers;
286
+ mask = this.options.masks.cardNumber;
287
+ numbers = val.split(' ');
288
+ if (numbers.length >= 3) {
289
+ numbers.forEach(function(item, idx) {
290
+ if (idx !== numbers.length - 1) {
291
+ return numbers[idx] = numbers[idx].replace(/\d/g, mask);
292
+ }
293
+ });
294
+ return numbers.join(' ');
295
+ } else {
296
+ return val.replace(/\d/g, mask);
297
+ }
298
+ };
299
+
300
+ Card.prototype.handlers = {
301
+ setCardType: function($el, e) {
302
+ var cardType;
303
+ cardType = e.data;
304
+ if (!QJ.hasClass(this.$card, cardType)) {
305
+ QJ.removeClass(this.$card, 'jp-card-unknown');
306
+ QJ.removeClass(this.$card, this.cardTypes.join(' '));
307
+ QJ.addClass(this.$card, "jp-card-" + cardType);
308
+ QJ.toggleClass(this.$card, 'jp-card-identified', cardType !== 'unknown');
309
+ return this.cardType = cardType;
310
+ }
311
+ },
312
+ flipCard: function() {
313
+ return QJ.addClass(this.$card, 'jp-card-flipped');
314
+ },
315
+ unflipCard: function() {
316
+ return QJ.removeClass(this.$card, 'jp-card-flipped');
317
+ }
318
+ };
319
+
320
+ bindVal = function(el, out, opts) {
321
+ var joiner, o, outDefaults;
322
+ if (opts == null) {
323
+ opts = {};
324
+ }
325
+ opts.fill = opts.fill || false;
326
+ opts.filters = opts.filters || [];
327
+ if (!(opts.filters instanceof Array)) {
328
+ opts.filters = [opts.filters];
329
+ }
330
+ opts.join = opts.join || "";
331
+ if (!(typeof opts.join === "function")) {
332
+ joiner = opts.join;
333
+ opts.join = function() {
334
+ return joiner;
335
+ };
336
+ }
337
+ outDefaults = (function() {
338
+ var j, len, results;
339
+ results = [];
340
+ for (j = 0, len = out.length; j < len; j++) {
341
+ o = out[j];
342
+ results.push(o.textContent);
343
+ }
344
+ return results;
345
+ })();
346
+ QJ.on(el, 'focus', function() {
347
+ return QJ.addClass(out, 'jp-card-focused');
348
+ });
349
+ QJ.on(el, 'blur', function() {
350
+ return QJ.removeClass(out, 'jp-card-focused');
351
+ });
352
+ QJ.on(el, 'keyup change paste', function(e) {
353
+ var elem, filter, i, j, join, k, len, len1, outEl, outVal, ref, results, val;
354
+ val = (function() {
355
+ var j, len, results;
356
+ results = [];
357
+ for (j = 0, len = el.length; j < len; j++) {
358
+ elem = el[j];
359
+ results.push(QJ.val(elem));
360
+ }
361
+ return results;
362
+ })();
363
+ join = opts.join(val);
364
+ val = val.join(join);
365
+ if (val === join) {
366
+ val = "";
367
+ }
368
+ ref = opts.filters;
369
+ for (j = 0, len = ref.length; j < len; j++) {
370
+ filter = ref[j];
371
+ val = filter(val, el, out);
372
+ }
373
+ results = [];
374
+ for (i = k = 0, len1 = out.length; k < len1; i = ++k) {
375
+ outEl = out[i];
376
+ if (opts.fill) {
377
+ outVal = val + outDefaults[i].substring(val.length);
378
+ } else {
379
+ outVal = val || outDefaults[i];
380
+ }
381
+ results.push(outEl.textContent = outVal);
382
+ }
383
+ return results;
384
+ });
385
+ return el;
386
+ };
387
+
388
+ return Card;
389
+
390
+ })();
391
+
392
+ module.exports = Card;
393
+
394
+ global.Card = Card;
395
+
396
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
397
+
398
+ /***/ }),
399
+ /* 1 */
400
+ /***/ (function(module, exports, __webpack_require__) {
401
+
402
+ // style-loader: Adds some css to the DOM by adding a <style> tag
403
+
404
+ // load the styles
405
+ var content = __webpack_require__(2);
406
+ if(typeof content === 'string') content = [[module.id, content, '']];
407
+ // add the styles to the DOM
408
+ var update = __webpack_require__(4)(content, {});
409
+ if(content.locals) module.exports = content.locals;
410
+ // Hot Module Replacement
411
+ if(false) {
412
+ // When the styles change, update the <style> tags
413
+ if(!content.locals) {
414
+ module.hot.accept("!!../../node_modules/css-loader/index.js!../../node_modules/sass-loader/index.js!./card.scss", function() {
415
+ var newContent = require("!!../../node_modules/css-loader/index.js!../../node_modules/sass-loader/index.js!./card.scss");
416
+ if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
417
+ update(newContent);
418
+ });
419
+ }
420
+ // When the module is disposed, remove the <style> tags
421
+ module.hot.dispose(function() { update(); });
422
+ }
423
+
424
+ /***/ }),
425
+ /* 2 */
426
+ /***/ (function(module, exports, __webpack_require__) {
427
+
428
+ exports = module.exports = __webpack_require__(3)();
429
+ // imports
430
+
431
+
432
+ // module
433
+ exports.push([module.id, ".jp-card.jp-card-safari.jp-card-identified .jp-card-front:before, .jp-card.jp-card-safari.jp-card-identified .jp-card-back:before {\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), -webkit-linear-gradient(-245deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%); }\n\n.jp-card.jp-card-ie-10.jp-card-flipped, .jp-card.jp-card-ie-11.jp-card-flipped {\n -webkit-transform: 0deg;\n -moz-transform: 0deg;\n -ms-transform: 0deg;\n -o-transform: 0deg;\n transform: 0deg; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-front, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-front {\n -webkit-transform: rotateY(0deg);\n -moz-transform: rotateY(0deg);\n -ms-transform: rotateY(0deg);\n -o-transform: rotateY(0deg);\n transform: rotateY(0deg); }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back {\n -webkit-transform: rotateY(0deg);\n -moz-transform: rotateY(0deg);\n -ms-transform: rotateY(0deg);\n -o-transform: rotateY(0deg);\n transform: rotateY(0deg); }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back:after, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back:after {\n left: 18%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-cvc, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-cvc {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg);\n left: 5%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-shiny, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-shiny {\n left: 84%; }\n .jp-card.jp-card-ie-10.jp-card-flipped .jp-card-back .jp-card-shiny:after, .jp-card.jp-card-ie-11.jp-card-flipped .jp-card-back .jp-card-shiny:after {\n left: -480%;\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n\n.jp-card.jp-card-ie-10.jp-card-amex .jp-card-back, .jp-card.jp-card-ie-11.jp-card-amex .jp-card-back {\n display: none; }\n\n.jp-card-logo {\n height: 36px;\n width: 60px;\n font-style: italic; }\n .jp-card-logo, .jp-card-logo:before, .jp-card-logo:after {\n box-sizing: border-box; }\n\n.jp-card-logo.jp-card-amex {\n text-transform: uppercase;\n font-size: 4px;\n font-weight: bold;\n color: white;\n background-image: repeating-radial-gradient(circle at center, #FFF 1px, #999 2px);\n background-image: repeating-radial-gradient(circle at center, #FFF 1px, #999 2px);\n border: 1px solid #EEE; }\n .jp-card-logo.jp-card-amex:before, .jp-card-logo.jp-card-amex:after {\n width: 28px;\n display: block;\n position: absolute;\n left: 16px; }\n .jp-card-logo.jp-card-amex:before {\n height: 28px;\n content: \"american\";\n top: 3px;\n text-align: left;\n padding-left: 2px;\n padding-top: 11px;\n background: #267AC3; }\n .jp-card-logo.jp-card-amex:after {\n content: \"express\";\n bottom: 11px;\n text-align: right;\n padding-right: 2px; }\n\n.jp-card.jp-card-amex.jp-card-flipped {\n -webkit-transform: none;\n -moz-transform: none;\n -ms-transform: none;\n -o-transform: none;\n transform: none; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front:before, .jp-card.jp-card-amex.jp-card-identified .jp-card-back:before {\n background-color: #108168; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front .jp-card-logo.jp-card-amex {\n opacity: 1; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front .jp-card-cvc {\n visibility: visible; }\n\n.jp-card.jp-card-amex.jp-card-identified .jp-card-front:after {\n opacity: 1; }\n\n.jp-card-logo.jp-card-discover {\n background: #FF6600;\n color: #111;\n text-transform: uppercase;\n font-style: normal;\n font-weight: bold;\n font-size: 10px;\n text-align: center;\n overflow: hidden;\n z-index: 1;\n padding-top: 9px;\n letter-spacing: .03em;\n border: 1px solid #EEE; }\n .jp-card-logo.jp-card-discover:before, .jp-card-logo.jp-card-discover:after {\n content: \" \";\n display: block;\n position: absolute; }\n .jp-card-logo.jp-card-discover:before {\n background: white;\n width: 200px;\n height: 200px;\n border-radius: 200px;\n bottom: -5%;\n right: -80%;\n z-index: -1; }\n .jp-card-logo.jp-card-discover:after {\n width: 8px;\n height: 8px;\n border-radius: 4px;\n top: 10px;\n left: 27px;\n background-color: #FF6600;\n background-image: -webkit-radial-gradient(#FF6600, #fff);\n background-image: radial-gradient( #FF6600, #fff);\n content: \"network\";\n font-size: 4px;\n line-height: 24px;\n text-indent: -7px; }\n\n.jp-card .jp-card-front .jp-card-logo.jp-card-discover {\n right: 12%;\n top: 18%; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-front:before, .jp-card.jp-card-discover.jp-card-identified .jp-card-back:before {\n background-color: #86B8CF; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-logo.jp-card-discover {\n opacity: 1; }\n\n.jp-card.jp-card-discover.jp-card-identified .jp-card-front:after {\n -webkit-transition: 400ms;\n -moz-transition: 400ms;\n transition: 400ms;\n content: \" \";\n display: block;\n background-color: #FF6600;\n background-image: -webkit-linear-gradient(#FF6600, #ffa366, #FF6600);\n background-image: linear-gradient(#FF6600, #ffa366, #FF6600);\n height: 50px;\n width: 50px;\n border-radius: 25px;\n position: absolute;\n left: 100%;\n top: 15%;\n margin-left: -25px;\n box-shadow: inset 1px 1px 3px 1px rgba(0, 0, 0, 0.5); }\n\n.jp-card-logo.jp-card-visa {\n text-transform: uppercase;\n color: white;\n text-align: center;\n font-weight: bold;\n font-size: 24px;\n line-height: 18px;\n margin-top: 5px; }\n .jp-card-logo.jp-card-visa:before, .jp-card-logo.jp-card-visa:after {\n content: \" \";\n display: block;\n width: 100%;\n height: 25%; }\n .jp-card-logo.jp-card-visa:before {\n position: absolute;\n left: -4px;\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 0 12px 6px 0;\n border-color: transparent #ffffff transparent transparent; }\n\n.jp-card.jp-card-visa.jp-card-identified .jp-card-front:before, .jp-card.jp-card-visa.jp-card-identified .jp-card-back:before {\n background-color: #191278; }\n\n.jp-card.jp-card-visa.jp-card-identified .jp-card-logo.jp-card-visa {\n opacity: 1;\n box-shadow: none; }\n\n.jp-card-logo.jp-card-visaelectron {\n background: white;\n text-transform: uppercase;\n color: #1A1876;\n text-align: center;\n font-weight: bold;\n font-size: 15px;\n line-height: 18px; }\n .jp-card-logo.jp-card-visaelectron:before, .jp-card-logo.jp-card-visaelectron:after {\n content: \" \";\n display: block;\n width: 100%;\n height: 25%; }\n .jp-card-logo.jp-card-visaelectron:before {\n background: #1A1876; }\n .jp-card-logo.jp-card-visaelectron:after {\n background: #E79800; }\n .jp-card-logo.jp-card-visaelectron .elec {\n float: right;\n font-family: arial;\n font-size: 9px;\n margin-right: 1px;\n margin-top: -5px;\n text-transform: none; }\n\n.jp-card.jp-card-visaelectron.jp-card-identified .jp-card-front:before, .jp-card.jp-card-visaelectron.jp-card-identified .jp-card-back:before {\n background-color: #191278; }\n\n.jp-card.jp-card-visaelectron.jp-card-identified .jp-card-logo.jp-card-visaelectron {\n opacity: 1; }\n\n.jp-card-logo.jp-card-mastercard {\n color: white;\n font-style: normal;\n text-transform: lowercase;\n font-weight: bold;\n text-align: center;\n font-size: 9px;\n line-height: 84px;\n z-index: 1;\n text-shadow: 1px 1px rgba(0, 0, 0, 0.6); }\n .jp-card-logo.jp-card-mastercard:before, .jp-card-logo.jp-card-mastercard:after {\n content: \" \";\n display: block;\n width: 36px;\n top: 0;\n position: absolute;\n height: 36px;\n border-radius: 18px; }\n .jp-card-logo.jp-card-mastercard:before {\n left: 0;\n background: #EB001B;\n z-index: -1;\n opacity: 0.9; }\n .jp-card-logo.jp-card-mastercard:after {\n right: 0;\n background: #FF5F00;\n z-index: -2; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-front .jp-card-logo.jp-card-mastercard, .jp-card.jp-card-mastercard.jp-card-identified .jp-card-back .jp-card-logo.jp-card-mastercard {\n box-shadow: none; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-front:before, .jp-card.jp-card-mastercard.jp-card-identified .jp-card-back:before {\n background-color: #0061A8; }\n\n.jp-card.jp-card-mastercard.jp-card-identified .jp-card-logo.jp-card-mastercard {\n opacity: 1; }\n\n.jp-card-logo.jp-card-maestro {\n color: white;\n font-style: normal;\n text-transform: lowercase;\n font-weight: bold;\n text-align: center;\n font-size: 14px;\n line-height: 84px;\n z-index: 1;\n text-shadow: 1px 1px rgba(0, 0, 0, 0.6); }\n .jp-card-logo.jp-card-maestro:before, .jp-card-logo.jp-card-maestro:after {\n content: \" \";\n display: block;\n width: 36px;\n top: 0;\n position: absolute;\n height: 36px;\n border-radius: 18px; }\n .jp-card-logo.jp-card-maestro:before {\n left: 0;\n background: #EB001B;\n z-index: -2; }\n .jp-card-logo.jp-card-maestro:after {\n right: 0;\n background: #00A2E5;\n z-index: -1;\n opacity: 0.8; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-front .jp-card-logo.jp-card-maestro, .jp-card.jp-card-maestro.jp-card-identified .jp-card-back .jp-card-logo.jp-card-maestro {\n box-shadow: none; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-front:before, .jp-card.jp-card-maestro.jp-card-identified .jp-card-back:before {\n background-color: #0B2C5F; }\n\n.jp-card.jp-card-maestro.jp-card-identified .jp-card-logo.jp-card-maestro {\n opacity: 1; }\n\n.jp-card-logo.jp-card-dankort {\n width: 60px;\n height: 36px;\n padding: 3px;\n border-radius: 8px;\n border: #000000 1px solid;\n background-color: #FFFFFF; }\n .jp-card-logo.jp-card-dankort .dk {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: hidden; }\n .jp-card-logo.jp-card-dankort .dk:before {\n background-color: #ED1C24;\n content: '';\n position: absolute;\n width: 100%;\n height: 100%;\n display: block;\n border-radius: 6px; }\n .jp-card-logo.jp-card-dankort .dk:after {\n content: '';\n position: absolute;\n top: 50%;\n margin-top: -7.7px;\n right: 0;\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 7px 7px 10px 0;\n border-color: transparent #ED1C24 transparent transparent;\n z-index: 1; }\n .jp-card-logo.jp-card-dankort .d, .jp-card-logo.jp-card-dankort .k {\n position: absolute;\n top: 50%;\n width: 50%;\n display: block;\n height: 15.4px;\n margin-top: -7.7px;\n background: white; }\n .jp-card-logo.jp-card-dankort .d {\n left: 0;\n border-radius: 0 8px 10px 0; }\n .jp-card-logo.jp-card-dankort .d:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n display: block;\n background: #ED1C24;\n border-radius: 2px 4px 6px 0px;\n height: 5px;\n width: 7px;\n margin: -3px 0 0 -4px; }\n .jp-card-logo.jp-card-dankort .k {\n right: 0; }\n .jp-card-logo.jp-card-dankort .k:before, .jp-card-logo.jp-card-dankort .k:after {\n content: '';\n position: absolute;\n right: 50%;\n width: 0;\n height: 0;\n border-style: solid;\n margin-right: -1px; }\n .jp-card-logo.jp-card-dankort .k:before {\n top: 0;\n border-width: 8px 5px 0 0;\n border-color: #ED1C24 transparent transparent transparent; }\n .jp-card-logo.jp-card-dankort .k:after {\n bottom: 0;\n border-width: 0 5px 8px 0;\n border-color: transparent transparent #ED1C24 transparent; }\n\n.jp-card.jp-card-dankort.jp-card-identified .jp-card-front:before, .jp-card.jp-card-dankort.jp-card-identified .jp-card-back:before {\n background-color: #0055C7; }\n\n.jp-card.jp-card-dankort.jp-card-identified .jp-card-logo.jp-card-dankort {\n opacity: 1; }\n\n.jp-card-logo.jp-card-elo {\n height: 50px;\n width: 50px;\n border-radius: 100%;\n background: black;\n color: white;\n text-align: center;\n text-transform: lowercase;\n font-size: 21px;\n font-style: normal;\n letter-spacing: 1px;\n font-weight: bold;\n padding-top: 13px; }\n .jp-card-logo.jp-card-elo .e, .jp-card-logo.jp-card-elo .l, .jp-card-logo.jp-card-elo .o {\n display: inline-block;\n position: relative; }\n .jp-card-logo.jp-card-elo .e {\n -webkit-transform: rotate(-15deg);\n -moz-transform: rotate(-15deg);\n -ms-transform: rotate(-15deg);\n -o-transform: rotate(-15deg);\n transform: rotate(-15deg); }\n .jp-card-logo.jp-card-elo .o {\n position: relative;\n display: inline-block;\n width: 12px;\n height: 12px;\n right: 0;\n top: 7px;\n border-radius: 100%;\n background-image: -webkit-linear-gradient( yellow 50%, red 50%);\n background-image: linear-gradient( yellow 50%, red 50%);\n -webkit-transform: rotate(40deg);\n -moz-transform: rotate(40deg);\n -ms-transform: rotate(40deg);\n -o-transform: rotate(40deg);\n transform: rotate(40deg);\n text-indent: -9999px; }\n .jp-card-logo.jp-card-elo .o:before {\n content: \"\";\n position: absolute;\n width: 49%;\n height: 49%;\n background: black;\n border-radius: 100%;\n text-indent: -99999px;\n top: 25%;\n left: 25%; }\n\n.jp-card.jp-card-elo.jp-card-identified .jp-card-front:before, .jp-card.jp-card-elo.jp-card-identified .jp-card-back:before {\n background-color: #6F6969; }\n\n.jp-card.jp-card-elo.jp-card-identified .jp-card-logo.jp-card-elo {\n opacity: 1; }\n\n.jp-card-logo.jp-card-jcb {\n border-radius: 5px 0px 5px 0px;\n -moz-border-radius: 5px 0px 5px 0px;\n -webkit-border-radius: 5px 0px 5px 0px;\n background-color: white;\n font-style: normal;\n color: white;\n width: 50px;\n padding: 2px 0 0 2px; }\n .jp-card-logo.jp-card-jcb > div {\n width: 15px;\n margin-right: 1px;\n display: inline-block;\n text-align: center;\n text-shadow: 1px 1px rgba(0, 0, 0, 0.6);\n border-radius: 5px 0px 5px 0px;\n -moz-border-radius: 5px 0px 5px 0px;\n -webkit-border-radius: 5px 0px 5px 0px; }\n .jp-card-logo.jp-card-jcb > div:before, .jp-card-logo.jp-card-jcb > div:after {\n content: \" \";\n display: block;\n height: 8px; }\n .jp-card-logo.jp-card-jcb > div.j {\n background-color: #000063;\n background-image: -webkit-linear-gradient(left, #000063, #008cff);\n background-image: linear-gradient(to right,#000063, #008cff); }\n .jp-card-logo.jp-card-jcb > div.c {\n background-color: #630000;\n background-image: -webkit-linear-gradient(left, #630000, #ff008d);\n background-image: linear-gradient(to right,#630000, #ff008d); }\n .jp-card-logo.jp-card-jcb > div.b {\n background-color: #006300;\n background-image: -webkit-linear-gradient(left, #006300, #00ff00);\n background-image: linear-gradient(to right,#006300, #00ff00); }\n\n.jp-card.jp-card-jcb.jp-card-identified .jp-card-front:before, .jp-card.jp-card-jcb.jp-card-identified .jp-card-back:before {\n background-color: #CB8000; }\n\n.jp-card.jp-card-jcb.jp-card-identified .jp-card-logo.jp-card-jcb {\n opacity: 1;\n box-shadow: none; }\n\n.jp-card-logo.jp-card-dinersclub {\n font-family: serif;\n height: 40px;\n width: 100px;\n color: white;\n font-size: 17px;\n font-style: normal;\n letter-spacing: 1px; }\n .jp-card-logo.jp-card-dinersclub::before, .jp-card-logo.jp-card-dinersclub::after {\n display: block;\n position: relative; }\n .jp-card-logo.jp-card-dinersclub::before {\n content: 'Diners Club'; }\n .jp-card-logo.jp-card-dinersclub::after {\n content: 'International';\n text-transform: uppercase;\n font-size: 0.6em; }\n\n.jp-card.jp-card-dinersclub .jp-card-front .jp-card-logo {\n box-shadow: none !important; }\n\n.jp-card.jp-card-dinersclub.jp-card-identified .jp-card-front:before, .jp-card.jp-card-dinersclub.jp-card-identified .jp-card-back:before {\n background-color: #999; }\n\n.jp-card.jp-card-dinersclub.jp-card-identified .jp-card-logo.jp-card-dinersclub {\n opacity: 1; }\n\n.jp-card-container {\n -webkit-perspective: 1000px;\n -moz-perspective: 1000px;\n perspective: 1000px;\n width: 350px;\n max-width: 100%;\n height: 200px;\n margin: auto;\n z-index: 1;\n position: relative; }\n\n.jp-card {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n line-height: 1;\n position: relative;\n width: 100%;\n height: 100%;\n min-width: 315px;\n border-radius: 10px;\n -webkit-transform-style: preserve-3d;\n -moz-transform-style: preserve-3d;\n -ms-transform-style: preserve-3d;\n -o-transform-style: preserve-3d;\n transform-style: preserve-3d;\n -webkit-transition: all 400ms linear;\n -moz-transition: all 400ms linear;\n transition: all 400ms linear; }\n .jp-card > *, .jp-card > *:before, .jp-card > *:after {\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-family: inherit; }\n .jp-card.jp-card-flipped {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n .jp-card .jp-card-front, .jp-card .jp-card-back {\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform-style: preserve-3d;\n -moz-transform-style: preserve-3d;\n -ms-transform-style: preserve-3d;\n -o-transform-style: preserve-3d;\n transform-style: preserve-3d;\n -webkit-transition: all 400ms linear;\n -moz-transition: all 400ms linear;\n transition: all 400ms linear;\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n border-radius: 10px;\n background: #DDD; }\n .jp-card .jp-card-front:before, .jp-card .jp-card-back:before {\n content: \" \";\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n opacity: 0;\n border-radius: 10px;\n -webkit-transition: all 400ms ease;\n -moz-transition: all 400ms ease;\n transition: all 400ms ease; }\n .jp-card .jp-card-front:after, .jp-card .jp-card-back:after {\n content: \" \";\n display: block; }\n .jp-card .jp-card-front .jp-card-display, .jp-card .jp-card-back .jp-card-display {\n color: white;\n font-weight: normal;\n opacity: 0.5;\n -webkit-transition: opacity 400ms linear;\n -moz-transition: opacity 400ms linear;\n transition: opacity 400ms linear; }\n .jp-card .jp-card-front .jp-card-display.jp-card-focused, .jp-card .jp-card-back .jp-card-display.jp-card-focused {\n opacity: 1;\n font-weight: 700; }\n .jp-card .jp-card-front .jp-card-cvc, .jp-card .jp-card-back .jp-card-cvc {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 14px; }\n .jp-card .jp-card-front .jp-card-shiny, .jp-card .jp-card-back .jp-card-shiny {\n width: 50px;\n height: 35px;\n border-radius: 5px;\n background: #CCC;\n position: relative; }\n .jp-card .jp-card-front .jp-card-shiny:before, .jp-card .jp-card-back .jp-card-shiny:before {\n content: \" \";\n display: block;\n width: 70%;\n height: 60%;\n border-top-right-radius: 5px;\n border-bottom-right-radius: 5px;\n background: #d9d9d9;\n position: absolute;\n top: 20%; }\n .jp-card .jp-card-front .jp-card-logo {\n position: absolute;\n opacity: 0;\n right: 5%;\n top: 8%;\n -webkit-transition: 400ms;\n -moz-transition: 400ms;\n transition: 400ms; }\n .jp-card .jp-card-front .jp-card-lower {\n width: 80%;\n position: absolute;\n left: 10%;\n bottom: 30px; }\n @media only screen and (max-width: 480px) {\n .jp-card .jp-card-front .jp-card-lower {\n width: 90%;\n left: 5%; } }\n .jp-card .jp-card-front .jp-card-lower .jp-card-cvc {\n visibility: hidden;\n float: right;\n position: relative;\n bottom: 5px; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-number {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 24px;\n clear: both;\n margin-bottom: 30px; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry {\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n letter-spacing: 0em;\n position: relative;\n float: right;\n width: 25%; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:before, .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:after {\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n font-weight: bold;\n font-size: 7px;\n white-space: pre;\n display: block;\n opacity: .5; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:before {\n content: attr(data-before);\n margin-bottom: 2px;\n font-size: 7px;\n text-transform: uppercase; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-expiry:after {\n position: absolute;\n content: attr(data-after);\n text-align: right;\n right: 100%;\n margin-right: 5px;\n margin-top: 2px;\n bottom: 0; }\n .jp-card .jp-card-front .jp-card-lower .jp-card-name {\n text-transform: uppercase;\n font-family: \"Bitstream Vera Sans Mono\", Consolas, Courier, monospace;\n font-size: 20px;\n max-height: 45px;\n position: absolute;\n bottom: 0;\n width: 190px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: horizontal;\n overflow: hidden;\n text-overflow: ellipsis; }\n .jp-card .jp-card-back {\n -webkit-transform: rotateY(180deg);\n -moz-transform: rotateY(180deg);\n -ms-transform: rotateY(180deg);\n -o-transform: rotateY(180deg);\n transform: rotateY(180deg); }\n .jp-card .jp-card-back .jp-card-bar {\n background-color: #444;\n background-image: -webkit-linear-gradient(#444, #333);\n background-image: linear-gradient(#444, #333);\n width: 100%;\n height: 20%;\n position: absolute;\n top: 10%; }\n .jp-card .jp-card-back:after {\n content: \" \";\n display: block;\n background-color: #FFF;\n background-image: -webkit-linear-gradient(#FFF, #FFF);\n background-image: linear-gradient(#FFF, #FFF);\n width: 80%;\n height: 16%;\n position: absolute;\n top: 40%;\n left: 2%; }\n .jp-card .jp-card-back .jp-card-cvc {\n position: absolute;\n top: 40%;\n left: 85%;\n -webkit-transition-delay: 600ms;\n -moz-transition-delay: 600ms;\n transition-delay: 600ms; }\n .jp-card .jp-card-back .jp-card-shiny {\n position: absolute;\n top: 66%;\n left: 2%; }\n .jp-card .jp-card-back .jp-card-shiny:after {\n content: \"This card has been issued by Jesse Pollak and is licensed for anyone to use anywhere for free. It comes with no warranty. For support issues, please visit: github.com/jessepollak/card.\";\n position: absolute;\n left: 120%;\n top: 5%;\n color: white;\n font-size: 7px;\n width: 230px;\n opacity: .5; }\n .jp-card.jp-card-identified {\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); }\n .jp-card.jp-card-identified .jp-card-front, .jp-card.jp-card-identified .jp-card-back {\n background-color: #000;\n background-color: rgba(0, 0, 0, 0.5); }\n .jp-card.jp-card-identified .jp-card-front:before, .jp-card.jp-card-identified .jp-card-back:before {\n -webkit-transition: all 400ms ease;\n -moz-transition: all 400ms ease;\n transition: all 400ms ease;\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 15% 80%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), -webkit-linear-gradient(-245deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-radial-gradient(circle at 15% 80%, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n opacity: 1; }\n .jp-card.jp-card-identified .jp-card-front .jp-card-logo, .jp-card.jp-card-identified .jp-card-back .jp-card-logo {\n box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3); }\n .jp-card.jp-card-identified.no-radial-gradient .jp-card-front:before, .jp-card.jp-card-identified.no-radial-gradient .jp-card-back:before {\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), -webkit-linear-gradient(-245deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%);\n background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 1px, rgba(255, 255, 255, 0) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.03) 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), repeating-linear-gradient(210deg, rgba(255, 255, 255, 0) 1px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.04) 3px, rgba(255, 255, 255, 0.05) 4px), linear-gradient(-25deg, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.2) 70%, rgba(255, 255, 255, 0) 90%); }\n", ""]);
434
+
435
+ // exports
436
+
437
+
438
+ /***/ }),
439
+ /* 3 */
440
+ /***/ (function(module, exports) {
441
+
442
+ /*
443
+ MIT License http://www.opensource.org/licenses/mit-license.php
444
+ Author Tobias Koppers @sokra
445
+ */
446
+ // css base code, injected by the css-loader
447
+ module.exports = function() {
448
+ var list = [];
449
+
450
+ // return the list of modules as css string
451
+ list.toString = function toString() {
452
+ var result = [];
453
+ for(var i = 0; i < this.length; i++) {
454
+ var item = this[i];
455
+ if(item[2]) {
456
+ result.push("@media " + item[2] + "{" + item[1] + "}");
457
+ } else {
458
+ result.push(item[1]);
459
+ }
460
+ }
461
+ return result.join("");
462
+ };
463
+
464
+ // import a list of modules into the list
465
+ list.i = function(modules, mediaQuery) {
466
+ if(typeof modules === "string")
467
+ modules = [[null, modules, ""]];
468
+ var alreadyImportedModules = {};
469
+ for(var i = 0; i < this.length; i++) {
470
+ var id = this[i][0];
471
+ if(typeof id === "number")
472
+ alreadyImportedModules[id] = true;
473
+ }
474
+ for(i = 0; i < modules.length; i++) {
475
+ var item = modules[i];
476
+ // skip already imported module
477
+ // this implementation is not 100% perfect for weird media query combinations
478
+ // when a module is imported multiple times with different media queries.
479
+ // I hope this will never occur (Hey this way we have smaller bundles)
480
+ if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
481
+ if(mediaQuery && !item[2]) {
482
+ item[2] = mediaQuery;
483
+ } else if(mediaQuery) {
484
+ item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
485
+ }
486
+ list.push(item);
487
+ }
488
+ }
489
+ };
490
+ return list;
491
+ };
492
+
493
+
494
+ /***/ }),
495
+ /* 4 */
496
+ /***/ (function(module, exports, __webpack_require__) {
497
+
498
+ /*
499
+ MIT License http://www.opensource.org/licenses/mit-license.php
500
+ Author Tobias Koppers @sokra
501
+ */
502
+ var stylesInDom = {},
503
+ memoize = function(fn) {
504
+ var memo;
505
+ return function () {
506
+ if (typeof memo === "undefined") memo = fn.apply(this, arguments);
507
+ return memo;
508
+ };
509
+ },
510
+ isOldIE = memoize(function() {
511
+ return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
512
+ }),
513
+ getHeadElement = memoize(function () {
514
+ return document.head || document.getElementsByTagName("head")[0];
515
+ }),
516
+ singletonElement = null,
517
+ singletonCounter = 0,
518
+ styleElementsInsertedAtTop = [];
519
+
520
+ module.exports = function(list, options) {
521
+ if(false) {
522
+ if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
523
+ }
524
+
525
+ options = options || {};
526
+ // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
527
+ // tags it will allow on a page
528
+ if (typeof options.singleton === "undefined") options.singleton = isOldIE();
529
+
530
+ // By default, add <style> tags to the bottom of <head>.
531
+ if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
532
+
533
+ var styles = listToStyles(list);
534
+ addStylesToDom(styles, options);
535
+
536
+ return function update(newList) {
537
+ var mayRemove = [];
538
+ for(var i = 0; i < styles.length; i++) {
539
+ var item = styles[i];
540
+ var domStyle = stylesInDom[item.id];
541
+ domStyle.refs--;
542
+ mayRemove.push(domStyle);
543
+ }
544
+ if(newList) {
545
+ var newStyles = listToStyles(newList);
546
+ addStylesToDom(newStyles, options);
547
+ }
548
+ for(var i = 0; i < mayRemove.length; i++) {
549
+ var domStyle = mayRemove[i];
550
+ if(domStyle.refs === 0) {
551
+ for(var j = 0; j < domStyle.parts.length; j++)
552
+ domStyle.parts[j]();
553
+ delete stylesInDom[domStyle.id];
554
+ }
555
+ }
556
+ };
557
+ }
558
+
559
+ function addStylesToDom(styles, options) {
560
+ for(var i = 0; i < styles.length; i++) {
561
+ var item = styles[i];
562
+ var domStyle = stylesInDom[item.id];
563
+ if(domStyle) {
564
+ domStyle.refs++;
565
+ for(var j = 0; j < domStyle.parts.length; j++) {
566
+ domStyle.parts[j](item.parts[j]);
567
+ }
568
+ for(; j < item.parts.length; j++) {
569
+ domStyle.parts.push(addStyle(item.parts[j], options));
570
+ }
571
+ } else {
572
+ var parts = [];
573
+ for(var j = 0; j < item.parts.length; j++) {
574
+ parts.push(addStyle(item.parts[j], options));
575
+ }
576
+ stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
577
+ }
578
+ }
579
+ }
580
+
581
+ function listToStyles(list) {
582
+ var styles = [];
583
+ var newStyles = {};
584
+ for(var i = 0; i < list.length; i++) {
585
+ var item = list[i];
586
+ var id = item[0];
587
+ var css = item[1];
588
+ var media = item[2];
589
+ var sourceMap = item[3];
590
+ var part = {css: css, media: media, sourceMap: sourceMap};
591
+ if(!newStyles[id])
592
+ styles.push(newStyles[id] = {id: id, parts: [part]});
593
+ else
594
+ newStyles[id].parts.push(part);
595
+ }
596
+ return styles;
597
+ }
598
+
599
+ function insertStyleElement(options, styleElement) {
600
+ var head = getHeadElement();
601
+ var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
602
+ if (options.insertAt === "top") {
603
+ if(!lastStyleElementInsertedAtTop) {
604
+ head.insertBefore(styleElement, head.firstChild);
605
+ } else if(lastStyleElementInsertedAtTop.nextSibling) {
606
+ head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
607
+ } else {
608
+ head.appendChild(styleElement);
609
+ }
610
+ styleElementsInsertedAtTop.push(styleElement);
611
+ } else if (options.insertAt === "bottom") {
612
+ head.appendChild(styleElement);
613
+ } else {
614
+ throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
615
+ }
616
+ }
617
+
618
+ function removeStyleElement(styleElement) {
619
+ styleElement.parentNode.removeChild(styleElement);
620
+ var idx = styleElementsInsertedAtTop.indexOf(styleElement);
621
+ if(idx >= 0) {
622
+ styleElementsInsertedAtTop.splice(idx, 1);
623
+ }
624
+ }
625
+
626
+ function createStyleElement(options) {
627
+ var styleElement = document.createElement("style");
628
+ styleElement.type = "text/css";
629
+ insertStyleElement(options, styleElement);
630
+ return styleElement;
631
+ }
632
+
633
+ function createLinkElement(options) {
634
+ var linkElement = document.createElement("link");
635
+ linkElement.rel = "stylesheet";
636
+ insertStyleElement(options, linkElement);
637
+ return linkElement;
638
+ }
639
+
640
+ function addStyle(obj, options) {
641
+ var styleElement, update, remove;
642
+
643
+ if (options.singleton) {
644
+ var styleIndex = singletonCounter++;
645
+ styleElement = singletonElement || (singletonElement = createStyleElement(options));
646
+ update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
647
+ remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
648
+ } else if(obj.sourceMap &&
649
+ typeof URL === "function" &&
650
+ typeof URL.createObjectURL === "function" &&
651
+ typeof URL.revokeObjectURL === "function" &&
652
+ typeof Blob === "function" &&
653
+ typeof btoa === "function") {
654
+ styleElement = createLinkElement(options);
655
+ update = updateLink.bind(null, styleElement);
656
+ remove = function() {
657
+ removeStyleElement(styleElement);
658
+ if(styleElement.href)
659
+ URL.revokeObjectURL(styleElement.href);
660
+ };
661
+ } else {
662
+ styleElement = createStyleElement(options);
663
+ update = applyToTag.bind(null, styleElement);
664
+ remove = function() {
665
+ removeStyleElement(styleElement);
666
+ };
667
+ }
668
+
669
+ update(obj);
670
+
671
+ return function updateStyle(newObj) {
672
+ if(newObj) {
673
+ if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
674
+ return;
675
+ update(obj = newObj);
676
+ } else {
677
+ remove();
678
+ }
679
+ };
680
+ }
681
+
682
+ var replaceText = (function () {
683
+ var textStore = [];
684
+
685
+ return function (index, replacement) {
686
+ textStore[index] = replacement;
687
+ return textStore.filter(Boolean).join('\n');
688
+ };
689
+ })();
690
+
691
+ function applyToSingletonTag(styleElement, index, remove, obj) {
692
+ var css = remove ? "" : obj.css;
693
+
694
+ if (styleElement.styleSheet) {
695
+ styleElement.styleSheet.cssText = replaceText(index, css);
696
+ } else {
697
+ var cssNode = document.createTextNode(css);
698
+ var childNodes = styleElement.childNodes;
699
+ if (childNodes[index]) styleElement.removeChild(childNodes[index]);
700
+ if (childNodes.length) {
701
+ styleElement.insertBefore(cssNode, childNodes[index]);
702
+ } else {
703
+ styleElement.appendChild(cssNode);
704
+ }
705
+ }
706
+ }
707
+
708
+ function applyToTag(styleElement, obj) {
709
+ var css = obj.css;
710
+ var media = obj.media;
711
+
712
+ if(media) {
713
+ styleElement.setAttribute("media", media)
714
+ }
715
+
716
+ if(styleElement.styleSheet) {
717
+ styleElement.styleSheet.cssText = css;
718
+ } else {
719
+ while(styleElement.firstChild) {
720
+ styleElement.removeChild(styleElement.firstChild);
721
+ }
722
+ styleElement.appendChild(document.createTextNode(css));
723
+ }
724
+ }
725
+
726
+ function updateLink(linkElement, obj) {
727
+ var css = obj.css;
728
+ var sourceMap = obj.sourceMap;
729
+
730
+ if(sourceMap) {
731
+ // http://stackoverflow.com/a/26603875
732
+ css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
733
+ }
734
+
735
+ var blob = new Blob([css], { type: "text/css" });
736
+
737
+ var oldSrc = linkElement.href;
738
+
739
+ linkElement.href = URL.createObjectURL(blob);
740
+
741
+ if(oldSrc)
742
+ URL.revokeObjectURL(oldSrc);
743
+ }
744
+
745
+
746
+ /***/ }),
747
+ /* 5 */
748
+ /***/ (function(module, exports) {
749
+
750
+ // Generated by CoffeeScript 1.10.0
751
+ (function() {
752
+ var QJ, rreturn, rtrim;
753
+
754
+ QJ = function(selector) {
755
+ if (QJ.isDOMElement(selector)) {
756
+ return selector;
757
+ }
758
+ return document.querySelectorAll(selector);
759
+ };
760
+
761
+ QJ.isDOMElement = function(el) {
762
+ return el && (el.nodeName != null);
763
+ };
764
+
765
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
766
+
767
+ QJ.trim = function(text) {
768
+ if (text === null) {
769
+ return "";
770
+ } else {
771
+ return (text + "").replace(rtrim, "");
772
+ }
773
+ };
774
+
775
+ rreturn = /\r/g;
776
+
777
+ QJ.val = function(el, val) {
778
+ var ret;
779
+ if (arguments.length > 1) {
780
+ return el.value = val;
781
+ } else {
782
+ ret = el.value;
783
+ if (typeof ret === "string") {
784
+ return ret.replace(rreturn, "");
785
+ } else {
786
+ if (ret === null) {
787
+ return "";
788
+ } else {
789
+ return ret;
790
+ }
791
+ }
792
+ }
793
+ };
794
+
795
+ QJ.preventDefault = function(eventObject) {
796
+ if (typeof eventObject.preventDefault === "function") {
797
+ eventObject.preventDefault();
798
+ return;
799
+ }
800
+ eventObject.returnValue = false;
801
+ return false;
802
+ };
803
+
804
+ QJ.normalizeEvent = function(e) {
805
+ var original;
806
+ original = e;
807
+ e = {
808
+ which: original.which != null ? original.which : void 0,
809
+ target: original.target || original.srcElement,
810
+ preventDefault: function() {
811
+ return QJ.preventDefault(original);
812
+ },
813
+ originalEvent: original,
814
+ data: original.data || original.detail
815
+ };
816
+ if (e.which == null) {
817
+ e.which = original.charCode != null ? original.charCode : original.keyCode;
818
+ }
819
+ return e;
820
+ };
821
+
822
+ QJ.on = function(element, eventName, callback) {
823
+ var el, i, j, len, len1, multEventName, originalCallback, ref;
824
+ if (element.length) {
825
+ for (i = 0, len = element.length; i < len; i++) {
826
+ el = element[i];
827
+ QJ.on(el, eventName, callback);
828
+ }
829
+ return;
830
+ }
831
+ if (eventName.match(" ")) {
832
+ ref = eventName.split(" ");
833
+ for (j = 0, len1 = ref.length; j < len1; j++) {
834
+ multEventName = ref[j];
835
+ QJ.on(element, multEventName, callback);
836
+ }
837
+ return;
838
+ }
839
+ originalCallback = callback;
840
+ callback = function(e) {
841
+ e = QJ.normalizeEvent(e);
842
+ return originalCallback(e);
843
+ };
844
+ if (element.addEventListener) {
845
+ return element.addEventListener(eventName, callback, false);
846
+ }
847
+ if (element.attachEvent) {
848
+ eventName = "on" + eventName;
849
+ return element.attachEvent(eventName, callback);
850
+ }
851
+ element['on' + eventName] = callback;
852
+ };
853
+
854
+ QJ.addClass = function(el, className) {
855
+ var e;
856
+ if (el.length) {
857
+ return (function() {
858
+ var i, len, results;
859
+ results = [];
860
+ for (i = 0, len = el.length; i < len; i++) {
861
+ e = el[i];
862
+ results.push(QJ.addClass(e, className));
863
+ }
864
+ return results;
865
+ })();
866
+ }
867
+ if (el.classList) {
868
+ return el.classList.add(className);
869
+ } else {
870
+ return el.className += ' ' + className;
871
+ }
872
+ };
873
+
874
+ QJ.hasClass = function(el, className) {
875
+ var e, hasClass, i, len;
876
+ if (el.length) {
877
+ hasClass = true;
878
+ for (i = 0, len = el.length; i < len; i++) {
879
+ e = el[i];
880
+ hasClass = hasClass && QJ.hasClass(e, className);
881
+ }
882
+ return hasClass;
883
+ }
884
+ if (el.classList) {
885
+ return el.classList.contains(className);
886
+ } else {
887
+ return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
888
+ }
889
+ };
890
+
891
+ QJ.removeClass = function(el, className) {
892
+ var cls, e, i, len, ref, results;
893
+ if (el.length) {
894
+ return (function() {
895
+ var i, len, results;
896
+ results = [];
897
+ for (i = 0, len = el.length; i < len; i++) {
898
+ e = el[i];
899
+ results.push(QJ.removeClass(e, className));
900
+ }
901
+ return results;
902
+ })();
903
+ }
904
+ if (el.classList) {
905
+ ref = className.split(' ');
906
+ results = [];
907
+ for (i = 0, len = ref.length; i < len; i++) {
908
+ cls = ref[i];
909
+ results.push(el.classList.remove(cls));
910
+ }
911
+ return results;
912
+ } else {
913
+ return el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
914
+ }
915
+ };
916
+
917
+ QJ.toggleClass = function(el, className, bool) {
918
+ var e;
919
+ if (el.length) {
920
+ return (function() {
921
+ var i, len, results;
922
+ results = [];
923
+ for (i = 0, len = el.length; i < len; i++) {
924
+ e = el[i];
925
+ results.push(QJ.toggleClass(e, className, bool));
926
+ }
927
+ return results;
928
+ })();
929
+ }
930
+ if (bool) {
931
+ if (!QJ.hasClass(el, className)) {
932
+ return QJ.addClass(el, className);
933
+ }
934
+ } else {
935
+ return QJ.removeClass(el, className);
936
+ }
937
+ };
938
+
939
+ QJ.append = function(el, toAppend) {
940
+ var e;
941
+ if (el.length) {
942
+ return (function() {
943
+ var i, len, results;
944
+ results = [];
945
+ for (i = 0, len = el.length; i < len; i++) {
946
+ e = el[i];
947
+ results.push(QJ.append(e, toAppend));
948
+ }
949
+ return results;
950
+ })();
951
+ }
952
+ return el.insertAdjacentHTML('beforeend', toAppend);
953
+ };
954
+
955
+ QJ.find = function(el, selector) {
956
+ if (el instanceof NodeList || el instanceof Array) {
957
+ el = el[0];
958
+ }
959
+ return el.querySelectorAll(selector);
960
+ };
961
+
962
+ QJ.trigger = function(el, name, data) {
963
+ var e, error, ev;
964
+ try {
965
+ ev = new CustomEvent(name, {
966
+ detail: data
967
+ });
968
+ } catch (error) {
969
+ e = error;
970
+ ev = document.createEvent('CustomEvent');
971
+ if (ev.initCustomEvent) {
972
+ ev.initCustomEvent(name, true, true, data);
973
+ } else {
974
+ ev.initEvent(name, true, true, data);
975
+ }
976
+ }
977
+ return el.dispatchEvent(ev);
978
+ };
979
+
980
+ module.exports = QJ;
981
+
982
+ }).call(this);
983
+
984
+
985
+ /***/ }),
986
+ /* 6 */
987
+ /***/ (function(module, exports, __webpack_require__) {
988
+
989
+ /* WEBPACK VAR INJECTION */(function(global) {// Generated by CoffeeScript 1.10.0
990
+ (function() {
991
+ var Payment, QJ, cardFromNumber, cardFromType, cards, defaultFormat, formatBackCardNumber, formatBackExpiry, formatCardNumber, formatExpiry, formatForwardExpiry, formatForwardSlash, formatMonthExpiry, hasTextSelected, luhnCheck, reFormatCardNumber, restrictCVC, restrictCardNumber, restrictCombinedExpiry, restrictExpiry, restrictMonthExpiry, restrictNumeric, restrictYearExpiry, setCardType,
992
+ indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
993
+
994
+ QJ = __webpack_require__(5);
995
+
996
+ defaultFormat = /(\d{1,4})/g;
997
+
998
+ cards = [
999
+ {
1000
+ type: 'amex',
1001
+ pattern: /^3[47]/,
1002
+ format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
1003
+ length: [15],
1004
+ cvcLength: [4],
1005
+ luhn: true
1006
+ }, {
1007
+ type: 'dankort',
1008
+ pattern: /^5019/,
1009
+ format: defaultFormat,
1010
+ length: [16],
1011
+ cvcLength: [3],
1012
+ luhn: true
1013
+ }, {
1014
+ type: 'hipercard',
1015
+ pattern: /^(384100|384140|384160|606282|637095|637568|60(?!11))/,
1016
+ format: defaultFormat,
1017
+ length: [14, 15, 16, 17, 18, 19],
1018
+ cvcLength: [3],
1019
+ luhn: true
1020
+ }, {
1021
+ type: 'dinersclub',
1022
+ pattern: /^(36|38|30[0-5])/,
1023
+ format: /(\d{1,4})(\d{1,6})?(\d{1,4})?/,
1024
+ length: [14],
1025
+ cvcLength: [3],
1026
+ luhn: true
1027
+ }, {
1028
+ type: 'discover',
1029
+ pattern: /^(6011|65|64[4-9]|622)/,
1030
+ format: defaultFormat,
1031
+ length: [16],
1032
+ cvcLength: [3],
1033
+ luhn: true
1034
+ }, {
1035
+ type: 'jcb',
1036
+ pattern: /^35/,
1037
+ format: defaultFormat,
1038
+ length: [16],
1039
+ cvcLength: [3],
1040
+ luhn: true
1041
+ }, {
1042
+ type: 'laser',
1043
+ pattern: /^(6706|6771|6709)/,
1044
+ format: defaultFormat,
1045
+ length: [16, 17, 18, 19],
1046
+ cvcLength: [3],
1047
+ luhn: true
1048
+ }, {
1049
+ type: 'maestro',
1050
+ pattern: /^(5018|5020|5038|6304|6703|6708|6759|676[1-3])/,
1051
+ format: defaultFormat,
1052
+ length: [12, 13, 14, 15, 16, 17, 18, 19],
1053
+ cvcLength: [3],
1054
+ luhn: true
1055
+ }, {
1056
+ type: 'mastercard',
1057
+ pattern: /^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/,
1058
+ format: defaultFormat,
1059
+ length: [16],
1060
+ cvcLength: [3],
1061
+ luhn: true
1062
+ }, {
1063
+ type: 'unionpay',
1064
+ pattern: /^62/,
1065
+ format: defaultFormat,
1066
+ length: [16, 17, 18, 19],
1067
+ cvcLength: [3],
1068
+ luhn: false
1069
+ }, {
1070
+ type: 'visaelectron',
1071
+ pattern: /^4(026|17500|405|508|844|91[37])/,
1072
+ format: defaultFormat,
1073
+ length: [16],
1074
+ cvcLength: [3],
1075
+ luhn: true
1076
+ }, {
1077
+ type: 'elo',
1078
+ pattern: /^(4011(78|79)|43(1274|8935)|45(1416|7393|763(1|2))|50(4175|6699|67[0-7][0-9]|9000)|627780|63(6297|6368)|650(03([^4])|04([0-9])|05(0|1)|4(0[5-9]|3[0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8])|9([2-6][0-9]|7[0-8])|541|700|720|901)|651652|655000|655021)/,
1079
+ format: defaultFormat,
1080
+ length: [16],
1081
+ cvcLength: [3],
1082
+ luhn: true
1083
+ }, {
1084
+ type: 'visa',
1085
+ pattern: /^4/,
1086
+ format: defaultFormat,
1087
+ length: [13, 16, 19],
1088
+ cvcLength: [3],
1089
+ luhn: true
1090
+ }
1091
+ ];
1092
+
1093
+ cardFromNumber = function(num) {
1094
+ var card, j, len;
1095
+ num = (num + '').replace(/\D/g, '');
1096
+ for (j = 0, len = cards.length; j < len; j++) {
1097
+ card = cards[j];
1098
+ if (card.pattern.test(num)) {
1099
+ return card;
1100
+ }
1101
+ }
1102
+ };
1103
+
1104
+ cardFromType = function(type) {
1105
+ var card, j, len;
1106
+ for (j = 0, len = cards.length; j < len; j++) {
1107
+ card = cards[j];
1108
+ if (card.type === type) {
1109
+ return card;
1110
+ }
1111
+ }
1112
+ };
1113
+
1114
+ luhnCheck = function(num) {
1115
+ var digit, digits, j, len, odd, sum;
1116
+ odd = true;
1117
+ sum = 0;
1118
+ digits = (num + '').split('').reverse();
1119
+ for (j = 0, len = digits.length; j < len; j++) {
1120
+ digit = digits[j];
1121
+ digit = parseInt(digit, 10);
1122
+ if ((odd = !odd)) {
1123
+ digit *= 2;
1124
+ }
1125
+ if (digit > 9) {
1126
+ digit -= 9;
1127
+ }
1128
+ sum += digit;
1129
+ }
1130
+ return sum % 10 === 0;
1131
+ };
1132
+
1133
+ hasTextSelected = function(target) {
1134
+ var e, error, ref;
1135
+ try {
1136
+ if ((target.selectionStart != null) && target.selectionStart !== target.selectionEnd) {
1137
+ return true;
1138
+ }
1139
+ if ((typeof document !== "undefined" && document !== null ? (ref = document.selection) != null ? ref.createRange : void 0 : void 0) != null) {
1140
+ if (document.selection.createRange().text) {
1141
+ return true;
1142
+ }
1143
+ }
1144
+ } catch (error) {
1145
+ e = error;
1146
+ }
1147
+ return false;
1148
+ };
1149
+
1150
+ reFormatCardNumber = function(e) {
1151
+ return setTimeout((function(_this) {
1152
+ return function() {
1153
+ var target, value;
1154
+ target = e.target;
1155
+ value = QJ.val(target);
1156
+ value = Payment.fns.formatCardNumber(value);
1157
+ QJ.val(target, value);
1158
+ return QJ.trigger(target, 'change');
1159
+ };
1160
+ })(this));
1161
+ };
1162
+
1163
+ formatCardNumber = function(maxLength) {
1164
+ return function(e) {
1165
+ var card, digit, i, j, len, length, re, target, upperLength, upperLengths, value;
1166
+ digit = String.fromCharCode(e.which);
1167
+ if (!/^\d+$/.test(digit)) {
1168
+ return;
1169
+ }
1170
+ target = e.target;
1171
+ value = QJ.val(target);
1172
+ card = cardFromNumber(value + digit);
1173
+ length = (value.replace(/\D/g, '') + digit).length;
1174
+ upperLengths = [16];
1175
+ if (card) {
1176
+ upperLengths = card.length;
1177
+ }
1178
+ if (maxLength) {
1179
+ upperLengths = upperLengths.filter(function(x) {
1180
+ return x <= maxLength;
1181
+ });
1182
+ }
1183
+ for (i = j = 0, len = upperLengths.length; j < len; i = ++j) {
1184
+ upperLength = upperLengths[i];
1185
+ if (length >= upperLength && upperLengths[i + 1]) {
1186
+ continue;
1187
+ }
1188
+ if (length >= upperLength) {
1189
+ return;
1190
+ }
1191
+ }
1192
+ if (hasTextSelected(target)) {
1193
+ return;
1194
+ }
1195
+ if (card && card.type === 'amex') {
1196
+ re = /^(\d{4}|\d{4}\s\d{6})$/;
1197
+ } else {
1198
+ re = /(?:^|\s)(\d{4})$/;
1199
+ }
1200
+ if (re.test(value)) {
1201
+ e.preventDefault();
1202
+ QJ.val(target, value + ' ' + digit);
1203
+ return QJ.trigger(target, 'change');
1204
+ }
1205
+ };
1206
+ };
1207
+
1208
+ formatBackCardNumber = function(e) {
1209
+ var target, value;
1210
+ target = e.target;
1211
+ value = QJ.val(target);
1212
+ if (e.meta) {
1213
+ return;
1214
+ }
1215
+ if (e.which !== 8) {
1216
+ return;
1217
+ }
1218
+ if (hasTextSelected(target)) {
1219
+ return;
1220
+ }
1221
+ if (/\d\s$/.test(value)) {
1222
+ e.preventDefault();
1223
+ QJ.val(target, value.replace(/\d\s$/, ''));
1224
+ return QJ.trigger(target, 'change');
1225
+ } else if (/\s\d?$/.test(value)) {
1226
+ e.preventDefault();
1227
+ QJ.val(target, value.replace(/\s\d?$/, ''));
1228
+ return QJ.trigger(target, 'change');
1229
+ }
1230
+ };
1231
+
1232
+ formatExpiry = function(e) {
1233
+ var digit, target, val;
1234
+ digit = String.fromCharCode(e.which);
1235
+ if (!/^\d+$/.test(digit)) {
1236
+ return;
1237
+ }
1238
+ target = e.target;
1239
+ val = QJ.val(target) + digit;
1240
+ if (/^\d$/.test(val) && (val !== '0' && val !== '1')) {
1241
+ e.preventDefault();
1242
+ QJ.val(target, "0" + val + " / ");
1243
+ return QJ.trigger(target, 'change');
1244
+ } else if (/^\d\d$/.test(val)) {
1245
+ e.preventDefault();
1246
+ QJ.val(target, val + " / ");
1247
+ return QJ.trigger(target, 'change');
1248
+ }
1249
+ };
1250
+
1251
+ formatMonthExpiry = function(e) {
1252
+ var digit, target, val;
1253
+ digit = String.fromCharCode(e.which);
1254
+ if (!/^\d+$/.test(digit)) {
1255
+ return;
1256
+ }
1257
+ target = e.target;
1258
+ val = QJ.val(target) + digit;
1259
+ if (/^\d$/.test(val) && (val !== '0' && val !== '1')) {
1260
+ e.preventDefault();
1261
+ QJ.val(target, "0" + val);
1262
+ return QJ.trigger(target, 'change');
1263
+ } else if (/^\d\d$/.test(val)) {
1264
+ e.preventDefault();
1265
+ QJ.val(target, "" + val);
1266
+ return QJ.trigger(target, 'change');
1267
+ }
1268
+ };
1269
+
1270
+ formatForwardExpiry = function(e) {
1271
+ var digit, target, val;
1272
+ digit = String.fromCharCode(e.which);
1273
+ if (!/^\d+$/.test(digit)) {
1274
+ return;
1275
+ }
1276
+ target = e.target;
1277
+ val = QJ.val(target);
1278
+ if (/^\d\d$/.test(val)) {
1279
+ QJ.val(target, val + " / ");
1280
+ return QJ.trigger(target, 'change');
1281
+ }
1282
+ };
1283
+
1284
+ formatForwardSlash = function(e) {
1285
+ var slash, target, val;
1286
+ slash = String.fromCharCode(e.which);
1287
+ if (slash !== '/') {
1288
+ return;
1289
+ }
1290
+ target = e.target;
1291
+ val = QJ.val(target);
1292
+ if (/^\d$/.test(val) && val !== '0') {
1293
+ QJ.val(target, "0" + val + " / ");
1294
+ return QJ.trigger(target, 'change');
1295
+ }
1296
+ };
1297
+
1298
+ formatBackExpiry = function(e) {
1299
+ var target, value;
1300
+ if (e.metaKey) {
1301
+ return;
1302
+ }
1303
+ target = e.target;
1304
+ value = QJ.val(target);
1305
+ if (e.which !== 8) {
1306
+ return;
1307
+ }
1308
+ if (hasTextSelected(target)) {
1309
+ return;
1310
+ }
1311
+ if (/\d(\s|\/)+$/.test(value)) {
1312
+ e.preventDefault();
1313
+ QJ.val(target, value.replace(/\d(\s|\/)*$/, ''));
1314
+ return QJ.trigger(target, 'change');
1315
+ } else if (/\s\/\s?\d?$/.test(value)) {
1316
+ e.preventDefault();
1317
+ QJ.val(target, value.replace(/\s\/\s?\d?$/, ''));
1318
+ return QJ.trigger(target, 'change');
1319
+ }
1320
+ };
1321
+
1322
+ restrictNumeric = function(e) {
1323
+ var input;
1324
+ if (e.metaKey || e.ctrlKey) {
1325
+ return true;
1326
+ }
1327
+ if (e.which === 32) {
1328
+ return e.preventDefault();
1329
+ }
1330
+ if (e.which === 0) {
1331
+ return true;
1332
+ }
1333
+ if (e.which < 33) {
1334
+ return true;
1335
+ }
1336
+ input = String.fromCharCode(e.which);
1337
+ if (!/[\d\s]/.test(input)) {
1338
+ return e.preventDefault();
1339
+ }
1340
+ };
1341
+
1342
+ restrictCardNumber = function(maxLength) {
1343
+ return function(e) {
1344
+ var card, digit, length, target, value;
1345
+ target = e.target;
1346
+ digit = String.fromCharCode(e.which);
1347
+ if (!/^\d+$/.test(digit)) {
1348
+ return;
1349
+ }
1350
+ if (hasTextSelected(target)) {
1351
+ return;
1352
+ }
1353
+ value = (QJ.val(target) + digit).replace(/\D/g, '');
1354
+ card = cardFromNumber(value);
1355
+ length = 16;
1356
+ if (card) {
1357
+ length = card.length[card.length.length - 1];
1358
+ }
1359
+ if (maxLength) {
1360
+ length = Math.min(length, maxLength);
1361
+ }
1362
+ if (!(value.length <= length)) {
1363
+ return e.preventDefault();
1364
+ }
1365
+ };
1366
+ };
1367
+
1368
+ restrictExpiry = function(e, length) {
1369
+ var digit, target, value;
1370
+ target = e.target;
1371
+ digit = String.fromCharCode(e.which);
1372
+ if (!/^\d+$/.test(digit)) {
1373
+ return;
1374
+ }
1375
+ if (hasTextSelected(target)) {
1376
+ return;
1377
+ }
1378
+ value = QJ.val(target) + digit;
1379
+ value = value.replace(/\D/g, '');
1380
+ if (value.length > length) {
1381
+ return e.preventDefault();
1382
+ }
1383
+ };
1384
+
1385
+ restrictCombinedExpiry = function(e) {
1386
+ return restrictExpiry(e, 6);
1387
+ };
1388
+
1389
+ restrictMonthExpiry = function(e) {
1390
+ return restrictExpiry(e, 2);
1391
+ };
1392
+
1393
+ restrictYearExpiry = function(e) {
1394
+ return restrictExpiry(e, 4);
1395
+ };
1396
+
1397
+ restrictCVC = function(e) {
1398
+ var digit, target, val;
1399
+ target = e.target;
1400
+ digit = String.fromCharCode(e.which);
1401
+ if (!/^\d+$/.test(digit)) {
1402
+ return;
1403
+ }
1404
+ if (hasTextSelected(target)) {
1405
+ return;
1406
+ }
1407
+ val = QJ.val(target) + digit;
1408
+ if (!(val.length <= 4)) {
1409
+ return e.preventDefault();
1410
+ }
1411
+ };
1412
+
1413
+ setCardType = function(e) {
1414
+ var allTypes, card, cardType, target, val;
1415
+ target = e.target;
1416
+ val = QJ.val(target);
1417
+ cardType = Payment.fns.cardType(val) || 'unknown';
1418
+ if (!QJ.hasClass(target, cardType)) {
1419
+ allTypes = (function() {
1420
+ var j, len, results;
1421
+ results = [];
1422
+ for (j = 0, len = cards.length; j < len; j++) {
1423
+ card = cards[j];
1424
+ results.push(card.type);
1425
+ }
1426
+ return results;
1427
+ })();
1428
+ QJ.removeClass(target, 'unknown');
1429
+ QJ.removeClass(target, allTypes.join(' '));
1430
+ QJ.addClass(target, cardType);
1431
+ QJ.toggleClass(target, 'identified', cardType !== 'unknown');
1432
+ return QJ.trigger(target, 'payment.cardType', cardType);
1433
+ }
1434
+ };
1435
+
1436
+ Payment = (function() {
1437
+ function Payment() {}
1438
+
1439
+ Payment.fns = {
1440
+ cardExpiryVal: function(value) {
1441
+ var month, prefix, ref, year;
1442
+ value = value.replace(/\s/g, '');
1443
+ ref = value.split('/', 2), month = ref[0], year = ref[1];
1444
+ if ((year != null ? year.length : void 0) === 2 && /^\d+$/.test(year)) {
1445
+ prefix = (new Date).getFullYear();
1446
+ prefix = prefix.toString().slice(0, 2);
1447
+ year = prefix + year;
1448
+ }
1449
+ month = parseInt(month, 10);
1450
+ year = parseInt(year, 10);
1451
+ return {
1452
+ month: month,
1453
+ year: year
1454
+ };
1455
+ },
1456
+ validateCardNumber: function(num) {
1457
+ var card, ref;
1458
+ num = (num + '').replace(/\s+|-/g, '');
1459
+ if (!/^\d+$/.test(num)) {
1460
+ return false;
1461
+ }
1462
+ card = cardFromNumber(num);
1463
+ if (!card) {
1464
+ return false;
1465
+ }
1466
+ return (ref = num.length, indexOf.call(card.length, ref) >= 0) && (card.luhn === false || luhnCheck(num));
1467
+ },
1468
+ validateCardExpiry: function(month, year) {
1469
+ var currentTime, expiry, prefix, ref, ref1;
1470
+ if (typeof month === 'object' && 'month' in month) {
1471
+ ref = month, month = ref.month, year = ref.year;
1472
+ } else if (typeof month === 'string' && indexOf.call(month, '/') >= 0) {
1473
+ ref1 = Payment.fns.cardExpiryVal(month), month = ref1.month, year = ref1.year;
1474
+ }
1475
+ if (!(month && year)) {
1476
+ return false;
1477
+ }
1478
+ month = QJ.trim(month);
1479
+ year = QJ.trim(year);
1480
+ if (!/^\d+$/.test(month)) {
1481
+ return false;
1482
+ }
1483
+ if (!/^\d+$/.test(year)) {
1484
+ return false;
1485
+ }
1486
+ month = parseInt(month, 10);
1487
+ if (!(month && month <= 12)) {
1488
+ return false;
1489
+ }
1490
+ if (year.length === 2) {
1491
+ prefix = (new Date).getFullYear();
1492
+ prefix = prefix.toString().slice(0, 2);
1493
+ year = prefix + year;
1494
+ }
1495
+ expiry = new Date(year, month);
1496
+ currentTime = new Date;
1497
+ expiry.setMonth(expiry.getMonth() - 1);
1498
+ expiry.setMonth(expiry.getMonth() + 1, 1);
1499
+ return expiry > currentTime;
1500
+ },
1501
+ validateCardCVC: function(cvc, type) {
1502
+ var ref, ref1;
1503
+ cvc = QJ.trim(cvc);
1504
+ if (!/^\d+$/.test(cvc)) {
1505
+ return false;
1506
+ }
1507
+ if (type && cardFromType(type)) {
1508
+ return ref = cvc.length, indexOf.call((ref1 = cardFromType(type)) != null ? ref1.cvcLength : void 0, ref) >= 0;
1509
+ } else {
1510
+ return cvc.length >= 3 && cvc.length <= 4;
1511
+ }
1512
+ },
1513
+ cardType: function(num) {
1514
+ var ref;
1515
+ if (!num) {
1516
+ return null;
1517
+ }
1518
+ return ((ref = cardFromNumber(num)) != null ? ref.type : void 0) || null;
1519
+ },
1520
+ formatCardNumber: function(num) {
1521
+ var card, groups, ref, upperLength;
1522
+ card = cardFromNumber(num);
1523
+ if (!card) {
1524
+ return num;
1525
+ }
1526
+ upperLength = card.length[card.length.length - 1];
1527
+ num = num.replace(/\D/g, '');
1528
+ num = num.slice(0, upperLength);
1529
+ if (card.format.global) {
1530
+ return (ref = num.match(card.format)) != null ? ref.join(' ') : void 0;
1531
+ } else {
1532
+ groups = card.format.exec(num);
1533
+ if (groups == null) {
1534
+ return;
1535
+ }
1536
+ groups.shift();
1537
+ groups = groups.filter(function(n) {
1538
+ return n;
1539
+ });
1540
+ return groups.join(' ');
1541
+ }
1542
+ }
1543
+ };
1544
+
1545
+ Payment.restrictNumeric = function(el) {
1546
+ return QJ.on(el, 'keypress', restrictNumeric);
1547
+ };
1548
+
1549
+ Payment.cardExpiryVal = function(el) {
1550
+ return Payment.fns.cardExpiryVal(QJ.val(el));
1551
+ };
1552
+
1553
+ Payment.formatCardCVC = function(el) {
1554
+ Payment.restrictNumeric(el);
1555
+ QJ.on(el, 'keypress', restrictCVC);
1556
+ return el;
1557
+ };
1558
+
1559
+ Payment.formatCardExpiry = function(el) {
1560
+ var month, year;
1561
+ Payment.restrictNumeric(el);
1562
+ if (el.length && el.length === 2) {
1563
+ month = el[0], year = el[1];
1564
+ this.formatCardExpiryMultiple(month, year);
1565
+ } else {
1566
+ QJ.on(el, 'keypress', restrictCombinedExpiry);
1567
+ QJ.on(el, 'keypress', formatExpiry);
1568
+ QJ.on(el, 'keypress', formatForwardSlash);
1569
+ QJ.on(el, 'keypress', formatForwardExpiry);
1570
+ QJ.on(el, 'keydown', formatBackExpiry);
1571
+ }
1572
+ return el;
1573
+ };
1574
+
1575
+ Payment.formatCardExpiryMultiple = function(month, year) {
1576
+ QJ.on(month, 'keypress', restrictMonthExpiry);
1577
+ QJ.on(month, 'keypress', formatMonthExpiry);
1578
+ return QJ.on(year, 'keypress', restrictYearExpiry);
1579
+ };
1580
+
1581
+ Payment.formatCardNumber = function(el, maxLength) {
1582
+ Payment.restrictNumeric(el);
1583
+ QJ.on(el, 'keypress', restrictCardNumber(maxLength));
1584
+ QJ.on(el, 'keypress', formatCardNumber(maxLength));
1585
+ QJ.on(el, 'keydown', formatBackCardNumber);
1586
+ QJ.on(el, 'keyup blur', setCardType);
1587
+ QJ.on(el, 'paste', reFormatCardNumber);
1588
+ QJ.on(el, 'input', reFormatCardNumber);
1589
+ return el;
1590
+ };
1591
+
1592
+ Payment.getCardArray = function() {
1593
+ return cards;
1594
+ };
1595
+
1596
+ Payment.setCardArray = function(cardArray) {
1597
+ cards = cardArray;
1598
+ return true;
1599
+ };
1600
+
1601
+ Payment.addToCardArray = function(cardObject) {
1602
+ return cards.push(cardObject);
1603
+ };
1604
+
1605
+ Payment.removeFromCardArray = function(type) {
1606
+ var key, value;
1607
+ for (key in cards) {
1608
+ value = cards[key];
1609
+ if (value.type === type) {
1610
+ cards.splice(key, 1);
1611
+ }
1612
+ }
1613
+ return true;
1614
+ };
1615
+
1616
+ return Payment;
1617
+
1618
+ })();
1619
+
1620
+ module.exports = Payment;
1621
+
1622
+ global.Payment = Payment;
1623
+
1624
+ }).call(this);
1625
+
1626
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
1627
+
1628
+ /***/ }),
1629
+ /* 7 */
1630
+ /***/ (function(module, exports, __webpack_require__) {
1631
+
1632
+ 'use strict';
1633
+
1634
+ module.exports = __webpack_require__(8);
1635
+
1636
+
1637
+ /***/ }),
1638
+ /* 8 */
1639
+ /***/ (function(module, exports, __webpack_require__) {
1640
+
1641
+ 'use strict';
1642
+
1643
+ /*!
1644
+ * node.extend
1645
+ * Copyright 2011, John Resig
1646
+ * Dual licensed under the MIT or GPL Version 2 licenses.
1647
+ * http://jquery.org/license
1648
+ *
1649
+ * @fileoverview
1650
+ * Port of jQuery.extend that actually works on node.js
1651
+ */
1652
+ var is = __webpack_require__(9);
1653
+
1654
+ var extend = function extend() {
1655
+ var target = arguments[0] || {};
1656
+ var i = 1;
1657
+ var length = arguments.length;
1658
+ var deep = false;
1659
+ var options, name, src, copy, copyIsArray, clone;
1660
+
1661
+ // Handle a deep copy situation
1662
+ if (typeof target === 'boolean') {
1663
+ deep = target;
1664
+ target = arguments[1] || {};
1665
+ // skip the boolean and the target
1666
+ i = 2;
1667
+ }
1668
+
1669
+ // Handle case when target is a string or something (possible in deep copy)
1670
+ if (typeof target !== 'object' && !is.fn(target)) {
1671
+ target = {};
1672
+ }
1673
+
1674
+ for (; i < length; i++) {
1675
+ // Only deal with non-null/undefined values
1676
+ options = arguments[i];
1677
+ if (options != null) {
1678
+ if (typeof options === 'string') {
1679
+ options = options.split('');
1680
+ }
1681
+ // Extend the base object
1682
+ for (name in options) {
1683
+ src = target[name];
1684
+ copy = options[name];
1685
+
1686
+ // Prevent never-ending loop
1687
+ if (target === copy) {
1688
+ continue;
1689
+ }
1690
+
1691
+ // Recurse if we're merging plain objects or arrays
1692
+ if (deep && copy && (is.hash(copy) || (copyIsArray = is.array(copy)))) {
1693
+ if (copyIsArray) {
1694
+ copyIsArray = false;
1695
+ clone = src && is.array(src) ? src : [];
1696
+ } else {
1697
+ clone = src && is.hash(src) ? src : {};
1698
+ }
1699
+
1700
+ // Never move original objects, clone them
1701
+ target[name] = extend(deep, clone, copy);
1702
+
1703
+ // Don't bring in undefined values
1704
+ } else if (typeof copy !== 'undefined') {
1705
+ target[name] = copy;
1706
+ }
1707
+ }
1708
+ }
1709
+ }
1710
+
1711
+ // Return the modified object
1712
+ return target;
1713
+ };
1714
+
1715
+ /**
1716
+ * @public
1717
+ */
1718
+ extend.version = '1.1.3';
1719
+
1720
+ /**
1721
+ * Exports module.
1722
+ */
1723
+ module.exports = extend;
1724
+
1725
+
1726
+ /***/ }),
1727
+ /* 9 */
1728
+ /***/ (function(module, exports) {
1729
+
1730
+ /* globals window, HTMLElement */
1731
+
1732
+ 'use strict';
1733
+
1734
+ /**!
1735
+ * is
1736
+ * the definitive JavaScript type testing library
1737
+ *
1738
+ * @copyright 2013-2014 Enrico Marino / Jordan Harband
1739
+ * @license MIT
1740
+ */
1741
+
1742
+ var objProto = Object.prototype;
1743
+ var owns = objProto.hasOwnProperty;
1744
+ var toStr = objProto.toString;
1745
+ var symbolValueOf;
1746
+ if (typeof Symbol === 'function') {
1747
+ symbolValueOf = Symbol.prototype.valueOf;
1748
+ }
1749
+ var isActualNaN = function (value) {
1750
+ return value !== value;
1751
+ };
1752
+ var NON_HOST_TYPES = {
1753
+ 'boolean': 1,
1754
+ number: 1,
1755
+ string: 1,
1756
+ undefined: 1
1757
+ };
1758
+
1759
+ var base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;
1760
+ var hexRegex = /^[A-Fa-f0-9]+$/;
1761
+
1762
+ /**
1763
+ * Expose `is`
1764
+ */
1765
+
1766
+ var is = {};
1767
+
1768
+ /**
1769
+ * Test general.
1770
+ */
1771
+
1772
+ /**
1773
+ * is.type
1774
+ * Test if `value` is a type of `type`.
1775
+ *
1776
+ * @param {Mixed} value value to test
1777
+ * @param {String} type type
1778
+ * @return {Boolean} true if `value` is a type of `type`, false otherwise
1779
+ * @api public
1780
+ */
1781
+
1782
+ is.a = is.type = function (value, type) {
1783
+ return typeof value === type;
1784
+ };
1785
+
1786
+ /**
1787
+ * is.defined
1788
+ * Test if `value` is defined.
1789
+ *
1790
+ * @param {Mixed} value value to test
1791
+ * @return {Boolean} true if 'value' is defined, false otherwise
1792
+ * @api public
1793
+ */
1794
+
1795
+ is.defined = function (value) {
1796
+ return typeof value !== 'undefined';
1797
+ };
1798
+
1799
+ /**
1800
+ * is.empty
1801
+ * Test if `value` is empty.
1802
+ *
1803
+ * @param {Mixed} value value to test
1804
+ * @return {Boolean} true if `value` is empty, false otherwise
1805
+ * @api public
1806
+ */
1807
+
1808
+ is.empty = function (value) {
1809
+ var type = toStr.call(value);
1810
+ var key;
1811
+
1812
+ if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') {
1813
+ return value.length === 0;
1814
+ }
1815
+
1816
+ if (type === '[object Object]') {
1817
+ for (key in value) {
1818
+ if (owns.call(value, key)) {
1819
+ return false;
1820
+ }
1821
+ }
1822
+ return true;
1823
+ }
1824
+
1825
+ return !value;
1826
+ };
1827
+
1828
+ /**
1829
+ * is.equal
1830
+ * Test if `value` is equal to `other`.
1831
+ *
1832
+ * @param {Mixed} value value to test
1833
+ * @param {Mixed} other value to compare with
1834
+ * @return {Boolean} true if `value` is equal to `other`, false otherwise
1835
+ */
1836
+
1837
+ is.equal = function equal(value, other) {
1838
+ if (value === other) {
1839
+ return true;
1840
+ }
1841
+
1842
+ var type = toStr.call(value);
1843
+ var key;
1844
+
1845
+ if (type !== toStr.call(other)) {
1846
+ return false;
1847
+ }
1848
+
1849
+ if (type === '[object Object]') {
1850
+ for (key in value) {
1851
+ if (!is.equal(value[key], other[key]) || !(key in other)) {
1852
+ return false;
1853
+ }
1854
+ }
1855
+ for (key in other) {
1856
+ if (!is.equal(value[key], other[key]) || !(key in value)) {
1857
+ return false;
1858
+ }
1859
+ }
1860
+ return true;
1861
+ }
1862
+
1863
+ if (type === '[object Array]') {
1864
+ key = value.length;
1865
+ if (key !== other.length) {
1866
+ return false;
1867
+ }
1868
+ while (key--) {
1869
+ if (!is.equal(value[key], other[key])) {
1870
+ return false;
1871
+ }
1872
+ }
1873
+ return true;
1874
+ }
1875
+
1876
+ if (type === '[object Function]') {
1877
+ return value.prototype === other.prototype;
1878
+ }
1879
+
1880
+ if (type === '[object Date]') {
1881
+ return value.getTime() === other.getTime();
1882
+ }
1883
+
1884
+ return false;
1885
+ };
1886
+
1887
+ /**
1888
+ * is.hosted
1889
+ * Test if `value` is hosted by `host`.
1890
+ *
1891
+ * @param {Mixed} value to test
1892
+ * @param {Mixed} host host to test with
1893
+ * @return {Boolean} true if `value` is hosted by `host`, false otherwise
1894
+ * @api public
1895
+ */
1896
+
1897
+ is.hosted = function (value, host) {
1898
+ var type = typeof host[value];
1899
+ return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];
1900
+ };
1901
+
1902
+ /**
1903
+ * is.instance
1904
+ * Test if `value` is an instance of `constructor`.
1905
+ *
1906
+ * @param {Mixed} value value to test
1907
+ * @return {Boolean} true if `value` is an instance of `constructor`
1908
+ * @api public
1909
+ */
1910
+
1911
+ is.instance = is['instanceof'] = function (value, constructor) {
1912
+ return value instanceof constructor;
1913
+ };
1914
+
1915
+ /**
1916
+ * is.nil / is.null
1917
+ * Test if `value` is null.
1918
+ *
1919
+ * @param {Mixed} value value to test
1920
+ * @return {Boolean} true if `value` is null, false otherwise
1921
+ * @api public
1922
+ */
1923
+
1924
+ is.nil = is['null'] = function (value) {
1925
+ return value === null;
1926
+ };
1927
+
1928
+ /**
1929
+ * is.undef / is.undefined
1930
+ * Test if `value` is undefined.
1931
+ *
1932
+ * @param {Mixed} value value to test
1933
+ * @return {Boolean} true if `value` is undefined, false otherwise
1934
+ * @api public
1935
+ */
1936
+
1937
+ is.undef = is.undefined = function (value) {
1938
+ return typeof value === 'undefined';
1939
+ };
1940
+
1941
+ /**
1942
+ * Test arguments.
1943
+ */
1944
+
1945
+ /**
1946
+ * is.args
1947
+ * Test if `value` is an arguments object.
1948
+ *
1949
+ * @param {Mixed} value value to test
1950
+ * @return {Boolean} true if `value` is an arguments object, false otherwise
1951
+ * @api public
1952
+ */
1953
+
1954
+ is.args = is.arguments = function (value) {
1955
+ var isStandardArguments = toStr.call(value) === '[object Arguments]';
1956
+ var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);
1957
+ return isStandardArguments || isOldArguments;
1958
+ };
1959
+
1960
+ /**
1961
+ * Test array.
1962
+ */
1963
+
1964
+ /**
1965
+ * is.array
1966
+ * Test if 'value' is an array.
1967
+ *
1968
+ * @param {Mixed} value value to test
1969
+ * @return {Boolean} true if `value` is an array, false otherwise
1970
+ * @api public
1971
+ */
1972
+
1973
+ is.array = Array.isArray || function (value) {
1974
+ return toStr.call(value) === '[object Array]';
1975
+ };
1976
+
1977
+ /**
1978
+ * is.arguments.empty
1979
+ * Test if `value` is an empty arguments object.
1980
+ *
1981
+ * @param {Mixed} value value to test
1982
+ * @return {Boolean} true if `value` is an empty arguments object, false otherwise
1983
+ * @api public
1984
+ */
1985
+ is.args.empty = function (value) {
1986
+ return is.args(value) && value.length === 0;
1987
+ };
1988
+
1989
+ /**
1990
+ * is.array.empty
1991
+ * Test if `value` is an empty array.
1992
+ *
1993
+ * @param {Mixed} value value to test
1994
+ * @return {Boolean} true if `value` is an empty array, false otherwise
1995
+ * @api public
1996
+ */
1997
+ is.array.empty = function (value) {
1998
+ return is.array(value) && value.length === 0;
1999
+ };
2000
+
2001
+ /**
2002
+ * is.arraylike
2003
+ * Test if `value` is an arraylike object.
2004
+ *
2005
+ * @param {Mixed} value value to test
2006
+ * @return {Boolean} true if `value` is an arguments object, false otherwise
2007
+ * @api public
2008
+ */
2009
+
2010
+ is.arraylike = function (value) {
2011
+ return !!value && !is.bool(value)
2012
+ && owns.call(value, 'length')
2013
+ && isFinite(value.length)
2014
+ && is.number(value.length)
2015
+ && value.length >= 0;
2016
+ };
2017
+
2018
+ /**
2019
+ * Test boolean.
2020
+ */
2021
+
2022
+ /**
2023
+ * is.bool
2024
+ * Test if `value` is a boolean.
2025
+ *
2026
+ * @param {Mixed} value value to test
2027
+ * @return {Boolean} true if `value` is a boolean, false otherwise
2028
+ * @api public
2029
+ */
2030
+
2031
+ is.bool = is['boolean'] = function (value) {
2032
+ return toStr.call(value) === '[object Boolean]';
2033
+ };
2034
+
2035
+ /**
2036
+ * is.false
2037
+ * Test if `value` is false.
2038
+ *
2039
+ * @param {Mixed} value value to test
2040
+ * @return {Boolean} true if `value` is false, false otherwise
2041
+ * @api public
2042
+ */
2043
+
2044
+ is['false'] = function (value) {
2045
+ return is.bool(value) && Boolean(Number(value)) === false;
2046
+ };
2047
+
2048
+ /**
2049
+ * is.true
2050
+ * Test if `value` is true.
2051
+ *
2052
+ * @param {Mixed} value value to test
2053
+ * @return {Boolean} true if `value` is true, false otherwise
2054
+ * @api public
2055
+ */
2056
+
2057
+ is['true'] = function (value) {
2058
+ return is.bool(value) && Boolean(Number(value)) === true;
2059
+ };
2060
+
2061
+ /**
2062
+ * Test date.
2063
+ */
2064
+
2065
+ /**
2066
+ * is.date
2067
+ * Test if `value` is a date.
2068
+ *
2069
+ * @param {Mixed} value value to test
2070
+ * @return {Boolean} true if `value` is a date, false otherwise
2071
+ * @api public
2072
+ */
2073
+
2074
+ is.date = function (value) {
2075
+ return toStr.call(value) === '[object Date]';
2076
+ };
2077
+
2078
+ /**
2079
+ * is.date.valid
2080
+ * Test if `value` is a valid date.
2081
+ *
2082
+ * @param {Mixed} value value to test
2083
+ * @returns {Boolean} true if `value` is a valid date, false otherwise
2084
+ */
2085
+ is.date.valid = function (value) {
2086
+ return is.date(value) && !isNaN(Number(value));
2087
+ };
2088
+
2089
+ /**
2090
+ * Test element.
2091
+ */
2092
+
2093
+ /**
2094
+ * is.element
2095
+ * Test if `value` is an html element.
2096
+ *
2097
+ * @param {Mixed} value value to test
2098
+ * @return {Boolean} true if `value` is an HTML Element, false otherwise
2099
+ * @api public
2100
+ */
2101
+
2102
+ is.element = function (value) {
2103
+ return value !== undefined
2104
+ && typeof HTMLElement !== 'undefined'
2105
+ && value instanceof HTMLElement
2106
+ && value.nodeType === 1;
2107
+ };
2108
+
2109
+ /**
2110
+ * Test error.
2111
+ */
2112
+
2113
+ /**
2114
+ * is.error
2115
+ * Test if `value` is an error object.
2116
+ *
2117
+ * @param {Mixed} value value to test
2118
+ * @return {Boolean} true if `value` is an error object, false otherwise
2119
+ * @api public
2120
+ */
2121
+
2122
+ is.error = function (value) {
2123
+ return toStr.call(value) === '[object Error]';
2124
+ };
2125
+
2126
+ /**
2127
+ * Test function.
2128
+ */
2129
+
2130
+ /**
2131
+ * is.fn / is.function (deprecated)
2132
+ * Test if `value` is a function.
2133
+ *
2134
+ * @param {Mixed} value value to test
2135
+ * @return {Boolean} true if `value` is a function, false otherwise
2136
+ * @api public
2137
+ */
2138
+
2139
+ is.fn = is['function'] = function (value) {
2140
+ var isAlert = typeof window !== 'undefined' && value === window.alert;
2141
+ if (isAlert) {
2142
+ return true;
2143
+ }
2144
+ var str = toStr.call(value);
2145
+ return str === '[object Function]' || str === '[object GeneratorFunction]' || str === '[object AsyncFunction]';
2146
+ };
2147
+
2148
+ /**
2149
+ * Test number.
2150
+ */
2151
+
2152
+ /**
2153
+ * is.number
2154
+ * Test if `value` is a number.
2155
+ *
2156
+ * @param {Mixed} value value to test
2157
+ * @return {Boolean} true if `value` is a number, false otherwise
2158
+ * @api public
2159
+ */
2160
+
2161
+ is.number = function (value) {
2162
+ return toStr.call(value) === '[object Number]';
2163
+ };
2164
+
2165
+ /**
2166
+ * is.infinite
2167
+ * Test if `value` is positive or negative infinity.
2168
+ *
2169
+ * @param {Mixed} value value to test
2170
+ * @return {Boolean} true if `value` is positive or negative Infinity, false otherwise
2171
+ * @api public
2172
+ */
2173
+ is.infinite = function (value) {
2174
+ return value === Infinity || value === -Infinity;
2175
+ };
2176
+
2177
+ /**
2178
+ * is.decimal
2179
+ * Test if `value` is a decimal number.
2180
+ *
2181
+ * @param {Mixed} value value to test
2182
+ * @return {Boolean} true if `value` is a decimal number, false otherwise
2183
+ * @api public
2184
+ */
2185
+
2186
+ is.decimal = function (value) {
2187
+ return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;
2188
+ };
2189
+
2190
+ /**
2191
+ * is.divisibleBy
2192
+ * Test if `value` is divisible by `n`.
2193
+ *
2194
+ * @param {Number} value value to test
2195
+ * @param {Number} n dividend
2196
+ * @return {Boolean} true if `value` is divisible by `n`, false otherwise
2197
+ * @api public
2198
+ */
2199
+
2200
+ is.divisibleBy = function (value, n) {
2201
+ var isDividendInfinite = is.infinite(value);
2202
+ var isDivisorInfinite = is.infinite(n);
2203
+ var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;
2204
+ return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);
2205
+ };
2206
+
2207
+ /**
2208
+ * is.integer
2209
+ * Test if `value` is an integer.
2210
+ *
2211
+ * @param value to test
2212
+ * @return {Boolean} true if `value` is an integer, false otherwise
2213
+ * @api public
2214
+ */
2215
+
2216
+ is.integer = is['int'] = function (value) {
2217
+ return is.number(value) && !isActualNaN(value) && value % 1 === 0;
2218
+ };
2219
+
2220
+ /**
2221
+ * is.maximum
2222
+ * Test if `value` is greater than 'others' values.
2223
+ *
2224
+ * @param {Number} value value to test
2225
+ * @param {Array} others values to compare with
2226
+ * @return {Boolean} true if `value` is greater than `others` values
2227
+ * @api public
2228
+ */
2229
+
2230
+ is.maximum = function (value, others) {
2231
+ if (isActualNaN(value)) {
2232
+ throw new TypeError('NaN is not a valid value');
2233
+ } else if (!is.arraylike(others)) {
2234
+ throw new TypeError('second argument must be array-like');
2235
+ }
2236
+ var len = others.length;
2237
+
2238
+ while (--len >= 0) {
2239
+ if (value < others[len]) {
2240
+ return false;
2241
+ }
2242
+ }
2243
+
2244
+ return true;
2245
+ };
2246
+
2247
+ /**
2248
+ * is.minimum
2249
+ * Test if `value` is less than `others` values.
2250
+ *
2251
+ * @param {Number} value value to test
2252
+ * @param {Array} others values to compare with
2253
+ * @return {Boolean} true if `value` is less than `others` values
2254
+ * @api public
2255
+ */
2256
+
2257
+ is.minimum = function (value, others) {
2258
+ if (isActualNaN(value)) {
2259
+ throw new TypeError('NaN is not a valid value');
2260
+ } else if (!is.arraylike(others)) {
2261
+ throw new TypeError('second argument must be array-like');
2262
+ }
2263
+ var len = others.length;
2264
+
2265
+ while (--len >= 0) {
2266
+ if (value > others[len]) {
2267
+ return false;
2268
+ }
2269
+ }
2270
+
2271
+ return true;
2272
+ };
2273
+
2274
+ /**
2275
+ * is.nan
2276
+ * Test if `value` is not a number.
2277
+ *
2278
+ * @param {Mixed} value value to test
2279
+ * @return {Boolean} true if `value` is not a number, false otherwise
2280
+ * @api public
2281
+ */
2282
+
2283
+ is.nan = function (value) {
2284
+ return !is.number(value) || value !== value;
2285
+ };
2286
+
2287
+ /**
2288
+ * is.even
2289
+ * Test if `value` is an even number.
2290
+ *
2291
+ * @param {Number} value value to test
2292
+ * @return {Boolean} true if `value` is an even number, false otherwise
2293
+ * @api public
2294
+ */
2295
+
2296
+ is.even = function (value) {
2297
+ return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);
2298
+ };
2299
+
2300
+ /**
2301
+ * is.odd
2302
+ * Test if `value` is an odd number.
2303
+ *
2304
+ * @param {Number} value value to test
2305
+ * @return {Boolean} true if `value` is an odd number, false otherwise
2306
+ * @api public
2307
+ */
2308
+
2309
+ is.odd = function (value) {
2310
+ return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);
2311
+ };
2312
+
2313
+ /**
2314
+ * is.ge
2315
+ * Test if `value` is greater than or equal to `other`.
2316
+ *
2317
+ * @param {Number} value value to test
2318
+ * @param {Number} other value to compare with
2319
+ * @return {Boolean}
2320
+ * @api public
2321
+ */
2322
+
2323
+ is.ge = function (value, other) {
2324
+ if (isActualNaN(value) || isActualNaN(other)) {
2325
+ throw new TypeError('NaN is not a valid value');
2326
+ }
2327
+ return !is.infinite(value) && !is.infinite(other) && value >= other;
2328
+ };
2329
+
2330
+ /**
2331
+ * is.gt
2332
+ * Test if `value` is greater than `other`.
2333
+ *
2334
+ * @param {Number} value value to test
2335
+ * @param {Number} other value to compare with
2336
+ * @return {Boolean}
2337
+ * @api public
2338
+ */
2339
+
2340
+ is.gt = function (value, other) {
2341
+ if (isActualNaN(value) || isActualNaN(other)) {
2342
+ throw new TypeError('NaN is not a valid value');
2343
+ }
2344
+ return !is.infinite(value) && !is.infinite(other) && value > other;
2345
+ };
2346
+
2347
+ /**
2348
+ * is.le
2349
+ * Test if `value` is less than or equal to `other`.
2350
+ *
2351
+ * @param {Number} value value to test
2352
+ * @param {Number} other value to compare with
2353
+ * @return {Boolean} if 'value' is less than or equal to 'other'
2354
+ * @api public
2355
+ */
2356
+
2357
+ is.le = function (value, other) {
2358
+ if (isActualNaN(value) || isActualNaN(other)) {
2359
+ throw new TypeError('NaN is not a valid value');
2360
+ }
2361
+ return !is.infinite(value) && !is.infinite(other) && value <= other;
2362
+ };
2363
+
2364
+ /**
2365
+ * is.lt
2366
+ * Test if `value` is less than `other`.
2367
+ *
2368
+ * @param {Number} value value to test
2369
+ * @param {Number} other value to compare with
2370
+ * @return {Boolean} if `value` is less than `other`
2371
+ * @api public
2372
+ */
2373
+
2374
+ is.lt = function (value, other) {
2375
+ if (isActualNaN(value) || isActualNaN(other)) {
2376
+ throw new TypeError('NaN is not a valid value');
2377
+ }
2378
+ return !is.infinite(value) && !is.infinite(other) && value < other;
2379
+ };
2380
+
2381
+ /**
2382
+ * is.within
2383
+ * Test if `value` is within `start` and `finish`.
2384
+ *
2385
+ * @param {Number} value value to test
2386
+ * @param {Number} start lower bound
2387
+ * @param {Number} finish upper bound
2388
+ * @return {Boolean} true if 'value' is is within 'start' and 'finish'
2389
+ * @api public
2390
+ */
2391
+ is.within = function (value, start, finish) {
2392
+ if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {
2393
+ throw new TypeError('NaN is not a valid value');
2394
+ } else if (!is.number(value) || !is.number(start) || !is.number(finish)) {
2395
+ throw new TypeError('all arguments must be numbers');
2396
+ }
2397
+ var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);
2398
+ return isAnyInfinite || (value >= start && value <= finish);
2399
+ };
2400
+
2401
+ /**
2402
+ * Test object.
2403
+ */
2404
+
2405
+ /**
2406
+ * is.object
2407
+ * Test if `value` is an object.
2408
+ *
2409
+ * @param {Mixed} value value to test
2410
+ * @return {Boolean} true if `value` is an object, false otherwise
2411
+ * @api public
2412
+ */
2413
+ is.object = function (value) {
2414
+ return toStr.call(value) === '[object Object]';
2415
+ };
2416
+
2417
+ /**
2418
+ * is.primitive
2419
+ * Test if `value` is a primitive.
2420
+ *
2421
+ * @param {Mixed} value value to test
2422
+ * @return {Boolean} true if `value` is a primitive, false otherwise
2423
+ * @api public
2424
+ */
2425
+ is.primitive = function isPrimitive(value) {
2426
+ if (!value) {
2427
+ return true;
2428
+ }
2429
+ if (typeof value === 'object' || is.object(value) || is.fn(value) || is.array(value)) {
2430
+ return false;
2431
+ }
2432
+ return true;
2433
+ };
2434
+
2435
+ /**
2436
+ * is.hash
2437
+ * Test if `value` is a hash - a plain object literal.
2438
+ *
2439
+ * @param {Mixed} value value to test
2440
+ * @return {Boolean} true if `value` is a hash, false otherwise
2441
+ * @api public
2442
+ */
2443
+
2444
+ is.hash = function (value) {
2445
+ return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;
2446
+ };
2447
+
2448
+ /**
2449
+ * Test regexp.
2450
+ */
2451
+
2452
+ /**
2453
+ * is.regexp
2454
+ * Test if `value` is a regular expression.
2455
+ *
2456
+ * @param {Mixed} value value to test
2457
+ * @return {Boolean} true if `value` is a regexp, false otherwise
2458
+ * @api public
2459
+ */
2460
+
2461
+ is.regexp = function (value) {
2462
+ return toStr.call(value) === '[object RegExp]';
2463
+ };
2464
+
2465
+ /**
2466
+ * Test string.
2467
+ */
2468
+
2469
+ /**
2470
+ * is.string
2471
+ * Test if `value` is a string.
2472
+ *
2473
+ * @param {Mixed} value value to test
2474
+ * @return {Boolean} true if 'value' is a string, false otherwise
2475
+ * @api public
2476
+ */
2477
+
2478
+ is.string = function (value) {
2479
+ return toStr.call(value) === '[object String]';
2480
+ };
2481
+
2482
+ /**
2483
+ * Test base64 string.
2484
+ */
2485
+
2486
+ /**
2487
+ * is.base64
2488
+ * Test if `value` is a valid base64 encoded string.
2489
+ *
2490
+ * @param {Mixed} value value to test
2491
+ * @return {Boolean} true if 'value' is a base64 encoded string, false otherwise
2492
+ * @api public
2493
+ */
2494
+
2495
+ is.base64 = function (value) {
2496
+ return is.string(value) && (!value.length || base64Regex.test(value));
2497
+ };
2498
+
2499
+ /**
2500
+ * Test base64 string.
2501
+ */
2502
+
2503
+ /**
2504
+ * is.hex
2505
+ * Test if `value` is a valid hex encoded string.
2506
+ *
2507
+ * @param {Mixed} value value to test
2508
+ * @return {Boolean} true if 'value' is a hex encoded string, false otherwise
2509
+ * @api public
2510
+ */
2511
+
2512
+ is.hex = function (value) {
2513
+ return is.string(value) && (!value.length || hexRegex.test(value));
2514
+ };
2515
+
2516
+ /**
2517
+ * is.symbol
2518
+ * Test if `value` is an ES6 Symbol
2519
+ *
2520
+ * @param {Mixed} value value to test
2521
+ * @return {Boolean} true if `value` is a Symbol, false otherise
2522
+ * @api public
2523
+ */
2524
+
2525
+ is.symbol = function (value) {
2526
+ return typeof Symbol === 'function' && toStr.call(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol';
2527
+ };
2528
+
2529
+ module.exports = is;
2530
+
2531
+
2532
+ /***/ })
2533
+ /******/ ]);