(()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.data,o=window.wp.components,r=window.wp.blockEditor,n=window.wp.serverSideRender;var l=e.n(n);const i=window.wp.blocks,a=window.wp.element,s=window.ReactJSXRuntime;(0,i.registerBlockType)("um-block/um-forms",{edit:function(e){const n=(0,r.useBlockProps)(),{attributes:i,setAttributes:u}=e,{form_id:c}=i,d=(0,t.useSelect)(e=>e("core").getEntityRecords("postType","um_form",{per_page:-1,_fields:["id","title"]}),[]),m=(0,a.useMemo)(()=>d?0===d.length?[{label:wp.i18n.__("No forms found.","ultimate-member"),value:""}]:[{label:wp.i18n.__("Select Form","ultimate-member"),value:""}].concat(d.map(e=>({label:e.title.rendered,value:e.id}))):[{label:wp.i18n.__("Loading...","ultimate-member"),value:""}],[d]);return(0,s.jsxs)("div",{...n,children:[(0,s.jsx)(l(),{block:"um-block/um-forms",attributes:i}),(0,s.jsx)(r.InspectorControls,{children:(0,s.jsx)(o.PanelBody,{title:wp.i18n.__("Select Forms","ultimate-member"),children:(0,s.jsx)(o.SelectControl,{label:wp.i18n.__("Select Forms","ultimate-member"),className:"um_select_forms",value:c,options:m,onChange:e=>u({form_id:e})})})})]})},save:()=>null}),jQuery(window).on("load",function(e){new MutationObserver(function(e){e.forEach(function(e){jQuery(e.addedNodes).find(".um-form").each(function(){let e=document.querySelector(".um-form");e&&e.addEventListener("click",t=>{t.target!==e&&(t.preventDefault(),t.stopPropagation())})})})}).observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})})})();