(()=>{"use strict";const e=window.wp.blocks,t=window.React,n=window.wp.blockEditor,o=window.wp.components,s=window.wp.coreData,r=window.wp.hooks,i=window.wp.i18n,l=(0,o.withFilters)("personalizeWP.addInspectorControls")(e=>(0,t.createElement)(t.Fragment,null));function a(e){var a;const{attributes:c,setAttributes:p}=e,d=(0,s.useEntityRecord)("personalizewp/v1","settings");if(d.isResolving)return(0,t.createElement)(n.InspectorControls,{group:"settings"},(0,t.createElement)(o.PanelBody,{title:(0,i.__)("Loading","personalizewp")},(0,t.createElement)(o.Spinner,null)));const w=d.record;let u=null!==(a=c?.["display-conditions"])&&void 0!==a?a:{};return(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(o.PanelBody,{title:(0,i.__)("Variation Settings","personalizewp")},(0,t.createElement)("p",null,(0,i.__)("Choose one of the options below. The content variation will show if the criteria is met.","personalizewp")),(0,t.createElement)(l,{blockAtts:u,setPersonalizeWPAtts:function(e){Object.entries(e).forEach(([t,n])=>{(0,r.applyFilters)("personalizeWP.hasRequiredFields",!1,{[t]:n})||(delete e[t],delete u[t])});let t=Object.assign({...u},{...e});var n;n=t,[Object,Array].includes((n||{}).constructor)&&!Object.entries(n||{}).length&&(t=void 0),p({"display-conditions":t})},settings:w,...e})))}const c=JSON.parse('{"UU":"personalizewp-pro/variation"}');(0,e.registerBlockType)(c.UU,{edit:function(e){const{attributes:o}=e,s=(0,n.useBlockProps)(),r=(0,n.useInnerBlocksProps)(s);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(a,{...e}),(0,t.createElement)("div",{...r,hidden:!o.isActive}))},save:function(e){const o=n.useBlockProps.save(),{className:s,...r}=n.useInnerBlocksProps.save(o);return(0,t.createElement)("pwp-content-variation",{...r})}})})();