(globalThis.webpackChunkcoblocks=globalThis.webpackChunkcoblocks||[]).push([[342],{4342:(e,o,t)=>{"use strict";t.r(o),t.d(o,{default:()=>v});var l=t(1609),a=t(2485),n=t.n(a),c=t(5556),s=t.n(c),r=t(9668),i=t(8468),b=t(7723),u=t(6087),_=t(6427);const p=[{
/* translators: abbreviation for small size */
label:(0,b.__)("S","coblocks"),tooltip:(0,b.__)("Small","coblocks"),value:1},{
/* translators: abbreviation for medium size */
label:(0,b.__)("M","coblocks"),tooltip:(0,b.__)("Medium","coblocks"),value:2},{
/* translators: abbreviation for large size */
label:(0,b.__)("L","coblocks"),tooltip:(0,b.__)("Large","coblocks"),value:3},{
/* translators: abbreviation for extra large size */
label:(0,b.__)("XL","coblocks"),tooltip:(0,b.__)("Extra Large","coblocks"),value:4}],m={label:(0,b.__)("None","coblocks"),tooltip:(0,b.__)("None","coblocks"),value:0},g={label:(0,l.createElement)(_.Icon,{icon:r.Zes}),tooltip:(0,b.__)("Custom","coblocks"),value:"custom"};class d extends u.Component{render(){const{advancedMaxValue:e,advancedMinValue:o,currentOption:t,label:a,onChange:c,options:s,showAdvancedControls:r,showIcons:b,showNoneOption:u,showCustomOption:d}=this.props;let k=s||p;return u&&(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)},b?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,b.__)("S","coblocks"),tooltip:(0,b.__)("Small","coblocks"),value:"small"},{
/* translators: abbreviation for medium size */
label:(0,b.__)("M","coblocks"),tooltip:(0,b.__)("Medium","coblocks"),value:"medium"},{
/* translators: abbreviation for large size */
label:(0,b.__)("L","coblocks"),tooltip:(0,b.__)("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,u.useEffect)((()=>{c>s&&t({gutterCustom:s})}),[c,s]),(0,l.createElement)(l.Fragment,null,(0,l.createElement)(d,{currentOption:n,label:(0,b.__)("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}))},y=h;h.propTypes={attributes:s().object,setAttributes:s().func};var C=t(8558);const v=e=>{const{attributes:o,activeStyle:t,styleOptions:a,onUpdateStyle:c,setAttributes:s,onUserModifiedColumn:r,categoriesList:i,postCount:u,hasPosts:p,hasFeaturedImage:m,useUpdatedQueryControls:g}=e,{columns:k,displayPostContent:h,displayPostDate:v,excerptLength:E,imageSize:S,imageStyle:f,listPosition:O,order:T,orderBy:w,postFeedType:x,postsToShow:P,categories:R,categoryRelation:L}=o,M="horizontal"===t.name,B=[{value:"small",label:/* translators: abbreviation for small size */ /* translators: abbreviation for small size */(0,b.__)("S","coblocks"),tooltip:/* translators: label for small size option */ /* translators: label for small size option */(0,b.__)("Small","coblocks")},{value:"medium",label:/* translators: abbreviation for medium size */ /* translators: abbreviation for medium size */(0,b.__)("M","coblocks"),tooltip:/* translators: label for medium size option */ /* translators: label for medium size option */(0,b.__)("Medium","coblocks")},{value:"large",label:/* translators: abbreviation for large size */ /* translators: abbreviation for large size */(0,b.__)("L","coblocks"),tooltip:/* translators: label for large size option */ /* translators: label for large size option */(0,b.__)("Large","coblocks")},{value:"huge",label:/* translators: abbreviation for extra large size */ /* translators: abbreviation for extra large size */(0,b.__)("XL","coblocks"),tooltip:/* translators: label for extra large size option */ /* translators: label for extra large size option */(0,b.__)("Huge","coblocks")}],A=[{value:"square",label:(0,b.__)("Square","coblocks"),tooltip:(0,b.__)("Square","coblocks")},{value:"circle",label:(0,b.__)("Circle","coblocks"),tooltip:(0,b.__)("Circle","coblocks")}],N=[{value:"square",label:(0,b.__)("Square","coblocks"),tooltip:(0,b.__)("Square","coblocks")},{value:"four-to-three",label:(0,b.__)("4:3","coblocks"),tooltip:(0,b.__)("4:3 Aspect ratio","coblocks")},{value:"sixteen-to-nine",label:(0,b.__)("16:9","coblocks"),tooltip:(0,b.__)("16:9 Aspect ratio","coblocks")},{value:"circle",label:(0,b.__)("Circle","coblocks"),tooltip:(0,b.__)("Circle","coblocks")}],F=e=>{s({columns:e>P?P:e})};M&&k>2&&F(2);const I=(0,l.createElement)(_.PanelBody,{title:(0,b.__)("Posts settings","coblocks")},(0,l.createElement)(l.Fragment,null,(0,l.createElement)(_.ToggleControl,{label:(0,b.__)("Post date","coblocks"),checked:v,help:v?(0,b.__)("Showing the publish date.","coblocks"):(0,b.__)("Toggle to show the publish date.","coblocks"),onChange:()=>s({displayPostDate:!v})}),(0,l.createElement)(_.ToggleControl,{label:(0,b.__)("Post content","coblocks"),checked:h,help:h?(0,b.__)("Showing the post content.","coblocks"):(0,b.__)("Toggle to show the post content.","coblocks"),onChange:()=>s({displayPostContent:!h})}),h&&(0,l.createElement)(_.RangeControl,{label:(0,b.__)("Max words in content","coblocks"),value:E,onChange:e=>s({excerptLength:e}),min:5,max:75}),(0,l.createElement)(_.RangeControl,{label:(0,b.__)("Columns","coblocks"),value:k,onChange:e=>{r(),F(e)},min:1,max:M?Math.min(2,u):Math.min(4,u),required:!0}),o.columns>=2&&(0,l.createElement)(y,{...e}),m&&(0,l.createElement)(d,{label:(0,b.__)("Thumbnail style","coblocks"),options:M?A:N,currentOption:f,onChange:e=>s({imageStyle:e})}),M&&m&&(0,l.createElement)(d,{label:(0,b.__)("Thumbnail size","coblocks"),options:B,currentOption:S,onChange:e=>s({imageSize:e})}))),q=(0,l.createElement)(_.QueryControls,{order:T,orderBy:w,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,b.__)("Feed settings","coblocks"),initialOpen:!p},(0,l.createElement)(_.RadioControl,{selected:x,options:[{label:(0,b.__)("My blog","coblocks"),value:"internal"},{label:(0,b.__)("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:T,orderBy:w,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,b.__)("Category relation","coblocks"),help:(0,b.__)("The logical relationship between each category when there is more than one.","coblocks"),selected:L,options:[{label:(0,b.__)("Or","coblocks"),value:"or"},{label:(0,b.__)("And","coblocks"),value:"and"}],onChange:e=>s({categoryRelation:e})}),(0,l.createElement)(_.RangeControl,{label:(0,b.__)("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,b.__)("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(f)&&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)}},2694:(e,o,t)=>{"use strict";var l=t(6925);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}},5556:(e,o,t)=>{e.exports=t(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}}]);