PluginProbe ʕ •ᴥ•ʔ
Conditional Fields for Contact Form 7 / 2.3.11
Conditional Fields for Contact Form 7 v2.3.11
2.7.10 2.7.9 2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 2.7.3 2.7.2 0.2.4 0.2.5 0.2.6 0.2.7 0.2.8 0.2.9 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.4 1.4.1 1.4.2 1.4.3 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.6.1 1.6.2 1.6.3 1.6.5 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.8 1.7.9 1.8 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2 2.2.1 2.2.10 2.2.11 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.10 2.3.11 2.3.12 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.7 2.7.1 trunk 0.1 0.1.1 0.1.2 0.1.3 0.1.4 0.1.5 0.1.6 0.1.7 0.2 0.2.1 0.2.2 0.2.3
cf7-conditional-fields / js / scripts.js
cf7-conditional-fields / js Last commit date
polyfill.js 3 years ago scripts.js 3 years ago scripts.js.map 3 years ago scripts_admin copy.js 4 years ago scripts_admin.js 4 years ago scripts_admin_all_pages.js 5 years ago scripts_es6.js 3 years ago temp.js 4 years ago
scripts.js
4139 lines
1 /******/ (function(modules) { // webpackBootstrap
2 /******/ // The module cache
3 /******/ var installedModules = {};
4 /******/
5 /******/ // The require function
6 /******/ function __webpack_require__(moduleId) {
7 /******/
8 /******/ // Check if module is in cache
9 /******/ if(installedModules[moduleId]) {
10 /******/ return installedModules[moduleId].exports;
11 /******/ }
12 /******/ // Create a new module (and put it into the cache)
13 /******/ var module = installedModules[moduleId] = {
14 /******/ i: moduleId,
15 /******/ l: false,
16 /******/ exports: {}
17 /******/ };
18 /******/
19 /******/ // Execute the module function
20 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 /******/
22 /******/ // Flag the module as loaded
23 /******/ module.l = true;
24 /******/
25 /******/ // Return the exports of the module
26 /******/ return module.exports;
27 /******/ }
28 /******/
29 /******/
30 /******/ // expose the modules object (__webpack_modules__)
31 /******/ __webpack_require__.m = modules;
32 /******/
33 /******/ // expose the module cache
34 /******/ __webpack_require__.c = installedModules;
35 /******/
36 /******/ // define getter function for harmony exports
37 /******/ __webpack_require__.d = function(exports, name, getter) {
38 /******/ if(!__webpack_require__.o(exports, name)) {
39 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40 /******/ }
41 /******/ };
42 /******/
43 /******/ // define __esModule on exports
44 /******/ __webpack_require__.r = function(exports) {
45 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47 /******/ }
48 /******/ Object.defineProperty(exports, '__esModule', { value: true });
49 /******/ };
50 /******/
51 /******/ // create a fake namespace object
52 /******/ // mode & 1: value is a module id, require it
53 /******/ // mode & 2: merge all properties of value into the ns
54 /******/ // mode & 4: return value when already ns object
55 /******/ // mode & 8|1: behave like require
56 /******/ __webpack_require__.t = function(value, mode) {
57 /******/ if(mode & 1) value = __webpack_require__(value);
58 /******/ if(mode & 8) return value;
59 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60 /******/ var ns = Object.create(null);
61 /******/ __webpack_require__.r(ns);
62 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64 /******/ return ns;
65 /******/ };
66 /******/
67 /******/ // getDefaultExport function for compatibility with non-harmony modules
68 /******/ __webpack_require__.n = function(module) {
69 /******/ var getter = module && module.__esModule ?
70 /******/ function getDefault() { return module['default']; } :
71 /******/ function getModuleExports() { return module; };
72 /******/ __webpack_require__.d(getter, 'a', getter);
73 /******/ return getter;
74 /******/ };
75 /******/
76 /******/ // Object.prototype.hasOwnProperty.call
77 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78 /******/
79 /******/ // __webpack_public_path__
80 /******/ __webpack_require__.p = "";
81 /******/
82 /******/
83 /******/ // Load entry module and return exports
84 /******/ return __webpack_require__(__webpack_require__.s = 0);
85 /******/ })
86 /************************************************************************/
87 /******/ ({
88
89 /***/ "./js/polyfill.js":
90 /*!************************!*\
91 !*** ./js/polyfill.js ***!
92 \************************/
93 /*! no static exports found */
94 /***/ (function(module, exports) {
95
96 // endsWith polyfill
97 if (!String.prototype.endsWith) {
98 String.prototype.endsWith = function (search, thisLength) {
99 if (thisLength === undefined || thisLength > this.length) {
100 thisLength = this.length;
101 }
102
103 return this.substring(thisLength - search.length, thisLength) === search;
104 };
105 } // Object.values polyfill
106
107
108 if (!Object.values) Object.values = function (o) {
109 return Object.keys(o).map(function (k) {
110 return o[k];
111 });
112 }; // Array.from polyfill
113
114 if (!Array.from) {
115 Array.from = function () {
116 var toStr = Object.prototype.toString;
117
118 var isCallable = function isCallable(fn) {
119 return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
120 };
121
122 var toInteger = function toInteger(value) {
123 var number = Number(value);
124
125 if (isNaN(number)) {
126 return 0;
127 }
128
129 if (number === 0 || !isFinite(number)) {
130 return number;
131 }
132
133 return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
134 };
135
136 var maxSafeInteger = Math.pow(2, 53) - 1;
137
138 var toLength = function toLength(value) {
139 var len = toInteger(value);
140 return Math.min(Math.max(len, 0), maxSafeInteger);
141 }; // The length property of the from method is 1.
142
143
144 return function from(arrayLike
145 /*, mapFn, thisArg */
146 ) {
147 // 1. Let C be the this value.
148 var C = this; // 2. Let items be ToObject(arrayLike).
149
150 var items = Object(arrayLike); // 3. ReturnIfAbrupt(items).
151
152 if (arrayLike == null) {
153 throw new TypeError("Array.from requires an array-like object - not null or undefined");
154 } // 4. If mapfn is undefined, then let mapping be false.
155
156
157 var mapFn = arguments.length > 1 ? arguments[1] : void undefined;
158 var T;
159
160 if (typeof mapFn !== 'undefined') {
161 // 5. else
162 // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
163 if (!isCallable(mapFn)) {
164 throw new TypeError('Array.from: when provided, the second argument must be a function');
165 } // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
166
167
168 if (arguments.length > 2) {
169 T = arguments[2];
170 }
171 } // 10. Let lenValue be Get(items, "length").
172 // 11. Let len be ToLength(lenValue).
173
174
175 var len = toLength(items.length); // 13. If IsConstructor(C) is true, then
176 // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
177 // 14. a. Else, Let A be ArrayCreate(len).
178
179 var A = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0.
180
181 var k = 0; // 17. Repeat, while k < len… (also steps a - h)
182
183 var kValue;
184
185 while (k < len) {
186 kValue = items[k];
187
188 if (mapFn) {
189 A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
190 } else {
191 A[k] = kValue;
192 }
193
194 k += 1;
195 } // 18. Let putStatus be Put(A, "length", len, true).
196
197
198 A.length = len; // 20. Return A.
199
200 return A;
201 };
202 }();
203 }
204
205 /***/ }),
206
207 /***/ "./js/scripts_es6.js":
208 /*!***************************!*\
209 !*** ./js/scripts_es6.js ***!
210 \***************************/
211 /*! no exports provided */
212 /***/ (function(module, __webpack_exports__, __webpack_require__) {
213
214 "use strict";
215 __webpack_require__.r(__webpack_exports__);
216 /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
217 /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
218 /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js");
219 /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__);
220 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
221 /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2__);
222 /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js");
223 /* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__);
224 /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
225 /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4__);
226 // disable client side validation introduced in CF7 5.6 for now
227
228
229
230
231
232
233
234 function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
235
236 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
237
238 if (typeof wpcf7 !== 'undefined') {
239 wpcf7.validate = function (a, b) {
240 return null;
241 };
242 }
243
244 var cf7signature_resized = 0; // for compatibility with contact-form-7-signature-addon
245
246 var wpcf7cf_timeout;
247 var wpcf7cf_change_time_ms = 100; // the timeout after a change in the form is detected
248
249 if (window.wpcf7 && !wpcf7.setStatus) {
250 wpcf7.setStatus = function (form, status) {
251 form = form.length ? form[0] : form; // if form is a jQuery object, only grab te html-element
252
253 var defaultStatuses = new Map([// 0: Status in API response, 1: Status in HTML class
254 ['init', 'init'], ['validation_failed', 'invalid'], ['acceptance_missing', 'unaccepted'], ['spam', 'spam'], ['aborted', 'aborted'], ['mail_sent', 'sent'], ['mail_failed', 'failed'], ['submitting', 'submitting'], ['resetting', 'resetting']]);
255
256 if (defaultStatuses.has(status)) {
257 status = defaultStatuses.get(status);
258 }
259
260 if (!Array.from(defaultStatuses.values()).includes(status)) {
261 status = status.replace(/[^0-9a-z]+/i, ' ').trim();
262 status = status.replace(/\s+/, '-');
263 status = "custom-".concat(status);
264 }
265
266 var prevStatus = form.getAttribute('data-status');
267 form.wpcf7.status = status;
268 form.setAttribute('data-status', status);
269 form.classList.add(status);
270
271 if (prevStatus && prevStatus !== status) {
272 form.classList.remove(prevStatus);
273 }
274
275 return status;
276 };
277 }
278
279 if (window.wpcf7cf_running_tests) {
280 jQuery('input[name="_wpcf7cf_options"]').each(function (e) {
281 var $input = jQuery(this);
282 var opt = JSON.parse($input.val());
283 opt.settings.animation_intime = 0;
284 opt.settings.animation_outtime = 0;
285 $input.val(JSON.stringify(opt));
286 });
287 wpcf7cf_change_time_ms = 0;
288 }
289
290 var wpcf7cf_show_animation = {
291 "height": "show",
292 "marginTop": "show",
293 "marginBottom": "show",
294 "paddingTop": "show",
295 "paddingBottom": "show"
296 };
297 var wpcf7cf_hide_animation = {
298 "height": "hide",
299 "marginTop": "hide",
300 "marginBottom": "hide",
301 "paddingTop": "hide",
302 "paddingBottom": "hide"
303 };
304 var wpcf7cf_show_step_animation = {
305 "opacity": "show"
306 };
307 var wpcf7cf_hide_step_animation = {
308 "opacity": "hide"
309 };
310 var wpcf7cf_change_events = 'input.wpcf7cf paste.wpcf7cf change.wpcf7cf click.wpcf7cf propertychange.wpcf7cf changedisabledprop.wpcf7cf';
311 var wpcf7cf_forms = [];
312
313 var Wpcf7cfForm = function Wpcf7cfForm($form) {
314 var options_element = $form.find('input[name="_wpcf7cf_options"]').eq(0);
315
316 if (!options_element.length || !options_element.val()) {
317 // doesn't look like a CF7 form created with conditional fields plugin enabled.
318 return false;
319 }
320
321 var form = this;
322 var form_options = JSON.parse(options_element.val());
323 form.$form = $form;
324 form.$input_hidden_group_fields = $form.find('[name="_wpcf7cf_hidden_group_fields"]');
325 form.$input_hidden_groups = $form.find('[name="_wpcf7cf_hidden_groups"]');
326 form.$input_visible_groups = $form.find('[name="_wpcf7cf_visible_groups"]');
327 form.$input_repeaters = $form.find('[name="_wpcf7cf_repeaters"]');
328 form.$input_steps = $form.find('[name="_wpcf7cf_steps"]');
329 form.unit_tag = $form.closest('.wpcf7').attr('id');
330 form.conditions = form_options['conditions'];
331 form.simpleDom = null;
332
333 form.reloadSimpleDom = function () {
334 form.simpleDom = wpcf7cf.get_simplified_dom_model(form.$form[0]);
335 }; // quicker than reloading the simpleDom completely with reloadSimpleDom
336
337
338 form.updateSimpleDom = function () {
339 if (!form.simpleDom) {
340 form.reloadSimpleDom();
341 }
342
343 var inputs = Object.values(form.simpleDom).filter(function (item) {
344 return item.type === 'input';
345 });
346 var formdata = new FormData(form.$form[0]);
347
348 var formdataEntries = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(formdata.entries()).map(function (entry) {
349 var _entry$1$name;
350
351 return [entry[0], (_entry$1$name = entry[1].name) !== null && _entry$1$name !== void 0 ? _entry$1$name : entry[1]];
352 });
353
354 var buttonEntries = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(jQuery('button', form.$form)).map(function (entry) {
355 return [entry.name, entry.value];
356 });
357
358 formdataEntries = formdataEntries.concat(buttonEntries);
359 inputs.forEach(function (simpleDomItem) {
360 var newValue = form.getNewDomValueIfChanged(simpleDomItem, formdataEntries);
361
362 if (newValue !== null) {
363 form.simpleDom[simpleDomItem.name].val = newValue;
364 }
365 });
366 };
367
368 form.isDomMatch = function (simpleDomItem, formDataEntries) {
369 var simpleDomItemName = simpleDomItem.name;
370 var simpleDomItemValues = simpleDomItem.val;
371 var currentValues = formDataEntries.filter(function (entry) {
372 return entry[0] === simpleDomItemName;
373 }).map(function (entry) {
374 return entry[1];
375 });
376 return currentValues.join('|') === simpleDomItemValues.join('|');
377 };
378 /**
379 *
380 * @param {*} simpleDomItem
381 * @param {*} formDataEntries
382 * @returns the new value, or NULL if no change
383 */
384
385
386 form.getNewDomValueIfChanged = function (simpleDomItem, formDataEntries) {
387 var simpleDomItemName = simpleDomItem.name;
388 var simpleDomItemValues = simpleDomItem.val;
389 var currentValues = formDataEntries.filter(function (entry) {
390 return entry[0] === simpleDomItemName;
391 }).map(function (entry) {
392 return entry[1];
393 });
394 return currentValues.join('|') === simpleDomItemValues.join('|') ? null : currentValues;
395 }; // Wrapper around jQuery(selector, form.$form)
396
397
398 form.get = function (selector) {
399 // TODO: implement some caching here.
400 return jQuery(selector, form.$form);
401 };
402
403 form.getFieldByName = function (name) {
404 return form.simpleDom[name] || form.simpleDom[name + '[]'];
405 }; // compatibility with conditional forms created with older versions of the plugin ( < 1.4 )
406
407
408 for (var i = 0; i < form.conditions.length; i++) {
409 var condition = form.conditions[i];
410
411 if (!('and_rules' in condition)) {
412 condition.and_rules = [{
413 'if_field': condition.if_field,
414 'if_value': condition.if_value,
415 'operator': condition.operator
416 }];
417 }
418 }
419
420 form.initial_conditions = form.conditions;
421 form.settings = form_options['settings'];
422 form.$groups = jQuery(); // empty jQuery set
423
424 form.repeaters = [];
425 form.multistep = null;
426 form.fields = [];
427 form.settings.animation_intime = parseInt(form.settings.animation_intime);
428 form.settings.animation_outtime = parseInt(form.settings.animation_outtime);
429
430 if (form.settings.animation === 'no') {
431 form.settings.animation_intime = 0;
432 form.settings.animation_outtime = 0;
433 }
434
435 form.updateGroups();
436 form.updateEventListeners();
437 form.displayFields(); // bring form in initial state if the reset event is fired on it.
438 // (CF7 triggers the 'reset' event by default on each successfully submitted form)
439
440 form.$form.on('reset.wpcf7cf', form, function (e) {
441 var form = e.data;
442 setTimeout(function () {
443 form.reloadSimpleDom();
444 form.displayFields();
445 form.resetRepeaters();
446
447 if (form.multistep != null) {
448 form.multistep.moveToStep(1, false);
449 }
450
451 setTimeout(function () {
452 if (form.$form.hasClass('sent')) {
453 jQuery('.wpcf7-response-output', form.$form)[0].scrollIntoView({
454 behavior: "smooth",
455 block: "nearest",
456 inline: "nearest"
457 });
458 }
459 }, 400);
460 }, 200);
461 }); // PRO ONLY
462
463 form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function () {
464 form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form));
465 });
466 form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
467 return item.params.$repeater.id;
468 })));
469 var $multistep = form.get('.wpcf7cf_multistep');
470
471 if ($multistep.length) {
472 form.multistep = new Wpcf7cfMultistep($multistep, form); // window.wpcf7cf.updateMultistepState(form.multistep);
473 } // END PRO ONLY
474
475 };
476 /**
477 * reset initial number of subs for each repeater.
478 * (does not clear values)
479 */
480
481
482 Wpcf7cfForm.prototype.resetRepeaters = function () {
483 var form = this;
484 form.repeaters.forEach(function (repeater) {
485 repeater.updateSubs(repeater.params.$repeater.initial_subs);
486 });
487 };
488
489 Wpcf7cfForm.prototype.displayFields = function () {
490 var form = this;
491 var wpcf7cf_conditions = this.conditions;
492 var wpcf7cf_settings = this.settings; //for compatibility with contact-form-7-signature-addon
493
494 if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0) {
495 for (var i = 0; i < signatures.length; i++) {
496 if (signatures[i].canvas.width === 0) {
497 var $sig_canvas = jQuery(".wpcf7-form-control-signature-body>canvas");
498 var $sig_wrap = jQuery(".wpcf7-form-control-signature-wrap");
499 $sig_canvas.eq(i).attr('width', $sig_wrap.width());
500 $sig_canvas.eq(i).attr('height', $sig_wrap.height());
501 cf7signature_resized = 1;
502 }
503 }
504 }
505
506 form.$groups.addClass('wpcf7cf-hidden');
507
508 for (var _i = 0; _i < wpcf7cf_conditions.length; _i++) {
509 var condition = wpcf7cf_conditions[_i];
510 var show_group = window.wpcf7cf.should_group_be_shown(condition, form);
511
512 if (show_group) {
513 form.get('[data-id="' + condition.then_field + '"]').removeClass('wpcf7cf-hidden');
514 }
515 }
516
517 var animation_intime = wpcf7cf_settings.animation_intime;
518 var animation_outtime = wpcf7cf_settings.animation_outtime;
519 form.$groups.each(function (index) {
520 var $group = jQuery(this);
521
522 if ($group.is(':animated')) {
523 $group.finish(); // stop any current animations on the group
524 }
525
526 if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) {
527 if ($group.prop('tagName') === 'SPAN') {
528 $group.show().trigger('wpcf7cf_show_group'); // show instantly
529 } else {
530 $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show with animation
531 }
532
533 if ($group.attr('data-disable_on_hide') !== undefined) {
534 $group.find(':input').prop('disabled', false).trigger('changedisabledprop.wpcf7cf');
535 $group.find('.wpcf7-form-control-wrap').removeClass('wpcf7cf-disabled');
536 }
537 } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) {
538 if ($group.attr('data-clear_on_hide') !== undefined) {
539 var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden');
540 $inputs.each(function () {
541 var $this = jQuery(this);
542 $this.val(this.defaultValue);
543 $this.prop('checked', this.defaultChecked);
544 });
545 jQuery('option', $group).each(function () {
546 this.selected = this.defaultSelected;
547 });
548 jQuery('select', $group).each(function () {
549 var $select = jQuery(this);
550
551 if ($select.val() === null) {
552 $select.val(jQuery("option:first", $select).val());
553 }
554 });
555 $inputs.each(function () {
556 this.dispatchEvent(new Event("change", {
557 "bubbles": true
558 }));
559 });
560 }
561
562 if ($group.prop('tagName') === 'SPAN') {
563 $group.hide().trigger('wpcf7cf_hide_group');
564 } else {
565 $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide
566 }
567 }
568 });
569 form.updateHiddenFields();
570 form.updateSummaryFields();
571 };
572
573 Wpcf7cfForm.prototype.updateSummaryFields = function () {
574 var form = this;
575 var $summary = form.get('.wpcf7cf-summary');
576
577 if ($summary.length == 0 || !$summary.is(':visible')) {
578 return;
579 }
580
581 var fd = new FormData();
582 var formdata = form.$form.serializeArray();
583 jQuery.each(formdata, function (key, input) {
584 fd.append(input.name, input.value);
585 }); // Make sure to add file fields to FormData
586
587 jQuery.each(form.$form.find('input[type="file"]'), function (index, el) {
588 if (!el.files.length) return true; // continue
589
590 var fieldName = el.name;
591 fd.append(fieldName, new Blob(), Array.from(el.files).map(function (file) {
592 return file.name;
593 }).join(', '));
594 }); // add file fields to form-data
595
596 jQuery.ajax({
597 url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary',
598 type: 'POST',
599 data: fd,
600 processData: false,
601 contentType: false,
602 dataType: 'json',
603 success: function success(json) {
604 $summary.html(json.summaryHtml);
605 }
606 });
607 };
608
609 Wpcf7cfForm.prototype.updateHiddenFields = function () {
610 var form = this;
611 var hidden_fields = [];
612 var hidden_groups = [];
613 var visible_groups = [];
614 form.$groups.each(function () {
615 var $group = jQuery(this);
616
617 if ($group.hasClass('wpcf7cf-hidden')) {
618 hidden_groups.push($group.attr('data-id'));
619
620 if ($group.attr('data-disable_on_hide') !== undefined) {
621 // fields inside hidden disable_on_hide group
622 $group.find('input,select,textarea').each(function () {
623 var $this = jQuery(this);
624
625 if (!$this.prop('disabled')) {
626 $this.prop('disabled', true).trigger('changedisabledprop.wpcf7cf');
627 } // if there's no other field with the same name visible in the form
628 // then push this field to hidden_fields
629
630
631 if (form.$form.find("[data-class=\"wpcf7cf_group\"]:not(.wpcf7cf-hidden) [name='".concat($this.attr('name'), "']")).length === 0) {
632 hidden_fields.push($this.attr('name'));
633 }
634 });
635 $group.find('.wpcf7-form-control-wrap').addClass('wpcf7cf-disabled');
636 } else {
637 // fields inside regular hidden group are all pushed to hidden_fields
638 $group.find('input,select,textarea').each(function () {
639 hidden_fields.push(jQuery(this).attr('name'));
640 });
641 }
642 } else {
643 visible_groups.push($group.attr('data-id'));
644 }
645 });
646 form.hidden_fields = hidden_fields;
647 form.hidden_groups = hidden_groups;
648 form.visible_groups = visible_groups;
649 form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields));
650 form.$input_hidden_groups.val(JSON.stringify(hidden_groups));
651 form.$input_visible_groups.val(JSON.stringify(visible_groups));
652 return true;
653 };
654
655 Wpcf7cfForm.prototype.updateGroups = function () {
656 var form = this;
657 form.$groups = form.$form.find('[data-class="wpcf7cf_group"]');
658 form.$groups.height('auto');
659 form.conditions = window.wpcf7cf.get_nested_conditions(form);
660 };
661
662 Wpcf7cfForm.prototype.updateEventListeners = function () {
663 var form = this; // monitor input changes, and call displayFields() if something has changed
664
665 form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events, form, function (e) {
666 var form = e.data;
667 clearTimeout(wpcf7cf_timeout);
668 wpcf7cf_timeout = setTimeout(function () {
669 window.wpcf7cf.updateMultistepState(form.multistep);
670 form.updateSimpleDom();
671 form.displayFields();
672 }, wpcf7cf_change_time_ms);
673 }); // PRO ONLY
674
675 form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf', function () {
676 var $this = jQuery(this);
677
678 if ($this.text() === $this.attr('data-val-1')) {
679 $this.text($this.attr('data-val-2'));
680 $this.val($this.attr('data-val-2'));
681 } else {
682 $this.text($this.attr('data-val-1'));
683 $this.val($this.attr('data-val-1'));
684 }
685 }); // END PRO ONLY
686 }; // PRO ONLY
687
688
689 function Wpcf7cfRepeater($repeater, form) {
690 var $ = jQuery;
691 var thisRepeater = this;
692 var wpcf7cf_settings = form.settings;
693 thisRepeater.form = form;
694 $repeater.parentRepeaters = Array.from($repeater.parents('.wpcf7cf_repeater').map(function () {
695 return this.getAttribute('data-id');
696 })).reverse();
697 $repeater.num_subs = 0;
698 $repeater.id = $repeater.attr('data-id');
699 $repeater.orig_id = $repeater.attr('data-orig_data_id');
700 $repeater.min = typeof $repeater.attr('data-min') !== 'undefined' ? parseInt($repeater.attr('data-min')) : 1;
701 $repeater.max = typeof $repeater.attr('data-max') !== 'undefined' ? parseInt($repeater.attr('data-max')) : 200;
702 $repeater.initial_subs = typeof $repeater.attr('data-initial') !== 'undefined' ? parseInt($repeater.attr('data-initial')) : $repeater.min;
703
704 if ($repeater.initial_subs > $repeater.max) {
705 $repeater.initial_subs = $repeater.max;
706 }
707
708 var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0);
709 var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0);
710 var $repeater_sub_clone = $repeater_sub.clone();
711 $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function () {
712 var $this = jQuery(this);
713 var prev_suffix = $this.attr('data-repeater_sub_suffix');
714 var new_suffix = prev_suffix + '__{{repeater_sub_suffix}}';
715 $this.attr('data-repeater_sub_suffix', new_suffix);
716 });
717 $repeater_sub_clone.find('[name]').each(function () {
718 var $this = jQuery(this);
719 var prev_name = $this.attr('name');
720 var new_name = thisRepeater.getNewName(prev_name);
721 var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name;
722 $this.attr('name', new_name);
723 $this.attr('data-orig_name', orig_name);
724 $this.closest('.wpcf7-form-control-wrap').attr('data-name', new_name.replace('[]', ''));
725 });
726 $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class="wpcf7cf_group"]').each(function () {
727 var $this = jQuery(this);
728 var prev_data_id = $this.attr('data-id');
729 var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id;
730 var new_data_id = thisRepeater.getNewName(prev_data_id);
731
732 if (prev_data_id.endsWith('_count')) {
733 new_data_id = prev_data_id.replace('_count', '__{{repeater_sub_suffix}}_count');
734 }
735
736 $this.attr('data-id', new_data_id);
737 $this.attr('data-orig_data_id', orig_data_id);
738 });
739 $repeater_sub_clone.find('[id]').each(function () {
740 var $this = jQuery(this);
741 var prev_id = $this.attr('id');
742 var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id;
743 var new_id = thisRepeater.getNewName(prev_id);
744 $this.attr('id', new_id);
745 $this.attr('data-orig_id', orig_id);
746 });
747 $repeater_sub_clone.find('[for]').each(function () {
748 var $this = jQuery(this);
749 var prev_for = $this.attr('for');
750 var orig_for = $this.attr('data-orig_for') != null ? $this.attr('data-orig_for') : prev_for;
751 var new_for = thisRepeater.getNewName(prev_for);
752 $this.attr('for', new_for);
753 $this.attr('data-orig_for', orig_for);
754 });
755 var repeater_sub_html = $repeater_sub_clone[0].outerHTML;
756 var $repeater_count_field = $repeater.find('[name=' + $repeater.id + '_count]').eq(0);
757 var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0);
758 var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0);
759 var params = {
760 $repeater: $repeater,
761 $repeater_count_field: $repeater_count_field,
762 repeater_sub_html: repeater_sub_html,
763 $repeater_controls: $repeater_controls,
764 $button_add: $button_add,
765 $button_remove: $button_remove,
766 wpcf7cf_settings: wpcf7cf_settings
767 };
768 thisRepeater.params = params;
769 $button_add.on('click', null, thisRepeater, function (e) {
770 thisRepeater = e.data;
771 thisRepeater.updateSubs(params.$repeater.num_subs + 1);
772 });
773 $button_remove.on('click', null, thisRepeater, function (e) {
774 thisRepeater = e.data;
775 thisRepeater.updateSubs(params.$repeater.num_subs - 1);
776 });
777 jQuery('> .wpcf7cf_repeater_sub', params.$repeater).eq(0).remove(); // remove the first sub, it's just a template.
778
779 thisRepeater.updateSubs($repeater.initial_subs);
780 thisRepeater.updateButtons();
781 }
782
783 Wpcf7cfRepeater.prototype.getNewName = function (previousName) {
784 var prev_parts = previousName.split('[');
785 previousName = prev_parts[0];
786 var prev_suff = prev_parts.length > 1 ? '[' + prev_parts.splice(1).join('[') : '';
787 var newName = previousName + '__{{repeater_sub_suffix}}' + prev_suff;
788
789 if (previousName.endsWith('_count')) {
790 newName = previousName.replace('_count', '__{{repeater_sub_suffix}}_count');
791 }
792
793 return newName;
794 };
795
796 Wpcf7cfRepeater.prototype.updateButtons = function () {
797 var repeater = this;
798 var params = repeater.params;
799 var num_subs = params.$repeater.num_subs;
800 var showButtonRemove = false;
801 var showButtonAdd = false;
802
803 if (params.$repeater.num_subs < params.$repeater.max) {
804 showButtonAdd = true;
805 }
806
807 if (params.$repeater.num_subs > params.$repeater.min) {
808 showButtonRemove = true;
809 }
810
811 if (showButtonAdd) {
812 params.$button_add.show();
813 } else {
814 params.$button_add.hide();
815 }
816
817 if (showButtonRemove) {
818 params.$button_remove.show();
819 } else {
820 params.$button_remove.hide();
821 }
822
823 params.$repeater_count_field.val(num_subs);
824 };
825
826 Wpcf7cfRepeater.prototype.updateSubs = function (subs_to_show) {
827 var repeater = this;
828 var params = repeater.params; // make sure subs_to_show is a valid number
829
830 subs_to_show = subs_to_show < params.$repeater.min ? params.$repeater.min : subs_to_show;
831 subs_to_show = subs_to_show > params.$repeater.max ? params.$repeater.max : subs_to_show;
832 var subs_to_add = subs_to_show - params.$repeater.num_subs;
833
834 if (subs_to_add < 0) {
835 repeater.removeSubs(-subs_to_add);
836 } else if (subs_to_add > 0) {
837 repeater.addSubs(subs_to_add);
838 }
839 };
840 /**
841 * add Subs to repeater
842 * @param {Number} subs_to_add
843 * @param {Number} index - zero-based. leave blank (or null) to append at the end
844 */
845
846
847 Wpcf7cfRepeater.prototype.addSubs = function (subs_to_add) {
848 var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
849 var $ = jQuery;
850 var params = this.params;
851 var repeater = this;
852 var form = repeater.form;
853 var $repeater = params.$repeater;
854 var $repeater_controls = params.$repeater_controls;
855
856 if (subs_to_add + $repeater.num_subs > $repeater.max) {
857 subs_to_add = $repeater.max - $repeater.num_subs;
858 }
859
860 var html_str = '';
861
862 for (var i = 1; i <= subs_to_add; i++) {
863 var sub_suffix = $repeater.num_subs + i;
864 html_str += params.repeater_sub_html.replace(/\{\{repeater_sub_suffix\}\}/g, sub_suffix).replace(new RegExp('\{\{' + $repeater.orig_id + '_index\}\}', 'g'), '<span class="wpcf7cf-index wpcf7cf__' + $repeater.orig_id + '">' + sub_suffix + '</span>');
865 }
866
867 var $html = $(html_str);
868 $('> .wpcf7cf_repeater_sub', $repeater).finish(); // finish any currently running animations immediately.
869 // Add the newly created fields to the form
870
871 if (index === null) {
872 $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');
873 } else {
874 $html.hide().insertBefore($('> .wpcf7cf_repeater_sub', $repeater).eq(index)).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added');
875 } // enable all new fields
876
877
878 $html.find('.wpcf7cf-disabled :input').prop('disabled', false).trigger('changedisabledprop.wpcf7cf');
879 $html.find('.wpcf7-form-control-wrap').removeClass('wpcf7cf-disabled');
880 $('.wpcf7cf_repeater', $html).each(function () {
881 form.repeaters.push(new Wpcf7cfRepeater($(this), form));
882 });
883 form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) {
884 return item.params.$repeater.id;
885 })));
886 $repeater.num_subs += subs_to_add;
887
888 if (index !== null) {
889 repeater.updateSuffixes();
890 }
891
892 window.wpcf7cf.updateMultistepState(form.multistep);
893 form.updateGroups();
894 form.updateEventListeners();
895 form.displayFields();
896 repeater.updateButtons(); // Exclusive Checkbox
897
898 $html.on('click', '.wpcf7-exclusive-checkbox input:checkbox', function () {
899 var name = $(this).attr('name');
900 $html.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false);
901 }); //basic compatibility with material-design-for-contact-form-7
902
903 if (typeof window.cf7mdInit === "function") {
904 window.cf7mdInit();
905 }
906
907 return false;
908 };
909
910 Wpcf7cfRepeater.prototype.updateSuffixes = function () {
911 // Loop trough all subs
912 // -- 1. update all fields, groups and repeaters names, id's, for's, ...
913 // -- 2. loop trough all repeaters
914 // -- update sub_html template for nested repeater
915 // -- call updateSuffixes() for nested repeater
916 var $repeater = this.params.$repeater;
917 var num_subs = this.params.$repeater.num_subs;
918 var form = this.form;
919 var orig_id = $repeater.attr('data-orig_data_id');
920 var repeater_id = $repeater.attr('data-id');
921 var repeater_suffix = repeater_id.replace(orig_id, '');
922 var simplifiedDomArray = Object.values(wpcf7cf.get_simplified_dom_model(form.$form[0]));
923
924 var _loop = function _loop(i) {
925 var $sub = jQuery('> .wpcf7cf_repeater_sub', $repeater).eq(i);
926 var newIndex = i + 1;
927 var currentSuffix = $sub.attr('data-repeater_sub_suffix');
928 var newSuffix = repeater_suffix + '__' + newIndex;
929 $sub.attr('data-repeater_sub_suffix', newSuffix); // update sub attr
930
931 $sub.find('.wpcf7cf__' + orig_id).html(newIndex); // update {{r_index}} parts
932
933 simplifiedDomArray.forEach(function (el) {
934 if (el.suffix !== currentSuffix) return; // TODO: may need an extra check to verify that the element is inside the current repeater
935 // (orig_id) . Otherwise problems may occur if there are repeaters on the same level.
936
937 var newName = el.name.replace(currentSuffix, newSuffix);
938 var pureElName = el.name.replace('[]', '');
939 var pureNewName = newName.replace('[]', '');
940 jQuery('[name="' + el.name + '"]', $sub).attr('name', newName);
941 jQuery('[id="' + el.name + '"]', $sub).attr('id', newName);
942 jQuery('label[for="' + el.name + '"]', $sub).attr('for', newName);
943 var $nested_repeater = jQuery('[data-id="' + el.name + '"]', $sub);
944 $nested_repeater.attr('data-id', newName);
945 jQuery(".wpcf7-form-control-wrap[data-name=\"".concat(pureElName, "\"]"), $sub).attr('data-name', pureNewName);
946
947 if (el.type === 'repeater') {
948 var nested_repeater = form.repeaters.find(function (repeater) {
949 return repeater.params.$repeater.get(0) === $nested_repeater.get(0);
950 });
951 if (!nested_repeater) return;
952 nested_repeater.params.repeater_sub_html = wpcf7cf.updateRepeaterSubHTML(nested_repeater.params.repeater_sub_html, currentSuffix, newSuffix, nested_repeater.params.$repeater.parentRepeaters);
953 nested_repeater.updateSuffixes();
954 }
955 });
956 };
957
958 for (var i = 0; i < num_subs; i++) {
959 _loop(i);
960 }
961 };
962 /**
963 * Return the parent repeaters, order is not guaranteed.
964 */
965
966
967 Wpcf7cfRepeater.prototype.getParentRepeaters = function () {
968 var simplifiedDomArray = Object.values(wpcf7cf.get_simplified_dom_model(form.$form[0]));
969 form.repeaters.map(function (repeater) {});
970 };
971
972 Wpcf7cfRepeater.prototype.removeSubs = function (subs_to_remove) {
973 var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
974 var $ = jQuery;
975 var repeater = this;
976 var params = repeater.params;
977 var form = repeater.form;
978 var $repeater = params.$repeater;
979
980 if ($repeater.num_subs - subs_to_remove < $repeater.min) {
981 subs_to_remove = $repeater.num_subs - $repeater.min;
982 }
983
984 if (index === null) {
985 index = $repeater.num_subs - subs_to_remove;
986 }
987
988 $repeater.num_subs -= subs_to_remove;
989 jQuery('> .wpcf7cf_repeater_sub', $repeater).finish(); // finish any currently running animations immediately.
990
991 jQuery('> .wpcf7cf_repeater_sub', $repeater).slice(index, index + subs_to_remove).animate(wpcf7cf_hide_animation, {
992 duration: params.wpcf7cf_settings.animation_intime,
993 done: function done() {
994 var $this = jQuery(this); //remove the actual fields from the form
995
996 $this.remove();
997 params.$repeater.trigger('wpcf7cf_repeater_removed');
998 window.wpcf7cf.updateMultistepState(form.multistep);
999 form.updateGroups();
1000 form.updateEventListeners();
1001 form.displayFields();
1002 repeater.updateButtons();
1003
1004 if (index !== null) {
1005 repeater.updateSuffixes();
1006 }
1007 }
1008 });
1009 return false;
1010 };
1011
1012 function Wpcf7cfMultistep($multistep, form) {
1013 var multistep = this;
1014 multistep.$multistep = $multistep;
1015 multistep.form = form;
1016 multistep.$steps = $multistep.find('.wpcf7cf_step');
1017 multistep.$btn_next = $multistep.find('.wpcf7cf_next');
1018 multistep.$btn_prev = $multistep.find('.wpcf7cf_prev');
1019 multistep.$dots = $multistep.find('.wpcf7cf_steps-dots');
1020 multistep.currentStep = 0;
1021 multistep.numSteps = multistep.$steps.length;
1022 multistep.$dots.html('');
1023
1024 for (var i = 1; i <= multistep.numSteps; i++) {
1025 multistep.$dots.append("\n <div class=\"dot\" data-step=\"".concat(i, "\">\n <div class=\"step-index\">").concat(i, "</div>\n <div class=\"step-title\">").concat(multistep.$steps.eq(i - 1).attr('data-title'), "</div>\n </div>\n "));
1026 }
1027
1028 multistep.$btn_next.on('click.wpcf7cf_step', /*#__PURE__*/_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee() {
1029 var result;
1030 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee$(_context) {
1031 while (1) {
1032 switch (_context.prev = _context.next) {
1033 case 0:
1034 multistep.$btn_next.addClass('disabled').attr('disabled', true);
1035 multistep.form.$form.addClass('submitting');
1036 _context.next = 4;
1037 return multistep.validateStep(multistep.currentStep);
1038
1039 case 4:
1040 result = _context.sent;
1041 multistep.form.$form.removeClass('submitting');
1042
1043 if (result === 'success') {
1044 multistep.moveToStep(multistep.currentStep + 1);
1045 }
1046
1047 case 7:
1048 case "end":
1049 return _context.stop();
1050 }
1051 }
1052 }, _callee);
1053 }))); // If form is submitted (by pressing Enter for example), and if we are not on the last step,
1054 // then trigger click event on the $btn_next button instead.
1055
1056 multistep.form.$form.on('submit.wpcf7cf_step', function (e) {
1057 if (multistep.currentStep !== multistep.numSteps) {
1058 multistep.$btn_next.trigger('click.wpcf7cf_step');
1059 e.stopImmediatePropagation();
1060 return false;
1061 }
1062 });
1063 multistep.$btn_prev.on('click', function () {
1064 multistep.moveToStep(multistep.currentStep - 1);
1065 });
1066 multistep.moveToStep(1);
1067 }
1068
1069 Wpcf7cfMultistep.prototype.validateStep = function (step_index) {
1070 var multistep = this;
1071 var $multistep = multistep.$multistep;
1072 var $form = multistep.form.$form;
1073 var form = multistep.form;
1074 $form.find('.wpcf7-response-output').addClass('wpcf7-display-none');
1075 return new Promise(function (resolve) {
1076 var fd = new FormData(); // Make sure to add file fields to FormData
1077
1078 jQuery.each($form.find('[data-id="step-' + step_index + '"] input[type="file"]'), function (index, el) {
1079 if (!el.files.length) return true; // = continue
1080
1081 var file = el.files[0];
1082 var fieldName = el.name;
1083 fd.append(fieldName, file);
1084 });
1085 var formdata = $form.serializeArray();
1086 jQuery.each(formdata, function (key, input) {
1087 fd.append(input.name, input.value);
1088 });
1089 jQuery.ajax({
1090 url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step',
1091 type: 'POST',
1092 data: fd,
1093 processData: false,
1094 contentType: false,
1095 dataType: 'json'
1096 }).done(function (json) {
1097 $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove();
1098 $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid');
1099 $multistep.find('.wpcf7-response-output').remove();
1100 $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors');
1101 multistep.$btn_next.removeClass('disabled').attr('disabled', false);
1102
1103 if (!json.success) {
1104 var checkError = 0;
1105 jQuery.each(json.invalid_fields, function (index, el) {
1106 if ($multistep.find('input[name="' + index + '"]').length || $multistep.find('input[name="' + index + '[]"]').length || $multistep.find('select[name="' + index + '"]').length || $multistep.find('select[name="' + index + '[]"]').length || $multistep.find('textarea[name="' + index + '"]').length || $multistep.find('textarea[name="' + index + '[]"]').length) {
1107 checkError = checkError + 1;
1108 var controlWrap = form.get(".wpcf7-form-control-wrap[data-name=\"".concat(index, "\"]"));
1109 controlWrap.find('.wpcf7-form-control').addClass('wpcf7-not-valid');
1110 controlWrap.find('span.wpcf7-not-valid-tip').remove();
1111 controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>');
1112 }
1113 });
1114 resolve('failed');
1115 $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message);
1116 wpcf7.setStatus($form, 'invalid');
1117 multistep.$steps.trigger('wpcf7cf_step_invalid'); // wpcf7.triggerEvent( data.into, 'invalid', detail );
1118 } else if (json.success) {
1119 wpcf7.setStatus($form, 'init');
1120 resolve('success');
1121 return false;
1122 }
1123 }).fail(function () {
1124 resolve('error');
1125 }).always(function () {// do nothing
1126 });
1127 });
1128 };
1129
1130 Wpcf7cfMultistep.prototype.moveToStep = function (step_index) {
1131 var scrollToTop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1132 var multistep = this;
1133 var previousStep = multistep.currentStep;
1134 multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps : step_index < 1 ? 1 : step_index; // ANIMATION DISABLED FOR NOW cause it's ugly
1135 // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime);
1136 // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime);
1137
1138 multistep.$multistep.attr('data-current_step', multistep.currentStep);
1139 multistep.$steps.hide();
1140 multistep.$steps.eq(multistep.currentStep - 1).show().trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]);
1141
1142 if (scrollToTop) {
1143 var formEl = multistep.form.$form[0];
1144 var topOffset = formEl.getBoundingClientRect().top;
1145
1146 if (topOffset < 0 && previousStep > 0) {
1147 formEl.scrollIntoView({
1148 behavior: "smooth"
1149 });
1150 }
1151 }
1152
1153 multistep.form.updateSummaryFields();
1154 window.wpcf7cf.updateMultistepState(multistep);
1155 };
1156
1157 Wpcf7cfMultistep.prototype.getFieldsInStep = function (step_index) {
1158 this.form.reloadSimpleDom();
1159 var inStep = false;
1160 return Object.values(this.form.simpleDom).filter(function (item, i) {
1161 if (item.type == 'step') {
1162 inStep = item.val == step_index + '';
1163 }
1164
1165 return inStep && item.type == 'input';
1166 }).map(function (item) {
1167 return item.name;
1168 });
1169 }; // END PRO ONLY
1170
1171 /**
1172 * @global
1173 * @namespace wpcf7cf
1174 */
1175
1176
1177 window.wpcf7cf = {
1178 hideGroup: function hideGroup($group, animate) {},
1179 showGroup: function showGroup($group, animate) {},
1180 updateRepeaterSubHTML: function updateRepeaterSubHTML(html, oldSuffix, newSuffix, parentRepeaters) {
1181 var oldIndexes = oldSuffix.split('__');
1182 oldIndexes.shift(); // remove first empty element
1183
1184 var newIndexes = newSuffix.split('__');
1185 newIndexes.shift(); // remove first empty element
1186
1187 var returnHtml = html;
1188
1189 if (oldIndexes && newIndexes && oldIndexes.length === parentRepeaters.length && newIndexes.length === parentRepeaters.length) {
1190 var parentRepeatersInfo = parentRepeaters.map(function (repeaterId, i) {
1191 return _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1___default()({}, repeaterId.split('__')[0], [oldIndexes[i], newIndexes[i]]);
1192 });
1193 var length = parentRepeatersInfo.length;
1194 var replacements = oldIndexes.map(function (oldIndex, i) {
1195 return ['__' + oldIndexes.slice(0, length - i).join('__'), '__' + newIndexes.slice(0, length - i).join('__')];
1196 });
1197
1198 for (var i = 0; i < length; i++) {
1199 var id = Object.keys(parentRepeatersInfo[i])[0];
1200 var find = parentRepeatersInfo[i][id][0];
1201 var repl = parentRepeatersInfo[i][id][1];
1202 replacements.push(["<span class=\"wpcf7cf-index wpcf7cf__".concat(id, "\">").concat(find, "<\\/span>"), "<span class=\"wpcf7cf-index wpcf7cf__".concat(id, "\">").concat(repl, "</span>")]);
1203 }
1204
1205 replacements.forEach(function (_ref3) {
1206 var _ref4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref3, 2),
1207 oldSuffix = _ref4[0],
1208 newSuffix = _ref4[1];
1209
1210 returnHtml = returnHtml.replace(new RegExp(oldSuffix, 'g'), newSuffix);
1211 });
1212 }
1213
1214 return returnHtml;
1215 },
1216 // keep this for backwards compatibility
1217 initForm: function initForm($forms) {
1218 $forms.each(function () {
1219 var $form = jQuery(this); // only add form is its class is "wpcf7-form" and if the form was not previously added
1220
1221 if ($form.hasClass('wpcf7-form') && !wpcf7cf_forms.some(function (form) {
1222 return form.$form.get(0) === $form.get(0);
1223 })) {
1224 wpcf7cf_forms.push(new Wpcf7cfForm($form));
1225 }
1226 });
1227 },
1228 getWpcf7cfForm: function getWpcf7cfForm($form) {
1229 var matched_forms = wpcf7cf_forms.filter(function (form) {
1230 return form.$form.get(0) === $form.get(0);
1231 });
1232
1233 if (matched_forms.length) {
1234 return matched_forms[0];
1235 }
1236
1237 return false;
1238 },
1239 get_nested_conditions: function get_nested_conditions(form) {
1240 var conditions = form.initial_conditions; //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index
1241
1242 form.reloadSimpleDom();
1243 var groups = Object.values(form.simpleDom).filter(function (item, i) {
1244 return item.type === 'group';
1245 });
1246 var sub_conditions = [];
1247
1248 var _loop2 = function _loop2(i) {
1249 var g = groups[i];
1250 var relevant_conditions = conditions.filter(function (condition, i) {
1251 return condition.then_field === g.original_name;
1252 });
1253 relevant_conditions = relevant_conditions.map(function (item, i) {
1254 return {
1255 then_field: g.name,
1256 and_rules: item.and_rules.map(function (and_rule, i) {
1257 return {
1258 if_field: and_rule.if_field + g.suffix,
1259 if_value: and_rule.if_value,
1260 operator: and_rule.operator
1261 };
1262 })
1263 };
1264 });
1265 sub_conditions = sub_conditions.concat(relevant_conditions);
1266 };
1267
1268 for (var i = 0; i < groups.length; i++) {
1269 _loop2(i);
1270 }
1271
1272 return sub_conditions;
1273 },
1274 get_simplified_dom_model: function get_simplified_dom_model(currentNode) {
1275 var simplified_dom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1276 var parentGroups = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1277 var parentRepeaters = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1278 var type = currentNode.classList && currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' : currentNode.dataset["class"] == 'wpcf7cf_group' ? 'group' : currentNode.className == 'wpcf7cf_step' ? 'step' : currentNode.hasAttribute('name') ? 'input' : false;
1279
1280 var newParentRepeaters = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(parentRepeaters);
1281
1282 var newParentGroups = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_4___default()(parentGroups);
1283
1284 if (type) {
1285 var name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id;
1286
1287 if (type === 'repeater') {
1288 newParentRepeaters.push(name);
1289 }
1290
1291 if (type === 'group') {
1292 newParentGroups.push(name);
1293 } // skip _wpcf7 hidden fields
1294
1295
1296 if (name.substring(0, 6) === '_wpcf7') return {};
1297 var original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id : type === 'input' ? currentNode.getAttribute('data-orig_name') || name : name;
1298 var nameWithoutBrackets = name.replace('[]', '');
1299 var originalNameWithoutBrackets = original_name.replace('[]', '');
1300 var val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];
1301 var suffix = nameWithoutBrackets.replace(originalNameWithoutBrackets, '');
1302
1303 if (!simplified_dom[name]) {
1304 // init entry
1305 simplified_dom[name] = {
1306 name: name,
1307 type: type,
1308 original_name: original_name,
1309 suffix: suffix,
1310 val: val,
1311 parentGroups: parentGroups,
1312 parentRepeaters: parentRepeaters
1313 };
1314 }
1315
1316 if (type === 'input') {
1317 // skip unchecked checkboxes and radiobuttons
1318 if ((currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked) return {}; // if multiselect, make sure to add all the values
1319
1320 if (currentNode.multiple && currentNode.options) {
1321 simplified_dom[name].val = Object.values(currentNode.options).filter(function (o) {
1322 return o.selected;
1323 }).map(function (o) {
1324 return o.value;
1325 });
1326 } else {
1327 simplified_dom[name].val.push(currentNode.value);
1328 }
1329 }
1330 } // can't use currentNode.children (because then field name cannot be "children")
1331
1332
1333 var getter = Object.getOwnPropertyDescriptor(Element.prototype, "children").get;
1334 var children = getter.call(currentNode);
1335 Array.from(children).forEach(function (childNode) {
1336 var dom = wpcf7cf.get_simplified_dom_model(childNode, simplified_dom, newParentGroups, newParentRepeaters);
1337 simplified_dom = _objectSpread(_objectSpread({}, dom), simplified_dom);
1338 });
1339 return simplified_dom;
1340 },
1341 updateMultistepState: function updateMultistepState(multistep) {
1342 if (multistep == null) return; // update hidden input field
1343
1344 var stepsData = {
1345 currentStep: multistep.currentStep,
1346 numSteps: multistep.numSteps,
1347 fieldsInCurrentStep: multistep.getFieldsInStep(multistep.currentStep)
1348 };
1349 multistep.form.$input_steps.val(JSON.stringify(stepsData)); // update Buttons
1350
1351 multistep.$btn_prev.removeClass('disabled').attr('disabled', false);
1352 multistep.$btn_next.removeClass('disabled').attr('disabled', false);
1353
1354 if (multistep.currentStep == multistep.numSteps) {
1355 multistep.$btn_next.addClass('disabled').attr('disabled', true);
1356 }
1357
1358 if (multistep.currentStep == 1) {
1359 multistep.$btn_prev.addClass('disabled').attr('disabled', true);
1360 } // replace next button with submit button on last step.
1361 // TODO: make this depend on a setting
1362
1363
1364 var $submit_button = multistep.form.$form.find('input[type="submit"]:last').eq(0);
1365 var $ajax_loader = multistep.form.$form.find('.wpcf7-spinner').eq(0);
1366 $submit_button.detach().prependTo(multistep.$btn_next.parent());
1367 $ajax_loader.detach().prependTo(multistep.$btn_next.parent());
1368
1369 if (multistep.currentStep == multistep.numSteps) {
1370 multistep.$btn_next.hide();
1371 $submit_button.show();
1372 } else {
1373 $submit_button.hide();
1374 multistep.$btn_next.show();
1375 } // update dots
1376
1377
1378 var $dots = multistep.$dots.find('.dot');
1379 $dots.removeClass('active').removeClass('completed');
1380
1381 for (var step = 1; step <= multistep.numSteps; step++) {
1382 if (step < multistep.currentStep) {
1383 $dots.eq(step - 1).addClass('completed');
1384 } else if (step == multistep.currentStep) {
1385 $dots.eq(step - 1).addClass('active');
1386 }
1387 }
1388 },
1389 should_group_be_shown: function should_group_be_shown(condition, form) {
1390 var show_group = true;
1391 var atLeastOneFieldFound = false;
1392
1393 for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) {
1394 var condition_ok = false;
1395 var condition_and_rule = condition.and_rules[and_rule_i];
1396 var inputField = form.getFieldByName(condition_and_rule.if_field);
1397 if (!inputField) continue; // field not found
1398
1399 atLeastOneFieldFound = true;
1400 var if_val = condition_and_rule.if_value;
1401 var operator = condition_and_rule.operator; //backwards compat
1402
1403 operator = operator === '' ? 'less than or equals' : operator;
1404 operator = operator === '' ? 'greater than or equals' : operator;
1405 operator = operator === '>' ? 'greater than' : operator;
1406 operator = operator === '<' ? 'less than' : operator;
1407 var $field = operator === 'function' && jQuery("[name=\"".concat(inputField.name, "\"]")).eq(0);
1408 condition_ok = this.isConditionTrue(inputField.val, operator, if_val, $field);
1409 show_group = show_group && condition_ok;
1410 }
1411
1412 return show_group && atLeastOneFieldFound;
1413 },
1414 isConditionTrue: function isConditionTrue(values, operator) {
1415 var testValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1416 var $field = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : jQuery();
1417
1418 if (!Array.isArray(values)) {
1419 values = [values];
1420 }
1421
1422 var condition_ok = false; // start by assuming that the condition is not met
1423 // Considered EMPTY: [] [''] [null] ['',null] [,,'']
1424 // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null]
1425
1426 var valuesAreEmpty = values.length === 0 || values.every(function (v) {
1427 return !v && v !== 0;
1428 }); // 0 is not considered empty
1429 // special cases: [] equals '' => TRUE; [] not equals '' => FALSE
1430
1431 if (operator === 'equals' && testValue === '' && valuesAreEmpty) {
1432 return true;
1433 }
1434
1435 if (operator === 'not equals' && testValue === '' && valuesAreEmpty) {
1436 return false;
1437 }
1438
1439 if (valuesAreEmpty) {
1440 if (operator === 'is empty') {
1441 condition_ok = true;
1442 }
1443 } else {
1444 if (operator === 'not empty') {
1445 condition_ok = true;
1446 }
1447 }
1448
1449 var testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN;
1450
1451 if (operator === 'not equals' || operator === 'not equals (regex)') {
1452 // start by assuming that the condition is met
1453 condition_ok = true;
1454 }
1455
1456 if (operator === 'function' && typeof window[testValue] == 'function' && window[testValue]($field) // here we call the actual user defined function
1457 ) {
1458 condition_ok = true;
1459 }
1460
1461 var regex_patt = /.*/i; // fallback regex pattern
1462
1463 var isValidRegex = true;
1464
1465 if (operator === 'equals (regex)' || operator === 'not equals (regex)') {
1466 try {
1467 regex_patt = new RegExp(testValue, 'i');
1468 } catch (e) {
1469 isValidRegex = false;
1470 }
1471 }
1472
1473 for (var i = 0; i < values.length; i++) {
1474 var value = values[i];
1475 var valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN;
1476 var valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber);
1477
1478 if (operator === 'equals' && value === testValue || operator === 'equals (regex)' && regex_patt.test(value) || operator === 'greater than' && valsAreNumbers && valueNumber > testValueNumber || operator === 'less than' && valsAreNumbers && valueNumber < testValueNumber || operator === 'greater than or equals' && valsAreNumbers && valueNumber >= testValueNumber || operator === 'less than or equals' && valsAreNumbers && valueNumber <= testValueNumber) {
1479 condition_ok = true;
1480 break;
1481 } else if (operator === 'not equals' && value === testValue || operator === 'not equals (regex)' && regex_patt.test(value)) {
1482 condition_ok = false;
1483 break;
1484 }
1485 }
1486
1487 return condition_ok;
1488 },
1489 getFormObj: function getFormObj($form) {
1490 if (typeof $form === 'string') {
1491 $form = jQuery($form).eq(0);
1492 }
1493
1494 return wpcf7cf.getWpcf7cfForm($form);
1495 },
1496 getRepeaterObj: function getRepeaterObj($form, repeaterDataId) {
1497 var form = wpcf7cf.getFormObj($form);
1498 var repeater = form.repeaters.find(function (repeater) {
1499 return repeater.params.$repeater.attr('data-id') === repeaterDataId;
1500 });
1501 return repeater;
1502 },
1503 getMultiStepObj: function getMultiStepObj($form) {
1504 var form = wpcf7cf.getFormObj($form);
1505 return form.multistep;
1506 },
1507
1508 /**
1509 * Append a new sub-entry to the repeater with the name `repeaterDataId` inside the form `$form`
1510 * @memberof wpcf7cf
1511 * @function wpcf7cf.repeaterAddSub
1512 * @link
1513 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1514 * @param {String} repeaterDataId - *data-id* attribute of the repeater. Normally this is simply the name of the repeater. However, in case of a nested repeater you need to append the name with the correct suffix. For example `my-nested-repeater__1__3`. Hint (check the `data-id` attribute in the HTML code to find the correct suffix)
1515 */
1516 repeaterAddSub: function repeaterAddSub($form, repeaterDataId) {
1517 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1518 repeater.updateSubs(repeater.params.$repeater.num_subs + 1);
1519 },
1520
1521 /**
1522 * Insert a new sub-entry at the given `index` of the repeater with the name `repeaterDataId` inside the form `$form`
1523 * @memberof wpcf7cf
1524 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1525 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1526 * @param {Number} index - position where to insert the new sub-entry within the repeater
1527 */
1528 repeaterAddSubAtIndex: function repeaterAddSubAtIndex($form, repeaterDataId, index) {
1529 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1530 repeater.addSubs(1, index);
1531 },
1532
1533 /**
1534 * Remove the sub-entry at the given `index` of the repeater with the *data-id* attribute of `repeaterDataId` inside the form `$form`
1535 * @memberof wpcf7cf
1536 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1537 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1538 * @param {Number} index - position where to insert the new sub-entry within the repeater
1539 */
1540 repeaterRemoveSubAtIndex: function repeaterRemoveSubAtIndex($form, repeaterDataId, index) {
1541 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1542 repeater.removeSubs(1, index);
1543 },
1544
1545 /**
1546 * Remove the last sub-entry from the repeater with the *data-id* attribute of `repeaterDataId` inside the form `$form`
1547 * @memberof wpcf7cf
1548 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1549 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1550 * @param {Number} index - position where to insert the new sub-entry within the repeater
1551 */
1552 repeaterRemoveSub: function repeaterRemoveSub($form, repeaterDataId) {
1553 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1554 repeater.updateSubs(repeater.params.$repeater.num_subs - 1);
1555 },
1556
1557 /**
1558 * Set the number of subs for the repeater with the *data-id* attribute of `repeaterDataId` inside the form `$form`.
1559 * Subs are either appended to or removed from the end of the repeater.
1560 * @memberof wpcf7cf
1561 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1562 * @param {String} repeaterDataId - *data-id* attribute of the repeater.
1563 * @param {Number} numberOfSubs - position where to insert the new sub-entry within the repeater
1564 */
1565 repeaterSetNumberOfSubs: function repeaterSetNumberOfSubs($form, repeaterDataId, numberOfSubs) {
1566 var repeater = wpcf7cf.getRepeaterObj($form, repeaterDataId);
1567 repeater.updateSubs(numberOfSubs);
1568 },
1569
1570 /**
1571 * Move to step number `step`, ignoring any validation.
1572 * @memberof wpcf7cf
1573 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1574 * @param {*} step
1575 */
1576 multistepMoveToStep: function multistepMoveToStep($form, step) {
1577 var multistep = wpcf7cf.getMultiStepObj($form);
1578 multistep.moveToStep(step);
1579 },
1580
1581 /**
1582 * Validate the current step, and move to step number `step` if validation passes.
1583 * @memberof wpcf7cf
1584 * @param {String|JQuery} $form - JQuery object or css-selector representing the form
1585 * @param {Number} step
1586 */
1587 multistepMoveToStepWithValidation: function multistepMoveToStepWithValidation($form, step) {
1588 return _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.mark(function _callee2() {
1589 var multistep, result;
1590 return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_2___default.a.wrap(function _callee2$(_context2) {
1591 while (1) {
1592 switch (_context2.prev = _context2.next) {
1593 case 0:
1594 multistep = wpcf7cf.getMultiStepObj($form);
1595 _context2.next = 3;
1596 return multistep.validateStep(multistep.currentStep);
1597
1598 case 3:
1599 result = _context2.sent;
1600
1601 if (result === 'success') {
1602 multistep.moveToStep(step);
1603 }
1604
1605 case 5:
1606 case "end":
1607 return _context2.stop();
1608 }
1609 }
1610 }, _callee2);
1611 }))();
1612 }
1613 };
1614 jQuery('.wpcf7-form').each(function () {
1615 wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this)));
1616 }); // Call displayFields again on all forms
1617 // Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded.
1618
1619 jQuery('document').on('ready', function () {
1620 wpcf7cf_forms.forEach(function (f) {
1621 f.displayFields();
1622 });
1623 }); // fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)
1624
1625 var old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox;
1626
1627 jQuery.fn.wpcf7ExclusiveCheckbox = function () {
1628 return this.find('input:checkbox').on('click', function () {
1629 var name = jQuery(this).attr('name');
1630 jQuery(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false).eq(0).change();
1631 });
1632 };
1633
1634 /***/ }),
1635
1636 /***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
1637 /*!*****************************************************************!*\
1638 !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
1639 \*****************************************************************/
1640 /*! no static exports found */
1641 /***/ (function(module, exports) {
1642
1643 function _arrayLikeToArray(arr, len) {
1644 if (len == null || len > arr.length) len = arr.length;
1645
1646 for (var i = 0, arr2 = new Array(len); i < len; i++) {
1647 arr2[i] = arr[i];
1648 }
1649
1650 return arr2;
1651 }
1652
1653 module.exports = _arrayLikeToArray;
1654
1655 /***/ }),
1656
1657 /***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js":
1658 /*!***************************************************************!*\
1659 !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
1660 \***************************************************************/
1661 /*! no static exports found */
1662 /***/ (function(module, exports) {
1663
1664 function _arrayWithHoles(arr) {
1665 if (Array.isArray(arr)) return arr;
1666 }
1667
1668 module.exports = _arrayWithHoles;
1669
1670 /***/ }),
1671
1672 /***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js":
1673 /*!******************************************************************!*\
1674 !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
1675 \******************************************************************/
1676 /*! no static exports found */
1677 /***/ (function(module, exports, __webpack_require__) {
1678
1679 var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
1680
1681 function _arrayWithoutHoles(arr) {
1682 if (Array.isArray(arr)) return arrayLikeToArray(arr);
1683 }
1684
1685 module.exports = _arrayWithoutHoles;
1686
1687 /***/ }),
1688
1689 /***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js":
1690 /*!*****************************************************************!*\
1691 !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
1692 \*****************************************************************/
1693 /*! no static exports found */
1694 /***/ (function(module, exports) {
1695
1696 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1697 try {
1698 var info = gen[key](arg);
1699 var value = info.value;
1700 } catch (error) {
1701 reject(error);
1702 return;
1703 }
1704
1705 if (info.done) {
1706 resolve(value);
1707 } else {
1708 Promise.resolve(value).then(_next, _throw);
1709 }
1710 }
1711
1712 function _asyncToGenerator(fn) {
1713 return function () {
1714 var self = this,
1715 args = arguments;
1716 return new Promise(function (resolve, reject) {
1717 var gen = fn.apply(self, args);
1718
1719 function _next(value) {
1720 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1721 }
1722
1723 function _throw(err) {
1724 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1725 }
1726
1727 _next(undefined);
1728 });
1729 };
1730 }
1731
1732 module.exports = _asyncToGenerator;
1733
1734 /***/ }),
1735
1736 /***/ "./node_modules/@babel/runtime/helpers/defineProperty.js":
1737 /*!***************************************************************!*\
1738 !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
1739 \***************************************************************/
1740 /*! no static exports found */
1741 /***/ (function(module, exports) {
1742
1743 function _defineProperty(obj, key, value) {
1744 if (key in obj) {
1745 Object.defineProperty(obj, key, {
1746 value: value,
1747 enumerable: true,
1748 configurable: true,
1749 writable: true
1750 });
1751 } else {
1752 obj[key] = value;
1753 }
1754
1755 return obj;
1756 }
1757
1758 module.exports = _defineProperty;
1759
1760 /***/ }),
1761
1762 /***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js":
1763 /*!****************************************************************!*\
1764 !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
1765 \****************************************************************/
1766 /*! no static exports found */
1767 /***/ (function(module, exports) {
1768
1769 function _iterableToArray(iter) {
1770 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
1771 }
1772
1773 module.exports = _iterableToArray;
1774
1775 /***/ }),
1776
1777 /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
1778 /*!*********************************************************************!*\
1779 !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
1780 \*********************************************************************/
1781 /*! no static exports found */
1782 /***/ (function(module, exports) {
1783
1784 function _iterableToArrayLimit(arr, i) {
1785 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
1786 var _arr = [];
1787 var _n = true;
1788 var _d = false;
1789 var _e = undefined;
1790
1791 try {
1792 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1793 _arr.push(_s.value);
1794
1795 if (i && _arr.length === i) break;
1796 }
1797 } catch (err) {
1798 _d = true;
1799 _e = err;
1800 } finally {
1801 try {
1802 if (!_n && _i["return"] != null) _i["return"]();
1803 } finally {
1804 if (_d) throw _e;
1805 }
1806 }
1807
1808 return _arr;
1809 }
1810
1811 module.exports = _iterableToArrayLimit;
1812
1813 /***/ }),
1814
1815 /***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js":
1816 /*!****************************************************************!*\
1817 !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
1818 \****************************************************************/
1819 /*! no static exports found */
1820 /***/ (function(module, exports) {
1821
1822 function _nonIterableRest() {
1823 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1824 }
1825
1826 module.exports = _nonIterableRest;
1827
1828 /***/ }),
1829
1830 /***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js":
1831 /*!******************************************************************!*\
1832 !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
1833 \******************************************************************/
1834 /*! no static exports found */
1835 /***/ (function(module, exports) {
1836
1837 function _nonIterableSpread() {
1838 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1839 }
1840
1841 module.exports = _nonIterableSpread;
1842
1843 /***/ }),
1844
1845 /***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js":
1846 /*!**************************************************************!*\
1847 !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
1848 \**************************************************************/
1849 /*! no static exports found */
1850 /***/ (function(module, exports, __webpack_require__) {
1851
1852 var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js");
1853
1854 var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js");
1855
1856 var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
1857
1858 var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js");
1859
1860 function _slicedToArray(arr, i) {
1861 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
1862 }
1863
1864 module.exports = _slicedToArray;
1865
1866 /***/ }),
1867
1868 /***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js":
1869 /*!******************************************************************!*\
1870 !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
1871 \******************************************************************/
1872 /*! no static exports found */
1873 /***/ (function(module, exports, __webpack_require__) {
1874
1875 var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js");
1876
1877 var iterableToArray = __webpack_require__(/*! ./iterableToArray */ "./node_modules/@babel/runtime/helpers/iterableToArray.js");
1878
1879 var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
1880
1881 var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js");
1882
1883 function _toConsumableArray(arr) {
1884 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
1885 }
1886
1887 module.exports = _toConsumableArray;
1888
1889 /***/ }),
1890
1891 /***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
1892 /*!***************************************************************************!*\
1893 !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
1894 \***************************************************************************/
1895 /*! no static exports found */
1896 /***/ (function(module, exports, __webpack_require__) {
1897
1898 var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
1899
1900 function _unsupportedIterableToArray(o, minLen) {
1901 if (!o) return;
1902 if (typeof o === "string") return arrayLikeToArray(o, minLen);
1903 var n = Object.prototype.toString.call(o).slice(8, -1);
1904 if (n === "Object" && o.constructor) n = o.constructor.name;
1905 if (n === "Map" || n === "Set") return Array.from(o);
1906 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
1907 }
1908
1909 module.exports = _unsupportedIterableToArray;
1910
1911 /***/ }),
1912
1913 /***/ "./node_modules/@babel/runtime/regenerator/index.js":
1914 /*!**********************************************************!*\
1915 !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
1916 \**********************************************************/
1917 /*! no static exports found */
1918 /***/ (function(module, exports, __webpack_require__) {
1919
1920 module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js");
1921
1922 /***/ }),
1923
1924 /***/ "./node_modules/es6-promise-promise/index.js":
1925 /*!***************************************************!*\
1926 !*** ./node_modules/es6-promise-promise/index.js ***!
1927 \***************************************************/
1928 /*! no static exports found */
1929 /***/ (function(module, exports, __webpack_require__) {
1930
1931 module.exports = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js").Promise;
1932
1933 /***/ }),
1934
1935 /***/ "./node_modules/es6-promise/dist/es6-promise.js":
1936 /*!******************************************************!*\
1937 !*** ./node_modules/es6-promise/dist/es6-promise.js ***!
1938 \******************************************************/
1939 /*! no static exports found */
1940 /***/ (function(module, exports, __webpack_require__) {
1941
1942 /* WEBPACK VAR INJECTION */(function(process, global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1943
1944 /*!
1945 * @overview es6-promise - a tiny implementation of Promises/A+.
1946 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
1947 * @license Licensed under MIT license
1948 * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
1949 * @version 3.3.1
1950 */
1951 (function (global, factory) {
1952 ( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
1953 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
1954 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
1955 __WEBPACK_AMD_DEFINE_FACTORY__),
1956 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
1957 })(this, function () {
1958 'use strict';
1959
1960 function objectOrFunction(x) {
1961 return typeof x === 'function' || _typeof(x) === 'object' && x !== null;
1962 }
1963
1964 function isFunction(x) {
1965 return typeof x === 'function';
1966 }
1967
1968 var _isArray = undefined;
1969
1970 if (!Array.isArray) {
1971 _isArray = function _isArray(x) {
1972 return Object.prototype.toString.call(x) === '[object Array]';
1973 };
1974 } else {
1975 _isArray = Array.isArray;
1976 }
1977
1978 var isArray = _isArray;
1979 var len = 0;
1980 var vertxNext = undefined;
1981 var customSchedulerFn = undefined;
1982
1983 var asap = function asap(callback, arg) {
1984 queue[len] = callback;
1985 queue[len + 1] = arg;
1986 len += 2;
1987
1988 if (len === 2) {
1989 // If len is 2, that means that we need to schedule an async flush.
1990 // If additional callbacks are queued before the queue is flushed, they
1991 // will be processed by this flush that we are scheduling.
1992 if (customSchedulerFn) {
1993 customSchedulerFn(flush);
1994 } else {
1995 scheduleFlush();
1996 }
1997 }
1998 };
1999
2000 function setScheduler(scheduleFn) {
2001 customSchedulerFn = scheduleFn;
2002 }
2003
2004 function setAsap(asapFn) {
2005 asap = asapFn;
2006 }
2007
2008 var browserWindow = typeof window !== 'undefined' ? window : undefined;
2009 var browserGlobal = browserWindow || {};
2010 var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
2011 var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; // test for web worker but not in IE10
2012
2013 var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; // node
2014
2015 function useNextTick() {
2016 // node version 0.10.x displays a deprecation warning when nextTick is used recursively
2017 // see https://github.com/cujojs/when/issues/410 for details
2018 return function () {
2019 return process.nextTick(flush);
2020 };
2021 } // vertx
2022
2023
2024 function useVertxTimer() {
2025 return function () {
2026 vertxNext(flush);
2027 };
2028 }
2029
2030 function useMutationObserver() {
2031 var iterations = 0;
2032 var observer = new BrowserMutationObserver(flush);
2033 var node = document.createTextNode('');
2034 observer.observe(node, {
2035 characterData: true
2036 });
2037 return function () {
2038 node.data = iterations = ++iterations % 2;
2039 };
2040 } // web worker
2041
2042
2043 function useMessageChannel() {
2044 var channel = new MessageChannel();
2045 channel.port1.onmessage = flush;
2046 return function () {
2047 return channel.port2.postMessage(0);
2048 };
2049 }
2050
2051 function useSetTimeout() {
2052 // Store setTimeout reference so es6-promise will be unaffected by
2053 // other code modifying setTimeout (like sinon.useFakeTimers())
2054 var globalSetTimeout = setTimeout;
2055 return function () {
2056 return globalSetTimeout(flush, 1);
2057 };
2058 }
2059
2060 var queue = new Array(1000);
2061
2062 function flush() {
2063 for (var i = 0; i < len; i += 2) {
2064 var callback = queue[i];
2065 var arg = queue[i + 1];
2066 callback(arg);
2067 queue[i] = undefined;
2068 queue[i + 1] = undefined;
2069 }
2070
2071 len = 0;
2072 }
2073
2074 function attemptVertx() {
2075 try {
2076 var r = require;
2077 var vertx = __webpack_require__(/*! vertx */ 1);
2078 vertxNext = vertx.runOnLoop || vertx.runOnContext;
2079 return useVertxTimer();
2080 } catch (e) {
2081 return useSetTimeout();
2082 }
2083 }
2084
2085 var scheduleFlush = undefined; // Decide what async method to use to triggering processing of queued callbacks:
2086
2087 if (isNode) {
2088 scheduleFlush = useNextTick();
2089 } else if (BrowserMutationObserver) {
2090 scheduleFlush = useMutationObserver();
2091 } else if (isWorker) {
2092 scheduleFlush = useMessageChannel();
2093 } else if (browserWindow === undefined && "function" === 'function') {
2094 scheduleFlush = attemptVertx();
2095 } else {
2096 scheduleFlush = useSetTimeout();
2097 }
2098
2099 function then(onFulfillment, onRejection) {
2100 var _arguments = arguments;
2101 var parent = this;
2102 var child = new this.constructor(noop);
2103
2104 if (child[PROMISE_ID] === undefined) {
2105 makePromise(child);
2106 }
2107
2108 var _state = parent._state;
2109
2110 if (_state) {
2111 (function () {
2112 var callback = _arguments[_state - 1];
2113 asap(function () {
2114 return invokeCallback(_state, child, callback, parent._result);
2115 });
2116 })();
2117 } else {
2118 subscribe(parent, child, onFulfillment, onRejection);
2119 }
2120
2121 return child;
2122 }
2123 /**
2124 `Promise.resolve` returns a promise that will become resolved with the
2125 passed `value`. It is shorthand for the following:
2126
2127 ```javascript
2128 let promise = new Promise(function(resolve, reject){
2129 resolve(1);
2130 });
2131
2132 promise.then(function(value){
2133 // value === 1
2134 });
2135 ```
2136
2137 Instead of writing the above, your code now simply becomes the following:
2138
2139 ```javascript
2140 let promise = Promise.resolve(1);
2141
2142 promise.then(function(value){
2143 // value === 1
2144 });
2145 ```
2146
2147 @method resolve
2148 @static
2149 @param {Any} value value that the returned promise will be resolved with
2150 Useful for tooling.
2151 @return {Promise} a promise that will become fulfilled with the given
2152 `value`
2153 */
2154
2155
2156 function resolve(object) {
2157 /*jshint validthis:true */
2158 var Constructor = this;
2159
2160 if (object && _typeof(object) === 'object' && object.constructor === Constructor) {
2161 return object;
2162 }
2163
2164 var promise = new Constructor(noop);
2165
2166 _resolve(promise, object);
2167
2168 return promise;
2169 }
2170
2171 var PROMISE_ID = Math.random().toString(36).substring(16);
2172
2173 function noop() {}
2174
2175 var PENDING = void 0;
2176 var FULFILLED = 1;
2177 var REJECTED = 2;
2178 var GET_THEN_ERROR = new ErrorObject();
2179
2180 function selfFulfillment() {
2181 return new TypeError("You cannot resolve a promise with itself");
2182 }
2183
2184 function cannotReturnOwn() {
2185 return new TypeError('A promises callback cannot return that same promise.');
2186 }
2187
2188 function getThen(promise) {
2189 try {
2190 return promise.then;
2191 } catch (error) {
2192 GET_THEN_ERROR.error = error;
2193 return GET_THEN_ERROR;
2194 }
2195 }
2196
2197 function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
2198 try {
2199 then.call(value, fulfillmentHandler, rejectionHandler);
2200 } catch (e) {
2201 return e;
2202 }
2203 }
2204
2205 function handleForeignThenable(promise, thenable, then) {
2206 asap(function (promise) {
2207 var sealed = false;
2208 var error = tryThen(then, thenable, function (value) {
2209 if (sealed) {
2210 return;
2211 }
2212
2213 sealed = true;
2214
2215 if (thenable !== value) {
2216 _resolve(promise, value);
2217 } else {
2218 fulfill(promise, value);
2219 }
2220 }, function (reason) {
2221 if (sealed) {
2222 return;
2223 }
2224
2225 sealed = true;
2226
2227 _reject(promise, reason);
2228 }, 'Settle: ' + (promise._label || ' unknown promise'));
2229
2230 if (!sealed && error) {
2231 sealed = true;
2232
2233 _reject(promise, error);
2234 }
2235 }, promise);
2236 }
2237
2238 function handleOwnThenable(promise, thenable) {
2239 if (thenable._state === FULFILLED) {
2240 fulfill(promise, thenable._result);
2241 } else if (thenable._state === REJECTED) {
2242 _reject(promise, thenable._result);
2243 } else {
2244 subscribe(thenable, undefined, function (value) {
2245 return _resolve(promise, value);
2246 }, function (reason) {
2247 return _reject(promise, reason);
2248 });
2249 }
2250 }
2251
2252 function handleMaybeThenable(promise, maybeThenable, then$$) {
2253 if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
2254 handleOwnThenable(promise, maybeThenable);
2255 } else {
2256 if (then$$ === GET_THEN_ERROR) {
2257 _reject(promise, GET_THEN_ERROR.error);
2258 } else if (then$$ === undefined) {
2259 fulfill(promise, maybeThenable);
2260 } else if (isFunction(then$$)) {
2261 handleForeignThenable(promise, maybeThenable, then$$);
2262 } else {
2263 fulfill(promise, maybeThenable);
2264 }
2265 }
2266 }
2267
2268 function _resolve(promise, value) {
2269 if (promise === value) {
2270 _reject(promise, selfFulfillment());
2271 } else if (objectOrFunction(value)) {
2272 handleMaybeThenable(promise, value, getThen(value));
2273 } else {
2274 fulfill(promise, value);
2275 }
2276 }
2277
2278 function publishRejection(promise) {
2279 if (promise._onerror) {
2280 promise._onerror(promise._result);
2281 }
2282
2283 publish(promise);
2284 }
2285
2286 function fulfill(promise, value) {
2287 if (promise._state !== PENDING) {
2288 return;
2289 }
2290
2291 promise._result = value;
2292 promise._state = FULFILLED;
2293
2294 if (promise._subscribers.length !== 0) {
2295 asap(publish, promise);
2296 }
2297 }
2298
2299 function _reject(promise, reason) {
2300 if (promise._state !== PENDING) {
2301 return;
2302 }
2303
2304 promise._state = REJECTED;
2305 promise._result = reason;
2306 asap(publishRejection, promise);
2307 }
2308
2309 function subscribe(parent, child, onFulfillment, onRejection) {
2310 var _subscribers = parent._subscribers;
2311 var length = _subscribers.length;
2312 parent._onerror = null;
2313 _subscribers[length] = child;
2314 _subscribers[length + FULFILLED] = onFulfillment;
2315 _subscribers[length + REJECTED] = onRejection;
2316
2317 if (length === 0 && parent._state) {
2318 asap(publish, parent);
2319 }
2320 }
2321
2322 function publish(promise) {
2323 var subscribers = promise._subscribers;
2324 var settled = promise._state;
2325
2326 if (subscribers.length === 0) {
2327 return;
2328 }
2329
2330 var child = undefined,
2331 callback = undefined,
2332 detail = promise._result;
2333
2334 for (var i = 0; i < subscribers.length; i += 3) {
2335 child = subscribers[i];
2336 callback = subscribers[i + settled];
2337
2338 if (child) {
2339 invokeCallback(settled, child, callback, detail);
2340 } else {
2341 callback(detail);
2342 }
2343 }
2344
2345 promise._subscribers.length = 0;
2346 }
2347
2348 function ErrorObject() {
2349 this.error = null;
2350 }
2351
2352 var TRY_CATCH_ERROR = new ErrorObject();
2353
2354 function tryCatch(callback, detail) {
2355 try {
2356 return callback(detail);
2357 } catch (e) {
2358 TRY_CATCH_ERROR.error = e;
2359 return TRY_CATCH_ERROR;
2360 }
2361 }
2362
2363 function invokeCallback(settled, promise, callback, detail) {
2364 var hasCallback = isFunction(callback),
2365 value = undefined,
2366 error = undefined,
2367 succeeded = undefined,
2368 failed = undefined;
2369
2370 if (hasCallback) {
2371 value = tryCatch(callback, detail);
2372
2373 if (value === TRY_CATCH_ERROR) {
2374 failed = true;
2375 error = value.error;
2376 value = null;
2377 } else {
2378 succeeded = true;
2379 }
2380
2381 if (promise === value) {
2382 _reject(promise, cannotReturnOwn());
2383
2384 return;
2385 }
2386 } else {
2387 value = detail;
2388 succeeded = true;
2389 }
2390
2391 if (promise._state !== PENDING) {// noop
2392 } else if (hasCallback && succeeded) {
2393 _resolve(promise, value);
2394 } else if (failed) {
2395 _reject(promise, error);
2396 } else if (settled === FULFILLED) {
2397 fulfill(promise, value);
2398 } else if (settled === REJECTED) {
2399 _reject(promise, value);
2400 }
2401 }
2402
2403 function initializePromise(promise, resolver) {
2404 try {
2405 resolver(function resolvePromise(value) {
2406 _resolve(promise, value);
2407 }, function rejectPromise(reason) {
2408 _reject(promise, reason);
2409 });
2410 } catch (e) {
2411 _reject(promise, e);
2412 }
2413 }
2414
2415 var id = 0;
2416
2417 function nextId() {
2418 return id++;
2419 }
2420
2421 function makePromise(promise) {
2422 promise[PROMISE_ID] = id++;
2423 promise._state = undefined;
2424 promise._result = undefined;
2425 promise._subscribers = [];
2426 }
2427
2428 function Enumerator(Constructor, input) {
2429 this._instanceConstructor = Constructor;
2430 this.promise = new Constructor(noop);
2431
2432 if (!this.promise[PROMISE_ID]) {
2433 makePromise(this.promise);
2434 }
2435
2436 if (isArray(input)) {
2437 this._input = input;
2438 this.length = input.length;
2439 this._remaining = input.length;
2440 this._result = new Array(this.length);
2441
2442 if (this.length === 0) {
2443 fulfill(this.promise, this._result);
2444 } else {
2445 this.length = this.length || 0;
2446
2447 this._enumerate();
2448
2449 if (this._remaining === 0) {
2450 fulfill(this.promise, this._result);
2451 }
2452 }
2453 } else {
2454 _reject(this.promise, validationError());
2455 }
2456 }
2457
2458 function validationError() {
2459 return new Error('Array Methods must be provided an Array');
2460 }
2461
2462 ;
2463
2464 Enumerator.prototype._enumerate = function () {
2465 var length = this.length;
2466 var _input = this._input;
2467
2468 for (var i = 0; this._state === PENDING && i < length; i++) {
2469 this._eachEntry(_input[i], i);
2470 }
2471 };
2472
2473 Enumerator.prototype._eachEntry = function (entry, i) {
2474 var c = this._instanceConstructor;
2475 var resolve$$ = c.resolve;
2476
2477 if (resolve$$ === resolve) {
2478 var _then = getThen(entry);
2479
2480 if (_then === then && entry._state !== PENDING) {
2481 this._settledAt(entry._state, i, entry._result);
2482 } else if (typeof _then !== 'function') {
2483 this._remaining--;
2484 this._result[i] = entry;
2485 } else if (c === Promise) {
2486 var promise = new c(noop);
2487 handleMaybeThenable(promise, entry, _then);
2488
2489 this._willSettleAt(promise, i);
2490 } else {
2491 this._willSettleAt(new c(function (resolve$$) {
2492 return resolve$$(entry);
2493 }), i);
2494 }
2495 } else {
2496 this._willSettleAt(resolve$$(entry), i);
2497 }
2498 };
2499
2500 Enumerator.prototype._settledAt = function (state, i, value) {
2501 var promise = this.promise;
2502
2503 if (promise._state === PENDING) {
2504 this._remaining--;
2505
2506 if (state === REJECTED) {
2507 _reject(promise, value);
2508 } else {
2509 this._result[i] = value;
2510 }
2511 }
2512
2513 if (this._remaining === 0) {
2514 fulfill(promise, this._result);
2515 }
2516 };
2517
2518 Enumerator.prototype._willSettleAt = function (promise, i) {
2519 var enumerator = this;
2520 subscribe(promise, undefined, function (value) {
2521 return enumerator._settledAt(FULFILLED, i, value);
2522 }, function (reason) {
2523 return enumerator._settledAt(REJECTED, i, reason);
2524 });
2525 };
2526 /**
2527 `Promise.all` accepts an array of promises, and returns a new promise which
2528 is fulfilled with an array of fulfillment values for the passed promises, or
2529 rejected with the reason of the first passed promise to be rejected. It casts all
2530 elements of the passed iterable to promises as it runs this algorithm.
2531
2532 Example:
2533
2534 ```javascript
2535 let promise1 = resolve(1);
2536 let promise2 = resolve(2);
2537 let promise3 = resolve(3);
2538 let promises = [ promise1, promise2, promise3 ];
2539
2540 Promise.all(promises).then(function(array){
2541 // The array here would be [ 1, 2, 3 ];
2542 });
2543 ```
2544
2545 If any of the `promises` given to `all` are rejected, the first promise
2546 that is rejected will be given as an argument to the returned promises's
2547 rejection handler. For example:
2548
2549 Example:
2550
2551 ```javascript
2552 let promise1 = resolve(1);
2553 let promise2 = reject(new Error("2"));
2554 let promise3 = reject(new Error("3"));
2555 let promises = [ promise1, promise2, promise3 ];
2556
2557 Promise.all(promises).then(function(array){
2558 // Code here never runs because there are rejected promises!
2559 }, function(error) {
2560 // error.message === "2"
2561 });
2562 ```
2563
2564 @method all
2565 @static
2566 @param {Array} entries array of promises
2567 @param {String} label optional string for labeling the promise.
2568 Useful for tooling.
2569 @return {Promise} promise that is fulfilled when all `promises` have been
2570 fulfilled, or rejected if any of them become rejected.
2571 @static
2572 */
2573
2574
2575 function all(entries) {
2576 return new Enumerator(this, entries).promise;
2577 }
2578 /**
2579 `Promise.race` returns a new promise which is settled in the same way as the
2580 first passed promise to settle.
2581
2582 Example:
2583
2584 ```javascript
2585 let promise1 = new Promise(function(resolve, reject){
2586 setTimeout(function(){
2587 resolve('promise 1');
2588 }, 200);
2589 });
2590
2591 let promise2 = new Promise(function(resolve, reject){
2592 setTimeout(function(){
2593 resolve('promise 2');
2594 }, 100);
2595 });
2596
2597 Promise.race([promise1, promise2]).then(function(result){
2598 // result === 'promise 2' because it was resolved before promise1
2599 // was resolved.
2600 });
2601 ```
2602
2603 `Promise.race` is deterministic in that only the state of the first
2604 settled promise matters. For example, even if other promises given to the
2605 `promises` array argument are resolved, but the first settled promise has
2606 become rejected before the other promises became fulfilled, the returned
2607 promise will become rejected:
2608
2609 ```javascript
2610 let promise1 = new Promise(function(resolve, reject){
2611 setTimeout(function(){
2612 resolve('promise 1');
2613 }, 200);
2614 });
2615
2616 let promise2 = new Promise(function(resolve, reject){
2617 setTimeout(function(){
2618 reject(new Error('promise 2'));
2619 }, 100);
2620 });
2621
2622 Promise.race([promise1, promise2]).then(function(result){
2623 // Code here never runs
2624 }, function(reason){
2625 // reason.message === 'promise 2' because promise 2 became rejected before
2626 // promise 1 became fulfilled
2627 });
2628 ```
2629
2630 An example real-world use case is implementing timeouts:
2631
2632 ```javascript
2633 Promise.race([ajax('foo.json'), timeout(5000)])
2634 ```
2635
2636 @method race
2637 @static
2638 @param {Array} promises array of promises to observe
2639 Useful for tooling.
2640 @return {Promise} a promise which settles in the same way as the first passed
2641 promise to settle.
2642 */
2643
2644
2645 function race(entries) {
2646 /*jshint validthis:true */
2647 var Constructor = this;
2648
2649 if (!isArray(entries)) {
2650 return new Constructor(function (_, reject) {
2651 return reject(new TypeError('You must pass an array to race.'));
2652 });
2653 } else {
2654 return new Constructor(function (resolve, reject) {
2655 var length = entries.length;
2656
2657 for (var i = 0; i < length; i++) {
2658 Constructor.resolve(entries[i]).then(resolve, reject);
2659 }
2660 });
2661 }
2662 }
2663 /**
2664 `Promise.reject` returns a promise rejected with the passed `reason`.
2665 It is shorthand for the following:
2666
2667 ```javascript
2668 let promise = new Promise(function(resolve, reject){
2669 reject(new Error('WHOOPS'));
2670 });
2671
2672 promise.then(function(value){
2673 // Code here doesn't run because the promise is rejected!
2674 }, function(reason){
2675 // reason.message === 'WHOOPS'
2676 });
2677 ```
2678
2679 Instead of writing the above, your code now simply becomes the following:
2680
2681 ```javascript
2682 let promise = Promise.reject(new Error('WHOOPS'));
2683
2684 promise.then(function(value){
2685 // Code here doesn't run because the promise is rejected!
2686 }, function(reason){
2687 // reason.message === 'WHOOPS'
2688 });
2689 ```
2690
2691 @method reject
2692 @static
2693 @param {Any} reason value that the returned promise will be rejected with.
2694 Useful for tooling.
2695 @return {Promise} a promise rejected with the given `reason`.
2696 */
2697
2698
2699 function reject(reason) {
2700 /*jshint validthis:true */
2701 var Constructor = this;
2702 var promise = new Constructor(noop);
2703
2704 _reject(promise, reason);
2705
2706 return promise;
2707 }
2708
2709 function needsResolver() {
2710 throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
2711 }
2712
2713 function needsNew() {
2714 throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
2715 }
2716 /**
2717 Promise objects represent the eventual result of an asynchronous operation. The
2718 primary way of interacting with a promise is through its `then` method, which
2719 registers callbacks to receive either a promise's eventual value or the reason
2720 why the promise cannot be fulfilled.
2721
2722 Terminology
2723 -----------
2724
2725 - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
2726 - `thenable` is an object or function that defines a `then` method.
2727 - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
2728 - `exception` is a value that is thrown using the throw statement.
2729 - `reason` is a value that indicates why a promise was rejected.
2730 - `settled` the final resting state of a promise, fulfilled or rejected.
2731
2732 A promise can be in one of three states: pending, fulfilled, or rejected.
2733
2734 Promises that are fulfilled have a fulfillment value and are in the fulfilled
2735 state. Promises that are rejected have a rejection reason and are in the
2736 rejected state. A fulfillment value is never a thenable.
2737
2738 Promises can also be said to *resolve* a value. If this value is also a
2739 promise, then the original promise's settled state will match the value's
2740 settled state. So a promise that *resolves* a promise that rejects will
2741 itself reject, and a promise that *resolves* a promise that fulfills will
2742 itself fulfill.
2743
2744
2745 Basic Usage:
2746 ------------
2747
2748 ```js
2749 let promise = new Promise(function(resolve, reject) {
2750 // on success
2751 resolve(value);
2752
2753 // on failure
2754 reject(reason);
2755 });
2756
2757 promise.then(function(value) {
2758 // on fulfillment
2759 }, function(reason) {
2760 // on rejection
2761 });
2762 ```
2763
2764 Advanced Usage:
2765 ---------------
2766
2767 Promises shine when abstracting away asynchronous interactions such as
2768 `XMLHttpRequest`s.
2769
2770 ```js
2771 function getJSON(url) {
2772 return new Promise(function(resolve, reject){
2773 let xhr = new XMLHttpRequest();
2774
2775 xhr.open('GET', url);
2776 xhr.onreadystatechange = handler;
2777 xhr.responseType = 'json';
2778 xhr.setRequestHeader('Accept', 'application/json');
2779 xhr.send();
2780
2781 function handler() {
2782 if (this.readyState === this.DONE) {
2783 if (this.status === 200) {
2784 resolve(this.response);
2785 } else {
2786 reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
2787 }
2788 }
2789 };
2790 });
2791 }
2792
2793 getJSON('/posts.json').then(function(json) {
2794 // on fulfillment
2795 }, function(reason) {
2796 // on rejection
2797 });
2798 ```
2799
2800 Unlike callbacks, promises are great composable primitives.
2801
2802 ```js
2803 Promise.all([
2804 getJSON('/posts'),
2805 getJSON('/comments')
2806 ]).then(function(values){
2807 values[0] // => postsJSON
2808 values[1] // => commentsJSON
2809
2810 return values;
2811 });
2812 ```
2813
2814 @class Promise
2815 @param {function} resolver
2816 Useful for tooling.
2817 @constructor
2818 */
2819
2820
2821 function Promise(resolver) {
2822 this[PROMISE_ID] = nextId();
2823 this._result = this._state = undefined;
2824 this._subscribers = [];
2825
2826 if (noop !== resolver) {
2827 typeof resolver !== 'function' && needsResolver();
2828 this instanceof Promise ? initializePromise(this, resolver) : needsNew();
2829 }
2830 }
2831
2832 Promise.all = all;
2833 Promise.race = race;
2834 Promise.resolve = resolve;
2835 Promise.reject = reject;
2836 Promise._setScheduler = setScheduler;
2837 Promise._setAsap = setAsap;
2838 Promise._asap = asap;
2839 Promise.prototype = {
2840 constructor: Promise,
2841
2842 /**
2843 The primary way of interacting with a promise is through its `then` method,
2844 which registers callbacks to receive either a promise's eventual value or the
2845 reason why the promise cannot be fulfilled.
2846
2847 ```js
2848 findUser().then(function(user){
2849 // user is available
2850 }, function(reason){
2851 // user is unavailable, and you are given the reason why
2852 });
2853 ```
2854
2855 Chaining
2856 --------
2857
2858 The return value of `then` is itself a promise. This second, 'downstream'
2859 promise is resolved with the return value of the first promise's fulfillment
2860 or rejection handler, or rejected if the handler throws an exception.
2861
2862 ```js
2863 findUser().then(function (user) {
2864 return user.name;
2865 }, function (reason) {
2866 return 'default name';
2867 }).then(function (userName) {
2868 // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
2869 // will be `'default name'`
2870 });
2871
2872 findUser().then(function (user) {
2873 throw new Error('Found user, but still unhappy');
2874 }, function (reason) {
2875 throw new Error('`findUser` rejected and we're unhappy');
2876 }).then(function (value) {
2877 // never reached
2878 }, function (reason) {
2879 // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
2880 // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
2881 });
2882 ```
2883 If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
2884
2885 ```js
2886 findUser().then(function (user) {
2887 throw new PedagogicalException('Upstream error');
2888 }).then(function (value) {
2889 // never reached
2890 }).then(function (value) {
2891 // never reached
2892 }, function (reason) {
2893 // The `PedgagocialException` is propagated all the way down to here
2894 });
2895 ```
2896
2897 Assimilation
2898 ------------
2899
2900 Sometimes the value you want to propagate to a downstream promise can only be
2901 retrieved asynchronously. This can be achieved by returning a promise in the
2902 fulfillment or rejection handler. The downstream promise will then be pending
2903 until the returned promise is settled. This is called *assimilation*.
2904
2905 ```js
2906 findUser().then(function (user) {
2907 return findCommentsByAuthor(user);
2908 }).then(function (comments) {
2909 // The user's comments are now available
2910 });
2911 ```
2912
2913 If the assimliated promise rejects, then the downstream promise will also reject.
2914
2915 ```js
2916 findUser().then(function (user) {
2917 return findCommentsByAuthor(user);
2918 }).then(function (comments) {
2919 // If `findCommentsByAuthor` fulfills, we'll have the value here
2920 }, function (reason) {
2921 // If `findCommentsByAuthor` rejects, we'll have the reason here
2922 });
2923 ```
2924
2925 Simple Example
2926 --------------
2927
2928 Synchronous Example
2929
2930 ```javascript
2931 let result;
2932
2933 try {
2934 result = findResult();
2935 // success
2936 } catch(reason) {
2937 // failure
2938 }
2939 ```
2940
2941 Errback Example
2942
2943 ```js
2944 findResult(function(result, err){
2945 if (err) {
2946 // failure
2947 } else {
2948 // success
2949 }
2950 });
2951 ```
2952
2953 Promise Example;
2954
2955 ```javascript
2956 findResult().then(function(result){
2957 // success
2958 }, function(reason){
2959 // failure
2960 });
2961 ```
2962
2963 Advanced Example
2964 --------------
2965
2966 Synchronous Example
2967
2968 ```javascript
2969 let author, books;
2970
2971 try {
2972 author = findAuthor();
2973 books = findBooksByAuthor(author);
2974 // success
2975 } catch(reason) {
2976 // failure
2977 }
2978 ```
2979
2980 Errback Example
2981
2982 ```js
2983
2984 function foundBooks(books) {
2985
2986 }
2987
2988 function failure(reason) {
2989
2990 }
2991
2992 findAuthor(function(author, err){
2993 if (err) {
2994 failure(err);
2995 // failure
2996 } else {
2997 try {
2998 findBoooksByAuthor(author, function(books, err) {
2999 if (err) {
3000 failure(err);
3001 } else {
3002 try {
3003 foundBooks(books);
3004 } catch(reason) {
3005 failure(reason);
3006 }
3007 }
3008 });
3009 } catch(error) {
3010 failure(err);
3011 }
3012 // success
3013 }
3014 });
3015 ```
3016
3017 Promise Example;
3018
3019 ```javascript
3020 findAuthor().
3021 then(findBooksByAuthor).
3022 then(function(books){
3023 // found books
3024 }).catch(function(reason){
3025 // something went wrong
3026 });
3027 ```
3028
3029 @method then
3030 @param {Function} onFulfilled
3031 @param {Function} onRejected
3032 Useful for tooling.
3033 @return {Promise}
3034 */
3035 then: then,
3036
3037 /**
3038 `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
3039 as the catch block of a try/catch statement.
3040
3041 ```js
3042 function findAuthor(){
3043 throw new Error('couldn't find that author');
3044 }
3045
3046 // synchronous
3047 try {
3048 findAuthor();
3049 } catch(reason) {
3050 // something went wrong
3051 }
3052
3053 // async with promises
3054 findAuthor().catch(function(reason){
3055 // something went wrong
3056 });
3057 ```
3058
3059 @method catch
3060 @param {Function} onRejection
3061 Useful for tooling.
3062 @return {Promise}
3063 */
3064 'catch': function _catch(onRejection) {
3065 return this.then(null, onRejection);
3066 }
3067 };
3068
3069 function polyfill() {
3070 var local = undefined;
3071
3072 if (typeof global !== 'undefined') {
3073 local = global;
3074 } else if (typeof self !== 'undefined') {
3075 local = self;
3076 } else {
3077 try {
3078 local = Function('return this')();
3079 } catch (e) {
3080 throw new Error('polyfill failed because global object is unavailable in this environment');
3081 }
3082 }
3083
3084 var P = local.Promise;
3085
3086 if (P) {
3087 var promiseToString = null;
3088
3089 try {
3090 promiseToString = Object.prototype.toString.call(P.resolve());
3091 } catch (e) {// silently ignored
3092 }
3093
3094 if (promiseToString === '[object Promise]' && !P.cast) {
3095 return;
3096 }
3097 }
3098
3099 local.Promise = Promise;
3100 }
3101
3102 polyfill(); // Strange compat..
3103
3104 Promise.polyfill = polyfill;
3105 Promise.Promise = Promise;
3106 return Promise;
3107 });
3108 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
3109
3110 /***/ }),
3111
3112 /***/ "./node_modules/process/browser.js":
3113 /*!*****************************************!*\
3114 !*** ./node_modules/process/browser.js ***!
3115 \*****************************************/
3116 /*! no static exports found */
3117 /***/ (function(module, exports) {
3118
3119 // shim for using process in browser
3120 var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
3121 // don't break things. But we need to wrap it in a try catch in case it is
3122 // wrapped in strict mode code which doesn't define any globals. It's inside a
3123 // function because try/catches deoptimize in certain engines.
3124
3125 var cachedSetTimeout;
3126 var cachedClearTimeout;
3127
3128 function defaultSetTimout() {
3129 throw new Error('setTimeout has not been defined');
3130 }
3131
3132 function defaultClearTimeout() {
3133 throw new Error('clearTimeout has not been defined');
3134 }
3135
3136 (function () {
3137 try {
3138 if (typeof setTimeout === 'function') {
3139 cachedSetTimeout = setTimeout;
3140 } else {
3141 cachedSetTimeout = defaultSetTimout;
3142 }
3143 } catch (e) {
3144 cachedSetTimeout = defaultSetTimout;
3145 }
3146
3147 try {
3148 if (typeof clearTimeout === 'function') {
3149 cachedClearTimeout = clearTimeout;
3150 } else {
3151 cachedClearTimeout = defaultClearTimeout;
3152 }
3153 } catch (e) {
3154 cachedClearTimeout = defaultClearTimeout;
3155 }
3156 })();
3157
3158 function runTimeout(fun) {
3159 if (cachedSetTimeout === setTimeout) {
3160 //normal enviroments in sane situations
3161 return setTimeout(fun, 0);
3162 } // if setTimeout wasn't available but was latter defined
3163
3164
3165 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
3166 cachedSetTimeout = setTimeout;
3167 return setTimeout(fun, 0);
3168 }
3169
3170 try {
3171 // when when somebody has screwed with setTimeout but no I.E. maddness
3172 return cachedSetTimeout(fun, 0);
3173 } catch (e) {
3174 try {
3175 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
3176 return cachedSetTimeout.call(null, fun, 0);
3177 } catch (e) {
3178 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
3179 return cachedSetTimeout.call(this, fun, 0);
3180 }
3181 }
3182 }
3183
3184 function runClearTimeout(marker) {
3185 if (cachedClearTimeout === clearTimeout) {
3186 //normal enviroments in sane situations
3187 return clearTimeout(marker);
3188 } // if clearTimeout wasn't available but was latter defined
3189
3190
3191 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
3192 cachedClearTimeout = clearTimeout;
3193 return clearTimeout(marker);
3194 }
3195
3196 try {
3197 // when when somebody has screwed with setTimeout but no I.E. maddness
3198 return cachedClearTimeout(marker);
3199 } catch (e) {
3200 try {
3201 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
3202 return cachedClearTimeout.call(null, marker);
3203 } catch (e) {
3204 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
3205 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
3206 return cachedClearTimeout.call(this, marker);
3207 }
3208 }
3209 }
3210
3211 var queue = [];
3212 var draining = false;
3213 var currentQueue;
3214 var queueIndex = -1;
3215
3216 function cleanUpNextTick() {
3217 if (!draining || !currentQueue) {
3218 return;
3219 }
3220
3221 draining = false;
3222
3223 if (currentQueue.length) {
3224 queue = currentQueue.concat(queue);
3225 } else {
3226 queueIndex = -1;
3227 }
3228
3229 if (queue.length) {
3230 drainQueue();
3231 }
3232 }
3233
3234 function drainQueue() {
3235 if (draining) {
3236 return;
3237 }
3238
3239 var timeout = runTimeout(cleanUpNextTick);
3240 draining = true;
3241 var len = queue.length;
3242
3243 while (len) {
3244 currentQueue = queue;
3245 queue = [];
3246
3247 while (++queueIndex < len) {
3248 if (currentQueue) {
3249 currentQueue[queueIndex].run();
3250 }
3251 }
3252
3253 queueIndex = -1;
3254 len = queue.length;
3255 }
3256
3257 currentQueue = null;
3258 draining = false;
3259 runClearTimeout(timeout);
3260 }
3261
3262 process.nextTick = function (fun) {
3263 var args = new Array(arguments.length - 1);
3264
3265 if (arguments.length > 1) {
3266 for (var i = 1; i < arguments.length; i++) {
3267 args[i - 1] = arguments[i];
3268 }
3269 }
3270
3271 queue.push(new Item(fun, args));
3272
3273 if (queue.length === 1 && !draining) {
3274 runTimeout(drainQueue);
3275 }
3276 }; // v8 likes predictible objects
3277
3278
3279 function Item(fun, array) {
3280 this.fun = fun;
3281 this.array = array;
3282 }
3283
3284 Item.prototype.run = function () {
3285 this.fun.apply(null, this.array);
3286 };
3287
3288 process.title = 'browser';
3289 process.browser = true;
3290 process.env = {};
3291 process.argv = [];
3292 process.version = ''; // empty string to avoid regexp issues
3293
3294 process.versions = {};
3295
3296 function noop() {}
3297
3298 process.on = noop;
3299 process.addListener = noop;
3300 process.once = noop;
3301 process.off = noop;
3302 process.removeListener = noop;
3303 process.removeAllListeners = noop;
3304 process.emit = noop;
3305 process.prependListener = noop;
3306 process.prependOnceListener = noop;
3307
3308 process.listeners = function (name) {
3309 return [];
3310 };
3311
3312 process.binding = function (name) {
3313 throw new Error('process.binding is not supported');
3314 };
3315
3316 process.cwd = function () {
3317 return '/';
3318 };
3319
3320 process.chdir = function (dir) {
3321 throw new Error('process.chdir is not supported');
3322 };
3323
3324 process.umask = function () {
3325 return 0;
3326 };
3327
3328 /***/ }),
3329
3330 /***/ "./node_modules/regenerator-runtime/runtime.js":
3331 /*!*****************************************************!*\
3332 !*** ./node_modules/regenerator-runtime/runtime.js ***!
3333 \*****************************************************/
3334 /*! no static exports found */
3335 /***/ (function(module, exports, __webpack_require__) {
3336
3337 /* WEBPACK VAR INJECTION */(function(module) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3338
3339 /**
3340 * Copyright (c) 2014-present, Facebook, Inc.
3341 *
3342 * This source code is licensed under the MIT license found in the
3343 * LICENSE file in the root directory of this source tree.
3344 */
3345 var runtime = function (exports) {
3346 "use strict";
3347
3348 var Op = Object.prototype;
3349 var hasOwn = Op.hasOwnProperty;
3350 var undefined; // More compressible than void 0.
3351
3352 var $Symbol = typeof Symbol === "function" ? Symbol : {};
3353 var iteratorSymbol = $Symbol.iterator || "@@iterator";
3354 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
3355 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
3356
3357 function wrap(innerFn, outerFn, self, tryLocsList) {
3358 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
3359 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
3360 var generator = Object.create(protoGenerator.prototype);
3361 var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
3362 // .throw, and .return methods.
3363
3364 generator._invoke = makeInvokeMethod(innerFn, self, context);
3365 return generator;
3366 }
3367
3368 exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
3369 // record like context.tryEntries[i].completion. This interface could
3370 // have been (and was previously) designed to take a closure to be
3371 // invoked without arguments, but in all the cases we care about we
3372 // already have an existing method we want to call, so there's no need
3373 // to create a new function object. We can even get away with assuming
3374 // the method takes exactly one argument, since that happens to be true
3375 // in every case, so we don't have to touch the arguments object. The
3376 // only additional allocation required is the completion record, which
3377 // has a stable shape and so hopefully should be cheap to allocate.
3378
3379 function tryCatch(fn, obj, arg) {
3380 try {
3381 return {
3382 type: "normal",
3383 arg: fn.call(obj, arg)
3384 };
3385 } catch (err) {
3386 return {
3387 type: "throw",
3388 arg: err
3389 };
3390 }
3391 }
3392
3393 var GenStateSuspendedStart = "suspendedStart";
3394 var GenStateSuspendedYield = "suspendedYield";
3395 var GenStateExecuting = "executing";
3396 var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
3397 // breaking out of the dispatch switch statement.
3398
3399 var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
3400 // .constructor.prototype properties for functions that return Generator
3401 // objects. For full spec compliance, you may wish to configure your
3402 // minifier not to mangle the names of these two functions.
3403
3404 function Generator() {}
3405
3406 function GeneratorFunction() {}
3407
3408 function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
3409 // don't natively support it.
3410
3411
3412 var IteratorPrototype = {};
3413
3414 IteratorPrototype[iteratorSymbol] = function () {
3415 return this;
3416 };
3417
3418 var getProto = Object.getPrototypeOf;
3419 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
3420
3421 if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
3422 // This environment has a native %IteratorPrototype%; use it instead
3423 // of the polyfill.
3424 IteratorPrototype = NativeIteratorPrototype;
3425 }
3426
3427 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
3428 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
3429 GeneratorFunctionPrototype.constructor = GeneratorFunction;
3430 GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
3431 // Iterator interface in terms of a single ._invoke method.
3432
3433 function defineIteratorMethods(prototype) {
3434 ["next", "throw", "return"].forEach(function (method) {
3435 prototype[method] = function (arg) {
3436 return this._invoke(method, arg);
3437 };
3438 });
3439 }
3440
3441 exports.isGeneratorFunction = function (genFun) {
3442 var ctor = typeof genFun === "function" && genFun.constructor;
3443 return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
3444 // do is to check its .name property.
3445 (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
3446 };
3447
3448 exports.mark = function (genFun) {
3449 if (Object.setPrototypeOf) {
3450 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
3451 } else {
3452 genFun.__proto__ = GeneratorFunctionPrototype;
3453
3454 if (!(toStringTagSymbol in genFun)) {
3455 genFun[toStringTagSymbol] = "GeneratorFunction";
3456 }
3457 }
3458
3459 genFun.prototype = Object.create(Gp);
3460 return genFun;
3461 }; // Within the body of any async function, `await x` is transformed to
3462 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
3463 // `hasOwn.call(value, "__await")` to determine if the yielded value is
3464 // meant to be awaited.
3465
3466
3467 exports.awrap = function (arg) {
3468 return {
3469 __await: arg
3470 };
3471 };
3472
3473 function AsyncIterator(generator, PromiseImpl) {
3474 function invoke(method, arg, resolve, reject) {
3475 var record = tryCatch(generator[method], generator, arg);
3476
3477 if (record.type === "throw") {
3478 reject(record.arg);
3479 } else {
3480 var result = record.arg;
3481 var value = result.value;
3482
3483 if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
3484 return PromiseImpl.resolve(value.__await).then(function (value) {
3485 invoke("next", value, resolve, reject);
3486 }, function (err) {
3487 invoke("throw", err, resolve, reject);
3488 });
3489 }
3490
3491 return PromiseImpl.resolve(value).then(function (unwrapped) {
3492 // When a yielded Promise is resolved, its final value becomes
3493 // the .value of the Promise<{value,done}> result for the
3494 // current iteration.
3495 result.value = unwrapped;
3496 resolve(result);
3497 }, function (error) {
3498 // If a rejected Promise was yielded, throw the rejection back
3499 // into the async generator function so it can be handled there.
3500 return invoke("throw", error, resolve, reject);
3501 });
3502 }
3503 }
3504
3505 var previousPromise;
3506
3507 function enqueue(method, arg) {
3508 function callInvokeWithMethodAndArg() {
3509 return new PromiseImpl(function (resolve, reject) {
3510 invoke(method, arg, resolve, reject);
3511 });
3512 }
3513
3514 return previousPromise = // If enqueue has been called before, then we want to wait until
3515 // all previous Promises have been resolved before calling invoke,
3516 // so that results are always delivered in the correct order. If
3517 // enqueue has not been called before, then it is important to
3518 // call invoke immediately, without waiting on a callback to fire,
3519 // so that the async generator function has the opportunity to do
3520 // any necessary setup in a predictable way. This predictability
3521 // is why the Promise constructor synchronously invokes its
3522 // executor callback, and why async functions synchronously
3523 // execute code before the first await. Since we implement simple
3524 // async functions in terms of async generators, it is especially
3525 // important to get this right, even though it requires care.
3526 previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
3527 // invocations of the iterator.
3528 callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
3529 } // Define the unified helper method that is used to implement .next,
3530 // .throw, and .return (see defineIteratorMethods).
3531
3532
3533 this._invoke = enqueue;
3534 }
3535
3536 defineIteratorMethods(AsyncIterator.prototype);
3537
3538 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
3539 return this;
3540 };
3541
3542 exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
3543 // AsyncIterator objects; they just return a Promise for the value of
3544 // the final result produced by the iterator.
3545
3546 exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
3547 if (PromiseImpl === void 0) PromiseImpl = Promise;
3548 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
3549 return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
3550 : iter.next().then(function (result) {
3551 return result.done ? result.value : iter.next();
3552 });
3553 };
3554
3555 function makeInvokeMethod(innerFn, self, context) {
3556 var state = GenStateSuspendedStart;
3557 return function invoke(method, arg) {
3558 if (state === GenStateExecuting) {
3559 throw new Error("Generator is already running");
3560 }
3561
3562 if (state === GenStateCompleted) {
3563 if (method === "throw") {
3564 throw arg;
3565 } // Be forgiving, per 25.3.3.3.3 of the spec:
3566 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
3567
3568
3569 return doneResult();
3570 }
3571
3572 context.method = method;
3573 context.arg = arg;
3574
3575 while (true) {
3576 var delegate = context.delegate;
3577
3578 if (delegate) {
3579 var delegateResult = maybeInvokeDelegate(delegate, context);
3580
3581 if (delegateResult) {
3582 if (delegateResult === ContinueSentinel) continue;
3583 return delegateResult;
3584 }
3585 }
3586
3587 if (context.method === "next") {
3588 // Setting context._sent for legacy support of Babel's
3589 // function.sent implementation.
3590 context.sent = context._sent = context.arg;
3591 } else if (context.method === "throw") {
3592 if (state === GenStateSuspendedStart) {
3593 state = GenStateCompleted;
3594 throw context.arg;
3595 }
3596
3597 context.dispatchException(context.arg);
3598 } else if (context.method === "return") {
3599 context.abrupt("return", context.arg);
3600 }
3601
3602 state = GenStateExecuting;
3603 var record = tryCatch(innerFn, self, context);
3604
3605 if (record.type === "normal") {
3606 // If an exception is thrown from innerFn, we leave state ===
3607 // GenStateExecuting and loop back for another invocation.
3608 state = context.done ? GenStateCompleted : GenStateSuspendedYield;
3609
3610 if (record.arg === ContinueSentinel) {
3611 continue;
3612 }
3613
3614 return {
3615 value: record.arg,
3616 done: context.done
3617 };
3618 } else if (record.type === "throw") {
3619 state = GenStateCompleted; // Dispatch the exception by looping back around to the
3620 // context.dispatchException(context.arg) call above.
3621
3622 context.method = "throw";
3623 context.arg = record.arg;
3624 }
3625 }
3626 };
3627 } // Call delegate.iterator[context.method](context.arg) and handle the
3628 // result, either by returning a { value, done } result from the
3629 // delegate iterator, or by modifying context.method and context.arg,
3630 // setting context.delegate to null, and returning the ContinueSentinel.
3631
3632
3633 function maybeInvokeDelegate(delegate, context) {
3634 var method = delegate.iterator[context.method];
3635
3636 if (method === undefined) {
3637 // A .throw or .return when the delegate iterator has no .throw
3638 // method always terminates the yield* loop.
3639 context.delegate = null;
3640
3641 if (context.method === "throw") {
3642 // Note: ["return"] must be used for ES3 parsing compatibility.
3643 if (delegate.iterator["return"]) {
3644 // If the delegate iterator has a return method, give it a
3645 // chance to clean up.
3646 context.method = "return";
3647 context.arg = undefined;
3648 maybeInvokeDelegate(delegate, context);
3649
3650 if (context.method === "throw") {
3651 // If maybeInvokeDelegate(context) changed context.method from
3652 // "return" to "throw", let that override the TypeError below.
3653 return ContinueSentinel;
3654 }
3655 }
3656
3657 context.method = "throw";
3658 context.arg = new TypeError("The iterator does not provide a 'throw' method");
3659 }
3660
3661 return ContinueSentinel;
3662 }
3663
3664 var record = tryCatch(method, delegate.iterator, context.arg);
3665
3666 if (record.type === "throw") {
3667 context.method = "throw";
3668 context.arg = record.arg;
3669 context.delegate = null;
3670 return ContinueSentinel;
3671 }
3672
3673 var info = record.arg;
3674
3675 if (!info) {
3676 context.method = "throw";
3677 context.arg = new TypeError("iterator result is not an object");
3678 context.delegate = null;
3679 return ContinueSentinel;
3680 }
3681
3682 if (info.done) {
3683 // Assign the result of the finished delegate to the temporary
3684 // variable specified by delegate.resultName (see delegateYield).
3685 context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
3686
3687 context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
3688 // exception, let the outer generator proceed normally. If
3689 // context.method was "next", forget context.arg since it has been
3690 // "consumed" by the delegate iterator. If context.method was
3691 // "return", allow the original .return call to continue in the
3692 // outer generator.
3693
3694 if (context.method !== "return") {
3695 context.method = "next";
3696 context.arg = undefined;
3697 }
3698 } else {
3699 // Re-yield the result returned by the delegate method.
3700 return info;
3701 } // The delegate iterator is finished, so forget it and continue with
3702 // the outer generator.
3703
3704
3705 context.delegate = null;
3706 return ContinueSentinel;
3707 } // Define Generator.prototype.{next,throw,return} in terms of the
3708 // unified ._invoke helper method.
3709
3710
3711 defineIteratorMethods(Gp);
3712 Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the
3713 // @@iterator function is called on it. Some browsers' implementations of the
3714 // iterator prototype chain incorrectly implement this, causing the Generator
3715 // object to not be returned from this call. This ensures that doesn't happen.
3716 // See https://github.com/facebook/regenerator/issues/274 for more details.
3717
3718 Gp[iteratorSymbol] = function () {
3719 return this;
3720 };
3721
3722 Gp.toString = function () {
3723 return "[object Generator]";
3724 };
3725
3726 function pushTryEntry(locs) {
3727 var entry = {
3728 tryLoc: locs[0]
3729 };
3730
3731 if (1 in locs) {
3732 entry.catchLoc = locs[1];
3733 }
3734
3735 if (2 in locs) {
3736 entry.finallyLoc = locs[2];
3737 entry.afterLoc = locs[3];
3738 }
3739
3740 this.tryEntries.push(entry);
3741 }
3742
3743 function resetTryEntry(entry) {
3744 var record = entry.completion || {};
3745 record.type = "normal";
3746 delete record.arg;
3747 entry.completion = record;
3748 }
3749
3750 function Context(tryLocsList) {
3751 // The root entry object (effectively a try statement without a catch
3752 // or a finally block) gives us a place to store values thrown from
3753 // locations where there is no enclosing try statement.
3754 this.tryEntries = [{
3755 tryLoc: "root"
3756 }];
3757 tryLocsList.forEach(pushTryEntry, this);
3758 this.reset(true);
3759 }
3760
3761 exports.keys = function (object) {
3762 var keys = [];
3763
3764 for (var key in object) {
3765 keys.push(key);
3766 }
3767
3768 keys.reverse(); // Rather than returning an object with a next method, we keep
3769 // things simple and return the next function itself.
3770
3771 return function next() {
3772 while (keys.length) {
3773 var key = keys.pop();
3774
3775 if (key in object) {
3776 next.value = key;
3777 next.done = false;
3778 return next;
3779 }
3780 } // To avoid creating an additional object, we just hang the .value
3781 // and .done properties off the next function object itself. This
3782 // also ensures that the minifier will not anonymize the function.
3783
3784
3785 next.done = true;
3786 return next;
3787 };
3788 };
3789
3790 function values(iterable) {
3791 if (iterable) {
3792 var iteratorMethod = iterable[iteratorSymbol];
3793
3794 if (iteratorMethod) {
3795 return iteratorMethod.call(iterable);
3796 }
3797
3798 if (typeof iterable.next === "function") {
3799 return iterable;
3800 }
3801
3802 if (!isNaN(iterable.length)) {
3803 var i = -1,
3804 next = function next() {
3805 while (++i < iterable.length) {
3806 if (hasOwn.call(iterable, i)) {
3807 next.value = iterable[i];
3808 next.done = false;
3809 return next;
3810 }
3811 }
3812
3813 next.value = undefined;
3814 next.done = true;
3815 return next;
3816 };
3817
3818 return next.next = next;
3819 }
3820 } // Return an iterator with no values.
3821
3822
3823 return {
3824 next: doneResult
3825 };
3826 }
3827
3828 exports.values = values;
3829
3830 function doneResult() {
3831 return {
3832 value: undefined,
3833 done: true
3834 };
3835 }
3836
3837 Context.prototype = {
3838 constructor: Context,
3839 reset: function reset(skipTempReset) {
3840 this.prev = 0;
3841 this.next = 0; // Resetting context._sent for legacy support of Babel's
3842 // function.sent implementation.
3843
3844 this.sent = this._sent = undefined;
3845 this.done = false;
3846 this.delegate = null;
3847 this.method = "next";
3848 this.arg = undefined;
3849 this.tryEntries.forEach(resetTryEntry);
3850
3851 if (!skipTempReset) {
3852 for (var name in this) {
3853 // Not sure about the optimal order of these conditions:
3854 if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
3855 this[name] = undefined;
3856 }
3857 }
3858 }
3859 },
3860 stop: function stop() {
3861 this.done = true;
3862 var rootEntry = this.tryEntries[0];
3863 var rootRecord = rootEntry.completion;
3864
3865 if (rootRecord.type === "throw") {
3866 throw rootRecord.arg;
3867 }
3868
3869 return this.rval;
3870 },
3871 dispatchException: function dispatchException(exception) {
3872 if (this.done) {
3873 throw exception;
3874 }
3875
3876 var context = this;
3877
3878 function handle(loc, caught) {
3879 record.type = "throw";
3880 record.arg = exception;
3881 context.next = loc;
3882
3883 if (caught) {
3884 // If the dispatched exception was caught by a catch block,
3885 // then let that catch block handle the exception normally.
3886 context.method = "next";
3887 context.arg = undefined;
3888 }
3889
3890 return !!caught;
3891 }
3892
3893 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3894 var entry = this.tryEntries[i];
3895 var record = entry.completion;
3896
3897 if (entry.tryLoc === "root") {
3898 // Exception thrown outside of any try block that could handle
3899 // it, so set the completion value of the entire function to
3900 // throw the exception.
3901 return handle("end");
3902 }
3903
3904 if (entry.tryLoc <= this.prev) {
3905 var hasCatch = hasOwn.call(entry, "catchLoc");
3906 var hasFinally = hasOwn.call(entry, "finallyLoc");
3907
3908 if (hasCatch && hasFinally) {
3909 if (this.prev < entry.catchLoc) {
3910 return handle(entry.catchLoc, true);
3911 } else if (this.prev < entry.finallyLoc) {
3912 return handle(entry.finallyLoc);
3913 }
3914 } else if (hasCatch) {
3915 if (this.prev < entry.catchLoc) {
3916 return handle(entry.catchLoc, true);
3917 }
3918 } else if (hasFinally) {
3919 if (this.prev < entry.finallyLoc) {
3920 return handle(entry.finallyLoc);
3921 }
3922 } else {
3923 throw new Error("try statement without catch or finally");
3924 }
3925 }
3926 }
3927 },
3928 abrupt: function abrupt(type, arg) {
3929 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3930 var entry = this.tryEntries[i];
3931
3932 if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
3933 var finallyEntry = entry;
3934 break;
3935 }
3936 }
3937
3938 if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
3939 // Ignore the finally entry if control is not jumping to a
3940 // location outside the try/catch block.
3941 finallyEntry = null;
3942 }
3943
3944 var record = finallyEntry ? finallyEntry.completion : {};
3945 record.type = type;
3946 record.arg = arg;
3947
3948 if (finallyEntry) {
3949 this.method = "next";
3950 this.next = finallyEntry.finallyLoc;
3951 return ContinueSentinel;
3952 }
3953
3954 return this.complete(record);
3955 },
3956 complete: function complete(record, afterLoc) {
3957 if (record.type === "throw") {
3958 throw record.arg;
3959 }
3960
3961 if (record.type === "break" || record.type === "continue") {
3962 this.next = record.arg;
3963 } else if (record.type === "return") {
3964 this.rval = this.arg = record.arg;
3965 this.method = "return";
3966 this.next = "end";
3967 } else if (record.type === "normal" && afterLoc) {
3968 this.next = afterLoc;
3969 }
3970
3971 return ContinueSentinel;
3972 },
3973 finish: function finish(finallyLoc) {
3974 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3975 var entry = this.tryEntries[i];
3976
3977 if (entry.finallyLoc === finallyLoc) {
3978 this.complete(entry.completion, entry.afterLoc);
3979 resetTryEntry(entry);
3980 return ContinueSentinel;
3981 }
3982 }
3983 },
3984 "catch": function _catch(tryLoc) {
3985 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3986 var entry = this.tryEntries[i];
3987
3988 if (entry.tryLoc === tryLoc) {
3989 var record = entry.completion;
3990
3991 if (record.type === "throw") {
3992 var thrown = record.arg;
3993 resetTryEntry(entry);
3994 }
3995
3996 return thrown;
3997 }
3998 } // The context.catch method must only be called with a location
3999 // argument that corresponds to a known catch block.
4000
4001
4002 throw new Error("illegal catch attempt");
4003 },
4004 delegateYield: function delegateYield(iterable, resultName, nextLoc) {
4005 this.delegate = {
4006 iterator: values(iterable),
4007 resultName: resultName,
4008 nextLoc: nextLoc
4009 };
4010
4011 if (this.method === "next") {
4012 // Deliberately forget the last sent value so that we don't
4013 // accidentally pass it on to the delegate.
4014 this.arg = undefined;
4015 }
4016
4017 return ContinueSentinel;
4018 }
4019 }; // Regardless of whether this script is executing as a CommonJS module
4020 // or not, return the runtime object so that we can declare the variable
4021 // regeneratorRuntime in the outer scope, which allows this module to be
4022 // injected easily by `bin/regenerator --include-runtime script.js`.
4023
4024 return exports;
4025 }( // If this script is executing as a CommonJS module, use module.exports
4026 // as the regeneratorRuntime namespace. Otherwise create a new empty
4027 // object. Either way, the resulting object will be used to initialize
4028 // the regeneratorRuntime variable at the top of this file.
4029 ( false ? undefined : _typeof(module)) === "object" ? module.exports : {});
4030
4031 try {
4032 regeneratorRuntime = runtime;
4033 } catch (accidentalStrictMode) {
4034 // This module should not be running in strict mode, so the above
4035 // assignment should always work unless something is misconfigured. Just
4036 // in case runtime.js accidentally runs in strict mode, we can escape
4037 // strict mode using a global Function call. This could conceivably fail
4038 // if a Content Security Policy forbids using Function, but in that case
4039 // the proper solution is to fix the accidental strict mode problem. If
4040 // you've misconfigured your bundler to force strict mode and applied a
4041 // CSP to forbid Function, and you're not willing to fix either of those
4042 // problems, please detail your unique predicament in a GitHub issue.
4043 Function("r", "regeneratorRuntime = r")(runtime);
4044 }
4045 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
4046
4047 /***/ }),
4048
4049 /***/ "./node_modules/webpack/buildin/global.js":
4050 /*!***********************************!*\
4051 !*** (webpack)/buildin/global.js ***!
4052 \***********************************/
4053 /*! no static exports found */
4054 /***/ (function(module, exports) {
4055
4056 function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4057
4058 var g; // This works in non-strict mode
4059
4060 g = function () {
4061 return this;
4062 }();
4063
4064 try {
4065 // This works if eval is allowed (see CSP)
4066 g = g || new Function("return this")();
4067 } catch (e) {
4068 // This works if the window reference is available
4069 if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
4070 } // g can still be undefined, but nothing to do about it...
4071 // We return undefined, instead of nothing here, so it's
4072 // easier to handle this case. if(!global) { ...}
4073
4074
4075 module.exports = g;
4076
4077 /***/ }),
4078
4079 /***/ "./node_modules/webpack/buildin/module.js":
4080 /*!***********************************!*\
4081 !*** (webpack)/buildin/module.js ***!
4082 \***********************************/
4083 /*! no static exports found */
4084 /***/ (function(module, exports) {
4085
4086 module.exports = function (module) {
4087 if (!module.webpackPolyfill) {
4088 module.deprecate = function () {};
4089
4090 module.paths = []; // module.parent = undefined by default
4091
4092 if (!module.children) module.children = [];
4093 Object.defineProperty(module, "loaded", {
4094 enumerable: true,
4095 get: function get() {
4096 return module.l;
4097 }
4098 });
4099 Object.defineProperty(module, "id", {
4100 enumerable: true,
4101 get: function get() {
4102 return module.i;
4103 }
4104 });
4105 module.webpackPolyfill = 1;
4106 }
4107
4108 return module;
4109 };
4110
4111 /***/ }),
4112
4113 /***/ 0:
4114 /*!**********************************************************************!*\
4115 !*** multi es6-promise-promise ./js/polyfill.js ./js/scripts_es6.js ***!
4116 \**********************************************************************/
4117 /*! no static exports found */
4118 /***/ (function(module, exports, __webpack_require__) {
4119
4120 __webpack_require__(/*! es6-promise-promise */"./node_modules/es6-promise-promise/index.js");
4121 __webpack_require__(/*! ./js/polyfill.js */"./js/polyfill.js");
4122 module.exports = __webpack_require__(/*! ./js/scripts_es6.js */"./js/scripts_es6.js");
4123
4124
4125 /***/ }),
4126
4127 /***/ 1:
4128 /*!***********************!*\
4129 !*** vertx (ignored) ***!
4130 \***********************/
4131 /*! no static exports found */
4132 /***/ (function(module, exports) {
4133
4134 /* (ignored) */
4135
4136 /***/ })
4137
4138 /******/ });
4139 //# sourceMappingURL=scripts.js.map