(()=>{"use strict";var e,t={3998:(e,t,a)=>{const s=window.wp.blocks,r=window.wp.blockEditor,n=window.wp.components,o=window.wp.i18n,i=window.wp.element,l=window.wp.data,p=[["gatherpress/modal-manager",{style:{spacing:{blockGap:"var:preset|spacing|40"}}},[["core/buttons",{align:"center",layout:{type:"flex",justifyContent:"center"},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Edit RSVP","Button label for editing RSVP","gatherpress"),tagName:"button",className:"gatherpress-modal--trigger-open",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}]]],["core/group",{style:{spacing:{blockGap:"0"}}},[["core/group",{style:{spacing:{blockGap:"var:preset|spacing|20"}},layout:{type:"flex",flexWrap:"nowrap"}},[["gatherpress/icon",{icon:"yes-alt",iconSize:24}],["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("Attending","RSVP status indicator","gatherpress"),metadata:{name:(0,o._x)("RSVP Status","Block name displayed in the editor","gatherpress")}}]]],["gatherpress/rsvp-guest-count-display",{}]]],["gatherpress/modal",{className:"gatherpress-modal--type-rsvp",metadata:{name:(0,o._x)("RSVP Modal","Modal title in editor","gatherpress")}},[["gatherpress/modal-content",{},[["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("You're Attending","RSVP modal header","gatherpress"),metadata:{name:(0,o._x)("RSVP Heading","Block name displayed in the editor","gatherpress")}}],["core/paragraph",{content:(0,o.__)("To change your attendance status, simply click the Not Attending button below.","gatherpress"),metadata:{name:(0,o._x)("RSVP Info","Block name displayed in the editor","gatherpress")}}],["gatherpress/form-field",{className:"gatherpress-rsvp-field-guests",fieldType:"number",fieldName:"gatherpress_rsvp_guests",label:(0,o.__)("Number of guests?","gatherpress"),placeholder:(0,o.__)("0","gatherpress"),minValue:0,inlineLayout:!0,fieldWidth:10,inputPadding:5,autocomplete:"off"}],["gatherpress/form-field",{className:"gatherpress-rsvp-field-anonymous",fieldType:"checkbox",fieldName:"gatherpress_rsvp_anonymous",label:(0,o.__)("List me as anonymous","gatherpress"),autocomplete:"off"}],["core/buttons",{align:"left",layout:{type:"flex",justifyContent:"flex-start"},style:{spacing:{margin:{bottom:"0"},padding:{bottom:"0"}}},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Not Attending","RSVP button label for declining event attendance","gatherpress"),tagName:"button",className:"gatherpress-rsvp--trigger-update",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}],["core/button",{text:(0,o._x)("Close","Button label for closing modal dialog","gatherpress"),tagName:"button",className:"is-style-outline gatherpress-modal--trigger-close",metadata:{name:(0,o._x)("Close Button","Block name displayed in the editor","gatherpress")}}]]]]]]]]]],d=[["gatherpress/modal-manager",{},[["core/buttons",{align:"center",layout:{type:"flex",justifyContent:"center"},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("RSVP","Button label for editing RSVP","gatherpress"),tagName:"button",className:"gatherpress-modal--trigger-open",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}]]],["gatherpress/modal",{className:"gatherpress-modal--type-rsvp",metadata:{name:(0,o._x)("RSVP Modal","Modal title in editor","gatherpress")}},[["gatherpress/modal-content",{},[["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("RSVP to this event","RSVP modal header","gatherpress"),metadata:{name:(0,o._x)("RSVP Heading","Block name displayed in the editor","gatherpress")}}],["core/paragraph",{content:(0,o.__)("To set your attendance status, simply click the Attend button below.","gatherpress"),metadata:{name:(0,o._x)("RSVP Info","Block name displayed in the editor","gatherpress")}}],["gatherpress/form-field",{className:"gatherpress-rsvp-field-anonymous",fieldType:"checkbox",fieldName:"gatherpress_rsvp_anonymous",label:(0,o.__)("List me as anonymous","gatherpress"),autocomplete:"off"}],["core/buttons",{align:"left",layout:{type:"flex",justifyContent:"flex-start"},style:{spacing:{margin:{bottom:"0"},padding:{bottom:"0"}}},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Attend","RSVP button label for confirming event attendance","gatherpress"),tagName:"button",className:"gatherpress-rsvp--trigger-update",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}],["core/button",{text:(0,o._x)("Close","Button label for closing modal dialog","gatherpress"),tagName:"button",className:"is-style-outline gatherpress-modal--trigger-close",metadata:{name:(0,o._x)("Close Button","Block name displayed in the editor","gatherpress")}}]]]]]]],["gatherpress/modal",{className:"gatherpress-modal--login",metadata:{name:(0,o._x)("Login Modal","Block title for the login modal","gatherpress")}},[["gatherpress/modal-content",{},[["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("Login Required","Login modal header","gatherpress"),metadata:{name:(0,o._x)("Login Heading","Block name displayed in the editor","gatherpress")}}],["core/paragraph",{content:(0,o.__)('This action requires an account. Please Login to RSVP to this event.',"gatherpress"),className:"gatherpress--has-login-url",metadata:{name:(0,o._x)("Login Info","Block name displayed in the editor","gatherpress")}}],["core/paragraph",{content:(0,o.__)('Don\'t have an account? Register here to create one.',"gatherpress"),className:"gatherpress--has-registration-url",metadata:{name:(0,o._x)("Register Info","Block name displayed in the editor","gatherpress")}}],["core/buttons",{align:"left",layout:{type:"flex",justifyContent:"flex-start"},style:{spacing:{margin:{bottom:"0"},padding:{bottom:"0"}}},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Close","Button label for closing modal dialog","gatherpress"),tagName:"button",className:"gatherpress-modal--trigger-close",metadata:{name:(0,o._x)("Close Button","Block name displayed in the editor","gatherpress")}}]]]]]]]]]],g=[["gatherpress/modal-manager",{style:{spacing:{blockGap:"var:preset|spacing|40"}}},[["core/buttons",{align:"center",layout:{type:"flex",justifyContent:"center"},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Edit RSVP","Button label for editing RSVP","gatherpress"),tagName:"button",className:"gatherpress-modal--trigger-open",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}]]],["core/group",{style:{spacing:{blockGap:"var:preset|spacing|20"}},layout:{type:"flex",flexWrap:"nowrap"}},[["gatherpress/icon",{icon:"dismiss",iconSize:24}],["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("Not Attending","RSVP status indicator","gatherpress"),metadata:{name:(0,o._x)("RSVP Status","Block name displayed in the editor","gatherpress")}}]]],["gatherpress/modal",{className:"gatherpress-modal--type-rsvp",metadata:{name:(0,o._x)("RSVP Modal","Modal title in editor","gatherpress")}},[["gatherpress/modal-content",{},[["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("You're Not Attending","RSVP modal header","gatherpress"),metadata:{name:(0,o._x)("RSVP Heading","Block name displayed in the editor","gatherpress")}}],["core/paragraph",{content:(0,o.__)("To change your attendance status, simply click the Attending button below.","gatherpress"),metadata:{name:(0,o._x)("RSVP Info","Block name displayed in the editor","gatherpress")}}],["gatherpress/form-field",{className:"gatherpress-rsvp-field-anonymous",fieldType:"checkbox",fieldName:"gatherpress_rsvp_anonymous",label:(0,o.__)("List me as anonymous","gatherpress"),autocomplete:"off"}],["core/buttons",{align:"left",layout:{type:"flex",justifyContent:"flex-start"},style:{spacing:{margin:{bottom:"0"},padding:{bottom:"0"}}},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Attending","RSVP button label for confirming event attendance","gatherpress"),tagName:"button",className:"gatherpress-rsvp--trigger-update",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}],["core/button",{text:(0,o._x)("Close","Button label for closing modal dialog","gatherpress"),tagName:"button",className:"is-style-outline gatherpress-modal--trigger-close",metadata:{name:(0,o._x)("Close Button","Block name displayed in the editor","gatherpress")}}]]]]]]]]]],c={no_status:d,attending:p,waiting_list:[["gatherpress/modal-manager",{style:{spacing:{blockGap:"var:preset|spacing|40"}}},[["core/buttons",{align:"center",layout:{type:"flex",justifyContent:"center"},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Edit RSVP","Button label for editing RSVP","gatherpress"),tagName:"button",className:"gatherpress-modal--trigger-open",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}]]],["core/group",{style:{spacing:{blockGap:"var:preset|spacing|20"}},layout:{type:"flex",flexWrap:"nowrap"}},[["gatherpress/icon",{icon:"clock",iconSize:24}],["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("Waiting List","RSVP status indicator","gatherpress"),metadata:{name:(0,o._x)("RSVP Status","Block name displayed in the editor","gatherpress")}}]]],["gatherpress/modal",{className:"gatherpress-modal--type-rsvp",metadata:{name:(0,o._x)("RSVP Modal","Block name displayed in the editor","gatherpress")}},[["gatherpress/modal-content",{},[["core/paragraph",{style:{spacing:{margin:{top:"0"},padding:{top:"0"}}},content:(0,o._x)("You're Wait Listed","RSVP modal header","gatherpress"),metadata:{name:(0,o._x)("RSVP Heading","Block name displayed in the editor","gatherpress")}}],["core/paragraph",{content:(0,o.__)("To change your attendance status, simply click the Not Attending button below.","gatherpress"),metadata:{name:(0,o._x)("RSVP Info","Block name displayed in the editor","gatherpress")}}],["gatherpress/form-field",{className:"gatherpress-rsvp-field-anonymous",fieldType:"checkbox",fieldName:"gatherpress_rsvp_anonymous",label:(0,o.__)("List me as anonymous","gatherpress"),autocomplete:"off"}],["core/buttons",{align:"left",layout:{type:"flex",justifyContent:"flex-start"},style:{spacing:{margin:{bottom:"0"},padding:{bottom:"0"}}},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Not Attending","RSVP button label for declining event attendance","gatherpress"),tagName:"button",className:"gatherpress-rsvp--trigger-update",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}],["core/button",{text:(0,o._x)("Close","Button label for closing modal dialog","gatherpress"),tagName:"button",className:"is-style-outline gatherpress-modal--trigger-close",metadata:{name:(0,o._x)("Close Button","Block name displayed in the editor","gatherpress")}}]]]]]]]]]],not_attending:g,past:[["core/buttons",{align:"center",layout:{type:"flex",justifyContent:"center"},metadata:{name:(0,o._x)("Call to Action","Block name displayed in the editor","gatherpress")}},[["core/button",{text:(0,o._x)("Past Event","Button label for past RSVP","gatherpress"),tagName:"button",className:"gatherpress--is-disabled",metadata:{name:(0,o._x)("RSVP Button","Block name displayed in the editor","gatherpress")}}]]]]},m=window.moment;var u=a.n(m);function h(){const e=(0,l.select)("core/editor")?.getCurrentPostType();return["wp_template","wp_template_part"].includes(e)}window.wp.hooks,window.wp.date;const y=window.ReactJSXRuntime,f="YYYY-MM-DD HH:mm:ss";function _(){const e=k();return x(u()().format("YYYY-MM-DD HH:mm:ss"),e).add(1,"day").set("hour",18).set("minute",0).set("second",0).format(f)}function b(e){return/^[+-]\d{2}:\d{2}$/.test(e)}function x(e,t){return b(t)?u()(e).utcOffset(t,!0):u().tz(e,t)}function k(e=function(){if("object"==typeof GatherPress)return"eventDetails.dateTime.timezone".split(".").reduce((e,t)=>e?.[t],GatherPress)}()){return b(e)||u().tz.zone(e)?e:(0,o.__)("GMT","gatherpress")}function v(e){return e.map(([e,t,a])=>(0,s.createBlock)(e,t,v(a||[])))}_(),function(){const e=k();x(_(),e).add(2,"hours").format(f)}();const B=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"gatherpress/rsvp","version":"2.0.0","title":"RSVP","category":"gatherpress","icon":"insert","example":{},"description":"Enables members to easily confirm their attendance for an event.","usesContext":["postId","queryId"],"attributes":{"serializedInnerBlocks":{"type":"string","default":"[]"},"selectedStatus":{"type":"string","default":"no_status"}},"supports":{"gatherpress":{"blockGuard":true,"postIdOverride":true},"html":false,"interactivity":true},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","viewScriptModule":"file:./view.js"}');(0,s.registerBlockType)(B,{edit:({attributes:e,setAttributes:t,clientId:a,context:p})=>{var d,g;const{serializedInnerBlocks:m="{}",selectedStatus:u}=e,{replaceInnerBlocks:f}=(0,l.useDispatch)(r.store),_=null!==(d=null!==(g=e?.postId||null)&&void 0!==g?g:p?.postId)&&void 0!==d?d:null,b=function(e=null){if(e){const t=(0,l.select)("core").getEntityRecord("postType","gatherpress_event",e),a=(0,l.select)("core/editor")?.getCurrentPostId();return a&&a===e?!!t:!!t&&"publish"===t.status}return"gatherpress_event"===(0,l.select)("core/editor")?.getCurrentPostType()}(_),x=(0,r.useBlockProps)({style:{opacity:h()||b?1:.3}}),k=(0,l.useSelect)(e=>e(r.store).getBlocks(a),[a]),{maxGuestLimit:B,enableAnonymousRsvp:S}=(0,l.useSelect)(t=>function(e,t,a){let s,r;if(a?.postId&&t){const a=e("core").getEntityRecord("postType","gatherpress_event",t);s=a?.meta?.gatherpress_max_guest_limit,r=Boolean(a?.meta?.gatherpress_enable_anonymous_rsvp)}else{const t=e("core/editor")?.getCurrentPostType();if("gatherpress_event"===t){const t=e("core/editor").getEditedPostAttribute("meta");s=t?.gatherpress_max_guest_limit,r=Boolean(t?.gatherpress_enable_anonymous_rsvp)}}return{maxGuestLimit:null!=s?s:0,enableAnonymousRsvp:null!=r&&r}}(t,_,e),[_,e]),P=(0,i.useCallback)(e=>e.map(e=>{if("gatherpress/form-field"===e.name){const t=e.attributes?.fieldName;let a=!1;if("gatherpress_rsvp_guests"===t?a=0===parseInt(B,10):"gatherpress_rsvp_anonymous"===t&&(a=!S),"gatherpress_rsvp_guests"===t||"gatherpress_rsvp_anonymous"===t){const t={...e.attributes};return a?t["data-gatherpress-no-render"]="true":delete t["data-gatherpress-no-render"],{...e,attributes:t}}}return e.innerBlocks&&0{const n=JSON.parse(m||"{}"),o=(0,s.serialize)(r),i={...n,[e]:o};delete i[a],t({serializedInnerBlocks:JSON.stringify(i)})},[m,t]),R=(0,i.useCallback)(e=>{const t=JSON.parse(m||"{}")[e];t&&0{const e=()=>{const e=JSON.parse(m||"{}"),a=Object.keys(c).reduce((t,a)=>{if(e[a])return t[a]=e[a],t;if(a!==u){const e=v(c[a]);t[a]=(0,s.serialize)(e)}return t},{...e});t({serializedInnerBlocks:JSON.stringify(a)})};setTimeout(()=>{e()},0)},[m,t,u]),(0,i.useEffect)(()=>{const e=function(){const e=document.querySelector('iframe[name="editor-canvas"]');return e?.contentDocument?e.contentDocument:document}(),t=`gatherpress-rsvp-visibility-${a}`;let s=e.getElementById(t);s||(s=e.createElement("style"),s.id=t,e.head.appendChild(s));const r=[];return 0===parseInt(B,10)&&r.push(`#block-${a} .gatherpress-rsvp-field-guests { opacity: 0.3; }`),S||r.push(`#block-${a} .gatherpress-rsvp-field-anonymous { opacity: 0.3; }`),s.textContent=r.join("\n"),()=>{s?.remove()}},[B,S,a]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.InspectorControls,{children:(0,y.jsxs)(n.PanelBody,{title:(0,o.__)("RSVP Block Settings","gatherpress"),children:[(0,y.jsx)("p",{children:(0,o.__)("Select an RSVP status to edit how this block appears for users with that status.","gatherpress")}),(0,y.jsx)(n.SelectControl,{label:(0,o.__)("Edit Block Status","gatherpress"),value:u,options:[{label:(0,o.__)("No Response (Default)","gatherpress"),value:"no_status"},{label:(0,o.__)("Attending","gatherpress"),value:"attending"},{label:(0,o.__)("Waiting List","gatherpress"),value:"waiting_list"},{label:(0,o.__)("Not Attending","gatherpress"),value:"not_attending"},{label:(0,o.__)("Past Event","gatherpress"),value:"past"}],onChange:e=>{R(e),t({selectedStatus:e}),N(u,e,k)}})]})}),(0,y.jsx)("div",{...x,children:(0,y.jsx)(r.InnerBlocks,{template:c[u]})})]})},save:()=>(0,y.jsx)("div",{...r.useBlockProps.save(),children:(0,y.jsx)(r.InnerBlocks.Content,{})})})}},a={};function s(e){var r=a[e];if(void 0!==r)return r.exports;var n=a[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.m=t,e=[],s.O=(t,a,r,n)=>{if(!a){var o=1/0;for(d=0;d=n)&&Object.keys(s.O).every(e=>s.O[e](a[l]))?a.splice(l--,1):(i=!1,n0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[a,r,n]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={3662:0,1394:0};s.O.j=t=>0===e[t];var t=(t,a)=>{var r,n,[o,i,l]=a,p=0;if(o.some(t=>0!==e[t])){for(r in i)s.o(i,r)&&(s.m[r]=i[r]);if(l)var d=l(s)}for(t&&t(a);ps(3998));r=s.O(r)})();