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