(()=>{"use strict";var e={4997:e=>{e.exports=window.wp.blocks},5119:(e,r,t)=>{t.d(r,{Q:()=>p});var s=t(4997),n=t(7723),a=t(6947),o=t(9092),i=t(8035);const l="core/query-pagination",c="gatherpress-query-pagination",u=[a._,o.b,i._],p=[l,{className:c},u];(0,s.registerBlockVariation)(l,{category:"gatherpress",keywords:[(0,n.__)("Page numbers","gatherpress"),(0,n.__)("Pagination","gatherpress")],isActive:["className"],attributes:{className:c},scope:["block","inserter","transform"],name:c,title:(0,n.__)("Event Pagination","gatherpress"),description:(0,n.__)("Displays a paginated navigation to next/previous set of events, when applicable.","gatherpress"),innerBlocks:[...u]})},6947:(e,r,t)=>{t.d(r,{_:()=>l});var s=t(4997),n=t(7723);const a="core/query-pagination-previous",o="gatherpress-query-pagination-previous",i=(0,n.__)("Previous Events","gatherpress"),l=[a,{className:o,label:i}];(0,s.registerBlockVariation)(a,{category:"gatherpress",keywords:[(0,n.__)("Page numbers","gatherpress"),(0,n.__)("Pagination","gatherpress")],isActive:["className"],attributes:{className:o,label:i},scope:["block","inserter","transform"],name:o,title:i,description:(0,n.__)("Displays the previous events link.","gatherpress")})},7723:e=>{e.exports=window.wp.i18n},8035:(e,r,t)=>{t.d(r,{_:()=>l});var s=t(4997),n=t(7723);const a="core/query-pagination-next",o="gatherpress-query-pagination-next",i=(0,n.__)("Next Events","gatherpress"),l=[a,{className:o,label:i}];(0,s.registerBlockVariation)(a,{category:"gatherpress",keywords:[(0,n.__)("Page numbers","gatherpress"),(0,n.__)("Pagination","gatherpress")],isActive:["className"],attributes:{className:o,label:i},scope:["block","inserter","transform"],name:o,title:i,description:(0,n.__)("Displays the next events link.","gatherpress")})},9092:(e,r,t)=>{t.d(r,{b:()=>i});var s=t(4997),n=t(7723);const a="core/query-pagination-numbers",o="gatherpress-query-pagination-numbers",i=[a,{className:o}];(0,s.registerBlockVariation)(a,{category:"gatherpress",keywords:[(0,n.__)("Page numbers","gatherpress"),(0,n.__)("Pagination","gatherpress")],isActive:["className"],attributes:{className:o},scope:["block","inserter","transform"],name:o,title:(0,n.__)("Event Numbers","gatherpress"),description:(0,n.__)("Displays a list of event numbers for pagination.","gatherpress")})},9623:(e,r,t)=>{t.d(r,{W:()=>l});var s=t(4997),n=t(7723);const a="core/query-no-results",o="gatherpress-query-no-results",i=[["core/paragraph",{placeholder:(0,n.__)("Add text or blocks that will display when a query returns no events.","gatherpress")}]],l=[a,{className:o},i];(0,s.registerBlockVariation)(a,{category:"gatherpress",isActive:["className"],attributes:{className:o},scope:["block","inserter","transform"],name:o,title:(0,n.__)("No Event Results","gatherpress"),description:(0,n.__)("Contains the block elements used to render content when no event query results are found.","gatherpress"),innerBlocks:[...i]})}},r={};function t(s){var n=r[s];if(void 0!==n)return n.exports;var a=r[s]={exports:{}};return e[s](a,a.exports,t),a.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var s in r)t.o(r,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:r[s]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.d({},{o:()=>Y});var s=t(4997),n=t(7723);const a=window.wp.hooks,o=window.wp.blockEditor,i=window.wp.components,l=window.wp.element,c=window.wp.plugins,u=window.ReactJSXRuntime,{Fill:p,Slot:g}=(0,i.createSlotFill)("GatherPressQueryControls"),d=({children:e})=>(0,u.jsx)(p,{children:e});d.Slot=({fillProps:e})=>(0,u.jsx)(g,{fillProps:e,children:e=>e.length?e:null});const h=d,{Fill:_,Slot:m}=(0,i.createSlotFill)("GatherPressInheritedQueryControls"),y=({children:e})=>(0,u.jsx)(_,{children:e});y.Slot=({fillProps:e})=>(0,u.jsx)(m,{fillProps:e,children:e=>e.length?e:null});const v=y,b=window.wp.data,f=window.moment;var x=t.n(f);window.wp.date;const q="YYYY-MM-DD HH:mm:ss";function w(){const e=P();return k(x()().format("YYYY-MM-DD HH:mm:ss"),e).add(1,"day").set("hour",18).set("minute",0).set("second",0).format(q)}function j(e){return/^[+-]\d{2}:\d{2}$/.test(e)}function k(e,r){return j(r)?x()(e).utcOffset(r,!0):x().tz(e,r)}function P(e=function(){if("object"==typeof GatherPress)return"eventDetails.dateTime.timezone".split(".").reduce((e,r)=>e?.[r],GatherPress)}()){return j(e)||x().tz.zone(e)?e:(0,n.__)("GMT","gatherpress")}w(),function(){const e=P();k(w(),e).add(2,"hours").format(q)}();const C=({attributes:e,setAttributes:r})=>{const{query:{perPage:t,offset:s=0}={}}=e;return(0,u.jsx)(i.RangeControl,{label:(0,n.__)("Events Per Page","gatherpress"),min:1,max:50,onChange:t=>{r({query:{...e.query,perPage:t,offset:s}})},value:t})},E=({attributes:e,setAttributes:r})=>{const{query:{exclude_current:t}={}}=e,s=(0,b.useSelect)(e=>e("core/editor").getCurrentPost(),[]);return s?(0,u.jsx)(i.ToggleControl,{label:(0,n.__)("Exclude Current Event","gatherpress"),checked:!!t,onChange:t=>{r({query:{...e.query,exclude_current:t?s.id:0}})}}):(0,u.jsx)("div",{children:(0,n.__)("Loading…","gatherpress")})},N=({attributes:e,setAttributes:r})=>{const{query:{include_unfinished:t,gatherpress_event_query:s="upcoming"}={}}=e;let a;return a=void 0===t?"upcoming"===s:1===t,(0,u.jsx)(i.ToggleControl,{label:(0,n.__)("Include unfinished events","gatherpress"),help:(0,n.sprintf)(/* translators: %s: 'upcoming' or 'past' */ /* translators: %s: 'upcoming' or 'past' */ (0,n._x)("%s events that have started but are not yet finished.","'Shows' or 'Hides'","gatherpress"),a?(0,n.__)("Shows","gatherpress"):(0,n.__)("Hides","gatherpress")),checked:a,onChange:t=>{const s=t?1:0;r({query:{...e.query,include_unfinished:s}})}})},B=({attributes:e,setAttributes:r})=>{const{query:{gatherpress_event_query:t="upcoming"}={}}=e;return(0,b.useSelect)(e=>e("core/editor").getCurrentPost(),[])?(0,u.jsx)(i.ToggleControl,{label:(0,n.__)("Upcoming or past events.","gatherpress"),help:(0,n.sprintf)(/* translators: %s: 'upcoming' or 'past' */ /* translators: %s: 'upcoming' or 'past' */ (0,n._x)("Currently shows %s events.","'upcoming' or 'past'","gatherpress"),t),checked:"upcoming"===t,onChange:t=>{const s=t?"upcoming":"past",n="upcoming"===s?1:0;r({query:{...e.query,gatherpress_event_query:s,include_unfinished:n}})}}):(0,u.jsx)("div",{children:(0,n.__)("Loading…","gatherpress")})},A=({attributes:e,setAttributes:r})=>{const{query:{offset:t=0}={}}=e;return(0,u.jsx)(i.RangeControl,{label:(0,n.__)("Event Offset","gatherpress"),min:0,max:50,value:t,onChange:t=>{r({query:{...e.query,offset:t}})}})},S=({attributes:e,setAttributes:r})=>{const{query:{order:t,orderBy:s}={}}=e;let a;return a="rand"===s?(0,n.__)("Random Order","gatherpress"):"asc"===t?(0,n.__)("Ascending Order","gatherpress"):(0,n.__)("Descending Order","gatherpress"),(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(i.SelectControl,{label:(0,n.__)("Order Events by","gatherpress"),value:s,options:[{label:(0,n.__)("Event Date","gatherpress"),value:"datetime"},{label:(0,n.__)("Last Modified Date","gatherpress"),value:"modified"},{label:(0,n.__)("Title","gatherpress"),value:"title"},{label:(0,n.__)("Random","gatherpress"),value:"rand"},{label:(0,n.__)("Post ID","gatherpress"),value:"id"}],onChange:t=>{r({query:{...e.query,orderBy:t}})}}),(0,u.jsx)(i.ToggleControl,{label:a,checked:"asc"===t,disabled:"rand"===s,onChange:()=>{r({query:{...e.query,order:"asc"===t?"desc":"asc"}})}})]})},D=e=>{const{attributes:{namespace:r}}=e;return r&&r===Y},T=({attributes:e,setAttributes:r})=>{const{postType:t}=e.query;(0,l.useEffect)(()=>{if("gatherpress_event"===t){const t={...e,namespace:Y,query:{...e.query,gatherpress_event_query:"upcoming",include_unfinished:1,order:"asc",orderBy:"datetime",inherit:!1}};r(t)}},[t,e,r])};(0,a.addFilter)("editor.BlockEdit","core/query",e=>r=>D(r)||"core/query"===r.name?D(r)?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e,{...r}),(0,u.jsx)(o.InspectorControls,{children:(0,u.jsx)(i.PanelBody,{title:(0,n.__)("Event Query Settings","gatherpress"),children:!1===r.attributes.query.inherit?(0,u.jsx)(h.Slot,{fillProps:{...r}}):(0,u.jsx)(v.Slot,{fillProps:{...r}})})})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(T,{...r}),(0,u.jsx)(e,{...r}),";"]}):(0,u.jsx)(e,{...r})),(0,c.registerPlugin)("gatherpress-query-controls-slotfill",{render:()=>{const e="gatherpress_event"===(0,b.select)("core/editor")?.getCurrentPostType();return(0,u.jsx)(h,{children:r=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(B,{...r}),(0,u.jsx)(N,{...r}),e&&(0,u.jsx)(E,{...r}),(0,u.jsx)(C,{...r}),(0,u.jsx)(A,{...r}),(0,u.jsx)(S,{...r})]})})}}),(0,c.registerPlugin)("gatherpress-inherited-query-controls-slotfill",{render:()=>(0,u.jsx)(v,{children:e=>(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(B,{...e}),(0,u.jsx)(N,{...e}),(0,u.jsx)(S,{...e})]})})});var F=t(9623),O=t(5119);const Y="gatherpress-event-query",M={namespace:Y,query:{perPage:5,pages:0,offset:0,postType:"gatherpress_event",gatherpress_event_query:"upcoming",include_unfinished:1,order:"asc",orderBy:"datetime",inherit:!1}},Q={category:"gatherpress",keywords:[(0,n.__)("Events","gatherpress"),(0,n.__)("Dates","gatherpress")],isActive:["namespace","query.postType"],attributes:{...M},allowedControls:["inherit","taxQuery","author","search"],scope:["block"]};(0,s.registerBlockVariation)("core/query",{...Q,name:Y,title:(0,n.__)("Event Query","gatherpress"),description:(0,n.__)("Create event queries","gatherpress"),scope:["inserter","transform"],innerBlocks:[["core/post-template",{metadata:{name:(0,n.__)("Events Template","gatherpress")}},[["core/post-title"],["gatherpress/event-date"],["core/post-excerpt"],["core/post-terms",{term:"_gatherpress_venue"}]]],O.Q,F.W],example:{attributes:{...M},innerBlocks:[{name:"core/post-template",attributes:{},innerBlocks:[{name:"core/post-title"}]}]}})})();