!function(){const e=e=>{const t=new URLSearchParams;for(const n in e)if(e.hasOwnProperty(n)){const o=e[n];Array.isArray(o)?o.forEach(e=>t.append(n+"[]",e)):t.append(n,o)}return fetch(ajaxurl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:t.toString()}).then(e=>e.json())},t=(e,t)=>{e&&e.classList.toggle("is-active",Boolean(t))},n=(e,t="success")=>{const n=document.createElement("div"),o={success:"notice notice-success is-dismissible",error:"notice notice-error is-dismissible",info:"notice notice-info is-dismissible"};n.className=o[t]||o.success;const r=document.createElement("p");r.textContent=e,n.appendChild(r);const s=document.querySelector(".content-wrapper > h1");s&&s.parentNode.insertBefore(n,s.nextSibling)};document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".responsive-lightbox-settings input.reset-responsive-lightbox-settings").forEach(e=>{e.addEventListener("click",e=>{confirm(rlArgsAdmin.resetSettingsToDefaults)||e.preventDefault()})}),document.addEventListener("click",o=>{const r=o.target instanceof Element?o.target:o.target.parentElement;if(!r||!r.closest("#rl-folders-load-old-taxonomies"))return;o.preventDefault();const s=document.getElementById("rl-folders-media-taxonomy"),a=s?s.parentElement.querySelector(".spinner"):null;if(!s)return;const i=Array.from(s.options).map(e=>e.value),c=new Set(i);t(a,!0),e({action:"rl-folders-load-old-taxonomies",taxonomies:i,nonce:rlArgsAdmin.taxNonce}).then(e=>{try{if(e.success){const t=e.data&&Array.isArray(e.data.taxonomies)?e.data.taxonomies:[];let o=0;t.forEach(e=>{if(c.has(e))return;const t=document.createElement("option");t.value=e,t.textContent=e,s.appendChild(t),c.add(e),o++});const r=s.options.length>0,a=e.data&&Number(e.data.count)>0;if(s.disabled=!(r||a),e.data&&e.data.message){const t=a?"success":"info";n(e.data.message,t)}}else{const t=e.data&&e.data.message?e.data.message:rlArgsAdmin.errorLoadingTaxonomies;n(t,"error")}}catch(t){console.error("Error processing taxonomies:",t),n(rlArgsAdmin.errorProcessingTaxonomies,"error")}}).catch(e=>{console.error("AJAX error:",e),n(rlArgsAdmin.errorLoadingTaxonomies,"error")}).finally(()=>{t(a,!1)})}),(()=>{const e=document.querySelector('input[name="responsive_lightbox_folders[folders_source]"][value="custom_taxonomy"]'),t=document.getElementById("rl-folders-media-taxonomy");e&&t&&e.checked&&t.disabled&&n("Please click the link below to load existing custom taxonomies before selecting one.","info")})(),(()=>{const t=document.getElementById("rl-addons-feed");if(!t||"1"===t.dataset.loaded)return;const n=t.dataset.nonce||"",o=t.dataset.errorMessage||"There was an error retrieving the extensions list from the server. Please try again later.";e({action:"rl-get-addons-feed",nonce:n}).then(e=>{e&&e.success&&e.data&&e.data.html?(t.innerHTML=e.data.html,t.dataset.loaded="1"):e&&e.data&&e.data.message?t.innerHTML='<div class="error"><p>'+e.data.message+"</p></div>":t.innerHTML='<div class="error"><p>'+o+"</p></div>"}).catch(()=>{t.innerHTML='<div class="error"><p>'+o+"</p></div>"})})()})}();
