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