(()=>{"use strict";var e={20:(e,r,o)=>{var t=o(609),n=Symbol.for("react.element"),s=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};r.jsx=function(e,r,o){var t,l={},c=null,m=null;for(t in void 0!==o&&(c=""+o),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(m=r.ref),r)s.call(r,t)&&!a.hasOwnProperty(t)&&(l[t]=r[t]);if(e&&e.defaultProps)for(t in r=e.defaultProps)void 0===l[t]&&(l[t]=r[t]);return{$$typeof:n,type:e,key:c,ref:m,props:l,_owner:i.current}}},609:e=>{e.exports=window.React},848:(e,r,o)=>{e.exports=o(20)}},r={};function o(t){var n=r[t];if(void 0!==n)return n.exports;var s=r[t]={exports:{}};return e[t](s,s.exports,o),s.exports}var t=o(609);const n=window.wp.hooks,s=window.wp.i18n,i=window.wp.components,a=window.wp.primitives;var l=o(848);const c=(0,l.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,l.jsx)(a.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),m=(0,l.jsx)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,l.jsx)(a.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M7.404 16.596a6.5 6.5 0 1 0 9.192-9.192 6.5 6.5 0 0 0-9.192 9.192ZM6.344 6.343a8 8 0 1 0 11.313 11.314A8 8 0 0 0 6.343 6.343Zm4.906 9.407v-3h-3v-1.5h3v-3h1.5v3h3v1.5h-3v3h-1.5Z"})}),p=e=>[Object,Array].includes((e||{}).constructor)&&!Object.entries(e||{}).length;(0,n.addFilter)("personalizeWP.hasRequiredFields","personalizewp/check-for-woocommerce-memberships-plans",(e,r)=>!!(Object.hasOwn(r,"integrations")&&"woocommerce-memberships"==r?.integrations?.plugin&&Object.hasOwn(r?.integrations,"woocommerce_memberships_plans")&&0<r?.integrations?.woocommerce_memberships_plans?.filter(Boolean).length)||e),(0,n.addFilter)("personalizeWP.integrations.attributes","personalizewp/add-woocommerce-memberships-integrations-attributes",function(e){return e.woocommerce_memberships_plans={type:"array",default:[]},e}),(0,n.addFilter)("personalizeWP.additionalIntegrationsControls","personalizewp/add-woocommerce-memberships-inspector-integrations-controls",function(e,r,o,n){var a;const{blockAtts:l,setPersonalizeWPAtts:w,settings:d}=r;if(!d?.integrations?.plugins&&!d?.integrations?.woocommerce_memberships_plans)return e;if("woocommerce-memberships"!==o)return e;const h=[{value:0,label:(0,s.__)("-- Select membership levels --","personalizewp")}].concat(...Array.from(d.integrations.woocommerce_memberships_plans).map(function(e){return{value:parseInt(e.value,10),label:e.label}}));let u=null!==(a=l?.integrations?.woocommerce_memberships_plans)&&void 0!==a?a:[];u&&!p(u)||(u=[0]);const _=e=>{let r=(o=(o=e).map(e=>parseInt(e,10)),[...new Set(o)]);var o;p(r)?n({}):n({woocommerce_memberships_plans:r})};return(0,t.createElement)(t.Fragment,null,u.map((e,r)=>(0,t.createElement)(i.Flex,{direction:"row","data-key":"i"+r,key:"pwp-membeships-plan-"+r,className:"select-integrations-plan"},(0,t.createElement)(i.SelectControl,{label:0===r?(0,s.__)("Plans","personalizewp"):"",hideLabelFromVision:!0,value:String(e),options:h,onChange:e=>{((e,r)=>{u[e]=r,_(u)})(r,e)},__nextHasNoMarginBottom:!0}),1<u.length&&(0,t.createElement)(i.Button,{label:(0,s.__)("Delete field","personalizewp"),icon:c,onClick:()=>{(e=>{u.splice(e,1),_(u)})(r)}}))),(0,t.createElement)("div",{className:"woocommerce-memberships-plan-set__add-woocommerce-memberships-plan"},(0,t.createElement)(i.Flex,{direction:"row",align:"center",justify:"flex-end"},0!==u[u.length-1]&&(0,t.createElement)(i.Button,{label:(0,s.__)("Add another","personalizewp"),icon:m,onClick:()=>{u.splice(u.length,0,0),_(u)}}))))})})();