(()=>{"use strict";var e,r={1828(e,r,n){const t=window.wp.blocks,o=window.wp.i18n,s=window.wp.blockEditor,l=window.wp.apiFetch;var a=n.n(l);window.wp.url;const i=window.React,c=window.ReactJSXRuntime,{ToggleControl:d}=wp.components,p=JSON.parse('{"UU":"rsvpmaker/rsvpdateblock"}');(0,t.registerBlockType)(p.UU,{edit:function(e){const{attributes:r,attributes:{alignment:n,qr:t},context:{postId:l},setAttributes:p,isSelected:u}=e,[v,h]=(0,i.useState)(null),[w,g]=(0,i.useState)(null);return console.log("post id "+l),(0,i.useEffect)(()=>{a()({path:"/rsvpmaker/v1/dateblock?post_id="+l+"&alignment="+n}).then(e=>{h(e.dateblock)})},[n]),(0,i.useEffect)(()=>{t?a()({path:"/rsvpmaker/v1/qr?post_id="+l}).then(e=>{g(e.image)}):g(null)},[t]),(0,c.jsxs)("div",{...(0,s.useBlockProps)(),children:[(0,c.jsx)(s.InspectorControls,{children:(0,c.jsx)(d,{label:(0,o.__)("Show QR Code","rsvpmaker"),checked:t,onChange:e=>{p({qr:e})}})}),(0,c.jsx)(s.BlockControls,{children:(0,c.jsx)(s.AlignmentToolbar,{value:n,onChange:e=>p({alignment:e})})}),v&&(0,c.jsx)(c.Fragment,{children:(0,c.jsx)("div",{dangerouslySetInnerHTML:{__html:v}})}),!v&&(0,c.jsx)(c.Fragment,{children:(0,c.jsx)("p",{children:"Loading ..."})}),w?(0,c.jsx)("div",{className:"rsvpqr",children:(0,c.jsx)("img",{src:w,alt:"QR code"})}):null]})},save:function(){return null}})}},n={};function t(e){var o=n[e];if(void 0!==o)return o.exports;var s=n[e]={exports:{}};return r[e](s,s.exports,t),s.exports}t.m=r,e=[],t.O=(r,n,o,s)=>{if(!n){var l=1/0;for(d=0;d<e.length;d++){for(var[n,o,s]=e[d],a=!0,i=0;i<n.length;i++)(!1&s||l>=s)&&Object.keys(t.O).every(e=>t.O[e](n[i]))?n.splice(i--,1):(a=!1,s<l&&(l=s));if(a){e.splice(d--,1);var c=o();void 0!==c&&(r=c)}}return r}s=s||0;for(var d=e.length;d>0&&e[d-1][2]>s;d--)e[d]=e[d-1];e[d]=[n,o,s]},t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={7530:0,6046:0};t.O.j=r=>0===e[r];var r=(r,n)=>{var o,s,[l,a,i]=n,c=0;if(l.some(r=>0!==e[r])){for(o in a)t.o(a,o)&&(t.m[o]=a[o]);if(i)var d=i(t)}for(r&&r(n);c<l.length;c++)s=l[c],t.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return t.O(d)},n=globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})();var o=t.O(void 0,[6046],()=>t(1828));o=t.O(o)})();