(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))_(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&_(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function _(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}})();var L,p,me,w,oe,ye,J,x={},be=[],xe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Z=Array.isArray;function $(e,t){for(var n in t)e[n]=t[n];return e}function ge(e){var t=e.parentNode;t&&t.removeChild(e)}function E(e,t,n){var _,o,r,s={};for(r in t)r=="key"?_=t[r]:r=="ref"?o=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?L.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)s[r]===void 0&&(s[r]=e.defaultProps[r]);return T(e,s,_,o,null)}function T(e,t,n,_,o){var r={type:e,props:t,key:n,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++me,__i:-1,__u:0};return o==null&&p.vnode!=null&&p.vnode(r),r}function R(e){return e.children}function U(e,t){this.props=e,this.context=t}function P(e,t){if(t==null)return e.__?P(e.__,e.__i+1):null;for(var n;tt&&w.sort(J));W.__r=0}function Ne(e,t,n,_,o,r,s,l,c,u,f){var i,d,a,h,N,y=_&&_.__k||be,v=t.length;for(n.__d=c,Le(n,t,y),c=n.__d,i=0;i0?T(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=Oe(o,n,s=_+i,f),o.__i=l,r=null,l!==-1&&(f--,(r=n[l])&&(r.__u|=131072)),r==null||r.__v===null?(l==-1&&i--,typeof o.type!="function"&&(o.__u|=65536)):l!==s&&(l===s+1?i++:l>s?f>c-s?i+=l-s:i--:i=l(c!=null&&!(131072&c.__u)?1:0))for(;s>=0||l=0){if((c=t[s])&&!(131072&c.__u)&&o==c.key&&r===c.type)return s;s--}if(l2&&(l.children=arguments.length>3?L.call(arguments,2):n),T(e.type,l,_||e.key,o||e.ref,null)}L=be.slice,p={__e:function(e,t,n,_){for(var o,r,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,_||{}),s=o.__d),s)return o.__E=o}catch(l){e=l}throw e}},me=0,U.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=$({},this.state),typeof e=="function"&&(e=e($({},n),this.props)),e&&$(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),re(this))},U.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),re(this))},U.prototype.render=R,w=[],ye=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,J=function(e,t){return e.__v.__b-t.__v.__b},W.__r=0;function ne(){return(ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(l[r]=_[r]);return l}(e,Ie);return Ce(t,n)}function je(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=E(Ue,ne({},this._props,{context:e.detail.context}),function t(n,_){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var o=[],r={},s=0,l=n.attributes,c=n.childNodes;for(s=l.length;s--;)l[s].name!=="slot"&&(r[l[s].name]=l[s].value,r[Ee(l[s].name)]=l[s].value);for(s=c.length;s--;){var u=t(c[s],null),f=c[s].slot;f?r[f]=E(ce,{name:f},u):o[s]=u}var i=_?E(ce,null,o):o;return E(_||n.nodeName.toLowerCase(),r,i)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?we:V)(this._vdom,this._root)}function Ee(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function Fe(e,t,n){if(this._vdom){var _={};_[e]=n=n??void 0,_[Ee(e)]=n,this._vdom=Ce(this._vdom,_),V(this._vdom,this._root)}}function Me(){V(this._vdom=null,this._root)}function ce(e,t){var n=this;return E("slot",ne({},e,{ref:function(_){_?(n.ref=_,n._listener||(n._listener=function(o){o.stopPropagation(),o.detail.context=t},_.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function Be(e,t,n,_){function o(){var r=Reflect.construct(HTMLElement,[],o);return r._vdomComponent=e,r._root=_&&_.shadow?r.attachShadow({mode:_.mode||"open"}):r,r}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=je,o.prototype.attributeChangedCallback=Fe,o.prototype.disconnectedCallback=Me,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(r){Object.defineProperty(o.prototype,r,{get:function(){return this._vdom.props[r]},set:function(s){this._vdom?this.attributeChangedCallback(r,null,s):(this._props||(this._props={}),this._props[r]=s,this.connectedCallback());var l=typeof s;s!=null&&l!=="string"&&l!=="boolean"&&l!=="number"||this.setAttribute(r,s)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}var q,m,z,ue,Q=0,Pe=[],j=[],ae=p.__b,fe=p.__r,pe=p.diffed,de=p.__c,he=p.unmount;function He(e,t){p.__h&&p.__h(m,e,Q||t),Q=0;var n=m.__H||(m.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:j}),n.__[e]}function C(e){return Q=1,We(Te,e)}function We(e,t,n){var _=He(q++,2);if(_.t=e,!_.__c&&(_.__=[n?n(t):Te(void 0,t),function(l){var c=_.__N?_.__N[0]:_.__[0],u=_.t(c,l);c!==u&&(_.__N=[u,_.__[1]],_.__c.setState({}))}],_.__c=m,!m.u)){var o=function(l,c,u){if(!_.__c.__H)return!0;var f=_.__c.__H.__.filter(function(d){return d.__c});if(f.every(function(d){return!d.__N}))return!r||r.call(this,l,c,u);var i=!1;return f.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(i=!0)}}),!(!i&&_.__c.props===l)&&(!r||r.call(this,l,c,u))};m.u=!0;var r=m.shouldComponentUpdate,s=m.componentWillUpdate;m.componentWillUpdate=function(l,c,u){if(this.__e){var f=r;r=void 0,o(l,c,u),r=f}s&&s.call(this,l,c,u)},m.shouldComponentUpdate=o}return _.__N||_.__}function qe(e,t){var n=He(q++,3);!p.__s&&Ye(n.__H,t)&&(n.__=e,n.i=t,m.__H.__h.push(n))}function Re(){for(var e;e=Pe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(F),e.__H.__h.forEach(X),e.__H.__h=[]}catch(t){e.__H.__h=[],p.__e(t,e.__v)}}p.__b=function(e){m=null,ae&&ae(e)},p.__r=function(e){fe&&fe(e),q=0;var t=(m=e.__c).__H;t&&(z===m?(t.__h=[],m.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=j,n.__N=n.i=void 0})):(t.__h.forEach(F),t.__h.forEach(X),t.__h=[],q=0)),z=m},p.diffed=function(e){pe&&pe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pe.push(t)!==1&&ue===p.requestAnimationFrame||((ue=p.requestAnimationFrame)||Ve)(Re)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==j&&(n.__=n.__V),n.i=void 0,n.__V=j})),z=m=null},p.__c=function(e,t){t.some(function(n){try{n.__h.forEach(F),n.__h=n.__h.filter(function(_){return!_.__||X(_)})}catch(_){t.some(function(o){o.__h&&(o.__h=[])}),t=[],p.__e(_,n.__v)}}),de&&de(e,t)},p.unmount=function(e){he&&he(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(_){try{F(_)}catch(o){t=o}}),n.__H=void 0,t&&p.__e(t,n.__v))};var ve=typeof requestAnimationFrame=="function";function Ve(e){var t,n=function(){clearTimeout(_),ve&&cancelAnimationFrame(t),setTimeout(e)},_=setTimeout(n,100);ve&&(t=requestAnimationFrame(n))}function F(e){var t=m,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),m=t}function X(e){var t=m;e.__c=e.__(),m=t}function Ye(e,t){return!e||e.length!==t.length||t.some(function(n,_){return n!==e[_]})}function Te(e,t){return typeof t=="function"?t(e):t}function ze(e){const[t,n]=C("idle"),[_,o]=C([]);return[async s=>{n("pending");try{const l=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)}),c=await l.json();o(c),l.status>=400?n("failed"):n("success")}catch(l){o(l),n("failed")}},t,_]}var Ge=0;function g(e,t,n,_,o,r){var s,l,c={};for(l in t)l=="ref"?s=t[l]:c[l]=t[l];var u={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ge,__i:-1,__u:0,__source:o,__self:r};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return p.vnode&&p.vnode(u),u}function Je({url:e,nonce:t}){const[n,_]=C(""),[o,r,s]=ze(e),l=c=>{c.preventDefault(),o({email:n,nonce:t})};return g("div",{children:[r==="pending"&&"Subscribing...",r!=="pending"&&(s!=null&&s.message)?s.message:"",g("form",{method:"post",action:"http://localhost:10034/katowice-sw-antoni",onSubmit:l,children:[g("label",{htmlFor:"tnp-1",children:"Email"}),g("input",{type:"email",name:"email",onChange:c=>{_(c.target.value)},id:"tnp-1",value:n,required:!0}),g("button",{type:"submit",children:"Subscribe"})]})]})}const G="yes",M="no",B="only";function Ke(){const e=document.querySelectorAll("script"),t=e[e.length-1],n=new URL(t.getAttribute("src")),_=n.pathname.split("/embed.js")[0],o=document.createElement("parish-bulletin");o.setAttribute("url",`${n.origin}${_}`),[M,B].includes(n.searchParams.get("displayIntentions"))&&o.setAttribute("display-intentions",n.searchParams.get("displayIntentions")),t.before(o),Be(Qe,"parish-bulletin",["url","display-intentions"],{shadow:!0})}function Qe({url:e,displayIntentions:t}){const[n,_]=C({__html:""}),[o,r]=C({}),[s,l]=C(""),[c,u]=C(t??G),f=new URL(e);f.pathname=`${f.pathname}/wp-json/easy-parish/v1/bulletin`,qe(()=>{if(n.__html)return;async function d(){const h=await(await fetch(f.href)).json();_({__html:(h==null?void 0:h.body)??""}),r((h==null?void 0:h.labels)??{}),l((h==null?void 0:h.nonce)??"")}d()},[f.href]);let i="";return c===B?i="only-intentions":c===M&&(i="no-intentions"),g("main",{className:i,children:[!t&&!!n.__html&&g("nav",{className:"display-selector",children:g("div",{className:"display-selector__buttons",children:[g("button",{className:`display-selector__button ${c===G?"is-active":""}`,onClick:()=>u(G),children:o.displayAll??"Show all"}),g("button",{className:`display-selector__button ${c===B?"is-active":""}`,onClick:()=>u(B),children:o.intentionsOnly??"Intentions only"}),g("button",{className:`display-selector__button ${c===M?"is-active":""}`,onClick:()=>u(M),children:o.bulletinOnly??"Bulletin only"})]})}),f&&s&&g(Je,{url:`${f.href}/subscribe`,nonce:s}),g("div",{dangerouslySetInnerHTML:n})]})}Ke();