(()=>{function e(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info";document.querySelectorAll(".flux-media-optimizer-notice").forEach(function(e){return e.remove()});var t=document.createElement("div");t.className="flux-media-optimizer-notice notice notice-".concat(n," is-dismissible"),t.style.cssText="position: fixed; top: 32px; right: 20px; z-index: 999999; max-width: 400px;";var o=document.createElement("p");o.textContent=e,t.appendChild(o);var i=document.createElement("button");i.type="button",i.className="notice-dismiss",i.innerHTML='<span class="screen-reader-text">Dismiss this notice.</span>',i.onclick=function(){return t.remove()},t.appendChild(i),document.body.appendChild(t),setTimeout(function(){t.parentNode&&t.remove()},5e3)}window.fluxMediaConvertAttachment=function(n){if(n){var t=event.target,o=t.textContent;t.disabled=!0,t.textContent="Converting...";var i={action:"flux_media_optimizer_convert_attachment",attachment_id:n,nonce:fluxMediaAdmin.convertNonce};fetch(fluxMediaAdmin.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(i)}).then(function(e){return e.json()}).then(function(n){n.success?(e("Conversion completed successfully!","success"),setTimeout(function(){window.location.reload()},1500)):e("Conversion failed: "+(n.data||"Unknown error"),"error")}).catch(function(n){e("Conversion failed: Network error","error")}).finally(function(){t.disabled=!1,t.textContent=o})}else alert("Invalid attachment ID")},window.fluxMediaDisableConversion=function(n){if(n){if(confirm("Are you sure you want to disable conversion for this attachment? This will prevent it from being processed in future bulk operations.")){var t=event.target,o=t.textContent;t.disabled=!0,t.textContent="Disabling...";var i={action:"flux_media_optimizer_disable_conversion",attachment_id:n,nonce:fluxMediaAdmin.disableNonce};fetch(fluxMediaAdmin.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(i)}).then(function(e){return e.json()}).then(function(n){n.success?(e("Conversion disabled successfully!","success"),setTimeout(function(){window.location.reload()},1500)):e("Failed to disable conversion: "+(n.data||"Unknown error"),"error")}).catch(function(n){e("Failed to disable conversion: Network error","error")}).finally(function(){t.disabled=!1,t.textContent=o})}}else alert("Invalid attachment ID")},window.fluxMediaEnableConversion=function(n){if(n){var t=event.target,o=t.textContent;t.disabled=!0,t.textContent="Enabling...";var i={action:"flux_media_optimizer_enable_conversion",attachment_id:n,nonce:fluxMediaAdmin.enableNonce};fetch(fluxMediaAdmin.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(i)}).then(function(e){return e.json()}).then(function(n){n.success?(e("Conversion enabled successfully!","success"),setTimeout(function(){window.location.reload()},1500)):e("Failed to enable conversion: "+(n.data||"Unknown error"),"error")}).catch(function(n){e("Failed to enable conversion: Network error","error")}).finally(function(){t.disabled=!1,t.textContent=o})}else alert("Invalid attachment ID")}})();
//# sourceMappingURL=attachment.bundle.js.map