(()=>{"use strict";var e,r={2035(){const e=window.wp.blocks,r=window.ReactJSXRuntime,{__}=wp.i18n,{Fragment:t}=wp.element,{Component:o}=wp.element,{InspectorControls:s,useBlockProps:a}=wp.blockEditor,{PanelBody:n,SelectControl:l,TextControl:i,TextareaControl:c,ToggleControl:u,RadioControl:p}=wp.components;class d extends o{render(){const{attributes:e,setAttributes:t,className:o}=this.props,a=e.choicearray.join("\n");return(0,r.jsx)(s,{children:(0,r.jsxs)(n,{title:__("Field Properties","rsvpmaker"),children:[(0,r.jsx)(i,{label:__("Label","rsvpmaker"),value:e.label,onChange:r=>function(r){!function({label:e,attributes:r,setAttributes:t,setGuestform:o=!0}){if(r.slug&&("first"===r.slug||"last"===r.slug||"email"===r.slug||r.slug.length>25))return void t({label:e});let s=e.toLowerCase().replaceAll(/[^A-Za-z0-9]+/g,"_");s.length>20&&(s=s.substring(0,20)),s+="_"+Date.now();const a={slug:s,label:e};o&&(a.guestform=!0),t(a)}({label:r,attributes:e,setAttributes:t,slugLockLength:0,setGuestform:!0})}(r)}),(0,r.jsx)(i,{label:__("Field Note (optional additional information)","rsvpmaker"),value:e.fieldnote||"",onChange:e=>t({fieldnote:e})}),(0,r.jsx)(c,{label:__("Choices","rsvpmaker"),value:a,onChange:e=>function(e){t({choicearray:e.split("\n")})}(e)}),(0,r.jsx)("div",{children:(0,r.jsx)("em",{children:"Enter each choice on a separate line"})}),(0,r.jsx)(u,{label:__("Include on Guest Form","rsvpmaker"),checked:e.guestform,help:e.guestform?"Included":"Not included",onChange:e=>{t({guestform:e})}}),(0,r.jsx)(u,{label:__("Check first choice by default","rsvpmaker"),checked:e.defaultToFirst,help:e.defaultToFirst?"First item selected by default":"No default",onChange:e=>{t({defaultToFirst:e})}})]})},"choiceinspector")}}const m=JSON.parse('{"UU":"rsvpmaker/formradio"}');(0,e.registerBlockType)(m.UU,{edit:function(e){const{attributes:{label:o,fieldnote:s,slug:n,choicearray:l,guestform:i,defaultToFirst:c},setAttributes:u,isSelected:p}=e;var m="profile["+n+"]";const h=a();return(0,r.jsxs)(t,{children:[(0,r.jsx)(d,{...e}),(0,r.jsx)("div",{...h,children:(0,r.jsxs)("div",{className:e.className,children:[(0,r.jsx)("p",{children:(0,r.jsxs)("label",{children:[o,":"]})}),s&&(0,r.jsx)("p",{children:(0,r.jsx)("em",{children:s})}),(0,r.jsx)("div",{className:"rsvp-radio-line",children:(0,r.jsx)("span",{children:l.map(function(e,t){return(0,r.jsxs)("div",{className:"rsvp-form-radio",children:[(0,r.jsx)("input",{type:"radio",className:n,name:m,id:n,value:e,checked:c&&0==t})," ",e," "]})})})}),p&&(0,r.jsx)("div",{children:(0,r.jsx)("em",{children:__("Set form label and other properties in sidebar. For use within an RSVPMaker registration form.","rsvpmaker")})})]})})]})},save:function(){return null},transforms:{to:[{type:"block",blocks:["core/query"],transform:r=>{const t=r.calendar&&parseInt(r.calendar)?[["rsvpmaker/calendar",r],["core/post-template",{layout:{type:"grid",columnCount:2}},[["core/post-title",{isLink:!0}],["core/post-featured-image"],["rsvpmaker/loop-blocks"],["core/read-more",{content:"Read More >>"}]]],["core/query-pagination"],["core/query-no-results",{},[["core/paragraph",{content:"No events found."}]]]]:[["core/post-template",{layout:{type:"grid",columnCount:2}},[["core/post-title",{isLink:!0}],["core/post-featured-image"],["rsvpmaker/loop-blocks"],["core/read-more",{content:"Read More >>"}]]],["core/query-pagination"],["core/query-no-results",{},[["core/paragraph",{content:"No events found."}]]]],o=(0,e.createBlocksFromInnerBlocksTemplate)(t);return(0,e.createBlock)("core/query",{queryId:0,query:{perPage:20,pages:0,offset:0,postType:"rsvpmaker",order:"asc",author:"",search:"",exclude:[],sticky:"",inherit:!1},namespace:"rsvpmaker/rsvpmaker-loop"},o)}}]}})}},t={};function o(e){var s=t[e];if(void 0!==s)return s.exports;var a=t[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.m=r,e=[],o.O=(r,t,s,a)=>{if(!t){var n=1/0;for(u=0;u<e.length;u++){for(var[t,s,a]=e[u],l=!0,i=0;i<t.length;i++)(!1&a||n>=a)&&Object.keys(o.O).every(e=>o.O[e](t[i]))?t.splice(i--,1):(l=!1,a<n&&(n=a));if(l){e.splice(u--,1);var c=s();void 0!==c&&(r=c)}}return r}a=a||0;for(var u=e.length;u>0&&e[u-1][2]>a;u--)e[u]=e[u-1];e[u]=[t,s,a]},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={6567:0,2223:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var s,a,[n,l,i]=t,c=0;if(n.some(r=>0!==e[r])){for(s in l)o.o(l,s)&&(o.m[s]=l[s]);if(i)var u=i(o)}for(r&&r(t);c<n.length;c++)a=n[c],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return o.O(u)},t=globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var s=o.O(void 0,[2223],()=>o(2035));s=o.O(s)})();