/*! Positional.js v0.4.3 | MIT License */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("positional",t):(e="undefined"!=typeof globalThis?globalThis:e||self).positional=t()}(this,(function(){"use strict";var e=function(e,t,n,r){var o="",i="";if(n){var a=new Date;a.setTime(a.getTime()+60*n*1e3),o="; expires="+a.toGMTString()}r&&(i="; domain="+r);try{sessionStorage.setItem(e,t)}catch(e){}try{localStorage.setItem(e,t)}catch(e){}document.cookie=e+"="+escape(t)+o+i+"; path=/; samesite=lax"},t=function(e){var t,n,r,o,i=e+"=",a=document.cookie.split(";");for(t=0;t>6,128|63&o);else if(o<55296||o>=57344)t.push(224|o>>12,128|o>>6&63,128|63&o);else{var i=65536+((1023&o)<<10|1023&e.charCodeAt(++n));t.push(240|i>>18&7,128|i>>12&63,128|i>>6&63,128|63&i)}}return new Uint8Array(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.toUtf8=e.toUtf8_3=e.toUtf8_2=e.toUtf8_1=void 0,e.toUtf8_1=function(e){var t=[],n=new Array(4),r=[0,192,224,240],o=[127,63,63,63],i=[0,128,128,128];for(var a of e){var c=n,s=a.codePointAt(0),l=0-(-(4294967168&s)>>31)-(-(4294965248&s)>>31)-(-(4294901760&s)>>31),u=o[l],d=i[l];c[3]=d|s&u,c[2]=d|s>>>6&u,c[1]=d|s>>>12&u,c[0]=d|s>>>18&u;var f=3-l;c[f]|=r[l],Array.prototype.push.apply(t,c.slice(f))}return new Uint8Array(t)},e.toUtf8_2=function(e){var t=[];for(var n of e){var r=n.codePointAt(0);r<128?t.push(r):r<2048?t.push(192|r>>6&31,128|63&r):r<65536?t.push(224|r>>12&15,128|r>>6&63,128|63&r):t.push(240|r>>18&7,128|r>>12&63,128|r>>6&63,128|63&r)}return new Uint8Array(t)},e.toUtf8_3=t,e.toUtf8=t,e.default=e.toUtf8}(i),Object.defineProperty(o,"__esModule",{value:!0}),o.xxHash32=void 0;var a=i,c=2654435761,s=2246822519,l=3266489917,u=668265263,d=374761393;o.xxHash32=function(e,t){void 0===t&&(t=0);var n=e="string"==typeof e?(0,a.toUtf8)(e):e,r=t+d&4294967295,o=0;if(n.length>=16){var i=[t+c+s&4294967295,t+s&4294967295,t+0&4294967295,t-c&4294967295],f=e,p=f.length-16,h=0;for(o=0;(4294967280&o)<=p;o+=4){var v=o,m=f[v+0]+(f[v+1]<<8),g=f[v+2]+(f[v+3]<<8),w=m*s+(g*s<<16),k=i[h]+w&4294967295,x=65535&(k=k<<13|k>>>19),y=k>>>16;i[h]=x*c+(y*c<<16)&4294967295,h=h+1&3}r=(i[0]<<1|i[0]>>>31)+(i[1]<<7|i[1]>>>25)+(i[2]<<12|i[2]>>>20)+(i[3]<<18|i[3]>>>14)&4294967295}r=r+e.length&4294967295;for(var b=e.length-4;o<=b;o+=4){var T=o,_=n[T+0]+(n[T+1]<<8),E=n[T+2]+(n[T+3]<<8);r=(65535&(r=(r=r+(_*l+(E*l<<16))&4294967295)<<17|r>>>15))*u+((r>>>16)*u<<16)&4294967295}for(;o>>21))*c+((r>>>16)*c<<16)&4294967295}return r=((65535&(r^=r>>>15))*s&4294967295)+((r>>>16)*s<<16),r=((65535&(r^=r>>>13))*l&4294967295)+((r>>>16)*l<<16),(r^=r>>>16)<0?r+4294967296:r},function(e){var t=n&&n.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=n&&n.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),r(o,e)}(r);var f={urlPrefix:"https://api.positional.ai",eventsBeaconUrl:"/hnqajdkrrf/eb",visitsBeaconUrl:"/hnqajdkrrf/vb",page:null,platform:"Web",startOnReady:!0,trackVisits:!0,trackViews:!0,trackExternalViews:!1,trackClose:!0,timePrefix:(Math.floor(Date.now()/1e3)>>16).toString(16),consentRequired:!1,consentPeriod:1051200,cookies:!0,cookieDomain:null,customerId:null,trackScroll:!0,trackPerformance:!1,trackNavigate:!0,trackParagraphsSelector:"p,a",trackClicksSelector:"a > *,p,a",visitParams:{},debug:!1,sendDev:!1,visitDuration:240,visitorDuration:1051200},p=window.positional||window.Positional||{};p.configure=function(e){for(var t in k("positional_track",!0,f.visitorDuration),e)Object.prototype.hasOwnProperty.call(e,t)&&(f[t]=e[t])},p.isVertical=function(){return window.screen.height>window.screen.width},p.allowedToTrack=function(){return!f.consentRequired||"true"==x("positional_consent")},p.allowTracking=function(){k("positional_consent",!0,f.consentPeriod),p.track("$trackingConsentGranted",{})},p.debounce=function(e,t){var n,r=this;return void 0===t&&(t=300),function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];clearTimeout(n),n=setTimeout((function(){e.apply(r,o)}),t)}},p.configure(window.__positional_config);var h,v,m=!1,g=[];function w(e){var t=new FormData;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.append(n,e[n]);return t}function k(t,n,r){e(t,n,r,f.cookieDomain||f.domain)}function x(e){return t(e)}function y(t){e(t,"",-1)}function b(e){x("positional_debug")&&window.console.log(e)}function T(){for(var e;e=g.shift();)e();m=!0}function _(e,t){var n=e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;return n?n.apply(e,[t])?e:e.parentElement?_(e.parentElement,t):null:(b("Unable to match"),null)}function E(e,t,n){document.addEventListener(e,(function(e){var r=_(e.target,t);if(r){var o=M(r,"data-positional-skip");if(null!==o&&"false"!==o)return;n.call(r,e)}}))}function O(e){"interactive"===document.readyState||"complete"===document.readyState?setTimeout(e,0):document.addEventListener("DOMContentLoaded",e)}function S(){var e=new Uint32Array(32);crypto.getRandomValues(e);var t=f.timePrefix,n=f.customerId,r=0;return"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".replace(/[x]/g,(function(){return++r>20&&r<=24?t[r-20-1]:r>16&&r<=20?n[r-16-1]:e[r-1].toString(16)[0]}))}function N(){return f.page||window.location.pathname}function P(e){return e&&e.length>0?e:null}function D(){var e,t,n,o,i,a,c,s,l=M(this,"href");return l&&(l=new URL(l,document.location).href),function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&null===e[t]&&delete e[t];return e}({href:l,xpath:p.xPath(this),vertical:p.isVertical(),y:(e=this,t=e.getBoundingClientRect(),n=document.body,o=document.documentElement,i=Math.max(n.scrollHeight,n.offsetHeight,o.clientHeight,o.scrollHeight,o.offsetHeight),a=o.scrollTop||n.scrollTop,c=o.clientTop||n.clientTop||0,s=t.top+a-c,L(s/i,0,1)),x:H(this),text:this.innerText,text_hash:r.xxHash32(void 0===this.innerText?"":this.innerText,0),tag:this.tagName.toLowerCase(),id:P(this.id),class:P(this.className),page:N(),section:M(this,"data-section")})}function M(e,t){for(;e&&e!==document;e=e.parentNode)if(e.hasAttribute(t))return e.getAttribute(t);return null}function C(){if(m=!1,h=p.getVisitId(),v=p.getVisitorId(),p.debug(f.debug),!1===f.cookies||!1===f.trackVisits)b("Visit tracking disabled"),T();else if(h&&v)b("Active visit"),T();else if(h||k("positional_visit",h=S(),f.visitDuration),x("positional_visit")){b("Visit started"),v||k("positional_visitor",v=S(),f.visitorDuration);var e={visit_token:h,visitor_token:v,customer_id:f.customerId,platform:f.platform,landing_page:window.location.href,screen_width:window.screen.width,screen_height:window.screen.height,js:!0};for(var t in document.referrer.length>0&&(e.referrer=document.referrer),f.visitParams)Object.prototype.hasOwnProperty.call(f.visitParams,t)&&(e[t]=f.visitParams[t]);var n=window.navigator.sendBeacon(f.urlPrefix+f.visitsBeaconUrl,w({visit_json:JSON.stringify(e)}));f.sendDev&&window.navigator.sendBeacon("https://dev.positional.ai/hnqajdkrrf/vb",w({visit_json:JSON.stringify(e)})),n&&(y("positional_track"),T())}else b("Cookies disabled"),T();f.trackPerformance&&p.trackPerformance(),f.trackNavigate&&p.trackNavigate(),f.trackParagraphsSelector&&p.trackParagraphs(f.trackParagraphsSelector),f.trackClicksSelector&&p.trackClicks(f.trackClicksSelector),f.trackViews&&p.trackView(),f.trackClose&&p.trackClose(),f.trackScroll&&p.trackScroll()}p.ready=function(e){m?e():g.push(e)},p.getVisitId=p.getVisitToken=function(){return x("positional_visit")},p.getVisitorId=p.getVisitorToken=function(){return x("positional_visitor")},p.reset=function(){return y("positional_visit"),y("positional_visitor"),y("positional_events"),y("positional_track"),!0},p.debug=function(e){return!1===e?y("positional_debug"):k("positional_debug","t",525600),!0},p.toServerEvent=function(e){var t=Object.assign({},e,{visit_id:p.getVisitId(),customer_id:f.customerId,visitor_id:p.getVisitorId()});return t.properties_str=JSON.stringify(t.properties),delete t.properties,JSON.stringify(t)},p.track=function(e,t,n){n=n||{},(t=t||{}).time_on_page=performance.now()/1e3;var r={name:e,properties:t,time:(new Date).getTime()/1e3,id:S(),js:!0,url:window.location.href};return n.url&&(r.url=n.url),p.ready((function(){p.allowedToTrack()&&(p.getVisitId()||C(),p.sendSocket(p.toServerEvent(r)))})),!0},p.trackView=function(e){var t={url:window.location.href,title:document.title,page:N()};if(e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);p.track("$view",t)},p.trackNavigate=function(){window.navigation&&window.navigation.addEventListener("navigate",(function(e){var t=e.type,n=e.navigationType;b(n);var r={href:e.destination.url,type:t,navigationType:n},o=new URL(window.location.href),i=new URL(e.destination.url,window.location.href);if(f.trackExternalViews&&o.hostname!=i.hostname){var a={url:e.destination.url,title:"Unknown",page:i.pathname};p.track("$external_view",a,{url:e.destination.url})}p.track("$navigate",r)}))},p.trackClicks=function(e){if(void 0===e)throw new Error("Missing selector");E("click",e,(function(e){var t=D.call(this,e);t.text="input"===t.tag?this.value:(this.textContent||this.innerText||this.innerHTML).replace(/[\s\r\n]+/g," ").trim(),p.track("$click",t)}))},p.trackSubmits=function(e){if(void 0===e)throw new Error("Missing selector");E("submit",e,(function(e){var t=D.call(this,e);p.track("$submit",t)}))},p.trackChanges=function(e){if(b("trackChanges is deprecated and will be removed in 0.5.0"),void 0===e)throw new Error("Missing selector");E("change",e,(function(e){var t=D.call(this,e);p.track("$change",t)}))},p.performanceBeacons={},p.performanceCallback=function(e){e.getEntries().forEach((function(e){var t="$performance."+e.entryType;e.initiatorType&&(t+="."+e.initiatorType),"resource"!=e.entryType&&"navigation"!=e.entryType&&e.name&&(t+="."+e.name);var n=e.toJSON();if("resource"===e.entryType&&["beacon","other"].includes(e.initiatorType)){if(p.performanceBeacons[e.name])return;p.performanceBeacons[e.name]=!0}p.track(t,n)}))},p.performanceObserver=new PerformanceObserver(p.performanceCallback),p.trackPerformance=function(){p.performanceCallback(window.performance),p.performanceObserver.observe({entryTypes:PerformanceObserver.supportedEntryTypes})},p.doomScroll={x:{min:0,max:0,last:0,sum:0,normalized:0},y:{min:0,max:0,last:0,sum:0,normalized:0}},p.trackScroll=function(){var e=p.debounce((function(e){p.track("$scroll",e)}),500);window.addEventListener("scroll",(function(){var t=p.doomScroll;t.x.min=Math.min(t.x.min,window.scrollX),t.x.max=Math.max(t.x.max,window.scrollX),t.y.min=Math.min(t.y.min,window.scrollY),t.y.max=Math.max(t.y.max,window.scrollY),t.x.sum+=Math.abs(window.scrollX-t.x.last),t.y.sum+=Math.abs(window.scrollY-t.y.last),t.x.last=window.scrollX,t.y.last=window.scrollY,t.x.normalized=t.x.sum/(t.x.max-t.x.min),t.y.normalized=t.y.sum/(t.y.max-t.y.min);var n,r,o,i={x:window.scrollX,y:(window.scrollY+window.innerHeight)/(n=document.body,r=document.documentElement,o=Math.max(n.scrollHeight,n.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight),o)};e(i)}),!1)};var I=new Set,U=new Set,V={},A=0;function j(e){var t=e.dataset.positionalElementId;return t||(e.dataset.positionalElementId=A++)}p.observeOffScreen=function(e,t){var n=V[j(e)];if(n){var r=t-n.time,o=D.call(e);o.duration=r/1e3,p.track("$elementVisible",o),delete V[j(e)]}},p.observeOnScreen=function(e,t){V[j(e)]={time:t,element:e}},p.observeOnScreenExit=function(){var e=performance.now();for(var t in V){var n=V[t].element;p.observeOffScreen(n,e)}};function L(e,t,n){return Math.min(Math.max(e,t),n)}var B=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.target;(I.has(t)||(I.add(t),p.track("$textExists",D.call(e.target))),e.isIntersecting?p.observeOnScreen(e.target,e.time):p.observeOffScreen(e.target,e.time),e.isIntersecting)&&(U.has(t)||(U.add(t),p.track("$textRead",D.call(e.target))))}))}),{rootMargin:"0px",threshold:1});function H(e){var t=e.getBoundingClientRect(),n=document.body,r=document.documentElement,o=Math.max(n.scrollWidth,n.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth),i=r.scrollLeft||n.scrollLeft,a=r.clientLeft||n.clientLeft||0;return L((t.left+i-a)/o,0,1)}return p.trackParagraphs=function(e){O((function(){!function(e){document.querySelectorAll(e).forEach((function(e){B.observe(e)}))}(e)}))},p.trackBrowserVisibility=function(e){p.observeOnScreenExit(),p.track(e,{})},p.trackClose=function(){document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?p.track("$foreground",{}):p.trackBrowserVisibility("$background",{})})),window.addEventListener("beforeunload",(function(){p.trackBrowserVisibility("$exit",{scroll:p.doomScroll})}))},p.socketEventQueue=[],p.flushEventQueue=function(){if(0!=p.socketEventQueue.length){for(var e=0;e0&&(n+="["+r+"]"),new p.DOMPath.Step(n,e.nodeType===Node.DOCUMENT_NODE)},p.DOMPath._xPathIndex=function(e){function t(e,t){return e===t||(e.nodeType===Node.ELEMENT_NODE&&t.nodeType===Node.ELEMENT_NODE?e.localName===t.localName:e.nodeType===t.nodeType||(e.nodeType===Node.CDATA_SECTION_NODE?Node.TEXT_NODE:e.nodeType)===(t.nodeType===Node.CDATA_SECTION_NODE?Node.TEXT_NODE:t.nodeType))}var n,r=e.parentNode?e.parentNode.children:null;if(!r)return 0;for(var o=0;o