const main=(()=>{const t=new Map;t.set("/join","registration:form_view"),t.set("/login","login:form_view"),t.set("/account/cashier/deposit","cashier:deposit"),t.set("/","home");const n=new Map;n.set("/?overlay=join","registration:form_view"),n.set("/?overlay=login","login:form_view");const e="/?";function o(t,n){if(!n)return"";const e=n.split("; ").find(n=>n.startsWith(t+"="));return e?e.split("=")[1]:""}function i(t){let n=t;if(t){const o=t.indexOf("deposit-details");-1!==o&&(n=function(t,n){const o=n.indexOf(e),i=n.substring(0,t-1)+":deposit-details";return-1===o?i:i+n.substring(o)}(o,t));const i=n.lastIndexOf("overlay=");-1!==i&&(n=function(t,n,o){const i=t.indexOf(e),r=function(t){return t=t.replace(/\(/g,"").replace(/\)/g,""),["&","/",":","%","#"].forEach(n=>{t=-1!==t.indexOf(n)?t.substr(0,t.indexOf(n)):t}),t}(t.substring(n+o.length));return t.substring(0,i)+":"+r+e+t.substring(i)}(n,i,"overlay="));const r=n.indexOf(e);-1!==r&&(n=n.substring(0,r))}return n}function r(t,n){const o="/"+n;return t===o?"/":function(t,n){return 0===t.indexOf(n+e)||0===t.indexOf(n+"/")}(t,o)?t.substring(n.length+1):t}function s(t,n,e){if(t&&t[e]){let r="";return n.substring(1,n.length).split("/").forEach(n=>{const s=(o=t[e],i=n,Object.keys(o).find(t=>o[t]===i));r+="/"+(s||n)}),r}var o,i;return n}function u(t,n){let o=t.location.pathname;return(i=o)||""===i?(o=r(o,n),o=s(t.routes,o,n),t.location.search&&(o=function(t,n){return-1!==(t+=n).indexOf("?")&&-1===t.indexOf(e)&&(t=t.replace("?",e)),t}(o,t.location.search)),o):o;var i}function c(o,r,s,c,f){let a=u(o,f);if(n.get(a))return r+":"+n.get(a);const l=function(t){if(t){const n=t.indexOf(e);if(-1!==n)return 0===n?"/":t.substring(0,n)}return t}(a);var g;return r+":"+(a=t.get(l)?function(n,o,r,s){let u=t.get(o);"home"===u&&(u=u+":"+function(t,n){return t?"logged":n?"ftv":"unlogged"}(r,s));const c=n.indexOf(e);return-1!==c&&(u+=n.substring(c)),i(u)}(a,l,s,c):(g=i(g=a))?g.replace("/","").replace(/\//g,":"):g)}function f(t,n){return t[n]?t[n][0]:void 0}function a(t,n){return t[n]?t[n]:void 0}function l(t){const n=a(t.config,"brandCode"),e=a(t.config,"territory"),i=f(t.config,"languages.default"),r=f(t.config,"site.config.first_time_visitor.enabled"),s=t.document.cookie,u=localStorage.getItem("sessionId"),l=localStorage.getItem("customerId"),g=function(t){const n=localStorage.getItem("ftv");if(n){const e=JSON.parse(n).value,o=parseInt(e);return Date.now()-o<1e3&&"true"===t}return!1}(r),d=function(t,n){return!(!t&&"false"!==n)&&JSON.parse(n).value.toString()}(u,l),p=function(t,n){return t?"logged":n&&o("JOINED",n)?"loggedout":"notlogged"}(u,s),m=function(t,n,e){let i=o("LANG",t);if(i)return i;let r=e.split("/")[3];return r&&2===r.length?r:n}(s,i,t.location.href),h=c(t,n,u,g,m);t.wts=t.wts||[],t.wts.push(["site_name",n]),t.wts.push(["page_language",m]),t.wts.push(["pageLoginStatus",p]),t.wts.push(["territory",e]),t.wts.push(["contentId",h]),"logged"===p&&t.wts.push(["customerId",d]),t.wts.push(["send","pageupdate"])}return function(t){return t&&t.config?new Promise((n,e)=>{let o=f(t.config,"site.config.webtrekk.uri");(o=o)&&o.length>0?(o=o.replace("{{url}}",encodeURIComponent(t.location.href)),function(t,n){return new Promise((e,o)=>{const i=function(t){const n=t.indexOf("//");return t.substring(n+"//".length).split("/")}(n);t._tiConfig=t._tiConfig||{tiDomain:i[0],tiId:function(t){const n=t.indexOf("?");return-1===n?t:t.substring(0,n)}(i.pop()),option:{}};const r=t.document.createElement("script");r.onload=(()=>e(r)),r.onerror=(()=>o(`Failed to load ${n}`)),r.id="wtInjection",r.async=!0,r.src=n,r.type="text/javascript",t.document.head.appendChild(r)})}(t,o).then(()=>{l(t),n("Wts was fulfilled successfully")},t=>{console.log(`${t}`),e(t)})):n("Webtrekk URI is not configured")}):Promise.resolve("Config object is not defined");var n}})();main(window),window.module={},module.exports={main:main};