(function(){"use strict";const n={selectors:{transitionCard:"[r-transition-card]",sourceImg:'[r-transition-img="source"]',sourceImgElement:'[r-card-hover-effect="target-img"]',sourceHide:"[r-transition-card-hide]",targetImg:'[r-transition-img="target"]',targetFade:'[r-transition-hero="fade-in"]',targetBlock:'[r-transition-hero="block"]'},animation:{imageDuration:.8,imageEase:"power3.inOut",fadeDuration:.5,fadeEase:"ease",blockReveal:{duration:.6,ease:"power2.inOut"},fadeIn:{duration:.3,ease:"ease",yOffset:40,stagger:.1}},classes:{transitioning:"cc-is-transitioning"}};let c=null;function p(r){const e=r.querySelectorAll(n.selectors.sourceHide);e.length&&gsap.to(e,{opacity:0,duration:.2,ease:n.animation.fadeEase})}function y(r){const e=r.getBoundingClientRect(),o=r.cloneNode(!0),s=window.getComputedStyle(r);return o.classList.add("floating-image"),gsap.set(o,{position:"fixed",top:e.top,left:e.left,width:e.width,height:e.height,margin:0,zIndex:1100,objectFit:s.objectFit||"cover",objectPosition:s.objectPosition||"center"}),gsap.set(o.querySelector(n.selectors.sourceImgElement),{scale:1}),document.body.appendChild(o),o}function h(r,e){return gsap.to(r,{borderRadius:0,top:0,left:e.x,width:e.width,height:e.height,duration:n.animation.imageDuration,ease:n.animation.imageEase})}function l(r,e){return gsap.fromTo(r,{opacity:1},{opacity:0,delay:e||0,duration:n.animation.fadeDuration,ease:n.animation.fadeEase,overwrite:!0})}function d(r,e){return gsap.fromTo(r,{opacity:0},{opacity:1,delay:0,duration:n.animation.fadeDuration,ease:n.animation.fadeEase,overwrite:!0})}function u(r){const e=r.querySelector(n.selectors.targetBlock),o=r.querySelectorAll(n.selectors.targetFade),s=r.querySelector(n.selectors.targetImg),t=gsap.timeline();return e&&(gsap.set(e,{clipPath:"inset(0 0 0 100%)"}),t.to(e,{clipPath:"inset(0 0 0 0%)",duration:n.animation.blockReveal.duration,ease:n.animation.blockReveal.ease}),t.to(s,{maxWidth:"calc(100% - 42.625rem)",duration:n.animation.blockReveal.duration,ease:n.animation.blockReveal.ease},"<")),o.length>0&&(gsap.set(o,{opacity:0,y:n.animation.fadeIn.yOffset}),t.to(o,{opacity:1,y:0,duration:n.animation.fadeIn.duration,ease:n.animation.fadeIn.ease,stagger:n.animation.fadeIn.stagger,onComplete:()=>{gsap.set(o,{opacity:1,y:0,overwrite:!1})}})),t}function m(){if(!document.querySelector("[data-barba='wrapper']"))return;let e=null;barba.init({cacheIgnore:!0,transitions:[{name:"card-to-hero",from:{namespace:["list"]},to:{namespace:["detail"]},leave(t){return c?(e=y(c.element),p(e),l(t.current.container,.2)):l(t.current.container)},enter(t){const a=t.next.container.querySelector(n.selectors.targetImg);if(gsap.set(t.next.container,{opacity:0}),!c||!a||!e){e&&(e.remove(),e=null),d(t.next.container),u(t.next.container);return}gsap.set(a,{visibility:"hidden"});const i=a.getBoundingClientRect();return h(e,i).then(()=>{gsap.set(a,{visibility:"visible"}),d(t.next.container).then(()=>{e.remove(),e=null,u(t.next.container)})})}},{name:"to-card",from:{},to:{namespace:["detail"]},leave(t){return l(t.current.container)},enter(t){d(t.next.container).then(()=>{u(t.next.container)})}},{name:"default-fade",leave(t){return l(t.current.container)},enter(t){d(t.next.container)}}]}),barba.hooks.before(t=>{if(document.body.classList.add(n.classes.transitioning),c=null,!t.trigger||!t.trigger.closest)return;const a=t.trigger.closest(n.selectors.transitionCard);if(!a)return;const i=a.querySelector(n.selectors.sourceImg);i&&(c={element:i,rect:i.getBoundingClientRect()})}),barba.hooks.after(t=>{if(document.body.classList.remove(n.classes.transitioning),b(),v(),o(),t.next.container.querySelectorAll("[data-eloqua-formid]").length>0){const i="https://cdn.haufe.de/content/eloqua/forms/eloqua-common.js",g=document.querySelector(`script[src="${i}"]`);g&&g.remove();const f=document.createElement("script");f.src=i,document.body.appendChild(f)}window.scrollTo(0,0)});function o(){window.Webflow&&window.Webflow.require&&(window.Webflow.destroy(),window.Webflow.ready(),window.Webflow.require("ix2").init())}let s;window.addEventListener("resize",()=>{clearTimeout(s),s=setTimeout(()=>{const t=document.querySelector('[data-barba-namespace="detail"]');if(!t)return;const a=t.querySelectorAll(n.selectors.targetFade);a.length>0&&gsap.set(a,{opacity:1,y:0,overwrite:!1})},250)}),w()}function b(){const r=document.body.querySelectorAll("[r-cms-back-btn]");r.length&&r.forEach(e=>{e.addEventListener("click",o=>{if(o.preventDefault(),window.history.length>1){window.history.back();return}window.location.href="/weiter"})})}function w(){const r=document.querySelector('[data-barba-namespace="detail"]');r&&u(r)}function v(){document.body.querySelectorAll("script[refresh]").forEach(r=>{const e=r.src;r.remove();const o=document.createElement("script");o.src=e,o.setAttribute("refresh","true"),document.body.appendChild(o)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m):m()})();