(()=>{"use strict";const e=window.wp.i18n;!function(t){let s=!1,l="";t(window).load((function(){const d=document.getElementById("feed-validation-message"),n=document.getElementById("rss-submit-button"),a=document.getElementById("rss-submit-button-js"),o=document.getElementById("pf_feedlist-single"),r=e=>{a&&(a.style.display=e?"block":"none")},u=t=>{n.value=t||(0,e.__)("Submit","pressforward")};n&&(u((0,e.__)("Check Feed","pressforward")),t(n).click((function(a){a.preventDefault(),t(d).html(""),n.disabled=!0,s=!0,u((0,e.__)("Validating...","pressforward")),t.ajax({url:ajaxurl,method:"POST",data:{action:"pf_validate_feed",feedUrl:o.value},success:a=>{s=!1,n.disabled=!1;const{feedUrl:i,message:c,rawUrl:f}=a.data;let p=c;i.length>0&&f!==o.value&&(p+='&nbsp;<button class="accept-suggested-feed-url button button-secondary">'+(0,e.__)("Use detected URL","pressforward")+"</button>",l=i),t(d).html(p),u((0,e.__)("Check Feed","pressforward")),a.success?r(!0):r(!1)}})})),r(!1)),t(d).on("click",".accept-suggested-feed-url",(function(e){e.preventDefault(),t(o).val(l)})),t(".pf_primary_media_opml_upload").click((function(t){t.preventDefault();var s=wp.media({title:(0,e.__)("Upload .OPML or .XML","pressforward"),button:{text:(0,e.__)("Add to Subscription list","pressforward")},multiple:!1}).on("select",(function(){var e=s.state().get("selection").first().toJSON();jQuery(".pf_opml_file_upload_field").val(e.url)})).open();return!1}))}))}(jQuery)})();