(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{197:function(t,e,i){"use strict";i.r(e);var r=i(3),n=i(0),a=i(35),s=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{c(r.next(t))}catch(t){a(t)}}function o(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}c((r=r.apply(t,e||[])).next())}))};const o="planned",c="in progress",l="completed",u="aborted",d={ACCEPTED:"accepted",DECLINED:"declined",INVITED:"invited",REGISTERED:"registered",UNREGISTERED:"unregistered"};class h{static initIn(t){t.querySelectorAll(".acacias--pam-event-registration").forEach(t=>{t.removeAttribute(`data-${h.NS}-is`),new h({element:t,options:{}})})}constructor(t){this.statusApiUrl="",this.registerApiUrl="",this.unregisterApiUrl="",this.loggedIn=!1,(null==t?void 0:t.element)&&(this.root=t.element,this.init())}init(){var t,e,i;const r=this.root;r&&(this.statusApiUrl=(null===(t=r.dataset.statusApiUrl)||void 0===t?void 0:t.trim())||"",this.registerApiUrl=(null===(e=r.dataset.registerApiUrl)||void 0===e?void 0:e.trim())||"",this.unregisterApiUrl=(null===(i=r.dataset.unregisterApiUrl)||void 0===i?void 0:i.trim())||"",this.statusApiUrl&&(this.fillEventDetails(),r.querySelectorAll("[data-register]").forEach(t=>t.addEventListener("click",t=>this.handleChange(t,!0))),r.querySelectorAll("[data-unregister]").forEach(t=>t.addEventListener("click",t=>this.handleChange(t,!1))),r.querySelectorAll("[data-retry]").forEach(t=>t.addEventListener("click",()=>{this.fetchStatus()})),window.addEventListener(a.c,t=>{this.loggedIn=!!t.detail}),window.addEventListener("event-registration-status.change",()=>{this.fetchStatus()}),r.hidden=!1,this.fetchStatus()))}fillEventDetails(){const t=this.root;if(!t)return;const e=(e,i)=>t.querySelectorAll(`[data-${e}]`).forEach(t=>t.textContent=i);e("title",t.dataset.eventTitle||"");const i=new Date(t.dataset.eventDate||"");if(Number.isNaN(i.getTime()))return;const r=document.documentElement.lang||navigator.language||"default";e("day",String(i.getDate())),e("month",i.toLocaleString(r,{month:"long"}))}fetchStatus(){return s(this,void 0,void 0,(function*(){const t=this.root;if(t){"pending"!==t.dataset.state&&"error"!==t.dataset.state||(t.dataset.state="pending");try{const t=yield fetch(this.statusApiUrl);if(!t.ok)throw new Error(""+t.status);const e=yield t.json();this.apply(e.eventStatus,e.registrationStatus)}catch(e){t.dataset.state="error"}}}))}apply(t,e){const i=this.root;if(!i)return;const r=(t||"").toLowerCase(),n=(e||"").toLowerCase();let a="error";r===l?a="completed":r===u?a="canceled":(r===o||r===c)&&(a=n===d.REGISTERED||n===d.ACCEPTED?"attending":"register"),i.dataset.state=a,i.toggleAttribute("data-live","register"===a&&r===c),i.toggleAttribute("data-register-error","register"===a&&!Object.values(d).includes(n))}handleChange(t,e){const i=this.root;if(!i||!this.loggedIn)return;t.preventDefault();const r=t.currentTarget.href;i.toggleAttribute("data-loading",!0),i.toggleAttribute("data-register-error",!1),function t(e,i,r,n=3,a=1e3){return s(this,void 0,void 0,(function*(){try{const t=yield fetch(e,i);if(!t.ok&&!r.includes(t.status))throw new Error("Fetch error, status "+t.status);return t}catch(s){if(n<=0)throw s;return yield new Promise(t=>setTimeout(t,a)),t(e,i,r,n-1,a)}}))}(e?this.registerApiUrl:this.unregisterApiUrl,{method:"POST"},[401]).then(t=>{if(t.ok)window.dispatchEvent(new CustomEvent("event-registration-status.change"));else{if(401!==t.status)throw new Error(""+t.status);this.redirect(r)}}).catch(()=>i.toggleAttribute("data-register-error",!0)).finally(()=>i.toggleAttribute("data-loading",!1))}redirect(t){if(!t)return;const e=new URL(t,window.location.origin).pathname,i=new URL(location.toString());i.pathname!==e&&(i.pathname=e,location.replace(i))}}h.NS="acacias",h.IS="pam-event-registration",h.selectors={self:`[data-${h.NS}-is="${h.IS}"]`},Object(r.a)(h);var g=function(t,e,i,r){return new(i||(i=Promise))((function(n,a){function s(t){try{c(r.next(t))}catch(t){a(t)}}function o(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}c((r=r.apply(t,e||[])).next())}))};class f{constructor(t){this.config=null,t&&t.element&&(this.config=t,this.init())}init(){return g(this,void 0,void 0,(function*(){this.initFigureParallax(),this.initStickyBar()}))}initFigureParallax(){var t,e;const i=null===(t=this.config)||void 0===t?void 0:t.element.querySelector(".acacias--pam-stage__figure"),r=null==i?void 0:i.querySelector("picture img"),a="true"===(null==i?void 0:i.dataset.parallax),s="home"===(null===(e=this.config)||void 0===e?void 0:e.element.dataset.layout);i&&r&&a&&s&&n.a.fromTo(r,{y:"-70%",x:"-50%"},{y:"-30%",x:"-50%",ease:"none",scrollTrigger:{trigger:i,start:"top bottom",end:"bottom top",scrub:!0}})}initStickyBar(){var t,e;const i=null===(t=this.config)||void 0===t?void 0:t.element;if("true"!==(null==i?void 0:i.getAttribute("data-sticky")))return;const r=i.cloneNode(!0);r.removeAttribute("data-acacias-is"),r.removeAttribute("id"),r.classList.add("acacias--pam-stage--sticky"),r.setAttribute("aria-hidden","true");(null!==(e=i.parentElement)&&void 0!==e?e:document.body).appendChild(r),h.initIn(r);new IntersectionObserver(([t])=>{r.dataset.visible=String(!t.isIntersecting)},{threshold:0}).observe(i)}}f.NS="acacias",f.IS="pam-stage",f.selectors={self:"[data-"+f.NS+'-is="'+f.IS+'"]'},Object(r.a)(f)},35:function(t,e,i){"use strict";i.d(e,"c",(function(){return r})),i.d(e,"b",(function(){return n})),i.d(e,"a",(function(){return a}));const r="user.ready",n="user.profile.open",a="favorites.change"}}]);