((t,c)=>{t.dataLayer=t.dataLayer||[],t.fxp=t.fxp||[];const _={webc_fxp_1873:()=>location.pathname==="/checkout"&&[...t.globalEventsCache].find(e=>e.name==="empty_seat_not_advertised"||e.name==="empty_seat_advertised_expensive"),webc_fxp_1945:()=>{if(!t.searchMaskComponent||!c.querySelector('[data-e2e="search-button"]'))return!1;const e=[...t.globalEventsCache].reverse(),r=e.some(f=>f.name==="search.search-mask.city_selected"&&f.payload[0].direction==="arrival"),p=e.some(f=>f.name==="search.search-mask.city_selected"&&f.payload[0].direction==="departure");return!(!r||!p)},webc_fxp_1951:()=>location.pathname==="/checkout"&&c.querySelector("#paysafe_paysafecash"),webc_fxp_1913:()=>location.pathname==="/booking/success"&&t.formbricks,webc_search_alternate_train_trips:()=>!location.search.includes("origin_flix_train=1")||location.pathname!=="/search"?!1:!!(c.querySelector('div[class*="TrainInfoBox"] a[href*="https://www.flixtrain."]')||c.querySelector('[data-e2e="filter-tab-section"]')&&c.querySelector('[data-e2e="search-results-error-message"]')),webc_fxp_1944:()=>location.pathname==="/booking/success",webc_fxp_1949:()=>{const e=(t.globalEventsCache||[]).some(r=>r.name==="exitIntent.dialog.openMouseInteraction"||r.name==="exitIntent.dialog.openIdle");return c.location.pathname==="/checkout"&&e}},u={webc_fxp_1873:{0:[],1:[]},webc_fxp_1945:{0:[],1:[()=>{(()=>{const i=c.querySelector('[data-e2e="search-button"]:not(.fxp1945Listener)');!i||(i.classList.add("fxp1945Listener"),i.addEventListener("click",l=>{if(!c.querySelector("#fxp1945-checkbox:checked")){dataLayer.push({event:"ga_event",eventCategory:"ABTest",eventAction:"fxp1945_submit",eventValue:void 0,eventLabel:"checkbox_deselected",eventProperty:void 0});return}const a=B(),n=h(),b=v();if(!n||!b){dataLayer.push({event:"ga_event",eventCategory:"ABTest",eventAction:"fxp1945_safeguard",eventValue:void 0,eventLabel:"prevented_redirect",eventProperty:void 0});return}dataLayer.push({event:"ga_event",eventCategory:"ABTest",eventAction:"fxp1945_submit",eventValue:void 0,eventLabel:"redirect",eventProperty:void 0}),l.preventDefault(),l.stopImmediatePropagation(),setTimeout(()=>{dataLayer.push({event:"ga_event",eventCategory:"ABTest",eventAction:"fxp1945_redirect",eventValue:void 0,eventLabel:void 0,eventProperty:void 0}),t.location.href=`https://www.booking.com/searchresults.html?aid=2427824&ss=${e()}&checkin=${f(r())}&checkout=${f(p(!0))}&group_adults=${a.adults}&group_children=${a.children}`},3e3),t.open(`https://${o()}/search?departureCity=${n}&arrivalCity=${b}&rideDate=${s(r())}${x()}&adult=${a.adults}&children=${a.children}&bike_slot=${a.bikes}`,"_blank")}))})(),(()=>{if(c.querySelector("#fxp1945-checkbox")||!v()||!h())return;let i="";sessionStorage.getItem("fxp1045isChecked")||(i="checked");const l=c.querySelector("#search-mask-component > div > div > div"),a=c.createElement("div");let n="Find my accommodation";switch(c.documentElement.lang.substring(0,2)){case"de":n="Finde meine Unterkunft";break;case"fr":n="Trouver un logement";break;case"it":n="Trova un alloggio";break}a.id="fxp1945-div",a.innerHTML=`
`,a.querySelector("input").addEventListener("change",function(){this.checked?(dataLayer.push({event:"ga_event",eventCategory:"ABTest",eventAction:"fxp1945_checkbox_click",eventValue:void 0,eventLabel:"checked",eventProperty:void 0}),sessionStorage.removeItem("fxp1045isChecked")):(dataLayer.push({event:"ga_event",eventCategory:"ABTest",eventAction:"fxp1945_checkbox_click",eventValue:void 0,eventLabel:"unchecked",eventProperty:void 0}),sessionStorage.setItem("fxp1045isChecked","unchecked"))}),l.appendChild(a),dataLayer.push({event:"ga_event",eventCategory:"ABTest",eventAction:"fxp1945_checkbox_impression",eventValue:void 0,eventLabel:void 0,eventProperty:void 0})})();function e(){return c.querySelector("#searchInput-to").value}function r(){let i=new Date;const l=[...t.globalEventsCache].reverse().find(a=>a.name==="search.search-mask.field-changed"&&a.payload[0].fieldName==="date.departure");if(l)i=new Date(...l.payload[0].value.split(".").reverse().map((a,n)=>a-(n===1)));else{const a=sessionStorage.getItem("search-personalization-dep-date");a&&(i=new Date(parseInt(a)*1e3))}return i}function p(i=!1){if(!c.querySelector("#search-mask-trip-mode-roundtrip-toggle:checked")&&i){const n=r();return n.setDate(n.getDate()+2),n}let l=new Date;l.setDate(l.getDate()+1);const a=[...t.globalEventsCache].reverse().find(n=>n.name==="search.search-mask.field-changed"&&n.payload[0].fieldName==="date.return");if(a)l=new Date(...a.payload[0].value.split(".").reverse().map((n,b)=>n-(b===1)));else{const n=sessionStorage.getItem("search-personalization-arr-date");n&&(l=new Date(parseInt(n)*1e3))}return l}function f(i){const l=i.getFullYear(),a=String(i.getMonth()+1).padStart(2,"0"),n=String(i.getDate()).padStart(2,"0");return`${l}-${a}-${n}`}function s(i){const l=i.getFullYear(),a=String(i.getMonth()+1).padStart(2,"0");return`${String(i.getDate()).padStart(2,"0")}.${a}.${l}`}function o(){switch(location.host){case"www.flixbus.de":return"shop.flixbus.de";case"www.flixbus.fr":return"shop.flixbus.fr";case"www.flixbus.it":return"shop.flixbus.it";case"www.flixbus.com.br":return"shop.flixbus.com.br"}return"shop.global.flixbus.com"}function x(){return c.querySelector("#search-mask-trip-mode-roundtrip-toggle:checked")?`&backRideDate=${s(p())}`:""}function h(){let i=null;const l=[...t.globalEventsCache].reverse().find(a=>a.name==="search.search-mask.city_selected"&&a.payload[0].direction==="departure");return l&&(i=l.payload[0].selectedCityId,l.payload[0].selectedCityName!==c.querySelector("#searchInput-from").value&&(i=null)),location.pathname==="/"?i:null}function v(){let i=null;const l=[...t.globalEventsCache].reverse().find(a=>a.name==="search.search-mask.city_selected"&&a.payload[0].direction==="arrival");return l&&(i=l.payload[0].selectedCityId,l.payload[0].selectedCityName!==c.querySelector("#searchInput-to").value&&(i=null)),location.pathname==="/"?i:null}function y(i){const l=c.cookie.match(new RegExp("(^| )"+i+"=([^;]+)"));return l?l[2]:null}function B(){const i=c.querySelector("#productSummary").value,l={adults:["Erwachsene:r","Erwachsene","adulte","adultes","Adulto/a","Adulti/e"],children:["Kind","Kinder","enfant","enfants","Bambino/a","Bambini/e"],bikes:["Fahrrad","Fahrr\xE4der","v\xE9lo","v\xE9los","Posto bici","Posti bici"]},a={adults:0,children:0,bikes:0};return i.split(", ").forEach(n=>{Object.keys(l).forEach(b=>{l[b].forEach(P=>{const I=new RegExp(`(\\d+)\\s${P}`),E=n.match(I);E&&(a[b]=parseInt(E[1],10))})})}),a}},()=>{(e=>{if(!e.getElementById("fxp-3a0625af-1d48-4684-a6c6-926889e2c07c")){var r=e.createElement("style");r.id="fxp-3a0625af-1d48-4684-a6c6-926889e2c07c",e.head.appendChild(r).innerText='#fxp1945-div{margin-top:var(--hcr-spacing-2)}.flix-checkbox{position:relative}.flix-checkbox--sm .flix-checkbox__label{min-height:var(--flix-spacing-3);border-radius:var(--flix-primary-border-radius)}.flix-checkbox--sm .flix-checkbox__label:hover{background-image:var(--flix-hover-layer-color);text-decoration:none}.flix-checkbox--sm .flix-checkbox__label:after{-webkit-mask-size:calc(var(--flix-spacing-3) - var(--flix-spacing-1));mask-size:calc(var(--flix-spacing-3) - var(--flix-spacing-1))}.flix-checkbox--sm .flix-checkbox__input,.flix-checkbox--sm .flix-checkbox__label:after,.flix-checkbox--sm .flix-checkbox__label:before{width:var(--flix-spacing-3);height:var(--flix-spacing-3);margin-top:calc((var(--flix-line-height-primary) - var(--flix-spacing-3))/ 2)}@supports (margin-top: max(0px,calc((var(--flix-line-height-primary) - var(--flix-spacing-3)) / 2))){.flix-checkbox--sm .flix-checkbox__input,.flix-checkbox--sm .flix-checkbox__label:after,.flix-checkbox--sm .flix-checkbox__label:before{margin-top:max(0,(var(--flix-line-height-primary) - var(--flix-spacing-3)) / 2)}}.flix-checkbox__label{display:inline-flex;position:relative;align-items:center;min-height:var(--flix-spacing-5);margin:calc(-1 * var(--flix-spacing-half));padding:var(--flix-spacing-half);border-radius:var(--flix-primary-border-radius);color:var(--flix-content-primary-color);font-family:inherit;vertical-align:middle;cursor:pointer;gap:var(--flix-spacing-2)}.flix-checkbox__label:after,.flix-checkbox__label:before{content:"";display:block;flex-shrink:0;align-self:flex-start}.flix-checkbox__label:before{width:var(--flix-spacing-5);height:var(--flix-spacing-5);border:2px solid var(--flix-input-border-color);border-radius:var(--flix-primary-border-radius);transition:border-color .25s ease;margin-top:calc((var(--flix-line-height-primary) - var(--flix-spacing-5))/ 2)}@supports (margin-top: max(0px,calc((var(--flix-line-height-primary) - var(--flix-spacing-5)) / 2))){.flix-checkbox__label:before{margin-top:max(0,(var(--flix-line-height-primary) - var(--flix-spacing-5)) / 2)}}.flix-checkbox__label:after{width:var(--flix-spacing-5);height:var(--flix-spacing-5);background-color:var(--flix-input-border-color);position:absolute;top:var(--flix-spacing-half);left:var(--flix-spacing-half);transform:scale(0);pointer-events:none;transition:transform .25s ease,background-color .25s ease;margin-top:calc((var(--flix-line-height-primary) - var(--flix-spacing-5))/ 2)}@supports (margin-top: max(0px,calc((var(--flix-line-height-primary) - var(--flix-spacing-5)) / 2))){.flix-checkbox__label:after{margin-top:max(0,(var(--flix-line-height-primary) - var(--flix-spacing-5)) / 2)}}.flix-checkbox__input{width:var(--flix-spacing-5);height:var(--flix-spacing-5);margin-top:calc((var(--flix-line-height-primary) - var(--flix-spacing-5))/ 2)}@supports (margin-top: max(0px,calc((var(--flix-line-height-primary) - var(--flix-spacing-5)) / 2))){.flix-checkbox__input{margin-top:max(0,(var(--flix-line-height-primary) - var(--flix-spacing-5)) / 2)}}.flix-checkbox__input:checked+.flix-checkbox__label:after{transform:scale(1)}.flix-checkbox__input{position:absolute;opacity:0;cursor:pointer}.flix-checkbox__input:focus-visible+.flix-checkbox__label:before{outline:2px solid var(--flix-focus-outline-color);outline-offset:1px;box-shadow:0 0 0 calc(var(--flix-spacing-half) + 1px) var(--flix-grayscale-0-color)}.flix-checkbox__input:enabled+.flix-checkbox__label:hover,.flix-checkbox__input:enabled:hover+.flix-checkbox__label{background-image:var(--flix-hover-layer-color);text-decoration:none}.flix-checkbox__input:checked+.flix-checkbox__label:before{border-color:var(--flix-ui-primary-color)}.flix-checkbox__input:checked+.flix-checkbox__label:after{background-color:var(--flix-ui-primary-color)}.flix-checkbox--disabled .flix-checkbox__label{opacity:var(--flix-disabled-element-opacity);cursor:not-allowed}.flix-checkbox__info:not(:empty){color:var(--flix-container-content-color,var(--flix-content-primary-color));font-size:var(--flix-font-size-small);font-weight:var(--flix-font-weight-normal);line-height:var(--flix-line-height-small);display:block;margin-top:var(--flix-spacing-1)}.flix-checkbox__info:not(:empty)~.flix-checkbox__info{margin-top:var(--flix-spacing-half)}.flix-checkbox__info~.flix-checkbox__info{color:var(--flix-content-primary-color)}.flix-checkbox--indeterminate>.flix-checkbox__label:before,.flix-checkbox__input:indeterminate+.flix-checkbox__label:before{border-color:var(--flix-ui-primary-color)}.flix-checkbox--sm .flix-checkbox__label:before{border-radius:3px}.flix-checkbox--no-label .flix-checkbox__label:after,.flix-checkbox--no-label .flix-checkbox__label:before{margin-top:0}'}})(c)}]},webc_fxp_1951:{0:[],1:[()=>{(()=>{const e=c.querySelector("#paysafe_paysafecash");!e||e.parentElement.parentElement.remove()})()}]},webc_fxp_1953:{0:[],1:[]},webc_fxp_1913:{0:[],1:[()=>{t.fxp1913||(t.fxp1913=!0,formbricks.track("fxp1913_uk"))},()=>{(()=>{const s=c.querySelector('label[for="aw2637eohg2jpmlcqc2flsa3"]');if(!s)return;const o=s.parentElement.parentElement.parentElement.parentElement.querySelector('button[tabindex="0"]');!o||t.fxp1913Listener||(t.fxp1913Listener=!0,o.addEventListener("click",function(){t.open(e(),"_blank").focus()}))})();function e(){const s=r(),o=p(),x=f();if(!s||!o||!x)return console.log(s,o,x),"https://de.trustpilot.com/evaluate/flixbus.de";let h="https://geo.cro.flixbus.com/trustpilot/invitation-link";const v=new URLSearchParams({domain:"flixbus_uk",token:"clv3r6ha8ld5Sq208la3rg21x91",name:o,email:s,network_userid:x});return h+="?"+v.toString(),console.log(h),h}function r(){const s=localStorage.getItem("persist:contact");if(s)try{const o=JSON.parse(s).email.replace(/"/g,"");return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?o:null}catch(o){return null}else return null}function p(){try{const s=localStorage.getItem("persist:passenger"),o=JSON.parse(s),x=JSON.parse(o.passengers);return x&&x.length>0?x[0].firstName:null}catch(s){return null}}function f(){const s=c.cookie.split(";").map(x=>x.trim());let o="";return s.reduce((x,h)=>{const[v,y]=h.split("=");v.startsWith("_sp_id.")&&(o=y)},{}),o.substr(0,o.indexOf("."))}}]},webc_fxp_1932:{0:[],1:[]},webc_search_alternate_train_trips:{0:[],1:[]},webc_fxp_1944:{0:[],1:[]},webc_fxp_1947:{0:[],1:[],2:[]},webc_fxp_1949:{0:[],1:[]}};let g={};const d={attributes:!0,childList:!0,subtree:!0},C=(e,r)=>{r.disconnect(),k(),r.observe(c.body,d)};new MutationObserver(C).observe(c.body,d);const m=e=>{Object.keys(e).forEach(r=>{const p=String(r),f=String(e[r]);g[p]=f}),k()},k=()=>{Object.keys(g).forEach(e=>{let r=e,p=g[e];S(r,p)})},S=(e,r)=>{if(!!g[e]){if(!u[e]){t.fxp[e]===void 0&&(t.fxp[e]=null);return}if(!L(e)){t.fxp[e]===void 0&&(t.fxp[e]=!1);return}$(e,r),u[e]&&(!u[e][r]||u[e][r].forEach(p=>{try{p()}catch(f){console.warn(e,f)}}))}},L=e=>{if(!_[e])return!0;try{return _[e]()}catch(r){console.warn(e,r)}},$=(e,r)=>{t.fxp[e]!==r&&(t.dataLayer.push({event:"ab_cc",ab_cc_id:e,ab_cc_v:r,ab_cc_src:"fxp"}),t.fxp[e]=r,typeof t.globalEvents=="object"&&t.globalEvents.emit("flixperiments",{[e]:r}))};if(c.location.host.slice(0,5)==="shop."&&c.location.pathname==="/")return;const D=()=>t.globalEvents.on("*.ab_test_flags",e=>m(e)),q=()=>{if(!t.globalEventsCache||!t.globalEventsCache.length)return!1;t.globalEventsCache.filter(e=>e.name.match(/ab_test_flags$/g)).forEach(e=>m(e.payload[0]))},A=setInterval(()=>{typeof t.globalEvents=="object"&&(clearInterval(A),D(),q())},200)})(window,document);