(()=>{"use strict";var e,r={5762(e,r,o){const t=window.wp.blocks,n=window.wp.apiFetch;var a=o.n(n);const l=window.React,s=window.ReactJSXRuntime,{__}=wp.i18n,{InspectorControls:c,useBlockProps:p}=wp.blockEditor,{SelectControl:i}=wp.components,{RawHTML:u}=wp.element,v=JSON.parse('{"UU":"rsvpmaker/next-events"}');(0,t.registerBlockType)(v.UU,{edit:function(e){const r=p(),{attributes:{number_of_posts:o,rsvp_only:t},setAttributes:n,isSelected:v}=e,[d,m]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{const e="/rsvpmaker/v1/preview/next-events?number_of_posts="+o;console.log(e);const r=await a()({path:e});m(r)})()},[o]),(0,s.jsxs)("div",{...r,children:[(0,s.jsxs)(c,{children:[(0,s.jsx)(i,{label:__("Number of Event Links Shown","rsvpmaker"),value:o,options:[{label:"1 (next only)",value:1},{label:"2 (next +1)",value:2},{label:"3 (next +2)",value:3},{label:"4 (next +3)",value:4},{label:"5 (next +4)",value:5},{label:"6 (next +5)",value:6},{label:"7 (next +6)",value:7},{label:"8 (next +7)",value:8},{label:"9 (next +8)",value:9},{label:"10 (next +9)",value:10}],onChange:e=>{n({number_of_posts:e})}}),(0,s.jsxs)("div",{style:{marginTop:"15px"},children:[(0,s.jsx)("input",{type:"checkbox",id:"rsvp_only",checked:t,onChange:e=>{n({rsvp_only:e.target.checked})}}),(0,s.jsx)("label",{htmlFor:"rsvp_only",style:{marginLeft:"5px"},children:__("RSVP On Only","rsvpmaker")}),(0,s.jsx)("p",{style:{margin:"5px 0 0 25px",fontSize:"12px",color:"#666"},children:__("Only include events where the _rsvp_on postmeta flag is enabled.","rsvpmaker")})]})]},"eventinspector"),(0,s.jsx)(u,{children:d}),!d&&(0,s.jsx)("p",{children:"Loading..."})]})},save:function(){return null},transforms:{to:[{type:"block",blocks:["core/query"],transform:e=>{const r=e.calendar&&parseInt(e.calendar)?[["rsvpmaker/calendar",e],["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,t.createBlocksFromInnerBlocksTemplate)(r);return(0,t.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)}}]}})}},o={};function t(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return r[e](a,a.exports,t),a.exports}t.m=r,e=[],t.O=(r,o,n,a)=>{if(!o){var l=1/0;for(i=0;i<e.length;i++){for(var[o,n,a]=e[i],s=!0,c=0;c<o.length;c++)(!1&a||l>=a)&&Object.keys(t.O).every(e=>t.O[e](o[c]))?o.splice(c--,1):(s=!1,a<l&&(l=a));if(s){e.splice(i--,1);var p=n();void 0!==p&&(r=p)}}return r}a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[o,n,a]},t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={7439:0,9671:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,a,[l,s,c]=o,p=0;if(l.some(r=>0!==e[r])){for(n in s)t.o(s,n)&&(t.m[n]=s[n]);if(c)var i=c(t)}for(r&&r(o);p<l.length;p++)a=l[p],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(i)},o=globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[];o.forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o))})();var n=t.O(void 0,[9671],()=>t(5762));n=t.O(n)})();