(()=>{function V(s){let c="seline_vid",g="seline-do-not-track",w=s.apiHost??"https://api.seline.com",S=`${w}${s.apiHost?"/ennui/blase":"/s/e"}`,v=`${w}${s.apiHost?"/ennui/su":"/s/su"}`,k=s.token,f=s.maskPatterns??[],b=s.skipPatterns??[],y=s.cookieOnIdentify??!1,d=s.cookie??!1,u=s.outbound??!1,r=A(c),p={},P=null,m=sessionStorage.getItem("seline:referrer")?"":document.referrer;function A(t){let e=document.cookie.match(new RegExp(`(^|;\\s*)${t}=([^;]*)`));return e?decodeURIComponent(e[2]):null}function E(t,e,i=365){let n=new Date;n.setTime(n.getTime()+i*24*60*60*1e3);let o=location.hostname.split(".").slice(-2).join(".");document.cookie=`${t}=${encodeURIComponent(e)};expires=${n.toUTCString()};path=/;domain=.${o};SameSite=Lax`}function $(){return localStorage.getItem(g)==="1"}function N(){localStorage.setItem(g,"1")}function R(){let t=history.pushState;history.pushState=function(...i){t.apply(this,i),h()},addEventListener("popstate",()=>h());function e(){!P&&document.visibilityState==="visible"&&h()}document.visibilityState!=="visible"?document.addEventListener("visibilitychange",e):h(),U()}function x(t=!1){s.autoPageView&&!t||(s.autoPageView=!0,R())}function T(t){let e=b.map(n=>new RegExp(`^${n.replace(/\*/g,"[^/]+")}$`)),i=f.map(n=>new RegExp(`^${n.replace(/\*/g,"[^/]+")}$`));if(e.some(n=>n.test(t)))return null;for(let n=0;n{if(!l.ok)return;let a=await l.json();a?.visitorId&&(r=a.visitorId,d&&E(c,r))})}function _(t){C(S,{token:k,...t},!0)}function I(t,e){let i=T(window.location.pathname);i&&_({pathname:i+window.location.search,name:t,data:e})}function h(t){let e=t??window.location.pathname;if(P===e)return;P=e;let i=T(e);i&&((!m||m.includes(window.location.hostname))&&(m=null),_({pathname:t?i:i+window.location.search,referrer:m}),m&&(m=null,sessionStorage.setItem("seline:referrer","set")))}function L(t){p={...p,...t},C(v,{token:k,fields:p},!1).then(()=>{r&&y&&E(c,r)})}function U(){document.addEventListener("click",t=>{let e=t.target;if(!e||(e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA")&&e.type!=="submit")return;if(u){let o=e;for(;o&&o.tagName!=="A";)o=o.parentElement;if(o&&o.tagName==="A"){let l=o,a=l.href;a&&l.hostname&&l.hostname!==window.location.hostname&&I("outbound link: clicked",{url:a,text:l.textContent?.trim()||"",hostname:l.hostname})}}for(;e&&!e?.hasAttribute("data-sln-event");)e=e.parentElement;if(!e)return;let i=e.getAttribute("data-sln-event");if(!i)return;let n={};for(let o of Array.from(e.attributes))o.name.startsWith("data-sln-event-")&&o.value&&(n[o.name.slice(15)]=o.value);if(e.tagName==="FORM"){let l=Array.from(e.elements);for(let a of l)a.type!=="password"&&a.name&&a.value&&(n[a.name]=a.value)}I(i,n)})}function H(){d=!0,r&&E(c,r)}function O(){return r||(r=A(c),r)}return{track:I,page:h,setUser:L,enableAutoPageView:x,doNotTrack:N,enableCookieMode:H,getVisitorId:O}}if(!window.seline||"queue"in window.seline){let g=function(u){return u?u.replace(/^\[|\]$/g,"").split(",").map(r=>r.trim().replace(/^['"]|['"]$/g,"")).filter(Boolean):[]},s=window.seline?.queue??[],c=document.currentScript?.getAttribute("data-token"),w=g(document.currentScript?.getAttribute("data-skip-patterns")),S=g(document.currentScript?.getAttribute("data-mask-patterns")),v=document.currentScript?.getAttribute("data-auto-page-view")!=="false",k=document.currentScript?.getAttribute("data-api-host"),f=document.currentScript?.getAttribute("data-cookie-on-identify")==="true",b=document.currentScript?.getAttribute("data-cookie")==="true",y=document.currentScript?.getAttribute("data-outbound")==="true",d=V({token:c,skipPatterns:w,maskPatterns:S,autoPageView:v,apiHost:k,cookieOnIdentify:f,cookie:b,outbound:y});for(;s.length>0;){let u=s.shift();u&&d[u.method](...u.args)}window.seline=d,v&&d.enableAutoPageView(!0)}})();