(()=>{"use strict";var e={567:e=>{e.exports=window.jQuery},736:e=>{e.exports=window.wp.i18n}},n={};function r(o){var a=n[o];if(void 0!==a)return a.exports;var t=n[o]={exports:{}};return e[o](t,t.exports,r),t.exports}r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var o in n)r.o(n,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e=r(736),n=r(567),o=r.n(n);const _n=e._n,__=e.__,{ajaxUrl:a,connectionsUrl:t,isEnhancedPublishingEnabled:s}=window.jetpackSocialClassicEditorOptions,i=["instagram-business"],c=(e,n)=>{const r=window.wp.media.featuredImage.get(),o=r&&-1!==r,a=e("#pub-connection-needs-media"),t=!!a.html();if(o!==t)return;if(n.forEach((n=>{e(".wpas-submit-"+n).each(((n,r)=>{const a=e(r);a.prop("disabled")||o||a.data("checkedVal",a.prop("checked")),a.prop("checked",o&&a.data("checkedVal")),a.prop("disabled",!o)}))})),o)return void a.removeClass().html("");const i=s?/* translators: %s is the link to the media upload best practices. */__('You need a featured image to share to Instagram. Use the block editor for more advanced media features! <a href="%s" rel="noopener noreferrer" target="_blank">Learn more</a>.',"jetpack-publicize-pkg"):/* translators: %s is the link to the media upload best practices. */__('You need a featured image to share to Instagram. <a href="%s" rel="noopener noreferrer" target="_blank">Learn more</a>.',"jetpack-publicize-pkg",0);a.addClass("notice-warning publicize__notice-media-warning publicize__notice-warning").append(i.replace("%s","https://jetpack.com/redirect/?source=jetpack-social-media-support-information"))};o()((function(e){const n=i.filter((n=>e(".wpas-submit-"+n).length));if(n.length>0){c(e,n);const r=window.wp.media.featuredImage.set;window.wp.media.featuredImage.set=function(o){r(o),c(e,n)}}let r=!1;const o=function(){r||(e.post(a,{action:"test_publicize_conns"},d),r=!0)};let s;window.addEventListener("focus",(()=>{s&&clearTimeout(s),s=setTimeout(o,2e3)}));const p=(n,r)=>r.data?r.data.reduce(((r,o)=>o.connectionTestPassed||n!==(o.connectionTestErrorCode??"broken")?r:(e("#wpas-submit-"+o.id).prop("checked",!1).prop("disabled",!0),r+1)),0):0,d=function(n){r=!1;const o=e("#pub-connection-tests");o.removeClass("test-in-progress").removeClass("below-h2").removeClass("error").removeClass("publicize-token-refresh-message").html("");const a=p("broken",n),s=p("unsupported",n);if(a){
/* translators: %s is the link to the connections page in Calypso */
const e=_n('One of your social connections is broken. Reconnect it on the <a href="%s" rel="noopener noreferrer" target="_blank">connection management</a> page.','Some of your social connections are broken. Reconnect them on the <a href="%s" rel="noopener noreferrer" target="_blank">connection management</a> page.',a,"jetpack-publicize-pkg");o.addClass("below-h2").addClass("error").addClass("publicize-token-refresh-message").append(e.replace("%s",t))}if(s){
/* translators: %s is the link to the connections page in Calypso */
const e=__('Twitter is not supported anymore. <a href="%s" rel="noopener noreferrer" target="_blank">Learn more</a>.',"jetpack-publicize-pkg");a?o.append("<hr />"):o.addClass("below-h2").addClass("error").addClass("publicize-token-refresh-message"),o.append(e.replace("%s",t))}};e("#pub-connection-tests").length&&o()}))})()})();