(()=>{"use strict";var e,r={4937(e,r,o){const t=window.wp.blocks,n=window.wp.i18n,a=window.React,s=window.wp.blockEditor,l=window.wp.apiFetch;var p=o.n(l);const i=window.wp.url,c=window.lodash,u=window.ReactJSXRuntime,{Fragment:d}=wp.element,{SelectControl:v,TextControl:m,ToggleControl:h}=wp.components,k=JSON.parse('{"UU":"rsvpmaker/qr"}');(0,t.registerBlockType)(k.UU,{edit:function(e){const{attributes:r,setAttributes:o,attributes:{pixel:t,url:l,rsvpnow:d,queryString:k}}=e,[g,f]=(0,a.useState)(null),b=wp.data.select("core/editor").getCurrentPostId(),w=(0,a.useCallback)((0,c.debounce)((e,r,o,t,n)=>{const a={url:e,pixel:r,rsvpnow:o,queryString:t,post_id:n},s=(0,i.addQueryArgs)("/rsvpmaker/v1/qr",a);p()({path:s}).then(e=>{f(e)})},500),[]);return(0,a.useEffect)(()=>{l&&w(l,t,d,k,b)},[l,t,d,k,b,w]),(0,u.jsxs)("div",{...(0,s.useBlockProps)(),children:[(0,u.jsxs)(s.InspectorControls,{children:[(0,u.jsx)(m,{label:(0,n.__)("URL","rsvpmaker"),value:l,onChange:e=>{o({url:e})}}),(0,u.jsx)("p",{children:(0,u.jsx)("em",{children:(0,n.__)("Enter the URL to encode. Defaults to the 'permalink' URL of the current post. You can also enter 'home' for the homepage URL.","rsvpmaker")})}),(0,u.jsx)(m,{label:(0,n.__)("Query String (optional)","rsvpmaker"),value:k,onChange:e=>{o({queryString:e})}}),(0,u.jsx)("p",{children:(0,u.jsx)("em",{children:"Must begin with '?'. Example: ?ref=newsletter"})}),(0,u.jsx)(h,{label:(0,n.__)("Add #rsvpnow to event URLs","rsvpmaker"),checked:d,onChange:e=>{o({rsvpnow:e})}}),(0,u.jsx)("p",{children:(0,u.jsx)("em",{children:(0,n.__)("If set, the link takes user to the top of the form, rather than top of post.","rsvpmaker")})}),(0,u.jsx)(v,{label:(0,n.__)("Pixel Size","rsvpmaker"),value:t,options:[{value:5,label:5},{value:3,label:3},{value:4,label:4},{value:8,label:8},{value:10,label:10},{value:15,label:15}],onChange:e=>{o({pixel:e})}})]},"qrinspector"),g&&(0,u.jsx)("div",{className:"rsvpmaker_qr",children:(0,u.jsx)("img",{src:g.image,alt:"QR Code"})}),!g&&(0,u.jsx)("p",{children:"QR Code 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 s=1/0;for(c=0;c<e.length;c++){for(var[o,n,a]=e[c],l=!0,p=0;p<o.length;p++)(!1&a||s>=a)&&Object.keys(t.O).every(e=>t.O[e](o[p]))?o.splice(p--,1):(l=!1,a<s&&(s=a));if(l){e.splice(c--,1);var i=n();void 0!==i&&(r=i)}}return r}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[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={5775:0,5255:0};t.O.j=r=>0===e[r];var r=(r,o)=>{var n,a,[s,l,p]=o,i=0;if(s.some(r=>0!==e[r])){for(n in l)t.o(l,n)&&(t.m[n]=l[n]);if(p)var c=p(t)}for(r&&r(o);i<s.length;i++)a=s[i],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(c)},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,[5255],()=>t(4937));n=t.O(n)})();