(()=>{"use strict";const e=window.wp.plugins,t=window.wp.editPost,a=window.wp.i18n,s=window.wp.compose,i=window.wp.data,n=window.wp.element,o=window.wp.components,r="newspack_article_summary",m="newspack_article_summary_title",c=(0,i.withSelect)((e=>({summary:e("core/editor").getEditedPostAttribute("meta")[r],summaryTitle:e("core/editor").getEditedPostAttribute("meta")[m],mode:e("core/edit-post").getEditorMode()}))),w=window.ReactJSXRuntime,l=(0,s.compose)(c,(0,i.withDispatch)((e=>({saveSummary:t=>{e("core/editor").editPost({meta:{[r]:t}})}}))))((({summary:e,saveSummary:t})=>{const[s,i]=(0,n.useState)(e);return(0,n.useEffect)((()=>{t(s)}),[s]),(0,w.jsx)(o.TextareaControl,{label:(0,a.__)("Body:","newspack"),value:s,onChange:i,style:{width:"100%"}})})),u=(0,s.compose)(c,(0,i.withDispatch)((e=>({saveSummaryTitle:t=>{e("core/editor").editPost({meta:{[m]:t}})}}))))((({summaryTitle:e,saveSummaryTitle:t})=>{const[s,i]=(0,n.useState)(e);return(0,n.useEffect)((()=>{t(s)}),[s]),(0,w.jsx)(o.TextControl,{label:(0,a.__)("Title:","newspack"),value:s,onChange:i,style:{width:"100%"}})}));(0,e.registerPlugin)("plugin-document-setting-panel-newspack-summary",{render:c((()=>(0,w.jsxs)(t.PluginDocumentSettingPanel,{name:"newspack-summary",title:(0,a.__)("Article Summary","newspack"),className:"newspack-summary",children:[(0,w.jsx)("p",{children:(0,a.__)("Write a summary that will be appended to the top of the article content.","newspack")}),(0,w.jsx)(u,{}),(0,w.jsx)(l,{})]}))),icon:null})})();