(()=>{"use strict";const t=window.wp.data;let e=!1;(0,t.subscribe)((()=>{if(e)return;if(!seopressPostWatcherData.noticeData)return;const s=wp.data.select("core/editor"),i=seopressPostWatcherData.noticeData||[],a={message:i?.message?i.message:"",options:{id:"redirection-notice",isDismissible:!0,actions:[{label:i?.actionLabel||"",onClick:()=>{const t=window.open(i?.actionUrl||"","_blank");t&&t.focus()},variant:"primary"}]}},o=()=>{e||a.message&&(e=!0,(0,t.dispatch)("core/notices").createWarningNotice(a.message,a.options))};if(i&&i.displayOnLoad&&o(),s.isSavingPost()&&!s.isAutosavingPost()){const t=s.getCurrentPost()?.link,e=s.getPermalink(),a=s.getCurrentPost().slug,n=s.getEditedPostSlug(),r=s.getEditedPostAttribute("status");if(!a)return;if(["draft","auto-draft"].includes(r))return;if(a!==n){const s=URL.parse(t),a=URL.parse(e);if(a&&s){const t=s.pathname.replace(/^\/+/,"");i.actionUrl=function(t,e,s){const[i,a=""]=t.split("#"),o=new URL(i,window.location.origin);return e&&o.searchParams.set("seopress_prefill_origin",e),s&&o.searchParams.set("seopress_prefill_destination",s),o.pathname+o.search+(a?"#"+a:"")}(i.actionUrl,t,a.toString())}o()}}}))})();