(self.webpackChunkcoblocks=self.webpackChunkcoblocks||[]).push([[758],{8758:(e,o,t)=>{"use strict";t.r(o),t.d(o,{default:()=>C});var l=t(9307),a=t(4184),n=t.n(a),c=t(5697),s=t.n(c),r=t(7635),i=t(2819),u=t(5736),b=t(5609);const _=[{
/* translators: abbreviation for small size */
label:(0,u.__)("S","coblocks"),tooltip:(0,u.__)("Small","coblocks"),value:1},{
/* translators: abbreviation for medium size */
label:(0,u.__)("M","coblocks"),tooltip:(0,u.__)("Medium","coblocks"),value:2},{
/* translators: abbreviation for large size */
label:(0,u.__)("L","coblocks"),tooltip:(0,u.__)("Large","coblocks"),value:3},{
/* translators: abbreviation for extra large size */
label:(0,u.__)("XL","coblocks"),tooltip:(0,u.__)("Extra Large","coblocks"),value:4}],p={label:(0,u.__)("None","coblocks"),tooltip:(0,u.__)("None","coblocks"),value:0},m={label:(0,l.createElement)(b.Icon,{icon:r.ewm}),tooltip:(0,u.__)("Custom","coblocks"),value:"custom"};class g extends l.Component{render(){const{advancedMaxValue:e,advancedMinValue:o,currentOption:t,label:a,onChange:c,options:s,showAdvancedControls:r,showIcons:u,showNoneOption:g,showCustomOption:d}=this.props;let k=s||_;return g&&(k=[p,...k]),d&&(k=[...k,m]),r&&!1!==o&&!1!==e?(0,l.createElement)(b.RangeControl,{label:a,max:e,min:o,onChange:e=>c(e),value:t}):(0,l.createElement)(b.BaseControl,{className:n()("coblocks-option-selector-control",{"is-custom":"custom"===t}),id:`coblocks-option-selector-${(0,i.kebabCase)(a)}`,label:a},(0,l.createElement)(b.PanelRow,null,(0,l.createElement)(b.ButtonGroup,{"aria-label":a},k.map((e=>(0,l.createElement)(b.Tooltip,{key:`option-${e.value}`,text:e.tooltip},(0,l.createElement)(b.Button,{"aria-label":e.tooltip,"aria-pressed":t===e.value,isPrimary:t===e.value,isSecondary:t!==e.value,onClick:()=>c(e.value)},u?e.icon:e.label)))))))}}g.propTypes={advancedMaxValue:s().number,advancedMinValue:s().number,currentOption:s().oneOfType([s().string,s().number]),label:s().string,onChange:s().func,options:s().array,showAdvancedControls:s().bool,showCustomOption:s().bool,showIcons:s().bool,showNoneOption:s().bool};const d=[{
/* translators: abbreviation for small size */
label:(0,u.__)("S","coblocks"),tooltip:(0,u.__)("Small","coblocks"),value:"small"},{
/* translators: abbreviation for medium size */
label:(0,u.__)("M","coblocks"),tooltip:(0,u.__)("Medium","coblocks"),value:"medium"},{
/* translators: abbreviation for large size */
label:(0,u.__)("L","coblocks"),tooltip:(0,u.__)("Large","coblocks"),value:"large"}],k=e=>{const{attributes:o,setAttributes:t}=e,{align:a,gutter:n,gutterCustom:c}=o,s="full"===a?10:5;return(0,l.useEffect)((()=>{c>s&&t({gutterCustom:s})}),[c,s]),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(g,{currentOption:n,label:(0,u.__)("Gutter","coblocks"),onChange:e=>t({gutter:e}),options:d,showCustomOption:!0}),"custom"===n&&(0,l.createElement)(b.RangeControl,{initialValue:0,max:s,min:0,onChange:e=>t({gutterCustom:e.toString()}),step:.1,value:parseFloat(c)||0,withInputField:!0}))},h=k;k.propTypes={attributes:s().object,setAttributes:s().func};var y=t(9630);const C=e=>{const{attributes:o,activeStyle:t,styleOptions:a,onUpdateStyle:c,setAttributes:s,onUserModifiedColumn:r,categoriesList:i,postCount:_,hasPosts:p,hasFeaturedImage:m,useUpdatedQueryControls:d}=e,{columns:k,displayPostContent:C,displayPostDate:v,excerptLength:E,imageSize:f,imageStyle:S,listPosition:O,order:w,orderBy:T,postFeedType:x,postsToShow:P,categories:R,categoryRelation:L}=o,M="horizontal"===t.name,B=[{value:"small",label:
/* translators: abbreviation for small size */
(0,u.__)("S","coblocks"),tooltip:
/* translators: label for small size option */
(0,u.__)("Small","coblocks")},{value:"medium",label:
/* translators: abbreviation for medium size */
(0,u.__)("M","coblocks"),tooltip:
/* translators: label for medium size option */
(0,u.__)("Medium","coblocks")},{value:"large",label:
/* translators: abbreviation for large size */
(0,u.__)("L","coblocks"),tooltip:
/* translators: label for large size option */
(0,u.__)("Large","coblocks")},{value:"huge",label:
/* translators: abbreviation for extra large size */
(0,u.__)("XL","coblocks"),tooltip:
/* translators: label for extra large size option */
(0,u.__)("Huge","coblocks")}],A=[{value:"square",label:(0,u.__)("Square","coblocks"),tooltip:(0,u.__)("Square","coblocks")},{value:"circle",label:(0,u.__)("Circle","coblocks"),tooltip:(0,u.__)("Circle","coblocks")}],N=[{value:"square",label:(0,u.__)("Square","coblocks"),tooltip:(0,u.__)("Square","coblocks")},{value:"four-to-three",label:(0,u.__)("4:3","coblocks"),tooltip:(0,u.__)("4:3 Aspect ratio","coblocks")},{value:"sixteen-to-nine",label:(0,u.__)("16:9","coblocks"),tooltip:(0,u.__)("16:9 Aspect ratio","coblocks")},{value:"circle",label:(0,u.__)("Circle","coblocks"),tooltip:(0,u.__)("Circle","coblocks")}],F=e=>{s({columns:e>P?P:e})};M&&k>2&&F(2);const I=(0,l.createElement)(b.PanelBody,{title:(0,u.__)("Posts settings","coblocks")},(0,l.createElement)(l.Fragment,null,(0,l.createElement)(b.ToggleControl,{label:(0,u.__)("Post date","coblocks"),checked:v,help:v?(0,u.__)("Showing the publish date.","coblocks"):(0,u.__)("Toggle to show the publish date.","coblocks"),onChange:()=>s({displayPostDate:!v})}),(0,l.createElement)(b.ToggleControl,{label:(0,u.__)("Post content","coblocks"),checked:C,help:C?(0,u.__)("Showing the post content.","coblocks"):(0,u.__)("Toggle to show the post content.","coblocks"),onChange:()=>s({displayPostContent:!C})}),C&&(0,l.createElement)(b.RangeControl,{label:(0,u.__)("Max words in content","coblocks"),value:E,onChange:e=>s({excerptLength:e}),min:5,max:75}),(0,l.createElement)(b.RangeControl,{label:(0,u.__)("Columns","coblocks"),value:k,onChange:e=>{r(),F(e)},min:1,max:M?Math.min(2,_):Math.min(4,_),required:!0}),o.columns>=2&&(0,l.createElement)(h,e),m&&(0,l.createElement)(g,{label:(0,u.__)("Thumbnail style","coblocks"),options:M?A:N,currentOption:S,onChange:e=>s({imageStyle:e})}),M&&m&&(0,l.createElement)(g,{label:(0,u.__)("Thumbnail size","coblocks"),options:B,currentOption:f,onChange:e=>s({imageSize:e})}))),q=(0,l.createElement)(b.QueryControls,{order:w,orderBy:T,categoriesList:i,selectedCategoryId:o.categories,categorySuggestions:i,selectedCategories:o.categories,onOrderChange:e=>s({order:e}),onOrderByChange:e=>s({orderBy:e}),onCategoryChange:e=>s({categories:""!==e?e:void 0})}),D=(0,l.createElement)(b.PanelBody,{title:(0,u.__)("Feed settings","coblocks"),initialOpen:!p},(0,l.createElement)(b.RadioControl,{selected:x,options:[{label:(0,u.__)("My blog","coblocks"),value:"internal"},{label:(0,u.__)("External feed","coblocks"),value:"external"}],onChange:e=>s({postFeedType:e})}),p||R&&(null==R?void 0:R.length)>0?(0,l.createElement)(l.Fragment,null,"internal"===x&&d?(()=>{const e=i.reduce(((e,o)=>({...e,[o.name]:o})),{}),t=i.reduce(((e,o)=>({...e,[o.name]:o})),{});return(0,l.createElement)(b.QueryControls,{order:w,orderBy:T,categorySuggestions:e,selectedCategories:o.categories,onOrderChange:e=>s({order:e}),onOrderByChange:e=>s({orderBy:e}),onCategoryChange:e=>{const o=e.reduce(((e,o)=>{if("string"==typeof o){const l=t[o];l&&e.push(l)}else e.push(o);return e}),[]);s({categories:o}),e.length<2&&s({categoryRelation:"or"})}})})():q,R&&R.length>1&&(0,l.createElement)(b.RadioControl,{label:(0,u.__)("Category relation","coblocks"),help:(0,u.__)("The logical relationship between each category when there is more than one.","coblocks"),selected:L,options:[{label:(0,u.__)("Or","coblocks"),value:"or"},{label:(0,u.__)("And","coblocks"),value:"and"}],onChange:e=>s({categoryRelation:e})}),(0,l.createElement)(b.RangeControl,{label:(0,u.__)("Number of posts","coblocks"),value:P,onChange:e=>(e=>{const o={postsToShow:e};(k>e||1===e&&1!==k)&&Object.assign(o,{columns:e}),s(o)})(e),min:1,max:20})):null);return(0,l.createElement)(l.Fragment,null,p?(0,l.createElement)(b.PanelBody,{title:(0,u.__)("Styles","coblocks"),initialOpen:!1},(0,l.createElement)("div",{className:"block-editor-block-styles coblocks-editor-block-styles"},a.map((e=>(0,l.createElement)("div",{key:`style-${e.name}`,className:n()("block-editor-block-styles__item",{"is-active":t===e}),onClick:()=>{"horizontal"===e.name&&["four-to-three","sixteen-to-nine"].includes(S)&&s({imageStyle:"square"}),c(e)},onKeyDown:o=>{y.ENTER!==o.keyCode&&y.SPACE!==o.keyCode||(o.preventDefault(),c(e))},role:"button",tabIndex:"0","aria-label":e.label||e.name},(0,l.createElement)("div",{className:"block-editor-block-styles__item-preview"},"left"===O&&e.iconAlt?e.iconAlt:e.icon),(0,l.createElement)("div",{className:"block-editor-block-styles__item-label"},e.label||e.name)))))):null,p?I:null,D)}},2703:(e,o,t)=>{"use strict";var l=t(414);function a(){}function n(){}n.resetWarningCache=a,e.exports=function(){function e(e,o,t,a,n,c){if(c!==l){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function o(){return e}e.isRequired=e;var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:o,element:e,elementType:e,instanceOf:o,node:e,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:a};return t.PropTypes=t,t}},5697:(e,o,t)=>{e.exports=t(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}}]);