(()=>{"use strict";var e,a={9716(e,a,l){const r=window.wp.blocks,o=window.wp.i18n,t=window.React,n=window.wp.blockEditor,s=window.wp.apiFetch;var u=l.n(s);const p=window.wp.url,c=window.ReactJSXRuntime,{Fragment:i}=wp.element,{SelectControl:v,ToggleControl:d}=wp.components,g=JSON.parse('{"UU":"rsvpmaker/eventlisting"}');(0,r.registerBlockType)(g.UU,{edit:function(e){const{attributes:a,setAttributes:l,attributes:{posts_per_page:r,days:s,type:g,time:m,date_format:b}}=e,[h,y]=(0,t.useState)([]),[f,k]=(0,t.useState)(null);return(0,t.useEffect)(()=>{const e=[{value:"",label:"None selected (optional)"}];u()({path:"rsvpmaker/v1/types"}).then(a=>{Array.isArray(a)?a.map(function(a){a.slug&&a.name&&e.push({value:a.slug,label:a.name})}):(Object.values(a).map(function(a){a.slug&&a.name&&e.push({value:a.slug,label:a.name})}),console.log(g.slug),console.log(typeof g.slug),console.log(g.name),console.log(typeof g.name))}).catch(e=>{console.log(e)}),y(e)},[]),(0,t.useEffect)(()=>{u()({path:(0,p.addQueryArgs)("/rsvpmaker/v1/preview/eventslisting",a)}).then(e=>{e&&k(e)})},[a]),(0,c.jsx)(i,{children:(0,c.jsxs)("div",{...(0,n.useBlockProps)(),children:[(0,c.jsxs)(n.InspectorControls,{children:[(0,c.jsx)(v,{label:(0,o.__)("Events Per Page","rsvpmaker"),value:r,options:[{value:5,label:5},{value:10,label:10},{value:15,label:15},{value:20,label:20},{value:25,label:25},{value:30,label:30},{value:35,label:35},{value:40,label:40},{value:45,label:45},{value:50,label:50},{value:"-1",label:"No limit"}],onChange:e=>{l({posts_per_page:e})}}),(0,c.jsx)(v,{label:(0,o.__)("Date Range","rsvpmaker"),value:s,options:[{value:5,label:5},{value:30,label:"30 Days"},{value:60,label:"60 Days"},{value:90,label:"90 Days"},{value:180,label:"180 Days"},{value:366,label:"1 Year"}],onChange:e=>{l({days:e})}}),(0,c.jsx)(v,{label:(0,o.__)("Event Type","rsvpmaker"),value:g,options:h,onChange:e=>{l({type:e})}}),(0,c.jsx)(v,{label:(0,o.__)("Date Format","rsvpmaker"),value:b,options:[{label:"Thursday August 8, 2019",value:"%A %B %e, %Y"},{label:"August 8, 2019",value:"%B %e, %Y"},{label:"August 8",value:"%B %e"},{label:"Aug. 8",value:"%h. %e"},{label:"8 August 2019",value:"%e %B %Y"}],onChange:e=>{l({date_format:e})}}),(0,c.jsx)(d,{label:(0,o.__)("Include Time","rsvpmaker"),checked:m,onChange:e=>{l({time:e})}})]},"eventlistinginspector"),f&&(0,c.jsx)("div",{dangerouslySetInnerHTML:{__html:f}}),!f&&(0,c.jsx)("p",{children:"RSVPMaker Events Listing loading ..."})]})})},save:function(){return null},transforms:{to:[{type:"block",blocks:["core/query"],transform:e=>{const a=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."}]]]],l=(0,r.createBlocksFromInnerBlocksTemplate)(a);return(0,r.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"},l)}}]}})}},l={};function r(e){var o=l[e];if(void 0!==o)return o.exports;var t=l[e]={exports:{}};return a[e](t,t.exports,r),t.exports}r.m=a,e=[],r.O=(a,l,o,t)=>{if(!l){var n=1/0;for(c=0;c<e.length;c++){for(var[l,o,t]=e[c],s=!0,u=0;u<l.length;u++)(!1&t||n>=t)&&Object.keys(r.O).every(e=>r.O[e](l[u]))?l.splice(u--,1):(s=!1,t<n&&(n=t));if(s){e.splice(c--,1);var p=o();void 0!==p&&(a=p)}}return a}t=t||0;for(var c=e.length;c>0&&e[c-1][2]>t;c--)e[c]=e[c-1];e[c]=[l,o,t]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a}),a},r.d=(e,a)=>{for(var l in a)r.o(a,l)&&!r.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:a[l]})},r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={858:0,286:0};r.O.j=a=>0===e[a];var a=(a,l)=>{var o,t,[n,s,u]=l,p=0;if(n.some(a=>0!==e[a])){for(o in s)r.o(s,o)&&(r.m[o]=s[o]);if(u)var c=u(r)}for(a&&a(l);p<n.length;p++)t=n[p],r.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return r.O(c)},l=globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[];l.forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l))})();var o=r.O(void 0,[286],()=>r(9716));o=r.O(o)})();