(self.webpackChunkcoblocks=self.webpackChunkcoblocks||[]).push([[758],{8758:function(e,o,t){"use strict";t.r(o),t.d(o,{default:function(){return v}});var l=t(9196),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(9307),_=t(5609);const p=[{
/* 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}],m={label:(0,u.__)("None","coblocks"),tooltip:(0,u.__)("None","coblocks"),value:0},g={label:(0,l.createElement)(_.Icon,{icon:r.ewm}),tooltip:(0,u.__)("Custom","coblocks"),value:"custom"};class d extends b.Component{render(){const{advancedMaxValue:e,advancedMinValue:o,currentOption:t,label:a,onChange:c,options:s,showAdvancedControls:r,showIcons:u,showNoneOption:b,showCustomOption:d}=this.props;let k=s||p;return b&&(k=[m,...k]),d&&(k=[...k,g]),r&&!1!==o&&!1!==e?(0,l.createElement)(_.RangeControl,{label:a,max:e,min:o,onChange:e=>c(e),value:t}):(0,l.createElement)(_.BaseControl,{className:n()("coblocks-option-selector-control",{"is-custom":"custom"===t}),id:`coblocks-option-selector-${(0,i.kebabCase)(a)}`,label:a},(0,l.createElement)(_.PanelRow,null,(0,l.createElement)(_.ButtonGroup,{"aria-label":a},k.map((e=>(0,l.createElement)(_.Tooltip,{key:`option-${e.value}`,text:e.tooltip},(0,l.createElement)(_.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)))))))}}d.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 k=[{
/* 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"}],h=e=>{const{attributes:o,setAttributes:t}=e,{align:a,gutter:n,gutterCustom:c}=o,s="full"===a?10:5;return(0,b.useEffect)((()=>{c>s&&t({gutterCustom:s})}),[c,s]),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(d,{currentOption:n,label:(0,u.__)("Gutter","coblocks"),onChange:e=>t({gutter:e}),options:k,showCustomOption:!0}),"custom"===n&&(0,l.createElement)(_.RangeControl,{initialValue:0,max:s,min:0,onChange:e=>t({gutterCustom:e.toString()}),step:.1,value:parseFloat(c)||0,withInputField:!0}))};var y=h;h.propTypes={attributes:s().object,setAttributes:s().func};var C=t(9630),v=e=>{const{attributes:o,activeStyle:t,styleOptions:a,onUpdateStyle:c,setAttributes:s,onUserModifiedColumn:r,categoriesList:i,postCount:b,hasPosts:p,hasFeaturedImage:m,useUpdatedQueryControls:g}=e,{columns:k,displayPostContent:h,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)(_.PanelBody,{title:(0,u.__)("Posts settings","coblocks")},(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.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)(_.ToggleControl,{label:(0,u.__)("Post content","coblocks"),checked:h,help:h?(0,u.__)("Showing the post content.","coblocks"):(0,u.__)("Toggle to show the post content.","coblocks"),onChange:()=>s({displayPostContent:!h})}),h&&(0,l.createElement)(_.RangeControl,{label:(0,u.__)("Max words in content","coblocks"),value:E,onChange:e=>s({excerptLength:e}),min:5,max:75}),(0,l.createElement)(_.RangeControl,{label:(0,u.__)("Columns","coblocks"),value:k,onChange:e=>{r(),F(e)},min:1,max:M?Math.min(2,b):Math.min(4,b),required:!0}),o.columns>=2&&(0,l.createElement)(y,{...e}),m&&(0,l.createElement)(d,{label:(0,u.__)("Thumbnail style","coblocks"),options:M?A:N,currentOption:S,onChange:e=>s({imageStyle:e})}),M&&m&&(0,l.createElement)(d,{label:(0,u.__)("Thumbnail size","coblocks"),options:B,currentOption:f,onChange:e=>s({imageSize:e})}))),q=(0,l.createElement)(_.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)(_.PanelBody,{title:(0,u.__)("Feed settings","coblocks"),initialOpen:!p},(0,l.createElement)(_.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&&R?.length>0?(0,l.createElement)(l.Fragment,null,"internal"===x&&g?(()=>{const e=i.reduce(((e,o)=>({...e,[o.name]:o})),{}),t=i.reduce(((e,o)=>({...e,[o.name]:o})),{});return(0,l.createElement)(_.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)(_.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)(_.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)(_.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=>{C.ENTER!==o.keyCode&&C.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:function(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:function(e,o,t){e.exports=t(2703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}}]);