(()=>{"use strict";const e=window.wp.plugins,t=window.wp.editPost,i=window.wp.element,n=window.wp.i18n,s=window.wp.compose,o=window.wp.data,l=window.wp.components,c="newspack-post-subtitle-element",w="newspack_post_subtitle",u=(0,o.withSelect)((e=>({subtitle:e("core/editor").getEditedPostAttribute("meta")[w]}))),a=window.ReactJSXRuntime,p=(0,s.compose)(u,(0,o.withDispatch)((e=>({saveSubtitle:t=>{e("core/editor").editPost({meta:{[w]:t}})}}))))((({subtitle:e,saveSubtitle:t})=>{const[n,s]=(0,i.useState)(e);return(0,i.useEffect)((()=>{t(n)}),[n]),(0,a.jsx)(l.TextareaControl,{value:n,onChange:s,style:{marginTop:"10px",width:"100%"}})}));(0,e.registerPlugin)("plugin-document-setting-panel-newspack-subtitle",{render:u((({subtitle:e})=>((0,i.useEffect)((()=>{(e=>{const t=document.querySelector(".edit-post-visual-editor__post-title-wrapper");if(t&&"string"==typeof e){let i=document.getElementById(c);const n=t.parentNode;i||(i=document.createElement("div"),i.id=c,n.insertBefore(i,t.nextSibling)),i.innerHTML=e}})(e)}),[e]),(0,a.jsxs)(t.PluginDocumentSettingPanel,{name:"newspack-subtitle",title:(0,n.__)("Article Subtitle","newspack"),className:"newspack-subtitle",children:[(0,n.__)("Set a Subtitle for the Article","newspack"),(0,a.jsx)(p,{})]})))),icon:null})})();