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