(()=>{"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,c=window.wp.components,r=window.kadence.helpers,a=window.wp.compose,d=window.wp.i18n,s=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:c}=o;return"list-view"===n&&""!==(0,i.get)(c,"name","")?c.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,s.useState)(!1),[w,m]=(0,s.useState)(!1),u=()=>m(!1),g=o&&t.clientId===k&&!(0,r.blockExists)(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:[w&&(0,p.jsxs)(c.Modal,{title:(0,d.__)("Replace header","kadence-blocks"),onRequestClose:u,children:[(0,p.jsx)("p",{children:(0,d.__)("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)(c.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),u()},children:(0,d.__)("Replace","kadence-blocks")}),(0,p.jsx)(c.Button,{isSecondary:!0,onClick:u,children:(0,d.__)("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,d.__)("Try the Kadence Header block!","kadence-blocks"),(0,p.jsxs)("div",{children:[(0,p.jsx)(c.Button,{isPrimary:!0,style:{marginRight:"15px"},onClick:()=>{m(!0)},children:(0,d.__)("Replace with Kadence Header","kadence-blocks")}),(0,p.jsx)(c.Button,{isSecondary:!0,onClick:()=>{h(!0),y("root","site",{kadence_blocks_header_notice_dismissed:!0})},children:(0,d.__)("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})();