(self.webpackChunkcoblocks=self.webpackChunkcoblocks||[]).push([[880],{3601:function(e,t,o){"use strict";const n=(0,o(2175).withColors)("backgroundColor",{textColor:"color"});t.Z=n},5880:function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return T}});var n=o(9196),l=o(4184),c=o.n(l),r=o(7361),a=o.n(r),i=o(7635),s=o(5161),u=o.n(s),d=o(1313),m=o(5736),k=o(5609),p=o(4333),b=o(9307),g=o(9818),_=o(2175),v=o(3601),B=o(9035),f=o(3267),h=o(5377),E=e=>{const{clientId:t,attributes:o,setAttributes:l,getBlocksByClientId:c,updateBlockAttributes:r}=e,{columns:a,layout:i,verticalAlignment:s}=o;let d=1;return a&&(d=parseInt(a.toString().split("-"))),i?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(_.BlockControls,null,a&&d>1&&(0,n.createElement)(k.ToolbarGroup,{isCollapsed:!0,icon:(()=>{let e=1;return a&&(e=parseInt(a.toString().split("-"))),void 0===i?f.Z.layout:u()(B.sL[e],(({key:e,smallIcon:t})=>e===i?t:""))})(),label:(0,m.__)("Change row block layout","coblocks"),controls:u()(B.sL[d],(({name:e,key:o,smallIcon:n})=>({title:e,key:o,icon:n,isActive:o===i,onClick:()=>{const e=o.toString().split("-"),n=c(t);l({layout:o}),void 0!==n[0].innerBlocks&&u()(n[0].innerBlocks,((t,o)=>r(t.clientId,{width:e[o]})))}})))}),(0,n.createElement)(_.BlockVerticalAlignmentToolbar,{onChange:e=>{const o=c(t);l({verticalAlignment:e}),void 0!==o[0].innerBlocks&&u()(o[0].innerBlocks,(t=>r(t.clientId,{verticalAlignment:e})))},value:s}),i&&(0,h.H)(e))):null},y=o(3264);function w(){return(0,n.createElement)(k.PanelBody,{initialOpen:!1,title:(0,n.createElement)("span",{className:"coblocks-ellipsis-loading"},(0,m.__)("Loading Inspector","coblocks"))},(0,n.createElement)(k.Spinner,null))}function I({children:e}){return(0,n.createElement)(_.InspectorControls,null,(0,n.createElement)(b.Suspense,{fallback:(0,n.createElement)(w,null)},e))}var S=o(4981);const C=(0,b.lazy)((()=>o.e(203).then(o.bind(o,4203)))),x=(0,g.withDispatch)((e=>{const{updateBlockAttributes:t}=e("core/block-editor");return{updateBlockAttributes:t}})),A=(0,g.withSelect)(((e,t)=>{const{getBlocks:o,getBlocksByClientId:n}=e("core/block-editor"),{getBlockType:l,getBlockVariations:c,getDefaultBlockVariation:r}=e("core/blocks"),a=o(t.clientId),{replaceInnerBlocks:i}=(0,g.useDispatch)("core/block-editor");return{blockType:l(t.name),defaultVariation:void 0===r?null:r(t.name),getBlocksByClientId:n,hasInnerBlocks:e("core/block-editor").getBlocks(t.clientId).length>0,innerBlocks:a,replaceInnerBlocks:i,variations:void 0===c?null:c(t.name)}}));var T=(0,p.compose)(v.Z,A,x)((e=>{const{attributes:t,isSelected:o,setAttributes:l,className:r,variations:s,hasInnerBlocks:v,defaultVariation:w,replaceInnerBlocks:x,blockType:A,textColor:T,backgroundColor:N,clientId:L}=e,{columns:F,layout:P,id:R,backgroundImg:Z,coblocks:$,paddingSize:V,marginSize:O,marginUnit:U,marginTop:D,marginRight:G,marginBottom:z,marginLeft:M,paddingUnit:j,paddingTop:H,backgroundType:K,hasParallax:Q,focalPoint:X,paddingRight:q,paddingBottom:J,isStackedOnMobile:W,paddingLeft:Y,verticalAlignment:ee}=t,te=(0,p.usePrevious)(v),[oe,ne]=(0,b.useState)(!0),{__unstableMarkNextChangeAsNotPersistent:le}=(0,g.useDispatch)("core/block-editor");(0,b.useEffect)((()=>{te&&!v&&(le(),ne(!0),l({columns:null,layout:null}))}),[v,te]);const ce=e=>u()(e,(([e,t,o=[]])=>(0,S.createBlock)(e,t,ce(o)))),re=()=>!!S.registerBlockVariation,ae=(0,n.createElement)(h.pG,{...e,label:(0,m.__)("Add background to row","coblocks")}),ie=[{columns:1,icon:f.Z.colOne,key:"100",name:(0,m.__)("One column","coblocks")},{columns:2,icon:f.Z.colTwo,name:(0,m.__)("Two columns","coblocks")},{columns:3,icon:f.Z.colThree,name:(0,m.__)("Three columns","coblocks")},{columns:4,icon:f.Z.colFour,name:(0,m.__)("Four columns","coblocks")}];let se=1;if(F&&(se=parseInt(F.toString().split("-"))),!P&&oe&&!re())return(0,n.createElement)(n.Fragment,null,o&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(E,{...e}),(0,n.createElement)(I,null,(0,n.createElement)(C,{...e}))),(0,n.createElement)(k.Placeholder,{className:"components-coblocks-row-placeholder",icon:(0,n.createElement)(k.Icon,{icon:i.M8y}),instructions:F?(0,m.sprintf)(/* translators: %s: 'one' 'two' 'three' and 'four' */
(0,m.__)("Select a layout for this %s column row.","coblocks"),(ue=F,1===ue?(0,m.__)("one","coblocks"):2===ue?(0,m.__)("two","coblocks"):3===ue?(0,m.__)("three","coblocks"):4===ue?(0,m.__)("four","coblocks"):void 0)):(0,m.__)("Select the number of columns for this row.","coblocks"),key:"placeholder",label:F?(0,m.__)("Row layout","coblocks"):(0,m.__)("Row","coblocks")},F?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(k.ButtonGroup,{"aria-label":(0,m.__)("Select row layout","coblocks"),className:"block-editor-inner-blocks__template-picker-options block-editor-block-pattern-picker__patterns"},(0,n.createElement)(k.Button,{className:"components-coblocks-row-placeholder__back",icon:"exit",label:(0,m.__)("Back to columns","coblocks"),onClick:()=>{l({columns:null}),ne(!0)}}),u()(B.sL[se],(e=>(0,n.createElement)(k.Tooltip,{text:e.name},(0,n.createElement)("div",{className:"components-coblocks-row-placeholder__button-wrapper"},(0,n.createElement)(k.Button,{className:"components-coblocks-row-placeholder__button block-editor-inner-blocks__template-picker-option block-editor-block-pattern-picker__pattern",isSecondary:!0,key:e.key,onClick:()=>{l({layout:e.key}),ne(!1)}},e.icon))))))):(0,n.createElement)(k.ButtonGroup,{"aria-label":(0,m.__)("Select row columns","coblocks"),className:"block-editor-inner-blocks__template-picker-options block-editor-block-pattern-picker__patterns"},u()(ie,(e=>(0,n.createElement)(k.Tooltip,{text:e.name},(0,n.createElement)("div",{className:"components-coblocks-row-placeholder__button-wrapper"},(0,n.createElement)(k.Button,{className:"components-coblocks-row-placeholder__button block-editor-inner-blocks__template-picker-option block-editor-block-pattern-picker__pattern",isSecondary:!0,onClick:()=>{l({columns:e.columns,layout:1===e.columns?e.key:null}),1===e.columns&&ne(!1)}},e.icon))))))));var ue;let de=c()(r,{[`coblocks-row--${R}`]:R});$&&void 0!==$.id&&(de=c()(de,`coblocks-row-${$.id}`));const me=c()("wp-block-coblocks-row__inner",...(0,h.Ro)(t),{"has-text-color":T.color,"has-padding":V&&"no"!==V,[`has-${V}-padding`]:V&&"advanced"!==V,"has-margin":O&&"no"!==O,[`has-${O}-margin`]:O&&"advanced"!==O,"is-stacked-on-mobile":W,[`are-vertically-aligned-${ee}`]:ee}),ke={backgroundColor:N.color,backgroundImage:Z&&"image"===K?`url(${Z})`:void 0,backgroundPosition:X&&!Q?`${100*X.x}% ${100*X.y}%`:void 0,color:T.color,marginBottom:"advanced"===O&&z?z+U:void 0,marginLeft:"advanced"===O&&M?M+U:void 0,marginRight:"advanced"===O&&G?G+U:void 0,marginTop:"advanced"===O&&D?D+U:void 0,paddingBottom:"advanced"===V&&J?J+j:void 0,paddingLeft:"advanced"===V&&Y?Y+j:void 0,paddingRight:"advanced"===V&&q?q+j:void 0,paddingTop:"advanced"===V&&H?H+j:void 0};if(v&&P){const l=()=>(0,n.createElement)(_.InnerBlocks,{allowedBlocks:B.Ss,renderAppender:()=>null,template:B.XK[P],templateInsertUpdatesSelection:1===F,templateLock:"all"}),c=()=>(0,n.createElement)(_.InnerBlocks,{allowedBlocks:B.Ss,renderAppender:()=>null,templateInsertUpdatesSelection:1===F,templateLock:"all"});return(0,n.createElement)(n.Fragment,null,ae,o&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(E,{...e}),(0,n.createElement)(I,null,(0,n.createElement)(C,{...e}))),(0,n.createElement)("div",{className:de},(0,d.isBlobURL)(Z)&&(0,n.createElement)(k.Spinner,null),(0,n.createElement)(y.Z,{...t},(0,n.createElement)("div",{className:me,style:ke},(0,h.QF)(t),re()?c():l()))))}return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(_.__experimentalBlockVariationPicker,{allowSkip:!0,icon:a()(A,["icon","src"]),instructions:(0,m.__)("Select a variation to start with.","coblocks"),label:a()(A,["title"]),onSelect:e=>((e=w)=>{e.attributes&&l(e.attributes),e.innerBlocks&&x(L,ce(e.innerBlocks))})(e),variations:s}))}))},9881:function(e,t,o){var n=o(7816),l=o(9291)(n);e.exports=l},8483:function(e,t,o){var n=o(5063)();e.exports=n},7816:function(e,t,o){var n=o(8483),l=o(3674);e.exports=function(e,t){return e&&n(e,t,l)}},9199:function(e,t,o){var n=o(9881),l=o(8612);e.exports=function(e,t){var o=-1,c=l(e)?Array(e.length):[];return n(e,(function(e,n,l){c[++o]=t(e,n,l)})),c}},9291:function(e,t,o){var n=o(8612);e.exports=function(e,t){return function(o,l){if(null==o)return o;if(!n(o))return e(o,l);for(var c=o.length,r=t?c:-1,a=Object(o);(t?r--:++r<c)&&!1!==l(a[r],r,a););return o}}},5063:function(e){e.exports=function(e){return function(t,o,n){for(var l=-1,c=Object(t),r=n(t),a=r.length;a--;){var i=r[e?a:++l];if(!1===o(c[i],i,c))break}return t}}},5161:function(e,t,o){var n=o(9932),l=o(7206),c=o(9199),r=o(1469);e.exports=function(e,t){return(r(e)?n:c)(e,l(t,3))}}}]);