!function(){"use strict";var t,e={415:function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e,i){for(var n=0;n<i.length;n++){var o=i[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,a=function(e,i){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===t(a)?a:String(a)),o)}var a}var i={unclear_how_to_use:["io_text_field_unclear","io_unclear_details"],switched_solution:["io_text_field_switched","io_switched_details"],other:["io_text_field_other","io_other_details"]},n=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.deactivationLink=document.querySelector('[id*="deactivate-image-optimizer"], [id*="deactivate-image-optimization"]'),this.deactivationLink&&(this.originalDeactivationLink=this.deactivationLink.getAttribute("href"),this.init())}var n,o;return n=t,(o=[{key:"modal",value:function(t,e,i){var n,o;null===(n=(o=window).tb_show)||void 0===n||n.call(o,t,e),setTimeout((function(){var t;return null===(t=document.getElementById("TB_window"))||void 0===t?void 0:t.classList.add(i)}),5)}},{key:"hideFields",value:function(){document.querySelectorAll(".image-optimization-feedback-text-field").forEach((function(t){return t.classList.add("text-field-hidden")}))}},{key:"toggleField",value:function(t){var e;this.hideFields();var n=null===(e=i[t])||void 0===e?void 0:e[0];n&&document.getElementById(n).classList.remove("text-field-hidden")}},{key:"sendRequest",value:function(t,e){var i;fetch((null===(i=window)||void 0===i||null===(i=i.imageOptimizationDeactivationFeedback)||void 0===i?void 0:i.ajaxurl)||"",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t)}).finally(e)}},{key:"handleSubmit",value:function(){var t,e,n,o,a=this,r=null===(t=document.querySelector('input[name="image_optimization_deactivation_reason"]:checked'))||void 0===t?void 0:t.value,d=null===(e=i[r])||void 0===e?void 0:e[1],l=d&&(null===(n=document.getElementById(d))||void 0===n?void 0:n.value)||"";r?this.sendRequest({action:"image_optimization_deactivation_feedback",reason:r,additional_data:l,nonce:(null===(o=window)||void 0===o||null===(o=o.imageOptimizationDeactivationFeedback)||void 0===o?void 0:o.nonce)||""},(function(){return a.deactivate()})):this.deactivate()}},{key:"deactivate",value:function(){var t,e;null===(t=(e=window).tb_remove)||void 0===t||t.call(e),window.location.href=this.originalDeactivationLink}},{key:"init",value:function(){var t=this;this.deactivationLink.addEventListener("click",(function(e){e.preventDefault(),t.hideFields(),t.modal("QUICK FEEDBACK","#TB_inline?width=550&height=auto&inlineId=image-optimization-deactivation-modal","image-optimization-feedback-thickbox")})),document.addEventListener("change",(function(e){var i;"image_optimization_deactivation_reason"===(null===(i=e.target)||void 0===i?void 0:i.name)&&t.toggleField(e.target.value)})),document.addEventListener("click",(function(e){var i,n;"image-optimization-submit-deactivate"===(null===(i=e.target)||void 0===i?void 0:i.id)&&(e.preventDefault(),t.handleSubmit()),"image-optimization-skip-deactivate"===(null===(n=e.target)||void 0===n?void 0:n.id)&&(e.preventDefault(),t.deactivate())}))}}])&&e(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),t}();document.addEventListener("DOMContentLoaded",(function(){return new n}))}},i={};function n(t){var o=i[t];if(void 0!==o)return o.exports;var a=i[t]={exports:{}};return e[t](a,a.exports,n),a.exports}n.m=e,t=[],n.O=function(e,i,o,a){if(!i){var r=1/0;for(c=0;c<t.length;c++){i=t[c][0],o=t[c][1],a=t[c][2];for(var d=!0,l=0;l<i.length;l++)(!1&a||r>=a)&&Object.keys(n.O).every((function(t){return n.O[t](i[l])}))?i.splice(l--,1):(d=!1,a<r&&(r=a));if(d){t.splice(c--,1);var u=o();void 0!==u&&(e=u)}}return e}a=a||0;for(var c=t.length;c>0&&t[c-1][2]>a;c--)t[c]=t[c-1];t[c]=[i,o,a]},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){var t={742:0,130:0};n.O.j=function(e){return 0===t[e]};var e=function(e,i){var o,a,r=i[0],d=i[1],l=i[2],u=0;if(r.some((function(e){return 0!==t[e]}))){for(o in d)n.o(d,o)&&(n.m[o]=d[o]);if(l)var c=l(n)}for(e&&e(i);u<r.length;u++)a=r[u],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0;return n.O(c)},i=self.webpackChunkimage_optimization=self.webpackChunkimage_optimization||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))}();var o=n.O(void 0,[130],(function(){return n(415)}));o=n.O(o)}();