(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{blockMetadataAttribute:()=>k});const o=window.wp.hooks,n=window.wp.blocks,i=window.lodash,r=window.wp.components;function c(e,t,o=50,n=0){for(const i of e){if(i.name===t)return!0;if(i.innerBlocks&&i.innerBlocks.length>0&&n<o&&c(i.innerBlocks,t,o,n+1))return!0}return!1}const a=window.wp.compose,s=window.wp.i18n,d=window.wp.element,l=window.wp.data,p=window.ReactJSXRuntime;function k(e){if((0,n.hasBlockSupport)(e,"kbMetadata")){e.attributes=(0,i.assign)(e.attributes,{metadata:{type:"object",default:{name:""}}});const t=(0,n.getBlockSupport)(e,"kbContentLabel");e.__experimentalLabel=(o,{context:n})=>{const{metadata:r}=o;return"list-view"===n&&""!==(0,i.get)(r,"name","")?r.name:"list-view"===n&&void 0!==t&&""!==(0,i.get)(o,t)?"kadence/pane"===(0,i.get)(e,"name")&&(0,i.get)(o,t)instanceof Array?b((0,i.get)(o,t)):(0,i.get)(o,t):void 0}}return e}function b(e){let t="";return e.forEach(e=>{"string"==typeof e?t+=e:e.props&&e.props.children&&(t+=b(e.props.children))}),t}(0,o.addFilter)("blocks.registerBlockType","kadence/block-label",k);const h=(0,a.createHigherOrderComponent)(e=>t=>{const o="header"===(0,l.select)("core/editor").getEditedPostAttribute("area"),a=(0,l.select)("core/block-editor").getBlocks(),k=(0,i.get)(a,["0","clientId"]),[b,h]=(0,d.useState)(!1),[u,w]=(0,d.useState)(!1),m=()=>w(!1),g=o&&t.clientId===k&&!c(a,"kadence/header"),{getEntityRecord:_}=(0,l.select)("core"),{saveEntityRecord:y}=(0,l.useDispatch)("core"),{removeBlocks:f,insertBlock:x}=(0,l.useDispatch)("core/block-editor"),j=_("root","site"),B=(0,i.get)(j,"kadence_blocks_header_notice_dismissed",!1);return(0,p.jsxs)(p.Fragment,{children:[u&&(0,p.jsxs)(r.Modal,{title:(0,s.__)("Replace header","kadence-blocks"),onRequestClose:m,children:[(0,p.jsx)("p",{children:(0,s.__)("This will replace your header with a Kadence Header block.","kadence-blocks")}),(0,p.jsxs)("div",{style:{marginBottom:"15px",display:"flex",justifyContent:"space-between"},children:[(0,p.jsx)(r.Button,{isPrimary:!0,onClick:()=>{f(a.map(e=>e.clientId)),x((0,n.createBlock)("kadence/header",{})),y("root","site",{kadence_blocks_header_notice_dismissed:!0}),h(!0),m()},children:(0,s.__)("Replace","kadence-blocks")}),(0,p.jsx)(r.Button,{isSecondary:!0,onClick:m,children:(0,s.__)("Cancel","kadence-blocks")})]})]}),g&&!b&&!B&&(0,p.jsxs)("div",{style:{height:"30px",padding:"15px",backgroundColor:"#fef8ef",borderBottom:"1px solid rgb(155, 155, 155, 0.6)",borderLeft:"4px solid #f1b849",display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"5px"},children:[(0,s.__)("Try the Kadence Header block!","kadence-blocks"),(0,p.jsxs)("div",{children:[(0,p.jsx)(r.Button,{isPrimary:!0,style:{marginRight:"15px"},onClick:()=>{w(!0)},children:(0,s.__)("Replace with Kadence Header","kadence-blocks")}),(0,p.jsx)(r.Button,{isSecondary:!0,onClick:()=>{h(!0),y("root","site",{kadence_blocks_header_notice_dismissed:!0})},children:(0,s.__)("Dismiss","kadence-blocks")})]})]}),(0,p.jsx)(e,{...t})]})},"withTemplatePartNotice");window.wpWidgets||(0,o.addFilter)("editor.BlockEdit","kadence-blocks/with-template-part-notice",h),(this.kadence=this.kadence||{})["early-filters"]=t})();