flusterduck 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/flusterduck.mjs +23 -0
- package/dist/core.d.ts +7 -1
- package/dist/d.global.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/queue.d.ts +4 -3
- package/dist/signals/frustration-correlator.d.ts +1 -1
- package/dist/types.d.ts +25 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# flusterduck
|
|
2
2
|
|
|
3
|
-
Lightweight browser SDK for UX friction monitoring. Detects rage clicks, dead clicks, form abandonment, navigation loops, and 20+ other behavioral signals
|
|
3
|
+
Lightweight browser SDK for UX friction monitoring. Detects and classifies rage clicks, dead clicks, form abandonment, navigation loops, and 20+ other behavioral signals locally in the browser. No configuration required beyond your publishable key.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ npm install flusterduck
|
|
|
11
11
|
Or load via script tag:
|
|
12
12
|
|
|
13
13
|
```html
|
|
14
|
-
<script async src="https://
|
|
14
|
+
<script async src="https://cdn.jsdelivr.net/npm/flusterduck@0/dist/d.global.js" data-key="fd_pub_..."></script>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Basic usage
|
|
@@ -51,7 +51,7 @@ init({
|
|
|
51
51
|
// Only track a fraction of sessions (0-1)
|
|
52
52
|
sampleRate: 0.5,
|
|
53
53
|
|
|
54
|
-
// Cookieless mode: session ID
|
|
54
|
+
// Cookieless mode: memory-only session ID, no Flusterduck cookie
|
|
55
55
|
cookieless: false,
|
|
56
56
|
|
|
57
57
|
// Respect DoNotTrack and GlobalPrivacyControl (default: true)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// `npx flusterduck <args>` resolves THIS package (the SDK), not the CLI. The CLI
|
|
3
|
+
// is published separately as `flusterduck-cli`. To make the intuitive
|
|
4
|
+
// `npx flusterduck init` just work, this thin launcher hands the arguments off
|
|
5
|
+
// to the real CLI via npx. Importing the SDK in code is unaffected.
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
10
|
+
|
|
11
|
+
const result = spawnSync(npx, ['-y', 'flusterduck-cli@latest', ...args], {
|
|
12
|
+
stdio: 'inherit',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (result.error) {
|
|
16
|
+
console.error(
|
|
17
|
+
'Could not start the Flusterduck CLI. Run it directly with:\n npx flusterduck-cli ' +
|
|
18
|
+
args.join(' '),
|
|
19
|
+
);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
process.exit(result.status ?? 0);
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config, SDKEvent } from './types';
|
|
1
|
+
import type { Config, EmittedSignal, SDKEvent } from './types';
|
|
2
2
|
import { enqueue, flush } from './queue';
|
|
3
3
|
export declare function init(cfg: Config): void;
|
|
4
4
|
export declare function signal(name: string, data?: {
|
|
@@ -10,6 +10,12 @@ export declare function track(name: string, metadata?: Record<string, unknown>):
|
|
|
10
10
|
export declare function identify(segment: Record<string, string>): void;
|
|
11
11
|
export declare function setConsent(consented: boolean): void;
|
|
12
12
|
export declare function optOut(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Subscribe to friction signals as they are detected. The listener runs
|
|
15
|
+
* synchronously the instant a signal fires (before it is batched/sent). Returns
|
|
16
|
+
* an unsubscribe function. Works whether or not `onSignal` was passed to init.
|
|
17
|
+
*/
|
|
18
|
+
export declare function onSignal(listener: (signal: EmittedSignal) => void): () => void;
|
|
13
19
|
export declare function destroy(): void;
|
|
14
20
|
export { enqueue, flush };
|
|
15
21
|
export type { Config, SDKEvent };
|
package/dist/d.global.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{function t(t){return(...e)=>{try{return t(...e)}catch{}}}function e(t){return e=>{try{t(e)}catch{}}}var n="_fd_s",o=/^[0-9a-f]{32}$/;function r(){s(n,"",-1)}function i(){const t=new Uint8Array(16);crypto.getRandomValues(t);let e="";for(const n of t)e+=n.toString(16).padStart(2,"0");return e}function s(t,e,n){const o=new Date;o.setTime(o.getTime()+864e5*n);const r="https:"===location.protocol?";Secure":"";document.cookie=`${t}=${encodeURIComponent(e)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var c=/^[:\d]|--|^(ember|react|ng-|__)/;function a(t){if(!t||t===document.documentElement)return"html";const e=t.getAttribute("data-fd");if(e)return`[data-fd="${u(e)}"]`;if(t.id&&!c.test(t.id)&&t.id.length<64)return"#"+u(t.id);const n=[];let o=t,r=0;for(;o&&o!==document.body&&r<5;){let t=o.tagName.toLowerCase();const e=o.getAttribute("name"),i=o.getAttribute("role"),s=o.getAttribute("type");e&&e.length<64?t+=`[name="${u(e)}"]`:i?t+=`[role="${u(i)}"]`:!s||"input"!==t&&"button"!==t||(t+=`[type="${u(s)}"]`);const c=o.parentElement;if(c){const e=c.children;let n=0,r=0;for(let t=0;t<e.length;t++){const i=e[t];i&&i.tagName===o.tagName&&(n++,i===o&&(r=n))}n>1&&(t+=`:nth-of-type(${r})`)}n.unshift(t);const a=n.join(" > ");try{if(1===document.querySelectorAll(a).length)return a}catch(t){}o=c,r++}return n.join(" > ")}function u(t){return"undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([^\w-])/g,"\\$1")}var l=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,f=/^(INPUT|TEXTAREA|SELECT)$/;function d(t){try{const e=t.getAttribute("aria-label");if(e)return e.trim().slice(0,60);if(!f.test(t.tagName)){const e=(t.textContent??"").trim().replace(/\s+/g," ").slice(0,60);if(e&&!l.test(e))return e}const n=t.getAttribute("placeholder");if(n)return n.trim().slice(0,60);const o=t.getAttribute("title");if(o)return o.trim().slice(0,60);const r=t.getAttribute("alt");return r?r.trim().slice(0,60):""}catch{return""}}function p(t,e){if(t.hasAttribute("data-fd-ignore"))return!0;if(t.closest("[data-fd-ignore]"))return!0;for(const n of e)try{if(t.matches(n)||t.closest(n))return!0}catch(t){}return!1}function h(t,e){return t&&e.includes(t)?t:null}function w(t){const e=t.tagName.toLowerCase();if("input"!==e&&"button"!==e)return null;const n=t.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function m(t){return t.top<window.innerHeight&&t.bottom>0&&t.left<window.innerWidth&&t.right>0}function _(t){if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t.tagName))return!0;const e=t.getAttribute("role");return!(!e||!/^(button|link|tab|menuitem|checkbox|radio)$/.test(e))}var v=6e4,g="application/json",b=[],y=null,M="",k=7e3,T=50,D=null,x={domMode:"off",compression:"auto"},A=!1,E=null,S=!1;function O(t){E=t}var $=new Set;function U(t){S=t}var N=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),R=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),C=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),L=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,j=e(()=>{"hidden"===document.visibilityState&&P()}),I=t(()=>P());function B(t){S||b.length>=100||((t=>{if("sig"!==t.t||!$.size)return;const e="string"==typeof t.d?.s?t.d.s:"";if(e)for(const n of $)try{n(e,t.ts)}catch{}})(t),b.push(t),b.length>=T?P():y||(y=setTimeout(P,k)))}function P(){(async()=>{if(A)return;if(!b.length||!D)return;A=!0,y&&(clearTimeout(y),y=null);const t=b;b=[];const e={v:1,sid:D.sid,key:D.key,url:D.url,page:D.page,ts:Date.now(),ua:D.ua,vw:D.vw,vh:D.vh,environment:D.environment,...D.segment?{segment:D.segment}:{},dom_mode:x.domMode},n=t.map(t=>((t,e,n)=>{const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":R.has(t)?t:"custom_signal")(t.t),i={type:r,ts:t.ts,page:"string"==typeof o.page?o.page.slice(0,2048):e},s=J(o.el,o.element,o.target);if("signal"===r){i.signal_type=J(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));const t=s?((t,e)=>{if("off"===e)return null;try{const n=document.querySelector(t);return n?((t,e)=>{if("off"===e)return null;if("metadata"===e)return(t=>({mode:"metadata",selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),attributes:{disabled:!0===t.disabled,required:!0===t.required,ariaDisabled:"true"===t.getAttribute("aria-disabled"),ariaExpanded:h(t.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:h(t.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:w(t)}}))(t);const n=(t=>{try{const e=t.getBoundingClientRect(),n=getComputedStyle(t),o=t.parentElement,r=[];if(o)for(let e=0;e<o.children.length&&r.length<6;e++){const n=o.children[e];if(!n||n===t)continue;const i=n.getBoundingClientRect();r.push({selector:a(n),tag:n.tagName.toLowerCase(),box:{x:Math.round(i.x),y:Math.round(i.y),w:Math.round(i.width),h:Math.round(i.height)},interactive:_(n)})}const i=[];try{const e=t.getAnimations();for(const t of e)"animationName"in t&&i.push(t.animationName)}catch{}return{selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),parent:o?a(o):"",box:{x:Math.round(e.x),y:Math.round(e.y),w:Math.round(e.width),h:Math.round(e.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:!0===t.disabled},inView:m(e),animations:i,siblings:r}}catch{return null}})(t);return n?{mode:"snapshot",...n}:null})(n,e):null}catch{return null}})(s,n):null;t&&(i.dom=t),i.signal_type&&E&&E(i.signal_type)}const c=(t=>{const e=Object.create(null);for(const n of Object.keys(t)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;const o=F(t[n],n);void 0!==o&&(e[n.slice(0,64)]=o)}if(t.meta&&"object"==typeof t.meta&&!Array.isArray(t.meta)){const n=F(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(c).length&&(i.metadata=c),i})(t,D.page,x.domMode));let o=[];try{for(const t of n){const n=[...o,t];if(JSON.stringify({...e,events:n}).length>v)if(o.length>0)await q({...e,events:o}),o=[t];else{const n={...e,events:[t]};JSON.stringify(n).length<=v&&await q(n),o=[]}else o=n}o.length>0&&await q({...e,events:o})}catch{}finally{A=!1}})()}function z(t){if(D)for(const e of Object.keys(t))N.has(e)&&(D[e]=t[e])}async function q(t){const e=JSON.stringify(t),n=await(async(t,e)=>{const n=(new TextEncoder).encode(t);if(n.byteLength>v)return null;if("off"!==e){const e=await(async t=>{const e=globalThis.CompressionStream;if("function"!=typeof e)return null;try{const n=(t=>{const e=(new TextEncoder).encode(t),n=new Blob([e],{type:g});if("function"==typeof n.stream)return n.stream();const o=globalThis.ReadableStream;return"function"!=typeof o?null:new o({start(t){t.enqueue(e),t.close()}})})(t);if(!n)return null;const o=new e("gzip"),r=n.pipeThrough(o).getReader(),i=[];let s=0;for(;;){const t=await r.read();if(t.done)break;if(s+=t.value.byteLength,s>v)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const c=new Uint8Array(s);let a=0;for(const t of i)c.set(t,a),a+=t.byteLength;return c.buffer}catch{return null}})(t);if(e&&e.byteLength<=v)return{beaconBody:new Blob([e],{type:"application/json; encoding=gzip"}),fetchBody:new Uint8Array(e),headers:{"Content-Type":g,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:g}),fetchBody:t,headers:{"Content-Type":g}}})(e,x.compression);n&&X(n,0)}function X(t,e,n=M){if(n){if(navigator.sendBeacon&&navigator.sendBeacon(n,t.beaconBody))return;try{fetch(n,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}).catch(()=>{e<3&&setTimeout(()=>X(t,e+1,n),1e3*(e+1))})}catch{}}}function F(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>C.has(t)))(e))){if(null===t||"boolean"==typeof t)return t;if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t){if(L.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>F(t,e,n+1)).filter(t=>void 0!==t);if("object"==typeof t){const e=Object.create(null);for(const o of Object.keys(t).slice(0,40)){if("__proto__"===o||"constructor"===o||"prototype"===o)continue;const r=F(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function J(...t){for(const e of t)if("string"==typeof e&&e)return e}function Z(t){return"off"===t?"off":"auto"}function H(t,e){for(const n of e){const e=W(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id"))(t)}var V=/^[a-zA-Z0-9/:._*\-]+$/;function W(t){if(t.length>200)return null;if(!V.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var Y=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],G=[],K=3,Q=2e3,tt=24,et=[],nt=[],ot=0,rt=new Map,it=new Map,st=!1,ct=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,et))return;if((t=>{const e=t.tagName;return"VIDEO"===e||"AUDIO"===e||(!!t.hasAttribute("ondblclick")||(!!t.hasAttribute("data-dbl")||"spinbutton"===t.getAttribute("role")))})(e))return;const n=Date.now(),o=t.clientX,r=t.clientY;for(;G.length&&n-G[0].t>Q;)G.shift();G.push({t:n,x:o,y:r});const i=nt.length>=3?2:K;if(G.length<i)return;const s=G.slice(-i);for(let t=0;t<s.length-1;t++)for(let e=t+1;e<s.length;e++){const n=s[t],o=s[e],r=o.x-n.x,i=o.y-n.y;if(r*r+i*i>tt*tt)return}const c=(s[s.length-1].t-s[0].t)/1e3,u=c>0?s.length/c:s.length,l=Math.round(100*Math.min(1,(s.length-i)/i+u/10))/100,f=((t,e,n)=>{const o=Math.min(4,(t.length-e)/5*4),r=Math.min(4,n/10*4);let i=2;if(t.length>=2){let e=0,n=0;for(let o=0;o<t.length-1;o++)for(let r=o+1;r<t.length;r++){const i=t[o],s=t[r],c=s.x-i.x,a=s.y-i.y;e+=Math.sqrt(c*c+a*a),n++}i=Math.max(0,2-e/n/tt*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(s,i,u),h=a(e),w=d(e);nt.push({selector:h,ts:n});const m=nt.length,_=(t=>{const e=(t-ot)/6e4;return e<=0?0:Math.round(nt.length/e*10)/10})(n),v=rt.get(h)??0,g=v+1,b=it.get(h)??0,y=b>0&&n-b<1e4;rt.set(h,g),it.set(h,n);const M=v>=1,k=(()=>{try{const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return null;const n=s.reduce((t,e)=>t+e.x,0)/s.length,o=s.reduce((t,e)=>t+e.y,0)/s.length,r=t.top+t.height/2;return{click_dx:Math.round(n-(t.left+t.width/2)),click_dy:Math.round(o-r),el_w:Math.round(t.width),el_h:Math.round(t.height)}}catch{return null}})();B({t:"sig",ts:n,d:{s:"rage_click",el:h,...w?{el_label:w}:{},cnt:s.length,vel:Math.round(10*u)/10,intensity:l,quality:f,burst_seq:m,burst_rate_per_min:_,repeated_target:M,hot_repeat:y,...k??{}}}),M&&B({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:h,...w?{el_label:w}:{},total_hits:g,burst_count:g,burst_seq:m}}),G=G.slice(-(i-1))});function at(){st&&(st=!1,document.removeEventListener("click",ct,{capture:!0,passive:!0}),G=[],nt=[],rt.clear(),it.clear())}var ut=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,lt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,ft=/^(A|BUTTON|LABEL)$/,dt=[],pt=null,ht=new Map,wt=e(t=>{pt={x:t.clientX,y:t.clientY}}),mt=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,dt))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!pt)return!1;const e=t.clientX-pt.x,n=t.clientY-pt.y;return Math.sqrt(e*e+n*n)>5})(t);if(pt=null,n)return;if((t=>{if(ut.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&<.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!ft.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const o=((t,e,n)=>{let o=t;for(let r=0;r<5&&o;r++){const r=o.parentElement;if(!r)break;const i=r.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]');let s=null,c=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const a=bt(e,n,r);a<c&&(c=a,s=r)}if(s&&c<100)return s;o=r}return null})(e,t.clientX,t.clientY),r=o?gt(t.clientX,t.clientY,o):null,i=a(e),s=(ht.get(i)??0)+1;ht.set(i,s);const c=s>=2,u=(t=>{try{return window.getComputedStyle(t).cursor.slice(0,20)}catch{return""}})(e),l=(t=>{try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e),f=d(e),h=o?d(o):"";B({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...f?{el_label:f}:{},near:o?a(o):"",...h?{near_label:h}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:u,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:s}:{}}})});function _t(){document.removeEventListener("mousedown",wt,{capture:!0}),document.removeEventListener("click",mt,{capture:!0}),pt=null,ht.clear()}function vt(){ht.clear()}function gt(t,e,n){const o=n.getBoundingClientRect(),r=t-Math.max(o.left,Math.min(t,o.right)),i=e-Math.max(o.top,Math.min(e,o.bottom));return{dist:Math.sqrt(r*r+i*i),dx:r,dy:i}}function bt(t,e,n){return gt(t,e,n).dist}var yt=null,Mt=3e3,kt=[],Tt="click",Dt=0,xt=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,At=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Et=e(t=>{const e=t.target;if(!e)return;if(p(e,kt))return;const n=e.getAttribute("role");if(!(xt.test(e.tagName)||n&&At.test(n)))return;const o=Date.now();if(o-Dt>50&&(Tt="click",Dt=o),yt){if(yt.el===e||yt.el.contains(e)){const t=o-yt.ts;return t>=Mt&&B({t:"sig",ts:o,d:{s:"speed_frustration",el:yt.selector,delay:t,interaction_type:Tt,observed_delay_ms:t}}),void Nt()}Nt()}const r=a(e);let i=!1;const s=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return i=!0,void Nt();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void Nt()}}),c=e.parentElement||document.body;s.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const u=setTimeout(()=>{!i&&yt&&(yt.observer.disconnect(),yt={...yt,timeout:null})},Mt+500);yt={el:e,selector:r,ts:o,observer:s,timeout:u}}),St=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(Tt="keydown",Dt=Date.now()))}),Ot=e(()=>{Tt="touch",Dt=Date.now()});function $t(){document.removeEventListener("click",Et,{capture:!0}),document.removeEventListener("keydown",St,{capture:!0}),document.removeEventListener("touchstart",Ot,{capture:!0}),Nt()}function Ut(){Nt()}function Nt(){yt&&(yt.observer.disconnect(),yt.timeout&&clearTimeout(yt.timeout),yt=null)}var Rt=800,Ct=2e3,Lt=0,jt=0,It=0,Bt=0,Pt=0,zt=0,qt=0,Xt=0,Ft=[],Jt=0,Zt=null,Ht=e(t=>{const e=Date.now();e-Lt<16||(Lt=e,Zt&&clearTimeout(Zt),Zt=setTimeout(()=>Wt(),150),((t,e,n)=>{if(0===Bt)return jt=t,It=e,Bt=n,void(Xt=n);const o=(n-Bt)/1e3;if(0===o)return;const r=t-jt,i=e-It;if(Math.abs(r)<2&&Math.abs(i)<2)return;const s=Math.sqrt(r*r+i*i),c=s/o;Ft.length>=100&&(Ft=Ft.slice(-50)),Ft.push(c),Jt+=s;const a=Math.sign(r),u=Math.sign(i);if(s>=5&&(0!==Pt&&0!==a&&a!==Pt||0!==zt&&0!==u&&u!==zt)&&qt++,Pt=a||Pt,zt=u||zt,jt=t,It=e,Bt=n,n-Xt>Ct){if(qt>=3){const t=Ft.reduce((t,e)=>t+e,0)/Ft.length;t>=Rt&&B({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:qt,distance_px:Math.round(Jt)}})}Wt(),Xt=n}})(t.clientX,t.clientY,e))});function Vt(){document.removeEventListener("mousemove",Ht),Zt&&clearTimeout(Zt),Wt()}function Wt(){qt=0,Ft=[],Jt=0,Pt=0,zt=0,Bt=0,jt=0,It=0,Lt=0,Zt=null}var Yt=[],Gt=[],Kt=3e4;function Qt(){Yt=[],Gt=[]}var te=1e4,ee=.5,ne=[],oe=0,re=0,ie=!1,se=0,ce=e(()=>{ie||(ie=!0,requestAnimationFrame(()=>{ie=!1,(()=>{const t=Date.now(),e=window.scrollY;if((se=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/se,o=e>oe?"down":"up";if(t-re<100)return void(oe=e);for(;ne.length&&t-ne[0].ts>te;)ne.shift();ne.length>=100&&(ne=ne.slice(-50)),ne.push({depth:n,ts:t,direction:o}),oe=e,re=t;let r=0,i=1,s=0,c=!1,a=0,u=0,l=0,f=1,d=0;for(let t=1;t<ne.length;t++)ne[t].direction!==ne[t-1].direction&&d++;for(let t=0;t<ne.length;t++){const e=ne[t],n=e.depth;if(n>r&&(r=n),n>=ee&&(c||(a=e.ts,l=n),c=!0),c&&n<i&&(i=n,u=e.ts,f=n),c&&i<.25&&n>=ee){if(u-a<200){c=!1,i=1,a=e.ts,l=n;continue}s++,c=!1,i=1}}if(s>=1){const e=Math.max(u-a,1),n=100*Math.abs(l-f),o=Math.round(n/e*1e3);B({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:s+1,vel:o,dir_changes:d}}),ne=[]}})()}))});function ae(t){te=t?.windowMs??1e4,ee=t?.depthThreshold??.5,window.addEventListener("scroll",ce,{passive:!0})}function ue(){window.removeEventListener("scroll",ce),ne=[],ie=!1}function le(){ne=[],oe=0,re=0,ie=!1}var fe=["textarea",'[role="textbox"]',"[contenteditable]"],de=new Map,pe=new Map,he=new Set,we=null,me=0,_e=5e3,ve=[],ge=e(t=>{const e=t.target;if(!e||!Ae(e))return;if(p(e,ve))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of fe)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();de.set(e,n),pe.set(e,n);const o=e.closest("form");o&&o!==we&&(we=o,me=o.querySelectorAll("input, select, textarea").length)}),be=e(t=>{const e=t.target;if(!e||!Ae(e))return;const n=de.get(e),o=pe.get(e);de.delete(e),pe.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=_e){const n=d(e);B({t:"sig",ts:r,d:{s:"form_hesitation",el:a(e),...n?{el_label:n}:{},pause:t}})}}const i=e.getAttribute("name")||e.getAttribute("id")||a(e);(t=>"value"in t&&t.value.length>0)(e)&&he.add(i)}),ye=e(()=>{he.clear(),we=null}),Me=t(xe),ke=null;function Te(){document.removeEventListener("focusin",ge,{capture:!0}),document.removeEventListener("focusout",be,{capture:!0}),document.removeEventListener("submit",ye,{capture:!0}),window.removeEventListener("pagehide",Me),ke&&(document.removeEventListener("visibilitychange",ke),ke=null),de.clear(),pe.clear(),he.clear(),we=null}function De(){de.clear(),pe.clear(),he.clear(),we=null,me=0}function xe(){if(he.size>0&&we){const t=me||he.size,e=Math.round(he.size/t*100)/100;B({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:he.size,total:t,field_count:t,completion_rate:e}}),he.clear(),we=null}}function Ae(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var Ee=null,Se=null,Oe=/flusterduck\.com|\/v1\/ingest/,$e=e(t=>{const e=t.message||"Unknown error";var n;B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Ie(e,200),ep:"",status:0,error_category:(n=e,Ce.test(n)?"network":"script"),url:location.pathname}})}),Ue=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Ie(e,200),ep:"",status:0,error_category:Le(t.reason),url:location.pathname}})});function Ne(){window.addEventListener("error",$e),window.addEventListener("unhandledrejection",Ue),Ee||(Ee=window.fetch,Se=function(t,e){let n;try{n=Ee.call(this,t,e)}catch(t){throw t}return n.then(e=>{try{if(e.status>=400){const n="string"==typeof t?t:t instanceof URL?t.pathname:t.url;Oe.test(n)||B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:je(n),status:e.status,error_category:"network",url:location.pathname}})}}catch{}return e},e=>{try{const n="string"==typeof t?t:t instanceof URL?t.href:t.url;Oe.test(n)||B({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Ie(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?je(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=Se)}function Re(){window.removeEventListener("error",$e),window.removeEventListener("unhandledrejection",Ue),Ee&&Se&&window.fetch===Se&&(window.fetch=Ee),Ee=null,Se=null}var Ce=/fetch|network|cors|timeout/i;function Le(t){if(t instanceof TypeError&&Ce.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return Ce.test(e)?"network":"unhandled_promise"}function je(t){try{return new URL(t,location.origin).pathname}catch{const e=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(e>=0?e:t.length,n>=0?n:t.length);return t.slice(0,o)||"/"}}function Ie(t,e){let n=t.length>e?t.slice(0,e):t;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,t=>{try{return new URL(t).origin+new URL(t).pathname}catch{return"[URL]"}}),n}var Be=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Pe=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ze=null,qe=0,Xe=1,Fe=0,Je=0,Ze=0,He=0,Ve=0,We=null,Ye=[],Ge=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(ze={x:e.clientX,y:e.clientY,ts:Date.now()},qe=0):2===t.touches.length&&(qe=on(t.touches),ze=null)}),Ke=e(t=>{if(qe>0){const e=t.touches.length>=2?on(t.touches):(()=>{const e=t.changedTouches[0],n=t.changedTouches[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)})();e>0&&(Xe=Math.round(e/qe*100)/100),qe=0}if(!ze)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-ze.x,o=e.clientY-ze.y,r=Date.now()-ze.ts,i=document.elementFromPoint(e.clientX,e.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&((t,e,n)=>{if(p(t,Ye))return;const o=((t,e,n)=>{const o=(t.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])');let r=null,i=21;for(let t=0;t<o.length;t++){const s=o[t];if(!s)continue;const c=s.getBoundingClientRect(),a=Math.max(c.left,Math.min(e,c.right)),u=Math.max(c.top,Math.min(n,c.bottom)),l=Math.sqrt((e-a)**2+(n-u)**2);l<i&&l>0&&(i=l,r=s)}return r})(t,e,n);if(!o)return;const r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(e,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),c=Math.sqrt((e-i)**2+(n-s)**2);if(c>0&&c<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;B({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:a(o),dist:Math.round(c),size:t}})}})(i,e.clientX,e.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&((t,e,n)=>{if(Math.abs(n)>Math.abs(e))return;if(!t)return;if(Be.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!Be.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";B({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),ze=null}),Qe=e(()=>{const t=Date.now();if(t-Je>3e4&&(Fe=0,Je=t),++Fe>=2){const e=document.activeElement||document.body;!Pe.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-Ze>200&&(Ze=t,B({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:Fe,pinch_scale:Xe}})),Fe=0,Xe=1}}),tn=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Ve>3e4&&(He=0,Ve=t),e!==We&&(He++,We=e),He>=3&&(B({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:He,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),He=0)}),en=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Je>3e4&&(Fe=0,Je=e),++Fe>=2&&e-Ze>200){const n=Math.round(100*t.scale)/100;Ze=e,B({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:Fe,pinch_scale:n}}),Fe=0,Xe=1}}});function nn(){document.removeEventListener("touchstart",Ge),document.removeEventListener("touchend",Ke),document.removeEventListener("gesturechange",Qe),window.removeEventListener("orientationchange",tn),window.visualViewport?.removeEventListener("resize",en),ze=null,qe=0,Xe=1,Fe=0,Je=0,Ze=0,He=0,Ve=0,We=null}function on(t){const e=t[0],n=t[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)}var rn=[],sn=null,cn=0,an=0,un="",ln=[],fn=[],dn=e(t=>{const e=Date.now(),n=t.target;n&&p(n,fn)||("Tab"===t.key?((t,e,n)=>{for(;rn.length&&t-rn[0].ts>5e3;)rn.shift();rn.length>=50&&(rn=rn.slice(-25));const o=e?a(e):"";if(rn.push({ts:t,el:o,shift:n}),rn.length>=10){const e=rn.map(t=>t.el).filter(Boolean),n=(t=>{let e=0;for(let n=1;n<t.length;n++)t[n].shift!==t[n-1].shift&&e++;return e})(rn);B({t:"sig",ts:t,d:{s:"tab_thrash",cnt:rn.length,els:e,direction_changes:n}}),rn=[]}if(!e)return;const r=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(r){const n=a(e);r===sn?t-an<=3e3?(cn++,un=n,cn>=5&&(B({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:cn,trapped_element:un}}),cn=0,un="",sn=null)):(an=t,cn=1,un=n):(sn=r,an=t,cn=1,un=n)}})(e,n,t.shiftKey):"Escape"===t.key?((t,e)=>{if(!e)return;const n=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(n&&n===sn){if(t-an>3e3)return an=t,cn=1,void(un=a(e));cn++,un=a(e),cn>=5&&(B({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:cn,trapped_element:un}}),cn=0,un="",sn=null)}})(e,t.target):"ArrowDown"!==t.key&&"ArrowUp"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||((t,e)=>{if(!e)return;const n=e.closest('[role="listbox"]')||e.closest('[role="menu"]')||e.closest('[role="tree"]')||e.closest("select");if(!n)return;for(;ln.length&&t-ln[0].ts>5e3;)ln.shift();ln.length>=50&&(ln=ln.slice(-25)),ln.push({ts:t,container:n});const o=ln.filter(t=>t.container===n);o.length>=15&&(B({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),ln=[])})(e,t.target))});function pn(){document.removeEventListener("keydown",dn,{capture:!0}),rn=[],ln=[],sn=null,cn=0,an=0,un="",fn=[]}var hn=0,wn=0,mn=null,_n=0,vn=!1,gn=0,bn=0,yn=null,Mn=0,kn=e(()=>{vn||(vn=!0,requestAnimationFrame(()=>{vn=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-wn;if(Math.abs(n)<2)return void(wn=e);const o=n>0?"down":"up";mn&&o!==mn&&(t-_n>3e3&&(hn=0,_n=t),++hn>=4)&&Math.abs(n)>100&&(t-bn>1e4&&(gn=0,bn=t),gn++,B({t:"sig",ts:t,d:{s:"scroll_hijack",rev:hn,source:null!==yn&&t-Mn<=2e3?yn:"wheel",repeated:gn>=2}}),hn=0),mn=o,wn=e})()}))}),Tn=e(()=>{yn="wheel",Mn=Date.now()}),Dn=e(()=>{yn="touch",Mn=Date.now()});function xn(){window.addEventListener("wheel",Tn,{passive:!0}),window.addEventListener("touchmove",Dn,{passive:!0}),window.addEventListener("scroll",kn,{passive:!0})}function An(){window.removeEventListener("wheel",Tn),window.removeEventListener("touchmove",Dn),window.removeEventListener("scroll",kn),En()}function En(){hn=0,wn=0,mn=null,_n=0,vn=!1,gn=0,bn=0,yn=null,Mn=0}var Sn=0,On=0,$n=!1,Un=e(()=>{$n||($n=!0,requestAnimationFrame(()=>{$n=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>Sn&&(Sn=e,0===On&&(On=Date.now()))}}))}),Nn=null,Rn=null;function Cn(){window.addEventListener("scroll",Un,{passive:!0}),Rn=t(In),window.addEventListener("pagehide",Rn),Nn=t(()=>{"hidden"===document.visibilityState&&In()}),document.addEventListener("visibilitychange",Nn)}function Ln(){window.removeEventListener("scroll",Un),Rn&&(window.removeEventListener("pagehide",Rn),Rn=null),Nn&&(document.removeEventListener("visibilitychange",Nn),Nn=null),Sn=0,On=0,$n=!1}function jn(){Sn=0,On=0,$n=!1}function In(){if(Sn>.05){const t=Date.now(),e=On>0?Math.max(0,t-On):0;B({t:"sig",ts:t,d:{s:"scroll_depth_abandon",depth:Math.round(100*Sn)/100,max_depth:Math.round(100*Sn),dwell_ms:e}})}}var Bn="",Pn=0,zn=0,qn=0,Xn=0,Fn=0,Jn=null,Zn=0,Hn=!1,Vn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==Bn||o-zn>1500)&&(Bn=n,zn=o,Pn=0),(Pn+=1)<4||(B({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:Pn,window_ms:1500}}),Pn=0,zn=o)}),Wn=e(()=>{const t=Date.now(),e=to(),n=Fn||e,o=Math.abs(e-n)/Math.max(n,1);Fn=e,o<.15||((!qn||t-qn>5e3)&&(qn=t,Xn=0),(Xn+=1)<3||(B({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:Xn,area_delta:Math.round(1e3*o)/1e3}}),Xn=0,qn=t))}),Yn=e(()=>{Qn()});function Gn(){Hn||(Hn=!0,Fn=to(),Qn(),document.addEventListener("mouseenter",Vn,!0),document.addEventListener("mouseleave",Vn,!0),document.addEventListener("click",Yn,{capture:!0,passive:!0}),document.addEventListener("keydown",Yn,{capture:!0,passive:!0}),document.addEventListener("scroll",Yn,{passive:!0}),window.addEventListener("resize",Wn,{passive:!0}))}function Kn(){Hn&&(Hn=!1,document.removeEventListener("mouseenter",Vn,!0),document.removeEventListener("mouseleave",Vn,!0),document.removeEventListener("click",Yn,{capture:!0}),document.removeEventListener("keydown",Yn,{capture:!0}),document.removeEventListener("scroll",Yn),window.removeEventListener("resize",Wn),eo(),Bn="",Pn=0,zn=0,Xn=0,qn=0,Zn=0)}function Qn(){eo();const t=Zn+=1;Jn=setTimeout(()=>{B({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function to(){return Math.max(1,window.innerWidth*window.innerHeight)}function eo(){Jn&&(clearTimeout(Jn),Jn=null)}var no=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],oo=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,ro=[],io=[],so=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,io))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(uo(e))return!0;if(lo(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;ro.length&&n-ro[0].t>6e4;)ro.shift();const o=a(e);if(ro.push({t:n,el:o}),ro.length<3)return;const r=new Set(ro.map(t=>t.el)).size,i=d(e);B({t:"sig",ts:n,d:{s:"help_hunt",cnt:ro.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),ro=[]});function co(){document.removeEventListener("click",so,{capture:!0}),ro=[]}function ao(){ro=[]}function uo(t){for(const e of no)try{if(t.matches(e))return!0}catch{}return!1}function lo(t){const e=t.id??"",n=t.className??"";return oo.test("string"==typeof n?`${e} ${n}`:e)}var fo=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,po=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,ho=[],wo=new Map,mo=[],_o=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,mo))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(bo(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=d(e);ho.push({t:n,el:o});const i=(wo.get(o)??0)+1;wo.set(o,i);const s=ho.length,c=(()=>{try{const n=e.getBoundingClientRect();return 0===n.width&&0===n.height?null:{click_dx:Math.round(t.clientX-(n.left+n.width/2)),click_dy:Math.round(t.clientY-(n.top+n.height/2)),el_w:Math.round(n.width),el_h:Math.round(n.height)}}catch{return null}})();B({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:s,element_cnt:i,repeated:i>1,container:yo(e),...c??{}}})});function vo(){document.removeEventListener("click",_o,{capture:!0}),ho=[],wo.clear()}function go(){ho=[],wo.clear()}function bo(t){const e=t.getAttribute("data-dismiss")??"",n=t.getAttribute("data-close")??"";if(e||n)return!0;const o=t.getAttribute("aria-label")??t.getAttribute("title")??"";if(o&&po.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(fo.test(t.id??"")||fo.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&po.test(i))return!0;if("BUTTON"===t.tagName&&t.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){const e=(t.textContent??"").trim();if("×"===e||"✕"===e||"✗"===e||"X"===e||"x"===e)return!0}return!1}function yo(t){const e=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(const[n,o]of e)try{if(t.closest(n))return o}catch{}return"unknown"}var Mo=null,ko=[],To=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,ko)||(Mo=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:d(e),t:Date.now()}))}),Do=e(t=>{"Escape"===t.key&&So("escape")}),xo=e(()=>{So("back_nav")});function Ao(){document.removeEventListener("click",To,{capture:!0}),document.removeEventListener("keydown",Do,{capture:!0}),window.removeEventListener("popstate",xo),Mo=null}function Eo(){Mo=null}function So(t){if(!Mo)return;const e=Date.now()-Mo.t;e>1500||B({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Mo.el,...Mo.label?{el_label:Mo.label}:{},elapsed_ms:e}}),Mo=null}var Oo=/^(checkbox|radio)$/,$o=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Uo=new Map,No=[],Ro=e(t=>{const e=t.target;e&&(p(e,No)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?Oo.test(t.type??""):$o.test(t.getAttribute("role")??"")))(e)&&Io(e))}),Co=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,No))return;const n=e.getAttribute("role")??"";$o.test(n)&&"INPUT"!==e.tagName&&Io(e)});function Lo(){document.removeEventListener("change",Ro,{capture:!0}),document.removeEventListener("click",Co,{capture:!0}),Uo.clear()}function jo(){Uo.clear()}function Io(t){const e=a(t),n=Date.now();let o=Uo.get(e);for(o||(o=[],Uo.set(e,o));o.length&&n-o[0].t>1e4;)o.shift();if(o.push({t:n}),o.length<3)return;const r=d(t);B({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),Uo.delete(e)}var Bo=[],Po=e(t=>{const e=t.target;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t)return;if(e.isContentEditable)return}const n=window.getSelection();if(!n||n.toString().length<2)return;const o=Date.now();for(;Bo.length&&o-Bo[0].t>15e3;)Bo.shift();Bo.push({t:o}),Bo.length<3||(B({t:"sig",ts:o,d:{s:"copy_frustration",cnt:Bo.length,window_ms:15e3}}),Bo=[])});function zo(){document.addEventListener("copy",Po,{capture:!0,passive:!0})}function qo(){document.removeEventListener("copy",Po,{capture:!0}),Bo=[]}function Xo(){Bo=[]}var Fo=[],Jo=0,Zo=null,Ho=null;function Vo(){Zo=t(Ko),Ho=t(Go),document.addEventListener("selectionchange",Zo),document.addEventListener("copy",Ho,{capture:!0,passive:!0}),document.addEventListener("cut",Ho,{capture:!0,passive:!0})}function Wo(){Zo&&(document.removeEventListener("selectionchange",Zo),Zo=null),Ho&&(document.removeEventListener("copy",Ho,{capture:!0}),document.removeEventListener("cut",Ho,{capture:!0}),Ho=null),Fo=[],Jo=0}function Yo(){Fo=[],Jo=0}function Go(){Jo=Date.now(),Fo=[]}function Ko(){const t=window.getSelection();if(!t||t.isCollapsed)return;if(t.toString().length<5)return;const e=t.anchorNode?.parentElement;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t||e.isContentEditable)return}const n=Date.now();if(n-Jo<2e3)return;for(;Fo.length&&n-Fo[0].t>15e3;)Fo.shift();const o=Fo[Fo.length-1];o&&n-o.t<500||(Fo.push({t:n}),Fo.length<4||(B({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:Fo.length,window_ms:15e3}}),Fo=[]))}var Qo=6e4,tr="_fd_sess",er={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},nr={low:1,medium:2,high:3,critical:4},or=[],rr=null,ir=!1,sr=new Map,cr={totalSignals:0,pagesWithFrustration:0},ar="",ur=null,lr=null,fr=null,dr=null;function pr(t){ir&&hr(t,Date.now())}function hr(t,e){sr.has(t)||sr.set(t,[]);const n=sr.get(t);n.push(e),n.length>20&&n.shift()}function wr(t){let e="",n=0;for(const[o,r]of t)(r>n||r===n&&o<e)&&(e=o,n=r);return{type:e,count:n}}function mr(t){if(!ir)return;if("frustration_burst"===t)return;const e=Date.now();(t=>{const e=t-Qo;let n=0;for(;n<or.length&&or[n].ts<e;)n++;n>0&&(or=or.slice(n))})(e),0===or.length&&(rr=null),or.push({type:t,ts:e}),hr(t,e);const{distinctTypes:n,totalWeight:o,typeCounts:r}=(()=>{const t=new Map;let e=0;for(const n of or)t.set(n.type,(t.get(n.type)??0)+1),e+=er[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),i=((t,e,n)=>wr(n).count>=3&&t>=3?"critical":t>=4&&e>=70?"high":t>=3&&e>=40?"medium":t>=2&&e>=20?"low":null)(n.size,o,r);i&&(null!==rr&&nr[i]<=nr[rr]||(rr=i,((t,e,n,o)=>{const r=wr(o),i=(()=>{const t=[],e=Date.now()-Qo,n=[];for(const[t,o]of sr.entries())for(const r of o)r>=e&&n.push({type:t,ts:r});n.sort((t,e)=>t.ts-e.ts);for(let e=0;e<n.length;e++)if("rage_click"===n[e].type)for(let o=e+1;o<n.length;o++)if("form_validation_loop"===n[o].type&&n[o].ts-n[e].ts<=3e4){t.push("rage_then_form_loop");break}for(let e=0;e<n.length;e++)if("dead_click"===n[e].type)for(let o=e+1;o<n.length;o++){const r=n[o].type;if(("popstate"===r||"hashchange"===r)&&n[o].ts-n[e].ts<=1e4){t.push("dead_then_bail");break}}for(let e=0;e<n.length;e++)if("form_validation_loop"===n[e].type)for(let o=e+1;o<n.length;o++)if(("visibilitychange"===n[o].type||"pagehide"===n[o].type)&&n[o].ts-n[e].ts<=2e4){t.push("form_loop_then_abandon");break}return t})();B({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:ar||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:Qo,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:cr.totalSignals,session_pages_with_frustration:cr.pagesWithFrustration}}),cr.totalSignals+=or.length,cr.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(tr,JSON.stringify(cr))}catch{}})()})(i,n,o,r)))}function _r(){ir=!1,or=[],rr=null,sr=new Map,O(null),ur&&(window.removeEventListener("popstate",ur),ur=null),lr&&(window.removeEventListener("hashchange",lr),lr=null),fr&&(document.removeEventListener("visibilitychange",fr),fr=null),dr&&(window.removeEventListener("pagehide",dr),dr=null)}var vr=3e4,gr=[],br="",yr=!1,Mr=e(()=>{Ar(location.pathname+location.search+location.hash)}),kr=e(()=>{Ar(location.pathname+location.search+location.hash)});function Tr(){gr=[],yr=!1,br=location.pathname+location.search+location.hash,window.addEventListener("popstate",Mr),window.addEventListener("hashchange",kr)}function Dr(){window.removeEventListener("popstate",Mr),window.removeEventListener("hashchange",kr),gr=[],yr=!1,br=""}function xr(){gr=[],yr=!1,br=location.pathname+location.search+location.hash}function Ar(t){const e=Date.now();if(br&&br!==t){const t=gr[gr.length-1];t&&t.path===br&&null===t.leftAt&&(t.leftAt=e)}for(;gr.length&&e-gr[0].ts>vr;)gr.shift();t!==br&&(gr.push({path:t,ts:e,leftAt:null}),br=t),gr.length<5||yr||(t=>{const e=gr.filter(e=>t-e.ts<=vr),n=e.filter(t=>null!==t.leftAt),o=new Set(e.map(t=>t.path));if(o.size<5)return;if(0===n.length)return;if(n.some(t=>t.leftAt-t.ts>=5e3))return;if(new Set(n.map(t=>t.path)).size<5)return;const r=n.map(t=>t.leftAt-t.ts),i=Math.round(r.reduce((t,e)=>t+e,0)/r.length),s=Math.max(...r),c=e.map(t=>t.path).slice(-8);yr=!0,B({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:vr,avg_dwell_ms:i,pages:c,max_dwell_ms:s}})})(e)}var Er=[],Sr=!1,Or="none",$r=0,Ur=0,Nr=0,Rr=!1,Cr=e(()=>{Sr||(Sr=!0,requestAnimationFrame(Pr))}),Lr=e(t=>{if(!Rr)return;const e=Date.now();if(e-Nr>3e3)return void(Rr=!1);if(window.scrollY+t.clientY>Ur+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round($r-Ur),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,s=i?a(i):"",c=i?d(i):"";Rr=!1,$r=window.scrollY,Or="none",Er=[],B({t:"sig",ts:e,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:s,...c?{click_el_label:c}:{},scroll_back_pct:r}})});function jr(){Er=[],Or="none",$r=0,Ur=0,Nr=0,Rr=!1,Sr=!1,window.addEventListener("scroll",Cr,{passive:!0}),window.addEventListener("click",Lr,{capture:!0})}function Ir(){window.removeEventListener("scroll",Cr),window.removeEventListener("click",Lr,{capture:!0}),Br()}function Br(){Er=[],Or="none",$r=0,Ur=0,Nr=0,Rr=!1,Sr=!1}function Pr(){Sr=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=Er[Er.length-1];if(o&&t-o.ts<50)return;if(Er.push({y:e,ts:t}),Er.length>60&&(Er=Er.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==Or&&Rr&&(Rr=!1),e>$r&&($r=e),void(Or="down");Rr&&t-Nr>3e3&&(Rr=!1),"down"===Or&&$r-e>=.3*n&&!Rr&&(Ur=e,Nr=t,Rr=!0),Or="up"}}var zr=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,qr=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Xr=/^(A|BUTTON|LABEL)$/,Fr=new Map,Jr=[],Zr=null,Hr=e(t=>{Zr={x:t.clientX,y:t.clientY}}),Vr=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Jr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!Zr)return!1;const e=t.clientX-Zr.x,n=t.clientY-Zr.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(zr.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&qr.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!Xr.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const{row:n,col:o}=((t,e)=>{const n=Math.min(3,Math.floor(t/window.innerWidth*4));return{row:Math.min(3,Math.floor(e/window.innerHeight*4)),col:n}})(t.clientX,t.clientY),r=((t,e)=>4*t+e)(n,o),i=Date.now(),s=a(e),c=(Fr.get(r)??[]).filter(t=>i-t.ts<9e4);if(c.push({ts:i,selector:s}),Fr.set(r,c),c.length>=3){const t=new Map;for(const e of c)t.set(e.selector,(t.get(e.selector)??0)+1);let e="",s=0;for(const[n,o]of t)o>s&&(s=o,e=n);const a=new Set,u=[];for(const t of c)if(!a.has(t.selector)&&(a.add(t.selector),u.push(t.selector),u.length>=5))break;const l=(()=>{try{const t=e?document.querySelector(e):null;return t?d(t):""}catch{return""}})();B({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:c.length,dominant_el:e,...l?{dominant_el_label:l}:{},elements:u,window_ms:9e4}}),Fr.set(r,[])}});function Wr(){document.removeEventListener("mousedown",Hr,{capture:!0}),document.removeEventListener("click",Vr,{capture:!0}),Zr=null,Fr.clear()}function Yr(){Fr.clear()}var Gr=12e4,Kr=new Map,Qr=[],ti=null,ei=e(t=>{const e=t.target;e&&li(e)}),ni=e(t=>{const e=t.target;if(!e||!ci(e))return;if(p(e,Qr))return;const n=a(e);Kr.has(n)||si(e)&&ui(e,n)});function oi(){document.removeEventListener("invalid",ei,{capture:!0}),document.removeEventListener("input",ni,{capture:!0}),document.removeEventListener("change",ni,{capture:!0}),ti&&(ti.disconnect(),ti=null);for(const t of Kr.values())ai(t);Kr.clear()}function ri(){for(const t of Kr.values())ai(t);Kr.clear()}function ii(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function si(t){const e=t.getAttribute("aria-invalid");if("true"===e||""===e)return!0;if("validity"in t&&t.validity&&!t.validity.valid)return!0;try{return t.matches(":invalid")}catch{return!1}}function ci(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function ai(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function ui(t,n){const o=(t=>e(e=>{di(t)}))(n),r=(t=>e(e=>{di(t)}))(n);t.addEventListener("input",o,{passive:!0}),t.addEventListener("change",r,{passive:!0});const i={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:o,changeHandler:r,el:t};return Kr.set(n,i),i}function li(t){if(!ci(t))return;if(p(t,Qr))return;const e=Date.now();(t=>{for(const[e,n]of Kr)t-n.lastTs>Gr&&(ai(n),Kr.delete(e))})(e);const n=a(t),o=Kr.get(n);if(!o)return void ui(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(B({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:Gr,field_type:ii(t)}}),ai(o),Kr.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(B({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:Gr,field_type:ii(t)}}),ai(o),Kr.delete(n)))}function fi(t){if(!ci(t))return;const e=Date.now(),n=a(t),o=Kr.get(n);return o?e-o.lastTs>Gr?(ai(o),void Kr.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function di(t){const e=Date.now(),n=Kr.get(t);if(n){if(e-n.lastTs>Gr)return ai(n),void Kr.delete(t);if(n.lastTs=e,si(n.el))return n.cycles+=1,void(n.cycles>=3&&(B({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...d(n.el)?{el_label:d(n.el)}:{},cycles:n.cycles,window_ms:Gr,field_type:ii(n.el)}}),ai(n),Kr.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function pi(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!ci(t))continue;if(p(t,Qr))continue;const n=e.oldValue,o="true"===n||""===n,r=si(t);r&&!o?li(t):!r&&o&&fi(t)}}var hi=null,wi=null,mi=[],_i=0,vi=new Map;function gi(){hi&&(hi.disconnect(),hi=null),wi&&(wi.disconnect(),wi=null),vi.clear()}function bi(){vi.clear(),hi&&yi()}function yi(){for(const t of mi)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Mi(e[t])}catch{}}function Mi(t){vi.has(t)||(vi.set(t,{firstSeenTs:0,emitted:!1}),hi.observe(t))}function ki(t){for(const e of t)for(let t=0;t<e.addedNodes.length;t++){const n=e.addedNodes[t];if(n instanceof Element)for(const t of mi)try{n.matches(t)&&Mi(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Mi(e[t])}catch{}}}function Ti(t){const e=Date.now();for(const n of t){const t=vi.get(n.target);if(t&&!t.emitted&&n.isIntersecting&&n.intersectionRatio>=.5){t.firstSeenTs||(t.firstSeenTs=e),t.emitted=!0;const o=n.boundingClientRect,r=n.rootBounds?.height??window.innerHeight,i=o.top<.5*r?"above_fold":"below_fold",s=a(n.target),c=d(n.target);B({t:"sig",ts:e,d:{s:"element_impression",el:s,...c?{el_label:c}:{},visible_pct:Math.round(100*n.intersectionRatio),time_to_visible_ms:Math.round(e-_i),viewport_position:i}})}}}var Di=new Map,xi=[],Ai=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,xi))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Di.get(r);if(i){if(n-i.lastTs>6e4)return i.lastValue=o,i.cycles=0,i.phase="typing",void(i.lastTs=n);if(i.lastTs=n,"typing"===i.phase&&i.lastValue.length-o.length>=3)i.phase="deleted";else if("deleted"===i.phase&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=2)){const t=d(e);return B({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:Oi(e)}}),void Di.delete(r)}i.lastValue=o}else Di.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function Ei(){document.removeEventListener("input",Ai,{capture:!0}),Di.clear()}function Si(){Di.clear()}function Oi(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var $i=null,Ui=2e3,Ni=[],Ri=new Map,Ci=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Ni))return;if(!(t=>{if(/^(A|BUTTON|SELECT)$/.test(t.tagName))return!0;const e=t.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(e))return!0;try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e))return;const n=a(e);if($i?.selector===n)return;Pi();const o=Date.now();if(o-(Ri.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=d(e);Ri.set(n,t),$i=null,B({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Ui);$i={el:e,selector:n,startTs:r,timer:i}}),Li=e(t=>{if(!$i)return;const e=t.target;if(e!==$i.el&&!$i.el.contains(e))return;const n=t.relatedTarget;n&&$i.el.contains(n)||Pi()}),ji=e(Pi);function Ii(){document.removeEventListener("mouseover",Ci),document.removeEventListener("mouseout",Li),document.removeEventListener("click",ji,{capture:!0}),Pi(),Ri.clear()}function Bi(){Pi(),Ri.clear()}function Pi(){$i&&(clearTimeout($i.timer),$i=null)}var zi=0,qi=0,Xi=null,Fi=t(e=>{if(e.clientY>20)return;const n=Date.now();n-zi<3e3||n-qi<6e4||(Xi&&clearTimeout(Xi),Xi=setTimeout(t(()=>{const t=Date.now();qi=t,Xi=null,B({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-zi)}})}),500))});function Ji(){zi=Date.now(),qi=0,document.addEventListener("mouseleave",Fi)}function Zi(){document.removeEventListener("mouseleave",Fi),Xi&&(clearTimeout(Xi),Xi=null)}function Hi(){zi=Date.now(),qi=0,Xi&&(clearTimeout(Xi),Xi=null)}var Vi=null,Wi=null,Yi=null,Gi=0;function Ki(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function Qi(){if("undefined"!=typeof PerformanceObserver){try{(Vi=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);B({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Ki(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Vi=null}try{(Wi=new PerformanceObserver(t(t=>{for(const e of t.getEntries()){const t=e;if(!t.interactionId)continue;const n=Math.round(t.duration);n<200||B({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:Ki(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{Wi=null}try{(Yi=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Gi+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{Yi=null}}}function ts(){if(Yi){if(Yi.disconnect(),Yi=null,Gi>0){const t=Math.round(1e3*Gi)/1e3;B({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:Ki(Gi,.1,.25)}})}Gi=0}}function es(){Vi&&(Vi.disconnect(),Vi=null),Wi&&(Wi.disconnect(),Wi=null),ts()}function ns(){if(ts(),"undefined"!=typeof PerformanceObserver)try{(Yi=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Gi+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{Yi=null}}var os=[],rs=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,os))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=d(e);B({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:ss(e)}})},100)});function is(){document.removeEventListener("paste",rs,{capture:!0})}function ss(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var cs=!1,as=null,us=null,ls="__flusterduck_instance__",fs=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,ds=[];function ps(e){if(cs)return;if(!e.key)return;if(e.key.startsWith("fd_sec_"))return;if(!e.key.startsWith("fd_pub_"))return;if(!1!==e.respectDoNotTrack&&("1"===navigator.doNotTrack||navigator.globalPrivacyControl))return void(us=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(us=e);if(!(()=>{const t=window;return!(t[ls]&&t[ls]!==fs||(t[ls]=fs,0))})())return void(us=e);us=e,cs=!0;const r=(t=>{if(t)return i();const e=(()=>{const t=document.cookie.match(new RegExp("(?:^|; )_fd_s=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null})();if(e&&o.test(e))return e;const r=i();return s(n,r,30),r})(e.cookieless??!1),c=(t=>{if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}})(e.endpoint)??"https://api.flusterduck.com/v1/ingest",a=H(location.pathname,e.pageRules??[]),u="metadata"===(l=e.domMode)||"snapshot"===l?l:"off";var l;((t,e,n,o,r)=>{var i;M=t,D=Object.assign(Object.create(null),e),x={domMode:(i=r?.domMode,"metadata"===i||"snapshot"===i?i:"off"),compression:Z(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.addEventListener("visibilitychange",j),window.addEventListener("pagehide",I)})(c,{sid:r,key:e.key,url:location.origin+location.pathname,page:a,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:u,compression:e.compression});const f=bs(location.pathname,e.ignorePages??[]);f&&U(!0);const d=document.referrer;let p="";if(d)try{p=new URL(d).origin+new URL(d).pathname}catch{p=""}f||B({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[];ds=[];for(const n of function(e,n,o){const r=t=>{const n=e.signals?.[t];return!1!==n?.enabled},i=!1!==e.trackForms;return[{when:()=>r("rageClick"),start:()=>((t,e)=>{st||(st=!0,K=t?.threshold??3,Q=t?.windowMs??2e3,tt=t?.radius&&t.radius>0?t.radius:24,et=[...Y,...e??[]],ot=Date.now(),G=[],nt=[],rt.clear(),it.clear(),document.addEventListener("click",ct,{capture:!0,passive:!0}))})(e.signals?.rageClick,n),stop:at},{when:()=>r("deadClick"),start:()=>(t=>{dt=t??[],document.addEventListener("mousedown",wt,{capture:!0,passive:!0}),document.addEventListener("click",mt,{capture:!0,passive:!0})})(n),stop:_t,reset:vt},{when:()=>r("speedFrustration"),start:()=>{const t=e.signals?.speedFrustration;((t,e)=>{Mt=t?.delayMs??3e3,kt=e??[],document.addEventListener("click",Et,{capture:!0,passive:!0}),document.addEventListener("keydown",St,{capture:!0,passive:!0}),document.addEventListener("touchstart",Ot,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,n)},stop:$t,reset:Ut},{when:()=>!1!==e.trackMouse&&r("thrashCursor"),start:()=>{const t=e.signals?.thrashCursor;var n;n=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,Rt=n?.velocityThreshold??800,Ct=n?.windowMs??2e3,document.addEventListener("mousemove",Ht,{passive:!0})},stop:Vt},{when:()=>r("loopNav"),start:()=>{return t=e.signals?.loopNav,void(Kt=t?.windowMs??3e4);var t},stop:Qt},{when:()=>r("scrollBounce"),start:ae,stop:ue,reset:le},{when:()=>i&&(r("formHesitation")||r("formAbandon")),start:()=>{const o=e.signals?.formHesitation;((e,n)=>{_e=e?.pauseMs??5e3,ve=n??[],document.addEventListener("focusin",ge,{capture:!0,passive:!0}),document.addEventListener("focusout",be,{capture:!0,passive:!0}),document.addEventListener("submit",ye,{capture:!0,passive:!0}),window.addEventListener("pagehide",Me),ke=t(()=>{"hidden"===document.visibilityState&&xe()}),document.addEventListener("visibilitychange",ke)})(o?{pauseMs:o.threshold}:void 0,n)},stop:Te,reset:De},{when:()=>i&&r("formValidationLoop"),start:()=>(t=>{Qr=t??[],document.addEventListener("invalid",ei,{capture:!0,passive:!0}),document.addEventListener("input",ni,{capture:!0,passive:!0}),document.addEventListener("change",ni,{capture:!0,passive:!0}),(ti=new MutationObserver(pi)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(n),stop:oi,reset:ri},{when:()=>r("errorEncounter"),start:Ne,stop:Re},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>(t=>{Ye=t??[],document.addEventListener("touchstart",Ge,{passive:!0}),document.addEventListener("touchend",Ke,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Qe,{passive:!0}),window.addEventListener("orientationchange",tn,{passive:!0})),window.visualViewport?.addEventListener("resize",en)})(n),stop:nn},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>(t=>{fn=t??[],document.addEventListener("keydown",dn,{capture:!0,passive:!0})})(n),stop:pn},{when:()=>r("scrollHijack"),start:xn,stop:An,reset:En},{when:()=>r("scrollDepthAbandon"),start:Cn,stop:Ln,reset:jn},{when:()=>r("advancedHeuristics"),start:Gn,stop:Kn,reset:()=>{Qn(),Zn=0}},{when:()=>r("helpHunt"),start:()=>(t=>{io=t??[],document.addEventListener("click",so,{capture:!0,passive:!0})})(n),stop:co,reset:ao},{when:()=>r("closeClick"),start:()=>(t=>{mo=t??[],document.addEventListener("click",_o,{capture:!0,passive:!0})})(n),stop:vo,reset:go},{when:()=>r("closeClickReversal"),start:()=>(t=>{ko=t??[],document.addEventListener("click",To,{capture:!0,passive:!0}),document.addEventListener("keydown",Do,{capture:!0,passive:!0}),window.addEventListener("popstate",xo)})(n),stop:Ao,reset:Eo},{when:()=>r("filterSpiral"),start:()=>(t=>{No=t??[],document.addEventListener("change",Ro,{capture:!0,passive:!0}),document.addEventListener("click",Co,{capture:!0,passive:!0})})(n),stop:Lo,reset:jo},{when:()=>r("copyFrustration"),start:zo,stop:qo,reset:Xo},{when:()=>r("textSelectFrustration"),start:Vo,stop:Wo,reset:Yo},{when:()=>r("deadClickTrapZone"),start:()=>(t=>{Jr=t??[],document.addEventListener("mousedown",Hr,{capture:!0,passive:!0}),document.addEventListener("click",Vr,{capture:!0,passive:!0})})(n),stop:Wr,reset:Yr},{when:()=>!0,start:()=>(t=>{or=[],rr=null,ir=!0,sr=new Map,ar=t??"",(()=>{try{const t=sessionStorage.getItem(tr);if(t){const e=JSON.parse(t);cr={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),O(mr),ur=()=>pr("popstate"),lr=()=>pr("hashchange"),fr=()=>{"hidden"===document.visibilityState&&pr("visibilitychange")},dr=()=>pr("pagehide"),window.addEventListener("popstate",ur),window.addEventListener("hashchange",lr),document.addEventListener("visibilitychange",fr),window.addEventListener("pagehide",dr)})(o),stop:_r},{when:()=>r("navigationConfusion"),start:Tr,stop:Dr,reset:xr},{when:()=>r("scrollToClickConfusion"),start:jr,stop:Ir,reset:Br},{when:()=>r("elementImpression"),start:()=>{return n=e.elementImpressionSelectors,mi=n?.length?n:["[data-fd-impression]"],_i=Date.now(),void("undefined"!=typeof IntersectionObserver&&(hi=new IntersectionObserver(t(Ti),{threshold:[0,.5,1]}),yi(),(wi=new MutationObserver(t(ki))).observe(document.body,{childList:!0,subtree:!0})));var n},stop:gi,reset:bi},{when:()=>i&&r("inputCorrection"),start:()=>(t=>{xi=t??[],document.addEventListener("input",Ai,{capture:!0,passive:!0})})(n),stop:Ei,reset:Si},{when:()=>i&&r("pasteBlocked"),start:()=>(t=>{os=t??[],document.addEventListener("paste",rs,{capture:!0,passive:!0})})(n),stop:is},{when:()=>r("hoverDwell"),start:()=>{const t=e.signals?.hoverDwell;((t,e)=>{Ui=t?.dwellMs??2e3,Ni=e??[],document.addEventListener("mouseover",Ci,{passive:!0}),document.addEventListener("mouseout",Li,{passive:!0}),document.addEventListener("click",ji,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,n)},stop:Ii,reset:Bi},{when:()=>r("exitIntent"),start:Ji,stop:Zi,reset:Hi},{when:()=>r("performanceVitals"),start:Qi,stop:es,reset:ns}]}(e,h,a))n.when()&&(n.start(),ds.push({stop:n.stop,reset:n.reset}));as=function(t){let e=location.href;function n(){const n=location.href;n!==e&&(e=n,t(n,location.pathname))}const o=history.pushState,r=history.replaceState,i=function(...t){o.apply(this,t),n()},s=function(...t){r.apply(this,t),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{history.pushState===i&&(history.pushState=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}(t((t,n)=>{P();for(const t of ds)t.reset?.();Ar(n),(t=>{ar=t})(n);const o=H(n,e.pageRules??[]),r=bs(n,e.ignorePages??[]);U(r),z({page:o,url:t}),(t=>{const e=Date.now(),n=t.indexOf("#"),o=-1===n?t:t.slice(0,n),r=-1===n?"":t.slice(n);for(;Yt.length&&e-Yt[0].ts>Kt;)Yt.shift();for(;Gt.length&&e-Gt[0].ts>Kt;)Gt.shift();if(Yt.length>=100&&(Yt=Yt.slice(-50)),Gt.length>=100&&(Gt=Gt.slice(-50)),Yt.push({path:t,ts:e}),r){Gt.push({path:t,ts:e});const n=Gt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))===o}),r=new Set(n.map(t=>{const e=t.path.indexOf("#");return-1===e?"":t.path.slice(e)}));if(r.size>=3&&n.length>r.size){const t=n.slice(-5).map(t=>t.path);return B({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(Gt=Gt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))}}if(Yt.length<4)return;let i=!1;const s=[];for(let e=0;e<Yt.length-1;e++)if(Yt[e].path===t){const t=Yt.slice(e,Yt.length),n=new Set(t.map(t=>t.path));if(n.size>=2){s.push(...Array.from(n)),i=!0;break}}i&&(B({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:Yt.slice(-5).map(t=>t.path)}}),Yt=[{path:t,ts:e}],Gt=Gt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(n),r||B({t:"pv",ts:Date.now(),d:{ref:""}})}))}function hs(t,e){if(!cs)return;if("string"!=typeof t||!t||t.length>128)return;let n;try{n=JSON.stringify(e?.metadata??{})}catch{return}if(n.length>2048)return;const o=JSON.parse(n);B({t:"sig",ts:Date.now(),d:{s:t.slice(0,128),el:"string"==typeof e?.element?e.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(e?.weight??15,100))}})}function ws(t,e={}){if(!cs)return;if("string"!=typeof t||!/^[a-z0-9_.-]{1,120}$/i.test(t))return;let n;try{n=JSON.stringify(e??{})}catch{return}n.length>2048||B({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function ms(t){if(!cs)return;if(!t||"object"!=typeof t)return;const e=Object.create(null);let n=0;for(const o of Object.keys(t)){if(n>=20)break;"__proto__"!==o&&"constructor"!==o&&"prototype"!==o&&(e[o.slice(0,64)]=String(t[o]).slice(0,256),n++)}z({segment:e})}function _s(t){t&&us&&!cs?ps(us):t||(gs(),r())}function vs(){gs(),r()}function gs(){if(cs){for(const t of ds)t.stop();ds=[],P(),S=!1,document.removeEventListener("visibilitychange",j),window.removeEventListener("pagehide",I),y&&(clearTimeout(y),y=null),as&&(as(),as=null),(()=>{const t=window;t[ls]===fs&&delete t[ls]})(),cs=!1}}function bs(t,e){for(const n of e)if(n)if(n.endsWith("*")){if(t.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(t.endsWith(n.slice(1)))return!0}else if(t===n)return!0;return!1}function ys(t){if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}}(()=>{try{const t=window;if(t.flusterduck)return;const e=document.currentScript;if(!e)return;const n=e.getAttribute("data-key");if(!n)return;const o={key:n,environment:e.getAttribute("data-env")||void 0,endpoint:ys(e.getAttribute("data-endpoint")),debug:"true"===e.getAttribute("data-debug"),cookieless:"true"===e.getAttribute("data-cookieless"),respectDoNotTrack:"false"!==e.getAttribute("data-dnt")},r=e.getAttribute("data-dom-mode");"metadata"!==r&&"snapshot"!==r||(o.domMode=r),"off"===e.getAttribute("data-compression")&&(o.compression="off");const i=e.getAttribute("data-sample");if(i){const t=parseFloat(i);isNaN(t)||(o.sampleRate=Math.max(0,Math.min(t,1)))}const s=e.getAttribute("data-segment");if(s&&s.length<2048)try{const t=JSON.parse(s);if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.create(null);for(const n of Object.keys(t))"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=String(t[n]));o.segment=e}}catch{}ps(o),t.flusterduck=Object.freeze({init:ps,signal:hs,track:ws,identify:ms,setConsent:_s,optOut:vs,destroy:gs})}catch{}})()})();
|
|
1
|
+
"use strict";(()=>{function t(t){return(...e)=>{try{return t(...e)}catch{}}}function e(t){return e=>{try{t(e)}catch{}}}var n="_fd_s",o=/^[0-9a-f]{32}$/;function r(){s(n,"",-1)}function i(){const t=new Uint8Array(16);crypto.getRandomValues(t);let e="";for(const n of t)e+=n.toString(16).padStart(2,"0");return e}function s(t,e,n){const o=new Date;o.setTime(o.getTime()+864e5*n);const r="https:"===location.protocol?";Secure":"";document.cookie=`${t}=${encodeURIComponent(e)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var c=/^[:\d]|--|^(ember|react|ng-|__)/;function a(t){if(!t||t===document.documentElement)return"html";const e=t.getAttribute("data-fd");if(e)return`[data-fd="${u(e)}"]`;if(t.id&&!c.test(t.id)&&t.id.length<64)return"#"+u(t.id);const n=[];let o=t,r=0;for(;o&&o!==document.body&&r<5;){let t=o.tagName.toLowerCase();const e=o.getAttribute("name"),i=o.getAttribute("role"),s=o.getAttribute("type");e&&e.length<64?t+=`[name="${u(e)}"]`:i?t+=`[role="${u(i)}"]`:!s||"input"!==t&&"button"!==t||(t+=`[type="${u(s)}"]`);const c=o.parentElement;if(c){const e=c.children;let n=0,r=0;for(let t=0;t<e.length;t++){const i=e[t];i&&i.tagName===o.tagName&&(n++,i===o&&(r=n))}n>1&&(t+=`:nth-of-type(${r})`)}n.unshift(t);const a=n.join(" > ");try{if(1===document.querySelectorAll(a).length)return a}catch(t){}o=c,r++}return n.join(" > ")}function u(t){return"undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([^\w-])/g,"\\$1")}var l=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,f=/^(INPUT|TEXTAREA|SELECT)$/;function d(t){try{const e=t.getAttribute("aria-label");if(e)return e.trim().slice(0,60);if(!f.test(t.tagName)){const e=(t.textContent??"").trim().replace(/\s+/g," ").slice(0,60);if(e&&!l.test(e))return e}const n=t.getAttribute("placeholder");if(n)return n.trim().slice(0,60);const o=t.getAttribute("title");if(o)return o.trim().slice(0,60);const r=t.getAttribute("alt");return r?r.trim().slice(0,60):""}catch{return""}}function p(t,e){if(t.hasAttribute("data-fd-ignore"))return!0;if(t.closest("[data-fd-ignore]"))return!0;for(const n of e)try{if(t.matches(n)||t.closest(n))return!0}catch(t){}return!1}function h(t,e){return t&&e.includes(t)?t:null}function w(t){const e=t.tagName.toLowerCase();if("input"!==e&&"button"!==e)return null;const n=t.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function m(t){return t.top<window.innerHeight&&t.bottom>0&&t.left<window.innerWidth&&t.right>0}function _(t){if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t.tagName))return!0;const e=t.getAttribute("role");return!(!e||!/^(button|link|tab|menuitem|checkbox|radio)$/.test(e))}var v=6e4,g="application/json",y=[],b=null,M="",k=7e3,T=50,D=null,x={domMode:"off",compression:"auto"},A=!1,E=null,S=!1,O=!0;function $(t){O=t}var U=new WeakMap;function N(t){E=t}var R=new Set;function C(t){return R.add(t),()=>{R.delete(t)}}function j(t){S=t}var L=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),I=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),B=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),P=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,z=e(()=>{"hidden"===document.visibilityState&&F()}),q=t(()=>F());function X(t){S||y.length>=100||((t=>{if("sig"!==t.t||!R.size)return;const e=t.d??{},n="string"==typeof e.s?e.s:"";if(!n)return;const o={name:n,element:"string"==typeof e.el?e.el:"",weight:"number"==typeof e.w?e.w:0,meta:e.meta&&"object"==typeof e.meta?e.meta:{},ts:t.ts};for(const t of R)try{t(o)}catch{}})(t),(t=>{if(!E||"sig"!==t.t)return;const e=Y(t.d?.s,t.d?.signal_type,t.d?.name);if(e)try{E(e.slice(0,128),t.ts)}catch{}})(t),O&&(y.push(t),y.length>=T?F():b||(b=setTimeout(F,k))))}function F(){(async()=>{if(A)return;if(!y.length||!D)return;A=!0,b&&(clearTimeout(b),b=null);const t=y;y=[];const e={v:1,sid:D.sid,key:D.key,url:D.url,page:D.page,ts:Date.now(),ua:D.ua,vw:D.vw,vh:D.vh,environment:D.environment,...D.segment?{segment:D.segment}:{},dom_mode:x.domMode},n=[];let o={source:[],events:[]};try{for(const r of t){const t=V(r,D.page,x.domMode),i=[...o.events,t];JSON.stringify({...e,events:i}).length>v?o.events.length>0?(n.push(o),o={source:[r],events:[t]}):(JSON.stringify({...e,events:[t]}).length<=v&&n.push({source:[r],events:[t]}),o={source:[],events:[]}):(o.source.push(r),o.events=i)}o.events.length>0&&n.push(o);for(const t of n)H({...e,events:t.events}).then(e=>{e||J(t.source)}).catch(()=>J(t.source))}catch(t){}finally{A=!1}})()}function J(t){const e=t.filter(t=>{const e=U.get(t)??0;return!(e>=3||(U.set(t,e+1),0))});if(!e.length)return;const n=[...e,...y];y=n.length>100?n.slice(-100):n,b||(b=setTimeout(F,k))}function Z(t){if(D)for(const e of Object.keys(t))L.has(e)&&(D[e]=t[e])}async function H(t){const e=JSON.stringify(t),n=await(async(t,e)=>{const n=(new TextEncoder).encode(t);if(n.byteLength>v)return null;if("off"!==e){const e=await(async t=>{const e=globalThis.CompressionStream;if("function"!=typeof e)return null;try{const n=(t=>{const e=(new TextEncoder).encode(t),n=new Blob([e],{type:g});if("function"==typeof n.stream)return n.stream();const o=globalThis.ReadableStream;return"function"!=typeof o?null:new o({start(t){t.enqueue(e),t.close()}})})(t);if(!n)return null;const o=new e("gzip"),r=n.pipeThrough(o).getReader(),i=[];let s=0;for(;;){const t=await r.read();if(t.done)break;if(s+=t.value.byteLength,s>v)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const c=new Uint8Array(s);let a=0;for(const t of i)c.set(t,a),a+=t.byteLength;return c.buffer}catch{return null}})(t);if(e&&e.byteLength<=v)return{beaconBody:new Blob([e],{type:"application/json; encoding=gzip"}),fetchBody:new Uint8Array(e),headers:{"Content-Type":g,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:g}),fetchBody:t,headers:{"Content-Type":g}}})(e,x.compression);return!n||(async(t,e=M)=>{if(!e)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(e,t.beaconBody))return!0}catch{}try{return await fetch(e,{method:"POST",body:t.fetchBody,headers:t.headers,keepalive:!0}),!0}catch{return!1}})(n)}function V(t,e,n){const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":I.has(t)?t:"custom_signal")(t.t),i={type:r,ts:t.ts,page:"string"==typeof o.page?o.page.slice(0,2048):e},s=Y(o.el,o.element,o.target);if("signal"===r){i.signal_type=Y(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));const t=s?((t,e)=>{if("off"===e)return null;try{const n=document.querySelector(t);return n?((t,e)=>{if("off"===e)return null;if("metadata"===e)return(t=>({mode:"metadata",selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),attributes:{disabled:!0===t.disabled,required:!0===t.required,ariaDisabled:"true"===t.getAttribute("aria-disabled"),ariaExpanded:h(t.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:h(t.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:w(t)}}))(t);const n=(t=>{try{const e=t.getBoundingClientRect(),n=getComputedStyle(t),o=t.parentElement,r=[];if(o)for(let e=0;e<o.children.length&&r.length<6;e++){const n=o.children[e];if(!n||n===t)continue;const i=n.getBoundingClientRect();r.push({selector:a(n),tag:n.tagName.toLowerCase(),box:{x:Math.round(i.x),y:Math.round(i.y),w:Math.round(i.width),h:Math.round(i.height)},interactive:_(n)})}const i=[];try{const e=t.getAnimations();for(const t of e)"animationName"in t&&i.push(t.animationName)}catch{}return{selector:a(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),parent:o?a(o):"",box:{x:Math.round(e.x),y:Math.round(e.y),w:Math.round(e.width),h:Math.round(e.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:!0===t.disabled},inView:m(e),animations:i,siblings:r}}catch{return null}})(t);return n?{mode:"snapshot",...n}:null})(n,e):null}catch{return null}})(s,n):null;t&&(i.dom=t)}const c=(t=>{const e=Object.create(null);for(const n of Object.keys(t)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;const o=W(t[n],n);void 0!==o&&(e[n.slice(0,64)]=o)}if(t.meta&&"object"==typeof t.meta&&!Array.isArray(t.meta)){const n=W(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(c).length&&(i.metadata=c),i}function W(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>B.has(t)))(e))){if(null===t||"boolean"==typeof t)return t;if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t){if(P.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>W(t,e,n+1)).filter(t=>void 0!==t);if("object"==typeof t){const e=Object.create(null);for(const o of Object.keys(t).slice(0,40)){if("__proto__"===o||"constructor"===o||"prototype"===o)continue;const r=W(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function Y(...t){for(const e of t)if("string"==typeof e&&e)return e}function G(t){return"off"===t?"off":"auto"}function K(t,e){for(const n of e){const e=tt(n.pattern);if(e&&e.test(t))return n.label}return(t=>t.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/gi,"/:id"))(t)}var Q=/^[a-zA-Z0-9/:._*\-]+$/;function tt(t){if(t.length>200)return null;if(!Q.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var et=[".carousel-arrow",".slick-arrow",".swiper-button-next",".swiper-button-prev","[data-carousel]",'button[aria-label*="next"]','button[aria-label*="prev"]','button[aria-label*="slide"]',".quantity-btn",".qty-btn",'input[type="number"]'],nt=[],ot=3,rt=2e3,it=24,st=[],ct=[],at=0,ut=new Map,lt=new Map,ft=!1,dt=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,st))return;if((t=>{const e=t.tagName;return"VIDEO"===e||"AUDIO"===e||(!!t.hasAttribute("ondblclick")||(!!t.hasAttribute("data-dbl")||"spinbutton"===t.getAttribute("role")))})(e))return;const n=Date.now(),o=t.clientX,r=t.clientY;for(;nt.length&&n-nt[0].t>rt;)nt.shift();nt.push({t:n,x:o,y:r});const i=ct.length>=3?2:ot;if(nt.length<i)return;const s=nt.slice(-i);for(let t=0;t<s.length-1;t++)for(let e=t+1;e<s.length;e++){const n=s[t],o=s[e],r=o.x-n.x,i=o.y-n.y;if(r*r+i*i>it*it)return}const c=(s[s.length-1].t-s[0].t)/1e3,u=c>0?s.length/c:s.length,l=Math.round(100*Math.min(1,(s.length-i)/i+u/10))/100,f=((t,e,n)=>{const o=Math.min(4,(t.length-e)/5*4),r=Math.min(4,n/10*4);let i=2;if(t.length>=2){let e=0,n=0;for(let o=0;o<t.length-1;o++)for(let r=o+1;r<t.length;r++){const i=t[o],s=t[r],c=s.x-i.x,a=s.y-i.y;e+=Math.sqrt(c*c+a*a),n++}i=Math.max(0,2-e/n/it*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(s,i,u),h=a(e),w=d(e);ct.push({selector:h,ts:n});const m=ct.length,_=(t=>{const e=(t-at)/6e4;return e<=0?0:Math.round(ct.length/e*10)/10})(n),v=ut.get(h)??0,g=v+1,y=lt.get(h)??0,b=y>0&&n-y<1e4;ut.set(h,g),lt.set(h,n);const M=v>=1,k=(()=>{try{const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return null;const n=s.reduce((t,e)=>t+e.x,0)/s.length,o=s.reduce((t,e)=>t+e.y,0)/s.length,r=t.top+t.height/2;return{click_dx:Math.round(n-(t.left+t.width/2)),click_dy:Math.round(o-r),el_w:Math.round(t.width),el_h:Math.round(t.height)}}catch{return null}})();X({t:"sig",ts:n,d:{s:"rage_click",el:h,...w?{el_label:w}:{},cnt:s.length,vel:Math.round(10*u)/10,intensity:l,quality:f,burst_seq:m,burst_rate_per_min:_,repeated_target:M,hot_repeat:b,...k??{}}}),M&&X({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:h,...w?{el_label:w}:{},total_hits:g,burst_count:g,burst_seq:m}}),nt=nt.slice(-(i-1))});function pt(){ft&&(ft=!1,document.removeEventListener("click",dt,{capture:!0,passive:!0}),nt=[],ct=[],ut.clear(),lt.clear())}var ht=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,wt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,mt=/^(A|BUTTON|LABEL)$/,_t=[],vt=null,gt=new Map,yt=e(t=>{vt={x:t.clientX,y:t.clientY}}),bt=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,_t))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!vt)return!1;const e=t.clientX-vt.x,n=t.clientY-vt.y;return Math.sqrt(e*e+n*n)>5})(t);if(vt=null,n)return;if((t=>{if(ht.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&wt.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!mt.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const o=((t,e,n)=>{let o=t;for(let r=0;r<5&&o;r++){const r=o.parentElement;if(!r)break;const i=r.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]');let s=null,c=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const a=Dt(e,n,r);a<c&&(c=a,s=r)}if(s&&c<100)return s;o=r}return null})(e,t.clientX,t.clientY),r=o?Tt(t.clientX,t.clientY,o):null,i=a(e),s=(gt.get(i)??0)+1;gt.set(i,s);const c=s>=2,u=(t=>{try{return window.getComputedStyle(t).cursor.slice(0,20)}catch{return""}})(e),l=(t=>{try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e),f=d(e),h=o?d(o):"";X({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...f?{el_label:f}:{},near:o?a(o):"",...h?{near_label:h}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:u,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:s}:{}}})});function Mt(){document.removeEventListener("mousedown",yt,{capture:!0}),document.removeEventListener("click",bt,{capture:!0}),vt=null,gt.clear()}function kt(){gt.clear()}function Tt(t,e,n){const o=n.getBoundingClientRect(),r=t-Math.max(o.left,Math.min(t,o.right)),i=e-Math.max(o.top,Math.min(e,o.bottom));return{dist:Math.sqrt(r*r+i*i),dx:r,dy:i}}function Dt(t,e,n){return Tt(t,e,n).dist}var xt=null,At=3e3,Et=[],St="click",Ot=0,$t=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Ut=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Nt=e(t=>{const e=t.target;if(!e)return;if(p(e,Et))return;const n=e.getAttribute("role");if(!($t.test(e.tagName)||n&&Ut.test(n)))return;const o=Date.now();if(o-Ot>50&&(St="click",Ot=o),xt){if(xt.el===e||xt.el.contains(e)){const t=o-xt.ts;return t>=At&&X({t:"sig",ts:o,d:{s:"speed_frustration",el:xt.selector,delay:t,interaction_type:St,observed_delay_ms:t}}),void It()}It()}const r=a(e);let i=!1;const s=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return i=!0,void It();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void It()}}),c=e.parentElement||document.body;s.observe(c,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const u=setTimeout(()=>{!i&&xt&&(xt.observer.disconnect(),xt={...xt,timeout:null})},At+500);xt={el:e,selector:r,ts:o,observer:s,timeout:u}}),Rt=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(St="keydown",Ot=Date.now()))}),Ct=e(()=>{St="touch",Ot=Date.now()});function jt(){document.removeEventListener("click",Nt,{capture:!0}),document.removeEventListener("keydown",Rt,{capture:!0}),document.removeEventListener("touchstart",Ct,{capture:!0}),It()}function Lt(){It()}function It(){xt&&(xt.observer.disconnect(),xt.timeout&&clearTimeout(xt.timeout),xt=null)}var Bt=800,Pt=2e3,zt=0,qt=0,Xt=0,Ft=0,Jt=0,Zt=0,Ht=0,Vt=0,Wt=[],Yt=0,Gt=null,Kt=e(t=>{const e=Date.now();e-zt<16||(zt=e,Gt&&clearTimeout(Gt),Gt=setTimeout(()=>te(),150),((t,e,n)=>{if(0===Ft)return qt=t,Xt=e,Ft=n,void(Vt=n);const o=(n-Ft)/1e3;if(0===o)return;const r=t-qt,i=e-Xt;if(Math.abs(r)<2&&Math.abs(i)<2)return;const s=Math.sqrt(r*r+i*i),c=s/o;Wt.length>=100&&(Wt=Wt.slice(-50)),Wt.push(c),Yt+=s;const a=Math.sign(r),u=Math.sign(i);if(s>=5&&(0!==Jt&&0!==a&&a!==Jt||0!==Zt&&0!==u&&u!==Zt)&&Ht++,Jt=a||Jt,Zt=u||Zt,qt=t,Xt=e,Ft=n,n-Vt>Pt){if(Ht>=3){const t=Wt.reduce((t,e)=>t+e,0)/Wt.length;t>=Bt&&X({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:Ht,distance_px:Math.round(Yt)}})}te(),Vt=n}})(t.clientX,t.clientY,e))});function Qt(){document.removeEventListener("mousemove",Kt),Gt&&clearTimeout(Gt),te()}function te(){Ht=0,Wt=[],Yt=0,Jt=0,Zt=0,Ft=0,qt=0,Xt=0,zt=0,Gt=null}var ee=[],ne=[],oe=3e4;function re(){ee=[],ne=[]}var ie=1e4,se=.5,ce=[],ae=0,ue=0,le=!1,fe=0,de=e(()=>{le||(le=!0,requestAnimationFrame(()=>{le=!1,(()=>{const t=Date.now(),e=window.scrollY;if((fe=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/fe,o=e>ae?"down":"up";if(t-ue<100)return void(ae=e);for(;ce.length&&t-ce[0].ts>ie;)ce.shift();ce.length>=100&&(ce=ce.slice(-50)),ce.push({depth:n,ts:t,direction:o}),ae=e,ue=t;let r=0,i=1,s=0,c=!1,a=0,u=0,l=0,f=1,d=0;for(let t=1;t<ce.length;t++)ce[t].direction!==ce[t-1].direction&&d++;for(let t=0;t<ce.length;t++){const e=ce[t],n=e.depth;if(n>r&&(r=n),n>=se&&(c||(a=e.ts,l=n),c=!0),c&&n<i&&(i=n,u=e.ts,f=n),c&&i<.25&&n>=se){if(u-a<200){c=!1,i=1,a=e.ts,l=n;continue}s++,c=!1,i=1}}if(s>=1){const e=Math.max(u-a,1),n=100*Math.abs(l-f),o=Math.round(n/e*1e3);X({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:s+1,vel:o,dir_changes:d}}),ce=[]}})()}))});function pe(t){ie=t?.windowMs??1e4,se=t?.depthThreshold??.5,window.addEventListener("scroll",de,{passive:!0})}function he(){window.removeEventListener("scroll",de),ce=[],le=!1}function we(){ce=[],ae=0,ue=0,le=!1}var me=["textarea",'[role="textbox"]',"[contenteditable]"],_e=new Map,ve=new Map,ge=new Set,ye=null,be=0,Me=5e3,ke=[],Te=e(t=>{const e=t.target;if(!e||!Ue(e))return;if(p(e,ke))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of me)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();_e.set(e,n),ve.set(e,n);const o=e.closest("form");o&&o!==ye&&(ye=o,be=o.querySelectorAll("input, select, textarea").length)}),De=e(t=>{const e=t.target;if(!e||!Ue(e))return;const n=_e.get(e),o=ve.get(e);_e.delete(e),ve.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=Me){const n=d(e);X({t:"sig",ts:r,d:{s:"form_hesitation",el:a(e),...n?{el_label:n}:{},pause:t}})}}const i=e.getAttribute("name")||e.getAttribute("id")||a(e);(t=>"value"in t&&t.value.length>0)(e)&&ge.add(i)}),xe=e(()=>{ge.clear(),ye=null}),Ae=t($e),Ee=null;function Se(){document.removeEventListener("focusin",Te,{capture:!0}),document.removeEventListener("focusout",De,{capture:!0}),document.removeEventListener("submit",xe,{capture:!0}),window.removeEventListener("pagehide",Ae),Ee&&(document.removeEventListener("visibilitychange",Ee),Ee=null),_e.clear(),ve.clear(),ge.clear(),ye=null}function Oe(){$e(),_e.clear(),ve.clear(),ge.clear(),ye=null,be=0}function $e(){if(ge.size>0&&ye){const t=be||ge.size,e=Math.round(ge.size/t*100)/100;X({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:ge.size,total:t,field_count:t,completion_rate:e}}),ge.clear(),ye=null}}function Ue(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var Ne=null,Re=null,Ce=/flusterduck\.com|\/v1\/ingest/,je=e(t=>{const e=t.message||"Unknown error";var n;X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Xe(e,200),ep:"",status:0,error_category:(n=e,Pe.test(n)?"network":"script"),url:location.pathname}})}),Le=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Xe(e,200),ep:"",status:0,error_category:ze(t.reason),url:location.pathname}})});function Ie(){window.addEventListener("error",je),window.addEventListener("unhandledrejection",Le),Ne||(Ne=window.fetch,Re=function(t,e){let n;try{n=Ne.call(this,t,e)}catch(t){throw t}return n.then(e=>{try{if(e.status>=400){const n="string"==typeof t?t:t instanceof URL?t.pathname:t.url;Ce.test(n)||X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:qe(n),status:e.status,error_category:"network",url:location.pathname}})}}catch{}return e},e=>{try{const n="string"==typeof t?t:t instanceof URL?t.href:t.url;Ce.test(n)||X({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Xe(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?qe(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=Re)}function Be(){window.removeEventListener("error",je),window.removeEventListener("unhandledrejection",Le),Ne&&Re&&window.fetch===Re&&(window.fetch=Ne),Ne=null,Re=null}var Pe=/fetch|network|cors|timeout/i;function ze(t){if(t instanceof TypeError&&Pe.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return Pe.test(e)?"network":"unhandled_promise"}function qe(t){try{return new URL(t,location.origin).pathname}catch{const e=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(e>=0?e:t.length,n>=0?n:t.length);return t.slice(0,o)||"/"}}function Xe(t,e){let n=t.length>e?t.slice(0,e):t;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,t=>{try{return new URL(t).origin+new URL(t).pathname}catch{return"[URL]"}}),n}var Fe=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Je=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Ze=null,He=0,Ve=1,We=0,Ye=0,Ge=0,Ke=0,Qe=0,tn=null,en=[],nn=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(Ze={x:e.clientX,y:e.clientY,ts:Date.now()},He=0):2===t.touches.length&&(He=un(t.touches),Ze=null)}),on=e(t=>{if(He>0){const e=t.touches.length>=2?un(t.touches):(()=>{const e=t.changedTouches[0],n=t.changedTouches[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)})();e>0&&(Ve=Math.round(e/He*100)/100),He=0}if(!Ze)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-Ze.x,o=e.clientY-Ze.y,r=Date.now()-Ze.ts,i=document.elementFromPoint(e.clientX,e.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&((t,e,n)=>{if(p(t,en))return;const o=((t,e,n)=>{const o=(t.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])');let r=null,i=21;for(let t=0;t<o.length;t++){const s=o[t];if(!s)continue;const c=s.getBoundingClientRect(),a=Math.max(c.left,Math.min(e,c.right)),u=Math.max(c.top,Math.min(n,c.bottom)),l=Math.sqrt((e-a)**2+(n-u)**2);l<i&&l>0&&(i=l,r=s)}return r})(t,e,n);if(!o)return;const r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(e,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),c=Math.sqrt((e-i)**2+(n-s)**2);if(c>0&&c<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;X({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:a(o),dist:Math.round(c),size:t}})}})(i,e.clientX,e.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&((t,e,n)=>{if(Math.abs(n)>Math.abs(e))return;if(!t)return;if(Fe.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!Fe.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";X({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),Ze=null}),rn=e(()=>{const t=Date.now();if(t-Ye>3e4&&(We=0,Ye=t),++We>=2){const e=document.activeElement||document.body;!Je.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-Ge>200&&(Ge=t,X({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:We,pinch_scale:Ve}})),We=0,Ve=1}}),sn=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Qe>3e4&&(Ke=0,Qe=t),e!==tn&&(Ke++,tn=e),Ke>=3&&(X({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:Ke,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),Ke=0)}),cn=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Ye>3e4&&(We=0,Ye=e),++We>=2&&e-Ge>200){const n=Math.round(100*t.scale)/100;Ge=e,X({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:We,pinch_scale:n}}),We=0,Ve=1}}});function an(){document.removeEventListener("touchstart",nn),document.removeEventListener("touchend",on),document.removeEventListener("gesturechange",rn),window.removeEventListener("orientationchange",sn),window.visualViewport?.removeEventListener("resize",cn),Ze=null,He=0,Ve=1,We=0,Ye=0,Ge=0,Ke=0,Qe=0,tn=null}function un(t){const e=t[0],n=t[1];if(!e||!n)return 0;const o=e.clientX-n.clientX,r=e.clientY-n.clientY;return Math.sqrt(o*o+r*r)}var ln=[],fn=null,dn=0,pn=0,hn="",wn=[],mn=[],_n=e(t=>{const e=Date.now(),n=t.target;n&&p(n,mn)||("Tab"===t.key?((t,e,n)=>{for(;ln.length&&t-ln[0].ts>5e3;)ln.shift();ln.length>=50&&(ln=ln.slice(-25));const o=e?a(e):"";if(ln.push({ts:t,el:o,shift:n}),ln.length>=10){const e=ln.map(t=>t.el).filter(Boolean),n=(t=>{let e=0;for(let n=1;n<t.length;n++)t[n].shift!==t[n-1].shift&&e++;return e})(ln);X({t:"sig",ts:t,d:{s:"tab_thrash",cnt:ln.length,els:e,direction_changes:n}}),ln=[]}if(!e)return;const r=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(r){const n=a(e);r===fn?t-pn<=3e3?(dn++,hn=n,dn>=5&&(X({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:dn,trapped_element:hn}}),dn=0,hn="",fn=null)):(pn=t,dn=1,hn=n):(fn=r,pn=t,dn=1,hn=n)}})(e,n,t.shiftKey):"Escape"===t.key?((t,e)=>{if(!e)return;const n=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');if(n&&n===fn){if(t-pn>3e3)return pn=t,dn=1,void(hn=a(e));dn++,hn=a(e),dn>=5&&(X({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:dn,trapped_element:hn}}),dn=0,hn="",fn=null)}})(e,t.target):"ArrowDown"!==t.key&&"ArrowUp"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||((t,e)=>{if(!e)return;const n=e.closest('[role="listbox"]')||e.closest('[role="menu"]')||e.closest('[role="tree"]')||e.closest("select");if(!n)return;for(;wn.length&&t-wn[0].ts>5e3;)wn.shift();wn.length>=50&&(wn=wn.slice(-25)),wn.push({ts:t,container:n});const o=wn.filter(t=>t.container===n);o.length>=15&&(X({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),wn=[])})(e,t.target))});function vn(){document.removeEventListener("keydown",_n,{capture:!0}),ln=[],wn=[],fn=null,dn=0,pn=0,hn="",mn=[]}var gn=0,yn=0,bn=null,Mn=0,kn=!1,Tn=0,Dn=0,xn=null,An=0,En=e(()=>{kn||(kn=!0,requestAnimationFrame(()=>{kn=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-yn;if(Math.abs(n)<2)return void(yn=e);const o=n>0?"down":"up";bn&&o!==bn&&(t-Mn>3e3&&(gn=0,Mn=t),++gn>=4)&&Math.abs(n)>100&&(t-Dn>1e4&&(Tn=0,Dn=t),Tn++,X({t:"sig",ts:t,d:{s:"scroll_hijack",rev:gn,source:null!==xn&&t-An<=2e3?xn:"wheel",repeated:Tn>=2}}),gn=0),bn=o,yn=e})()}))}),Sn=e(()=>{xn="wheel",An=Date.now()}),On=e(()=>{xn="touch",An=Date.now()});function $n(){window.addEventListener("wheel",Sn,{passive:!0}),window.addEventListener("touchmove",On,{passive:!0}),window.addEventListener("scroll",En,{passive:!0})}function Un(){window.removeEventListener("wheel",Sn),window.removeEventListener("touchmove",On),window.removeEventListener("scroll",En),Nn()}function Nn(){gn=0,yn=0,bn=null,Mn=0,kn=!1,Tn=0,Dn=0,xn=null,An=0}var Rn=0,Cn=0,jn=!1,Ln=e(()=>{jn||(jn=!0,requestAnimationFrame(()=>{jn=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>Rn&&(Rn=e,0===Cn&&(Cn=Date.now()))}}))}),In=null,Bn=null;function Pn(){window.addEventListener("scroll",Ln,{passive:!0}),Bn=t(Xn),window.addEventListener("pagehide",Bn),In=t(()=>{"hidden"===document.visibilityState&&Xn()}),document.addEventListener("visibilitychange",In)}function zn(){window.removeEventListener("scroll",Ln),Bn&&(window.removeEventListener("pagehide",Bn),Bn=null),In&&(document.removeEventListener("visibilitychange",In),In=null),Rn=0,Cn=0,jn=!1}function qn(){Rn=0,Cn=0,jn=!1}function Xn(){if(Rn>.05){const t=Date.now(),e=Cn>0?Math.max(0,t-Cn):0;X({t:"sig",ts:t,d:{s:"scroll_depth_abandon",depth:Math.round(100*Rn)/100,max_depth:Math.round(100*Rn),dwell_ms:e}})}}var Fn="",Jn=0,Zn=0,Hn=0,Vn=0,Wn=0,Yn=null,Gn=0,Kn=!1,Qn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==Fn||o-Zn>1500)&&(Fn=n,Zn=o,Jn=0),(Jn+=1)<4||(X({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:Jn,window_ms:1500}}),Jn=0,Zn=o)}),to=e(()=>{const t=Date.now(),e=io(),n=Wn||e,o=Math.abs(e-n)/Math.max(n,1);Wn=e,o<.15||((!Hn||t-Hn>5e3)&&(Hn=t,Vn=0),(Vn+=1)<3||(X({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:Vn,area_delta:Math.round(1e3*o)/1e3}}),Vn=0,Hn=t))}),eo=e(()=>{ro()});function no(){Kn||(Kn=!0,Wn=io(),ro(),document.addEventListener("mouseenter",Qn,!0),document.addEventListener("mouseleave",Qn,!0),document.addEventListener("click",eo,{capture:!0,passive:!0}),document.addEventListener("keydown",eo,{capture:!0,passive:!0}),document.addEventListener("scroll",eo,{passive:!0}),window.addEventListener("resize",to,{passive:!0}))}function oo(){Kn&&(Kn=!1,document.removeEventListener("mouseenter",Qn,!0),document.removeEventListener("mouseleave",Qn,!0),document.removeEventListener("click",eo,{capture:!0}),document.removeEventListener("keydown",eo,{capture:!0}),document.removeEventListener("scroll",eo),window.removeEventListener("resize",to),so(),Fn="",Jn=0,Zn=0,Vn=0,Hn=0,Gn=0)}function ro(){so();const t=Gn+=1;Yn=setTimeout(()=>{X({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function io(){return Math.max(1,window.innerWidth*window.innerHeight)}function so(){Yn&&(clearTimeout(Yn),Yn=null)}var co=["[data-help]","[data-tooltip]","[data-faq]","[aria-describedby]",'[aria-label*="help" i]','[aria-label*="support" i]','[title*="help" i]','a[href*="/help"]','a[href*="/faq"]','a[href*="/support"]','a[href*="help."]',"details > summary",'[role="tooltip"]'],ao=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,uo=[],lo=[],fo=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,lo))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(wo(e))return!0;if(mo(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;uo.length&&n-uo[0].t>6e4;)uo.shift();const o=a(e);if(uo.push({t:n,el:o}),uo.length<3)return;const r=new Set(uo.map(t=>t.el)).size,i=d(e);X({t:"sig",ts:n,d:{s:"help_hunt",cnt:uo.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),uo=[]});function po(){document.removeEventListener("click",fo,{capture:!0}),uo=[]}function ho(){uo=[]}function wo(t){for(const e of co)try{if(t.matches(e))return!0}catch{}return!1}function mo(t){const e=t.id??"",n=t.className??"";return ao.test("string"==typeof n?`${e} ${n}`:e)}var _o=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,vo=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,go=[],yo=new Map,bo=[],Mo=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,bo))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(Do(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=d(e);go.push({t:n,el:o});const i=(yo.get(o)??0)+1;yo.set(o,i);const s=go.length,c=(()=>{try{const n=e.getBoundingClientRect();return 0===n.width&&0===n.height?null:{click_dx:Math.round(t.clientX-(n.left+n.width/2)),click_dy:Math.round(t.clientY-(n.top+n.height/2)),el_w:Math.round(n.width),el_h:Math.round(n.height)}}catch{return null}})();X({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:s,element_cnt:i,repeated:i>1,container:xo(e),...c??{}}})});function ko(){document.removeEventListener("click",Mo,{capture:!0}),go=[],yo.clear()}function To(){go=[],yo.clear()}function Do(t){const e=t.getAttribute("data-dismiss")??"",n=t.getAttribute("data-close")??"";if(e||n)return!0;const o=t.getAttribute("aria-label")??t.getAttribute("title")??"";if(o&&vo.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(_o.test(t.id??"")||_o.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&vo.test(i))return!0;if("BUTTON"===t.tagName&&t.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){const e=(t.textContent??"").trim();if("×"===e||"✕"===e||"✗"===e||"X"===e||"x"===e)return!0}return!1}function xo(t){const e=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(const[n,o]of e)try{if(t.closest(n))return o}catch{}return"unknown"}var Ao=null,Eo=[],So=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,Eo)||(Ao=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:d(e),t:Date.now()}))}),Oo=e(t=>{"Escape"===t.key&&Ro("escape")}),$o=e(()=>{Ro("back_nav")});function Uo(){document.removeEventListener("click",So,{capture:!0}),document.removeEventListener("keydown",Oo,{capture:!0}),window.removeEventListener("popstate",$o),Ao=null}function No(){Ao=null}function Ro(t){if(!Ao)return;const e=Date.now()-Ao.t;e>1500||X({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Ao.el,...Ao.label?{el_label:Ao.label}:{},elapsed_ms:e}}),Ao=null}var Co=/^(checkbox|radio)$/,jo=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Lo=new Map,Io=[],Bo=e(t=>{const e=t.target;e&&(p(e,Io)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?Co.test(t.type??""):jo.test(t.getAttribute("role")??"")))(e)&&Xo(e))}),Po=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Io))return;const n=e.getAttribute("role")??"";jo.test(n)&&"INPUT"!==e.tagName&&Xo(e)});function zo(){document.removeEventListener("change",Bo,{capture:!0}),document.removeEventListener("click",Po,{capture:!0}),Lo.clear()}function qo(){Lo.clear()}function Xo(t){const e=a(t),n=Date.now();let o=Lo.get(e);for(o||(o=[],Lo.set(e,o));o.length&&n-o[0].t>1e4;)o.shift();if(o.push({t:n}),o.length<3)return;const r=d(t);X({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),Lo.delete(e)}var Fo=[],Jo=e(t=>{const e=t.target;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t)return;if(e.isContentEditable)return}const n=window.getSelection();if(!n||n.toString().length<2)return;const o=Date.now();for(;Fo.length&&o-Fo[0].t>15e3;)Fo.shift();Fo.push({t:o}),Fo.length<3||(X({t:"sig",ts:o,d:{s:"copy_frustration",cnt:Fo.length,window_ms:15e3}}),Fo=[])});function Zo(){document.addEventListener("copy",Jo,{capture:!0,passive:!0})}function Ho(){document.removeEventListener("copy",Jo,{capture:!0}),Fo=[]}function Vo(){Fo=[]}var Wo=[],Yo=0,Go=null,Ko=null;function Qo(){Go=t(or),Ko=t(nr),document.addEventListener("selectionchange",Go),document.addEventListener("copy",Ko,{capture:!0,passive:!0}),document.addEventListener("cut",Ko,{capture:!0,passive:!0})}function tr(){Go&&(document.removeEventListener("selectionchange",Go),Go=null),Ko&&(document.removeEventListener("copy",Ko,{capture:!0}),document.removeEventListener("cut",Ko,{capture:!0}),Ko=null),Wo=[],Yo=0}function er(){Wo=[],Yo=0}function nr(){Yo=Date.now(),Wo=[]}function or(){const t=window.getSelection();if(!t||t.isCollapsed)return;if(t.toString().length<5)return;const e=t.anchorNode?.parentElement;if(e){const t=e.tagName;if("INPUT"===t||"TEXTAREA"===t||e.isContentEditable)return}const n=Date.now();if(n-Yo<2e3)return;for(;Wo.length&&n-Wo[0].t>15e3;)Wo.shift();const o=Wo[Wo.length-1];o&&n-o.t<500||(Wo.push({t:n}),Wo.length<4||(X({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:Wo.length,window_ms:15e3}}),Wo=[]))}var rr=6e4,ir="_fd_sess",sr={rage_click:25,dead_click:15,speed_frustration:20,thrash_cursor:10,loop_nav:20,scroll_bounce:12,form_hesitation:10,form_abandon:25,error_encounter:30,user_confusion_idle:15,thrash_hover:8,viewport_thrashing:10,scroll_depth_abandon:15,scroll_hijack:12,tab_thrash:15,focus_trap:20,help_hunt:18,close_click:12,close_click_reversal:20,filter_spiral:15,copy_frustration:12,text_select_frustration:10},cr={low:1,medium:2,high:3,critical:4},ar=[],ur=null,lr=!1,fr=new Map,dr={totalSignals:0,pagesWithFrustration:0},pr="",hr=null,wr=null,mr=null,_r=null;function vr(t){lr&&gr(t,Date.now())}function gr(t,e){fr.has(t)||fr.set(t,[]);const n=fr.get(t);n.push(e),n.length>20&&n.shift()}function yr(t){let e="",n=0;for(const[o,r]of t)(r>n||r===n&&o<e)&&(e=o,n=r);return{type:e,count:n}}function br(t,e){if(!lr)return;if("frustration_burst"===t)return;const n=e??Date.now();(t=>{const e=t-rr;let n=0;for(;n<ar.length&&ar[n].ts<e;)n++;n>0&&(ar=ar.slice(n))})(n),0===ar.length&&(ur=null),ar.push({type:t,ts:n}),gr(t,n);const{distinctTypes:o,totalWeight:r,typeCounts:i}=(()=>{const t=new Map;let e=0;for(const n of ar)t.set(n.type,(t.get(n.type)??0)+1),e+=sr[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),s=((t,e,n)=>yr(n).count>=3&&t>=3?"critical":t>=4&&e>=70?"high":t>=3&&e>=40?"medium":t>=2&&e>=20?"low":null)(o.size,r,i);s&&(null!==ur&&cr[s]<=cr[ur]||(ur=s,((t,e,n,o)=>{const r=yr(o),i=(()=>{const t=[],e=Date.now()-rr,n=[];for(const[t,o]of fr.entries())for(const r of o)r>=e&&n.push({type:t,ts:r});n.sort((t,e)=>t.ts-e.ts);for(let e=0;e<n.length;e++)if("rage_click"===n[e].type)for(let o=e+1;o<n.length;o++)if("form_validation_loop"===n[o].type&&n[o].ts-n[e].ts<=3e4){t.push("rage_then_form_loop");break}for(let e=0;e<n.length;e++)if("dead_click"===n[e].type)for(let o=e+1;o<n.length;o++){const r=n[o].type;if(("popstate"===r||"hashchange"===r)&&n[o].ts-n[e].ts<=1e4){t.push("dead_then_bail");break}}for(let e=0;e<n.length;e++)if("form_validation_loop"===n[e].type)for(let o=e+1;o<n.length;o++)if(("visibilitychange"===n[o].type||"pagehide"===n[o].type)&&n[o].ts-n[e].ts<=2e4){t.push("form_loop_then_abandon");break}return t})();X({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:pr||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:rr,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:dr.totalSignals,session_pages_with_frustration:dr.pagesWithFrustration}}),dr.totalSignals+=ar.length,dr.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(ir,JSON.stringify(dr))}catch{}})()})(s,o,r,i)))}function Mr(){lr=!1,ar=[],ur=null,fr=new Map,N(null),hr&&(window.removeEventListener("popstate",hr),hr=null),wr&&(window.removeEventListener("hashchange",wr),wr=null),mr&&(document.removeEventListener("visibilitychange",mr),mr=null),_r&&(window.removeEventListener("pagehide",_r),_r=null)}var kr=3e4,Tr=[],Dr="",xr=!1,Ar=e(()=>{Ur(location.pathname+location.search+location.hash)}),Er=e(()=>{Ur(location.pathname+location.search+location.hash)});function Sr(){Tr=[],xr=!1,Dr=location.pathname+location.search+location.hash,window.addEventListener("popstate",Ar),window.addEventListener("hashchange",Er)}function Or(){window.removeEventListener("popstate",Ar),window.removeEventListener("hashchange",Er),Tr=[],xr=!1,Dr=""}function $r(){Tr=[],xr=!1,Dr=location.pathname+location.search+location.hash}function Ur(t){const e=Date.now();if(Dr&&Dr!==t){const t=Tr[Tr.length-1];t&&t.path===Dr&&null===t.leftAt&&(t.leftAt=e)}for(;Tr.length&&e-Tr[0].ts>kr;)Tr.shift();t!==Dr&&(Tr.push({path:t,ts:e,leftAt:null}),Dr=t),Tr.length<5||xr||(t=>{const e=Tr.filter(e=>t-e.ts<=kr),n=e.filter(t=>null!==t.leftAt),o=new Set(e.map(t=>t.path));if(o.size<5)return;if(0===n.length)return;if(n.some(t=>t.leftAt-t.ts>=5e3))return;if(new Set(n.map(t=>t.path)).size<5)return;const r=n.map(t=>t.leftAt-t.ts),i=Math.round(r.reduce((t,e)=>t+e,0)/r.length),s=Math.max(...r),c=e.map(t=>t.path).slice(-8);xr=!0,X({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:kr,avg_dwell_ms:i,pages:c,max_dwell_ms:s}})})(e)}var Nr=[],Rr=!1,Cr="none",jr=0,Lr=0,Ir=0,Br=!1,Pr=e(()=>{Rr||(Rr=!0,requestAnimationFrame(Jr))}),zr=e(t=>{if(!Br)return;const e=Date.now();if(e-Ir>3e3)return void(Br=!1);if(window.scrollY+t.clientY>Lr+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round(jr-Lr),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,s=i?a(i):"",c=i?d(i):"";Br=!1,jr=window.scrollY,Cr="none",Nr=[],X({t:"sig",ts:e,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:s,...c?{click_el_label:c}:{},scroll_back_pct:r}})});function qr(){Nr=[],Cr="none",jr=0,Lr=0,Ir=0,Br=!1,Rr=!1,window.addEventListener("scroll",Pr,{passive:!0}),window.addEventListener("click",zr,{capture:!0})}function Xr(){window.removeEventListener("scroll",Pr),window.removeEventListener("click",zr,{capture:!0}),Fr()}function Fr(){Nr=[],Cr="none",jr=0,Lr=0,Ir=0,Br=!1,Rr=!1}function Jr(){Rr=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=Nr[Nr.length-1];if(o&&t-o.ts<50)return;if(Nr.push({y:e,ts:t}),Nr.length>60&&(Nr=Nr.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==Cr&&Br&&(Br=!1),e>jr&&(jr=e),void(Cr="down");Br&&t-Ir>3e3&&(Br=!1),"down"===Cr&&jr-e>=.3*n&&!Br&&(Lr=e,Ir=t,Br=!0),Cr="up"}}var Zr=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Hr=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Vr=/^(A|BUTTON|LABEL)$/,Wr=new Map,Yr=[],Gr=null,Kr=e(t=>{Gr={x:t.clientX,y:t.clientY}}),Qr=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Yr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!Gr)return!1;const e=t.clientX-Gr.x,n=t.clientY-Gr.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(Zr.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&Hr.test(e))return!0;if(t.hasAttribute("contenteditable"))return!0;if(t.hasAttribute("tabindex")&&"-1"!==t.getAttribute("tabindex"))return!0;if(t.hasAttribute("onclick")||t.hasAttribute("onmousedown")||t.hasAttribute("onmouseup"))return!0;const n=t.parentElement;return!(!n||!Vr.test(n.tagName))||!!t.closest('a, button, [role="button"], label, [onclick]')})(e))return;const{row:n,col:o}=((t,e)=>{const n=Math.min(3,Math.floor(t/window.innerWidth*4));return{row:Math.min(3,Math.floor(e/window.innerHeight*4)),col:n}})(t.clientX,t.clientY),r=((t,e)=>4*t+e)(n,o),i=Date.now(),s=a(e),c=(Wr.get(r)??[]).filter(t=>i-t.ts<9e4);if(c.push({ts:i,selector:s}),Wr.set(r,c),c.length>=3){const t=new Map;for(const e of c)t.set(e.selector,(t.get(e.selector)??0)+1);let e="",s=0;for(const[n,o]of t)o>s&&(s=o,e=n);const a=new Set,u=[];for(const t of c)if(!a.has(t.selector)&&(a.add(t.selector),u.push(t.selector),u.length>=5))break;const l=(()=>{try{const t=e?document.querySelector(e):null;return t?d(t):""}catch{return""}})();X({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:c.length,dominant_el:e,...l?{dominant_el_label:l}:{},elements:u,window_ms:9e4}}),Wr.set(r,[])}});function ti(){document.removeEventListener("mousedown",Kr,{capture:!0}),document.removeEventListener("click",Qr,{capture:!0}),Gr=null,Wr.clear()}function ei(){Wr.clear()}var ni=12e4,oi=new Map,ri=[],ii=null,si=e(t=>{const e=t.target;e&&wi(e)}),ci=e(t=>{const e=t.target;if(!e||!di(e))return;if(p(e,ri))return;const n=a(e);oi.has(n)||fi(e)&&hi(e,n)});function ai(){document.removeEventListener("invalid",si,{capture:!0}),document.removeEventListener("input",ci,{capture:!0}),document.removeEventListener("change",ci,{capture:!0}),ii&&(ii.disconnect(),ii=null);for(const t of oi.values())pi(t);oi.clear()}function ui(){for(const t of oi.values())pi(t);oi.clear()}function li(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function fi(t){const e=t.getAttribute("aria-invalid");if("true"===e||""===e)return!0;if("validity"in t&&t.validity&&!t.validity.valid)return!0;try{return t.matches(":invalid")}catch{return!1}}function di(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function pi(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function hi(t,n){const o=(t=>e(e=>{_i(t)}))(n),r=(t=>e(e=>{_i(t)}))(n);t.addEventListener("input",o,{passive:!0}),t.addEventListener("change",r,{passive:!0});const i={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:o,changeHandler:r,el:t};return oi.set(n,i),i}function wi(t){if(!di(t))return;if(p(t,ri))return;const e=Date.now();(t=>{for(const[e,n]of oi)t-n.lastTs>ni&&(pi(n),oi.delete(e))})(e);const n=a(t),o=oi.get(n);if(!o)return void hi(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(X({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:ni,field_type:li(t)}}),pi(o),oi.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(X({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...d(t)?{el_label:d(t)}:{},cycles:o.cycles,window_ms:ni,field_type:li(t)}}),pi(o),oi.delete(n)))}function mi(t){if(!di(t))return;const e=Date.now(),n=a(t),o=oi.get(n);return o?e-o.lastTs>ni?(pi(o),void oi.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function _i(t){const e=Date.now(),n=oi.get(t);if(n){if(e-n.lastTs>ni)return pi(n),void oi.delete(t);if(n.lastTs=e,fi(n.el))return n.cycles+=1,void(n.cycles>=3&&(X({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...d(n.el)?{el_label:d(n.el)}:{},cycles:n.cycles,window_ms:ni,field_type:li(n.el)}}),pi(n),oi.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function vi(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!di(t))continue;if(p(t,ri))continue;const n=e.oldValue,o="true"===n||""===n,r=fi(t);r&&!o?wi(t):!r&&o&&mi(t)}}var gi=null,yi=null,bi=[],Mi=0,ki=new Map;function Ti(){gi&&(gi.disconnect(),gi=null),yi&&(yi.disconnect(),yi=null),ki.clear()}function Di(){ki.clear(),gi&&xi()}function xi(){for(const t of bi)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Ai(e[t])}catch{}}function Ai(t){ki.has(t)||(ki.set(t,{firstSeenTs:0,emitted:!1}),gi.observe(t))}function Ei(t){for(const e of t)for(let t=0;t<e.addedNodes.length;t++){const n=e.addedNodes[t];if(n instanceof Element)for(const t of bi)try{n.matches(t)&&Ai(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Ai(e[t])}catch{}}}function Si(t){const e=Date.now();for(const n of t){const t=ki.get(n.target);if(t&&!t.emitted&&n.isIntersecting&&n.intersectionRatio>=.5){t.firstSeenTs||(t.firstSeenTs=e),t.emitted=!0;const o=n.boundingClientRect,r=n.rootBounds?.height??window.innerHeight,i=o.top<.5*r?"above_fold":"below_fold",s=a(n.target),c=d(n.target);X({t:"sig",ts:e,d:{s:"element_impression",el:s,...c?{el_label:c}:{},visible_pct:Math.round(100*n.intersectionRatio),time_to_visible_ms:Math.round(e-Mi),viewport_position:i}})}}}var Oi=new Map,$i=[],Ui=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,$i))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Oi.get(r);if(i){if(n-i.lastTs>6e4)return i.lastValue=o,i.cycles=0,i.phase="typing",void(i.lastTs=n);if(i.lastTs=n,"typing"===i.phase&&i.lastValue.length-o.length>=3)i.phase="deleted";else if("deleted"===i.phase&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=2)){const t=d(e);return X({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:Ci(e)}}),void Oi.delete(r)}i.lastValue=o}else Oi.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function Ni(){document.removeEventListener("input",Ui,{capture:!0}),Oi.clear()}function Ri(){Oi.clear()}function Ci(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var ji=null,Li=2e3,Ii=[],Bi=new Map,Pi=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Ii))return;if(!(t=>{if(/^(A|BUTTON|SELECT)$/.test(t.tagName))return!0;const e=t.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(e))return!0;try{const e=window.getComputedStyle(t);return"pointer"===e.cursor&&"none"!==e.pointerEvents}catch{return!1}})(e))return;const n=a(e);if(ji?.selector===n)return;Ji();const o=Date.now();if(o-(Bi.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=d(e);Bi.set(n,t),ji=null,X({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Li);ji={el:e,selector:n,startTs:r,timer:i}}),zi=e(t=>{if(!ji)return;const e=t.target;if(e!==ji.el&&!ji.el.contains(e))return;const n=t.relatedTarget;n&&ji.el.contains(n)||Ji()}),qi=e(Ji);function Xi(){document.removeEventListener("mouseover",Pi),document.removeEventListener("mouseout",zi),document.removeEventListener("click",qi,{capture:!0}),Ji(),Bi.clear()}function Fi(){Ji(),Bi.clear()}function Ji(){ji&&(clearTimeout(ji.timer),ji=null)}var Zi=0,Hi=0,Vi=null,Wi=t(e=>{if(e.clientY>20)return;const n=Date.now();n-Zi<3e3||n-Hi<6e4||(Vi&&clearTimeout(Vi),Vi=setTimeout(t(()=>{const t=Date.now();Hi=t,Vi=null,X({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-Zi)}})}),500))});function Yi(){Zi=Date.now(),Hi=0,document.addEventListener("mouseleave",Wi)}function Gi(){document.removeEventListener("mouseleave",Wi),Vi&&(clearTimeout(Vi),Vi=null)}function Ki(){Zi=Date.now(),Hi=0,Vi&&(clearTimeout(Vi),Vi=null)}var Qi=null,ts=null,es=null,ns=0;function os(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function rs(){if("undefined"!=typeof PerformanceObserver){try{(Qi=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);X({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:os(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Qi=null}try{(ts=new PerformanceObserver(t(t=>{for(const e of t.getEntries()){const t=e;if(!t.interactionId)continue;const n=Math.round(t.duration);n<200||X({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:os(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{ts=null}try{(es=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(ns+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{es=null}}}function is(){if(es){if(es.disconnect(),es=null,ns>0){const t=Math.round(1e3*ns)/1e3;X({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:os(ns,.1,.25)}})}ns=0}}function ss(){Qi&&(Qi.disconnect(),Qi=null),ts&&(ts.disconnect(),ts=null),is()}function cs(){if(is(),"undefined"!=typeof PerformanceObserver)try{(es=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(ns+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{es=null}}var as=[],us=e(t=>{const e=t.target;if(!e||!(t=>{if("TEXTAREA"===t.tagName)return!0;if("INPUT"===t.tagName){const e=t.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(e)}return!1})(e))return;if(p(e,as))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=d(e);X({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:fs(e)}})},100)});function ls(){document.removeEventListener("paste",us,{capture:!0})}function fs(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var ds=!1,ps=null,hs=null,ws=[],ms="__flusterduck_instance__",_s=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,vs=[];function gs(e){if(ds)return;if(!e.key)return;if(e.key.startsWith("fd_sec_"))return;if(!e.key.startsWith("fd_pub_"))return;if(!1!==e.respectDoNotTrack&&("1"===navigator.doNotTrack||navigator.globalPrivacyControl))return void(hs=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(hs=e);if(!(()=>{const t=window;return!(t[ms]&&t[ms]!==_s||(t[ms]=_s,0))})())return void(hs=e);hs=e,ds=!0,$("none"!==e.transport),"function"==typeof e.onSignal&&ws.push(C(e.onSignal)),e.emitSignalEvents&&ws.push(C(Ds));const r=(t=>{if(t)return i();const e=(()=>{const t=document.cookie.match(new RegExp("(?:^|; )_fd_s=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null})();if(e&&o.test(e))return e;const r=i();return s(n,r,30),r})(e.cookieless??!1),c=(t=>{if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}})(e.endpoint)??"https://api.flusterduck.com/v1/ingest",a=K(location.pathname,e.pageRules??[]),u="metadata"===(l=e.domMode)||"snapshot"===l?l:"off";var l;((t,e,n,o,r)=>{var i;M=t,D=Object.assign(Object.create(null),e),x={domMode:(i=r?.domMode,"metadata"===i||"snapshot"===i?i:"off"),compression:G(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.removeEventListener("visibilitychange",z),window.removeEventListener("pagehide",q),document.addEventListener("visibilitychange",z),window.addEventListener("pagehide",q)})(c,{sid:r,key:e.key,url:location.origin+location.pathname,page:a,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:u,compression:e.compression});const f=As(location.pathname,e.ignorePages??[]);f&&j(!0);const d=document.referrer;let p="";if(d)try{p=new URL(d).origin+new URL(d).pathname}catch{p=""}f||X({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[];vs=[];for(const n of function(e,n,o){const r=t=>{const n=e.signals?.[t];return!1!==n?.enabled},i=!1!==e.trackForms;return[{when:()=>r("rageClick"),start:()=>((t,e)=>{ft||(ft=!0,ot=t?.threshold??3,rt=t?.windowMs??2e3,it=t?.radius&&t.radius>0?t.radius:24,st=[...et,...e??[]],at=Date.now(),nt=[],ct=[],ut.clear(),lt.clear(),document.addEventListener("click",dt,{capture:!0,passive:!0}))})(e.signals?.rageClick,n),stop:pt},{when:()=>r("deadClick"),start:()=>(t=>{_t=t??[],document.addEventListener("mousedown",yt,{capture:!0,passive:!0}),document.addEventListener("click",bt,{capture:!0,passive:!0})})(n),stop:Mt,reset:kt},{when:()=>r("speedFrustration"),start:()=>{const t=e.signals?.speedFrustration;((t,e)=>{At=t?.delayMs??3e3,Et=e??[],document.addEventListener("click",Nt,{capture:!0,passive:!0}),document.addEventListener("keydown",Rt,{capture:!0,passive:!0}),document.addEventListener("touchstart",Ct,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,n)},stop:jt,reset:Lt},{when:()=>!1!==e.trackMouse&&r("thrashCursor"),start:()=>{const t=e.signals?.thrashCursor;var n;n=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,Bt=n?.velocityThreshold??800,Pt=n?.windowMs??2e3,document.addEventListener("mousemove",Kt,{passive:!0})},stop:Qt},{when:()=>r("loopNav"),start:()=>{return t=e.signals?.loopNav,void(oe=t?.windowMs??3e4);var t},stop:re},{when:()=>r("scrollBounce"),start:pe,stop:he,reset:we},{when:()=>i&&(r("formHesitation")||r("formAbandon")),start:()=>{const o=e.signals?.formHesitation;((e,n)=>{Me=e?.pauseMs??5e3,ke=n??[],document.addEventListener("focusin",Te,{capture:!0,passive:!0}),document.addEventListener("focusout",De,{capture:!0,passive:!0}),document.addEventListener("submit",xe,{capture:!0,passive:!0}),window.addEventListener("pagehide",Ae),Ee=t(()=>{"hidden"===document.visibilityState&&$e()}),document.addEventListener("visibilitychange",Ee)})(o?{pauseMs:o.threshold}:void 0,n)},stop:Se,reset:Oe},{when:()=>i&&r("formValidationLoop"),start:()=>(t=>{ri=t??[],document.addEventListener("invalid",si,{capture:!0,passive:!0}),document.addEventListener("input",ci,{capture:!0,passive:!0}),document.addEventListener("change",ci,{capture:!0,passive:!0}),(ii=new MutationObserver(vi)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(n),stop:ai,reset:ui},{when:()=>r("errorEncounter"),start:Ie,stop:Be},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>(t=>{en=t??[],document.addEventListener("touchstart",nn,{passive:!0}),document.addEventListener("touchend",on,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",rn,{passive:!0}),window.addEventListener("orientationchange",sn,{passive:!0})),window.visualViewport?.addEventListener("resize",cn)})(n),stop:an},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>(t=>{mn=t??[],document.addEventListener("keydown",_n,{capture:!0,passive:!0})})(n),stop:vn},{when:()=>r("scrollHijack"),start:$n,stop:Un,reset:Nn},{when:()=>r("scrollDepthAbandon"),start:Pn,stop:zn,reset:qn},{when:()=>r("advancedHeuristics"),start:no,stop:oo,reset:()=>{ro(),Gn=0}},{when:()=>r("helpHunt"),start:()=>(t=>{lo=t??[],document.addEventListener("click",fo,{capture:!0,passive:!0})})(n),stop:po,reset:ho},{when:()=>r("closeClick"),start:()=>(t=>{bo=t??[],document.addEventListener("click",Mo,{capture:!0,passive:!0})})(n),stop:ko,reset:To},{when:()=>r("closeClickReversal"),start:()=>(t=>{Eo=t??[],document.addEventListener("click",So,{capture:!0,passive:!0}),document.addEventListener("keydown",Oo,{capture:!0,passive:!0}),window.addEventListener("popstate",$o)})(n),stop:Uo,reset:No},{when:()=>r("filterSpiral"),start:()=>(t=>{Io=t??[],document.addEventListener("change",Bo,{capture:!0,passive:!0}),document.addEventListener("click",Po,{capture:!0,passive:!0})})(n),stop:zo,reset:qo},{when:()=>r("copyFrustration"),start:Zo,stop:Ho,reset:Vo},{when:()=>r("textSelectFrustration"),start:Qo,stop:tr,reset:er},{when:()=>r("deadClickTrapZone"),start:()=>(t=>{Yr=t??[],document.addEventListener("mousedown",Kr,{capture:!0,passive:!0}),document.addEventListener("click",Qr,{capture:!0,passive:!0})})(n),stop:ti,reset:ei},{when:()=>!0,start:()=>(t=>{ar=[],ur=null,lr=!0,fr=new Map,pr=t??"",(()=>{try{const t=sessionStorage.getItem(ir);if(t){const e=JSON.parse(t);dr={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),N(br),hr=()=>vr("popstate"),wr=()=>vr("hashchange"),mr=()=>{"hidden"===document.visibilityState&&vr("visibilitychange")},_r=()=>vr("pagehide"),window.addEventListener("popstate",hr),window.addEventListener("hashchange",wr),document.addEventListener("visibilitychange",mr),window.addEventListener("pagehide",_r)})(o),stop:Mr},{when:()=>r("navigationConfusion"),start:Sr,stop:Or,reset:$r},{when:()=>r("scrollToClickConfusion"),start:qr,stop:Xr,reset:Fr},{when:()=>r("elementImpression"),start:()=>{return n=e.elementImpressionSelectors,bi=n?.length?n:["[data-fd-impression]"],Mi=Date.now(),void("undefined"!=typeof IntersectionObserver&&(gi=new IntersectionObserver(t(Si),{threshold:[0,.5,1]}),xi(),(yi=new MutationObserver(t(Ei))).observe(document.body,{childList:!0,subtree:!0})));var n},stop:Ti,reset:Di},{when:()=>i&&r("inputCorrection"),start:()=>(t=>{$i=t??[],document.addEventListener("input",Ui,{capture:!0,passive:!0})})(n),stop:Ni,reset:Ri},{when:()=>i&&r("pasteBlocked"),start:()=>(t=>{as=t??[],document.addEventListener("paste",us,{capture:!0,passive:!0})})(n),stop:ls},{when:()=>r("hoverDwell"),start:()=>{const t=e.signals?.hoverDwell;((t,e)=>{Li=t?.dwellMs??2e3,Ii=e??[],document.addEventListener("mouseover",Pi,{passive:!0}),document.addEventListener("mouseout",zi,{passive:!0}),document.addEventListener("click",qi,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,n)},stop:Xi,reset:Fi},{when:()=>r("exitIntent"),start:Yi,stop:Gi,reset:Ki},{when:()=>r("performanceVitals"),start:rs,stop:ss,reset:cs}]}(e,h,a))n.when()&&(n.start(),vs.push({stop:n.stop,reset:n.reset}));ps=function(t){let e=location.href;function n(){const n=location.href;n!==e&&(e=n,t(n,location.pathname))}const o=history.pushState,r=history.replaceState,i=function(...t){o.apply(this,t),n()},s=function(...t){r.apply(this,t),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{history.pushState===i&&(history.pushState=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}(t((t,n)=>{for(const t of vs)t.reset?.();F(),Ur(n),(t=>{pr=t})(n);const o=K(n,e.pageRules??[]),r=As(n,e.ignorePages??[]);j(r),Z({page:o,url:t}),(t=>{const e=Date.now(),n=t.indexOf("#"),o=-1===n?t:t.slice(0,n),r=-1===n?"":t.slice(n);for(;ee.length&&e-ee[0].ts>oe;)ee.shift();for(;ne.length&&e-ne[0].ts>oe;)ne.shift();if(ee.length>=100&&(ee=ee.slice(-50)),ne.length>=100&&(ne=ne.slice(-50)),ee.push({path:t,ts:e}),r){ne.push({path:t,ts:e});const n=ne.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))===o}),r=new Set(n.map(t=>{const e=t.path.indexOf("#");return-1===e?"":t.path.slice(e)}));if(r.size>=3&&n.length>r.size){const t=n.slice(-5).map(t=>t.path);return X({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(ne=ne.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))}}if(ee.length<4)return;let i=!1;const s=[];for(let e=0;e<ee.length-1;e++)if(ee[e].path===t){const t=ee.slice(e,ee.length),n=new Set(t.map(t=>t.path));if(n.size>=2){s.push(...Array.from(n)),i=!0;break}}i&&(X({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:ee.slice(-5).map(t=>t.path)}}),ee=[{path:t,ts:e}],ne=ne.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(n),r||X({t:"pv",ts:Date.now(),d:{ref:""}})}))}function ys(t,e){if(!ds)return;if("string"!=typeof t||!t||t.length>128)return;let n;try{n=JSON.stringify(e?.metadata??{})}catch{return}if(n.length>2048)return;const o=JSON.parse(n);X({t:"sig",ts:Date.now(),d:{s:t.slice(0,128),el:"string"==typeof e?.element?e.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(e?.weight??15,100))}})}function bs(t,e={}){if(!ds)return;if("string"!=typeof t||!/^[a-z0-9_.-]{1,120}$/i.test(t))return;let n;try{n=JSON.stringify(e??{})}catch{return}n.length>2048||X({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function Ms(t){if(!ds)return;if(!t||"object"!=typeof t)return;const e=Object.create(null);let n=0;for(const o of Object.keys(t)){if(n>=20)break;if("__proto__"===o||"constructor"===o||"prototype"===o)continue;const r=t[o];"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||(e[o.slice(0,64)]=String(r).slice(0,256),n++)}Z({segment:e})}function ks(t){t&&hs&&!ds?gs(hs):t||(xs(),r())}function Ts(){xs(),r()}function Ds(t){if("undefined"!=typeof window&&"undefined"!=typeof CustomEvent)try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:t}))}catch{}}function xs(){if(ds){for(const t of ws)t();ws=[],$(!0);for(const t of vs)t.stop();vs=[],F(),S=!1,document.removeEventListener("visibilitychange",z),window.removeEventListener("pagehide",q),b&&(clearTimeout(b),b=null),ps&&(ps(),ps=null),(()=>{const t=window;t[ms]===_s&&delete t[ms]})(),ds=!1}}function As(t,e){for(const n of e)if(n)if(n.endsWith("*")){if(t.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(t.endsWith(n.slice(1)))return!0}else if(t===n)return!0;return!1}function Es(t){if(t)try{const e=new URL(t),n="http:"===e.protocol&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(e.hostname);if("https:"!==e.protocol&&!n)return;return e.origin+e.pathname}catch{return}}(()=>{try{const t=window;if(t.flusterduck)return;const e=document.currentScript;if(!e)return;const n=e.getAttribute("data-key");if(!n)return;const o={key:n,environment:e.getAttribute("data-env")||void 0,endpoint:Es(e.getAttribute("data-endpoint")),debug:"true"===e.getAttribute("data-debug"),cookieless:"true"===e.getAttribute("data-cookieless"),respectDoNotTrack:"false"!==e.getAttribute("data-dnt")},r=e.getAttribute("data-dom-mode");"metadata"!==r&&"snapshot"!==r||(o.domMode=r),"off"===e.getAttribute("data-compression")&&(o.compression="off");const i=e.getAttribute("data-sample");if(i){const t=parseFloat(i);isNaN(t)||(o.sampleRate=Math.max(0,Math.min(t,1)))}const s=e.getAttribute("data-segment");if(s&&s.length<2048)try{const t=JSON.parse(s);if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.create(null);for(const n of Object.keys(t))"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=String(t[n]));o.segment=e}}catch{}gs(o),t.flusterduck=Object.freeze({init:gs,signal:ys,track:bs,identify:Ms,setConsent:ks,optOut:Ts,destroy:xs})}catch{}})()})();
|