(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,n=window.lodash,r=window.wp.components,o=window.wp.i18n,s=window.wp.coreData,a=window.wp.data,i=window.ReactJSXRuntime,c=e=>{var c,u;const{name:d,option:l,value:m,fieldOptions:p}=e.attrs,w=1!==p.limit,[f,g]=(0,t.useState)(null!==(c=JSON.parse(m))&&void 0!==c?c:"[]"),{contentList:h}=(0,a.useSelect)(e=>{const{getEntityRecords:t}=e(s.store);return{contentList:t("user"===p.type?"root":"postType",p.type||"post",{per_page:-1,context:"view"})}},[p.type]),v=null!==(u=h?.reduce((e,t)=>({...e,[t.title?.rendered||t.name]:t}),{}))&&void 0!==u?u:{};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.FormTokenField,{label:p.label||(0,o.__)("Select Posts","gatherpress"),name:d,value:f?.map(e=>({id:e.id,slug:e.slug,value:e.title?.rendered||e.name||e.value})),suggestions:Object.keys(v),onChange:e=>{if(e.some(e=>"string"==typeof e&&!v[e]))return;const t=e.map(e=>"string"==typeof e?v[e]:e);if((0,n.includes)(t,null))return!1;g(t)},maxSuggestions:p.max_suggestions||20,maxLength:p.limit||0,__experimentalShowHowTo:w},l),!1===w&&(0,i.jsx)("p",{className:"description",children:(0,o.__)("Choose only one item.","gatherpress")}),(0,i.jsx)("input",{type:"hidden",id:l,name:d,value:f?JSON.stringify(f.map(e=>({id:e.id,slug:e.slug,value:e.title?.rendered||e.name||e.value}))):void 0})]})},u=window.moment;var d=e.n(u);function l(e){if("object"==typeof GatherPress)return e.split(".").reduce((e,t)=>e?.[t],GatherPress)}window.wp.hooks;const m=window.wp.date,p=e=>{const{name:n,value:r}=e.attrs,[o,s]=(0,t.useState)(r);return document.querySelector(`[name="${n}"]`).addEventListener("input",e=>{s(e.target.value)},{once:!0}),(0,i.jsx)(i.Fragment,{children:o&&(0,m.format)(o)})},w="YYYY-MM-DD HH:mm:ss";function f(){const e=v();return h(d()().format("YYYY-MM-DD HH:mm:ss"),e).add(1,"day").set("hour",18).set("minute",0).set("second",0).format(w)}function g(e){return/^[+-]\d{2}:\d{2}$/.test(e)}function h(e,t){return g(t)?d()(e).utcOffset(t,!0):d().tz(e,t)}function v(e=l("eventDetails.dateTime.timezone")){return g(e)||d().tz.zone(e)?e:(0,o.__)("GMT","gatherpress")}f(),function(){const e=v();h(f(),e).add(2,"hours").format(w)}();const _=e=>{const{name:n,value:r,suffix:o}=e.attrs,[s,a]=(0,t.useState)(r),c=document.querySelector(`[name="${n}"]`),u=l("urls.homeUrl");return c.addEventListener("input",e=>{a(e.target.value)},{once:!0}),(0,i.jsxs)(i.Fragment,{children:[u+"/",(0,i.jsx)("strong",{children:s}),"/"+o]})},y=document.querySelectorAll('[data-gatherpress_component_name="autocomplete"]');for(const e of y){const n=JSON.parse(e.dataset.gatherpress_component_attrs);(0,t.createRoot)(e).render((0,i.jsx)(c,{attrs:n}))}!function(){const e=document.querySelectorAll('[data-gatherpress_component_name="datetime-preview"]');for(const n of e){const e=JSON.parse(n.dataset.gatherpress_component_attrs);(0,t.createRoot)(n).render((0,i.jsx)(p,{attrs:e}))}}(),function(){const e=document.querySelectorAll('[data-gatherpress_component_name="urlrewrite-preview"]');for(const n of e){const e=JSON.parse(n.dataset.gatherpress_component_attrs);(0,t.createRoot)(n).render((0,i.jsx)(_,{attrs:e}))}}()})();