;(()=>{"use strict";(t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})({});var t,e=(t=window.jQuery,{setupColorPicker:function(e){e.find(".thpladmin-colorpick").iris({change:function(e,i){t(this).parent().find(".thpladmin-colorpickpreview").css({backgroundColor:i.color.toString()})},hide:!0,border:!0}).click(function(){t(this).closest(".ccpeaw_settings_fields_form").length>0?(t(".iris-picker").hide(),t(this).closest(".ccpeaw_settings_fields_form").find(".iris-picker").show()):(t(".iris-picker").hide(),t(this).closest("td").find(".iris-picker").show())}),t("body").click(function(){t(".iris-picker").hide()}),t(".thpladmin-colorpick").click(function(t){t.stopPropagation()})}});!function(t,i,o){t(function(){var i=t("#edittag"),o=t("#addtag"),a=t("#advanced_settings_form"),r=t(".ccpeaw-custom-table"),c=t("#thwvs_design_form");e.setupColorPicker(a),e.setupColorPicker(i),e.setupColorPicker(o),e.setupColorPicker(r),e.setupColorPicker(c),t(".th-swatch-option-link").closest("#col-container").addClass("th-attr-container")});var a=ccpeaw_pv_var.placeholder_image;t(o).ajaxComplete(function(o,r,c){if(r&&4===r.readyState&&200===r.status&&c.data&&0<=c.data.indexOf("action=add-tag")){var n=wpAjax.parseAjaxResponse(r.responseXML,"ajax-response");if(!n||n.errors)return;return t(".i_index_media_img").attr("src",a),t(".i_index_media").val(""),t("#product_cat_thumbnail_id").val(""),t(".ccpeaw_remove_image_button").hide(),void t(".ccpeaw_settings_fields_form").find(".thpladmin-colorpickpreview").css("background-color","")}if(r&&4===r.readyState&&200===r.status&&c.data&&0<=c.data.indexOf("action=woocommerce_save_attributes")){var s=i.location.toString();s=s.replace("post-new.php?","post.php?post="+woocommerce_admin_meta_boxes.post_id+"&action=edit&"),t(".thwvs-custom-table"),t("#thwvs-product-attribute-settings").load(s+" #custom_variations_inner",function(){t("#thwvs-product-attribute-settings").trigger("reload"),e.setupColorPicker(t(".th-custom-attr-color-td")),t("#thwvs-product-attribute-settings").trigger("init_tooltips")})}})}(window.jQuery,window,document),jQuery(function(t){var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(t[o]=i[o])}return t};t(".product_attributes").on("click","button.ccpeaw_add_new_attribute",function(o){o.preventDefault(),t(".ccpeaw-class").val("");var a=ccpeaw_pv_var.placeholder_image;t(".i_index_media_img").attr("src",a),t(".thpladmin-colorpickpreview").css("background-color","");var r=t(".ccpeaw-attribte-dialog");r.find("input[type=text]").val(""),r.hasClass("ccpeaw-attribte-dialog-image")&&r.find(".ccpeaw_remove_image_button").hide();var c=t(this).closest(".woocommerce_attribute"),n=c.data("taxonomy"),s=(t(this).data("attr_taxonomy"),t(this).data("attr_type")),d=t(".ccpeaw_settings_fields_form");e.setupColorPicker(d);var l=t(".ccpeaw-attribte-dialog-"+s),p="color"==s?395:250;l.length>0&&(l.dialog({dialogClass:"wp-dialog ccpeaw-popup",title:"Add new term",modal:!0,autoOpen:!1,width:500,minHeight:p,buttons:[{text:"save",class:"button_class",click:function(){!function(e,o,a){var r,c={};if(r=o.find('input[name = "attribute_name"]').val(),c["product_"+a]=o.find('input[name = "attribute_type"]').val(),r){var n=i({action:"woocommerce_add_new_attribute",taxonomy:a,term:r,security:woocommerce_admin_meta_boxes.add_attribute_nonce},c);t.post(woocommerce_admin_meta_boxes.ajax_url,n,function(i){i.error?window.alert(i.error):i.slug&&(e.find("select.attribute_values").append('<option value="'+i.term_id+'" selected="selected">'+i.name+"</option>"),e.find("select.attribute_values").change()),t(".product_attributes").unblock()})}else t(".product_attributes").unblock()}(c,t(this),n),t(this).dialog("close")}}]}),t(".product_attributes").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),l.dialog("open"),t(".product_attributes").unblock(),t(".ui-dialog.ccpeaw-popup").css("z-index",99999999))})})})();