(()=>{"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 o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,n=window.wp.blockEditor,o=window.wp.components,s=window.wp.i18n,i=window.wp.element,l=window.wp.primitives,a=window.ReactJSXRuntime,r=(0,a.jsx)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,a.jsx)(l.Path,{d:"M14.103 7.128l2.26-2.26a4 4 0 00-5.207 4.804L5.828 15a2 2 0 102.828 2.828l5.329-5.328a4 4 0 004.804-5.208l-2.261 2.26-1.912-.512-.513-1.912zm-7.214 9.64a.5.5 0 11.707-.707.5.5 0 01-.707.707z"})}),c=window.wp.apiFetch;var d=e.n(c);const u=JSON.parse('{"uK":{"userId":{"type":"number"},"viewOptionValue":{"type":"string","default":"table"},"showStatus":{"type":"boolean","default":false}}}');(0,t.registerBlockType)("ticketleo-events/eventslist",{...u.uK,edit:function(e){const t=(0,n.useBlockProps)(),{attributes:l,setAttributes:c}=e,[u,w]=(0,i.useState)("");(0,i.useEffect)((()=>{"grid"===l.viewOptionValue?c({showStatus:void 0}):void 0===l.showStatus&&c({showStatus:!1})}),[l.viewOptionValue]),(0,i.useEffect)((()=>{d()({path:`/wp/v2/block-renderer/${e.name}`,method:"POST",data:{context:"edit",attributes:l}}).then((e=>{w(e.rendered)})).catch((e=>{console.error("Error fetching block content:",e)}))}),[l]);const p=[{label:(0,s.__)("Tabellarisch","ticketleo-events"),value:"table"},{label:(0,s.__)("Liste","ticketleo-events"),value:"list"},{label:(0,s.__)("Kacheln","ticketleo-events"),value:"grid"}];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.InspectorControls,{children:(0,a.jsxs)(o.PanelBody,{title:(0,s.__)("Einstellungen","ticketleo-events"),initialOpen:!0,icon:r,children:[(0,a.jsx)(o.TextControl,{label:(0,s.__)("User-ID","ticketleo-events"),value:l.userId,onChange:function(e){const t=""===e?void 0:Number(e);c({userId:t})},type:"number",help:(0,i.createInterpolateElement)((0,s.__)("Wie Sie diese herausfinden, können Sie <a>hier</a> sehen.","ticketleo-events"),{a:(0,a.jsx)("a",{href:`${window.location.origin}/wp-content/plugins/ticketleo-events/docs/find-ids.pdf`,target:"_blank",rel:"noopener noreferrer"})})}),(0,a.jsx)(o.SelectControl,{label:(0,s.__)("Ansicht","ticketleo-events"),value:l.viewOptionValue,options:p,onChange:function(e){const t=p.find((t=>t.value===e));c({viewOptionValue:t.value})}}),void 0!==l.showStatus&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{children:(0,s.__)("Metadaten einblenden","ticketleo-events")}),(0,a.jsx)("div",{style:{marginTop:"10px"},children:(0,a.jsx)(o.CheckboxControl,{label:(0,s.__)("Status","ticketleo-events"),checked:!!l.showStatus,onChange:()=>{c((e=>({showStatus:!e.showStatus})))}})})]})]})}),(0,a.jsx)("div",{...t,children:(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:u}})})]})},save:()=>null})})();