/*! 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={set: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"},get: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}(o),Object.defineProperty(r,"__esModule",{value:!0}),r.xxHash32=void 0;var i=o,a=2654435761,c=2246822519,s=3266489917,l=668265263,u=374761393;r.xxHash32=function(e,t){void 0===t&&(t=0);var n=e="string"==typeof e?(0,i.toUtf8)(e):e,r=t+u&4294967295,o=0;if(n.length>=16){var d=[t+a+c&4294967295,t+c&4294967295,t+0&4294967295,t-a&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*c+(g*c<<16),k=d[h]+w&4294967295,x=65535&(k=k<<13|k>>>19),y=k>>>16;d[h]=x*a+(y*a<<16)&4294967295,h=h+1&3}r=(d[0]<<1|d[0]>>>31)+(d[1]<<7|d[1]>>>25)+(d[2]<<12|d[2]>>>20)+(d[3]<<18|d[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+(_*s+(E*s<<16))&4294967295)<<17|r>>>15))*l+((r>>>16)*l<<16)&4294967295}for(;o>>21))*a+((r>>>16)*a<<16)&4294967295}return r=((65535&(r^=r>>>15))*c&4294967295)+((r>>>16)*c<<16),r=((65535&(r^=r>>>13))*s&4294967295)+((r>>>16)*s<<16),(r^=r>>>16)<0?r+4294967296:r},function(e){var n=t&&t.__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]}),o=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r,e)}(n);var d={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},f=window.positional||window.Positional||{};f.configure=function(e){for(var t in w("positional_track",!0,d.visitorDuration),e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])},f.isVertical=function(){return window.screen.height>window.screen.width},f.allowedToTrack=function(){return!d.consentRequired||"true"==k("positional_consent")},f.allowTracking=function(){w("positional_consent",!0,d.consentPeriod),f.track("$trackingConsentGranted",{})},f.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)}},f.configure(window.__positional_config);var p,h,v=!1,m=[];function g(e){var t=new FormData;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.append(n,e[n]);return t}function w(t,n,r){e.set(t,n,r,d.cookieDomain||d.domain)}function k(t){return e.get(t)}function x(t){e.set(t,"",-1)}function y(e){k("positional_debug")&&window.console.log(e)}function b(){for(var e;e=m.shift();)e();v=!0}function T(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?T(e.parentElement,t):null:(y("Unable to match"),null)}function _(e,t,n){document.addEventListener(e,(function(e){var r=T(e.target,t);if(r){var o=D(r,"data-positional-skip");if(null!==o&&"false"!==o)return;n.call(r,e)}}))}function E(e){"interactive"===document.readyState||"complete"===document.readyState?setTimeout(e,0):document.addEventListener("DOMContentLoaded",e)}function O(){var e=new Uint32Array(32);crypto.getRandomValues(e);var t=d.timePrefix,n=d.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 S(){return d.page||window.location.pathname}function N(e){return e&&e.length>0?e:null}function P(){var e,t,r,o,i,a,c,s,l=D(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:f.xPath(this),vertical:f.isVertical(),y:(e=this,t=e.getBoundingClientRect(),r=document.body,o=document.documentElement,i=Math.max(r.scrollHeight,r.offsetHeight,o.clientHeight,o.scrollHeight,o.offsetHeight),a=o.scrollTop||r.scrollTop,c=o.clientTop||r.clientTop||0,s=t.top+a-c,j(s/i,0,1)),x:B(this),text:this.innerText,text_hash:n.xxHash32(void 0===this.innerText?"":this.innerText,0),tag:this.tagName.toLowerCase(),id:N(this.id),class:N(this.className),page:S(),section:D(this,"data-section")})}function D(e,t){for(;e&&e!==document;e=e.parentNode)if(e.hasAttribute(t))return e.getAttribute(t);return null}function M(){if(v=!1,p=f.getVisitId(),h=f.getVisitorId(),f.debug(d.debug),!1===d.cookies||!1===d.trackVisits)y("Visit tracking disabled"),b();else if(p&&h)y("Active visit"),b();else if(p||w("positional_visit",p=O(),d.visitDuration),k("positional_visit")){y("Visit started"),h||w("positional_visitor",h=O(),d.visitorDuration);var e={visit_token:p,visitor_token:h,customer_id:d.customerId,platform:d.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),d.visitParams)Object.prototype.hasOwnProperty.call(d.visitParams,t)&&(e[t]=d.visitParams[t]);var n=window.navigator.sendBeacon(d.urlPrefix+d.visitsBeaconUrl,g({visit_json:JSON.stringify(e)}));d.sendDev&&window.navigator.sendBeacon("https://dev.positional.ai/hnqajdkrrf/vb",g({visit_json:JSON.stringify(e)})),n&&(x("positional_track"),b())}else y("Cookies disabled"),b();d.trackPerformance&&f.trackPerformance(),d.trackNavigate&&f.trackNavigate(),d.trackParagraphsSelector&&f.trackParagraphs(d.trackParagraphsSelector),d.trackClicksSelector&&f.trackClicks(d.trackClicksSelector),d.trackViews&&f.trackView(),d.trackClose&&f.trackClose(),d.trackScroll&&f.trackScroll()}f.ready=function(e){v?e():m.push(e)},f.getVisitId=f.getVisitToken=function(){return k("positional_visit")},f.getVisitorId=f.getVisitorToken=function(){return k("positional_visitor")},f.reset=function(){return x("positional_visit"),x("positional_visitor"),x("positional_events"),x("positional_track"),!0},f.debug=function(e){return!1===e?x("positional_debug"):w("positional_debug","t",525600),!0},f.toServerEvent=function(e){var t=Object.assign({},e,{visit_id:f.getVisitId(),customer_id:d.customerId,visitor_id:f.getVisitorId()});return t.properties_str=JSON.stringify(t.properties),delete t.properties,JSON.stringify(t)},f.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:O(),js:!0,url:window.location.href};return n.url&&(r.url=n.url),f.ready((function(){f.allowedToTrack()&&(f.getVisitId()||M(),f.sendSocket(f.toServerEvent(r)))})),!0},f.trackView=function(e){var t={url:window.location.href,title:document.title,page:S()};if(e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);f.track("$view",t)},f.trackNavigate=function(){window.navigation&&window.navigation.addEventListener("navigate",(function(e){var t=e.type,n=e.navigationType;y(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(d.trackExternalViews&&o.hostname!=i.hostname){var a={url:e.destination.url,title:"Unknown",page:i.pathname};f.track("$external_view",a,{url:e.destination.url})}f.track("$navigate",r)}))},f.trackClicks=function(e){if(void 0===e)throw new Error("Missing selector");_("click",e,(function(e){var t=P.call(this,e);t.text="input"===t.tag?this.value:(this.textContent||this.innerText||this.innerHTML).replace(/[\s\r\n]+/g," ").trim(),f.track("$click",t)}))},f.trackSubmits=function(e){if(void 0===e)throw new Error("Missing selector");_("submit",e,(function(e){var t=P.call(this,e);f.track("$submit",t)}))},f.trackChanges=function(e){if(y("trackChanges is deprecated and will be removed in 0.5.0"),void 0===e)throw new Error("Missing selector");_("change",e,(function(e){var t=P.call(this,e);f.track("$change",t)}))},f.performanceBeacons={},f.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(f.performanceBeacons[e.name])return;f.performanceBeacons[e.name]=!0}f.track(t,n)}))},f.performanceObserver=new PerformanceObserver(f.performanceCallback),f.trackPerformance=function(){f.performanceCallback(window.performance),f.performanceObserver.observe({entryTypes:PerformanceObserver.supportedEntryTypes})},f.doomScroll={x:{min:0,max:0,last:0,sum:0,normalized:0},y:{min:0,max:0,last:0,sum:0,normalized:0}},f.trackScroll=function(){var e=f.debounce((function(e){f.track("$scroll",e)}),500);window.addEventListener("scroll",(function(){var t=f.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 C=new Set,I=new Set,U={},V=0;function A(e){var t=e.dataset.positionalElementId;return t||(e.dataset.positionalElementId=V++)}f.observeOffScreen=function(e,t){var n=U[A(e)];if(n){var r=t-n.time,o=P.call(e);o.duration=r/1e3,f.track("$elementVisible",o),delete U[A(e)]}},f.observeOnScreen=function(e,t){U[A(e)]={time:t,element:e}},f.observeOnScreenExit=function(){var e=performance.now();for(var t in U){var n=U[t].element;f.observeOffScreen(n,e)}};function j(e,t,n){return Math.min(Math.max(e,t),n)}var L=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.target;(C.has(t)||(C.add(t),f.track("$textExists",P.call(e.target))),e.isIntersecting?f.observeOnScreen(e.target,e.time):f.observeOffScreen(e.target,e.time),e.isIntersecting)&&(I.has(t)||(I.add(t),f.track("$textRead",P.call(e.target))))}))}),{rootMargin:"0px",threshold:1});function B(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 j((t.left+i-a)/o,0,1)}return f.trackParagraphs=function(e){E((function(){!function(e){document.querySelectorAll(e).forEach((function(e){L.observe(e)}))}(e)}))},f.trackBrowserVisibility=function(e){f.observeOnScreenExit(),f.track(e,{})},f.trackClose=function(){document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?f.track("$foreground",{}):f.trackBrowserVisibility("$background",{})})),window.addEventListener("beforeunload",(function(){f.trackBrowserVisibility("$exit",{scroll:f.doomScroll})}))},f.socketEventQueue=[],f.flushEventQueue=function(){if(0!=f.socketEventQueue.length){for(var e=0;e0&&(n+="["+r+"]"),new f.DOMPath.Step(n,e.nodeType===Node.DOCUMENT_NODE)},f.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