(()=>{"use strict";var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.wp.plugins,o=window.wp.data,r=window.wp.element,n=window.wp.editPost,s=window.wp.i18n,i=window.wp.apiFetch;var d=t.n(i);const a=window.wp.components,p=window.ReactJSXRuntime;(0,e.registerPlugin)("pressforward-block-editor-comments-control",{render:({})=>{const[t,e]=(0,r.useState)([]),{apiBaseUrl:i,nominationPostType:c}=pfBlockEditorComments,{editPost:m}=(0,o.useDispatch)("core/editor"),{nomthisCommentText:l,postId:w,postStatus:u,postType:h}=(0,o.useSelect)((t=>{const e=t("core/editor").getCurrentPostId(),o=t("core/editor").getEditedPostAttribute("meta");return{nomthisCommentText:o?.pf_nomthis_comment||"",postId:e,postStatus:t("core/editor").getEditedPostAttribute("status"),postType:t("core/editor").getEditedPostAttribute("type")}}));(0,r.useEffect)((()=>{w&&d()({path:`/wp/v2/comments?post=${w}`}).then((t=>{e(t)}))}),[i,w]);const f=c===h&&"publish"!==u;return f?(0,p.jsx)(n.PluginDocumentSettingPanel,{icon:"controls-forward",name:"pressforward-block-editor-comments-control",title:(0,s.__)("Comments","pressforward"),children:f&&(0,p.jsx)(p.Fragment,{children:(0,p.jsx)(a.TextareaControl,{label:(0,s.__)("Start the Conversation","pressforward"),value:l,onChange:t=>{m({meta:{pf_nomthis_comment:t}})},help:(0,s.__)("Text entered here will be added as the first editorial comment on your nomination.","pressforward")})})}):null}})})();