(function(){const configurationData={"version":"v2.83.0","featureFlags":["ewx_498_observer_refactor"],"status":200,"errorDetail":"","instanceId":"rzt","makeAsyncCall":false,"cookie":"2298cb22-a3d0-47ca-a950-3517ea782d0f","cookieOptions":{"domain":"","path":""},"data":[],"asyncCallVars":[],"vars":{"data":[]}};!function(){"use strict";const e="exponea-experiments-editor",t={version:"",status:500,errorDetail:void 0,instanceId:"EWX",sdk:{},sdkObjectName:"",path:"",sign:"",rootElement:document.documentElement,makeAsyncCall:!1,cookie:"",cookieOptions:{},data:[],vars:{data:[]},asyncCallVars:[],featureFlags:[]},n={version:/** {REPLACE_BY: .Version }**/"",status:/** {REPLACE_BY: .Status }**/500,errorDetail:/** {REPLACE_BY: .ErrorDetail }**/void 0,instanceId:/** {REPLACE_BY: .InstanceID }**/"EWX",makeAsyncCall:/** {REPLACE_BY: .MakeAsyncCall }**/!1,cookie:/** {REPLACE_BY: .Cookie }**/"",cookieOptions:/** {REPLACE_BY: .CookieOptionsData }**/{},data:/** {REPLACE_BY: .ModificationsData }**/[],vars:/** {REPLACE_BY: .DataLayerData }**/{data:[]},asyncCallVars:/** {REPLACE_BY: .PageVars }**/[],featureFlags:/** {REPLACE_BY: .FeatureFlags }**/[]};class r{static get window(){return window}static get document(){return document}}function i(e,t,n=void 0){const r=(i=/[\[\]\.]/,t.split(i).filter(Boolean).reduce(((e,t)=>null!=e?e[t]:e),e));var i;return void 0===r?n:r}function s(e){return!Object.entries(e||{}).length&&!(null==e?void 0:e.length)&&!(null==e?void 0:e.size)}function o(e){return"function"==typeof e}function a(e,t){for(const n in e)e.hasOwnProperty(n)&&t(e[n],n,e);return e}const c="_webxp_";function l(e,t){r.window.location.search.match(/[?&]exponea_debug(&|=|$)/)&&(console.log(function(e){return"WebXP ["+(new Date).toUTCString()+"] "+e}(e)),void 0!==t&&console.log(t))}const u=()=>{};function d(){return"loading"!==document.readyState}function p(e){return null!==(t=e)&&"object"==typeof t&&o(e.remove);var t}function h(e,t){try{return e.matches(t)}catch(e){return!1}}function f(e){const t=e.element;try{const n=document.querySelectorAll(t);return 0===n.length&&("remove"===e.type&&l("The selector matched no elements, ignoring the remove modification",t),"run"!==e.type&&"banner"!==e.type||l("The selector matched no elements but still applying "+e.type+" modification",t)),n}catch(n){return"run"===e.type||"banner"===e.type?l("Invalid selector but still applying the "+e.type+" modification",t):l("Invalid selector of the "+e.type+" modification",t),[]}}function m(e){const t=document.createElement("div");t.innerHTML=e;const n=document.createDocumentFragment();for(;t.firstChild;)n.appendChild(t.firstChild);return n}function g(e){const t=[];for(let n=0;n<e.childNodes.length;n++)t.push(e.childNodes[n]);return t}function v(e,t){return function(e){const t=[];let n=e.parentElement,r=0;for(;n&&r<1e3;)t.push(n),n=n.parentElement,r++;return t}(e).some((e=>{var n;return null===(n=t.applied)||void 0===n?void 0:n.has(e)}))||function(e){const t=[],n=e.parentNode;if(!n)return t;const r=n.childNodes;for(let n=0;n<r.length;n++)r[n]!==e&&r[n].nodeType===Node.ELEMENT_NODE&&t.push(r[n]);return t}(e).some((e=>{var n;return null===(n=t.applied)||void 0===n?void 0:n.has(e)}))}function y(e,t){const n="before"===t||"after"===t?e.parentElement:e;let r=null;if(n)switch(t){case"before":r=e;break;case"after":r=e.nextSibling;break;case"prepend_child":r=e.firstChild;break;default:r=null}return{parentElement:n,nodeBefore:r}}function b(e,t){"length"in e||(e=[e]),[].forEach.call(e,(function(e){1===e.nodeType&&t(e)}))}function x(e){return c+e}const _=c+"list";function w(e,t){b(e,(e=>{e[_]||(e[_]=[]),-1===e[_].indexOf(t)&&e[_].push(t)}))}function E(e,t){b(e,(e=>{if(!e[_])return;const n=e[_].indexOf(t);-1!==n&&e[_].splice(n,1)}))}function O(e,t){return e[_]&&-1!==e[_].indexOf(t)}function S(){return!!document.getElementById(e)}function k(e,t,n,r){const i={};if(i.inPreview=S(),i.sdk=n,i.data=i.params=t,r)i.element=r,i.elements=[r];else{const t=f(e);t&&t.length>0?(i.element=t[0],i.elements=[].slice.call(t)):(i.element=null,i.elements=[])}i.selector=e.element;const s="parametrized_parts"in e?e.parametrized_parts.script:e.script,o=new Function(s).bind(i);return o.context=i,o}const I=e=>e/1e3;function R(e,t,n,r){var i,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,n,o):i(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o}function C(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function N(e,t,n,r){return new(n||(n=Promise))((function(t,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function o(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){e.done?t(e.value):new n((function(t){t(e.value)})).then(s,o)}a((r=r.apply(e,[])).next())}))}class T{constructor(){this.subscribers=new Map,this.numberOfEvents=0}subscribe(e,t){var n;const r=null!==(n=this.subscribers.get(e))&&void 0!==n?n:new Map,i=++this.numberOfEvents;return r.set(i,t),this.subscribers.set(e,r),{unsubscribe:()=>r.delete(i)}}publish(e,t){var n;const r=null!==(n=this.subscribers.get(e))&&void 0!==n?n:new Map;for(const[,e]of r)e(t)}}function L(e,t){var n;const r="add_modification",i=t.parametrized_parts?t.parametrized_parts.html:t.html;if(t.applied||(t.applied=new Map),t.applied.has(e)||O(e,r)&&v(e,t))return u;const s=m(i),{parentElement:o,nodeBefore:a}=y(e,t.place_to.placement);if(!o)return u;const c=g(s);return w(s.childNodes,r),null===(n=null==t?void 0:t.applied)||void 0===n||n.set(e,!0),o.insertBefore(s,a),()=>{var n;c.forEach((e=>P(e))),null===(n=t.applied)||void 0===n||n.set(e,!1)}}function P(e){e.parentNode?e.parentNode.removeChild(e):l("Cannot remove an inserted element because its original parent is missing.")}function $(e){let t=u;return e.parentElement&&(t=j.bind(window,e,e.parentElement,e.nextElementSibling),e.parentElement.removeChild(e)),t}function A(e,t){if("visibility"===t.method){const t=e.style.visibility;return e.style.visibility="hidden",()=>{e.style.visibility=t}}if("display"===t.method){const t=e.style.display;return e.style.display="none",()=>{e.style.display=t}}return()=>{}}function j(e,t,n){t?t.insertBefore(e,n):l("Cannot re-insert a removed element because its original parent is missing.")}function D(e,t){if(t.html&&!O(e,t)){const n=m(t.parametrized_parts?t.parametrized_parts.html:t.html),{parentElement:r}=y(e,"before");if(r){const i=g(n);return w(n.childNodes,t),r.insertBefore(n,e),r.removeChild(e),F.bind(window,e,r,i)}}return u}function F(e,t,n){t?(j(e,t,n[0]),n.forEach(P)):l("Cannot re-insert a removed element because its original parent is missing.")}function M(e,t){const n=e.innerHTML;return t.text&&!O(e,t)?(e.innerText=t.text,w(e,t),B.bind(window,e,n,t)):u}function B(e,t,n){E(e,n),e.innerHTML=t}function q(e){const t=[],n=f(e);if(n.length>0&&e.place_to){const r=function(e){let t;try{t=document.querySelector(e)}catch(t){return l("Invalid selector, ignoring the add modification",e),!1}return t||(l("No element matched the selector, ignoring the modification",e),null)}(e.place_to.element);if(r){const{parentElement:i,nodeBefore:s}=y(r,e.place_to.placement);i&&[].forEach.call(n,(function(n){O(n,e)||(t.push(V.bind(window,n,n.parentElement,n.nextSibling,e)),i.insertBefore(n,s),w(n,e))}))}}return t}function V(e,t,n,r){t?(E(e,r),j(e,t,n)):l("Cannot move back element because its original parent is missing.")}function Q(e,t){const n=[];return t.style?(e.hasAttribute("style")||n.push((()=>{e.removeAttribute("style")})),a(t.style,((t,r)=>{const i=e.style.getPropertyValue(r);e.style.setProperty(r,t,"important"),n.push(i?()=>{e.style.setProperty(r,i)}:()=>{e.style.removeProperty(r)})})),()=>{n.forEach((e=>e()))}):()=>{}}function U(e,t){if(!t.attributes)return()=>{};const n={};return a(t.attributes,((t,r)=>{var i;n[r]=e.getAttribute(r),function(e,t){return x(t)in e&&!0===e[x(t)]}(e,"alreadySetAttribute_"+r)||("src"!==r&&"srcset"!==r||e.setAttribute(r,""),e.setAttribute(r,t),i="alreadySetAttribute_"+r,b(e,(e=>{e[x(i)]=!0})))})),H.bind(window,e,n,t)}function H(e,t,n){n.attributes&&a(n.attributes,((r,i)=>{if(n.attributes&&e.getAttribute(i)===n.attributes[i]){const n=t[i];null==n?e.removeAttribute(i):e.setAttribute(i,n)}else l("Attribute `"+i+"` was not reverted because it changed value in meantime.");var s;s="alreadySetAttribute_"+i,b(e,(e=>{delete e[x(s)]}))}))}function K(e,t,n,r){try{if(r&&O(r,e))return()=>{};const i=k(e,t,n,r)();return r&&w(r,e),()=>{r&&E(r,e),o(i)?i():p(i)&&i.remove.call(i)}}catch(e){return l("The run modification script threw an error",e),()=>{}}}function z(e,t,n){try{const r=k(e,t,n);e.parametrized_parts?(r.context.html=e.parametrized_parts.html,r.context.style=e.parametrized_parts.style):(r.context.html=e.html,r.context.style=e.style);const i=r();return p(i)?i.remove.bind(i):()=>{}}catch(e){return l("The banner modification script threw an error",e),()=>{}}}function W(e){let t=[],n=`/* Experiment: ${e.params.experiment_name} (id: ${e.params.experiment_id}) */`,r=`/* Variant: ${e.params.variant_name} (id: ${e.params.variant_id}) */`;if(e.modifications.forEach((function(e){const i=[];if("change"===e.type&&e.style)for(const t in e.style)e.style.hasOwnProperty(t)&&i.push("\t"+t+": "+e.style[t]+" !important;");else"remove"!==e.type||"display"!==e.method&&"visibility"!==e.method||i.push("\t"+e.method+": "+("display"===e.method?"none":"hidden")+" !important;");i.length>0&&("change"===e.type||"remove"===e.type)&&(n&&(t.push(n),n=""),r&&(t.push(r),r=""),t=[...t,e.element+" {",...i,"}"])})),t.length>0){const e=document.createElement("style");return e.type="text/css",e.innerHTML=t.join("\n"),document.getElementsByTagName("head")[0].appendChild(e),P.bind(window,e)}return u}var J;!function(e){e.isDataLayerVariable=function(e){return"data_layer"===e.variable.type},e.isQueryParameterVariable=function(e){return"query"===e.variable.type},e.isJavaScriptVariable=function(e){return"global_variable"===e.variable.type},e.isCustomFunction=function(e){return"custom_function"===e.variable.type}}(J||(J={}));const X="dataLayer";var G,Y;function Z(e,t){return e.data.find((e=>e.id===t))}function ee(e,t){const n=function(e){const t={};return new URL(e).searchParams.forEach(((e,n)=>{t[n]=decodeURIComponent(e)})),t}(t);if(0===Object.keys(n).length)return;const r=e.variable.query.key;if(!r)return;return n[r]}function te(e,t){let n;if(e)return J.isDataLayerVariable(e)?n=function(e,t){const n=t[X];if(!n)return;const r=e.variable.data_layer.name;if(r)for(let e=n.length-1;e>=0;e--){const t=i(n[e],r,void 0);if(t)return t}}(e,t):J.isQueryParameterVariable(e)?n=ee(e,t.location.href):J.isJavaScriptVariable(e)?n=function(e,t){const n=e.variable.global_variable.name;if(!n)return;const r=i(t,n,void 0);return r||void 0}(e,t):J.isCustomFunction(e)&&(n=function(e){const t=e.variable.custom_function.body;if(!t)return;let n,r;try{n=new Function(t)}catch(e){return}try{r=n()}catch(e){return}return r}(e)),n}function ne(e,t=window,n){if(!n)return;if(!(null==e?void 0:e.length))return;const r={};return e.forEach((e=>{const i=e.id,s=Z(n,i);if(!s)return;const o=te(s,t);void 0!==o&&(r[i]=o)})),s(r)?void 0:r}!function(e){e.matches=function(e,t,n,r){return!r||r.every((r=>{let i;if(!n)return!1;try{const s=r.attribute.id,o=Z(n,s);if(!o)return!1;i=te(o,e);const a={};return void 0!==i&&(a[s]=i),t(a,s,r.constraint)}catch(e){return!1}}))}}(G||(G={}));class re{constructor(){this.revertObjects=[]}add({fn:e,experimentId:t,trigger:n}){"function"==typeof e?this.revertObjects.push({fn:e,experimentId:t,trigger:n}):this.revertObjects=[...this.revertObjects,...e.map((e=>({fn:e,experimentId:t,trigger:n})))]}revert(){for(let e=this.revertObjects.length-1;e>=0;e--)try{this.revertObjects[e].fn()}catch(e){l("Error from revert experiment script",e)}this.revertObjects=[]}revertExperiment(e){this.revertRelevant((t=>t.experimentId===e))}revertAllByTrigger(e){this.revertRelevant((t=>t.trigger===e))}revertRelevant(e){var t;this.revertObjects.filter(e).map((e=>e.fn)).forEach((e=>{try{e()}catch(e){l("Error from revert experiment script",e)}})),this.revertObjects=this.revertObjects.filter((t=e,e=>!t(e)))}}function ie(e,t,n){return N(this,0,void 0,(function*(){let r,i;l(`${(null==n?void 0:n.method)||"GET"} ${t} (payload: ${null==n?void 0:n.body})`);try{r=yield e.fetch(t,n)}catch(e){throw l(`Error ${(null==n?void 0:n.method)||"GET"} to ${t}.`,e),e}if(!(null==r?void 0:r.ok))throw l(`Error: Received ${null==r?void 0:r.status} from ${t}`),new Error(`Received ${null==r?void 0:r.status} from ${t}`);try{i=yield r.json()}catch(e){throw l(`Error: Unable to create JSON from ${t}`),e}return i}))}!function(e){e.ewx_498_observer_refactor="ewx_498_observer_refactor"}(Y||(Y={}));const se=console,oe={log:se.log,warn:se.warn,debug:se.debug,error:se.error};class ae{static isSupported(){if(void 0!==this.cachedIsSupported)return this.cachedIsSupported;try{const e="__storage_test_sample__";return this.getStorage().setItem(e,e),this.getStorage().removeItem(e),this.cachedIsSupported=!0,!0}catch(e){return this.cachedIsSupported=!1,!1}}static getItem(e){return this.isSupported()?this.getStorage().getItem(e):null}static setItem(e,t){this.getStorage().setItem(e,t)}static removeItem(e){this.getStorage().removeItem(e)}static getStorage(){return window.localStorage}}ae.cachedIsSupported=void 0;class ce{static getLastShow(e,t){const n=ae.getItem(this.getLastShowKey(e,t));return n?parseInt(n,10):null}static setLastShow(e,t){const n=""+Date.now();ae.setItem(this.getLastShowKey(e,t),n)}static getLastSessionStart(e){const t=ae.getItem(this.getLastSessionStartKey(e));return t?parseInt(t,10):null}static getLastShowKey(e,t){return this.getEventKeyPrefix(t)+e+"_last_show"}static getEventKeyPrefix(e){return this.getPrefix(e)+"_experiment_event__"}static getLastSessionStartKey(e){return this.getPrefix(e)+"_last_session_start_timestamp__"}static getPrefix(e){let t=e.replace(/^_/,"");return"infinario"===t&&(t="inf"),"__"+t}}var le,ue,de,pe;function he(e){return function(n,r,i){try{const s=i.type,o=i.operator,a=i.operands;if(le.whitelist.indexOf(o)>-1)return function(e,t,n,r){const i=e[n];switch(r){case le.isSet:return null!=i;case le.isNotSet:return null==i;case le.hasValue:return fe(t)?(null==i?void 0:i.length)>0:i+""!="";case le.hasNoValue:return fe(t)?0===(null==i?void 0:i.length):i+""==""}return!1}(n,s,r,o);if(function(e){return"string"===e}(s))return function(e,n,r,i){if(-1===ue.whitelist.indexOf(r))return t(r,"string"),!1;const s=e[n]+"";let o;switch(r){case ue.equals:return s===i[0].value;case ue.doesNotEqual:return s!==i[0].value;case ue.isIn:return o=i.map((e=>e.value)),o.indexOf(s)>-1;case ue.isNotIn:return o=i.map((e=>e.value)),-1===o.indexOf(s);case ue.contains:return s.indexOf(i[0].value)>-1;case ue.doesNotContain:return-1===s.indexOf(i[0].value);case ue.startsWith:return s.startsWith(i[0].value);case ue.endsWith:return s.endsWith(i[0].value);case ue.matchesRegex:return null!==new RegExp(i[0].value).exec(s)}return!1}(n,r,o,a);if(function(e){return"number"===e}(s))return function(e,n,r,i){if(-1===de.whitelist.indexOf(r))return t(r,"number"),!1;const s=parseFloat(e[n]+""),o=parseFloat(i[0].value);switch(r){case de.equalTo:return s===o;case de.inBetween:return o<=s&&s<=parseFloat(i[1].value);case de.lessThan:return s<o;case de.greaterThan:return s>o}return!1}(n,r,o,a);if(function(e){return"boolean"===e}(s))return function(e,n,r,i){if(-1===pe.whitelist.indexOf(r))return t(r,"boolean"),!1;const s=e[n]+"",o=i.value+"";if(r===pe.is)return s===o;return!1}(n,r,o,i);(function(e){return"date"===e})(s)&&e.error("Value filter: Date type is not supported."),fe(s)&&e.error("Value filter: List type is not supported.")}catch(t){e.debug("Value filter error:",t)}return e.debug("Invalid value filter:",i.operator),!1};function t(t,n){e.error("Contextual Bandits: operation "+t+" not suported for type "+n+".")}}function fe(e){return"list"===e}function me(e){return function(t){var n;return ge(t.params.experiment_id,t.frequency,e.sdkObjectName)&&function(e,t,n){if(!t||S())return!0;const r=e.experiment_id;try{const i=function(e,t,n){const r={};r.inPreview=S(),r.sdk=t,r.data=r.params=e;let i=n;i.length>0&&i.indexOf("\n")<0&&i.indexOf(";")<0&&i.indexOf("return")<0&&(i="return "+i);const s=new Function(i).bind(r);return s.context=r,s}(e,n,t);return i()||l(`Experiment ${r} was filtered out because of custom condition  ${t}.`),!!i()}catch(e){return l(`Custom condition for experiment ${r} threw an error`,e),!1}}(t.params,t.custom_condition,e.sdk)&&ve(null===(n=t.variables_target)||void 0===n?void 0:n.conditions,e.vars)}}function ge(e,t,n){if(S())return!0;const r=ce.getLastShow(e,n),i=ce.getLastSessionStart(n);if(!ae.isSupported()&&("only_once"===t||"once_per_visit"===t))return l(`Can't apply experiment ${e} due to missing browser local storage support.`),!1;switch(t){case"only_once":return r&&l(`Experiment ${e} was filtered out because of its frequency only_once.`),!r;case"once_per_visit":return r&&i&&r>=i&&l(`Experiment ${e} was filtered out because of its frequency once_per_visit.`),!r||!i||r<i;default:return!0}}function ve(e,t){const n=he(oe);return G.matches(window,n,t,e)}!function(e){e.isSet="is set",e.isNotSet="is not set",e.hasValue="has value",e.hasNoValue="has no value",e.whitelist=[e.isSet,e.isNotSet,e.hasValue,e.hasNoValue]}(le||(le={})),function(e){e.equals="equals",e.doesNotEqual="does not equal",e.isIn="in",e.isNotIn="not in",e.contains="contains",e.doesNotContain="does not contain",e.startsWith="starts with",e.endsWith="ends with",e.matchesRegex="regex",e.whitelist=[e.equals,e.doesNotEqual,e.isIn,e.isNotIn,e.contains,e.doesNotContain,e.startsWith,e.endsWith,e.matchesRegex]}(ue||(ue={})),function(e){e.equalTo="equal to",e.inBetween="in between",e.lessThan="less than",e.greaterThan="greater than",e.whitelist=[e.equalTo,e.inBetween,e.lessThan,e.greaterThan]}(de||(de={})),function(e){e.is="is",e.whitelist=[e.is]}(pe||(pe={}));class ye{static matches(e,t){return!t.enabled||!(t.from_date&&t.from_date>e)&&!(t.to_date&&t.to_date<e)}}var be={exports:{}};be.exports=Oe;var xe=be.exports.isMobile=Oe;be.exports.default=Oe;const _e=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,we=/CrOS/,Ee=/android|ipad|playbook|silk/i;function Oe(e){e||(e={});let t=e.ua;if(t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"!=typeof t)return!1;let n=_e.test(t)&&!we.test(t)||!!e.tablet&&Ee.test(t);return!n&&e.tablet&&e.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==t.indexOf("Macintosh")&&-1!==t.indexOf("Safari")&&(n=!0),n}class Se{static matches(e,t){if(!e)return!0;const n=xe({ua:t,tablet:!0,featureDetect:!0});return"mobile"===e.type?n:"desktop"!==e.type||!n}}class ke{static matches(e,t){if("page"in t)return this.matchesURLFilter(e,t.page);if(t.exclude_pages)for(const n of t.exclude_pages)if(this.matchesURLFilter(e,n))return!1;if(t.include_pages)for(const n of t.include_pages)if(this.matchesURLFilter(e,n))return!0;return!1}static parseURL(e){const t={source:e};let n;const r=/^(.{1,5}?):\/\//;(n=r.exec(e))&&(t.protocol=n[1],e=e.replace(r,"")),e.startsWith("//")&&(e=e.substr(2));const i=/(.*?)(\/|$)/;if(n=i.exec(e)){const r=n[1].split(":");""!==r[0]&&(t.host=r[0]),r.length>1&&(t.port=r[1]),e=e.replace(i,"/")}const s=/(.*?)(\?|$|#)/;(n=s.exec(e))&&(t.path=n[1],e=e.replace(s,n[2]));const o=/^\?(.*?)($|#)/;(n=o.exec(e))&&(t.query=n[1],e=e.replace(o,n[2]));if((n=/^#(.*)/.exec(e))&&(t.hash=n[1]),t.withoutHost=t.path,t.query&&(t.withoutHost+=`?${t.query}`),t.hash&&(t.withoutHost+=`#${t.hash}`),t.host){const e=t.port?`:${t.port}`:"";t.withoutProtocol=`//${t.host}${e}${t.withoutHost}`}return t}static escapeRegex(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}static wildcardToRegex(e){const t=("^"+this.escapeRegex(e)+"$").replace(new RegExp("\\\\\\*","g"),".*");return new RegExp(t)}static matchesExactURL(e,t){const n=this.parseURL(e),r=this.parseURL(t);return!(r.host||!r.withoutHost||!n.withoutHost||!n.withoutHost.match(this.wildcardToRegex(r.withoutHost)))||(!(r.protocol||!r.withoutProtocol||!n.withoutProtocol||!n.withoutProtocol.match(this.wildcardToRegex(r.withoutProtocol)))||!!n.source.match(this.wildcardToRegex(r.source)))}static matchesContainsURL(e,t){return e.includes(t)}static matchesRegexURL(e,t){try{const n=new RegExp(t);if(e.match(n))return!0;const r=this.parseURL(e);return!(!r.withoutProtocol||!r.withoutProtocol.match(n))||!(!r.withoutHost||!r.withoutHost.match(n))}catch(e){if(e instanceof Error)return!1;throw e}}static matchesURLFilter(e,t){return"any"===t.type||("exact"===t.type?this.matchesExactURL(e,t.url):"contains"===t.type?this.matchesContainsURL(e,t.url):"regex"===t.type&&this.matchesRegexURL(e,t.regex))}}function Ie(e,t,n,r){try{return(e=>ke.matches(n.href,e.trigger))(e)&&(e=>ye.matches(I((new Date).valueOf()),e.date_filter))(e)&&(e=>Se.matches(e.device_target,r))(e)&&(e=>ge(e._id,e.frequency,t.sdkObjectName))(e)&&(e=>{var n;return ve(null===(n=e.variables_target)||void 0===n?void 0:n.conditions,t.vars)})(e)}catch(e){return!1}}function Re(e){return"run"===e.type&&("repeatedly"===e.execute||"repeatedly_once_per_element"===e.execute)}function Ce(e,t,n,r,i){let s=[];const o=[];return setInterval((()=>{s=s.filter((e=>!e.toBeInvalidated))}),15e3),function(a,c,u){var d,p,h;return N(this,0,void 0,(function*(){const f=null===(h=null===(p=null===(d=a.sdk)||void 0===d?void 0:d.configuration)||void 0===p?void 0:p.customer)||void 0===h?void 0:h.cookie;f&&(a.cookie=f,a.sign=a.sign.split("/")[0]+"/"+a.cookie);const m=yield n,g=e=>t=>t.id===e;return m.forEach((n=>{if(!function(e,t,n){var r,i,s;const o=null===(r=null==e?void 0:e.trigger_event)||void 0===r?void 0:r.type;if(o!==t)return!1;if("datalayer_event"===o){const t=null==n?void 0:n.event;return(null===(s=null===(i=null==e?void 0:e.trigger_event)||void 0===i?void 0:i[o])||void 0===s?void 0:s.event)===t}return!1}(n,c,u))return;if(!Ie(n,a,e,t))return i(n._id),void(s.find(g(n._id))&&(s=function(e,t){const[n,r]=(i=e,s=e=>e.id===t,i.reduce(((e,t)=>(e[s(t)?0:1].push(t),e)),[[],[]]));var i,s;return n.forEach((e=>e.cancel())),r}(s,n._id)));const d=o.includes(n._id);if(s.find(g(n._id))&&!d)return;const p=function(e,t,n,r){l(`Loading experiment ${e}`);const[i,s]=n.sign.split("/"),o=`${n.path}/campaigns/experiments/show`,a=new AbortController,c=a.signal,u=(()=>N(this,0,void 0,(function*(){var a;let l={};if(null==t?void 0:t.length){const e=r(t,window,n.vars);e&&(l={page_vars:e})}const u=yield ie(window,o,{method:"POST",body:JSON.stringify(Object.assign({company_id:i,customer_ids:{cookie:s},personalisation_ids:[e]},l)),signal:c});if(0===(null===(a=null==u?void 0:u.data)||void 0===a?void 0:a.length)&&(null==u?void 0:u.success))return u.data[0];if(!(null==u?void 0:u.data)||1!==u.data.length)throw new Error(`Received unexpected response data from ${o}`);return u.data[0]})))();return{id:e,cancel:()=>a.abort(),promise:u,toBeInvalidated:!1}}(n._id,n.page_vars,a,ne);s.push(p),p.promise.then((e=>{e?(p.toBeInvalidated=!1,r(e,d),e.modifications.some(Re)&&!o.includes(e.params.experiment_id)&&o.push(e.params.experiment_id)):p.toBeInvalidated=!0})).catch(l)})),s}))}}function Ne(e,t){const n={};function r(e){return e.params.experiment_id+"_"+e.params.variant_id}e.forEach((e=>{n[r(e)]=e})),t.forEach((t=>{const i=r(t);n[i]?n[i].modifications=[...n[i].modifications,...t.modifications]:e.push(t)}))}class Te{start(){}stop(){}}class Le{constructor(e,t,n){this.isObserving=!1,this.config={childList:!0,subtree:!0,attributes:!0,characterData:!1},this.target=e,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.observerCallback=t,this.isObserverFlagOn=n}start(){this.isObserving||(this.observer.observe(this.target,this.config),this.isObserving=!0)}stop(){this.isObserving&&(this.observer.disconnect(),this.isObserving=!1)}observerHandler(e){if(this.isObserverFlagOn){this.observerCallback();const e=this.observer.takeRecords();this.stop(),e.length&&this.observerCallback()}else for(let t,n=0;n<e.length;n++)t=e[n],"childList"===t.type&&t.addedNodes.length>0?[].forEach.call(t.addedNodes,(e=>{1===e.nodeType&&this.observerCallback(e,"childList")})):"attributes"===t.type&&this.observerCallback(t.target,"attributes");this.start()}}function Pe(e){return("0"+e.toString(16)).slice(-2)}function $e(e,t=window){if(e%2)throw new Error("The length of the random string should be an even number!");const n=t.crypto||t.msCrypto;if(n&&n.getRandomValues&&Array.from){const t=new Uint8Array(e/2);return n.getRandomValues(t),Array.from(t,Pe).join("")}let r="";for(let t=0;t<e/2;t++)r+=Pe(Math.round(256*Math.random()));return r}function Ae(e,t,n){const r=n.value;return n.value=function(){try{return r.apply(this,arguments)}catch(e){let t;t=e instanceof Error?e:new Error(String(e));const n=this.config.instanceId,i=this.config.version;let s;try{s=this.config.sign.split("/")[0]}catch(e){s="00000000-0000-0000-0000-000000000000"}const o={id:$e(32),instance_id:n,sdk_version:i,company_id:s,spans:[{id:$e(16),start_time:Date.now()/1e3,duration:1,operation:"webxpClient."+r.name,error:{message:t.message,name:t.name,stack:t.stack||""},tags:{url:location.href.split(/[?#]/)[0],host:location.hostname}}]};throw navigator.sendBeacon("//sdk-tracing.exponea.com/webxp-trace/record/browser/v1",JSON.stringify(o)),e}},n}function je(e,t){e.forEach((e=>t(e)))}function De(e,t,n="dataLayer"){t[n]=t[n]||[];!function(e,t,n=!0,r){if(!Array.isArray(e))return;const i=e.push;if(e.push=(...n)=>{const r=i.apply(e,n);try{je(n,t)}catch(e){}return r},n)try{e.forEach((e=>je([e],t)))}catch(e){}}(t[n],e)}var Fe;!function(e){e.triggerTypes=["page_load","datalayer_event","manual"]}(Fe||(Fe={}));class Me{constructor(e){var t;this.config=e,this.pubSub=new T,this.experiments=[],this.alreadyTrackedExperimentsById={},this.isObserverFlagOn=!!(null===(t=this.config.featureFlags)||void 0===t?void 0:t.includes(Y.ewx_498_observer_refactor)),this.revertQueue=new re,this.config.legacyFlickeringMode?this.observer=new Te:this.observer=new Le(e.rootElement,((e,t)=>{if(this.isObserverFlagOn)this.applyExperimentsOnAllElements();else{this.applyAllExperiments(e);const n=!!window.webxpClientReactExperimentalSupport;"childList"===t&&(n||d())&&(null==e?void 0:e.firstElementChild)&&this.traverseNode(null==e?void 0:e.firstElementChild)}}),this.isObserverFlagOn),this.metaDataPromise=function(e){return N(this,0,void 0,(function*(){const t=e.sign.split("/")[0],n=e.path+"/webxp/projects/"+t+"/bundle";let r;try{r=yield ie(window,n)}catch(e){}let i=[];return(null==r?void 0:r.experiments)&&(i=r.experiments),i}))}(this.config);const n=Ce(location,window.navigator.userAgent,this.metaDataPromise,((e,t)=>this.startExperiment(e,t)),(e=>this.stopExperiment(e)));this.pubSub.subscribe("datalayer_event",(e=>n(this.config,"datalayer_event",e)));De((e=>{e&&"object"==typeof e&&(l(`DataLayer event triggered: ${JSON.stringify(e)}`),this.pubSub.publish("datalayer_event",e))}),window)}init(e=!1,t="page_load"){if(200!==this.config.status&&l("Web modifications ended up with status "+this.config.status),!this.config.skipExperiments)return l("Experiments was not applied by non-flickering script because skipExperiments=false"),void this.revealPage();this.config.cookie&&(this.config.sign=this.config.sign.split("/")[0]+"/"+this.config.cookie),this.config.sdk.initialize(!1),this.applyExperiments(this.config.data,!0),this.loadRemainingDataIfNeeded(e,t),this.revealPage()}applyModifications(e){return this.config.legacyFlickeringMode||this.revert(),this.config.data=[e],this.experiments=[],this.config.status=200,this.applyExperiments(this.config.data,!1),()=>{this.revert()}}reset(e){var t,n;const r=e=>"datalayer_event"===e.trigger_type;this.observer.stop(),this.revertQueue.revertAllByTrigger("page_load"),this.experiments=this.experiments.filter(r),this.config.data=this.config.data.filter(r),this.config.cookie=(null===(n=null===(t=this.getSDK().configuration)||void 0===t?void 0:t.customer)||void 0===n?void 0:n.cookie)||"",e&&Fe.triggerTypes.includes(e)||(e="manual"),this.init(!0,e)}revert(){this.observer.stop(),this.revertQueue.revert(),this.experiments=[]}applyModificationOnElement(e,t,n,r=!1){const i=n.params.experiment_id;if(r)"run"===t.type&&"repeatedly_once_per_element"===t.execute&&h(e,t.element)&&this.revertQueue.add({fn:K(t,n.params,this.getSDK(),e),experimentId:i,trigger:n.trigger_type});else if("add"===t.type&&h(e,t.place_to.element))this.revertQueue.add({fn:L(e,t),experimentId:i,trigger:n.trigger_type});else if("change"===t.type||"run"===t.type){const r=h(e,t.element);"change"===t.type?((r||t.place_to&&h(e,t.place_to.element))&&(t.html&&(this.isObserverFlagOn||this.observer.stop(),this.revertQueue.add({fn:D(e,t),experimentId:i,trigger:n.trigger_type})),t.text&&this.revertQueue.add({fn:M(e,t),experimentId:i,trigger:n.trigger_type}),t.place_to&&this.revertQueue.add({fn:q(t),experimentId:i,trigger:n.trigger_type}),t.attributes&&!s(t.attributes)&&(this.isObserverFlagOn||this.observer.stop(),this.revertQueue.add({fn:U(e,t),experimentId:i,trigger:n.trigger_type}))),t.style&&r&&(this.isObserverFlagOn||this.observer.stop(),this.revertQueue.add({fn:Q(e,t),experimentId:i,trigger:n.trigger_type}))):"run"===t.type&&t.execute&&["repeatedly_once_per_element","once_per_element"].includes(t.execute)&&r&&this.revertQueue.add({fn:K(t,n.params,this.getSDK(),e),experimentId:i,trigger:n.trigger_type})}else"remove"===t.type&&"remove"===t.method&&h(e,t.element)?this.revertQueue.add({fn:$(e),experimentId:i,trigger:n.trigger_type}):"remove"===t.type&&("visibility"===t.method||"display"===t.method)&&h(e,t.element)&&this.config.legacyFlickeringMode&&this.revertQueue.add({fn:A(e,t),experimentId:i,trigger:n.trigger_type})}applyExperiments(e,t,n=!1){const r=JSON.parse(JSON.stringify(e)),i=t&&!n?r.filter(me(this.config)):r;this.observer.stop(),l("Applying experiments ...",i),n||this.trackExperiments(i),this.applyOneTimeModifications(i,n),n||this.applyOnDocumentReadyModifications(i),Ne(this.experiments,i),this.isObserverFlagOn?(this.observer.start(),this.applyExperimentsOnAllElements(n)):(this.reapplyExperiments(),this.observer.start())}applyOneTimeModifications(e,t){e.forEach((e=>{const n=e.params.experiment_id;t||this.revertQueue.add({fn:W(e),experimentId:n,trigger:e.trigger_type}),e.modifications.forEach((r=>{"run"!==r.type||("immediately"!==r.execute||t)&&"repeatedly"!==r.execute||this.revertQueue.add({fn:K(r,e.params,this.getSDK()),experimentId:n,trigger:e.trigger_type})}))}))}applyOnDocumentReadyModifications(e){var t;t=()=>{e.forEach((e=>{const t=e.params.experiment_id;e.modifications.forEach((n=>{"run"!==n.type||n.execute&&"document_ready"!==n.execute?"banner"===n.type&&this.revertQueue.add({fn:z(n,e.params,this.getSDK()),experimentId:t,trigger:e.trigger_type}):this.revertQueue.add({fn:K(n,e.params,this.getSDK()),experimentId:t,trigger:e.trigger_type})}))}))},d()?t({}):document.addEventListener("DOMContentLoaded",t)}getSDK(){return S()?function(){let e=!1;return{initialize(){},track(){},trackLink(){},identify(){},update(){},anonymize(){},_revealPage(){},configuration:{},notifications:{isAvailable:e=>(e(!0),!0),isSubscribed:t=>(t(e,!1),e),subscribe(t){setTimeout((()=>{e=!0,t("subscribed")}),500)},unsubscribe(t){setTimeout((()=>{e=!1,t("unsubscribed")}),500)}}}}():window[this.config.sdkObjectName]}trackExperiments(e){e.forEach((e=>{S()||(ce.setLastShow(e.params.experiment_id,this.config.sdkObjectName),this.alreadyTrackedExperimentsById[e.params.experiment_id]||(this.getSDK().track("experiment",{action:"show",experiment_id:e.params.experiment_id,experiment_name:e.params.experiment_name,variant_id:e.params.variant_id,variant_name:e.params.variant_name,location:window.location.href,path:window.location.pathname}),this.alreadyTrackedExperimentsById[e.params.experiment_id]=!0))}))}loadRemainingDataIfNeeded(e=!1,t){return N(this,0,void 0,(function*(){if(e||this.config.makeAsyncCall||200!==this.config.status){const n=200===this.config.status;let r=this.config.path+"/webxp/data/modifications/"+this.config.sign+"/v1",i=!1;r+="?http-referer="+encodeURIComponent(location.href),!e&&n||(r+="&allModifications=true",i=!0),r+=`&trigger=${t}`;let s=this.config.asyncCallVars;const o=e=>!!e.page_vars;if(e||!n){s=(yield this.metaDataPromise).filter(o).flatMap((e=>e.page_vars))}let a,c;if(null==s?void 0:s.length){const e=ne(s,window,this.config.vars);if(e){const t={page_vars:e};let n;try{n=JSON.stringify(t)}catch(t){l(`Error serializing ${e} to json.`,t)}t&&(a={method:"POST",headers:{"Content-Type":"application/json"},body:n})}}try{c=yield ie(window,r,a)}catch(e){}return this.processResponse(c,i)}}))}startExperiment(e,t){this.isExperimentRunning(e.params.experiment_id)&&!t||(l(`Starting experiment ${e.params.experiment_id}`),this.applyExperiments([e],!0,t))}applyAllExperiments(e){e&&this.experiments.forEach((t=>{t.modifications.forEach((n=>{this.applyModificationOnElement(e,n,t)}))}))}reapplyExperiments(){if(this.config.legacyFlickeringMode)this.applyExperimentsOnAllElements();else{const e=this.config.rootElement;e&&this.traverseNode(e)}}traverseNode(e){const t=e.nextElementSibling;this.applyAllExperiments(e),e.firstElementChild&&this.traverseNode(e.firstElementChild),t&&this.traverseNode(t)}applyExperimentsOnAllElements(e=!1){for(const t of this.experiments)for(const n of t.modifications){const r=qe(Be(n));for(const i of r)this.applyModificationOnElement(i,n,t,e)}}isExperimentRunning(e){return this.experiments.some((t=e,e=>e.params.experiment_id===t));var t}stopExperiment(e){this.isExperimentRunning(e)&&(l(`Stopping experiment ${e}`),this.revertQueue.revertExperiment(e),this.experiments=this.experiments.filter((t=>t.params.experiment_id!==e)))}revealPage(){const e=this.getSDK();e._revealPage&&"function"==typeof e._revealPage&&e._revealPage()}processResponse(e,t=!1){e&&e.data&&(l(`Adding new experiments data, ${e.data}, to current data.`),Ne(this.config.data,e.data),t&&(this.config.vars=e.vars),l("Applying new experiments data ..."),this.applyExperiments(e.data,!0))}}function Be(e){const t=[],n=e=>{"string"==typeof e&&t.push(e)};return n(e.element),e.place_to&&n(e.place_to.element),t}function qe(e){return e.flatMap((e=>Array.from(document.querySelectorAll(e)))).filter((e=>e instanceof HTMLElement))}let Ve,Qe;R([Ae,C("design:type",Function),C("design:paramtypes",[Boolean,String]),C("design:returntype",void 0)],Me.prototype,"init",null),R([Ae,C("design:type",Function),C("design:paramtypes",[Object]),C("design:returntype",Function)],Me.prototype,"applyModifications",null),R([Ae,C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",void 0)],Me.prototype,"reset",null),R([Ae,C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",void 0)],Me.prototype,"revert",null);try{configurationData,Ve=!0}catch(e){Ve=!1}Qe=Ve?Object.assign(Object.assign(Object.assign({},t),configurationData),window.webxpClient):Object.assign(Object.assign(Object.assign({},t),n),window.webxpClient);const Ue=new Me(Qe);if(window.webxpClient={init:Ue.init.bind(Ue),revert:Ue.revert.bind(Ue),applyModifications:Ue.applyModifications.bind(Ue),config:Ue.config,skipExperiments:Qe.skipExperiments,reset:Ue.reset.bind(Ue)},Ue.config.legacyFlickeringMode&&function(){if(!function(){try{const e="___storage_test__";return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(e){return!1}}())return!1;try{return!!window.sessionStorage.getItem("exponea-editor-params")}catch(e){return!1}}()){const e=Ue.config.sdk;e._revealPage&&"function"==typeof e._revealPage&&e._revealPage()}else Ue.init()}();
//# sourceMappingURL=modifications.min.js.map
})()