(globalThis.webpackChunkcoblocks=globalThis.webpackChunkcoblocks||[]).push([[168],{8086:(e,t,o)=>{"use strict";o.d(t,{A:()=>n});const n=(0,o(4715).withColors)("backgroundColor",{textColor:"color"})},8168:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>x});var n=o(1609),l=o(2485),c=o.n(l),r=o(8156),a=o.n(r),i=o(9668),s=o(5378),u=o.n(s),d=o(3162),k=o(7723),m=o(6427),p=o(9491),b=o(6087),g=o(7143),_=o(4715),v=o(8086),h=o(8032),B=o(5342),E=o(4082);const y=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)(m.ToolbarGroup,{isCollapsed:!0,icon:(()=>{let e=1;return a&&(e=parseInt(a.toString().split("-"))),void 0===i?B.A.layout:u()(h.PC[e],(({key:e,smallIcon:t})=>e===i?t:""))})(),label:(0,k.__)("Change row block layout","coblocks"),controls:u()(h.PC[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,E.j2)(e))):null};var f=o(632);function w(){return(0,n.createElement)(m.PanelBody,{initialOpen:!1,title:(0,n.createElement)("span",{className:"coblocks-ellipsis-loading"},(0,k.__)("Loading Inspector","coblocks"))},(0,n.createElement)(m.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 A=o(4997);const C=(0,b.lazy)((()=>o.e(72).then(o.bind(o,72)))),S=(0,g.withDispatch)((e=>{const{updateBlockAttributes:t}=e("core/block-editor");return{updateBlockAttributes:t}})),T=(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)}})),x=(0,p.compose)(v.A,T,S)((e=>{const{attributes:t,isSelected:o,setAttributes:l,className:r,variations:s,hasInnerBlocks:v,defaultVariation:w,replaceInnerBlocks:S,blockType:T,textColor:x,backgroundColor:N,clientId:P}=e,{columns:F,layout:L,id:O,backgroundImg:$,coblocks:R,paddingSize:V,marginSize:U,marginUnit:D,marginTop:j,marginRight:z,marginBottom:G,marginLeft:M,paddingUnit:Q,paddingTop:q,backgroundType:H,hasParallax:J,focalPoint:K,paddingRight:W,paddingBottom:X,isStackedOnMobile:Y,paddingLeft:Z,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,A.createBlock)(e,t,ce(o)))),re=()=>!!A.registerBlockVariation,ae=(0,n.createElement)(E.i9,{...e,label:(0,k.__)("Add background to row","coblocks")}),ie=[{columns:1,icon:B.A.colOne,key:"100",name:(0,k.__)("One column","coblocks")},{columns:2,icon:B.A.colTwo,name:(0,k.__)("Two columns","coblocks")},{columns:3,icon:B.A.colThree,name:(0,k.__)("Three columns","coblocks")},{columns:4,icon:B.A.colFour,name:(0,k.__)("Four columns","coblocks")}];let se=1;if(F&&(se=parseInt(F.toString().split("-"))),!L&&oe&&!re())return(0,n.createElement)(n.Fragment,null,o&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(y,{...e}),(0,n.createElement)(I,null,(0,n.createElement)(C,{...e}))),(0,n.createElement)(m.Placeholder,{className:"components-coblocks-row-placeholder",icon:(0,n.createElement)(m.Icon,{icon:i.sk4}),instructions:F?(0,k.sprintf)(/* translators: %s: 'one' 'two' 'three' and 'four' */ /* translators: %s: 'one' 'two' 'three' and 'four' */
(0,k.__)("Select a layout for this %s column row.","coblocks"),(ue=F,1===ue?(0,k.__)("one","coblocks"):2===ue?(0,k.__)("two","coblocks"):3===ue?(0,k.__)("three","coblocks"):4===ue?(0,k.__)("four","coblocks"):void 0)):(0,k.__)("Select the number of columns for this row.","coblocks"),key:"placeholder",label:F?(0,k.__)("Row layout","coblocks"):(0,k.__)("Row","coblocks")},F?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.ButtonGroup,{"aria-label":(0,k.__)("Select row layout","coblocks"),className:"block-editor-inner-blocks__template-picker-options block-editor-block-pattern-picker__patterns"},(0,n.createElement)(m.Button,{className:"components-coblocks-row-placeholder__back",icon:"exit",label:(0,k.__)("Back to columns","coblocks"),onClick:()=>{l({columns:null}),ne(!0)}}),u()(h.PC[se],(e=>(0,n.createElement)(m.Tooltip,{text:e.name},(0,n.createElement)("div",{className:"components-coblocks-row-placeholder__button-wrapper"},(0,n.createElement)(m.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)(m.ButtonGroup,{"aria-label":(0,k.__)("Select row columns","coblocks"),className:"block-editor-inner-blocks__template-picker-options block-editor-block-pattern-picker__patterns"},u()(ie,(e=>(0,n.createElement)(m.Tooltip,{text:e.name},(0,n.createElement)("div",{className:"components-coblocks-row-placeholder__button-wrapper"},(0,n.createElement)(m.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--${O}`]:O});R&&void 0!==R.id&&(de=c()(de,`coblocks-row-${R.id}`));const ke=c()("wp-block-coblocks-row__inner",...(0,E.dN)(t),{"has-text-color":x.color,"has-padding":V&&"no"!==V,[`has-${V}-padding`]:V&&"advanced"!==V,"has-margin":U&&"no"!==U,[`has-${U}-margin`]:U&&"advanced"!==U,"is-stacked-on-mobile":Y,[`are-vertically-aligned-${ee}`]:ee}),me={backgroundColor:N.color,backgroundImage:$&&"image"===H?`url(${$})`:void 0,backgroundPosition:K&&!J?`${100*K.x}% ${100*K.y}%`:void 0,color:x.color,marginBottom:"advanced"===U&&G?G+D:void 0,marginLeft:"advanced"===U&&M?M+D:void 0,marginRight:"advanced"===U&&z?z+D:void 0,marginTop:"advanced"===U&&j?j+D:void 0,paddingBottom:"advanced"===V&&X?X+Q:void 0,paddingLeft:"advanced"===V&&Z?Z+Q:void 0,paddingRight:"advanced"===V&&W?W+Q:void 0,paddingTop:"advanced"===V&&q?q+Q:void 0};if(v&&L){const l=()=>(0,n.createElement)(_.InnerBlocks,{allowedBlocks:h.hO,renderAppender:()=>null,template:h.vs[L],templateInsertUpdatesSelection:1===F,templateLock:"all"}),c=()=>(0,n.createElement)(_.InnerBlocks,{allowedBlocks:h.hO,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)(y,{...e}),(0,n.createElement)(I,null,(0,n.createElement)(C,{...e}))),(0,n.createElement)("div",{className:de},(0,d.isBlobURL)($)&&(0,n.createElement)(m.Spinner,null),(0,n.createElement)(f.A,{...t},(0,n.createElement)("div",{className:ke,style:me},(0,E.Qt)(t),re()?c():l()))))}return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(_.__experimentalBlockVariationPicker,{allowSkip:!0,icon:a()(T,["icon","src"]),instructions:(0,k.__)("Select a variation to start with.","coblocks"),label:a()(T,["title"]),onSelect:e=>((e=w)=>{e.attributes&&l(e.attributes),e.innerBlocks&&S(P,ce(e.innerBlocks))})(e),variations:s}))}))},909:(e,t,o)=>{var n=o(3022),l=o(8329)(n);e.exports=l},6649:(e,t,o)=>{var n=o(3221)();e.exports=n},3022:(e,t,o)=>{var n=o(6649),l=o(5950);e.exports=function(e,t){return e&&n(e,t,l)}},5128:(e,t,o)=>{var n=o(909),l=o(4894);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}},8329:(e,t,o)=>{var n=o(4894);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}}},3221: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}}},5378:(e,t,o)=>{var n=o(4932),l=o(5389),c=o(5128),r=o(6449);e.exports=function(e,t){return(r(e)?n:c)(e,l(t,3))}}}]);