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