(()=>{"use strict";var i={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return i.d(e,{a:e}),e},d:(o,e)=>{for(var t in e)i.o(e,t)&&!i.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:e[t]})},o:(i,o)=>Object.prototype.hasOwnProperty.call(i,o)};const o=window.jQuery;var e=i.n(o);const t=window.wp.apiFetch;var n=i.n(t);e()(i=>{i(document).on("click",".notice.is-dismissible.wc-affiliate-migrate button.notice-dismiss",i=>{i.preventDefault(),n()({path:"/wc-affiliate/v1/notices/dismiss",method:"POST",data:{notice_type:"wc_affiliate_migration"}})}),i(document).on("click",".resolve-dependency.button.button-primary",function(o){o.preventDefault();const e=i(this);e.text("Loading..").prop("disabled",!0),n()({path:"/wc-affiliate/v1/notices/resolve-dependency",method:"POST"}).then(i=>{i&&(e.text("Plugin Activated").prop("disabled",!1),setTimeout(()=>{location.reload()},2e3))}).catch(()=>{e.text("Activation Failed").prop("disabled",!1),setTimeout(()=>{location.reload()},2e3)})}),i(document).on("change",".affiliate_commission, .wf-variation-commission-type",function(){const o=i(this).closest(".wf-affiliate_commission");"custom"===i(this).val()?(i(".commission_type_field, .commission_amount_field",o).slideDown(),i(".wf-variation-commission-type-panel, .wf-variation-commission-amount-panel",o).slideDown()):(i(".commission_type_field, .commission_amount_field",o).slideUp(),i(".wf-variation-commission-type-panel, .wf-variation-commission-amount-panel",o).slideUp())}).change();const o=i(".affiliate_commission, .wf-variation-commission-type");o.length>0&&o.change(),i(document).ajaxComplete(()=>{const o=i(".affiliate_commission, .wf-variation-commission-type");if(o.length>0){const e=o.closest(".wf-affiliate_commission");"custom"===o.val()&&(i(".commission_type_field, .commission_amount_field",e).slideDown(),i(".wf-variation-commission-type-panel, .wf-variation-commission-amount-panel",e).slideDown())}})})})();