scripts.js
6 years ago
scripts.js.map
6 years ago
scripts_admin.js
6 years ago
scripts_es6.js
6 years ago
scripts.js
1836 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 = "./js/scripts_es6.js"); |
| 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 | } |
| 170 | |
| 171 | var Wpcf7cfForm = function Wpcf7cfForm($form) { |
| 172 | var options_element = $form.find('input[name="_wpcf7cf_options"]').eq(0); |
| 173 | |
| 174 | if (!options_element.length || !options_element.val()) { |
| 175 | // doesn't look like a CF7 form created with conditional fields plugin enabled. |
| 176 | return false; |
| 177 | } |
| 178 | |
| 179 | var form = this; |
| 180 | var form_options = JSON.parse(options_element.val()); |
| 181 | form.$form = $form; |
| 182 | form.$input_hidden_group_fields = $form.find('[name="_wpcf7cf_hidden_group_fields"]'); |
| 183 | form.$input_hidden_groups = $form.find('[name="_wpcf7cf_hidden_groups"]'); |
| 184 | form.$input_visible_groups = $form.find('[name="_wpcf7cf_visible_groups"]'); |
| 185 | form.$input_repeaters = $form.find('[name="_wpcf7cf_repeaters"]'); |
| 186 | form.$input_steps = $form.find('[name="_wpcf7cf_steps"]'); |
| 187 | form.unit_tag = $form.closest('.wpcf7').attr('id'); |
| 188 | form.conditions = form_options['conditions']; // Wrapper around jQuery(selector, form.$form) |
| 189 | |
| 190 | form.get = function (selector) { |
| 191 | // TODO: implement some caching here. |
| 192 | return jQuery(selector, form.$form); |
| 193 | }; // compatibility with conditional forms created with older versions of the plugin ( < 1.4 ) |
| 194 | |
| 195 | |
| 196 | for (var i = 0; i < form.conditions.length; i++) { |
| 197 | var condition = form.conditions[i]; |
| 198 | |
| 199 | if (!('and_rules' in condition)) { |
| 200 | condition.and_rules = [{ |
| 201 | 'if_field': condition.if_field, |
| 202 | 'if_value': condition.if_value, |
| 203 | 'operator': condition.operator |
| 204 | }]; |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | form.initial_conditions = form.conditions; |
| 209 | form.settings = form_options['settings']; |
| 210 | form.$groups = jQuery(); // empty jQuery set |
| 211 | |
| 212 | form.repeaters = []; |
| 213 | form.multistep = null; |
| 214 | form.fields = []; |
| 215 | form.settings.animation_intime = parseInt(form.settings.animation_intime); |
| 216 | form.settings.animation_outtime = parseInt(form.settings.animation_outtime); |
| 217 | |
| 218 | if (form.settings.animation === 'no') { |
| 219 | form.settings.animation_intime = 0; |
| 220 | form.settings.animation_outtime = 0; |
| 221 | } |
| 222 | |
| 223 | form.updateGroups(); |
| 224 | form.updateEventListeners(); |
| 225 | form.displayFields(); // bring form in initial state if the reset event is fired on it. |
| 226 | |
| 227 | form.$form.on('reset.wpcf7cf', form, function (e) { |
| 228 | var form = e.data; |
| 229 | setTimeout(function () { |
| 230 | form.displayFields(); |
| 231 | form.resetRepeaters(); |
| 232 | |
| 233 | if (form.multistep != null) { |
| 234 | form.multistep.moveToStep(1); |
| 235 | } |
| 236 | }, 200); |
| 237 | }); // PRO ONLY |
| 238 | |
| 239 | form.get('.wpcf7cf_repeater:not(.wpcf7cf_repeater .wpcf7cf_repeater)').each(function () { |
| 240 | form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form)); |
| 241 | }); |
| 242 | form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) { |
| 243 | return item.params.$repeater.id; |
| 244 | }))); |
| 245 | var $multistep = form.get('.wpcf7cf_multistep'); |
| 246 | |
| 247 | if ($multistep.length) { |
| 248 | form.multistep = new Wpcf7cfMultistep($multistep, form); // window.wpcf7cf.updateMultistepState(form.multistep); |
| 249 | } // END PRO ONLY |
| 250 | |
| 251 | }; |
| 252 | /** |
| 253 | * reset initial number of subs for each repeater. |
| 254 | * (does not clear values) |
| 255 | */ |
| 256 | |
| 257 | |
| 258 | Wpcf7cfForm.prototype.resetRepeaters = function () { |
| 259 | var form = this; |
| 260 | form.repeaters.forEach(function (repeater) { |
| 261 | repeater.updateSubs(repeater.params.$repeater.initial_subs); |
| 262 | }); |
| 263 | }; |
| 264 | |
| 265 | Wpcf7cfForm.prototype.displayFields = function () { |
| 266 | var form = this; |
| 267 | var wpcf7cf_conditions = this.conditions; |
| 268 | var wpcf7cf_settings = this.settings; //for compatibility with contact-form-7-signature-addon |
| 269 | |
| 270 | if (cf7signature_resized === 0 && typeof signatures !== 'undefined' && signatures.constructor === Array && signatures.length > 0) { |
| 271 | for (var i = 0; i < signatures.length; i++) { |
| 272 | if (signatures[i].canvas.width === 0) { |
| 273 | var $sig_canvas = jQuery(".wpcf7-form-control-signature-body>canvas"); |
| 274 | var $sig_wrap = jQuery(".wpcf7-form-control-signature-wrap"); |
| 275 | $sig_canvas.eq(i).attr('width', $sig_wrap.width()); |
| 276 | $sig_canvas.eq(i).attr('height', $sig_wrap.height()); |
| 277 | cf7signature_resized = 1; |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | form.$groups.addClass('wpcf7cf-hidden'); |
| 283 | wpcf7cf_reload_dom(form.$form); |
| 284 | |
| 285 | for (var i = 0; i < wpcf7cf_conditions.length; i++) { |
| 286 | var condition = wpcf7cf_conditions[i]; |
| 287 | var show_group = window.wpcf7cf.should_group_be_shown(condition, form); |
| 288 | |
| 289 | if (show_group) { |
| 290 | form.get('[data-id="' + condition.then_field + '"]').removeClass('wpcf7cf-hidden'); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | var animation_intime = wpcf7cf_settings.animation_intime; |
| 295 | var animation_outtime = wpcf7cf_settings.animation_outtime; |
| 296 | form.$groups.each(function (index) { |
| 297 | var $group = jQuery(this); |
| 298 | if ($group.is(':animated')) $group.finish(); // stop any current animations on the group |
| 299 | |
| 300 | if ($group.css('display') === 'none' && !$group.hasClass('wpcf7cf-hidden')) { |
| 301 | if ($group.prop('tagName') === 'SPAN') { |
| 302 | $group.show().trigger('wpcf7cf_show_group'); |
| 303 | } else { |
| 304 | $group.animate(wpcf7cf_show_animation, animation_intime).trigger('wpcf7cf_show_group'); // show |
| 305 | } |
| 306 | } else if ($group.css('display') !== 'none' && $group.hasClass('wpcf7cf-hidden')) { |
| 307 | if ($group.attr('data-clear_on_hide') !== undefined) { |
| 308 | var $inputs = jQuery(':input', $group).not(':button, :submit, :reset, :hidden'); |
| 309 | $inputs.each(function () { |
| 310 | var $this = jQuery(this); |
| 311 | $this.val(this.defaultValue); |
| 312 | $this.prop('checked', this.defaultChecked); |
| 313 | }); |
| 314 | jQuery('option', $group).each(function () { |
| 315 | this.selected = this.defaultSelected; |
| 316 | }); |
| 317 | jQuery('select', $group).each(function () { |
| 318 | var $select = jQuery(this); |
| 319 | |
| 320 | if ($select.val() === null) { |
| 321 | $select.val(jQuery("option:first", $select).val()); |
| 322 | } |
| 323 | }); |
| 324 | $inputs.change(); //display_fields(); |
| 325 | } |
| 326 | |
| 327 | if ($group.prop('tagName') === 'SPAN') { |
| 328 | $group.hide().trigger('wpcf7cf_hide_group'); |
| 329 | } else { |
| 330 | $group.animate(wpcf7cf_hide_animation, animation_outtime).trigger('wpcf7cf_hide_group'); // hide |
| 331 | } |
| 332 | } |
| 333 | }); |
| 334 | form.updateHiddenFields(); |
| 335 | form.updateSummaryFields(); |
| 336 | }; |
| 337 | |
| 338 | Wpcf7cfForm.prototype.updateSummaryFields = function () { |
| 339 | var form = this; |
| 340 | var $summary = form.get('.wpcf7cf-summary'); |
| 341 | if ($summary.length == 0 || !$summary.is(':visible')) return; |
| 342 | var fd = new FormData(); |
| 343 | var formdata = form.$form.serializeArray(); |
| 344 | jQuery.each(formdata, function (key, input) { |
| 345 | fd.append(input.name, input.value); |
| 346 | }); // Make sure to add file fields to FormData |
| 347 | |
| 348 | jQuery.each(form.$form.find('input[type="file"]'), function (index, el) { |
| 349 | if (!el.files.length) return false; |
| 350 | var file = el.files[0]; |
| 351 | var fieldName = el.name; |
| 352 | fd.append(fieldName, new Blob(), file.name); |
| 353 | }); // add file fields to form-data |
| 354 | |
| 355 | jQuery.ajax({ |
| 356 | url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_get_summary', |
| 357 | type: 'POST', |
| 358 | data: fd, |
| 359 | processData: false, |
| 360 | contentType: false, |
| 361 | dataType: 'json', |
| 362 | success: function success(json) { |
| 363 | $summary.html(json.summaryHtml); |
| 364 | } |
| 365 | }); |
| 366 | }; |
| 367 | |
| 368 | Wpcf7cfForm.prototype.updateHiddenFields = function () { |
| 369 | var form = this; |
| 370 | var hidden_fields = []; |
| 371 | var hidden_groups = []; |
| 372 | var visible_groups = []; |
| 373 | form.$groups.each(function () { |
| 374 | var $this = jQuery(this); |
| 375 | |
| 376 | if ($this.hasClass('wpcf7cf-hidden')) { |
| 377 | hidden_groups.push($this.data('id')); |
| 378 | $this.find('input,select,textarea').each(function () { |
| 379 | hidden_fields.push(jQuery(this).attr('name')); |
| 380 | }); |
| 381 | } else { |
| 382 | visible_groups.push($this.data('id')); |
| 383 | } |
| 384 | }); |
| 385 | form.hidden_fields = hidden_fields; |
| 386 | form.hidden_groups = hidden_groups; |
| 387 | form.visible_groups = visible_groups; |
| 388 | form.$input_hidden_group_fields.val(JSON.stringify(hidden_fields)); |
| 389 | form.$input_hidden_groups.val(JSON.stringify(hidden_groups)); |
| 390 | form.$input_visible_groups.val(JSON.stringify(visible_groups)); |
| 391 | return true; |
| 392 | }; |
| 393 | |
| 394 | Wpcf7cfForm.prototype.updateGroups = function () { |
| 395 | var form = this; |
| 396 | form.$groups = form.$form.find('[data-class="wpcf7cf_group"]'); |
| 397 | form.conditions = window.wpcf7cf.get_nested_conditions(form.initial_conditions, form.$form); |
| 398 | }; |
| 399 | |
| 400 | Wpcf7cfForm.prototype.updateEventListeners = function () { |
| 401 | var form = this; // monitor input changes, and call displayFields() if something has changed |
| 402 | |
| 403 | form.get('input, select, textarea, button').not('.wpcf7cf_add, .wpcf7cf_remove').off(wpcf7cf_change_events).on(wpcf7cf_change_events, form, function (e) { |
| 404 | var form = e.data; |
| 405 | clearTimeout(wpcf7cf_timeout); |
| 406 | wpcf7cf_timeout = setTimeout(function () { |
| 407 | form.displayFields(); |
| 408 | }, wpcf7cf_change_time_ms); |
| 409 | }); // PRO ONLY |
| 410 | |
| 411 | form.get('.wpcf7cf-togglebutton').off('click.toggle_wpcf7cf').on('click.toggle_wpcf7cf', function () { |
| 412 | var $this = jQuery(this); |
| 413 | |
| 414 | if ($this.text() === $this.data('val-1')) { |
| 415 | $this.text($this.data('val-2')); |
| 416 | $this.val($this.data('val-2')); |
| 417 | } else { |
| 418 | $this.text($this.data('val-1')); |
| 419 | $this.val($this.data('val-1')); |
| 420 | } |
| 421 | }); // END PRO ONLY |
| 422 | }; // PRO ONLY |
| 423 | |
| 424 | |
| 425 | function Wpcf7cfRepeater($repeater, form) { |
| 426 | var $ = jQuery; |
| 427 | var repeater = this; |
| 428 | var wpcf7cf_settings = form.settings; |
| 429 | repeater.form = form; |
| 430 | $repeater.num_subs = 0; |
| 431 | $repeater.id = $repeater.data('id'); |
| 432 | $repeater.orig_id = $repeater.data('orig_data_id'); |
| 433 | $repeater.min = typeof $repeater.data('min') !== 'undefined' ? parseInt($repeater.data('min')) : 1; |
| 434 | $repeater.max = typeof $repeater.data('max') !== 'undefined' ? parseInt($repeater.data('max')) : 200; |
| 435 | $repeater.initial_subs = typeof $repeater.data('initial') !== 'undefined' ? parseInt($repeater.data('initial')) : $repeater.min; |
| 436 | if ($repeater.initial_subs > $repeater.max) $repeater.initial_subs = $repeater.max; |
| 437 | var $repeater_sub = $repeater.children('.wpcf7cf_repeater_sub').eq(0); |
| 438 | var $repeater_controls = $repeater.children('.wpcf7cf_repeater_controls').eq(0); |
| 439 | var $repeater_sub_clone = $repeater_sub.clone(); |
| 440 | $repeater_sub_clone.find('.wpcf7cf_repeater_sub').addBack('.wpcf7cf_repeater_sub').each(function () { |
| 441 | var $this = jQuery(this); |
| 442 | var prev_suffix = $this.attr('data-repeater_sub_suffix'); |
| 443 | var new_suffix = prev_suffix + '__{{repeater_sub_suffix}}'; |
| 444 | $this.attr('data-repeater_sub_suffix', new_suffix); |
| 445 | }); |
| 446 | $repeater_sub_clone.find('[name]').each(function () { |
| 447 | var $this = jQuery(this); |
| 448 | var prev_name = $this.attr('name'); |
| 449 | var orig_name = $this.attr('data-orig_name') != null ? $this.attr('data-orig_name') : prev_name; |
| 450 | var new_name = prev_name + '__{{repeater_sub_suffix}}'; |
| 451 | |
| 452 | if (prev_name.endsWith('_count')) { |
| 453 | new_name = prev_name.replace('_count', '__{{repeater_sub_suffix}}_count'); |
| 454 | } |
| 455 | |
| 456 | $this.attr('name', new_name); |
| 457 | $this.attr('data-orig_name', orig_name); |
| 458 | $this.closest('.wpcf7-form-control-wrap').addClass(new_name); |
| 459 | }); |
| 460 | $repeater_sub_clone.find('.wpcf7cf_repeater,[data-class="wpcf7cf_group"]').each(function () { |
| 461 | var $this = jQuery(this); |
| 462 | var prev_data_id = $this.attr('data-id'); |
| 463 | var orig_data_id = $this.attr('data-orig_data_id') != null ? $this.attr('data-orig_data_id') : prev_data_id; |
| 464 | var new_data_id = prev_data_id + '__{{repeater_sub_suffix}}'; |
| 465 | |
| 466 | if (prev_data_id.endsWith('_count')) { |
| 467 | new_data_id = prev_data_id.replace('_count', '__{{repeater_sub_suffix}}_count'); |
| 468 | } |
| 469 | |
| 470 | $this.attr('data-id', new_data_id); |
| 471 | $this.attr('data-orig_data_id', orig_data_id); |
| 472 | $this.closest('.wpcf7-form-control-wrap').addClass(new_data_id); |
| 473 | }); |
| 474 | $repeater_sub_clone.find('[id]').each(function () { |
| 475 | var $this = jQuery(this); |
| 476 | var prev_id = $this.attr('id'); |
| 477 | var orig_id = $this.attr('data-orig_id') != null ? $this.attr('data-orig_id') : prev_id; |
| 478 | var new_id = prev_id + '__{{repeater_sub_suffix}}'; |
| 479 | $this.attr('id', new_id); |
| 480 | $this.attr('data-orig_id', orig_id); |
| 481 | $this.closest('.wpcf7-form-control-wrap').addClass(new_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 = prev_for + '__{{repeater_sub_suffix}}'; |
| 488 | $this.attr('for', new_for); |
| 489 | $this.attr('data-orig_for', orig_for); |
| 490 | $this.closest('.wpcf7-form-control-wrap').addClass(new_for); |
| 491 | }); |
| 492 | var repeater_sub_html = $repeater_sub_clone[0].outerHTML; |
| 493 | var $repeater_count_field = $repeater.find('[name=' + $repeater.id + '_count]').eq(0); |
| 494 | var $button_add = $repeater_controls.find('.wpcf7cf_add').eq(0); |
| 495 | var $button_remove = $repeater_controls.find('.wpcf7cf_remove').eq(0); |
| 496 | var params = { |
| 497 | $repeater: $repeater, |
| 498 | $repeater_count_field: $repeater_count_field, |
| 499 | repeater_sub_html: repeater_sub_html, |
| 500 | $repeater_controls: $repeater_controls, |
| 501 | $button_add: $button_add, |
| 502 | $button_remove: $button_remove, |
| 503 | wpcf7cf_settings: wpcf7cf_settings |
| 504 | }; |
| 505 | this.params = params; |
| 506 | $button_add.on('click', null, repeater, function (e) { |
| 507 | var repeater = e.data; |
| 508 | repeater.updateSubs(params.$repeater.num_subs + 1); |
| 509 | }); |
| 510 | $button_remove.on('click', null, repeater, function (e) { |
| 511 | var repeater = e.data; |
| 512 | repeater.updateSubs(params.$repeater.num_subs - 1); |
| 513 | }); |
| 514 | jQuery('> .wpcf7cf_repeater_sub', params.$repeater).eq(0).remove(); // remove the first sub, it's just a template. |
| 515 | |
| 516 | repeater.updateSubs($repeater.initial_subs); |
| 517 | } |
| 518 | |
| 519 | Wpcf7cfRepeater.prototype.updateSubs = function (subs_to_show) { |
| 520 | var repeater = this; |
| 521 | var params = repeater.params; |
| 522 | var subs_to_add = subs_to_show - params.$repeater.num_subs; |
| 523 | |
| 524 | if (subs_to_add < 0) { |
| 525 | repeater.removeSubs(-subs_to_add); |
| 526 | } else if (subs_to_add > 0) { |
| 527 | repeater.addSubs(subs_to_add); |
| 528 | } |
| 529 | |
| 530 | var showButtonRemove = false; |
| 531 | var showButtonAdd = false; |
| 532 | |
| 533 | if (params.$repeater.num_subs < params.$repeater.max) { |
| 534 | showButtonAdd = true; |
| 535 | } |
| 536 | |
| 537 | if (params.$repeater.num_subs > params.$repeater.min) { |
| 538 | showButtonRemove = true; |
| 539 | } |
| 540 | |
| 541 | if (showButtonAdd) { |
| 542 | params.$button_add.show(); |
| 543 | } else { |
| 544 | params.$button_add.hide(); |
| 545 | } |
| 546 | |
| 547 | if (showButtonRemove) { |
| 548 | params.$button_remove.show(); |
| 549 | } else { |
| 550 | params.$button_remove.hide(); |
| 551 | } |
| 552 | |
| 553 | params.$repeater_count_field.val(subs_to_show); |
| 554 | }; |
| 555 | |
| 556 | Wpcf7cfRepeater.prototype.addSubs = function (subs_to_add) { |
| 557 | var $ = jQuery; |
| 558 | var params = this.params; |
| 559 | var repeater = this; |
| 560 | var form = repeater.form; |
| 561 | var $repeater = params.$repeater; |
| 562 | 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); |
| 563 | |
| 564 | var html_str = ''; |
| 565 | |
| 566 | for (var i = 1; i <= subs_to_add; i++) { |
| 567 | var sub_suffix = $repeater.num_subs + i; |
| 568 | html_str += params.repeater_sub_html.replace(/\{\{repeater_sub_suffix\}\}/g, sub_suffix).replace(new RegExp('\{\{' + $repeater.orig_id + '_index\}\}', 'g'), sub_suffix); |
| 569 | } |
| 570 | |
| 571 | var $html = jQuery(html_str); // Add the newly created fields to the form |
| 572 | |
| 573 | $html.hide().insertBefore($repeater_controls).animate(wpcf7cf_show_animation, params.wpcf7cf_settings.animation_intime).trigger('wpcf7cf_repeater_added'); |
| 574 | jQuery('.wpcf7cf_repeater', $html).each(function () { |
| 575 | form.repeaters.push(new Wpcf7cfRepeater(jQuery(this), form)); |
| 576 | }); |
| 577 | form.$input_repeaters.val(JSON.stringify(form.repeaters.map(function (item) { |
| 578 | return item.params.$repeater.id; |
| 579 | }))); |
| 580 | $repeater.num_subs += subs_to_add; |
| 581 | window.wpcf7cf.updateMultistepState(form.multistep); |
| 582 | form.updateGroups(); |
| 583 | form.updateEventListeners(); |
| 584 | form.displayFields(); // Exclusive Checkbox |
| 585 | |
| 586 | $html.on('click', '.wpcf7-exclusive-checkbox input:checkbox', function () { |
| 587 | var name = $(this).attr('name'); |
| 588 | $html.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false); |
| 589 | }); //basic compatibility with material-design-for-contact-form-7 |
| 590 | |
| 591 | if (typeof window.cf7mdInit === "function") { |
| 592 | window.cf7mdInit(); |
| 593 | } |
| 594 | |
| 595 | return false; |
| 596 | }; |
| 597 | |
| 598 | Wpcf7cfRepeater.prototype.removeSubs = function (num_subs) { |
| 599 | var $ = jQuery; |
| 600 | var params = this.params; |
| 601 | var form = this.form; |
| 602 | params.$repeater.num_subs -= num_subs; |
| 603 | jQuery('> .wpcf7cf_repeater_sub', params.$repeater).slice(-num_subs).animate(wpcf7cf_hide_animation, { |
| 604 | duration: params.wpcf7cf_settings.animation_intime, |
| 605 | done: function done() { |
| 606 | var $this = jQuery(this); //remove the actual fields from the form |
| 607 | |
| 608 | $this.remove(); |
| 609 | params.$repeater.trigger('wpcf7cf_repeater_removed'); |
| 610 | window.wpcf7cf.updateMultistepState(form.multistep); |
| 611 | form.updateGroups(); |
| 612 | form.updateEventListeners(); |
| 613 | form.displayFields(); |
| 614 | } |
| 615 | }); |
| 616 | return false; |
| 617 | }; |
| 618 | |
| 619 | function Wpcf7cfMultistep($multistep, form) { |
| 620 | var multistep = this; |
| 621 | multistep.$multistep = $multistep; |
| 622 | multistep.form = form; |
| 623 | multistep.$steps = $multistep.find('.wpcf7cf_step'); |
| 624 | multistep.$btn_next = $multistep.find('.wpcf7cf_next'); |
| 625 | multistep.$btn_prev = $multistep.find('.wpcf7cf_prev'); |
| 626 | multistep.$dots = $multistep.find('.wpcf7cf_steps-dots'); |
| 627 | multistep.currentStep = 0; |
| 628 | multistep.numSteps = multistep.$steps.length; |
| 629 | multistep.$dots.html(''); |
| 630 | |
| 631 | for (var i = 1; i <= multistep.numSteps; i++) { |
| 632 | 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 ")); |
| 633 | } |
| 634 | |
| 635 | 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() { |
| 636 | var result; |
| 637 | return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { |
| 638 | while (1) { |
| 639 | switch (_context.prev = _context.next) { |
| 640 | case 0: |
| 641 | _context.next = 2; |
| 642 | return multistep.validateStep(multistep.currentStep); |
| 643 | |
| 644 | case 2: |
| 645 | result = _context.sent; |
| 646 | |
| 647 | if (result === 'success') { |
| 648 | multistep.moveToStep(multistep.currentStep + 1); |
| 649 | } |
| 650 | |
| 651 | case 4: |
| 652 | case "end": |
| 653 | return _context.stop(); |
| 654 | } |
| 655 | } |
| 656 | }, _callee); |
| 657 | }))); // If form is submitted (by pressing Enter for example), and if we are not on the last step, |
| 658 | // then trigger click event on the $btn_next button instead. |
| 659 | |
| 660 | multistep.form.$form.on('submit.wpcf7cf_step', function (e) { |
| 661 | if (multistep.currentStep !== multistep.numSteps) { |
| 662 | multistep.$btn_next.trigger('click.wpcf7cf_step'); |
| 663 | e.stopImmediatePropagation(); |
| 664 | return false; |
| 665 | } |
| 666 | }); |
| 667 | multistep.$btn_prev.on('click', function () { |
| 668 | multistep.moveToStep(multistep.currentStep - 1); |
| 669 | }); |
| 670 | multistep.moveToStep(1); |
| 671 | } |
| 672 | |
| 673 | jQuery(document).ajaxComplete(function (e, xhr, settings) { |
| 674 | if (xhr.hasOwnProperty('responseJSON') && xhr.responseJSON != null && xhr.responseJSON.hasOwnProperty('status') && xhr.responseJSON.hasOwnProperty('into') && xhr.responseJSON.status === "mail_success") { |
| 675 | jQuery(xhr.responseJSON.into).trigger('reset.wpcf7cf'); |
| 676 | } |
| 677 | }); |
| 678 | |
| 679 | Wpcf7cfMultistep.prototype.validateStep = function (step_index) { |
| 680 | var multistep = this; |
| 681 | var $multistep = multistep.$multistep; |
| 682 | var $form = multistep.form.$form; |
| 683 | var form = multistep.form; |
| 684 | $form.find('.wpcf7-response-output').addClass('wpcf7-display-none'); |
| 685 | return new Promise(function (resolve) { |
| 686 | var fd = new FormData(); // Make sure to add file fields to FormData |
| 687 | |
| 688 | jQuery.each($form.find('[data-id="step-' + step_index + '"] input[type="file"]'), function (index, el) { |
| 689 | if (!el.files.length) return false; |
| 690 | var file = el.files[0]; |
| 691 | var fieldName = el.name; |
| 692 | fd.append(fieldName, file); |
| 693 | }); |
| 694 | var formdata = $form.serializeArray(); |
| 695 | jQuery.each(formdata, function (key, input) { |
| 696 | fd.append(input.name, input.value); |
| 697 | }); |
| 698 | jQuery.ajax({ |
| 699 | url: wpcf7cf_global_settings.ajaxurl + '?action=wpcf7cf_validate_step', |
| 700 | type: 'POST', |
| 701 | data: fd, |
| 702 | processData: false, |
| 703 | contentType: false, |
| 704 | dataType: 'json' |
| 705 | }).done(function (json) { |
| 706 | $multistep.find('.wpcf7-form-control-wrap .wpcf7-not-valid-tip').remove(); |
| 707 | $multistep.find('.wpcf7-not-valid').removeClass('wpcf7-not-valid'); |
| 708 | $multistep.find('.wpcf7-response-output').remove(); |
| 709 | $multistep.find('.wpcf7-response-output.wpcf7-validation-errors').removeClass('wpcf7-validation-errors'); |
| 710 | |
| 711 | if (!json.success) { |
| 712 | var checkError = 0; |
| 713 | jQuery.each(json.invalid_fields, function (index, el) { |
| 714 | 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) { |
| 715 | checkError = checkError + 1; |
| 716 | var controlWrap = form.get('.wpcf7-form-control-wrap.' + index); |
| 717 | controlWrap.find('input').addClass('wpcf7-not-valid'); |
| 718 | controlWrap.find('span.wpcf7-not-valid-tip').remove(); |
| 719 | controlWrap.append('<span role="alert" class="wpcf7-not-valid-tip">' + el.reason + '</span>'); |
| 720 | } |
| 721 | }); |
| 722 | resolve('failed'); |
| 723 | $multistep.parent().find('.wpcf7-response-output').removeClass('wpcf7-display-none').html(json.message); |
| 724 | } else if (json.success) { |
| 725 | resolve('success'); |
| 726 | return false; |
| 727 | } |
| 728 | }).fail(function () { |
| 729 | resolve('error'); |
| 730 | }).always(function () {// do nothing |
| 731 | }); |
| 732 | }); |
| 733 | }; |
| 734 | |
| 735 | Wpcf7cfMultistep.prototype.moveToStep = function (step_index) { |
| 736 | var multistep = this; |
| 737 | var previousStep = multistep.currentStep; |
| 738 | multistep.currentStep = step_index > multistep.numSteps ? multistep.numSteps : step_index < 1 ? 1 : step_index; // ANIMATION DISABLED FOR NOW cause it's ugly |
| 739 | // multistep.$steps.animate(wpcf7cf_hide_step_animation, multistep.form.settings.animation_outtime); |
| 740 | // multistep.$steps.eq(multistep.currentStep-1).animate(wpcf7cf_show_step_animation, multistep.form.settings.animation_intime); |
| 741 | |
| 742 | multistep.$multistep.attr('data-current_step', multistep.currentStep); |
| 743 | multistep.$steps.hide(); |
| 744 | multistep.$steps.eq(multistep.currentStep - 1).show().trigger('wpcf7cf_change_step', [previousStep, multistep.currentStep]); |
| 745 | var formEl = multistep.form.$form[0]; |
| 746 | var topOffset = formEl.getBoundingClientRect().top; |
| 747 | |
| 748 | if (topOffset < 0 && previousStep > 0) { |
| 749 | formEl.scrollIntoView({ |
| 750 | behavior: "smooth" |
| 751 | }); |
| 752 | } |
| 753 | |
| 754 | multistep.form.updateSummaryFields(); |
| 755 | window.wpcf7cf.updateMultistepState(multistep); |
| 756 | }; |
| 757 | |
| 758 | Wpcf7cfMultistep.prototype.getFieldsInStep = function (step_index) { |
| 759 | wpcf7cf_reload_dom(this.form.$form); |
| 760 | var inStep = false; |
| 761 | return Object.values(wpcf7cf_dom).filter(function (item, i) { |
| 762 | if (item.type == 'step') { |
| 763 | inStep = item.val == step_index + ''; |
| 764 | } |
| 765 | |
| 766 | return inStep && item.type == 'input'; |
| 767 | }).map(function (item) { |
| 768 | return item.name; |
| 769 | }); |
| 770 | }; // END PRO ONLY |
| 771 | |
| 772 | |
| 773 | window.wpcf7cf = { |
| 774 | // keep this for backwards compatibility |
| 775 | initForm: function initForm($form) { |
| 776 | wpcf7cf_forms.push(new Wpcf7cfForm($form)); |
| 777 | }, |
| 778 | get_nested_conditions: function get_nested_conditions(conditions, $current_form) { |
| 779 | //loop trough conditions. Then loop trough the dom, and each repeater we pass we should update all sub_values we encounter with __index |
| 780 | wpcf7cf_reload_dom($current_form); |
| 781 | var groups = Object.values(wpcf7cf_dom).filter(function (item, i) { |
| 782 | return item.type === 'group'; |
| 783 | }); |
| 784 | var sub_conditions = []; |
| 785 | |
| 786 | for (var i = 0; i < groups.length; i++) { |
| 787 | var g = groups[i]; |
| 788 | var relevant_conditions = conditions.filter(function (condition, i) { |
| 789 | return condition.then_field === g.original_name; |
| 790 | }); |
| 791 | var relevant_conditions = relevant_conditions.map(function (item, i) { |
| 792 | return { |
| 793 | then_field: g.name, |
| 794 | and_rules: item.and_rules.map(function (and_rule, i) { |
| 795 | return { |
| 796 | if_field: and_rule.if_field + g.suffix, |
| 797 | if_value: and_rule.if_value, |
| 798 | operator: and_rule.operator |
| 799 | }; |
| 800 | }) |
| 801 | }; |
| 802 | }); |
| 803 | sub_conditions = sub_conditions.concat(relevant_conditions); |
| 804 | } |
| 805 | |
| 806 | return sub_conditions; |
| 807 | }, |
| 808 | get_simplified_dom_model: function get_simplified_dom_model($current_form) { |
| 809 | var currentNode; |
| 810 | var ni = document.createNodeIterator($current_form[0], NodeFilter.SHOW_ELEMENT, null, false); //, NodeFilter.SHOW_ELEMENT, function(){ return NodeFilter.FILTER_ACCEPT; } |
| 811 | |
| 812 | var simplified_dom = {}; |
| 813 | |
| 814 | while (currentNode = ni.nextNode()) { |
| 815 | var type = currentNode.classList.contains('wpcf7cf_repeater') ? 'repeater' : currentNode.dataset["class"] == 'wpcf7cf_group' ? 'group' : currentNode.className == 'wpcf7cf_step' ? 'step' : currentNode.hasAttribute('name') ? 'input' : false; |
| 816 | |
| 817 | if (!type) { |
| 818 | continue; |
| 819 | } |
| 820 | |
| 821 | var name = type === 'input' ? currentNode.getAttribute('name') : currentNode.dataset.id; // skip _wpcf7 hidden fields |
| 822 | |
| 823 | if (name.substring(0, 6) === '_wpcf7') continue; |
| 824 | var original_name = type === 'repeater' || type === 'group' ? currentNode.dataset.orig_data_id : type === 'input' ? currentNode.getAttribute('data-orig_name') || name : name; |
| 825 | var val = type === 'step' ? [currentNode.dataset.id.substring(5)] : []; |
| 826 | var original_name_length = original_name == null ? name.length : original_name.length; |
| 827 | var suffix = name.substring(original_name_length); |
| 828 | |
| 829 | if (!simplified_dom[name]) { |
| 830 | // init entry |
| 831 | simplified_dom[name] = { |
| 832 | name: name, |
| 833 | type: type, |
| 834 | original_name: original_name, |
| 835 | suffix: suffix, |
| 836 | val: val |
| 837 | }; |
| 838 | } |
| 839 | |
| 840 | if (type === 'input') { |
| 841 | // skip unchecked checkboxes and radiobuttons |
| 842 | if ((currentNode.type === 'checkbox' || currentNode.type === 'radio') && !currentNode.checked) continue; // if multiselect, make sure to add all the values |
| 843 | |
| 844 | if (currentNode.multiple) { |
| 845 | simplified_dom[name].val = Object.values(currentNode.options).filter(function (o) { |
| 846 | return o.selected; |
| 847 | }).map(function (o) { |
| 848 | return o.value; |
| 849 | }); |
| 850 | } else { |
| 851 | simplified_dom[name].val.push(currentNode.value); |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | return simplified_dom; |
| 857 | }, |
| 858 | updateMultistepState: function updateMultistepState(multistep) { |
| 859 | if (multistep == null) return; // update hidden input field |
| 860 | |
| 861 | var stepsData = { |
| 862 | currentStep: multistep.currentStep, |
| 863 | numSteps: multistep.numSteps, |
| 864 | fieldsInCurrentStep: multistep.getFieldsInStep(multistep.currentStep) |
| 865 | }; |
| 866 | multistep.form.$input_steps.val(JSON.stringify(stepsData)); // update Buttons |
| 867 | |
| 868 | multistep.$btn_prev.removeClass('disabled').attr('disabled', false); |
| 869 | multistep.$btn_next.removeClass('disabled').attr('disabled', false); |
| 870 | |
| 871 | if (multistep.currentStep == multistep.numSteps) { |
| 872 | multistep.$btn_next.addClass('disabled').attr('disabled', true); |
| 873 | } |
| 874 | |
| 875 | if (multistep.currentStep == 1) { |
| 876 | multistep.$btn_prev.addClass('disabled').attr('disabled', true); |
| 877 | } // replace next button with submit button on last step. |
| 878 | // TODO: make this depend on a setting |
| 879 | |
| 880 | |
| 881 | var $submit_button = multistep.form.$form.find('input[type="submit"]').eq(0); |
| 882 | var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0); |
| 883 | |
| 884 | if (multistep.currentStep == multistep.numSteps) { |
| 885 | multistep.$btn_next.hide(); |
| 886 | $ajax_loader.detach().appendTo(multistep.$btn_next.parent()); |
| 887 | $submit_button.detach().appendTo(multistep.$btn_next.parent()); |
| 888 | $submit_button.show(); |
| 889 | } else { |
| 890 | $submit_button.hide(); |
| 891 | multistep.$btn_next.show(); |
| 892 | } // update dots |
| 893 | |
| 894 | |
| 895 | var $dots = multistep.$dots.find('.dot'); |
| 896 | $dots.removeClass('active').removeClass('completed'); |
| 897 | |
| 898 | for (var step = 1; step <= multistep.numSteps; step++) { |
| 899 | if (step < multistep.currentStep) { |
| 900 | $dots.eq(step - 1).addClass('completed'); |
| 901 | } else if (step == multistep.currentStep) { |
| 902 | $dots.eq(step - 1).addClass('active'); |
| 903 | } |
| 904 | } |
| 905 | }, |
| 906 | should_group_be_shown: function should_group_be_shown(condition) { |
| 907 | var show_group = true; |
| 908 | |
| 909 | for (var and_rule_i = 0; and_rule_i < condition.and_rules.length; and_rule_i++) { |
| 910 | var condition_ok = false; |
| 911 | var condition_and_rule = condition.and_rules[and_rule_i]; |
| 912 | var inputField = wpcf7cf_getFieldByName(condition_and_rule.if_field); |
| 913 | var if_val = condition_and_rule.if_value; |
| 914 | var operator = condition_and_rule.operator; //backwards compat |
| 915 | |
| 916 | operator = operator === '≤' ? 'less than or equals' : operator; |
| 917 | operator = operator === '≥' ? 'greater than or equals' : operator; |
| 918 | operator = operator === '>' ? 'greater than' : operator; |
| 919 | operator = operator === '<' ? 'less than' : operator; |
| 920 | condition_ok = this.isConditionTrue(inputField.val, operator, if_val); |
| 921 | show_group = show_group && condition_ok; |
| 922 | } |
| 923 | |
| 924 | return show_group; |
| 925 | }, |
| 926 | isConditionTrue: function isConditionTrue(values, operator) { |
| 927 | var testValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; |
| 928 | var $field = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : jQuery(); |
| 929 | |
| 930 | if (!Array.isArray(values)) { |
| 931 | values = [values]; |
| 932 | } |
| 933 | |
| 934 | var condition_ok = false; // start by assuming that the condition is not met |
| 935 | // Considered EMPTY: [] [''] [null] ['',null] [,,''] |
| 936 | // Considered NOT EMPTY: [0] ['ab','c'] ['',0,null] |
| 937 | |
| 938 | var valuesAreEmpty = values.length === 0 || values.every(function (v) { |
| 939 | return !v && v !== 0; |
| 940 | }); // 0 is not considered empty |
| 941 | // special cases: [] equals '' => TRUE; [] not equals '' => FALSE |
| 942 | |
| 943 | if (operator === 'equals' && testValue === '' && valuesAreEmpty) { |
| 944 | return true; |
| 945 | } |
| 946 | |
| 947 | if (operator === 'not equals' && testValue === '' && valuesAreEmpty) { |
| 948 | return false; |
| 949 | } |
| 950 | |
| 951 | if (valuesAreEmpty) { |
| 952 | if (operator === 'is empty') { |
| 953 | condition_ok = true; |
| 954 | } |
| 955 | } else { |
| 956 | if (operator === 'not empty') { |
| 957 | condition_ok = true; |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | var testValueNumber = isFinite(parseFloat(testValue)) ? parseFloat(testValue) : NaN; |
| 962 | |
| 963 | if (operator === 'not equals' || operator === 'not equals (regex)') { |
| 964 | // start by assuming that the condition is met |
| 965 | condition_ok = true; |
| 966 | } |
| 967 | |
| 968 | if (operator === 'function' && typeof window[testValue] == 'function' && window[testValue]($field) // here we call the actual user defined function |
| 969 | ) { |
| 970 | condition_ok = true; |
| 971 | } |
| 972 | |
| 973 | var regex_patt = /.*/i; // fallback regex pattern |
| 974 | |
| 975 | var isValidRegex = true; |
| 976 | |
| 977 | if (operator === 'equals (regex)' || operator === 'not equals (regex)') { |
| 978 | try { |
| 979 | regex_patt = new RegExp(testValue, 'i'); |
| 980 | } catch (e) { |
| 981 | isValidRegex = false; |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | for (var i = 0; i < values.length; i++) { |
| 986 | var value = values[i]; |
| 987 | var valueNumber = isFinite(parseFloat(value)) ? parseFloat(value) : NaN; |
| 988 | var valsAreNumbers = !isNaN(valueNumber) && !isNaN(testValueNumber); |
| 989 | |
| 990 | 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) { |
| 991 | condition_ok = true; |
| 992 | break; |
| 993 | } else if (operator === 'not equals' && value === testValue || operator === 'not equals (regex)' && regex_patt.test(value)) { |
| 994 | condition_ok = false; |
| 995 | break; |
| 996 | } |
| 997 | } |
| 998 | |
| 999 | return condition_ok; |
| 1000 | } |
| 1001 | }; |
| 1002 | jQuery('.wpcf7-form').each(function () { |
| 1003 | wpcf7cf_forms.push(new Wpcf7cfForm(jQuery(this))); |
| 1004 | }); // Call displayFields again on all forms |
| 1005 | // Necessary in case some theme or plugin changed a form value by the time the entire page is fully loaded. |
| 1006 | |
| 1007 | jQuery('document').ready(function () { |
| 1008 | wpcf7cf_forms.forEach(function (f) { |
| 1009 | f.displayFields(); |
| 1010 | }); |
| 1011 | }); // fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function) |
| 1012 | |
| 1013 | var old_wpcf7ExclusiveCheckbox = jQuery.fn.wpcf7ExclusiveCheckbox; |
| 1014 | |
| 1015 | jQuery.fn.wpcf7ExclusiveCheckbox = function () { |
| 1016 | return this.find('input:checkbox').on('click', function () { |
| 1017 | var name = jQuery(this).attr('name'); |
| 1018 | jQuery(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false).eq(0).change(); |
| 1019 | }); |
| 1020 | }; |
| 1021 | |
| 1022 | /***/ }), |
| 1023 | |
| 1024 | /***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js": |
| 1025 | /*!*****************************************************************!*\ |
| 1026 | !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***! |
| 1027 | \*****************************************************************/ |
| 1028 | /*! no static exports found */ |
| 1029 | /***/ (function(module, exports) { |
| 1030 | |
| 1031 | function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { |
| 1032 | try { |
| 1033 | var info = gen[key](arg); |
| 1034 | var value = info.value; |
| 1035 | } catch (error) { |
| 1036 | reject(error); |
| 1037 | return; |
| 1038 | } |
| 1039 | |
| 1040 | if (info.done) { |
| 1041 | resolve(value); |
| 1042 | } else { |
| 1043 | Promise.resolve(value).then(_next, _throw); |
| 1044 | } |
| 1045 | } |
| 1046 | |
| 1047 | function _asyncToGenerator(fn) { |
| 1048 | return function () { |
| 1049 | var self = this, |
| 1050 | args = arguments; |
| 1051 | return new Promise(function (resolve, reject) { |
| 1052 | var gen = fn.apply(self, args); |
| 1053 | |
| 1054 | function _next(value) { |
| 1055 | asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); |
| 1056 | } |
| 1057 | |
| 1058 | function _throw(err) { |
| 1059 | asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); |
| 1060 | } |
| 1061 | |
| 1062 | _next(undefined); |
| 1063 | }); |
| 1064 | }; |
| 1065 | } |
| 1066 | |
| 1067 | module.exports = _asyncToGenerator; |
| 1068 | |
| 1069 | /***/ }), |
| 1070 | |
| 1071 | /***/ "./node_modules/@babel/runtime/regenerator/index.js": |
| 1072 | /*!**********************************************************!*\ |
| 1073 | !*** ./node_modules/@babel/runtime/regenerator/index.js ***! |
| 1074 | \**********************************************************/ |
| 1075 | /*! no static exports found */ |
| 1076 | /***/ (function(module, exports, __webpack_require__) { |
| 1077 | |
| 1078 | module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js"); |
| 1079 | |
| 1080 | /***/ }), |
| 1081 | |
| 1082 | /***/ "./node_modules/regenerator-runtime/runtime.js": |
| 1083 | /*!*****************************************************!*\ |
| 1084 | !*** ./node_modules/regenerator-runtime/runtime.js ***! |
| 1085 | \*****************************************************/ |
| 1086 | /*! no static exports found */ |
| 1087 | /***/ (function(module, exports, __webpack_require__) { |
| 1088 | |
| 1089 | /* 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); } |
| 1090 | |
| 1091 | /** |
| 1092 | * Copyright (c) 2014-present, Facebook, Inc. |
| 1093 | * |
| 1094 | * This source code is licensed under the MIT license found in the |
| 1095 | * LICENSE file in the root directory of this source tree. |
| 1096 | */ |
| 1097 | var runtime = function (exports) { |
| 1098 | "use strict"; |
| 1099 | |
| 1100 | var Op = Object.prototype; |
| 1101 | var hasOwn = Op.hasOwnProperty; |
| 1102 | var undefined; // More compressible than void 0. |
| 1103 | |
| 1104 | var $Symbol = typeof Symbol === "function" ? Symbol : {}; |
| 1105 | var iteratorSymbol = $Symbol.iterator || "@@iterator"; |
| 1106 | var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; |
| 1107 | var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; |
| 1108 | |
| 1109 | function wrap(innerFn, outerFn, self, tryLocsList) { |
| 1110 | // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. |
| 1111 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; |
| 1112 | var generator = Object.create(protoGenerator.prototype); |
| 1113 | var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, |
| 1114 | // .throw, and .return methods. |
| 1115 | |
| 1116 | generator._invoke = makeInvokeMethod(innerFn, self, context); |
| 1117 | return generator; |
| 1118 | } |
| 1119 | |
| 1120 | exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion |
| 1121 | // record like context.tryEntries[i].completion. This interface could |
| 1122 | // have been (and was previously) designed to take a closure to be |
| 1123 | // invoked without arguments, but in all the cases we care about we |
| 1124 | // already have an existing method we want to call, so there's no need |
| 1125 | // to create a new function object. We can even get away with assuming |
| 1126 | // the method takes exactly one argument, since that happens to be true |
| 1127 | // in every case, so we don't have to touch the arguments object. The |
| 1128 | // only additional allocation required is the completion record, which |
| 1129 | // has a stable shape and so hopefully should be cheap to allocate. |
| 1130 | |
| 1131 | function tryCatch(fn, obj, arg) { |
| 1132 | try { |
| 1133 | return { |
| 1134 | type: "normal", |
| 1135 | arg: fn.call(obj, arg) |
| 1136 | }; |
| 1137 | } catch (err) { |
| 1138 | return { |
| 1139 | type: "throw", |
| 1140 | arg: err |
| 1141 | }; |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | var GenStateSuspendedStart = "suspendedStart"; |
| 1146 | var GenStateSuspendedYield = "suspendedYield"; |
| 1147 | var GenStateExecuting = "executing"; |
| 1148 | var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as |
| 1149 | // breaking out of the dispatch switch statement. |
| 1150 | |
| 1151 | var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and |
| 1152 | // .constructor.prototype properties for functions that return Generator |
| 1153 | // objects. For full spec compliance, you may wish to configure your |
| 1154 | // minifier not to mangle the names of these two functions. |
| 1155 | |
| 1156 | function Generator() {} |
| 1157 | |
| 1158 | function GeneratorFunction() {} |
| 1159 | |
| 1160 | function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that |
| 1161 | // don't natively support it. |
| 1162 | |
| 1163 | |
| 1164 | var IteratorPrototype = {}; |
| 1165 | |
| 1166 | IteratorPrototype[iteratorSymbol] = function () { |
| 1167 | return this; |
| 1168 | }; |
| 1169 | |
| 1170 | var getProto = Object.getPrototypeOf; |
| 1171 | var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); |
| 1172 | |
| 1173 | if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { |
| 1174 | // This environment has a native %IteratorPrototype%; use it instead |
| 1175 | // of the polyfill. |
| 1176 | IteratorPrototype = NativeIteratorPrototype; |
| 1177 | } |
| 1178 | |
| 1179 | var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); |
| 1180 | GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; |
| 1181 | GeneratorFunctionPrototype.constructor = GeneratorFunction; |
| 1182 | GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the |
| 1183 | // Iterator interface in terms of a single ._invoke method. |
| 1184 | |
| 1185 | function defineIteratorMethods(prototype) { |
| 1186 | ["next", "throw", "return"].forEach(function (method) { |
| 1187 | prototype[method] = function (arg) { |
| 1188 | return this._invoke(method, arg); |
| 1189 | }; |
| 1190 | }); |
| 1191 | } |
| 1192 | |
| 1193 | exports.isGeneratorFunction = function (genFun) { |
| 1194 | var ctor = typeof genFun === "function" && genFun.constructor; |
| 1195 | return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can |
| 1196 | // do is to check its .name property. |
| 1197 | (ctor.displayName || ctor.name) === "GeneratorFunction" : false; |
| 1198 | }; |
| 1199 | |
| 1200 | exports.mark = function (genFun) { |
| 1201 | if (Object.setPrototypeOf) { |
| 1202 | Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); |
| 1203 | } else { |
| 1204 | genFun.__proto__ = GeneratorFunctionPrototype; |
| 1205 | |
| 1206 | if (!(toStringTagSymbol in genFun)) { |
| 1207 | genFun[toStringTagSymbol] = "GeneratorFunction"; |
| 1208 | } |
| 1209 | } |
| 1210 | |
| 1211 | genFun.prototype = Object.create(Gp); |
| 1212 | return genFun; |
| 1213 | }; // Within the body of any async function, `await x` is transformed to |
| 1214 | // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test |
| 1215 | // `hasOwn.call(value, "__await")` to determine if the yielded value is |
| 1216 | // meant to be awaited. |
| 1217 | |
| 1218 | |
| 1219 | exports.awrap = function (arg) { |
| 1220 | return { |
| 1221 | __await: arg |
| 1222 | }; |
| 1223 | }; |
| 1224 | |
| 1225 | function AsyncIterator(generator, PromiseImpl) { |
| 1226 | function invoke(method, arg, resolve, reject) { |
| 1227 | var record = tryCatch(generator[method], generator, arg); |
| 1228 | |
| 1229 | if (record.type === "throw") { |
| 1230 | reject(record.arg); |
| 1231 | } else { |
| 1232 | var result = record.arg; |
| 1233 | var value = result.value; |
| 1234 | |
| 1235 | if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { |
| 1236 | return PromiseImpl.resolve(value.__await).then(function (value) { |
| 1237 | invoke("next", value, resolve, reject); |
| 1238 | }, function (err) { |
| 1239 | invoke("throw", err, resolve, reject); |
| 1240 | }); |
| 1241 | } |
| 1242 | |
| 1243 | return PromiseImpl.resolve(value).then(function (unwrapped) { |
| 1244 | // When a yielded Promise is resolved, its final value becomes |
| 1245 | // the .value of the Promise<{value,done}> result for the |
| 1246 | // current iteration. |
| 1247 | result.value = unwrapped; |
| 1248 | resolve(result); |
| 1249 | }, function (error) { |
| 1250 | // If a rejected Promise was yielded, throw the rejection back |
| 1251 | // into the async generator function so it can be handled there. |
| 1252 | return invoke("throw", error, resolve, reject); |
| 1253 | }); |
| 1254 | } |
| 1255 | } |
| 1256 | |
| 1257 | var previousPromise; |
| 1258 | |
| 1259 | function enqueue(method, arg) { |
| 1260 | function callInvokeWithMethodAndArg() { |
| 1261 | return new PromiseImpl(function (resolve, reject) { |
| 1262 | invoke(method, arg, resolve, reject); |
| 1263 | }); |
| 1264 | } |
| 1265 | |
| 1266 | return previousPromise = // If enqueue has been called before, then we want to wait until |
| 1267 | // all previous Promises have been resolved before calling invoke, |
| 1268 | // so that results are always delivered in the correct order. If |
| 1269 | // enqueue has not been called before, then it is important to |
| 1270 | // call invoke immediately, without waiting on a callback to fire, |
| 1271 | // so that the async generator function has the opportunity to do |
| 1272 | // any necessary setup in a predictable way. This predictability |
| 1273 | // is why the Promise constructor synchronously invokes its |
| 1274 | // executor callback, and why async functions synchronously |
| 1275 | // execute code before the first await. Since we implement simple |
| 1276 | // async functions in terms of async generators, it is especially |
| 1277 | // important to get this right, even though it requires care. |
| 1278 | previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later |
| 1279 | // invocations of the iterator. |
| 1280 | callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); |
| 1281 | } // Define the unified helper method that is used to implement .next, |
| 1282 | // .throw, and .return (see defineIteratorMethods). |
| 1283 | |
| 1284 | |
| 1285 | this._invoke = enqueue; |
| 1286 | } |
| 1287 | |
| 1288 | defineIteratorMethods(AsyncIterator.prototype); |
| 1289 | |
| 1290 | AsyncIterator.prototype[asyncIteratorSymbol] = function () { |
| 1291 | return this; |
| 1292 | }; |
| 1293 | |
| 1294 | exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of |
| 1295 | // AsyncIterator objects; they just return a Promise for the value of |
| 1296 | // the final result produced by the iterator. |
| 1297 | |
| 1298 | exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { |
| 1299 | if (PromiseImpl === void 0) PromiseImpl = Promise; |
| 1300 | var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); |
| 1301 | return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. |
| 1302 | : iter.next().then(function (result) { |
| 1303 | return result.done ? result.value : iter.next(); |
| 1304 | }); |
| 1305 | }; |
| 1306 | |
| 1307 | function makeInvokeMethod(innerFn, self, context) { |
| 1308 | var state = GenStateSuspendedStart; |
| 1309 | return function invoke(method, arg) { |
| 1310 | if (state === GenStateExecuting) { |
| 1311 | throw new Error("Generator is already running"); |
| 1312 | } |
| 1313 | |
| 1314 | if (state === GenStateCompleted) { |
| 1315 | if (method === "throw") { |
| 1316 | throw arg; |
| 1317 | } // Be forgiving, per 25.3.3.3.3 of the spec: |
| 1318 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume |
| 1319 | |
| 1320 | |
| 1321 | return doneResult(); |
| 1322 | } |
| 1323 | |
| 1324 | context.method = method; |
| 1325 | context.arg = arg; |
| 1326 | |
| 1327 | while (true) { |
| 1328 | var delegate = context.delegate; |
| 1329 | |
| 1330 | if (delegate) { |
| 1331 | var delegateResult = maybeInvokeDelegate(delegate, context); |
| 1332 | |
| 1333 | if (delegateResult) { |
| 1334 | if (delegateResult === ContinueSentinel) continue; |
| 1335 | return delegateResult; |
| 1336 | } |
| 1337 | } |
| 1338 | |
| 1339 | if (context.method === "next") { |
| 1340 | // Setting context._sent for legacy support of Babel's |
| 1341 | // function.sent implementation. |
| 1342 | context.sent = context._sent = context.arg; |
| 1343 | } else if (context.method === "throw") { |
| 1344 | if (state === GenStateSuspendedStart) { |
| 1345 | state = GenStateCompleted; |
| 1346 | throw context.arg; |
| 1347 | } |
| 1348 | |
| 1349 | context.dispatchException(context.arg); |
| 1350 | } else if (context.method === "return") { |
| 1351 | context.abrupt("return", context.arg); |
| 1352 | } |
| 1353 | |
| 1354 | state = GenStateExecuting; |
| 1355 | var record = tryCatch(innerFn, self, context); |
| 1356 | |
| 1357 | if (record.type === "normal") { |
| 1358 | // If an exception is thrown from innerFn, we leave state === |
| 1359 | // GenStateExecuting and loop back for another invocation. |
| 1360 | state = context.done ? GenStateCompleted : GenStateSuspendedYield; |
| 1361 | |
| 1362 | if (record.arg === ContinueSentinel) { |
| 1363 | continue; |
| 1364 | } |
| 1365 | |
| 1366 | return { |
| 1367 | value: record.arg, |
| 1368 | done: context.done |
| 1369 | }; |
| 1370 | } else if (record.type === "throw") { |
| 1371 | state = GenStateCompleted; // Dispatch the exception by looping back around to the |
| 1372 | // context.dispatchException(context.arg) call above. |
| 1373 | |
| 1374 | context.method = "throw"; |
| 1375 | context.arg = record.arg; |
| 1376 | } |
| 1377 | } |
| 1378 | }; |
| 1379 | } // Call delegate.iterator[context.method](context.arg) and handle the |
| 1380 | // result, either by returning a { value, done } result from the |
| 1381 | // delegate iterator, or by modifying context.method and context.arg, |
| 1382 | // setting context.delegate to null, and returning the ContinueSentinel. |
| 1383 | |
| 1384 | |
| 1385 | function maybeInvokeDelegate(delegate, context) { |
| 1386 | var method = delegate.iterator[context.method]; |
| 1387 | |
| 1388 | if (method === undefined) { |
| 1389 | // A .throw or .return when the delegate iterator has no .throw |
| 1390 | // method always terminates the yield* loop. |
| 1391 | context.delegate = null; |
| 1392 | |
| 1393 | if (context.method === "throw") { |
| 1394 | // Note: ["return"] must be used for ES3 parsing compatibility. |
| 1395 | if (delegate.iterator["return"]) { |
| 1396 | // If the delegate iterator has a return method, give it a |
| 1397 | // chance to clean up. |
| 1398 | context.method = "return"; |
| 1399 | context.arg = undefined; |
| 1400 | maybeInvokeDelegate(delegate, context); |
| 1401 | |
| 1402 | if (context.method === "throw") { |
| 1403 | // If maybeInvokeDelegate(context) changed context.method from |
| 1404 | // "return" to "throw", let that override the TypeError below. |
| 1405 | return ContinueSentinel; |
| 1406 | } |
| 1407 | } |
| 1408 | |
| 1409 | context.method = "throw"; |
| 1410 | context.arg = new TypeError("The iterator does not provide a 'throw' method"); |
| 1411 | } |
| 1412 | |
| 1413 | return ContinueSentinel; |
| 1414 | } |
| 1415 | |
| 1416 | var record = tryCatch(method, delegate.iterator, context.arg); |
| 1417 | |
| 1418 | if (record.type === "throw") { |
| 1419 | context.method = "throw"; |
| 1420 | context.arg = record.arg; |
| 1421 | context.delegate = null; |
| 1422 | return ContinueSentinel; |
| 1423 | } |
| 1424 | |
| 1425 | var info = record.arg; |
| 1426 | |
| 1427 | if (!info) { |
| 1428 | context.method = "throw"; |
| 1429 | context.arg = new TypeError("iterator result is not an object"); |
| 1430 | context.delegate = null; |
| 1431 | return ContinueSentinel; |
| 1432 | } |
| 1433 | |
| 1434 | if (info.done) { |
| 1435 | // Assign the result of the finished delegate to the temporary |
| 1436 | // variable specified by delegate.resultName (see delegateYield). |
| 1437 | context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). |
| 1438 | |
| 1439 | context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the |
| 1440 | // exception, let the outer generator proceed normally. If |
| 1441 | // context.method was "next", forget context.arg since it has been |
| 1442 | // "consumed" by the delegate iterator. If context.method was |
| 1443 | // "return", allow the original .return call to continue in the |
| 1444 | // outer generator. |
| 1445 | |
| 1446 | if (context.method !== "return") { |
| 1447 | context.method = "next"; |
| 1448 | context.arg = undefined; |
| 1449 | } |
| 1450 | } else { |
| 1451 | // Re-yield the result returned by the delegate method. |
| 1452 | return info; |
| 1453 | } // The delegate iterator is finished, so forget it and continue with |
| 1454 | // the outer generator. |
| 1455 | |
| 1456 | |
| 1457 | context.delegate = null; |
| 1458 | return ContinueSentinel; |
| 1459 | } // Define Generator.prototype.{next,throw,return} in terms of the |
| 1460 | // unified ._invoke helper method. |
| 1461 | |
| 1462 | |
| 1463 | defineIteratorMethods(Gp); |
| 1464 | Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the |
| 1465 | // @@iterator function is called on it. Some browsers' implementations of the |
| 1466 | // iterator prototype chain incorrectly implement this, causing the Generator |
| 1467 | // object to not be returned from this call. This ensures that doesn't happen. |
| 1468 | // See https://github.com/facebook/regenerator/issues/274 for more details. |
| 1469 | |
| 1470 | Gp[iteratorSymbol] = function () { |
| 1471 | return this; |
| 1472 | }; |
| 1473 | |
| 1474 | Gp.toString = function () { |
| 1475 | return "[object Generator]"; |
| 1476 | }; |
| 1477 | |
| 1478 | function pushTryEntry(locs) { |
| 1479 | var entry = { |
| 1480 | tryLoc: locs[0] |
| 1481 | }; |
| 1482 | |
| 1483 | if (1 in locs) { |
| 1484 | entry.catchLoc = locs[1]; |
| 1485 | } |
| 1486 | |
| 1487 | if (2 in locs) { |
| 1488 | entry.finallyLoc = locs[2]; |
| 1489 | entry.afterLoc = locs[3]; |
| 1490 | } |
| 1491 | |
| 1492 | this.tryEntries.push(entry); |
| 1493 | } |
| 1494 | |
| 1495 | function resetTryEntry(entry) { |
| 1496 | var record = entry.completion || {}; |
| 1497 | record.type = "normal"; |
| 1498 | delete record.arg; |
| 1499 | entry.completion = record; |
| 1500 | } |
| 1501 | |
| 1502 | function Context(tryLocsList) { |
| 1503 | // The root entry object (effectively a try statement without a catch |
| 1504 | // or a finally block) gives us a place to store values thrown from |
| 1505 | // locations where there is no enclosing try statement. |
| 1506 | this.tryEntries = [{ |
| 1507 | tryLoc: "root" |
| 1508 | }]; |
| 1509 | tryLocsList.forEach(pushTryEntry, this); |
| 1510 | this.reset(true); |
| 1511 | } |
| 1512 | |
| 1513 | exports.keys = function (object) { |
| 1514 | var keys = []; |
| 1515 | |
| 1516 | for (var key in object) { |
| 1517 | keys.push(key); |
| 1518 | } |
| 1519 | |
| 1520 | keys.reverse(); // Rather than returning an object with a next method, we keep |
| 1521 | // things simple and return the next function itself. |
| 1522 | |
| 1523 | return function next() { |
| 1524 | while (keys.length) { |
| 1525 | var key = keys.pop(); |
| 1526 | |
| 1527 | if (key in object) { |
| 1528 | next.value = key; |
| 1529 | next.done = false; |
| 1530 | return next; |
| 1531 | } |
| 1532 | } // To avoid creating an additional object, we just hang the .value |
| 1533 | // and .done properties off the next function object itself. This |
| 1534 | // also ensures that the minifier will not anonymize the function. |
| 1535 | |
| 1536 | |
| 1537 | next.done = true; |
| 1538 | return next; |
| 1539 | }; |
| 1540 | }; |
| 1541 | |
| 1542 | function values(iterable) { |
| 1543 | if (iterable) { |
| 1544 | var iteratorMethod = iterable[iteratorSymbol]; |
| 1545 | |
| 1546 | if (iteratorMethod) { |
| 1547 | return iteratorMethod.call(iterable); |
| 1548 | } |
| 1549 | |
| 1550 | if (typeof iterable.next === "function") { |
| 1551 | return iterable; |
| 1552 | } |
| 1553 | |
| 1554 | if (!isNaN(iterable.length)) { |
| 1555 | var i = -1, |
| 1556 | next = function next() { |
| 1557 | while (++i < iterable.length) { |
| 1558 | if (hasOwn.call(iterable, i)) { |
| 1559 | next.value = iterable[i]; |
| 1560 | next.done = false; |
| 1561 | return next; |
| 1562 | } |
| 1563 | } |
| 1564 | |
| 1565 | next.value = undefined; |
| 1566 | next.done = true; |
| 1567 | return next; |
| 1568 | }; |
| 1569 | |
| 1570 | return next.next = next; |
| 1571 | } |
| 1572 | } // Return an iterator with no values. |
| 1573 | |
| 1574 | |
| 1575 | return { |
| 1576 | next: doneResult |
| 1577 | }; |
| 1578 | } |
| 1579 | |
| 1580 | exports.values = values; |
| 1581 | |
| 1582 | function doneResult() { |
| 1583 | return { |
| 1584 | value: undefined, |
| 1585 | done: true |
| 1586 | }; |
| 1587 | } |
| 1588 | |
| 1589 | Context.prototype = { |
| 1590 | constructor: Context, |
| 1591 | reset: function reset(skipTempReset) { |
| 1592 | this.prev = 0; |
| 1593 | this.next = 0; // Resetting context._sent for legacy support of Babel's |
| 1594 | // function.sent implementation. |
| 1595 | |
| 1596 | this.sent = this._sent = undefined; |
| 1597 | this.done = false; |
| 1598 | this.delegate = null; |
| 1599 | this.method = "next"; |
| 1600 | this.arg = undefined; |
| 1601 | this.tryEntries.forEach(resetTryEntry); |
| 1602 | |
| 1603 | if (!skipTempReset) { |
| 1604 | for (var name in this) { |
| 1605 | // Not sure about the optimal order of these conditions: |
| 1606 | if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { |
| 1607 | this[name] = undefined; |
| 1608 | } |
| 1609 | } |
| 1610 | } |
| 1611 | }, |
| 1612 | stop: function stop() { |
| 1613 | this.done = true; |
| 1614 | var rootEntry = this.tryEntries[0]; |
| 1615 | var rootRecord = rootEntry.completion; |
| 1616 | |
| 1617 | if (rootRecord.type === "throw") { |
| 1618 | throw rootRecord.arg; |
| 1619 | } |
| 1620 | |
| 1621 | return this.rval; |
| 1622 | }, |
| 1623 | dispatchException: function dispatchException(exception) { |
| 1624 | if (this.done) { |
| 1625 | throw exception; |
| 1626 | } |
| 1627 | |
| 1628 | var context = this; |
| 1629 | |
| 1630 | function handle(loc, caught) { |
| 1631 | record.type = "throw"; |
| 1632 | record.arg = exception; |
| 1633 | context.next = loc; |
| 1634 | |
| 1635 | if (caught) { |
| 1636 | // If the dispatched exception was caught by a catch block, |
| 1637 | // then let that catch block handle the exception normally. |
| 1638 | context.method = "next"; |
| 1639 | context.arg = undefined; |
| 1640 | } |
| 1641 | |
| 1642 | return !!caught; |
| 1643 | } |
| 1644 | |
| 1645 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 1646 | var entry = this.tryEntries[i]; |
| 1647 | var record = entry.completion; |
| 1648 | |
| 1649 | if (entry.tryLoc === "root") { |
| 1650 | // Exception thrown outside of any try block that could handle |
| 1651 | // it, so set the completion value of the entire function to |
| 1652 | // throw the exception. |
| 1653 | return handle("end"); |
| 1654 | } |
| 1655 | |
| 1656 | if (entry.tryLoc <= this.prev) { |
| 1657 | var hasCatch = hasOwn.call(entry, "catchLoc"); |
| 1658 | var hasFinally = hasOwn.call(entry, "finallyLoc"); |
| 1659 | |
| 1660 | if (hasCatch && hasFinally) { |
| 1661 | if (this.prev < entry.catchLoc) { |
| 1662 | return handle(entry.catchLoc, true); |
| 1663 | } else if (this.prev < entry.finallyLoc) { |
| 1664 | return handle(entry.finallyLoc); |
| 1665 | } |
| 1666 | } else if (hasCatch) { |
| 1667 | if (this.prev < entry.catchLoc) { |
| 1668 | return handle(entry.catchLoc, true); |
| 1669 | } |
| 1670 | } else if (hasFinally) { |
| 1671 | if (this.prev < entry.finallyLoc) { |
| 1672 | return handle(entry.finallyLoc); |
| 1673 | } |
| 1674 | } else { |
| 1675 | throw new Error("try statement without catch or finally"); |
| 1676 | } |
| 1677 | } |
| 1678 | } |
| 1679 | }, |
| 1680 | abrupt: function abrupt(type, arg) { |
| 1681 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 1682 | var entry = this.tryEntries[i]; |
| 1683 | |
| 1684 | if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { |
| 1685 | var finallyEntry = entry; |
| 1686 | break; |
| 1687 | } |
| 1688 | } |
| 1689 | |
| 1690 | if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { |
| 1691 | // Ignore the finally entry if control is not jumping to a |
| 1692 | // location outside the try/catch block. |
| 1693 | finallyEntry = null; |
| 1694 | } |
| 1695 | |
| 1696 | var record = finallyEntry ? finallyEntry.completion : {}; |
| 1697 | record.type = type; |
| 1698 | record.arg = arg; |
| 1699 | |
| 1700 | if (finallyEntry) { |
| 1701 | this.method = "next"; |
| 1702 | this.next = finallyEntry.finallyLoc; |
| 1703 | return ContinueSentinel; |
| 1704 | } |
| 1705 | |
| 1706 | return this.complete(record); |
| 1707 | }, |
| 1708 | complete: function complete(record, afterLoc) { |
| 1709 | if (record.type === "throw") { |
| 1710 | throw record.arg; |
| 1711 | } |
| 1712 | |
| 1713 | if (record.type === "break" || record.type === "continue") { |
| 1714 | this.next = record.arg; |
| 1715 | } else if (record.type === "return") { |
| 1716 | this.rval = this.arg = record.arg; |
| 1717 | this.method = "return"; |
| 1718 | this.next = "end"; |
| 1719 | } else if (record.type === "normal" && afterLoc) { |
| 1720 | this.next = afterLoc; |
| 1721 | } |
| 1722 | |
| 1723 | return ContinueSentinel; |
| 1724 | }, |
| 1725 | finish: function finish(finallyLoc) { |
| 1726 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 1727 | var entry = this.tryEntries[i]; |
| 1728 | |
| 1729 | if (entry.finallyLoc === finallyLoc) { |
| 1730 | this.complete(entry.completion, entry.afterLoc); |
| 1731 | resetTryEntry(entry); |
| 1732 | return ContinueSentinel; |
| 1733 | } |
| 1734 | } |
| 1735 | }, |
| 1736 | "catch": function _catch(tryLoc) { |
| 1737 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 1738 | var entry = this.tryEntries[i]; |
| 1739 | |
| 1740 | if (entry.tryLoc === tryLoc) { |
| 1741 | var record = entry.completion; |
| 1742 | |
| 1743 | if (record.type === "throw") { |
| 1744 | var thrown = record.arg; |
| 1745 | resetTryEntry(entry); |
| 1746 | } |
| 1747 | |
| 1748 | return thrown; |
| 1749 | } |
| 1750 | } // The context.catch method must only be called with a location |
| 1751 | // argument that corresponds to a known catch block. |
| 1752 | |
| 1753 | |
| 1754 | throw new Error("illegal catch attempt"); |
| 1755 | }, |
| 1756 | delegateYield: function delegateYield(iterable, resultName, nextLoc) { |
| 1757 | this.delegate = { |
| 1758 | iterator: values(iterable), |
| 1759 | resultName: resultName, |
| 1760 | nextLoc: nextLoc |
| 1761 | }; |
| 1762 | |
| 1763 | if (this.method === "next") { |
| 1764 | // Deliberately forget the last sent value so that we don't |
| 1765 | // accidentally pass it on to the delegate. |
| 1766 | this.arg = undefined; |
| 1767 | } |
| 1768 | |
| 1769 | return ContinueSentinel; |
| 1770 | } |
| 1771 | }; // Regardless of whether this script is executing as a CommonJS module |
| 1772 | // or not, return the runtime object so that we can declare the variable |
| 1773 | // regeneratorRuntime in the outer scope, which allows this module to be |
| 1774 | // injected easily by `bin/regenerator --include-runtime script.js`. |
| 1775 | |
| 1776 | return exports; |
| 1777 | }( // If this script is executing as a CommonJS module, use module.exports |
| 1778 | // as the regeneratorRuntime namespace. Otherwise create a new empty |
| 1779 | // object. Either way, the resulting object will be used to initialize |
| 1780 | // the regeneratorRuntime variable at the top of this file. |
| 1781 | ( false ? undefined : _typeof(module)) === "object" ? module.exports : {}); |
| 1782 | |
| 1783 | try { |
| 1784 | regeneratorRuntime = runtime; |
| 1785 | } catch (accidentalStrictMode) { |
| 1786 | // This module should not be running in strict mode, so the above |
| 1787 | // assignment should always work unless something is misconfigured. Just |
| 1788 | // in case runtime.js accidentally runs in strict mode, we can escape |
| 1789 | // strict mode using a global Function call. This could conceivably fail |
| 1790 | // if a Content Security Policy forbids using Function, but in that case |
| 1791 | // the proper solution is to fix the accidental strict mode problem. If |
| 1792 | // you've misconfigured your bundler to force strict mode and applied a |
| 1793 | // CSP to forbid Function, and you're not willing to fix either of those |
| 1794 | // problems, please detail your unique predicament in a GitHub issue. |
| 1795 | Function("r", "regeneratorRuntime = r")(runtime); |
| 1796 | } |
| 1797 | /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) |
| 1798 | |
| 1799 | /***/ }), |
| 1800 | |
| 1801 | /***/ "./node_modules/webpack/buildin/module.js": |
| 1802 | /*!***********************************!*\ |
| 1803 | !*** (webpack)/buildin/module.js ***! |
| 1804 | \***********************************/ |
| 1805 | /*! no static exports found */ |
| 1806 | /***/ (function(module, exports) { |
| 1807 | |
| 1808 | module.exports = function (module) { |
| 1809 | if (!module.webpackPolyfill) { |
| 1810 | module.deprecate = function () {}; |
| 1811 | |
| 1812 | module.paths = []; // module.parent = undefined by default |
| 1813 | |
| 1814 | if (!module.children) module.children = []; |
| 1815 | Object.defineProperty(module, "loaded", { |
| 1816 | enumerable: true, |
| 1817 | get: function get() { |
| 1818 | return module.l; |
| 1819 | } |
| 1820 | }); |
| 1821 | Object.defineProperty(module, "id", { |
| 1822 | enumerable: true, |
| 1823 | get: function get() { |
| 1824 | return module.i; |
| 1825 | } |
| 1826 | }); |
| 1827 | module.webpackPolyfill = 1; |
| 1828 | } |
| 1829 | |
| 1830 | return module; |
| 1831 | }; |
| 1832 | |
| 1833 | /***/ }) |
| 1834 | |
| 1835 | /******/ }); |
| 1836 | //# sourceMappingURL=scripts.js.map |