(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,r=window.React,s=window.wp.blockEditor,n=window.wp.components,l=window.wp.i18n,a=window.wp.serverSideRender;var o=e.n(a);const i=window.bp.blockComponents,d=window.bp.blockData,u=[{label:(0,l.__)("None","buddypress"),value:"none"},{label:(0,l.__)("Thumb","buddypress"),value:"thumb"},{label:(0,l.__)("Full","buddypress"),value:"full"}],p=e=>e&&e.mention_name?e.mention_name:null,m=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"bp/member","title":"Member","category":"widgets","icon":"admin-users","description":"BuddyPress Member.","keywords":["BuddyPress","member","community"],"textdomain":"buddypress","attributes":{"itemID":{"type":"integer","default":0},"avatarSize":{"type":"string","default":"full"},"displayMentionSlug":{"type":"boolean","default":true},"displayActionButton":{"type":"boolean","default":true},"displayCoverImage":{"type":"boolean","default":true}},"supports":{"align":true},"editorScript":"file:index.js","style":"file:index.css"}');(0,t.registerBlockType)(m,{icon:{background:"#fff",foreground:"#d84800",src:"admin-users"},edit:({attributes:e,setAttributes:t})=>{const a=(0,s.useBlockProps)(),m=(0,d.isActive)("members","avatar"),c=(0,d.isActive)("activity","mentions"),b=(0,d.isActive)("members","cover"),{avatarSize:y,displayMentionSlug:_,displayActionButton:g,displayCoverImage:h}=e;return e.itemID?(0,r.createElement)("div",{...a},(0,r.createElement)(s.BlockControls,null,(0,r.createElement)(n.Toolbar,{label:(0,l.__)("Block toolbar","buddypress")},(0,r.createElement)(n.ToolbarButton,{icon:"edit",title:(0,l.__)("Select another member","buddypress"),onClick:()=>{t({itemID:0})}}))),(0,r.createElement)(s.InspectorControls,null,(0,r.createElement)(n.PanelBody,{title:(0,l.__)("Settings","buddypress"),initialOpen:!0},(0,r.createElement)(n.ToggleControl,{label:(0,l.__)("Display Profile button","buddypress"),checked:!!g,onChange:()=>{t({displayActionButton:!g})},help:g?(0,l.__)("Include a link to the user's profile page under their display name.","buddypress"):(0,l.__)("Toggle to display a link to the user's profile page under their display name.","buddypress")}),m&&(0,r.createElement)(n.SelectControl,{label:(0,l.__)("Avatar size","buddypress"),value:y,options:u,help:(0,l.__)('Select "None" to disable the avatar.',"buddypress"),onChange:e=>{t({avatarSize:e})}}),b&&(0,r.createElement)(n.ToggleControl,{label:(0,l.__)("Display Cover Image","buddypress"),checked:!!h,onChange:()=>{t({displayCoverImage:!h})},help:h?(0,l.__)("Include the user's cover image over their display name.","buddypress"):(0,l.__)("Toggle to display the user's cover image over their display name.","buddypress")}),c&&(0,r.createElement)(n.ToggleControl,{label:(0,l.__)("Display Mention slug","buddypress"),checked:!!_,onChange:()=>{t({displayMentionSlug:!_})},help:_?(0,l.__)("Include the user's mention name under their display name.","buddypress"):(0,l.__)("Toggle to display the user's mention name under their display name.","buddypress")}))),(0,r.createElement)(n.Disabled,null,(0,r.createElement)(o(),{block:"bp/member",attributes:e}))):(0,r.createElement)("div",{...a},(0,r.createElement)(n.Placeholder,{icon:"admin-users",label:(0,l.__)("BuddyPress Member","buddypress"),instructions:(0,l.__)("Start typing the name of the member you want to feature into this post.","buddypress")},(0,r.createElement)(i.AutoCompleter,{component:"members",slugValue:p,ariaLabel:(0,l.__)("Member's username","buddypress"),placeholder:(0,l.__)("Enter Member's username here…","buddypress"),onSelectItem:t,useAvatar:m})))}})})();