flusterduck 0.1.2 → 0.3.0
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 +161 -0
- package/dist/core.d.ts +1 -0
- package/dist/d.global.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/queue.d.ts +2 -0
- package/dist/selector.d.ts +1 -0
- package/dist/signals/advanced-signals.d.ts +4 -0
- package/dist/signals/close-click-reversal.d.ts +3 -0
- package/dist/signals/close-click.d.ts +3 -0
- package/dist/signals/copy-frustration.d.ts +3 -0
- package/dist/signals/dead-click-trap-zone.d.ts +3 -0
- package/dist/signals/dead-click.d.ts +1 -0
- package/dist/signals/element-impression.d.ts +3 -0
- package/dist/signals/exit-intent.d.ts +3 -0
- package/dist/signals/filter-spiral.d.ts +3 -0
- package/dist/signals/form-validation-loop.d.ts +3 -0
- package/dist/signals/frustration-correlator.d.ts +4 -0
- package/dist/signals/help-hunt.d.ts +3 -0
- package/dist/signals/hover-dwell.d.ts +5 -0
- package/dist/signals/index.d.ts +21 -3
- package/dist/signals/input-correction.d.ts +3 -0
- package/dist/signals/keyboard-signals.d.ts +1 -1
- package/dist/signals/navigation-confusion.d.ts +4 -0
- package/dist/signals/paste-blocked.d.ts +2 -0
- package/dist/signals/performance-vitals.d.ts +3 -0
- package/dist/signals/scroll-hijack.d.ts +1 -0
- package/dist/signals/scroll-to-click-confusion.d.ts +3 -0
- package/dist/signals/speed-frustration.d.ts +1 -0
- package/dist/signals/text-select-frustration.d.ts +3 -0
- package/dist/types.d.ts +5 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# flusterduck
|
|
2
|
+
|
|
3
|
+
Lightweight browser SDK for UX friction monitoring. Detects rage clicks, dead clicks, form abandonment, navigation loops, and 20+ other behavioral signals automatically. No configuration required beyond your publishable key.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install flusterduck
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or load via script tag:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script async src="https://flusterduck.com/d.js" data-key="fd_pub_..."></script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Basic usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { init } from 'flusterduck';
|
|
21
|
+
|
|
22
|
+
init({ key: 'fd_pub_...' });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Call `init` once on page load. It's idempotent; calling it again does nothing. The SDK attaches all signal detectors, starts batching events, and observes route changes automatically.
|
|
26
|
+
|
|
27
|
+
## Manual signals
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { signal, track, identify } from 'flusterduck';
|
|
31
|
+
|
|
32
|
+
// Custom friction signal with optional weight (0-100, default 15)
|
|
33
|
+
signal('checkout_error', { element: '#pay-btn', weight: 30 });
|
|
34
|
+
|
|
35
|
+
// Business event for correlation
|
|
36
|
+
track('checkout_started', { plan: 'scale' });
|
|
37
|
+
|
|
38
|
+
// Segment for filtering in the dashboard
|
|
39
|
+
identify({ plan: 'scale', role: 'admin' });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
init({
|
|
46
|
+
key: 'fd_pub_...',
|
|
47
|
+
|
|
48
|
+
// Tag events by environment
|
|
49
|
+
environment: 'production',
|
|
50
|
+
|
|
51
|
+
// Only track a fraction of sessions (0-1)
|
|
52
|
+
sampleRate: 0.5,
|
|
53
|
+
|
|
54
|
+
// Cookieless mode: session ID stored in sessionStorage
|
|
55
|
+
cookieless: false,
|
|
56
|
+
|
|
57
|
+
// Respect DoNotTrack and GlobalPrivacyControl (default: true)
|
|
58
|
+
respectDoNotTrack: true,
|
|
59
|
+
|
|
60
|
+
// Map URL patterns to logical page names
|
|
61
|
+
pageRules: [
|
|
62
|
+
{ pattern: '/checkout/*', label: '/checkout' },
|
|
63
|
+
{ pattern: '/blog/*', label: '/blog' },
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
// Segment all events from this init call
|
|
67
|
+
segment: { plan: 'scale' },
|
|
68
|
+
|
|
69
|
+
// Control individual detectors
|
|
70
|
+
signals: {
|
|
71
|
+
rageClick: { enabled: true },
|
|
72
|
+
deadClick: { enabled: true },
|
|
73
|
+
formHesitation: { enabled: true, threshold: 3000 },
|
|
74
|
+
loopNav: { enabled: true },
|
|
75
|
+
helpHunt: { enabled: false },
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// Skip tracking entirely on these pages
|
|
79
|
+
ignorePages: ['/internal', '/admin'],
|
|
80
|
+
|
|
81
|
+
// Skip signal detection on matching elements
|
|
82
|
+
ignoreElements: ['.no-track', '[data-fd-ignore]'],
|
|
83
|
+
|
|
84
|
+
// DOM evidence capture: 'off' | 'metadata' | 'snapshot'
|
|
85
|
+
domMode: 'metadata',
|
|
86
|
+
|
|
87
|
+
// Event batching
|
|
88
|
+
batchInterval: 2000,
|
|
89
|
+
batchMaxSize: 50,
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Consent and opt-out
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { setConsent, optOut } from 'flusterduck';
|
|
97
|
+
|
|
98
|
+
// Pass true after the user accepts your cookie banner
|
|
99
|
+
setConsent(true);
|
|
100
|
+
|
|
101
|
+
// Permanently opt out: clears session and stops all tracking
|
|
102
|
+
optOut();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`init` defers automatically if `respectDoNotTrack` is enabled and the user's browser signals DNT or Global Privacy Control. Call `setConsent(true)` explicitly to override.
|
|
106
|
+
|
|
107
|
+
## Signal detectors
|
|
108
|
+
|
|
109
|
+
Automatic detectors (all on by default):
|
|
110
|
+
|
|
111
|
+
| Signal | Description |
|
|
112
|
+
|---|---|
|
|
113
|
+
| `rageClick` | 3+ clicks on the same target within 700ms |
|
|
114
|
+
| `deadClick` | Click with no DOM change within 500ms |
|
|
115
|
+
| `speedFrustration` | Server response takes over 3s |
|
|
116
|
+
| `thrashCursor` | High-velocity erratic mouse movement |
|
|
117
|
+
| `loopNav` | Same page visited 3+ times in one session |
|
|
118
|
+
| `scrollBounce` | Scroll to bottom then immediately back |
|
|
119
|
+
| `formHesitation` | Pause over 3s in a form field |
|
|
120
|
+
| `formAbandon` | Form interaction without submission |
|
|
121
|
+
| `formValidationLoop` | 3+ failed submit attempts |
|
|
122
|
+
| `errorEncounter` | Uncaught JS errors or unhandled rejections |
|
|
123
|
+
| `scrollHijack` | Scroll direction reversed by the page |
|
|
124
|
+
| `scrollDepthAbandon` | Scroll past 80% then leave without action |
|
|
125
|
+
| `helpHunt` | Repeated clicks on help/support elements |
|
|
126
|
+
| `closeClick` | Modal/overlay dismissed repeatedly |
|
|
127
|
+
| `filterSpiral` | Rapid filter/sort changes |
|
|
128
|
+
| `copyFrustration` | Copy attempt on non-selectable content |
|
|
129
|
+
| `navigationConfusion` | Back/forward used immediately after navigation |
|
|
130
|
+
| `deadClickTrapZone` | Cluster of dead clicks in one area |
|
|
131
|
+
|
|
132
|
+
Mobile-only (activates automatically on touch devices):
|
|
133
|
+
|
|
134
|
+
| Signal | Description |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `mobileTapMiss` | Tap on non-interactive element |
|
|
137
|
+
| `pinchZoom` | Pinch-to-zoom on non-zoomable content |
|
|
138
|
+
| `swipeFrustration` | Failed swipe gestures |
|
|
139
|
+
|
|
140
|
+
Keyboard:
|
|
141
|
+
|
|
142
|
+
| Signal | Description |
|
|
143
|
+
|---|---|
|
|
144
|
+
| `tabThrash` | Tab key used rapidly without focusing any input |
|
|
145
|
+
| `focusTrap` | Focus trapped in a region |
|
|
146
|
+
| `keyboardNavFrustration` | Arrow key navigation with no visible change |
|
|
147
|
+
|
|
148
|
+
## Lifecycle
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import { destroy } from 'flusterduck';
|
|
152
|
+
|
|
153
|
+
// Tears down all detectors and flushes the event queue
|
|
154
|
+
destroy();
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Route changes in SPAs are detected automatically via History API patching and `popstate`. You don't need to call anything on navigation.
|
|
158
|
+
|
|
159
|
+
## Key format
|
|
160
|
+
|
|
161
|
+
The SDK only accepts publishable keys (`fd_pub_`). If a secret key (`fd_sec_`) is passed, it logs an error and aborts. Nothing is tracked.
|
package/dist/core.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare function signal(name: string, data?: {
|
|
|
6
6
|
metadata?: Record<string, unknown>;
|
|
7
7
|
weight?: number;
|
|
8
8
|
}): void;
|
|
9
|
+
export declare function track(name: string, metadata?: Record<string, unknown>): void;
|
|
9
10
|
export declare function identify(segment: Record<string, string>): void;
|
|
10
11
|
export declare function setConsent(consented: boolean): void;
|
|
11
12
|
export declare function optOut(): void;
|
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 a=/^[:\d]|--|^(ember|react|ng-|__)/;function c(t){if(!t||t===document.documentElement)return"html";const e=t.getAttribute("data-fd");if(e)return`[data-fd="${u(e)}"]`;if(t.id&&!a.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 a=o.parentElement;if(a){const e=a.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 c=n.join(" > ");try{if(1===document.querySelectorAll(c).length)return c}catch(t){}o=a,r++}return n.join(" > ")}function u(t){return"undefined"!=typeof CSS&&CSS.escape?CSS.escape(t):t.replace(/([^\w-])/g,"\\$1")}function l(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 d(t,e){return t&&e.includes(t)?t:null}function f(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 h(t){return t.top<window.innerHeight&&t.bottom>0&&t.left<window.innerWidth&&t.right>0}function p(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 m=[],w=null,b="",g=3e3,y=50,v=null,M={domMode:"off"},_=!1,k=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),D=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),T=/(?:value|text|label|email|e-mail|name|phone|address|password|token|secret|cookie|session|jwt|auth|credential|card|cc|cvv|ssn)/i,A=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,x=e(()=>{"hidden"===document.visibilityState&&S()}),E=t(()=>S());function j(t){m.length>=50||(m.push(t),m.length>=y?S():w||(w=setTimeout(S,g)))}function S(){if(_)return;if(!m.length||!v)return;_=!0,w&&(clearTimeout(w),w=null);const t=m;m=[];const e={v:1,sid:v.sid,key:v.key,url:v.url,page:v.page,ts:Date.now(),ua:v.ua,vw:v.vw,vh:v.vh,environment:v.environment,dom_mode:M.domMode,events:t.map(t=>((t,e,n)=>{const o=t.d??{},r=(t=>"pv"===t?"pageview":"sig"===t?"signal":D.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=R(o.el,o.element,o.target);if("signal"===r){i.signal_type=R(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:c(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:d(t.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:d(t.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:f(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:c(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:p(n)})}const i=[];try{const e=t.getAnimations();for(const t of e)"animationName"in t&&i.push(t.animationName)}catch{}return{selector:c(t),tag:t.tagName.toLowerCase(),role:t.getAttribute("role"),parent:o?c(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:h(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 a=(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=U(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=U(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(a).length&&(i.metadata=a),i})(t,v.page,M.domMode))};try{const t=JSON.stringify(e);t.length<=65536&&O(t,0)}catch{}_=!1}function $(t){if(v)for(const e of Object.keys(t))k.has(e)&&(v[e]=t[e])}function O(t,e){if(b){if(navigator.sendBeacon){const e=new Blob([t],{type:"application/json"});if(navigator.sendBeacon(b,e))return}try{fetch(b,{method:"POST",body:t,headers:{"Content-Type":"application/json"},keepalive:!0}).catch(()=>{e<3&&setTimeout(()=>O(t,e+1),1e3*(e+1))})}catch{}}}function U(t,e="",n=0){if(!(n>4||T.test(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(A.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>U(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=U(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function R(...t){for(const e of t)if("string"==typeof e&&e)return e}function L(t,e){for(const n of e){const e=C(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 N=/^[a-zA-Z0-9/:._*\-]+$/;function C(t){if(t.length>200)return null;if(!N.test(t))return null;const e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var I=[".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"]'],z=[],B=3,F=2e3,q=[],P=e(t=>{const e=t.target;if(!e)return;if(l(e,q))return;if((t=>{const e=t.tagName;return"VIDEO"===e||"AUDIO"===e||!!t.hasAttribute("ondblclick")})(e))return;const n=Date.now(),o=t.clientX,r=t.clientY;for(;z.length&&n-z[0].t>F;)z.shift();if(z.push({t:n,x:o,y:r,el:e}),z.length<B)return;const i=z.slice(-B),s=i[0];for(let t=1;t<i.length;t++){const e=i[t],n=e.x-s.x,o=e.y-s.y;if(n*n+o*o>64)return}const a=(i[i.length-1].t-s.t)/1e3,u=a>0?i.length/a:i.length;j({t:"sig",ts:n,d:{s:"rage_click",el:c(e),cnt:i.length,vel:Math.round(10*u)/10}}),z=[]}),X=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,J=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Z=/^(A|BUTTON|LABEL)$/,H=[],V=null,Y=e(t=>{V={x:t.clientX,y:t.clientY}}),G=e(t=>{if(0!==t.button)return;if(0===t.detail)return;const e=t.target;if(!e)return;if(l(e,H))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!V)return!1;const e=t.clientX-V.x,n=t.clientY-V.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(X.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&J.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;if(n&&Z.test(n.tagName))return!0;if(t.closest('a, button, [role="button"], label, [onclick]'))return!0;try{if("pointer"===getComputedStyle(t).cursor)return!0}catch{return!1}return!1})(e))return;const n=((t,e,n)=>{const o=t.parentElement;if(!o)return null;const r=o.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]');let i=null,s=1/0;for(let t=0;t<r.length;t++){const o=r[t];if(!o)continue;const a=K(e,n,o);a<s&&(s=a,i=o)}return i})(e,t.clientX,t.clientY),o=n?K(t.clientX,t.clientY,n):-1;j({t:"sig",ts:Date.now(),d:{s:"dead_click",el:c(e),near:n?c(n):"",dist:Math.round(o)}})});function K(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 Math.sqrt(r*r+i*i)}var Q=null,W=3e3,tt=[],et=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,nt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,ot=e(t=>{const e=t.target;if(!e)return;if(l(e,tt))return;const n=e.getAttribute("role");if(!(et.test(e.tagName)||n&&nt.test(n)))return;if(Q){if(Q.el===e||Q.el.contains(e)){const t=Date.now()-Q.ts;return t>=W&&j({t:"sig",ts:Date.now(),d:{s:"speed_frustration",el:Q.selector,delay:t}}),void rt()}rt()}const o=c(e);let r=!1;const i=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return r=!0,void rt();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return r=!0,void rt()}}),s=e.parentElement||document.body;i.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const a=setTimeout(()=>{!r&&Q&&(Q={...Q,timeout:null})},W+500);Q={el:e,selector:o,ts:Date.now(),observer:i,timeout:a}});function rt(){Q&&(Q.observer.disconnect(),Q.timeout&&clearTimeout(Q.timeout),Q=null)}var it=800,st=2e3,at=0,ct=0,ut=0,lt=0,dt=0,ft=0,ht=0,pt=0,mt=[],wt=e(t=>{const e=Date.now();e-at<50||(at=e,((t,e,n)=>{if(0===lt)return ct=t,ut=e,lt=n,void(pt=n);const o=(n-lt)/1e3;if(0===o)return;const r=t-ct,i=e-ut,s=Math.sqrt(r*r+i*i)/o;mt.length>=100&&(mt=mt.slice(-50)),mt.push(s);const a=Math.sign(r),c=Math.sign(i);if((0!==dt&&0!==a&&a!==dt||0!==ft&&0!==c&&c!==ft)&&ht++,dt=a||dt,ft=c||ft,ct=t,ut=e,lt=n,n-pt>st){if(ht>=3){const t=mt.reduce((t,e)=>t+e,0)/mt.length;t>=it&&j({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:ht}})}bt(),pt=n}})(t.clientX,t.clientY,e))});function bt(){ht=0,mt=[],dt=0,ft=0,lt=0,ct=0,ut=0}var gt=[],yt=3e4,vt=1e4,Mt=.5,_t=[],kt=0,Dt=0,Tt=!1,At=0,xt=e(()=>{Tt||(Tt=!0,requestAnimationFrame(()=>{Tt=!1,(()=>{const t=Date.now(),e=window.scrollY;if((At=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/At,o=e>kt?"down":"up";if(t-Dt<100)return void(kt=e);for(;_t.length&&t-_t[0].ts>vt;)_t.shift();_t.length>=100&&(_t=_t.slice(-50)),_t.push({depth:n,ts:t,direction:o}),kt=e,Dt=t;let r=0,i=1,s=0,a=!1;for(let t=0;t<_t.length;t++){const e=_t[t].depth;e>r&&(r=e),e>=Mt&&(a=!0),a&&e<i&&(i=e),a&&i<.25&&e>=Mt&&(s++,a=!1,i=1)}s>=1&&(j({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:s+1}}),_t=[])})()}))}),Et=["textarea",'[role="textbox"]',"[contenteditable]"],jt=new Map,St=new Set,$t=null,Ot=0,Ut=5e3,Rt=[],Lt=e(t=>{const e=t.target;if(!e||!Ft(e))return;if(l(e,Rt))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of Et)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;jt.set(e,Date.now());const n=e.closest("form");n&&n!==$t&&($t=n,Ot=n.querySelectorAll("input, select, textarea").length)}),Nt=e(t=>{const e=t.target;if(!e||!Ft(e))return;const n=jt.get(e);if(jt.delete(e),n){const t=Date.now()-n;t>=Ut&&j({t:"sig",ts:Date.now(),d:{s:"form_hesitation",el:c(e),pause:t}})}const o=e.getAttribute("name")||e.getAttribute("id")||c(e);(t=>"value"in t&&t.value.length>0)(e)&&St.add(o)}),Ct=e(()=>{St.clear(),$t=null}),It=t(Bt),zt=null;function Bt(){St.size>0&&$t&&(j({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:St.size,total:Ot||St.size}}),St.clear(),$t=null)}function Ft(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var qt=null,Pt=null,Xt=/flusterduck\.com|\/v1\/ingest/,Jt=e(t=>{j({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Vt(t.message||"Unknown error",200),ep:"",status:0}})}),Zt=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");j({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Vt(e,200),ep:"",status:0}})});function Ht(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 Vt(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 Yt=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Gt=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Kt=null,Qt=0,Wt=0,te=0,ee=0,ne=null,oe=[],re=e(t=>{const e=t.touches[0];1===t.touches.length&&e&&(Kt={x:e.clientX,y:e.clientY,ts:Date.now()})}),ie=e(t=>{if(!Kt)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-Kt.x,o=e.clientY-Kt.y,r=Date.now()-Kt.ts,i=document.elementFromPoint(e.clientX,e.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&((t,e,n)=>{if(l(t,oe))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 a=s.getBoundingClientRect(),c=Math.max(a.left,Math.min(e,a.right)),u=Math.max(a.top,Math.min(n,a.bottom)),l=Math.sqrt((e-c)**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)),a=Math.sqrt((e-i)**2+(n-s)**2);if(a>0&&a<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;j({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:c(o),dist:Math.round(a),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(Yt.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!Yt.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";j({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),Kt=null}),se=e(()=>{const t=Date.now();if(t-Wt>3e4&&(Qt=0,Wt=t),++Qt>=2){const e=document.activeElement||document.body;Gt.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})||j({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:Qt}}),Qt=0}}),ae=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-ee>3e4&&(te=0,ee=t),e!==ne&&(te++,ne=e),te>=3&&(j({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:te}}),te=0)}),ce=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const t=Date.now();t-Wt>3e4&&(Qt=0,Wt=t),++Qt>=2&&(j({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:Qt}}),Qt=0)}}),ue=[],le=null,de=0,fe=0,he=[],pe=e(t=>{const e=Date.now(),n=t.target;n&&l(n,[])||("Tab"===t.key?((t,e)=>{for(;ue.length&&t-ue[0].ts>5e3;)ue.shift();ue.length>=50&&(ue=ue.slice(-25));const n=e?c(e):"";if(ue.push({ts:t,el:n}),ue.length>=10){const e=ue.map(t=>t.el).filter(Boolean);j({t:"sig",ts:t,d:{s:"tab_thrash",cnt:ue.length,els:e}}),ue=[]}if(!e)return;const o=e.closest('[role="dialog"]')||e.closest('[role="menu"]')||e.closest(".modal")||e.closest('[aria-modal="true"]');o&&(o===le?t-fe<=3e3?++de>=5&&(j({t:"sig",ts:t,d:{s:"focus_trap",container:c(o),attempts:de}}),de=0,le=null):(fe=t,de=1):(le=o,fe=t,de=1))})(e,n):"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"]');n&&n===le&&++de>=5&&(j({t:"sig",ts:t,d:{s:"focus_trap",container:c(n),attempts:de}}),de=0,le=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(;he.length&&t-he[0].ts>5e3;)he.shift();he.length>=50&&(he=he.slice(-25)),he.push({ts:t,container:n});const o=he.filter(t=>t.container===n);o.length>=15&&(j({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:c(n),keys:o.length}}),he=[])})(e,t.target))}),me=0,we=0,be=null,ge=0,ye=!1,ve=e(()=>{ye||(ye=!0,requestAnimationFrame(()=>{ye=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-we;if(Math.abs(n)<2)return void(we=e);const o=n>0?"down":"up";be&&o!==be&&(t-ge>3e3&&(me=0,ge=t),++me>=4)&&Math.abs(n)>100&&(j({t:"sig",ts:t,d:{s:"scroll_hijack",rev:me}}),me=0),be=o,we=e})()}))}),Me=0,_e=!1,ke=e(()=>{_e||(_e=!0,requestAnimationFrame(()=>{_e=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>Me&&(Me=e)}}))}),De=t(Ae),Te=null;function Ae(){Me>.05&&j({t:"sig",ts:Date.now(),d:{s:"scroll_depth_abandon",depth:Math.round(100*Me)/100}})}var xe=!1,Ee=null,je=null;function Se(e){if(xe)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;if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return;je=e,xe=!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),a=(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",c=L(location.pathname,e.pageRules??[]),u="metadata"===(l=e.domMode)||"snapshot"===l?l:"off";var l;((t,e,n,o,r)=>{var i;b=t,v=Object.assign(Object.create(null),e),M={domMode:(i=r?.domMode,"metadata"===i||"snapshot"===i?i:"off")},g=Math.max(1e3,Math.min(n??3e3,3e4)),y=Math.max(5,Math.min(o??50,50)),document.addEventListener("visibilitychange",x),window.addEventListener("pagehide",E)})(a,{sid:r,key:e.key,url:location.origin+location.pathname,page:c,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:u});const d=document.referrer;let f="";if(d)try{f=new URL(d).origin+new URL(d).pathname}catch{f=""}j({t:"pv",ts:Date.now(),d:{ref:f}});const h=e.ignoreElements??[],p=t=>{const n=e.signals?.[t];return!1!==n?.enabled};if(p("rageClick")&&((t,e)=>{B=t?.threshold??3,F=t?.windowMs??2e3,q=[...I,...e??[]],document.addEventListener("click",P,{capture:!0,passive:!0})})(e.signals?.rageClick,h),p("deadClick")&&(t=>{H=t??[],document.addEventListener("mousedown",Y,{capture:!0,passive:!0}),document.addEventListener("click",G,{capture:!0,passive:!0})})(h),p("speedFrustration")){const t=e.signals?.speedFrustration;((t,e)=>{W=t?.delayMs??3e3,tt=e??[],document.addEventListener("click",ot,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,h)}var m;if(!1!==e.trackMouse&&p("thrashCursor")&&(m=e.signals?.thrashCursor,it=m?.velocityThreshold??800,st=m?.windowMs??2e3,document.addEventListener("mousemove",wt,{passive:!0})),p("loopNav")&&(t=>{yt=t?.windowMs??3e4})(e.signals?.loopNav),p("scrollBounce")&&(vt=1e4,Mt=.5,window.addEventListener("scroll",xt,{passive:!0})),!1!==e.trackForms&&(p("formHesitation")||p("formAbandon"))){const n=e.signals?.formHesitation;((e,n)=>{Ut=e?.pauseMs??5e3,Rt=n??[],document.addEventListener("focusin",Lt,{capture:!0,passive:!0}),document.addEventListener("focusout",Nt,{capture:!0,passive:!0}),document.addEventListener("submit",Ct,{capture:!0,passive:!0}),window.addEventListener("pagehide",It),zt=t(()=>{"hidden"===document.visibilityState&&Bt()}),document.addEventListener("visibilitychange",zt)})(n?{pauseMs:n.threshold}:void 0,h)}p("errorEncounter")&&(window.addEventListener("error",Jt),window.addEventListener("unhandledrejection",Zt),qt||(qt=window.fetch,Pt=function(t,e){let n;try{n=qt.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;Xt.test(n)||j({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:Ht(n),status:e.status}})}}catch{}return e},e=>{try{const n="string"==typeof t?t:t instanceof URL?t.href:t.url;Xt.test(n)||j({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Vt(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?Ht(t):"",status:0}})}catch{}throw e})},window.fetch=Pt)),("ontouchstart"in window||navigator.maxTouchPoints>0)&&(t=>{oe=t??[],document.addEventListener("touchstart",re,{passive:!0}),document.addEventListener("touchend",ie,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",se,{passive:!0}),window.addEventListener("orientationchange",ae,{passive:!0})),window.visualViewport?.addEventListener("resize",ce)})(h),(p("tabThrash")||p("focusTrap")||p("keyboardNavFrustration"))&&document.addEventListener("keydown",pe,{capture:!0,passive:!0}),p("scrollHijack")&&window.addEventListener("scroll",ve,{passive:!0}),p("scrollDepthAbandon")&&(window.addEventListener("scroll",ke,{passive:!0}),window.addEventListener("pagehide",De),Te=t(()=>{"hidden"===document.visibilityState&&Ae()}),document.addEventListener("visibilitychange",Te)),Ee=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)=>{S(),_t=[],kt=0,Dt=0,jt.clear(),St.clear(),$t=null,Ot=0,Me=0,$({page:L(n,e.pageRules??[]),url:t}),(t=>{const e=Date.now();for(;gt.length&&e-gt[0].ts>yt;)gt.shift();if(gt.length>=100&&(gt=gt.slice(-50)),gt.push({path:t,ts:e}),gt.length<4)return;const n=t;let o=!1;const r=[];for(let t=gt.length-2;t>=1;t--)if(gt[t-1].path===n){const e=gt.slice(t-1,gt.length);for(const t of e)r.includes(t.path)||r.push(t.path);o=!0;break}o&&r.length>=2&&(j({t:"sig",ts:e,d:{s:"loop_nav",pages:r}}),gt=[{path:t,ts:e}])})(n),j({t:"pv",ts:Date.now(),d:{ref:""}})}))}function $e(t,e){if(!xe)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);j({t:"sig",ts:Date.now(),d:{s:"custom",name: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 Oe(t){if(!xe)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++)}$({segment:e})}function Ue(t){t&&je&&!xe?Se(je):t||(Le(),r())}function Re(){Le(),r()}function Le(){xe&&(document.removeEventListener("click",P,{capture:!0}),z=[],document.removeEventListener("mousedown",Y,{capture:!0}),document.removeEventListener("click",G,{capture:!0}),V=null,document.removeEventListener("click",ot,{capture:!0}),rt(),document.removeEventListener("mousemove",wt),bt(),gt=[],window.removeEventListener("scroll",xt),_t=[],document.removeEventListener("focusin",Lt,{capture:!0}),document.removeEventListener("focusout",Nt,{capture:!0}),document.removeEventListener("submit",Ct,{capture:!0}),window.removeEventListener("pagehide",It),zt&&(document.removeEventListener("visibilitychange",zt),zt=null),jt.clear(),St.clear(),$t=null,window.removeEventListener("error",Jt),window.removeEventListener("unhandledrejection",Zt),qt&&Pt&&window.fetch===Pt&&(window.fetch=qt),qt=null,Pt=null,document.removeEventListener("touchstart",re),document.removeEventListener("touchend",ie),document.removeEventListener("gesturechange",se),window.removeEventListener("orientationchange",ae),window.visualViewport?.removeEventListener("resize",ce),document.removeEventListener("keydown",pe,{capture:!0}),ue=[],he=[],le=null,window.removeEventListener("scroll",ve),me=0,we=0,be=null,ge=0,ye=!1,window.removeEventListener("scroll",ke),window.removeEventListener("pagehide",De),Te&&(document.removeEventListener("visibilitychange",Te),Te=null),Me=0,_e=!1,S(),document.removeEventListener("visibilitychange",x),window.removeEventListener("pagehide",E),w&&(clearTimeout(w),w=null),Ee&&(Ee(),Ee=null),xe=!1)}function Ne(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:Ne(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);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{}Se(o),t.flusterduck=Object.freeze({init:Se,signal:$e,identify:Oe,setConsent:Ue,optOut:Re,destroy:Le})}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(){c(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 c(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 s=/^[:\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&&!s.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"),c=o.getAttribute("type");e&&e.length<64?t+=`[name="${u(e)}"]`:i?t+=`[role="${u(i)}"]`:!c||"input"!==t&&"button"!==t||(t+=`[type="${u(c)}"]`);const s=o.parentElement;if(s){const e=s.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=s,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,d=/^(INPUT|TEXTAREA|SELECT)$/;function f(t){try{const e=t.getAttribute("aria-label");if(e)return e.trim().slice(0,60);if(!d.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 m(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 w(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}function $(t){S=t}var U=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),N=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),R=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]),C=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,L=e(()=>{"hidden"===document.visibilityState&&B()}),j=t(()=>B());function I(t){S||b.length>=100||(b.push(t),b.length>=T?B():y||(y=setTimeout(B,k)))}function B(){(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":N.has(t)?t:"custom_signal")(t.t),i={type:r,ts:t.ts,page:"string"==typeof o.page?o.page.slice(0,2048):e},c=F(o.el,o.element,o.target);if("signal"===r){i.signal_type=F(o.s,o.signal_type,o.name)?.slice(0,128),c&&(i.element=c.slice(0,2048));const t=c?((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:m(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:w(e),animations:i,siblings:r}}catch{return null}})(t);return n?{mode:"snapshot",...n}:null})(n,e):null}catch{return null}})(c,n):null;t&&(i.dom=t),i.signal_type&&E&&E(i.signal_type)}const s=(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=X(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=X(t.meta,"meta");n&&"object"==typeof n&&!Array.isArray(n)&&Object.assign(e,n)}return e})(o);return Object.keys(s).length&&(i.metadata=s),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 z({...e,events:o}),o=[t];else{const n={...e,events:[t]};JSON.stringify(n).length<=v&&await z(n),o=[]}else o=n}o.length>0&&await z({...e,events:o})}catch{}finally{A=!1}})()}function P(t){if(D)for(const e of Object.keys(t))U.has(e)&&(D[e]=t[e])}async function z(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 c=0;for(;;){const t=await r.read();if(t.done)break;if(c+=t.value.byteLength,c>v)return null;const e=new Uint8Array(t.value.byteLength);e.set(t.value),i.push(e)}const s=new Uint8Array(c);let a=0;for(const t of i)s.set(t,a),a+=t.byteLength;return s.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&&q(n,0)}function q(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(()=>q(t,e+1,n),1e3*(e+1))})}catch{}}}function X(t,e="",n=0){if(!(n>4||(t=>t.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(t=>R.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(C.test(t))return;return t.slice(0,500)}if(Array.isArray(t))return t.slice(0,20).map(t=>X(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=X(t[o],o,n+1);void 0!==r&&(e[o.slice(0,64)]=r)}return e}}}function F(...t){for(const e of t)if("string"==typeof e&&e)return e}function J(t){return"off"===t?"off":"auto"}function Z(t,e){for(const n of e){const e=V(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 H=/^[a-zA-Z0-9/:._*\-]+$/;function V(t){if(t.length>200)return null;if(!H.test(t))return null;const e=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+e+"$")}catch{return null}}var W=[".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"]'],Y=[],G=3,K=2e3,Q=[],tt=[],et=0,nt=new Map,ot=new Map,rt=!1,it=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Q))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(;Y.length&&n-Y[0].t>K;)Y.shift();Y.push({t:n,x:o,y:r});const i=tt.length>=3?2:G;if(Y.length<i)return;const c=Y.slice(-i);for(let t=0;t<c.length-1;t++)for(let e=t+1;e<c.length;e++){const n=c[t],o=c[e],r=o.x-n.x,i=o.y-n.y;if(r*r+i*i>64)return}const s=(c[c.length-1].t-c[0].t)/1e3,u=s>0?c.length/s:c.length,l=Math.round(100*Math.min(1,(c.length-i)/i+u/10))/100,d=((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],c=t[r],s=c.x-i.x,a=c.y-i.y;e+=Math.sqrt(s*s+a*a),n++}i=Math.max(0,2-e/n/8*2)}return Math.round(Math.min(10,Math.max(0,o+r+i)))})(c,i,u),h=a(e),m=f(e);tt.push({selector:h,ts:n});const w=tt.length,_=(t=>{const e=(t-et)/6e4;return e<=0?0:Math.round(tt.length/e*10)/10})(n),v=nt.get(h)??0,g=v+1,b=ot.get(h)??0,y=b>0&&n-b<1e4;nt.set(h,g),ot.set(h,n);const M=v>=1,k=(()=>{try{const t=e.getBoundingClientRect();if(0===t.width&&0===t.height)return null;const n=c.reduce((t,e)=>t+e.x,0)/c.length,o=c.reduce((t,e)=>t+e.y,0)/c.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}})();I({t:"sig",ts:n,d:{s:"rage_click",el:h,...m?{el_label:m}:{},cnt:c.length,vel:Math.round(10*u)/10,intensity:l,quality:d,burst_seq:w,burst_rate_per_min:_,repeated_target:M,hot_repeat:y,...k??{}}}),M&&I({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:h,...m?{el_label:m}:{},total_hits:g,burst_count:g,burst_seq:w}}),Y=Y.slice(-(i-1))}),ct=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,st=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,at=/^(A|BUTTON|LABEL)$/,ut=[],lt=null,dt=new Map,ft=e(t=>{lt={x:t.clientX,y:t.clientY}}),pt=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,ut))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;const n=(t=>{if(!lt)return!1;const e=t.clientX-lt.x,n=t.clientY-lt.y;return Math.sqrt(e*e+n*n)>5})(t);if(lt=null,n)return;if((t=>{if(ct.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&st.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||!at.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 c=null,s=1/0;for(let o=0;o<i.length;o++){const r=i[o];if(!r||r===t)continue;const a=mt(e,n,r);a<s&&(s=a,c=r)}if(c&&s<100)return c;o=r}return null})(e,t.clientX,t.clientY),r=o?ht(t.clientX,t.clientY,o):null,i=a(e),c=(dt.get(i)??0)+1;dt.set(i,c);const s=c>=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),d=f(e),h=o?f(o):"";I({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...d?{el_label:d}:{},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}:{},...s?{repeated:!0,repeat_cnt:c}:{}}})});function ht(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 mt(t,e,n){return ht(t,e,n).dist}var wt=null,_t=3e3,vt=[],gt="click",bt=0,yt=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Mt=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,kt=e(t=>{const e=t.target;if(!e)return;if(p(e,vt))return;const n=e.getAttribute("role");if(!(yt.test(e.tagName)||n&&Mt.test(n)))return;const o=Date.now();if(o-bt>50&&(gt="click",bt=o),wt){if(wt.el===e||wt.el.contains(e)){const t=o-wt.ts;return t>=_t&&I({t:"sig",ts:o,d:{s:"speed_frustration",el:wt.selector,delay:t,interaction_type:gt,observed_delay_ms:t}}),void xt()}xt()}const r=a(e);let i=!1;const c=new MutationObserver(t=>{for(const n of t){if("childList"===n.type&&(n.addedNodes.length>0||n.removedNodes.length>0))return i=!0,void xt();if("attributes"===n.type&&n.target instanceof Element&&(n.target===e||e.contains(n.target)||n.target.contains(e)))return i=!0,void xt()}}),s=e.parentElement||document.body;c.observe(s,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});const u=setTimeout(()=>{!i&&wt&&(wt.observer.disconnect(),wt={...wt,timeout:null})},_t+500);wt={el:e,selector:r,ts:o,observer:c,timeout:u}}),Tt=e(t=>{t.target&&("Enter"!==t.key&&" "!==t.key||(gt="keydown",bt=Date.now()))}),Dt=e(()=>{gt="touch",bt=Date.now()});function xt(){wt&&(wt.observer.disconnect(),wt.timeout&&clearTimeout(wt.timeout),wt=null)}var At=800,Et=2e3,St=0,Ot=0,$t=0,Ut=0,Nt=0,Rt=0,Ct=0,Lt=0,jt=[],It=0,Bt=null,Pt=e(t=>{const e=Date.now();e-St<16||(St=e,Bt&&clearTimeout(Bt),Bt=setTimeout(()=>zt(),150),((t,e,n)=>{if(0===Ut)return Ot=t,$t=e,Ut=n,void(Lt=n);const o=(n-Ut)/1e3;if(0===o)return;const r=t-Ot,i=e-$t;if(Math.abs(r)<2&&Math.abs(i)<2)return;const c=Math.sqrt(r*r+i*i),s=c/o;jt.length>=100&&(jt=jt.slice(-50)),jt.push(s),It+=c;const a=Math.sign(r),u=Math.sign(i);if(c>=5&&(0!==Nt&&0!==a&&a!==Nt||0!==Rt&&0!==u&&u!==Rt)&&Ct++,Nt=a||Nt,Rt=u||Rt,Ot=t,$t=e,Ut=n,n-Lt>Et){if(Ct>=3){const t=jt.reduce((t,e)=>t+e,0)/jt.length;t>=At&&I({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(t),rev:Ct,distance_px:Math.round(It)}})}zt(),Lt=n}})(t.clientX,t.clientY,e))});function zt(){Ct=0,jt=[],It=0,Nt=0,Rt=0,Ut=0,Ot=0,$t=0,St=0,Bt=null}var qt=[],Xt=[],Ft=3e4,Jt=1e4,Zt=.5,Ht=[],Vt=0,Wt=0,Yt=!1,Gt=0,Kt=e(()=>{Yt||(Yt=!0,requestAnimationFrame(()=>{Yt=!1,(()=>{const t=Date.now(),e=window.scrollY;if((Gt=document.documentElement.scrollHeight-window.innerHeight)<=0)return;const n=e/Gt,o=e>Vt?"down":"up";if(t-Wt<100)return void(Vt=e);for(;Ht.length&&t-Ht[0].ts>Jt;)Ht.shift();Ht.length>=100&&(Ht=Ht.slice(-50)),Ht.push({depth:n,ts:t,direction:o}),Vt=e,Wt=t;let r=0,i=1,c=0,s=!1,a=0,u=0,l=0,d=1,f=0;for(let t=1;t<Ht.length;t++)Ht[t].direction!==Ht[t-1].direction&&f++;for(let t=0;t<Ht.length;t++){const e=Ht[t],n=e.depth;if(n>r&&(r=n),n>=Zt&&(s||(a=e.ts,l=n),s=!0),s&&n<i&&(i=n,u=e.ts,d=n),s&&i<.25&&n>=Zt){if(u-a<200){s=!1,i=1,a=e.ts,l=n;continue}c++,s=!1,i=1}}if(c>=1){const e=Math.max(u-a,1),n=100*Math.abs(l-d),o=Math.round(n/e*1e3);I({t:"sig",ts:t,d:{s:"scroll_bounce",depth:Math.round(100*r)/100,rev:c+1,vel:o,dir_changes:f}}),Ht=[]}})()}))}),Qt=["textarea",'[role="textbox"]',"[contenteditable]"],te=new Map,ee=new Map,ne=new Set,oe=null,re=0,ie=5e3,ce=[],se=e(t=>{const e=t.target;if(!e||!pe(e))return;if(p(e,ce))return;if((t=>{if("TEXTAREA"===t.tagName)return!0;for(const e of Qt)try{if(t.matches(e))return!0}catch{return!1}return!1})(e))return;const n=Date.now();te.set(e,n),ee.set(e,n);const o=e.closest("form");o&&o!==oe&&(oe=o,re=o.querySelectorAll("input, select, textarea").length)}),ae=e(t=>{const e=t.target;if(!e||!pe(e))return;const n=te.get(e),o=ee.get(e);te.delete(e),ee.delete(e);const r=Date.now();if(!(void 0!==o&&r-o<50)&&void 0!==n){const t=r-n;if(t>=ie){const n=f(e);I({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)&&ne.add(i)}),ue=e(()=>{ne.clear(),oe=null}),le=t(fe),de=null;function fe(){if(ne.size>0&&oe){const t=re||ne.size,e=Math.round(ne.size/t*100)/100;I({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:ne.size,total:t,field_count:t,completion_rate:e}}),ne.clear(),oe=null}}function pe(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}var he=null,me=null,we=/flusterduck\.com|\/v1\/ingest/,_e=e(t=>{const e=t.message||"Unknown error";var n;I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Me(e,200),ep:"",status:0,error_category:(n=e,ge.test(n)?"network":"script"),url:location.pathname}})}),ve=e(t=>{const e=t.reason instanceof Error?t.reason.message:String(t.reason??"");I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Me(e,200),ep:"",status:0,error_category:be(t.reason),url:location.pathname}})}),ge=/fetch|network|cors|timeout/i;function be(t){if(t instanceof TypeError&&ge.test(t.message))return"network";if("undefined"!=typeof Response&&t instanceof Response)return"network";const e=t instanceof Error?t.message:String(t??"");return ge.test(e)?"network":"unhandled_promise"}function ye(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 Me(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 ke=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Te=['[class*="map"]',"canvas",".gallery","[data-zoom]"],De=null,xe=0,Ae=1,Ee=0,Se=0,Oe=0,$e=0,Ue=0,Ne=null,Re=[],Ce=e(t=>{const e=t.touches[0];1===t.touches.length&&e?(De={x:e.clientX,y:e.clientY,ts:Date.now()},xe=0):2===t.touches.length&&(xe=Pe(t.touches),De=null)}),Le=e(t=>{if(xe>0){const e=t.touches.length>=2?Pe(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&&(Ae=Math.round(e/xe*100)/100),xe=0}if(!De)return;if(1!==t.changedTouches.length)return;const e=t.changedTouches[0];if(!e)return;const n=e.clientX-De.x,o=e.clientY-De.y,r=Date.now()-De.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,Re))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 c=o[t];if(!c)continue;const s=c.getBoundingClientRect(),a=Math.max(s.left,Math.min(e,s.right)),u=Math.max(s.top,Math.min(n,s.bottom)),l=Math.sqrt((e-a)**2+(n-u)**2);l<i&&l>0&&(i=l,r=c)}return r})(t,e,n);if(!o)return;const r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(e,r.right)),c=Math.max(r.top,Math.min(n,r.bottom)),s=Math.sqrt((e-i)**2+(n-c)**2);if(s>0&&s<=20){const t=`${Math.round(r.width)}x${Math.round(r.height)}`;I({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:a(o),dist:Math.round(s),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(ke.some(e=>{try{return t.matches(e)||t.closest(e)}catch{return!1}}))return;if(!ke.some(t=>{try{return null!==document.querySelector(t)}catch{return!1}}))return;const o=e>0?"right":"left";I({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:o}})})(i,n,o),De=null}),je=e(()=>{const t=Date.now();if(t-Se>3e4&&(Ee=0,Se=t),++Ee>=2){const e=document.activeElement||document.body;!Te.some(t=>{try{return e.matches(t)||e.closest(t)}catch{return!1}})&&t-Oe>200&&(Oe=t,I({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:Ee,pinch_scale:Ae}})),Ee=0,Ae=1}}),Ie=e(()=>{const t=Date.now(),e=screen.orientation?.type||"unknown";t-Ue>3e4&&($e=0,Ue=t),e!==Ne&&($e++,Ne=e),$e>=3&&(I({t:"sig",ts:t,d:{s:"orientation_thrash",cnt:$e,orientation:window.innerWidth>window.innerHeight?"landscape":"portrait"}}),$e=0)}),Be=e(()=>{const t=window.visualViewport;if(t&&t.scale>1.1){const e=Date.now();if(e-Se>3e4&&(Ee=0,Se=e),++Ee>=2&&e-Oe>200){const n=Math.round(100*t.scale)/100;Oe=e,I({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:Ee,pinch_scale:n}}),Ee=0,Ae=1}}});function Pe(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 ze=[],qe=null,Xe=0,Fe=0,Je="",Ze=[],He=[],Ve=e(t=>{const e=Date.now(),n=t.target;n&&p(n,He)||("Tab"===t.key?((t,e,n)=>{for(;ze.length&&t-ze[0].ts>5e3;)ze.shift();ze.length>=50&&(ze=ze.slice(-25));const o=e?a(e):"";if(ze.push({ts:t,el:o,shift:n}),ze.length>=10){const e=ze.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})(ze);I({t:"sig",ts:t,d:{s:"tab_thrash",cnt:ze.length,els:e,direction_changes:n}}),ze=[]}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===qe?t-Fe<=3e3?(Xe++,Je=n,Xe>=5&&(I({t:"sig",ts:t,d:{s:"focus_trap",container:a(r),attempts:Xe,trapped_element:Je}}),Xe=0,Je="",qe=null)):(Fe=t,Xe=1,Je=n):(qe=r,Fe=t,Xe=1,Je=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===qe){if(t-Fe>3e3)return Fe=t,Xe=1,void(Je=a(e));Xe++,Je=a(e),Xe>=5&&(I({t:"sig",ts:t,d:{s:"focus_trap",container:a(n),attempts:Xe,trapped_element:Je}}),Xe=0,Je="",qe=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(;Ze.length&&t-Ze[0].ts>5e3;)Ze.shift();Ze.length>=50&&(Ze=Ze.slice(-25)),Ze.push({ts:t,container:n});const o=Ze.filter(t=>t.container===n);o.length>=15&&(I({t:"sig",ts:t,d:{s:"keyboard_nav_frustration",container:a(n),keys:o.length}}),Ze=[])})(e,t.target))}),We=0,Ye=0,Ge=null,Ke=0,Qe=!1,tn=0,en=0,nn=null,on=0,rn=e(()=>{Qe||(Qe=!0,requestAnimationFrame(()=>{Qe=!1,(()=>{const t=Date.now(),e=window.scrollY,n=e-Ye;if(Math.abs(n)<2)return void(Ye=e);const o=n>0?"down":"up";Ge&&o!==Ge&&(t-Ke>3e3&&(We=0,Ke=t),++We>=4)&&Math.abs(n)>100&&(t-en>1e4&&(tn=0,en=t),tn++,I({t:"sig",ts:t,d:{s:"scroll_hijack",rev:We,source:null!==nn&&t-on<=2e3?nn:"wheel",repeated:tn>=2}}),We=0),Ge=o,Ye=e})()}))}),cn=e(()=>{nn="wheel",on=Date.now()}),sn=e(()=>{nn="touch",on=Date.now()});function an(){We=0,Ye=0,Ge=null,Ke=0,Qe=!1,tn=0,en=0,nn=null,on=0}var un=0,ln=0,dn=!1,fn=e(()=>{dn||(dn=!0,requestAnimationFrame(()=>{dn=!1;const t=document.documentElement.scrollHeight-window.innerHeight;if(t>0){const e=window.scrollY/t;e>un&&(un=e,0===ln&&(ln=Date.now()))}}))}),pn=null,hn=null;function mn(){if(un>.05){const t=Date.now(),e=ln>0?Math.max(0,t-ln):0;I({t:"sig",ts:t,d:{s:"scroll_depth_abandon",depth:Math.round(100*un)/100,max_depth:Math.round(100*un),dwell_ms:e}})}}var wn="",_n=0,vn=0,gn=0,bn=0,yn=0,Mn=null,kn=0,Tn=!1,Dn=e(t=>{if("mouseenter"!==t.type)return;const e=t.target;if(!e)return;const n=a(e),o=Date.now();(n!==wn||o-vn>1500)&&(wn=n,vn=o,_n=0),(_n+=1)<4||(I({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:_n,window_ms:1500}}),_n=0,vn=o)}),xn=e(()=>{const t=Date.now(),e=Sn(),n=yn||e,o=Math.abs(e-n)/Math.max(n,1);yn=e,o<.15||((!gn||t-gn>5e3)&&(gn=t,bn=0),(bn+=1)<3||(I({t:"sig",ts:t,d:{s:"viewport_thrashing",cnt:bn,area_delta:Math.round(1e3*o)/1e3}}),bn=0,gn=t))}),An=e(()=>{En()});function En(){On();const t=kn+=1;Mn=setTimeout(()=>{I({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:15e3,cycle:t}})},15e3)}function Sn(){return Math.max(1,window.innerWidth*window.innerHeight)}function On(){Mn&&(clearTimeout(Mn),Mn=null)}var $n=["[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"]'],Un=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,Nn=[],Rn=[],Cn=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Rn))return;if(!(t=>{let e=t;for(let t=0;t<3&&e;t++){if(Ln(e))return!0;if(jn(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now();for(;Nn.length&&n-Nn[0].t>6e4;)Nn.shift();const o=a(e);if(Nn.push({t:n,el:o}),Nn.length<3)return;const r=new Set(Nn.map(t=>t.el)).size,i=f(e);I({t:"sig",ts:n,d:{s:"help_hunt",cnt:Nn.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:6e4}}),Nn=[]});function Ln(t){for(const e of $n)try{if(t.matches(e))return!0}catch{}return!1}function jn(t){const e=t.id??"",n=t.className??"";return Un.test("string"==typeof n?`${e} ${n}`:e)}var In=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,Bn=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,Pn=[],zn=new Map,qn=[],Xn=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,qn))return;if(!(t=>{let e=t;for(let t=0;t<4&&e;t++){if(Fn(e))return!0;e=e.parentElement}return!1})(e))return;const n=Date.now(),o=a(e),r=f(e);Pn.push({t:n,el:o});const i=(zn.get(o)??0)+1;zn.set(o,i);const c=Pn.length,s=(()=>{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}})();I({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:c,element_cnt:i,repeated:i>1,container:Jn(e),...s??{}}})});function Fn(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&&Bn.test(o))return!0;const r="string"==typeof t.className?t.className:"";if(In.test(t.id??"")||In.test(r))return!0;const i=(t.textContent??"").trim().slice(0,60);if(i&&Bn.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 Jn(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 Zn=null,Hn=[],Vn=e(t=>{if(0!==t.button)return;const e=t.composedPath&&t.composedPath()[0]||t.target;e&&(p(e,Hn)||(Zn=(t=>"A"===t.tagName||null!==t.closest('a, [role="link"], nav'))(e)?null:{el:a(e),label:f(e),t:Date.now()}))}),Wn=e(t=>{"Escape"===t.key&&Gn("escape")}),Yn=e(()=>{Gn("back_nav")});function Gn(t){if(!Zn)return;const e=Date.now()-Zn.t;e>1500||I({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:t,el:Zn.el,...Zn.label?{el_label:Zn.label}:{},elapsed_ms:e}}),Zn=null}var Kn=/^(checkbox|radio)$/,Qn=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,to=new Map,eo=[],no=e(t=>{const e=t.target;e&&(p(e,eo)||(t=>"SELECT"===t.tagName||("INPUT"===t.tagName?Kn.test(t.type??""):Qn.test(t.getAttribute("role")??"")))(e)&&ro(e))}),oo=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,eo))return;const n=e.getAttribute("role")??"";Qn.test(n)&&"INPUT"!==e.tagName&&ro(e)});function ro(t){const e=a(t),n=Date.now();let o=to.get(e);for(o||(o=[],to.set(e,o));o.length&&n-o[0].t>1e4;)o.shift();if(o.push({t:n}),o.length<3)return;const r=f(t);I({t:"sig",ts:n,d:{s:"filter_spiral",el:e,...r?{el_label:r}:{},cnt:o.length,window_ms:1e4}}),to.delete(e)}var io=[],co=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(;io.length&&o-io[0].t>15e3;)io.shift();io.push({t:o}),io.length<3||(I({t:"sig",ts:o,d:{s:"copy_frustration",cnt:io.length,window_ms:15e3}}),io=[])}),so=[],ao=0,uo=null,lo=null;function fo(){ao=Date.now(),so=[]}function po(){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-ao<2e3)return;for(;so.length&&n-so[0].t>15e3;)so.shift();const o=so[so.length-1];o&&n-o.t<500||(so.push({t:n}),so.length<4||(I({t:"sig",ts:n,d:{s:"text_select_frustration",cnt:so.length,window_ms:15e3}}),so=[]))}var ho=6e4,mo="_fd_sess",wo={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},_o={low:1,medium:2,high:3,critical:4},vo=[],go=null,bo=!1,yo=new Map,Mo={totalSignals:0,pagesWithFrustration:0},ko="",To=null,Do=null,xo=null,Ao=null;function Eo(t){bo&&So(t,Date.now())}function So(t,e){yo.has(t)||yo.set(t,[]);const n=yo.get(t);n.push(e),n.length>20&&n.shift()}function Oo(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 $o(t){if(!bo)return;if("frustration_burst"===t)return;const e=Date.now();(t=>{const e=t-ho;let n=0;for(;n<vo.length&&vo[n].ts<e;)n++;n>0&&(vo=vo.slice(n))})(e),0===vo.length&&(go=null),vo.push({type:t,ts:e}),So(t,e);const{distinctTypes:n,totalWeight:o,typeCounts:r}=(()=>{const t=new Map;let e=0;for(const n of vo)t.set(n.type,(t.get(n.type)??0)+1),e+=wo[n.type]??10;return{distinctTypes:new Set(t.keys()),totalWeight:e,typeCounts:t}})(),i=((t,e,n)=>Oo(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!==go&&_o[i]<=_o[go]||(go=i,((t,e,n,o)=>{const r=Oo(o),i=(()=>{const t=[],e=Date.now()-ho,n=[];for(const[t,o]of yo.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})();I({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:t,page:ko||void 0,distinct_types:e.size,total_weight:n,signals:Array.from(e).sort(),window_ms:ho,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:Mo.totalSignals,session_pages_with_frustration:Mo.pagesWithFrustration}}),Mo.totalSignals+=vo.length,Mo.pagesWithFrustration+=1,(()=>{try{sessionStorage.setItem(mo,JSON.stringify(Mo))}catch{}})()})(i,n,o,r)))}var Uo=3e4,No=[],Ro="",Co=!1,Lo=e(()=>{Io(location.pathname+location.search+location.hash)}),jo=e(()=>{Io(location.pathname+location.search+location.hash)});function Io(t){const e=Date.now();if(Ro&&Ro!==t){const t=No[No.length-1];t&&t.path===Ro&&null===t.leftAt&&(t.leftAt=e)}for(;No.length&&e-No[0].ts>Uo;)No.shift();t!==Ro&&(No.push({path:t,ts:e,leftAt:null}),Ro=t),No.length<5||Co||(t=>{const e=No.filter(e=>t-e.ts<=Uo),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),c=Math.max(...r),s=e.map(t=>t.path).slice(-8);Co=!0,I({t:"sig",ts:t,d:{s:"navigation_confusion",page_count:o.size,window_ms:Uo,avg_dwell_ms:i,pages:s,max_dwell_ms:c}})})(e)}var Bo=[],Po=!1,zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Zo=e(()=>{Po||(Po=!0,requestAnimationFrame(Wo))}),Ho=e(t=>{if(!Jo)return;const e=Date.now();if(e-Fo>3e3)return void(Jo=!1);if(window.scrollY+t.clientY>Xo+.1*window.innerHeight)return;const n=window.innerHeight,o=Math.round(qo-Xo),r=Math.round(o/n*100),i=t.target instanceof Element?t.target:null,c=i?a(i):"",s=i?f(i):"";Jo=!1,qo=window.scrollY,zo="none",Bo=[],I({t:"sig",ts:e,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:c,...s?{click_el_label:s}:{},scroll_back_pct:r}})});function Vo(){Bo=[],zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Po=!1}function Wo(){Po=!1;const t=Date.now(),e=window.scrollY,n=window.innerHeight,o=Bo[Bo.length-1];if(o&&t-o.ts<50)return;if(Bo.push({y:e,ts:t}),Bo.length>60&&(Bo=Bo.slice(-40)),!o)return;const r=e-o.y;if(!(Math.abs(r)<2)){if("down"==(r>0?"down":"up"))return"down"!==zo&&Jo&&(Jo=!1),e>qo&&(qo=e),void(zo="down");Jo&&t-Fo>3e3&&(Jo=!1),"down"===zo&&qo-e>=.3*n&&!Jo&&(Xo=e,Fo=t,Jo=!0),zo="up"}}var Yo=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Go=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Ko=/^(A|BUTTON|LABEL)$/,Qo=new Map,tr=[],er=null,nr=e(t=>{er={x:t.clientX,y:t.clientY}}),or=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,tr))return;if((()=>{const t=window.getSelection();return null!==t&&t.toString().length>0})())return;if((t=>{if(!er)return!1;const e=t.clientX-er.x,n=t.clientY-er.y;return Math.sqrt(e*e+n*n)>5})(t))return;if((t=>{if(Yo.test(t.tagName))return!0;const e=t.getAttribute("role");if(e&&Go.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||!Ko.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(),c=a(e),s=(Qo.get(r)??[]).filter(t=>i-t.ts<9e4);if(s.push({ts:i,selector:c}),Qo.set(r,s),s.length>=3){const t=new Map;for(const e of s)t.set(e.selector,(t.get(e.selector)??0)+1);let e="",c=0;for(const[n,o]of t)o>c&&(c=o,e=n);const a=new Set,u=[];for(const t of s)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?f(t):""}catch{return""}})();I({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:s.length,dominant_el:e,...l?{dominant_el_label:l}:{},elements:u,window_ms:9e4}}),Qo.set(r,[])}}),rr=12e4,ir=new Map,cr=[],sr=null,ar=e(t=>{const e=t.target;e&&mr(e)}),ur=e(t=>{const e=t.target;if(!e||!fr(e))return;if(p(e,cr))return;const n=a(e);ir.has(n)||dr(e)&&hr(e,n)});function lr(t){const e=t.tagName.toLowerCase();return"select"===e?"select":"textarea"===e?"textarea":"input"===e?t.type||"text":e}function dr(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 fr(t){const e=t.tagName;return"INPUT"===e||"SELECT"===e||"TEXTAREA"===e}function pr(t){t.el.removeEventListener("input",t.inputHandler),t.el.removeEventListener("change",t.changeHandler)}function hr(t,n){const o=(t=>e(e=>{_r(t)}))(n),r=(t=>e(e=>{_r(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 ir.set(n,i),i}function mr(t){if(!fr(t))return;if(p(t,cr))return;const e=Date.now();(t=>{for(const[e,n]of ir)t-n.lastTs>rr&&(pr(n),ir.delete(e))})(e);const n=a(t),o=ir.get(n);if(!o)return void hr(t,n);const r=o.lastTs;o.lastTs=e,"edited"===o.phase?(o.cycles+=1,o.phase="invalid",o.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...f(t)?{el_label:f(t)}:{},cycles:o.cycles,window_ms:rr,field_type:lr(t)}}),pr(o),ir.delete(n))):"invalid"===o.phase&&e-r>500&&(o.cycles+=1,o.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:n,...f(t)?{el_label:f(t)}:{},cycles:o.cycles,window_ms:rr,field_type:lr(t)}}),pr(o),ir.delete(n)))}function wr(t){if(!fr(t))return;const e=Date.now(),n=a(t),o=ir.get(n);return o?e-o.lastTs>rr?(pr(o),void ir.delete(n)):void("invalid"===o.phase&&(o.phase="edited",o.lastTs=e)):void 0}function _r(t){const e=Date.now(),n=ir.get(t);if(n){if(e-n.lastTs>rr)return pr(n),void ir.delete(t);if(n.lastTs=e,dr(n.el))return n.cycles+=1,void(n.cycles>=3&&(I({t:"sig",ts:e,d:{s:"form_validation_loop",el:t,...f(n.el)?{el_label:f(n.el)}:{},cycles:n.cycles,window_ms:rr,field_type:lr(n.el)}}),pr(n),ir.delete(t)));"invalid"===n.phase&&(n.phase="edited")}}function vr(t){for(const e of t){if("attributes"!==e.type)continue;if("aria-invalid"!==e.attributeName)continue;const t=e.target;if(!fr(t))continue;if(p(t,cr))continue;const n=e.oldValue,o="true"===n||""===n,r=dr(t);r&&!o?mr(t):!r&&o&&wr(t)}}var gr=null,br=null,yr=[],Mr=0,kr=new Map;function Tr(){for(const t of yr)try{const e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)Dr(e[t])}catch{}}function Dr(t){kr.has(t)||(kr.set(t,{firstSeenTs:0,emitted:!1}),gr.observe(t))}function xr(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 yr)try{n.matches(t)&&Dr(n);const e=n.querySelectorAll(t);for(let t=0;t<e.length;t++)Dr(e[t])}catch{}}}function Ar(t){const e=Date.now();for(const n of t){const t=kr.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",c=a(n.target),s=f(n.target);I({t:"sig",ts:e,d:{s:"element_impression",el:c,...s?{el_label:s}:{},visible_pct:Math.round(100*n.intersectionRatio),time_to_visible_ms:Math.round(e-Mr),viewport_position:i}})}}}var Er=new Map,Sr=[],Or=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,Sr))return;const n=Date.now(),o=e.value??"",r=a(e);let i=Er.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=f(e);return I({t:"sig",ts:n,d:{s:"input_correction",el:r,...t?{el_label:t}:{},cycles:i.cycles,field_type:$r(e)}}),void Er.delete(r)}i.lastValue=o}else Er.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n})});function $r(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var Ur=null,Nr=2e3,Rr=[],Cr=new Map,Lr=e(t=>{const e=t.composedPath&&t.composedPath()[0]||t.target;if(!e)return;if(p(e,Rr))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(Ur?.selector===n)return;Br();const o=Date.now();if(o-(Cr.get(n)??0)<3e4)return;const r=o,i=setTimeout(()=>{const t=Date.now(),o=f(e);Cr.set(n,t),Ur=null,I({t:"sig",ts:t,d:{s:"hover_dwell",el:n,...o?{el_label:o}:{},dwell_ms:Math.round(t-r)}})},Nr);Ur={el:e,selector:n,startTs:r,timer:i}}),jr=e(t=>{if(!Ur)return;const e=t.target;if(e!==Ur.el&&!Ur.el.contains(e))return;const n=t.relatedTarget;n&&Ur.el.contains(n)||Br()}),Ir=e(Br);function Br(){Ur&&(clearTimeout(Ur.timer),Ur=null)}var Pr=0,zr=0,qr=null,Xr=t(e=>{if(e.clientY>20)return;const n=Date.now();n-Pr<3e3||n-zr<6e4||(qr&&clearTimeout(qr),qr=setTimeout(t(()=>{const t=Date.now();zr=t,qr=null,I({t:"sig",ts:t,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(t-Pr)}})}),500))}),Fr=null,Jr=null,Zr=null,Hr=0;function Vr(t,e,n){return t<=e?"good":t<=n?"needs_improvement":"poor"}function Wr(){if(Zr){if(Zr.disconnect(),Zr=null,Hr>0){const t=Math.round(1e3*Hr)/1e3;I({t:"sig",ts:Date.now(),d:{s:"cls",value:t,rating:Vr(Hr,.1,.25)}})}Hr=0}}var Yr=[],Gr=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,Yr))return;const n=e.value??"";setTimeout(()=>{if((e.value??"")!==n)return;const t=a(e),o=f(e);I({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:t,...o?{el_label:o}:{},field_type:Kr(e)}})},100)});function Kr(t){return"TEXTAREA"===t.tagName?"textarea":t.type?.toLowerCase()||"text"}var Qr=!1,ti=null,ei=null;function ni(e){if(Qr)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(ei=e);if(void 0!==e.sampleRate&&e.sampleRate<1&&Math.random()>e.sampleRate)return void(ei=e);ei=e,Qr=!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 c(n,r,30),r})(e.cookieless??!1),s=(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=Z(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:J(r?.compression)},k=Math.max(500,Math.min(n??7e3,1e4)),T=Math.max(1,Math.min(o??50,100)),document.addEventListener("visibilitychange",L),window.addEventListener("pagehide",j)})(s,{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 d=ui(location.pathname,e.ignorePages??[]);d&&$(!0);const f=document.referrer;let p="";if(f)try{p=new URL(f).origin+new URL(f).pathname}catch{p=""}d||I({t:"pv",ts:Date.now(),d:{ref:p}});const h=e.ignoreElements??[],m=t=>{const n=e.signals?.[t];return!1!==n?.enabled};if(m("rageClick")&&((t,e)=>{rt||(rt=!0,G=t?.threshold??3,K=t?.windowMs??2e3,Q=[...W,...e??[]],et=Date.now(),Y=[],tt=[],nt.clear(),ot.clear(),document.addEventListener("click",it,{capture:!0,passive:!0}))})(e.signals?.rageClick,h),m("deadClick")&&(t=>{ut=t??[],document.addEventListener("mousedown",ft,{capture:!0,passive:!0}),document.addEventListener("click",pt,{capture:!0,passive:!0})})(h),m("speedFrustration")){const t=e.signals?.speedFrustration;((t,e)=>{_t=t?.delayMs??3e3,vt=e??[],document.addEventListener("click",kt,{capture:!0,passive:!0}),document.addEventListener("keydown",Tt,{capture:!0,passive:!0}),document.addEventListener("touchstart",Dt,{capture:!0,passive:!0})})(t?{delayMs:t.windowMs}:void 0,h)}if(!1!==e.trackMouse&&m("thrashCursor")){const t=e.signals?.thrashCursor;w=t?{velocityThreshold:t.threshold,windowMs:t.windowMs}:void 0,At=w?.velocityThreshold??800,Et=w?.windowMs??2e3,document.addEventListener("mousemove",Pt,{passive:!0})}var w,_;if(m("loopNav")&&(t=>{Ft=t?.windowMs??3e4})(e.signals?.loopNav),m("scrollBounce")&&(Jt=1e4,Zt=.5,window.addEventListener("scroll",Kt,{passive:!0})),!1!==e.trackForms){if(m("formHesitation")||m("formAbandon")){const n=e.signals?.formHesitation;((e,n)=>{ie=e?.pauseMs??5e3,ce=n??[],document.addEventListener("focusin",se,{capture:!0,passive:!0}),document.addEventListener("focusout",ae,{capture:!0,passive:!0}),document.addEventListener("submit",ue,{capture:!0,passive:!0}),window.addEventListener("pagehide",le),de=t(()=>{"hidden"===document.visibilityState&&fe()}),document.addEventListener("visibilitychange",de)})(n?{pauseMs:n.threshold}:void 0,h)}m("formValidationLoop")&&(t=>{cr=t??[],document.addEventListener("invalid",ar,{capture:!0,passive:!0}),document.addEventListener("input",ur,{capture:!0,passive:!0}),document.addEventListener("change",ur,{capture:!0,passive:!0}),(sr=new MutationObserver(vr)).observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})})(h)}if(m("errorEncounter")&&(window.addEventListener("error",_e),window.addEventListener("unhandledrejection",ve),he||(he=window.fetch,me=function(t,e){let n;try{n=he.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;we.test(n)||I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${e.status} ${e.statusText}`,ep:ye(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;we.test(n)||I({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Me(e instanceof Error?e.message:"Fetch failed",200),ep:"string"==typeof t?ye(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw e})},window.fetch=me)),("ontouchstart"in window||navigator.maxTouchPoints>0)&&(t=>{Re=t??[],document.addEventListener("touchstart",Ce,{passive:!0}),document.addEventListener("touchend",Le,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",je,{passive:!0}),window.addEventListener("orientationchange",Ie,{passive:!0})),window.visualViewport?.addEventListener("resize",Be)})(h),(m("tabThrash")||m("focusTrap")||m("keyboardNavFrustration"))&&(t=>{He=t??[],document.addEventListener("keydown",Ve,{capture:!0,passive:!0})})(h),m("scrollHijack")&&(window.addEventListener("wheel",cn,{passive:!0}),window.addEventListener("touchmove",sn,{passive:!0}),window.addEventListener("scroll",rn,{passive:!0})),m("scrollDepthAbandon")&&(window.addEventListener("scroll",fn,{passive:!0}),hn=t(mn),window.addEventListener("pagehide",hn),pn=t(()=>{"hidden"===document.visibilityState&&mn()}),document.addEventListener("visibilitychange",pn)),m("advancedHeuristics")&&(Tn||(Tn=!0,yn=Sn(),En(),document.addEventListener("mouseenter",Dn,!0),document.addEventListener("mouseleave",Dn,!0),document.addEventListener("click",An,{capture:!0,passive:!0}),document.addEventListener("keydown",An,{capture:!0,passive:!0}),document.addEventListener("scroll",An,{passive:!0}),window.addEventListener("resize",xn,{passive:!0}))),m("helpHunt")&&(t=>{Rn=t??[],document.addEventListener("click",Cn,{capture:!0,passive:!0})})(h),m("closeClick")&&(t=>{qn=t??[],document.addEventListener("click",Xn,{capture:!0,passive:!0})})(h),m("closeClickReversal")&&(t=>{Hn=t??[],document.addEventListener("click",Vn,{capture:!0,passive:!0}),document.addEventListener("keydown",Wn,{capture:!0,passive:!0}),window.addEventListener("popstate",Yn)})(h),m("filterSpiral")&&(t=>{eo=t??[],document.addEventListener("change",no,{capture:!0,passive:!0}),document.addEventListener("click",oo,{capture:!0,passive:!0})})(h),m("copyFrustration")&&document.addEventListener("copy",co,{capture:!0,passive:!0}),m("textSelectFrustration")&&(uo=t(po),lo=t(fo),document.addEventListener("selectionchange",uo),document.addEventListener("copy",lo,{capture:!0,passive:!0}),document.addEventListener("cut",lo,{capture:!0,passive:!0})),m("deadClickTrapZone")&&(t=>{tr=t??[],document.addEventListener("mousedown",nr,{capture:!0,passive:!0}),document.addEventListener("click",or,{capture:!0,passive:!0})})(h),(t=>{vo=[],go=null,bo=!0,yo=new Map,ko=t??"",(()=>{try{const t=sessionStorage.getItem(mo);if(t){const e=JSON.parse(t);Mo={totalSignals:"number"==typeof e.totalSignals?e.totalSignals:0,pagesWithFrustration:"number"==typeof e.pagesWithFrustration?e.pagesWithFrustration:0}}}catch{}})(),O($o),To=()=>Eo("popstate"),Do=()=>Eo("hashchange"),xo=()=>{"hidden"===document.visibilityState&&Eo("visibilitychange")},Ao=()=>Eo("pagehide"),window.addEventListener("popstate",To),window.addEventListener("hashchange",Do),document.addEventListener("visibilitychange",xo),window.addEventListener("pagehide",Ao)})(a),m("navigationConfusion")&&(No=[],Co=!1,Ro=location.pathname+location.search+location.hash,window.addEventListener("popstate",Lo),window.addEventListener("hashchange",jo)),m("scrollToClickConfusion")&&(Bo=[],zo="none",qo=0,Xo=0,Fo=0,Jo=!1,Po=!1,window.addEventListener("scroll",Zo,{passive:!0}),window.addEventListener("click",Ho,{capture:!0})),m("elementImpression")&&(_=e.elementImpressionSelectors,yr=_?.length?_:["[data-fd-impression]"],Mr=Date.now(),"undefined"!=typeof IntersectionObserver&&(gr=new IntersectionObserver(t(Ar),{threshold:[0,.5,1]}),Tr(),(br=new MutationObserver(t(xr))).observe(document.body,{childList:!0,subtree:!0}))),!1!==e.trackForms&&m("inputCorrection")&&(t=>{Sr=t??[],document.addEventListener("input",Or,{capture:!0,passive:!0})})(h),!1!==e.trackForms&&m("pasteBlocked")&&(t=>{Yr=t??[],document.addEventListener("paste",Gr,{capture:!0,passive:!0})})(h),m("hoverDwell")){const t=e.signals?.hoverDwell;((t,e)=>{Nr=t?.dwellMs??2e3,Rr=e??[],document.addEventListener("mouseover",Lr,{passive:!0}),document.addEventListener("mouseout",jr,{passive:!0}),document.addEventListener("click",Ir,{capture:!0,passive:!0})})(t?.threshold?{dwellMs:t.threshold}:void 0,h)}m("exitIntent")&&(Pr=Date.now(),zr=0,document.addEventListener("mouseleave",Xr)),m("performanceVitals")&&(()=>{if("undefined"!=typeof PerformanceObserver){try{(Fr=new PerformanceObserver(t(t=>{const e=t.getEntries(),n=e[e.length-1];if(!n)return;const o=Math.round(n.startTime);I({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Vr(o,2500,4e3)}})}))).observe({type:"largest-contentful-paint",buffered:!0})}catch{Fr=null}try{(Jr=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||I({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:n,rating:Vr(n,200,500)}})}}))).observe({type:"event",buffered:!1,durationThreshold:200})}catch{Jr=null}try{(Zr=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Hr+=e.value)}))).observe({type:"layout-shift",buffered:!0})}catch{Zr=null}}})(),ti=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()},c=function(...t){r.apply(this,t),n()};return history.pushState=i,history.replaceState=c,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{history.pushState===i&&(history.pushState=o),history.replaceState===c&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}(t((n,o)=>{B(),Ht=[],Vt=0,Wt=0,Yt=!1,te.clear(),ee.clear(),ne.clear(),oe=null,re=0,un=0,ln=0,dn=!1,xt(),En(),kn=0,Nn=[],Pn=[],zn.clear(),Zn=null,to.clear(),io=[],so=[],ao=0,Qo.clear(),(()=>{for(const t of ir.values())pr(t);ir.clear()})(),dt.clear(),an(),Vo(),No=[],Co=!1,Ro=location.pathname+location.search+location.hash,kr.clear(),gr&&Tr(),Er.clear(),Br(),Cr.clear(),Pr=Date.now(),zr=0,qr&&(clearTimeout(qr),qr=null),(()=>{if(Wr(),"undefined"!=typeof PerformanceObserver)try{(Zr=new PerformanceObserver(t(t=>{for(const e of t.getEntries())e.hadRecentInput||(Hr+=e.value)}))).observe({type:"layout-shift",buffered:!1})}catch{Zr=null}})(),Io(o),(t=>{ko=t})(o);const r=Z(o,e.pageRules??[]),i=ui(o,e.ignorePages??[]);$(i),P({page:r,url:n}),(t=>{const e=Date.now(),n=t.indexOf("#"),o=-1===n?t:t.slice(0,n),r=-1===n?"":t.slice(n);for(;qt.length&&e-qt[0].ts>Ft;)qt.shift();for(;Xt.length&&e-Xt[0].ts>Ft;)Xt.shift();if(qt.length>=100&&(qt=qt.slice(-50)),Xt.length>=100&&(Xt=Xt.slice(-50)),qt.push({path:t,ts:e}),r){Xt.push({path:t,ts:e});const n=Xt.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 I({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(r).map(t=>o+t),path_sequence:t}}),void(Xt=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))}}if(qt.length<4)return;let i=!1;const c=[];for(let e=0;e<qt.length-1;e++)if(qt[e].path===t){const t=qt.slice(e,qt.length),n=new Set(t.map(t=>t.path));if(n.size>=2){c.push(...Array.from(n)),i=!0;break}}i&&(I({t:"sig",ts:e,d:{s:"loop_nav",loop_type:"path",pages:c,path_sequence:qt.slice(-5).map(t=>t.path)}}),qt=[{path:t,ts:e}],Xt=Xt.filter(t=>{const e=t.path.indexOf("#");return(-1===e?t.path:t.path.slice(0,e))!==o}))})(o),i||I({t:"pv",ts:Date.now(),d:{ref:""}})}))}function oi(t,e){if(!Qr)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);I({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 ri(t,e={}){if(!Qr)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||I({t:"custom_signal",ts:Date.now(),d:{business_event:t.slice(0,120),meta:JSON.parse(n)}})}function ii(t){if(!Qr)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++)}P({segment:e})}function ci(t){t&&ei&&!Qr?ni(ei):t||(ai(),r())}function si(){ai(),r()}function ai(){Qr&&(rt&&(rt=!1,document.removeEventListener("click",it,{capture:!0,passive:!0}),Y=[],tt=[],nt.clear(),ot.clear()),document.removeEventListener("mousedown",ft,{capture:!0}),document.removeEventListener("click",pt,{capture:!0}),lt=null,dt.clear(),document.removeEventListener("click",kt,{capture:!0}),document.removeEventListener("keydown",Tt,{capture:!0}),document.removeEventListener("touchstart",Dt,{capture:!0}),xt(),document.removeEventListener("mousemove",Pt),Bt&&clearTimeout(Bt),zt(),qt=[],Xt=[],window.removeEventListener("scroll",Kt),Ht=[],Yt=!1,document.removeEventListener("focusin",se,{capture:!0}),document.removeEventListener("focusout",ae,{capture:!0}),document.removeEventListener("submit",ue,{capture:!0}),window.removeEventListener("pagehide",le),de&&(document.removeEventListener("visibilitychange",de),de=null),te.clear(),ee.clear(),ne.clear(),oe=null,window.removeEventListener("error",_e),window.removeEventListener("unhandledrejection",ve),he&&me&&window.fetch===me&&(window.fetch=he),he=null,me=null,document.removeEventListener("touchstart",Ce),document.removeEventListener("touchend",Le),document.removeEventListener("gesturechange",je),window.removeEventListener("orientationchange",Ie),window.visualViewport?.removeEventListener("resize",Be),De=null,xe=0,Ae=1,Ee=0,Se=0,Oe=0,$e=0,Ue=0,Ne=null,document.removeEventListener("keydown",Ve,{capture:!0}),ze=[],Ze=[],qe=null,Xe=0,Fe=0,Je="",He=[],window.removeEventListener("wheel",cn),window.removeEventListener("touchmove",sn),window.removeEventListener("scroll",rn),an(),window.removeEventListener("scroll",fn),hn&&(window.removeEventListener("pagehide",hn),hn=null),pn&&(document.removeEventListener("visibilitychange",pn),pn=null),un=0,ln=0,dn=!1,Tn&&(Tn=!1,document.removeEventListener("mouseenter",Dn,!0),document.removeEventListener("mouseleave",Dn,!0),document.removeEventListener("click",An,{capture:!0}),document.removeEventListener("keydown",An,{capture:!0}),document.removeEventListener("scroll",An),window.removeEventListener("resize",xn),On(),wn="",_n=0,vn=0,bn=0,gn=0,kn=0),document.removeEventListener("click",Cn,{capture:!0}),Nn=[],document.removeEventListener("click",Xn,{capture:!0}),Pn=[],zn.clear(),document.removeEventListener("click",Vn,{capture:!0}),document.removeEventListener("keydown",Wn,{capture:!0}),window.removeEventListener("popstate",Yn),Zn=null,document.removeEventListener("change",no,{capture:!0}),document.removeEventListener("click",oo,{capture:!0}),to.clear(),document.removeEventListener("copy",co,{capture:!0}),io=[],uo&&(document.removeEventListener("selectionchange",uo),uo=null),lo&&(document.removeEventListener("copy",lo,{capture:!0}),document.removeEventListener("cut",lo,{capture:!0}),lo=null),so=[],ao=0,document.removeEventListener("mousedown",nr,{capture:!0}),document.removeEventListener("click",or,{capture:!0}),er=null,Qo.clear(),(()=>{document.removeEventListener("invalid",ar,{capture:!0}),document.removeEventListener("input",ur,{capture:!0}),document.removeEventListener("change",ur,{capture:!0}),sr&&(sr.disconnect(),sr=null);for(const t of ir.values())pr(t);ir.clear()})(),bo=!1,vo=[],go=null,yo=new Map,O(null),To&&(window.removeEventListener("popstate",To),To=null),Do&&(window.removeEventListener("hashchange",Do),Do=null),xo&&(document.removeEventListener("visibilitychange",xo),xo=null),Ao&&(window.removeEventListener("pagehide",Ao),Ao=null),window.removeEventListener("popstate",Lo),window.removeEventListener("hashchange",jo),No=[],Co=!1,Ro="",window.removeEventListener("scroll",Zo),window.removeEventListener("click",Ho,{capture:!0}),Vo(),gr&&(gr.disconnect(),gr=null),br&&(br.disconnect(),br=null),kr.clear(),document.removeEventListener("input",Or,{capture:!0}),Er.clear(),document.removeEventListener("mouseover",Lr),document.removeEventListener("mouseout",jr),document.removeEventListener("click",Ir,{capture:!0}),Br(),Cr.clear(),document.removeEventListener("mouseleave",Xr),qr&&(clearTimeout(qr),qr=null),Fr&&(Fr.disconnect(),Fr=null),Jr&&(Jr.disconnect(),Jr=null),Wr(),document.removeEventListener("paste",Gr,{capture:!0}),B(),S=!1,document.removeEventListener("visibilitychange",L),window.removeEventListener("pagehide",j),y&&(clearTimeout(y),y=null),ti&&(ti(),ti=null),Qr=!1)}function ui(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 li(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:li(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 c=e.getAttribute("data-segment");if(c&&c.length<2048)try{const t=JSON.parse(c);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{}ni(o),t.flusterduck=Object.freeze({init:ni,signal:oi,track:ri,identify:ii,setConsent:ci,optOut:si,destroy:ai})}catch{}})()})();
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var fe=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var yn=Object.prototype.hasOwnProperty;var Sn=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},Mn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of En(t))!yn.call(e,r)&&r!==n&&fe(e,r,{get:()=>t[r],enumerable:!(o=wn(t,r))||o.enumerable});return e};var Tn=e=>Mn(fe({},"__esModule",{value:!0}),e);var or={};Sn(or,{destroy:()=>ue,identify:()=>gn,init:()=>it,optOut:()=>bn,setConsent:()=>vn,signal:()=>hn});module.exports=Tn(or);function S(e){return(...t)=>{try{return e(...t)}catch{}}}function d(e){return t=>{try{e(t)}catch{}}}var me="_fd_s";var xn=/^[0-9a-f]{32}$/;function at(e){if(e)return st();let t=An(me);if(t&&xn.test(t))return t;let n=st();return ct(me,n,30),n}function pe(){ct(me,"",-1)}function st(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function An(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function ct(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var kn=/^[:\d]|--|^(ember|react|ng-|__)/;function f(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${q(t)}"]`;if(e.id&&!kn.test(e.id)&&e.id.length<64)return"#"+q(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),a=o.getAttribute("name"),s=o.getAttribute("role"),c=o.getAttribute("type");a&&a.length<64?i+=`[name="${q(a)}"]`:s?i+=`[role="${q(s)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${q(c)}"]`);let l=o.parentElement;if(l){let g=l.children,b=0,j=0;for(let O=0;O<g.length;O++){let de=g[O];de&&de.tagName===o.tagName&&(b++,de===o&&(j=b))}b>1&&(i+=`:nth-of-type(${j})`)}n.unshift(i);let h=n.join(" > ");try{if(document.querySelectorAll(h).length===1)return h}catch{}o=l,r++}return n.join(" > ")}function q(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}function w(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ut(e,t){if(t==="off")return null;if(t==="metadata")return Ln(e);let n=Dn(e);return n?{mode:"snapshot",...n}:null}function Ln(e){return{mode:"metadata",selector:f(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:lt(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:lt(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Rn(e)}}}function Dn(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let a=0;a<o.children.length&&r.length<6;a++){let s=o.children[a];if(!s||s===e)continue;let c=s.getBoundingClientRect();r.push({selector:f(s),tag:s.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Cn(s)})}let i=[];try{let a=e.getAnimations();for(let s of a)"animationName"in s&&i.push(s.animationName)}catch{}return{selector:f(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?f(o):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:_n(t),animations:i,siblings:r}}catch{return null}}function lt(e,t){return e&&t.includes(e)?e:null}function Rn(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function _n(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Cn(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var ft=3e3,mt=50,pt=50,On=3,Nn=65536,N=[],A=null,Z="",ht=ft,gt=mt,v=null,ge={domMode:"off"},he=!1,In=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),Fn=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),Pn=/(?:value|text|label|email|e-mail|name|phone|address|password|token|secret|cookie|session|jwt|auth|credential|card|cc|cvv|ssn)/i,Un=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,vt=d(Hn),bt=S(()=>D());function wt(e,t,n,o,r){Z=e,v=Object.assign(Object.create(null),t),ge={domMode:Xn(r?.domMode)},ht=Math.max(1e3,Math.min(n??ft,3e4)),gt=Math.max(5,Math.min(o??mt,pt)),document.addEventListener("visibilitychange",vt),window.addEventListener("pagehide",bt)}function u(e){N.length>=pt||(N.push(e),N.length>=gt?D():A||(A=setTimeout(D,ht)))}function D(){if(he||!N.length||!v)return;he=!0,A&&(clearTimeout(A),A=null);let e=N;N=[];let t={v:1,sid:v.sid,key:v.key,url:v.url,page:v.page,ts:Date.now(),ua:v.ua,vw:v.vw,vh:v.vh,environment:v.environment,dom_mode:ge.domMode,events:e.map(n=>jn(n,v.page,ge.domMode))};try{let n=JSON.stringify(t);n.length<=Nn&&yt(n,0)}catch{}he=!1}function ve(e){if(v)for(let t of Object.keys(e))In.has(t)&&(v[t]=e[t])}function Et(){D(),document.removeEventListener("visibilitychange",vt),window.removeEventListener("pagehide",bt),A&&(clearTimeout(A),A=null)}function Hn(){document.visibilityState==="hidden"&&D()}function yt(e,t){if(Z){if(navigator.sendBeacon){let n=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(Z,n))return}try{fetch(Z,{method:"POST",body:e,headers:{"Content-Type":"application/json"},keepalive:!0}).catch(()=>{t<On&&setTimeout(()=>yt(e,t+1),1e3*(t+1))})}catch{}}}function jn(e,t,n){let o=e.d??{},r=qn(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},a=dt(o.el,o.element,o.target);if(r==="signal"){i.signal_type=dt(o.s,o.signal_type,o.name)?.slice(0,128),a&&(i.element=a.slice(0,2048));let c=a?Vn(a,n):null;c&&(i.dom=c)}let s=Bn(o);return Object.keys(s).length&&(i.metadata=s),i}function qn(e){return e==="pv"?"pageview":e==="sig"?"signal":Fn.has(e)?e:"custom_signal"}function Bn(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let o=J(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=J(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function J(e,t="",n=0){if(!(n>4)&&!Pn.test(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return Un.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>J(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=J(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Vn(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ut(n,t):null}catch{return null}}function dt(...e){for(let t of e)if(typeof t=="string"&&t)return t}function Xn(e){return e==="metadata"||e==="snapshot"?e:"off"}function St(e){let t=location.href;function n(){let s=location.href;s!==t&&(t=s,e(s,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...s){o.apply(this,s),n()},a=function(...s){r.apply(this,s),n()};return history.pushState=i,history.replaceState=a,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===a&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function be(e,t){for(let n of t){let o=$n(n.pattern);if(o&&o.test(e))return n.label}return zn(e)}var Yn=/^[a-zA-Z0-9/:._*\-]+$/;function $n(e){if(e.length>200||!Yn.test(e))return null;let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function zn(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Kn=[".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"]'],k=[],we=3,Tt=2e3,Mt=8,xt=[],At=d(Wn);function Ee(e,t){we=e?.threshold??3,Tt=e?.windowMs??2e3,xt=[...Kn,...t??[]],document.addEventListener("click",At,{capture:!0,passive:!0})}function ye(){document.removeEventListener("click",At,{capture:!0}),k=[]}function Wn(e){let t=e.target;if(!t||w(t,xt)||Qn(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;k.length&&n-k[0].t>Tt;)k.shift();if(k.push({t:n,x:o,y:r,el:t}),k.length<we)return;let i=k.slice(-we),a=i[0];for(let g=1;g<i.length;g++){let b=i[g],j=b.x-a.x,O=b.y-a.y;if(j*j+O*O>Mt*Mt)return}let s=a.t,l=(i[i.length-1].t-s)/1e3,h=l>0?i.length/l:i.length;u({t:"sig",ts:n,d:{s:"rage_click",el:f(t),cnt:i.length,vel:Math.round(h*10)/10}}),k=[]}function Qn(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick"))}var Gn=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Zn=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Jn=/^(A|BUTTON|LABEL)$/,kt=[],B=null,eo=5,Lt=d(to),Dt=d(no);function to(e){B={x:e.clientX,y:e.clientY}}function Se(e){kt=e??[],document.addEventListener("mousedown",Lt,{capture:!0,passive:!0}),document.addEventListener("click",Dt,{capture:!0,passive:!0})}function Me(){document.removeEventListener("mousedown",Lt,{capture:!0}),document.removeEventListener("click",Dt,{capture:!0}),B=null}function no(e){if(e.button!==0||e.detail===0)return;let t=e.target;if(!t||w(t,kt)||io()||so(e)||oo(t))return;let n=ro(t,e.clientX,e.clientY),o=n?Rt(e.clientX,e.clientY,n):-1;u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:f(t),near:n?f(n):"",dist:Math.round(o)}})}function oo(e){if(Gn.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Zn.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;if(n&&Jn.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))return!0;try{if(getComputedStyle(e).cursor==="pointer")return!0}catch{return!1}return!1}function ro(e,t,n){let o=e.parentElement;if(!o)return null;let r=o.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),i=null,a=1/0;for(let s=0;s<r.length;s++){let c=r[s];if(!c)continue;let l=Rt(t,n,c);l<a&&(a=l,i=c)}return i}function Rt(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),a=e-r,s=t-i;return Math.sqrt(a*a+s*s)}function io(){let e=window.getSelection();return e!==null&&e.toString().length>0}function so(e){if(!B)return!1;let t=e.clientX-B.x,n=e.clientY-B.y;return Math.sqrt(t*t+n*n)>eo}var m=null,Te=3e3,_t=[],ao=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,co=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Ct=d(lo);function xe(e,t){Te=e?.delayMs??3e3,_t=t??[],document.addEventListener("click",Ct,{capture:!0,passive:!0})}function Ae(){document.removeEventListener("click",Ct,{capture:!0}),V()}function lo(e){let t=e.target;if(!t||w(t,_t))return;let n=t.getAttribute("role");if(!ao.test(t.tagName)&&!(n&&co.test(n)))return;if(m){if(m.el===t||m.el.contains(t)){let c=Date.now()-m.ts;c>=Te&&u({t:"sig",ts:Date.now(),d:{s:"speed_frustration",el:m.selector,delay:c}}),V();return}V()}let o=f(t),r=!1,i=new MutationObserver(c=>{for(let l of c){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){r=!0,V();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){r=!0,V();return}}}),a=t.parentElement||document.body;i.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let s=setTimeout(()=>{!r&&m&&(m={...m,timeout:null})},Te+500);m={el:t,selector:o,ts:Date.now(),observer:i,timeout:s}}function V(){m&&(m.observer.disconnect(),m.timeout&&clearTimeout(m.timeout),m=null)}var uo=100,Nt=800,It=2e3,fo=3,Ot=0,mo=50,ee=0,te=0,X=0,Y=0,$=0,ne=0,ke=0,R=[],Ft=d(po);function Le(e){Nt=e?.velocityThreshold??800,It=e?.windowMs??2e3,document.addEventListener("mousemove",Ft,{passive:!0})}function De(){document.removeEventListener("mousemove",Ft),Pt()}function po(e){let t=Date.now();t-Ot<mo||(Ot=t,ho(e.clientX,e.clientY,t))}function ho(e,t,n){if(X===0){ee=e,te=t,X=n,ke=n;return}let o=(n-X)/1e3;if(o===0)return;let r=e-ee,i=t-te,s=Math.sqrt(r*r+i*i)/o;R.length>=uo&&(R=R.slice(-50)),R.push(s);let c=Math.sign(r),l=Math.sign(i);if((Y!==0&&c!==0&&c!==Y||$!==0&&l!==0&&l!==$)&&ne++,Y=c||Y,$=l||$,ee=e,te=t,X=n,n-ke>It){if(ne>=fo){let h=R.reduce((g,b)=>g+b,0)/R.length;h>=Nt&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(h),rev:ne}})}Pt(),ke=n}}function Pt(){ne=0,R=[],Y=0,$=0,X=0,ee=0,te=0}var go=100,p=[],Ut=3e4;function Re(e){Ut=e?.windowMs??3e4}function _e(){p=[]}function Ce(e){let t=Date.now();for(;p.length&&t-p[0].ts>Ut;)p.shift();if(p.length>=go&&(p=p.slice(-50)),p.push({path:e,ts:t}),p.length<4)return;let n=e,o=!1,r=[];for(let i=p.length-2;i>=1;i--)if(p[i-1].path===n){let a=p.slice(i-1,p.length);for(let s of a)r.includes(s.path)||r.push(s.path);o=!0;break}o&&r.length>=2&&(u({t:"sig",ts:t,d:{s:"loop_nav",pages:r}}),p=[{path:e,ts:t}])}var vo=100,Ht=1e4,Ie=.5,E=[],oe=0,Fe=0,Oe=!1,Ne=0,jt=d(bo);function Pe(e){Ht=e?.windowMs??1e4,Ie=e?.depthThreshold??.5,window.addEventListener("scroll",jt,{passive:!0})}function Ue(){window.removeEventListener("scroll",jt),E=[]}function He(){E=[],oe=0,Fe=0}function bo(){Oe||(Oe=!0,requestAnimationFrame(()=>{Oe=!1,wo()}))}function wo(){let e=Date.now(),t=window.scrollY;if(Ne=document.documentElement.scrollHeight-window.innerHeight,Ne<=0)return;let n=t/Ne,o=t>oe?"down":"up";if(e-Fe<100){oe=t;return}for(;E.length&&e-E[0].ts>Ht;)E.shift();E.length>=vo&&(E=E.slice(-50)),E.push({depth:n,ts:e,direction:o}),oe=t,Fe=e;let r=0,i=1,a=0,s=!1;for(let c=0;c<E.length;c++){let l=E[c].depth;l>r&&(r=l),l>=Ie&&(s=!0),s&&l<i&&(i=l),s&&i<.25&&l>=Ie&&(a++,s=!1,i=1)}a>=1&&(u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:a+1}}),E=[])}var Eo=["textarea",'[role="textbox"]',"[contenteditable]"],K=new Map,L=new Set,_=null,je=0,qt=5e3,Bt=[],Vt=d(yo),Xt=d(So),Yt=d(Mo),$t=S(zt),z=null;function qe(e,t){qt=e?.pauseMs??5e3,Bt=t??[],document.addEventListener("focusin",Vt,{capture:!0,passive:!0}),document.addEventListener("focusout",Xt,{capture:!0,passive:!0}),document.addEventListener("submit",Yt,{capture:!0,passive:!0}),window.addEventListener("pagehide",$t),z=S(()=>{document.visibilityState==="hidden"&&zt()}),document.addEventListener("visibilitychange",z)}function Be(){document.removeEventListener("focusin",Vt,{capture:!0}),document.removeEventListener("focusout",Xt,{capture:!0}),document.removeEventListener("submit",Yt,{capture:!0}),window.removeEventListener("pagehide",$t),z&&(document.removeEventListener("visibilitychange",z),z=null),K.clear(),L.clear(),_=null}function Ve(){K.clear(),L.clear(),_=null,je=0}function yo(e){let t=e.target;if(!t||!Kt(t)||w(t,Bt)||To(t))return;K.set(t,Date.now());let n=t.closest("form");n&&n!==_&&(_=n,je=n.querySelectorAll("input, select, textarea").length)}function So(e){let t=e.target;if(!t||!Kt(t))return;let n=K.get(t);if(K.delete(t),n){let r=Date.now()-n;r>=qt&&u({t:"sig",ts:Date.now(),d:{s:"form_hesitation",el:f(t),pause:r}})}let o=t.getAttribute("name")||t.getAttribute("id")||f(t);xo(t)&&L.add(o)}function Mo(){L.clear(),_=null}function zt(){L.size>0&&_&&(u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:L.size,total:je||L.size}}),L.clear(),_=null)}function Kt(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function To(e){if(e.tagName==="TEXTAREA")return!0;for(let t of Eo)try{if(e.matches(t))return!0}catch{return!1}return!1}function xo(e){return"value"in e?e.value.length>0:!1}var I=null,W=null,Wt=/flusterduck\.com|\/v1\/ingest/,Gt=d(Ao),Zt=d(ko);function Xe(){window.addEventListener("error",Gt),window.addEventListener("unhandledrejection",Zt),Lo()}function Ye(){window.removeEventListener("error",Gt),window.removeEventListener("unhandledrejection",Zt),Do()}function Ao(e){u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:$e(e.message||"Unknown error",200),ep:"",status:0}})}function ko(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:$e(t,200),ep:"",status:0}})}function Lo(){I||(I=window.fetch,W=function(t,n){let o;try{o=I.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Wt.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:Qt(i),status:r.status}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Wt.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:$e(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?Qt(t):"",status:0}})}catch{}throw r})},window.fetch=W)}function Do(){I&&W&&window.fetch===W&&(window.fetch=I),I=null,W=null}function Qt(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function $e(e,t){let n=e.length>t?e.slice(0,t):e;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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Jt=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Ro=['[class*="map"]',"canvas",".gallery","[data-zoom]"],F=null,M=0,re=0,Q=0,en=0,tn=null,nn=[],on=d(_o),rn=d(Co),sn=d(Io),an=d(Po),cn=d(Fo);function ze(e){nn=e??[],document.addEventListener("touchstart",on,{passive:!0}),document.addEventListener("touchend",rn,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",sn,{passive:!0}),window.addEventListener("orientationchange",an,{passive:!0})),window.visualViewport?.addEventListener("resize",cn)}function Ke(){document.removeEventListener("touchstart",on),document.removeEventListener("touchend",rn),document.removeEventListener("gesturechange",sn),window.removeEventListener("orientationchange",an),window.visualViewport?.removeEventListener("resize",cn)}function _o(e){let t=e.touches[0];e.touches.length===1&&t&&(F={x:t.clientX,y:t.clientY,ts:Date.now()})}function Co(e){if(!F||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-F.x,o=t.clientY-F.y,r=Date.now()-F.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Oo(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&No(i,n,o),F=null}function Oo(e,t,n){if(w(e,nn))return;let o=Uo(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),a=Math.max(r.top,Math.min(n,r.bottom)),s=Math.sqrt((t-i)**2+(n-a)**2);if(s>0&&s<=20){let c=`${Math.round(r.width)}x${Math.round(r.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:f(o),dist:Math.round(s),size:c}})}}function No(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Jt.some(a=>{try{return e.matches(a)||e.closest(a)}catch{return!1}})||!Jt.some(a=>{try{return document.querySelector(a)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Io(){let e=Date.now();if(e-re>3e4&&(M=0,re=e),M++,M>=2){let t=document.activeElement||document.body;Ro.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})||u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:M}}),M=0}}function Fo(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();t-re>3e4&&(M=0,re=t),M++,M>=2&&(u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:M}}),M=0)}}function Po(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-en>3e4&&(Q=0,en=e),t!==tn&&(Q++,tn=t),Q>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:Q}}),Q=0)}function Uo(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,a=21;for(let s=0;s<r.length;s++){let c=r[s];if(!c)continue;let l=c.getBoundingClientRect(),h=Math.max(l.left,Math.min(t,l.right)),g=Math.max(l.top,Math.min(n,l.bottom)),b=Math.sqrt((t-h)**2+(n-g)**2);b<a&&b>0&&(a=b,i=c)}return i}var y=[],P=null,x=0,We=0,T=[],Ho=10,jo=5e3,ln=5,qo=3e3,Bo=15,Vo=5e3,un=d(Xo);function Qe(){document.addEventListener("keydown",un,{capture:!0,passive:!0})}function Ge(){document.removeEventListener("keydown",un,{capture:!0}),y=[],T=[],P=null}function Xo(e){let t=Date.now(),n=e.target;n&&w(n,[])||(e.key==="Tab"?Yo(t,n):e.key==="Escape"?$o(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&zo(t,e.target))}function Yo(e,t){for(;y.length&&e-y[0].ts>jo;)y.shift();y.length>=50&&(y=y.slice(-25));let n=t?f(t):"";if(y.push({ts:e,el:n}),y.length>=Ho){let r=y.map(i=>i.el).filter(Boolean);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:y.length,els:r}}),y=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');o&&(o===P?e-We<=qo?(x++,x>=ln&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:f(o),attempts:x}}),x=0,P=null)):(We=e,x=1):(P=o,We=e,x=1))}function $o(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');n&&n===P&&(x++,x>=ln&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:f(n),attempts:x}}),x=0,P=null))}function zo(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;T.length&&e-T[0].ts>Vo;)T.shift();T.length>=50&&(T=T.slice(-25)),T.push({ts:e,container:n});let o=T.filter(r=>r.container===n);o.length>=Bo&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:f(n),keys:o.length}}),T=[])}var U=0,ie=0,se=null,Ze=0,ae=!1,Ko=4,Wo=3e3,dn=d(Qo);function Je(){window.addEventListener("scroll",dn,{passive:!0})}function et(){window.removeEventListener("scroll",dn),U=0,ie=0,se=null,Ze=0,ae=!1}function Qo(){ae||(ae=!0,requestAnimationFrame(()=>{ae=!1,Go()}))}function Go(){let e=Date.now(),t=window.scrollY,n=t-ie;if(Math.abs(n)<2){ie=t;return}let o=n>0?"down":"up";se&&o!==se&&(e-Ze>Wo&&(U=0,Ze=e),U++,U>=Ko&&Math.abs(n)>100&&(u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:U}}),U=0)),se=o,ie=t}var H=0,ce=!1,fn=d(Zo),mn=S(pn),G=null;function tt(){window.addEventListener("scroll",fn,{passive:!0}),window.addEventListener("pagehide",mn),G=S(()=>{document.visibilityState==="hidden"&&pn()}),document.addEventListener("visibilitychange",G)}function nt(){window.removeEventListener("scroll",fn),window.removeEventListener("pagehide",mn),G&&(document.removeEventListener("visibilitychange",G),G=null),H=0,ce=!1}function ot(){H=0}function Zo(){ce||(ce=!0,requestAnimationFrame(()=>{ce=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>H&&(H=t)}}))}function pn(){H>.05&&u({t:"sig",ts:Date.now(),d:{s:"scroll_depth_abandon",depth:Math.round(H*100)/100}})}var Jo="https://api.flusterduck.com/v1/ingest",C=!1,le=null,rt=null;function er(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function it(e){if(C||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_")||e.respectDoNotTrack!==!1&&tr()||e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate)return;rt=e,C=!0;let t=at(e.cookieless??!1),n=er(e.endpoint)??Jo,o=be(location.pathname,e.pageRules??[]),r=nr(e.domMode);wt(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r});let i=document.referrer,a="";if(i)try{a=new URL(i).origin+new URL(i).pathname}catch{a=""}u({t:"pv",ts:Date.now(),d:{ref:a}});let s=e.ignoreElements??[],c=l=>e.signals?.[l]?.enabled!==!1;if(c("rageClick")&&Ee(e.signals?.rageClick,s),c("deadClick")&&Se(s),c("speedFrustration")){let l=e.signals?.speedFrustration;xe(l?{delayMs:l.windowMs}:void 0,s)}if(e.trackMouse!==!1&&c("thrashCursor")&&Le(e.signals?.thrashCursor),c("loopNav")&&Re(e.signals?.loopNav),c("scrollBounce")&&Pe(),e.trackForms!==!1&&(c("formHesitation")||c("formAbandon"))){let l=e.signals?.formHesitation;qe(l?{pauseMs:l.threshold}:void 0,s)}c("errorEncounter")&&Xe(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&ze(s),(c("tabThrash")||c("focusTrap")||c("keyboardNavFrustration"))&&Qe(),c("scrollHijack")&&Je(),c("scrollDepthAbandon")&&tt(),le=St(S((l,h)=>{D(),He(),Ve(),ot();let g=be(h,e.pageRules??[]);ve({page:g,url:l}),Ce(h),u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function hn(e,t){if(!C||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:"custom",name:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function gn(e){if(!C||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}ve({segment:t})}function vn(e){e&&rt&&!C?it(rt):e||(ue(),pe())}function bn(){ue(),pe()}function ue(){C&&(ye(),Me(),Ae(),De(),_e(),Ue(),Be(),Ye(),Ke(),Ge(),et(),nt(),Et(),le&&(le(),le=null),C=!1)}function tr(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function nr(e){return e==="metadata"||e==="snapshot"?e:"off"}
|
|
1
|
+
"use strict";var an=Object.defineProperty;var Zs=Object.getOwnPropertyDescriptor;var Qs=Object.getOwnPropertyNames;var Js=Object.prototype.hasOwnProperty;var ea=(e,t)=>{for(var n in t)an(e,n,{get:t[n],enumerable:!0})},ta=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Qs(t))!Js.call(e,r)&&r!==n&&an(e,r,{get:()=>t[r],enumerable:!(o=Zs(t,r))||o.enumerable});return e};var na=e=>ta(an({},"__esModule",{value:!0}),e);var td={};ea(td,{destroy:()=>on,identify:()=>Ys,init:()=>Tr,optOut:()=>$s,setConsent:()=>js,signal:()=>zs,track:()=>Xs});module.exports=na(td);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var ln="_fd_s";var oa=/^[0-9a-f]{32}$/;function Mr(e){if(e)return xr();let t=ra(ln);if(t&&oa.test(t))return t;let n=xr();return Ar(ln,n,30),n}function cn(){Ar(ln,"",-1)}function xr(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function ra(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Ar(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var ia=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${De(t)}"]`;if(e.id&&!ia.test(e.id)&&e.id.length<64)return"#"+De(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),s=o.getAttribute("name"),a=o.getAttribute("role"),u=o.getAttribute("type");s&&s.length<64?i+=`[name="${De(s)}"]`:a?i+=`[role="${De(a)}"]`:u&&(i==="input"||i==="button")&&(i+=`[type="${De(u)}"]`);let l=o.parentElement;if(l){let m=l.children,E=0,w=0;for(let b=0;b<m.length;b++){let g=m[b];g&&g.tagName===o.tagName&&(E++,g===o&&(w=E))}E>1&&(i+=`:nth-of-type(${w})`)}n.unshift(i);let c=n.join(" > ");try{if(document.querySelectorAll(c).length===1)return c}catch{}o=l,r++}return n.join(" > ")}function De(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Re=60,sa=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,aa=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Re);if(!aa.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Re);if(i&&!sa.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Re);let o=e.getAttribute("title");if(o)return o.trim().slice(0,Re);let r=e.getAttribute("alt");return r?r.trim().slice(0,Re):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Rr(e,t){if(t==="off")return null;if(t==="metadata")return la(e);let n=ca(e);return n?{mode:"snapshot",...n}:null}function la(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:Dr(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:Dr(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:ua(e)}}}function ca(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let s=0;s<o.children.length&&r.length<6;s++){let a=o.children[s];if(!a||a===e)continue;let u=a.getBoundingClientRect();r.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(u.x),y:Math.round(u.y),w:Math.round(u.width),h:Math.round(u.height)},interactive:fa(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?p(o):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:da(t),animations:i,siblings:r}}catch{return null}}function Dr(e,t){return e&&t.includes(e)?e:null}function ua(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function da(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function fa(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var Or=7e3,pa=500,ma=1e4,Nr=50,Pr=100,ga=3,Ie=6e4,bt="application/json",ha="application/json; encoding=gzip",ae=[],$=null,Hr="",Fr=Or,Br=Nr,_=null,yt={domMode:"off",compression:"auto"},un=!1,fn=null,pn=!1;function mn(e){fn=e}function gn(e){pn=e}var va=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),Ea=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),wa=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function ba(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>wa.has(n))}var ya=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Vr=f(_a),qr=y(()=>J());function Wr(e,t,n,o,r){Hr=e,_=Object.assign(Object.create(null),t),yt={domMode:Da(r?.domMode),compression:Ra(r?.compression)},Fr=Math.max(pa,Math.min(n??Or,ma)),Br=Math.max(1,Math.min(o??Nr,Pr)),document.addEventListener("visibilitychange",Vr),window.addEventListener("pagehide",qr)}function d(e){pn||ae.length>=Pr||(ae.push(e),ae.length>=Br?J():$||($=setTimeout(J,Fr)))}function J(){Sa()}async function Sa(){if(un||!ae.length||!_)return;un=!0,$&&(clearTimeout($),$=null);let e=ae;ae=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:yt.domMode},n=e.map(r=>ka(r,_.page,yt.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>Ie)if(o.length>0)await dn({...t,events:o}),o=[r];else{let a={...t,events:[r]};JSON.stringify(a).length<=Ie?await dn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),o=[]}else o=i}o.length>0&&await dn({...t,events:o})}catch{}finally{un=!1}}function hn(e){if(_)for(let t of Object.keys(e))va.has(t)&&(_[t]=e[t])}function Ur(){J(),pn=!1,document.removeEventListener("visibilitychange",Vr),window.removeEventListener("pagehide",qr),$&&(clearTimeout($),$=null)}function _a(){document.visibilityState==="hidden"&&J()}async function dn(e){let t=JSON.stringify(e),n=await Ta(t,yt.compression);n&&zr(n,0)}async function Ta(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>Ie)return null;if(t!=="off"){let r=await La(e);if(r&&r.byteLength<=Ie)return{beaconBody:new Blob([r],{type:ha}),fetchBody:new Uint8Array(r),headers:{"Content-Type":bt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:bt}),fetchBody:e,headers:{"Content-Type":bt}}}async function La(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=Ca(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),s=[],a=0;for(;;){let c=await i.read();if(c.done)break;if(a+=c.value.byteLength,a>Ie)return null;let m=new Uint8Array(c.value.byteLength);m.set(c.value),s.push(m)}let u=new Uint8Array(a),l=0;for(let c of s)u.set(c,l),l+=c.byteLength;return u.buffer}catch{return null}}function Ca(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:bt});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function zr(e,t,n=Hr){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<ga&&setTimeout(()=>zr(e,t+1,n),1e3*(t+1))})}catch{}}function ka(e,t,n){let o=e.d??{},r=xa(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},s=Ir(o.el,o.element,o.target);if(r==="signal"){i.signal_type=Ir(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let u=s?Aa(s,n):null;u&&(i.dom=u),i.signal_type&&fn&&fn(i.signal_type)}let a=Ma(o);return Object.keys(a).length&&(i.metadata=a),i}function xa(e){return e==="pv"?"pageview":e==="sig"?"signal":Ea.has(e)?e:"custom_signal"}function Ma(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let o=St(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=St(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function St(e,t="",n=0){if(!(n>4)&&!ba(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return ya.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>St(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=St(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Aa(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Rr(n,t):null}catch{return null}}function Ir(...e){for(let t of e)if(typeof t=="string"&&t)return t}function Da(e){return e==="metadata"||e==="snapshot"?e:"off"}function Ra(e){return e==="off"?"off":"auto"}function Xr(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...a){o.apply(this,a),n()},s=function(...a){r.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function vn(e,t){for(let n of t){let o=Oa(n.pattern);if(o&&o.test(e))return n.label}return Na(e)}var Ia=/^[a-zA-Z0-9/:._*\-]+$/;function Oa(e){if(e.length>200||!Ia.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function Na(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Pa=[".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"]'],P=[],Yr=3,jr=2e3,En=8,$r=[],le=[],Kr=0,_t=new Map,Tt=new Map,Ha=1e4,Lt=!1,Gr=f(Fa);function wn(e,t){Lt||(Lt=!0,Yr=e?.threshold??3,jr=e?.windowMs??2e3,$r=[...Pa,...t??[]],Kr=Date.now(),P=[],le=[],_t.clear(),Tt.clear(),document.addEventListener("click",Gr,{capture:!0,passive:!0}))}function bn(){Lt&&(Lt=!1,document.removeEventListener("click",Gr,{capture:!0,passive:!0}),P=[],le=[],_t.clear(),Tt.clear())}function Fa(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,$r)||Wa(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;P.length&&n-P[0].t>jr;)P.shift();P.push({t:n,x:o,y:r});let i=Ba();if(P.length<i)return;let s=P.slice(-i);for(let k=0;k<s.length-1;k++)for(let Ae=k+1;Ae<s.length;Ae++){let vt=s[k],Et=s[Ae],wt=Et.x-vt.x,se=Et.y-vt.y;if(wt*wt+se*se>En*En)return}let a=s[0].t,l=(s[s.length-1].t-a)/1e3,c=l>0?s.length/l:s.length,m=(s.length-i)/i+c/10,E=Math.round(Math.min(1,m)*100)/100,w=qa(s,i,c),b=p(t),g=h(t);le.push({selector:b,ts:n});let U=le.length,ht=Va(n),Lr=_t.get(b)??0,rn=Lr+1,Cr=Tt.get(b)??0,Ks=Cr>0&&n-Cr<Ha;_t.set(b,rn),Tt.set(b,n);let kr=Lr>=1,Gs=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Ae=s.reduce((se,sn)=>se+sn.x,0)/s.length,vt=s.reduce((se,sn)=>se+sn.y,0)/s.length,Et=k.left+k.width/2,wt=k.top+k.height/2;return{click_dx:Math.round(Ae-Et),click_dy:Math.round(vt-wt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"rage_click",el:b,...g?{el_label:g}:{},cnt:s.length,vel:Math.round(c*10)/10,intensity:E,quality:w,burst_seq:U,burst_rate_per_min:ht,repeated_target:kr,hot_repeat:Ks,...Gs??{}}}),kr&&d({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...g?{el_label:g}:{},total_hits:rn,burst_count:rn,burst_seq:U}}),P=P.slice(-(i-1))}function Ba(){return le.length>=3?2:Yr}function Va(e){let t=(e-Kr)/6e4;return t<=0?0:Math.round(le.length/t*10)/10}function qa(e,t,n){let o=e.length-t,r=Math.min(4,o/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let l=0,c=0;for(let E=0;E<e.length-1;E++)for(let w=E+1;w<e.length;w++){let b=e[E],g=e[w],U=g.x-b.x,ht=g.y-b.y;l+=Math.sqrt(U*U+ht*ht),c++}let m=l/c;a=Math.max(0,2-m/En*2)}let u=r+s+a;return Math.round(Math.min(10,Math.max(0,u)))}function Wa(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Ua=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,za=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Xa=/^(A|BUTTON|LABEL)$/,Ya=20,Zr=[],ce=null,ja=5,Ct=new Map,Qr=f($a),Jr=f(Za);function $a(e){ce={x:e.clientX,y:e.clientY}}function yn(e){Zr=e??[],document.addEventListener("mousedown",Qr,{capture:!0,passive:!0}),document.addEventListener("click",Jr,{capture:!0,passive:!0})}function Sn(){document.removeEventListener("mousedown",Qr,{capture:!0}),document.removeEventListener("click",Jr,{capture:!0}),ce=null,Ct.clear()}function _n(){Ct.clear()}function Ka(e){try{return window.getComputedStyle(e).cursor.slice(0,Ya)}catch{return""}}function Ga(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Za(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Zr)||tl())return;let n=nl(e);if(ce=null,n||Qa(t))return;let o=Ja(t,e.clientX,e.clientY),r=o?ei(e.clientX,e.clientY,o):null,i=p(t),a=(Ct.get(i)??0)+1;Ct.set(i,a);let u=a>=2,l=Ka(t),c=Ga(t),m=h(t),E=o?h(o):"";d({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...m?{el_label:m}:{},near:o?p(o):"",...E?{near_label:E}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:l,...c?{looks_interactive:!0}:{},...u?{repeated:!0,repeat_cnt:a}:{}}})}function Qa(e){if(Ua.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&za.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Xa.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Ja(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,u=1/0;for(let l=0;l<s.length;l++){let c=s[l];if(!c||c===e)continue;let m=el(t,n,c);m<u&&(u=m,a=c)}if(a&&u<100)return a;o=i}return null}function ei(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),s=e-r,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function el(e,t,n){return ei(e,t,n).dist}function tl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function nl(e){if(!ce)return!1;let t=e.clientX-ce.x,n=e.clientY-ce.y;return Math.sqrt(t*t+n*n)>ja}var T=null,Tn=3e3,ti=[],kt="click",xt=0,ol=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,rl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,ni=f(al),oi=f(il),ri=f(sl);function Ln(e,t){Tn=e?.delayMs??3e3,ti=t??[],document.addEventListener("click",ni,{capture:!0,passive:!0}),document.addEventListener("keydown",oi,{capture:!0,passive:!0}),document.addEventListener("touchstart",ri,{capture:!0,passive:!0})}function Cn(){document.removeEventListener("click",ni,{capture:!0}),document.removeEventListener("keydown",oi,{capture:!0}),document.removeEventListener("touchstart",ri,{capture:!0}),ue()}function kn(){ue()}function il(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(kt="keydown",xt=Date.now()))}function sl(){kt="touch",xt=Date.now()}function al(e){let t=e.target;if(!t||v(t,ti))return;let n=t.getAttribute("role");if(!ol.test(t.tagName)&&!(n&&rl.test(n)))return;let o=Date.now();if(o-xt>50&&(kt="click",xt=o),T){if(T.el===t||T.el.contains(t)){let l=o-T.ts;l>=Tn&&d({t:"sig",ts:o,d:{s:"speed_frustration",el:T.selector,delay:l,interaction_type:kt,observed_delay_ms:l}}),ue();return}ue()}let r=p(t),i=!1,s=new MutationObserver(l=>{for(let c of l){if(c.type==="childList"&&(c.addedNodes.length>0||c.removedNodes.length>0)){i=!0,ue();return}if(c.type==="attributes"&&c.target instanceof Element&&(c.target===t||t.contains(c.target)||c.target.contains(t))){i=!0,ue();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let u=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Tn+500);T={el:t,selector:r,ts:o,observer:s,timeout:u}}function ue(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var ll=100,cl=5,ii=800,si=2e3,ul=3,Mn=0,dl=16,Mt=0,At=0,Oe=0,Ne=0,Pe=0,Dt=0,xn=0,ee=[],An=0,de=null,ai=f(fl);function Dn(e){ii=e?.velocityThreshold??800,si=e?.windowMs??2e3,document.addEventListener("mousemove",ai,{passive:!0})}function Rn(){document.removeEventListener("mousemove",ai),de&&clearTimeout(de),In()}function fl(e){let t=Date.now();t-Mn<dl||(Mn=t,de&&clearTimeout(de),de=setTimeout(()=>In(),150),pl(e.clientX,e.clientY,t))}function pl(e,t,n){if(Oe===0){Mt=e,At=t,Oe=n,xn=n;return}let o=(n-Oe)/1e3;if(o===0)return;let r=e-Mt,i=t-At;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i),a=s/o;ee.length>=ll&&(ee=ee.slice(-50)),ee.push(a),An+=s;let u=Math.sign(r),l=Math.sign(i);if(s>=cl&&(Ne!==0&&u!==0&&u!==Ne||Pe!==0&&l!==0&&l!==Pe)&&Dt++,Ne=u||Ne,Pe=l||Pe,Mt=e,At=t,Oe=n,n-xn>si){if(Dt>=ul){let c=ee.reduce((m,E)=>m+E,0)/ee.length;c>=ii&&d({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(c),rev:Dt,distance_px:Math.round(An)}})}In(),xn=n}}function In(){Dt=0,ee=[],An=0,Ne=0,Pe=0,Oe=0,Mt=0,At=0,Mn=0,de=null}var li=100,ci=5,ml=3,L=[],x=[],On=3e4;function Nn(e){On=e?.windowMs??3e4}function Pn(){L=[],x=[]}function Hn(e){let t=Date.now(),n=e.indexOf("#"),o=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>On;)L.shift();for(;x.length&&t-x[0].ts>On;)x.shift();if(L.length>=li&&(L=L.slice(-50)),x.length>=li&&(x=x.slice(-50)),L.push({path:e,ts:t}),r){x.push({path:e,ts:t});let a=x.filter(l=>{let c=l.path.indexOf("#");return(c===-1?l.path:l.path.slice(0,c))===o}),u=new Set(a.map(l=>{let c=l.path.indexOf("#");return c===-1?"":l.path.slice(c)}));if(u.size>=ml&&a.length>u.size){let l=a.slice(-ci).map(c=>c.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(u).map(c=>o+c),path_sequence:l}}),x=x.filter(c=>{let m=c.path.indexOf("#");return(m===-1?c.path:c.path.slice(0,m))!==o});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let u=L.slice(a,L.length),l=new Set(u.map(c=>c.path));if(l.size>=2){s.push(...Array.from(l)),i=!0;break}}if(i){let a=L.slice(-ci).map(u=>u.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],x=x.filter(u=>{let l=u.path.indexOf("#");return(l===-1?u.path:u.path.slice(0,l))!==o})}}var gl=100,ui=1e4,Bn=.5,C=[],Rt=0,Vn=0,He=!1,Fn=0,di=f(hl);function qn(e){ui=e?.windowMs??1e4,Bn=e?.depthThreshold??.5,window.addEventListener("scroll",di,{passive:!0})}function Wn(){window.removeEventListener("scroll",di),C=[],He=!1}function Un(){C=[],Rt=0,Vn=0,He=!1}function hl(){He||(He=!0,requestAnimationFrame(()=>{He=!1,vl()}))}function vl(){let e=Date.now(),t=window.scrollY;if(Fn=document.documentElement.scrollHeight-window.innerHeight,Fn<=0)return;let n=t/Fn,o=t>Rt?"down":"up";if(e-Vn<100){Rt=t;return}for(;C.length&&e-C[0].ts>ui;)C.shift();C.length>=gl&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:o}),Rt=t,Vn=e;let r=0,i=1,s=0,a=!1,u=0,l=0,c=0,m=1,E=0;for(let w=1;w<C.length;w++)C[w].direction!==C[w-1].direction&&E++;for(let w=0;w<C.length;w++){let b=C[w],g=b.depth;if(g>r&&(r=g),g>=Bn&&(a||(u=b.ts,c=g),a=!0),a&&g<i&&(i=g,l=b.ts,m=g),a&&i<.25&&g>=Bn){if(l-u<200){a=!1,i=1,u=b.ts,c=g;continue}s++,a=!1,i=1}}if(s>=1){let w=Math.max(l-u,1),b=Math.abs(c-m)*100,g=Math.round(b/w*1e3);d({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:s+1,vel:g,dir_changes:E}}),C=[]}}var El=["textarea",'[role="textbox"]',"[contenteditable]"],Be=new Map,Ve=new Map,z=new Set,te=null,zn=0,fi=5e3,pi=[],wl=50,mi=f(bl),gi=f(yl),hi=f(Sl),vi=y(Ei),Fe=null;function Xn(e,t){fi=e?.pauseMs??5e3,pi=t??[],document.addEventListener("focusin",mi,{capture:!0,passive:!0}),document.addEventListener("focusout",gi,{capture:!0,passive:!0}),document.addEventListener("submit",hi,{capture:!0,passive:!0}),window.addEventListener("pagehide",vi),Fe=y(()=>{document.visibilityState==="hidden"&&Ei()}),document.addEventListener("visibilitychange",Fe)}function Yn(){document.removeEventListener("focusin",mi,{capture:!0}),document.removeEventListener("focusout",gi,{capture:!0}),document.removeEventListener("submit",hi,{capture:!0}),window.removeEventListener("pagehide",vi),Fe&&(document.removeEventListener("visibilitychange",Fe),Fe=null),Be.clear(),Ve.clear(),z.clear(),te=null}function jn(){Be.clear(),Ve.clear(),z.clear(),te=null,zn=0}function bl(e){let t=e.target;if(!t||!wi(t)||v(t,pi)||_l(t))return;let n=Date.now();Be.set(t,n),Ve.set(t,n);let o=t.closest("form");o&&o!==te&&(te=o,zn=o.querySelectorAll("input, select, textarea").length)}function yl(e){let t=e.target;if(!t||!wi(t))return;let n=Be.get(t),o=Ve.get(t);Be.delete(t),Ve.delete(t);let r=Date.now();if(!(o!==void 0&&r-o<wl)&&n!==void 0){let a=r-n;if(a>=fi){let u=h(t);d({t:"sig",ts:r,d:{s:"form_hesitation",el:p(t),...u?{el_label:u}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);Tl(t)&&z.add(s)}function Sl(){z.clear(),te=null}function Ei(){if(z.size>0&&te){let e=zn||z.size,t=Math.round(z.size/e*100)/100;d({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:z.size,total:e,field_count:e,completion_rate:t}}),z.clear(),te=null}}function wi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function _l(e){if(e.tagName==="TEXTAREA")return!0;for(let t of El)try{if(e.matches(t))return!0}catch{return!1}return!1}function Tl(e){return"value"in e?e.value.length>0:!1}var fe=null,qe=null,bi=/flusterduck\.com|\/v1\/ingest/,Si=f(kl),_i=f(xl);function Kn(){window.addEventListener("error",Si),window.addEventListener("unhandledrejection",_i),Ml()}function Gn(){window.removeEventListener("error",Si),window.removeEventListener("unhandledrejection",_i),Al()}var $n=/fetch|network|cors|timeout/i;function Ll(e){return $n.test(e)?"network":"script"}function Cl(e){if(e instanceof TypeError&&$n.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return $n.test(t)?"network":"unhandled_promise"}function kl(e){let t=e.message||"Unknown error";d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Zn(t,200),ep:"",status:0,error_category:Ll(t),url:location.pathname}})}function xl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Zn(t,200),ep:"",status:0,error_category:Cl(e.reason),url:location.pathname}})}function Ml(){fe||(fe=window.fetch,qe=function(t,n){let o;try{o=fe.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;bi.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:yi(i),status:r.status,error_category:"network",url:location.pathname}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;bi.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Zn(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?yi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw r})},window.fetch=qe)}function Al(){fe&&qe&&window.fetch===qe&&(window.fetch=fe),fe=null,qe=null}function yi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function Zn(e,t){let n=e.length>t?e.slice(0,t):e;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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Ti=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],Dl=['[class*="map"]',"canvas",".gallery","[data-zoom]"],K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Qn=0,Jn=null,Li=[],Ci=f(Rl),ki=f(Il),xi=f(Pl),Mi=f(Bl),Ai=f(Hl);function eo(e){Li=e??[],document.addEventListener("touchstart",Ci,{passive:!0}),document.addEventListener("touchend",ki,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",xi,{passive:!0}),window.addEventListener("orientationchange",Mi,{passive:!0})),window.visualViewport?.addEventListener("resize",Ai)}function to(){document.removeEventListener("touchstart",Ci),document.removeEventListener("touchend",ki),document.removeEventListener("gesturechange",xi),window.removeEventListener("orientationchange",Mi),window.visualViewport?.removeEventListener("resize",Ai),K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Qn=0,Jn=null}function Di(e){let t=e[0],n=e[1];if(!t||!n)return 0;let o=t.clientX-n.clientX,r=t.clientY-n.clientY;return Math.sqrt(o*o+r*r)}function Rl(e){let t=e.touches[0];e.touches.length===1&&t?(K={x:t.clientX,y:t.clientY,ts:Date.now()},me=0):e.touches.length===2&&(me=Di(e.touches),K=null)}function Il(e){if(me>0){let s=e.touches.length>=2?Di(e.touches):(()=>{let a=e.changedTouches[0],u=e.changedTouches[1];if(!a||!u)return 0;let l=a.clientX-u.clientX,c=a.clientY-u.clientY;return Math.sqrt(l*l+c*c)})();s>0&&(We=Math.round(s/me*100)/100),me=0}if(!K||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-K.x,o=t.clientY-K.y,r=Date.now()-K.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Ol(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&Nl(i,n,o),K=null}function Ol(e,t,n){if(v(e,Li))return;let o=Vl(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let u=`${Math.round(r.width)}x${Math.round(r.height)}`;d({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(o),dist:Math.round(a),size:u}})}}function Nl(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Ti.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Ti.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";d({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Pl(){let e=Date.now();if(e-Ue>3e4&&(R=0,Ue=e),R++,R>=2){let t=document.activeElement||document.body;!Dl.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})&&e-ze>200&&(ze=e,d({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:R,pinch_scale:We}})),R=0,We=1}}function Hl(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ue>3e4&&(R=0,Ue=t),R++,R>=2&&t-ze>200){let n=Math.round(e.scale*100)/100;ze=t,d({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:R,pinch_scale:n}}),R=0,We=1}}}function Fl(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function Bl(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-Qn>3e4&&(pe=0,Qn=e),t!==Jn&&(pe++,Jn=t),pe>=3&&(d({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:pe,orientation:Fl()}}),pe=0)}function Vl(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<r.length;a++){let u=r[a];if(!u)continue;let l=u.getBoundingClientRect(),c=Math.max(l.left,Math.min(t,l.right)),m=Math.max(l.top,Math.min(n,l.bottom)),E=Math.sqrt((t-c)**2+(n-m)**2);E<s&&E>0&&(s=E,i=u)}return i}var M=[],ge=null,A=0,he=0,F="",H=[],no=[],ql=10,Wl=5e3,Ri=5,Ii=3e3,Ul=15,zl=5e3,Oi=f(Xl);function oo(e){no=e??[],document.addEventListener("keydown",Oi,{capture:!0,passive:!0})}function ro(){document.removeEventListener("keydown",Oi,{capture:!0}),M=[],H=[],ge=null,A=0,he=0,F="",no=[]}function Xl(e){let t=Date.now(),n=e.target;n&&v(n,no)||(e.key==="Tab"?jl(t,n,e.shiftKey):e.key==="Escape"?$l(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Kl(t,e.target))}function Yl(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function jl(e,t,n){for(;M.length&&e-M[0].ts>Wl;)M.shift();M.length>=50&&(M=M.slice(-25));let o=t?p(t):"";if(M.push({ts:e,el:o,shift:n}),M.length>=ql){let i=M.map(a=>a.el).filter(Boolean),s=Yl(M);d({t:"sig",ts:e,d:{s:"tab_thrash",cnt:M.length,els:i,direction_changes:s}}),M=[]}if(!t)return;let r=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(r){let i=p(t);r===ge?e-he<=Ii?(A++,F=i,A>=Ri&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(r),attempts:A,trapped_element:F}}),A=0,F="",ge=null)):(he=e,A=1,F=i):(ge=r,he=e,A=1,F=i)}}function $l(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===ge){if(e-he>Ii){he=e,A=1,F=p(t);return}A++,F=p(t),A>=Ri&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:F}}),A=0,F="",ge=null)}}function Kl(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;H.length&&e-H[0].ts>zl;)H.shift();H.length>=50&&(H=H.slice(-25)),H.push({ts:e,container:n});let o=H.filter(r=>r.container===n);o.length>=Ul&&(d({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:o.length}}),H=[])}var ve=0,It=0,Ot=null,io=0,Nt=!1,Pt=0,so=0,Gl=1e4,Zl=2,Ql=4,Jl=3e3,Xe=null,Ht=0,ec=2e3,Ni=f(oc),Pi=f(tc),Hi=f(nc);function ao(){window.addEventListener("wheel",Pi,{passive:!0}),window.addEventListener("touchmove",Hi,{passive:!0}),window.addEventListener("scroll",Ni,{passive:!0})}function lo(){window.removeEventListener("wheel",Pi),window.removeEventListener("touchmove",Hi),window.removeEventListener("scroll",Ni),Ft()}function Ft(){ve=0,It=0,Ot=null,io=0,Nt=!1,Pt=0,so=0,Xe=null,Ht=0}function tc(){Xe="wheel",Ht=Date.now()}function nc(){Xe="touch",Ht=Date.now()}function oc(){Nt||(Nt=!0,requestAnimationFrame(()=>{Nt=!1,rc()}))}function rc(){let e=Date.now(),t=window.scrollY,n=t-It;if(Math.abs(n)<2){It=t;return}let o=n>0?"down":"up";if(Ot&&o!==Ot&&(e-io>Jl&&(ve=0,io=e),ve++,ve>=Ql&&Math.abs(n)>100)){let i=e-Ht,s=Xe!==null&&i<=ec?Xe:"wheel";e-so>Gl&&(Pt=0,so=e),Pt++;let a=Pt>=Zl;d({t:"sig",ts:e,d:{s:"scroll_hijack",rev:ve,source:s,repeated:a}}),ve=0}Ot=o,It=t}var ne=0,Ee=0,Ye=!1,Bi=f(ic),je=null,$e=null;function co(){window.addEventListener("scroll",Bi,{passive:!0}),$e=y(Fi),window.addEventListener("pagehide",$e),je=y(()=>{document.visibilityState==="hidden"&&Fi()}),document.addEventListener("visibilitychange",je)}function uo(){window.removeEventListener("scroll",Bi),$e&&(window.removeEventListener("pagehide",$e),$e=null),je&&(document.removeEventListener("visibilitychange",je),je=null),ne=0,Ee=0,Ye=!1}function fo(){ne=0,Ee=0,Ye=!1}function ic(){Ye||(Ye=!0,requestAnimationFrame(()=>{Ye=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ne&&(ne=t,Ee===0&&(Ee=Date.now()))}}))}function Fi(){if(ne>.05){let e=Date.now(),t=Ee>0?Math.max(0,e-Ee):0;d({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ne*100)/100,max_depth:Math.round(ne*100),dwell_ms:t}})}}var Vi=1500,qi=15e3,sc=5e3,ac=.15,po="",we=0,Bt=0,Ke=0,be=0,mo=0,Vt=null,qt=0,Wt=!1,Ut=f(cc),Wi=f(uc),ye=f(lc);function go(){Wt||(Wt=!0,mo=Ui(),Ge(),document.addEventListener("mouseenter",Ut,!0),document.addEventListener("mouseleave",Ut,!0),document.addEventListener("click",ye,{capture:!0,passive:!0}),document.addEventListener("keydown",ye,{capture:!0,passive:!0}),document.addEventListener("scroll",ye,{passive:!0}),window.addEventListener("resize",Wi,{passive:!0}))}function ho(){Wt&&(Wt=!1,document.removeEventListener("mouseenter",Ut,!0),document.removeEventListener("mouseleave",Ut,!0),document.removeEventListener("click",ye,{capture:!0}),document.removeEventListener("keydown",ye,{capture:!0}),document.removeEventListener("scroll",ye),window.removeEventListener("resize",Wi),zi(),po="",we=0,Bt=0,be=0,Ke=0,qt=0)}function Ge(){zi(),qt+=1;let e=qt;Vt=setTimeout(()=>{d({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:qi,cycle:e}})},qi)}function vo(){qt=0}function lc(){Ge()}function cc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),o=Date.now();(n!==po||o-Bt>Vi)&&(po=n,Bt=o,we=0),we+=1,!(we<4)&&(d({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:we,window_ms:Vi}}),we=0,Bt=o)}function uc(){let e=Date.now(),t=Ui(),n=mo||t,o=Math.abs(t-n)/Math.max(n,1);mo=t,!(o<ac)&&((!Ke||e-Ke>sc)&&(Ke=e,be=0),be+=1,!(be<3)&&(d({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:be,area_delta:Math.round(o*1e3)/1e3}}),be=0,Ke=e))}function Ui(){return Math.max(1,window.innerWidth*window.innerHeight)}function zi(){Vt&&(clearTimeout(Vt),Vt=null)}var Xi=6e4,dc=3,fc=["[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"]'],pc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,B=[],Yi=[],ji=f(mc);function Eo(e){Yi=e??[],document.addEventListener("click",ji,{capture:!0,passive:!0})}function wo(){document.removeEventListener("click",ji,{capture:!0}),B=[]}function bo(){B=[]}function mc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Yi)||!gc(t))return;let n=Date.now();for(;B.length&&n-B[0].t>Xi;)B.shift();let o=p(t);if(B.push({t:n,el:o}),B.length<dc)return;let r=new Set(B.map(s=>s.el)).size,i=h(t);d({t:"sig",ts:n,d:{s:"help_hunt",cnt:B.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:Xi}}),B=[]}function gc(e){let t=e;for(let n=0;n<3&&t;n++){if(hc(t)||vc(t))return!0;t=t.parentElement}return!1}function hc(e){for(let t of fc)try{if(e.matches(t))return!0}catch{}return!1}function vc(e){let t=e.id??"",n=e.className??"",o=typeof n=="string"?`${t} ${n}`:t;return pc.test(o)}var $i=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,Ki=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,zt=[],Xt=new Map,Gi=[],Zi=f(Ec);function yo(e){Gi=e??[],document.addEventListener("click",Zi,{capture:!0,passive:!0})}function So(){document.removeEventListener("click",Zi,{capture:!0}),zt=[],Xt.clear()}function _o(){zt=[],Xt.clear()}function Ec(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Gi)||!wc(t))return;let n=Date.now(),o=p(t),r=h(t);zt.push({t:n,el:o});let s=(Xt.get(o)??0)+1;Xt.set(o,s);let a=zt.length,u=(()=>{try{let l=t.getBoundingClientRect();return l.width===0&&l.height===0?null:{click_dx:Math.round(e.clientX-(l.left+l.width/2)),click_dy:Math.round(e.clientY-(l.top+l.height/2)),el_w:Math.round(l.width),el_h:Math.round(l.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:yc(t),...u??{}}})}function wc(e){let t=e;for(let n=0;n<4&&t;n++){if(bc(t))return!0;t=t.parentElement}return!1}function bc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let o=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(o&&Ki.test(o))return!0;let r=e.id??"",i=typeof e.className=="string"?e.className:"";if($i.test(r)||$i.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&Ki.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let u=(e.textContent??"").trim();if(u==="\xD7"||u==="\u2715"||u==="\u2717"||u==="X"||u==="x")return!0}return!1}function yc(e){let t=[['[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(let[n,o]of t)try{if(e.closest(n))return o}catch{}return"unknown"}var Sc=1500,I=null,Qi=[],Ji=f(_c),es=f(Tc),ts=f(Lc);function To(e){Qi=e??[],document.addEventListener("click",Ji,{capture:!0,passive:!0}),document.addEventListener("keydown",es,{capture:!0,passive:!0}),window.addEventListener("popstate",ts)}function Lo(){document.removeEventListener("click",Ji,{capture:!0}),document.removeEventListener("keydown",es,{capture:!0}),window.removeEventListener("popstate",ts),I=null}function Co(){I=null}function _c(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,Qi)){if(Cc(t)){I=null;return}I={el:p(t),label:h(t),t:Date.now()}}}function Tc(e){e.key==="Escape"&&ns("escape")}function Lc(){ns("back_nav")}function ns(e){if(!I)return;let t=Date.now()-I.t;if(t>Sc){I=null;return}d({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:I.el,...I.label?{el_label:I.label}:{},elapsed_ms:t}}),I=null}function Cc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var os=1e4,kc=3,xc=/^(checkbox|radio)$/,rs=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Ze=new Map,ko=[],is=f(Mc),ss=f(Ac);function xo(e){ko=e??[],document.addEventListener("change",is,{capture:!0,passive:!0}),document.addEventListener("click",ss,{capture:!0,passive:!0})}function Mo(){document.removeEventListener("change",is,{capture:!0}),document.removeEventListener("click",ss,{capture:!0}),Ze.clear()}function Ao(){Ze.clear()}function Mc(e){let t=e.target;t&&(v(t,ko)||Dc(t)&&as(t))}function Ac(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ko))return;let n=t.getAttribute("role")??"";rs.test(n)&&t.tagName!=="INPUT"&&as(t)}function as(e){let t=p(e),n=Date.now(),o=Ze.get(t);for(o||(o=[],Ze.set(t,o));o.length&&n-o[0].t>os;)o.shift();if(o.push({t:n}),o.length<kc)return;let r=h(e);d({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...r?{el_label:r}:{},cnt:o.length,window_ms:os}}),Ze.delete(t)}function Dc(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?xc.test(e.type??""):rs.test(e.getAttribute("role")??"")}var ls=15e3,Rc=3,X=[],cs=f(Ic);function Do(){document.addEventListener("copy",cs,{capture:!0,passive:!0})}function Ro(){document.removeEventListener("copy",cs,{capture:!0}),X=[]}function Io(){X=[]}function Ic(e){let t=e.target;if(t){let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let o=Date.now();for(;X.length&&o-X[0].t>ls;)X.shift();X.push({t:o}),!(X.length<Rc)&&(d({t:"sig",ts:o,d:{s:"copy_frustration",cnt:X.length,window_ms:ls}}),X=[])}var us=15e3,Oc=4,Nc=5,Pc=500,Hc=2e3,D=[],Yt=0,Qe=null,oe=null;function Oo(){Qe=y(Bc),oe=y(Fc),document.addEventListener("selectionchange",Qe),document.addEventListener("copy",oe,{capture:!0,passive:!0}),document.addEventListener("cut",oe,{capture:!0,passive:!0})}function No(){Qe&&(document.removeEventListener("selectionchange",Qe),Qe=null),oe&&(document.removeEventListener("copy",oe,{capture:!0}),document.removeEventListener("cut",oe,{capture:!0}),oe=null),D=[],Yt=0}function Po(){D=[],Yt=0}function Fc(){Yt=Date.now(),D=[]}function Bc(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<Nc)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let o=Date.now();if(o-Yt<Hc)return;for(;D.length&&o-D[0].t>us;)D.shift();let r=D[D.length-1];r&&o-r.t<Pc||(D.push({t:o}),!(D.length<Oc)&&(d({t:"sig",ts:o,d:{s:"text_select_frustration",cnt:D.length,window_ms:us}}),D=[]))}var Ho=6e4,Vc=20,fs="_fd_sess",qc={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},Wc=10,ds={low:1,medium:2,high:3,critical:4},V=[],Se=null,$t=!1,Te=new Map,_e={totalSignals:0,pagesWithFrustration:0},Fo="",Je=null,et=null,tt=null,nt=null;function jt(e){$t&&ps(e,Date.now())}function Uc(){try{let e=sessionStorage.getItem(fs);if(e){let t=JSON.parse(e);_e={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function zc(){try{sessionStorage.setItem(fs,JSON.stringify(_e))}catch{}}function Xc(){let e=[],n=Date.now()-Ho,o=[];for(let[r,i]of Te.entries())for(let s of i)s>=n&&o.push({type:r,ts:s});o.sort((r,i)=>r.ts-i.ts);for(let r=0;r<o.length;r++)if(o[r].type==="rage_click"){for(let i=r+1;i<o.length;i++)if(o[i].type==="form_validation_loop"&&o[i].ts-o[r].ts<=3e4){e.push("rage_then_form_loop");break}}for(let r=0;r<o.length;r++)if(o[r].type==="dead_click")for(let i=r+1;i<o.length;i++){let s=o[i].type;if((s==="popstate"||s==="hashchange")&&o[i].ts-o[r].ts<=1e4){e.push("dead_then_bail");break}}for(let r=0;r<o.length;r++)if(o[r].type==="form_validation_loop"){for(let i=r+1;i<o.length;i++)if((o[i].type==="visibilitychange"||o[i].type==="pagehide")&&o[i].ts-o[r].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function ps(e,t){Te.has(e)||Te.set(e,[]);let n=Te.get(e);n.push(t),n.length>Vc&&n.shift()}function Yc(e){let t=e-Ho,n=0;for(;n<V.length&&V[n].ts<t;)n++;n>0&&(V=V.slice(n))}function jc(){let e=new Map,t=0;for(let n of V)e.set(n.type,(e.get(n.type)??0)+1),t+=qc[n.type]??Wc;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function ms(e){let t="",n=0;for(let[o,r]of e)(r>n||r===n&&o<t)&&(t=o,n=r);return{type:t,count:n}}function $c(e,t,n){return ms(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Kc(e,t,n,o){let r=ms(o),i=Xc();d({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Fo||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:Ho,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:_e.totalSignals,session_pages_with_frustration:_e.pagesWithFrustration}}),_e.totalSignals+=V.length,_e.pagesWithFrustration+=1,zc()}function Gc(e){if(!$t||e==="frustration_burst")return;let t=Date.now();Yc(t),V.length===0&&(Se=null),V.push({type:e,ts:t}),ps(e,t);let{distinctTypes:n,totalWeight:o,typeCounts:r}=jc(),i=$c(n.size,o,r);i&&(Se!==null&&ds[i]<=ds[Se]||(Se=i,Kc(i,n,o,r)))}function Bo(e){Fo=e}function Vo(e){V=[],Se=null,$t=!0,Te=new Map,Fo=e??"",Uc(),mn(Gc),Je=()=>jt("popstate"),et=()=>jt("hashchange"),tt=()=>{document.visibilityState==="hidden"&&jt("visibilitychange")},nt=()=>jt("pagehide"),window.addEventListener("popstate",Je),window.addEventListener("hashchange",et),document.addEventListener("visibilitychange",tt),window.addEventListener("pagehide",nt)}function qo(){$t=!1,V=[],Se=null,Te=new Map,mn(null),Je&&(window.removeEventListener("popstate",Je),Je=null),et&&(window.removeEventListener("hashchange",et),et=null),tt&&(document.removeEventListener("visibilitychange",tt),tt=null),nt&&(window.removeEventListener("pagehide",nt),nt=null)}var Zc=8,Wo=3e4,Uo=5,Qc=5e3,O=[],G="",ot=!1,gs=f(eu),hs=f(tu);function zo(){O=[],ot=!1,G=location.pathname+location.search+location.hash,window.addEventListener("popstate",gs),window.addEventListener("hashchange",hs)}function Xo(){window.removeEventListener("popstate",gs),window.removeEventListener("hashchange",hs),O=[],ot=!1,G=""}function Yo(){O=[],ot=!1,G=location.pathname+location.search+location.hash}function rt(e){let t=Date.now();if(G&&G!==e){let n=O[O.length-1];n&&n.path===G&&n.leftAt===null&&(n.leftAt=t)}for(;O.length&&t-O[0].ts>Wo;)O.shift();e!==G&&(O.push({path:e,ts:t,leftAt:null}),G=e),!(O.length<Uo)&&(ot||Jc(t))}function Jc(e){let t=O.filter(c=>e-c.ts<=Wo),n=t.filter(c=>c.leftAt!==null),o=new Set(t.map(c=>c.path));if(o.size<Uo||n.length===0||n.some(c=>c.leftAt-c.ts>=Qc)||new Set(n.map(c=>c.path)).size<Uo)return;let s=n.map(c=>c.leftAt-c.ts),a=Math.round(s.reduce((c,m)=>c+m,0)/s.length),u=Math.max(...s),l=t.map(c=>c.path).slice(-Zc);ot=!0,d({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:o.size,window_ms:Wo,avg_dwell_ms:a,pages:l,max_dwell_ms:u}})}function eu(){let e=location.pathname+location.search+location.hash;rt(e)}function tu(){let e=location.pathname+location.search+location.hash;rt(e)}var nu=.3,vs=3e3,Y=[],it=!1,re="none",ie=0,st=0,at=0,N=!1,Es=f(ou),ws=f(iu);function jo(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1,window.addEventListener("scroll",Es,{passive:!0}),window.addEventListener("click",ws,{capture:!0})}function $o(){window.removeEventListener("scroll",Es),window.removeEventListener("click",ws,{capture:!0}),Kt()}function Kt(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1}function ou(){it||(it=!0,requestAnimationFrame(ru))}function ru(){it=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,o=Y[Y.length-1];if(o&&e-o.ts<50||(Y.push({y:t,ts:e}),Y.length>60&&(Y=Y.slice(-40)),!o))return;let r=t-o.y;if(Math.abs(r)<2)return;if((r>0?"down":"up")==="down"){re!=="down"&&N&&(N=!1),t>ie&&(ie=t),re="down";return}if(N&&e-at>vs&&(N=!1),re==="down"){let s=ie-t,a=n*nu;s>=a&&!N&&(st=t,at=e,N=!0)}re="up"}function iu(e){if(!N)return;let t=Date.now();if(t-at>vs){N=!1;return}if(window.scrollY+e.clientY>st+window.innerHeight*.1)return;let o=window.innerHeight,r=Math.round(ie-st),i=Math.round(r/o*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",u=s?h(s):"";N=!1,ie=window.scrollY,re="none",Y=[],d({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:r,click_el:a,...u?{click_el_label:u}:{},scroll_back_pct:i}})}var su=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,au=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,lu=/^(A|BUTTON|LABEL)$/,cu=3,bs=9e4,uu=5,lt=new Map,ys=[],ct=null,du=5,Ss=f(fu),_s=f(Eu);function fu(e){ct={x:e.clientX,y:e.clientY}}function Ko(e){ys=e??[],document.addEventListener("mousedown",Ss,{capture:!0,passive:!0}),document.addEventListener("click",_s,{capture:!0,passive:!0})}function Go(){document.removeEventListener("mousedown",Ss,{capture:!0}),document.removeEventListener("click",_s,{capture:!0}),ct=null,lt.clear()}function Zo(){lt.clear()}function pu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function mu(e,t){return e*4+t}function gu(e){if(su.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&au.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&lu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function hu(){let e=window.getSelection();return e!==null&&e.toString().length>0}function vu(e){if(!ct)return!1;let t=e.clientX-ct.x,n=e.clientY-ct.y;return Math.sqrt(t*t+n*n)>du}function Eu(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ys)||hu()||vu(e)||gu(t))return;let{row:n,col:o}=pu(e.clientX,e.clientY),r=mu(n,o),i=Date.now(),s=p(t),u=(lt.get(r)??[]).filter(l=>i-l.ts<bs);if(u.push({ts:i,selector:s}),lt.set(r,u),u.length>=cu){let l=new Map;for(let g of u)l.set(g.selector,(l.get(g.selector)??0)+1);let c="",m=0;for(let[g,U]of l)U>m&&(m=U,c=g);let E=new Set,w=[];for(let g of u)if(!E.has(g.selector)&&(E.add(g.selector),w.push(g.selector),w.length>=uu))break;let b=(()=>{try{let g=c?document.querySelector(c):null;return g?h(g):""}catch{return""}})();d({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:u.length,dominant_el:c,...b?{dominant_el_label:b}:{},elements:w,window_ms:bs}}),lt.set(r,[])}}var Qo=3,Le=12e4,S=new Map,Zt=[],ut=null,Ts=f(_u),Gt=f(Tu);function er(e){Zt=e??[],document.addEventListener("invalid",Ts,{capture:!0,passive:!0}),document.addEventListener("input",Gt,{capture:!0,passive:!0}),document.addEventListener("change",Gt,{capture:!0,passive:!0}),ut=new MutationObserver(Lu),ut.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function tr(){document.removeEventListener("invalid",Ts,{capture:!0}),document.removeEventListener("input",Gt,{capture:!0}),document.removeEventListener("change",Gt,{capture:!0}),ut&&(ut.disconnect(),ut=null);for(let e of S.values())Z(e);S.clear()}function nr(){for(let e of S.values())Z(e);S.clear()}function Jo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function or(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function Qt(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function wu(e){for(let[t,n]of S)e-n.lastTs>Le&&(Z(n),S.delete(t))}function Z(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function bu(e){return f(t=>{ks(e)})}function yu(e){return f(t=>{ks(e)})}function Ls(e,t){let n=bu(t),o=yu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",o,{passive:!0});let r={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:o,el:e};return S.set(t,r),r}function Cs(e){if(!Qt(e)||v(e,Zt))return;let t=Date.now();wu(t);let n=p(e),o=S.get(n);if(!o){Ls(e,n);return}let r=o.lastTs;o.lastTs=t,o.phase==="edited"?(o.cycles+=1,o.phase="invalid",o.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Jo(e)}}),Z(o),S.delete(n))):o.phase==="invalid"&&t-r>500&&(o.cycles+=1,o.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Jo(e)}}),Z(o),S.delete(n)))}function Su(e){if(!Qt(e))return;let t=Date.now(),n=p(e),o=S.get(n);if(o){if(t-o.lastTs>Le){Z(o),S.delete(n);return}o.phase==="invalid"&&(o.phase="edited",o.lastTs=t)}}function ks(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Le){Z(n),S.delete(e);return}if(n.lastTs=t,or(n.el)){n.cycles+=1,n.cycles>=Qo&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Le,field_type:Jo(n.el)}}),Z(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function _u(e){let t=e.target;t&&Cs(t)}function Tu(e){let t=e.target;if(!t||!Qt(t)||v(t,Zt))return;let n=p(t);S.has(n)||or(t)&&Ls(t,n)}function Lu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!Qt(n)||v(n,Zt))continue;let o=t.oldValue,r=o==="true"||o==="",i=or(n);i&&!r?Cs(n):!i&&r&&Su(n)}}var Ce=null,dt=null,ir=[],xs=0,ft=new Map;function sr(e){ir=e?.length?e:["[data-fd-impression]"],xs=Date.now(),!(typeof IntersectionObserver>"u")&&(Ce=new IntersectionObserver(y(ku),{threshold:[0,.5,1]}),Ms(),dt=new MutationObserver(y(Cu)),dt.observe(document.body,{childList:!0,subtree:!0}))}function ar(){Ce&&(Ce.disconnect(),Ce=null),dt&&(dt.disconnect(),dt=null),ft.clear()}function lr(){ft.clear(),Ce&&Ms()}function Ms(){for(let e of ir)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)rr(t[n])}catch{}}function rr(e){ft.has(e)||(ft.set(e,{firstSeenTs:0,emitted:!1}),Ce.observe(e))}function Cu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let o=t.addedNodes[n];if(o instanceof Element)for(let r of ir)try{o.matches(r)&&rr(o);let i=o.querySelectorAll(r);for(let s=0;s<i.length;s++)rr(i[s])}catch{}}}function ku(e){let t=Date.now();for(let n of e){let o=ft.get(n.target);if(!(!o||o.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){o.firstSeenTs||(o.firstSeenTs=t),o.emitted=!0;let r=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=r.top<i*.5?"above_fold":"below_fold",a=p(n.target),u=h(n.target);d({t:"sig",ts:t,d:{s:"element_impression",el:a,...u?{el_label:u}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-xs),viewport_position:s}})}}}var xu=2,Mu=3,Au=6e4,pt=new Map,As=[],Ds=f(Du);function cr(e){As=e??[],document.addEventListener("input",Ds,{capture:!0,passive:!0})}function ur(){document.removeEventListener("input",Ds,{capture:!0}),pt.clear()}function dr(){pt.clear()}function Du(e){let t=e.target;if(!t||!Ru(t)||v(t,As))return;let n=Date.now(),o=t.value??"",r=p(t),i=pt.get(r);if(!i){pt.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Au){i.lastValue=o,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-o.length;if(i.phase==="typing"&&s>=Mu)i.phase="deleted";else if(i.phase==="deleted"&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=xu)){let a=h(t);d({t:"sig",ts:n,d:{s:"input_correction",el:r,...a?{el_label:a}:{},cycles:i.cycles,field_type:Iu(t)}}),pt.delete(r);return}i.lastValue=o}function Ru(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Iu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Rs=2e3,Ou=3e4,q=null,Is=Rs,Os=[],Jt=new Map,Ns=f(Nu),Ps=f(Pu),Hs=f(mt);function fr(e,t){Is=e?.dwellMs??Rs,Os=t??[],document.addEventListener("mouseover",Ns,{passive:!0}),document.addEventListener("mouseout",Ps,{passive:!0}),document.addEventListener("click",Hs,{capture:!0,passive:!0})}function pr(){document.removeEventListener("mouseover",Ns),document.removeEventListener("mouseout",Ps),document.removeEventListener("click",Hs,{capture:!0}),mt(),Jt.clear()}function mr(){mt(),Jt.clear()}function Nu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Os)||!Hu(t))return;let n=p(t);if(q?.selector===n)return;mt();let o=Date.now();if(o-(Jt.get(n)??0)<Ou)return;let r=o,i=setTimeout(()=>{let s=Date.now(),a=h(t);Jt.set(n,s),q=null,d({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-r)}})},Is);q={el:t,selector:n,startTs:r,timer:i}}function Pu(e){if(!q)return;let t=e.target;if(t!==q.el&&!q.el.contains(t))return;let n=e.relatedTarget;n&&q.el.contains(n)||mt()}function mt(){q&&(clearTimeout(q.timer),q=null)}function Hu(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let o=window.getComputedStyle(e);return o.cursor==="pointer"&&o.pointerEvents!=="none"}catch{return!1}}var Fu=20,Bu=500,Vu=3e3,qu=6e4,en=0,tn=0,W=null,Fs=y(Wu);function gr(){en=Date.now(),tn=0,document.addEventListener("mouseleave",Fs)}function hr(){document.removeEventListener("mouseleave",Fs),W&&(clearTimeout(W),W=null)}function vr(){en=Date.now(),tn=0,W&&(clearTimeout(W),W=null)}function Wu(e){if(e.clientY>Fu)return;let t=Date.now();t-en<Vu||t-tn<qu||(W&&clearTimeout(W),W=setTimeout(y(()=>{let n=Date.now();tn=n,W=null,d({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-en)}})}),Bu))}var Uu=2500,zu=4e3,Bs=200,Xu=500,Yu=.1,ju=.25,xe=null,Me=null,j=null,ke=0;function Er(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function wr(){if(!(typeof PerformanceObserver>"u")){try{xe=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let o=Math.round(n.startTime);d({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:Er(o,Uu,zu)}})})),xe.observe({type:"largest-contentful-paint",buffered:!0})}catch{xe=null}try{Me=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let o=Math.round(n.duration);o<Bs||d({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:o,rating:Er(o,Bs,Xu)}})}})),Me.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Me=null}try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!0})}catch{j=null}}}function Vs(){if(j){if(j.disconnect(),j=null,ke>0){let e=Math.round(ke*1e3)/1e3;d({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Er(ke,Yu,ju)}})}ke=0}}function br(){xe&&(xe.disconnect(),xe=null),Me&&(Me.disconnect(),Me=null),Vs()}function yr(){if(Vs(),!(typeof PerformanceObserver>"u"))try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!1})}catch{j=null}}var qs=[],Ws=f($u);function Sr(e){qs=e??[],document.addEventListener("paste",Ws,{capture:!0,passive:!0})}function _r(){document.removeEventListener("paste",Ws,{capture:!0})}function $u(e){let t=e.target;if(!t||!Ku(t)||v(t,qs))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let r=p(t),i=h(t);d({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:r,...i?{el_label:i}:{},field_type:Gu(t)}})},100)}function Ku(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Gu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Zu="https://api.flusterduck.com/v1/ingest",Q=!1,nn=null,gt=null;function Qu(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function Tr(e){if(Q||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Ju()){gt=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){gt=e;return}gt=e,Q=!0;let t=Mr(e.cookieless??!1),n=Qu(e.endpoint)??Zu,o=vn(location.pathname,e.pageRules??[]),r=ed(e.domMode);Wr(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=Us(location.pathname,e.ignorePages??[]);i&&gn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||d({t:"pv",ts:Date.now(),d:{ref:a}});let u=e.ignoreElements??[],l=c=>e.signals?.[c]?.enabled!==!1;if(l("rageClick")&&wn(e.signals?.rageClick,u),l("deadClick")&&yn(u),l("speedFrustration")){let c=e.signals?.speedFrustration;Ln(c?{delayMs:c.windowMs}:void 0,u)}if(e.trackMouse!==!1&&l("thrashCursor")){let c=e.signals?.thrashCursor;Dn(c?{velocityThreshold:c.threshold,windowMs:c.windowMs}:void 0)}if(l("loopNav")&&Nn(e.signals?.loopNav),l("scrollBounce")&&qn(),e.trackForms!==!1){if(l("formHesitation")||l("formAbandon")){let c=e.signals?.formHesitation;Xn(c?{pauseMs:c.threshold}:void 0,u)}l("formValidationLoop")&&er(u)}if(l("errorEncounter")&&Kn(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&eo(u),(l("tabThrash")||l("focusTrap")||l("keyboardNavFrustration"))&&oo(u),l("scrollHijack")&&ao(),l("scrollDepthAbandon")&&co(),l("advancedHeuristics")&&go(),l("helpHunt")&&Eo(u),l("closeClick")&&yo(u),l("closeClickReversal")&&To(u),l("filterSpiral")&&xo(u),l("copyFrustration")&&Do(),l("textSelectFrustration")&&Oo(),l("deadClickTrapZone")&&Ko(u),Vo(o),l("navigationConfusion")&&zo(),l("scrollToClickConfusion")&&jo(),l("elementImpression")&&sr(e.elementImpressionSelectors),e.trackForms!==!1&&l("inputCorrection")&&cr(u),e.trackForms!==!1&&l("pasteBlocked")&&Sr(u),l("hoverDwell")){let c=e.signals?.hoverDwell;fr(c?.threshold?{dwellMs:c.threshold}:void 0,u)}l("exitIntent")&&gr(),l("performanceVitals")&&wr(),nn=Xr(y((c,m)=>{J(),Un(),jn(),fo(),kn(),Ge(),vo(),bo(),_o(),Co(),Ao(),Io(),Po(),Zo(),nr(),_n(),Ft(),Kt(),Yo(),lr(),dr(),mr(),vr(),yr(),rt(m),Bo(m);let E=vn(m,e.pageRules??[]),w=Us(m,e.ignorePages??[]);gn(w),hn({page:E,url:c}),Hn(m),w||d({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function zs(e,t){if(!Q||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);d({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Xs(e,t={}){if(!Q||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||d({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Ys(e){if(!Q||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}hn({segment:t})}function js(e){e&>&&!Q?Tr(gt):e||(on(),cn())}function $s(){on(),cn()}function on(){Q&&(bn(),Sn(),Cn(),Rn(),Pn(),Wn(),Yn(),Gn(),to(),ro(),lo(),uo(),ho(),wo(),So(),Lo(),Mo(),Ro(),No(),Go(),tr(),qo(),Xo(),$o(),ar(),ur(),pr(),hr(),br(),_r(),Ur(),nn&&(nn(),nn=null),Q=!1)}function Ju(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function ed(e){return e==="metadata"||e==="snapshot"?e:"off"}function Us(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { init, signal, identify, setConsent, optOut, destroy } from './core';
|
|
1
|
+
export { init, signal, track, identify, setConsent, optOut, destroy } from './core';
|
|
2
2
|
export type { Config, SDKEvent, SnapshotData } from './types';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function S(e){return(...t)=>{try{return e(...t)}catch{}}}function d(e){return t=>{try{e(t)}catch{}}}var de="_fd_s";var pn=/^[0-9a-f]{32}$/;function it(e){if(e)return rt();let t=hn(de);if(t&&pn.test(t))return t;let n=rt();return st(de,n,30),n}function fe(){st(de,"",-1)}function rt(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function hn(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function st(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var gn=/^[:\d]|--|^(ember|react|ng-|__)/;function f(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${q(t)}"]`;if(e.id&&!gn.test(e.id)&&e.id.length<64)return"#"+q(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),a=o.getAttribute("name"),s=o.getAttribute("role"),c=o.getAttribute("type");a&&a.length<64?i+=`[name="${q(a)}"]`:s?i+=`[role="${q(s)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${q(c)}"]`);let l=o.parentElement;if(l){let g=l.children,b=0,j=0;for(let O=0;O<g.length;O++){let ue=g[O];ue&&ue.tagName===o.tagName&&(b++,ue===o&&(j=b))}b>1&&(i+=`:nth-of-type(${j})`)}n.unshift(i);let h=n.join(" > ");try{if(document.querySelectorAll(h).length===1)return h}catch{}o=l,r++}return n.join(" > ")}function q(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}function w(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ct(e,t){if(t==="off")return null;if(t==="metadata")return vn(e);let n=bn(e);return n?{mode:"snapshot",...n}:null}function vn(e){return{mode:"metadata",selector:f(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:at(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:at(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:wn(e)}}}function bn(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let a=0;a<o.children.length&&r.length<6;a++){let s=o.children[a];if(!s||s===e)continue;let c=s.getBoundingClientRect();r.push({selector:f(s),tag:s.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:yn(s)})}let i=[];try{let a=e.getAnimations();for(let s of a)"animationName"in s&&i.push(s.animationName)}catch{}return{selector:f(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?f(o):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:En(t),animations:i,siblings:r}}catch{return null}}function at(e,t){return e&&t.includes(e)?e:null}function wn(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function En(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function yn(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var ut=3e3,dt=50,ft=50,Sn=3,Mn=65536,N=[],A=null,Z="",mt=ut,pt=dt,v=null,pe={domMode:"off"},me=!1,Tn=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),xn=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),An=/(?:value|text|label|email|e-mail|name|phone|address|password|token|secret|cookie|session|jwt|auth|credential|card|cc|cvv|ssn)/i,kn=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,ht=d(Ln),gt=S(()=>D());function vt(e,t,n,o,r){Z=e,v=Object.assign(Object.create(null),t),pe={domMode:On(r?.domMode)},mt=Math.max(1e3,Math.min(n??ut,3e4)),pt=Math.max(5,Math.min(o??dt,ft)),document.addEventListener("visibilitychange",ht),window.addEventListener("pagehide",gt)}function u(e){N.length>=ft||(N.push(e),N.length>=pt?D():A||(A=setTimeout(D,mt)))}function D(){if(me||!N.length||!v)return;me=!0,A&&(clearTimeout(A),A=null);let e=N;N=[];let t={v:1,sid:v.sid,key:v.key,url:v.url,page:v.page,ts:Date.now(),ua:v.ua,vw:v.vw,vh:v.vh,environment:v.environment,dom_mode:pe.domMode,events:e.map(n=>Dn(n,v.page,pe.domMode))};try{let n=JSON.stringify(t);n.length<=Mn&&wt(n,0)}catch{}me=!1}function he(e){if(v)for(let t of Object.keys(e))Tn.has(t)&&(v[t]=e[t])}function bt(){D(),document.removeEventListener("visibilitychange",ht),window.removeEventListener("pagehide",gt),A&&(clearTimeout(A),A=null)}function Ln(){document.visibilityState==="hidden"&&D()}function wt(e,t){if(Z){if(navigator.sendBeacon){let n=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(Z,n))return}try{fetch(Z,{method:"POST",body:e,headers:{"Content-Type":"application/json"},keepalive:!0}).catch(()=>{t<Sn&&setTimeout(()=>wt(e,t+1),1e3*(t+1))})}catch{}}}function Dn(e,t,n){let o=e.d??{},r=Rn(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},a=lt(o.el,o.element,o.target);if(r==="signal"){i.signal_type=lt(o.s,o.signal_type,o.name)?.slice(0,128),a&&(i.element=a.slice(0,2048));let c=a?Cn(a,n):null;c&&(i.dom=c)}let s=_n(o);return Object.keys(s).length&&(i.metadata=s),i}function Rn(e){return e==="pv"?"pageview":e==="sig"?"signal":xn.has(e)?e:"custom_signal"}function _n(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let o=J(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=J(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function J(e,t="",n=0){if(!(n>4)&&!An.test(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return kn.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>J(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=J(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Cn(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ct(n,t):null}catch{return null}}function lt(...e){for(let t of e)if(typeof t=="string"&&t)return t}function On(e){return e==="metadata"||e==="snapshot"?e:"off"}function Et(e){let t=location.href;function n(){let s=location.href;s!==t&&(t=s,e(s,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...s){o.apply(this,s),n()},a=function(...s){r.apply(this,s),n()};return history.pushState=i,history.replaceState=a,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===a&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function ge(e,t){for(let n of t){let o=In(n.pattern);if(o&&o.test(e))return n.label}return Fn(e)}var Nn=/^[a-zA-Z0-9/:._*\-]+$/;function In(e){if(e.length>200||!Nn.test(e))return null;let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function Fn(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Pn=[".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"]'],k=[],ve=3,St=2e3,yt=8,Mt=[],Tt=d(Un);function be(e,t){ve=e?.threshold??3,St=e?.windowMs??2e3,Mt=[...Pn,...t??[]],document.addEventListener("click",Tt,{capture:!0,passive:!0})}function we(){document.removeEventListener("click",Tt,{capture:!0}),k=[]}function Un(e){let t=e.target;if(!t||w(t,Mt)||Hn(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;k.length&&n-k[0].t>St;)k.shift();if(k.push({t:n,x:o,y:r,el:t}),k.length<ve)return;let i=k.slice(-ve),a=i[0];for(let g=1;g<i.length;g++){let b=i[g],j=b.x-a.x,O=b.y-a.y;if(j*j+O*O>yt*yt)return}let s=a.t,l=(i[i.length-1].t-s)/1e3,h=l>0?i.length/l:i.length;u({t:"sig",ts:n,d:{s:"rage_click",el:f(t),cnt:i.length,vel:Math.round(h*10)/10}}),k=[]}function Hn(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick"))}var jn=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,qn=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Bn=/^(A|BUTTON|LABEL)$/,xt=[],B=null,Vn=5,At=d(Xn),kt=d(Yn);function Xn(e){B={x:e.clientX,y:e.clientY}}function Ee(e){xt=e??[],document.addEventListener("mousedown",At,{capture:!0,passive:!0}),document.addEventListener("click",kt,{capture:!0,passive:!0})}function ye(){document.removeEventListener("mousedown",At,{capture:!0}),document.removeEventListener("click",kt,{capture:!0}),B=null}function Yn(e){if(e.button!==0||e.detail===0)return;let t=e.target;if(!t||w(t,xt)||Kn()||Wn(e)||$n(t))return;let n=zn(t,e.clientX,e.clientY),o=n?Lt(e.clientX,e.clientY,n):-1;u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:f(t),near:n?f(n):"",dist:Math.round(o)}})}function $n(e){if(jn.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&qn.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;if(n&&Bn.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))return!0;try{if(getComputedStyle(e).cursor==="pointer")return!0}catch{return!1}return!1}function zn(e,t,n){let o=e.parentElement;if(!o)return null;let r=o.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),i=null,a=1/0;for(let s=0;s<r.length;s++){let c=r[s];if(!c)continue;let l=Lt(t,n,c);l<a&&(a=l,i=c)}return i}function Lt(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),a=e-r,s=t-i;return Math.sqrt(a*a+s*s)}function Kn(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Wn(e){if(!B)return!1;let t=e.clientX-B.x,n=e.clientY-B.y;return Math.sqrt(t*t+n*n)>Vn}var m=null,Se=3e3,Dt=[],Qn=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Gn=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Rt=d(Zn);function Me(e,t){Se=e?.delayMs??3e3,Dt=t??[],document.addEventListener("click",Rt,{capture:!0,passive:!0})}function Te(){document.removeEventListener("click",Rt,{capture:!0}),V()}function Zn(e){let t=e.target;if(!t||w(t,Dt))return;let n=t.getAttribute("role");if(!Qn.test(t.tagName)&&!(n&&Gn.test(n)))return;if(m){if(m.el===t||m.el.contains(t)){let c=Date.now()-m.ts;c>=Se&&u({t:"sig",ts:Date.now(),d:{s:"speed_frustration",el:m.selector,delay:c}}),V();return}V()}let o=f(t),r=!1,i=new MutationObserver(c=>{for(let l of c){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){r=!0,V();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){r=!0,V();return}}}),a=t.parentElement||document.body;i.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let s=setTimeout(()=>{!r&&m&&(m={...m,timeout:null})},Se+500);m={el:t,selector:o,ts:Date.now(),observer:i,timeout:s}}function V(){m&&(m.observer.disconnect(),m.timeout&&clearTimeout(m.timeout),m=null)}var Jn=100,Ct=800,Ot=2e3,eo=3,_t=0,to=50,ee=0,te=0,X=0,Y=0,$=0,ne=0,xe=0,R=[],Nt=d(no);function Ae(e){Ct=e?.velocityThreshold??800,Ot=e?.windowMs??2e3,document.addEventListener("mousemove",Nt,{passive:!0})}function ke(){document.removeEventListener("mousemove",Nt),It()}function no(e){let t=Date.now();t-_t<to||(_t=t,oo(e.clientX,e.clientY,t))}function oo(e,t,n){if(X===0){ee=e,te=t,X=n,xe=n;return}let o=(n-X)/1e3;if(o===0)return;let r=e-ee,i=t-te,s=Math.sqrt(r*r+i*i)/o;R.length>=Jn&&(R=R.slice(-50)),R.push(s);let c=Math.sign(r),l=Math.sign(i);if((Y!==0&&c!==0&&c!==Y||$!==0&&l!==0&&l!==$)&&ne++,Y=c||Y,$=l||$,ee=e,te=t,X=n,n-xe>Ot){if(ne>=eo){let h=R.reduce((g,b)=>g+b,0)/R.length;h>=Ct&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(h),rev:ne}})}It(),xe=n}}function It(){ne=0,R=[],Y=0,$=0,X=0,ee=0,te=0}var ro=100,p=[],Ft=3e4;function Le(e){Ft=e?.windowMs??3e4}function De(){p=[]}function Re(e){let t=Date.now();for(;p.length&&t-p[0].ts>Ft;)p.shift();if(p.length>=ro&&(p=p.slice(-50)),p.push({path:e,ts:t}),p.length<4)return;let n=e,o=!1,r=[];for(let i=p.length-2;i>=1;i--)if(p[i-1].path===n){let a=p.slice(i-1,p.length);for(let s of a)r.includes(s.path)||r.push(s.path);o=!0;break}o&&r.length>=2&&(u({t:"sig",ts:t,d:{s:"loop_nav",pages:r}}),p=[{path:e,ts:t}])}var io=100,Pt=1e4,Oe=.5,E=[],oe=0,Ne=0,_e=!1,Ce=0,Ut=d(so);function Ie(e){Pt=e?.windowMs??1e4,Oe=e?.depthThreshold??.5,window.addEventListener("scroll",Ut,{passive:!0})}function Fe(){window.removeEventListener("scroll",Ut),E=[]}function Pe(){E=[],oe=0,Ne=0}function so(){_e||(_e=!0,requestAnimationFrame(()=>{_e=!1,ao()}))}function ao(){let e=Date.now(),t=window.scrollY;if(Ce=document.documentElement.scrollHeight-window.innerHeight,Ce<=0)return;let n=t/Ce,o=t>oe?"down":"up";if(e-Ne<100){oe=t;return}for(;E.length&&e-E[0].ts>Pt;)E.shift();E.length>=io&&(E=E.slice(-50)),E.push({depth:n,ts:e,direction:o}),oe=t,Ne=e;let r=0,i=1,a=0,s=!1;for(let c=0;c<E.length;c++){let l=E[c].depth;l>r&&(r=l),l>=Oe&&(s=!0),s&&l<i&&(i=l),s&&i<.25&&l>=Oe&&(a++,s=!1,i=1)}a>=1&&(u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:a+1}}),E=[])}var co=["textarea",'[role="textbox"]',"[contenteditable]"],K=new Map,L=new Set,_=null,Ue=0,Ht=5e3,jt=[],qt=d(lo),Bt=d(uo),Vt=d(fo),Xt=S(Yt),z=null;function He(e,t){Ht=e?.pauseMs??5e3,jt=t??[],document.addEventListener("focusin",qt,{capture:!0,passive:!0}),document.addEventListener("focusout",Bt,{capture:!0,passive:!0}),document.addEventListener("submit",Vt,{capture:!0,passive:!0}),window.addEventListener("pagehide",Xt),z=S(()=>{document.visibilityState==="hidden"&&Yt()}),document.addEventListener("visibilitychange",z)}function je(){document.removeEventListener("focusin",qt,{capture:!0}),document.removeEventListener("focusout",Bt,{capture:!0}),document.removeEventListener("submit",Vt,{capture:!0}),window.removeEventListener("pagehide",Xt),z&&(document.removeEventListener("visibilitychange",z),z=null),K.clear(),L.clear(),_=null}function qe(){K.clear(),L.clear(),_=null,Ue=0}function lo(e){let t=e.target;if(!t||!$t(t)||w(t,jt)||mo(t))return;K.set(t,Date.now());let n=t.closest("form");n&&n!==_&&(_=n,Ue=n.querySelectorAll("input, select, textarea").length)}function uo(e){let t=e.target;if(!t||!$t(t))return;let n=K.get(t);if(K.delete(t),n){let r=Date.now()-n;r>=Ht&&u({t:"sig",ts:Date.now(),d:{s:"form_hesitation",el:f(t),pause:r}})}let o=t.getAttribute("name")||t.getAttribute("id")||f(t);po(t)&&L.add(o)}function fo(){L.clear(),_=null}function Yt(){L.size>0&&_&&(u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:L.size,total:Ue||L.size}}),L.clear(),_=null)}function $t(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function mo(e){if(e.tagName==="TEXTAREA")return!0;for(let t of co)try{if(e.matches(t))return!0}catch{return!1}return!1}function po(e){return"value"in e?e.value.length>0:!1}var I=null,W=null,zt=/flusterduck\.com|\/v1\/ingest/,Wt=d(ho),Qt=d(go);function Be(){window.addEventListener("error",Wt),window.addEventListener("unhandledrejection",Qt),vo()}function Ve(){window.removeEventListener("error",Wt),window.removeEventListener("unhandledrejection",Qt),bo()}function ho(e){u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Xe(e.message||"Unknown error",200),ep:"",status:0}})}function go(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Xe(t,200),ep:"",status:0}})}function vo(){I||(I=window.fetch,W=function(t,n){let o;try{o=I.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;zt.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:Kt(i),status:r.status}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;zt.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Xe(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?Kt(t):"",status:0}})}catch{}throw r})},window.fetch=W)}function bo(){I&&W&&window.fetch===W&&(window.fetch=I),I=null,W=null}function Kt(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function Xe(e,t){let n=e.length>t?e.slice(0,t):e;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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Gt=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],wo=['[class*="map"]',"canvas",".gallery","[data-zoom]"],F=null,M=0,re=0,Q=0,Zt=0,Jt=null,en=[],tn=d(Eo),nn=d(yo),on=d(To),rn=d(Ao),sn=d(xo);function Ye(e){en=e??[],document.addEventListener("touchstart",tn,{passive:!0}),document.addEventListener("touchend",nn,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",on,{passive:!0}),window.addEventListener("orientationchange",rn,{passive:!0})),window.visualViewport?.addEventListener("resize",sn)}function $e(){document.removeEventListener("touchstart",tn),document.removeEventListener("touchend",nn),document.removeEventListener("gesturechange",on),window.removeEventListener("orientationchange",rn),window.visualViewport?.removeEventListener("resize",sn)}function Eo(e){let t=e.touches[0];e.touches.length===1&&t&&(F={x:t.clientX,y:t.clientY,ts:Date.now()})}function yo(e){if(!F||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-F.x,o=t.clientY-F.y,r=Date.now()-F.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&So(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&Mo(i,n,o),F=null}function So(e,t,n){if(w(e,en))return;let o=ko(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),a=Math.max(r.top,Math.min(n,r.bottom)),s=Math.sqrt((t-i)**2+(n-a)**2);if(s>0&&s<=20){let c=`${Math.round(r.width)}x${Math.round(r.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:f(o),dist:Math.round(s),size:c}})}}function Mo(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Gt.some(a=>{try{return e.matches(a)||e.closest(a)}catch{return!1}})||!Gt.some(a=>{try{return document.querySelector(a)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function To(){let e=Date.now();if(e-re>3e4&&(M=0,re=e),M++,M>=2){let t=document.activeElement||document.body;wo.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})||u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:M}}),M=0}}function xo(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();t-re>3e4&&(M=0,re=t),M++,M>=2&&(u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:M}}),M=0)}}function Ao(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-Zt>3e4&&(Q=0,Zt=e),t!==Jt&&(Q++,Jt=t),Q>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:Q}}),Q=0)}function ko(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,a=21;for(let s=0;s<r.length;s++){let c=r[s];if(!c)continue;let l=c.getBoundingClientRect(),h=Math.max(l.left,Math.min(t,l.right)),g=Math.max(l.top,Math.min(n,l.bottom)),b=Math.sqrt((t-h)**2+(n-g)**2);b<a&&b>0&&(a=b,i=c)}return i}var y=[],P=null,x=0,ze=0,T=[],Lo=10,Do=5e3,an=5,Ro=3e3,_o=15,Co=5e3,cn=d(Oo);function Ke(){document.addEventListener("keydown",cn,{capture:!0,passive:!0})}function We(){document.removeEventListener("keydown",cn,{capture:!0}),y=[],T=[],P=null}function Oo(e){let t=Date.now(),n=e.target;n&&w(n,[])||(e.key==="Tab"?No(t,n):e.key==="Escape"?Io(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Fo(t,e.target))}function No(e,t){for(;y.length&&e-y[0].ts>Do;)y.shift();y.length>=50&&(y=y.slice(-25));let n=t?f(t):"";if(y.push({ts:e,el:n}),y.length>=Lo){let r=y.map(i=>i.el).filter(Boolean);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:y.length,els:r}}),y=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');o&&(o===P?e-ze<=Ro?(x++,x>=an&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:f(o),attempts:x}}),x=0,P=null)):(ze=e,x=1):(P=o,ze=e,x=1))}function Io(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');n&&n===P&&(x++,x>=an&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:f(n),attempts:x}}),x=0,P=null))}function Fo(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;T.length&&e-T[0].ts>Co;)T.shift();T.length>=50&&(T=T.slice(-25)),T.push({ts:e,container:n});let o=T.filter(r=>r.container===n);o.length>=_o&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:f(n),keys:o.length}}),T=[])}var U=0,ie=0,se=null,Qe=0,ae=!1,Po=4,Uo=3e3,ln=d(Ho);function Ge(){window.addEventListener("scroll",ln,{passive:!0})}function Ze(){window.removeEventListener("scroll",ln),U=0,ie=0,se=null,Qe=0,ae=!1}function Ho(){ae||(ae=!0,requestAnimationFrame(()=>{ae=!1,jo()}))}function jo(){let e=Date.now(),t=window.scrollY,n=t-ie;if(Math.abs(n)<2){ie=t;return}let o=n>0?"down":"up";se&&o!==se&&(e-Qe>Uo&&(U=0,Qe=e),U++,U>=Po&&Math.abs(n)>100&&(u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:U}}),U=0)),se=o,ie=t}var H=0,ce=!1,un=d(qo),dn=S(fn),G=null;function Je(){window.addEventListener("scroll",un,{passive:!0}),window.addEventListener("pagehide",dn),G=S(()=>{document.visibilityState==="hidden"&&fn()}),document.addEventListener("visibilitychange",G)}function et(){window.removeEventListener("scroll",un),window.removeEventListener("pagehide",dn),G&&(document.removeEventListener("visibilitychange",G),G=null),H=0,ce=!1}function tt(){H=0}function qo(){ce||(ce=!0,requestAnimationFrame(()=>{ce=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>H&&(H=t)}}))}function fn(){H>.05&&u({t:"sig",ts:Date.now(),d:{s:"scroll_depth_abandon",depth:Math.round(H*100)/100}})}var Bo="https://api.flusterduck.com/v1/ingest",C=!1,le=null,nt=null;function Vo(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function mn(e){if(C||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_")||e.respectDoNotTrack!==!1&&Ko()||e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate)return;nt=e,C=!0;let t=it(e.cookieless??!1),n=Vo(e.endpoint)??Bo,o=ge(location.pathname,e.pageRules??[]),r=Wo(e.domMode);vt(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r});let i=document.referrer,a="";if(i)try{a=new URL(i).origin+new URL(i).pathname}catch{a=""}u({t:"pv",ts:Date.now(),d:{ref:a}});let s=e.ignoreElements??[],c=l=>e.signals?.[l]?.enabled!==!1;if(c("rageClick")&&be(e.signals?.rageClick,s),c("deadClick")&&Ee(s),c("speedFrustration")){let l=e.signals?.speedFrustration;Me(l?{delayMs:l.windowMs}:void 0,s)}if(e.trackMouse!==!1&&c("thrashCursor")&&Ae(e.signals?.thrashCursor),c("loopNav")&&Le(e.signals?.loopNav),c("scrollBounce")&&Ie(),e.trackForms!==!1&&(c("formHesitation")||c("formAbandon"))){let l=e.signals?.formHesitation;He(l?{pauseMs:l.threshold}:void 0,s)}c("errorEncounter")&&Be(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&Ye(s),(c("tabThrash")||c("focusTrap")||c("keyboardNavFrustration"))&&Ke(),c("scrollHijack")&&Ge(),c("scrollDepthAbandon")&&Je(),le=Et(S((l,h)=>{D(),Pe(),qe(),tt();let g=ge(h,e.pageRules??[]);he({page:g,url:l}),Re(h),u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function Xo(e,t){if(!C||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:"custom",name:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Yo(e){if(!C||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}he({segment:t})}function $o(e){e&&nt&&!C?mn(nt):e||(ot(),fe())}function zo(){ot(),fe()}function ot(){C&&(we(),ye(),Te(),ke(),De(),Fe(),je(),Ve(),$e(),We(),Ze(),et(),bt(),le&&(le(),le=null),C=!1)}function Ko(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Wo(e){return e==="metadata"||e==="snapshot"?e:"off"}export{ot as destroy,Yo as identify,mn as init,zo as optOut,$o as setConsent,Xo as signal};
|
|
1
|
+
function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var sn="_fd_s";var Xs=/^[0-9a-f]{32}$/;function kr(e){if(e)return Cr();let t=Ys(sn);if(t&&Xs.test(t))return t;let n=Cr();return xr(sn,n,30),n}function an(){xr(sn,"",-1)}function Cr(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function Ys(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function xr(e,t,n){let o=new Date;o.setTime(o.getTime()+n*864e5);let r=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${o.toUTCString()};SameSite=Lax${r}`}var js=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${De(t)}"]`;if(e.id&&!js.test(e.id)&&e.id.length<64)return"#"+De(e.id);let n=[],o=e,r=0;for(;o&&o!==document.body&&r<5;){let i=o.tagName.toLowerCase(),s=o.getAttribute("name"),a=o.getAttribute("role"),u=o.getAttribute("type");s&&s.length<64?i+=`[name="${De(s)}"]`:a?i+=`[role="${De(a)}"]`:u&&(i==="input"||i==="button")&&(i+=`[type="${De(u)}"]`);let l=o.parentElement;if(l){let m=l.children,E=0,w=0;for(let b=0;b<m.length;b++){let g=m[b];g&&g.tagName===o.tagName&&(E++,g===o&&(w=E))}E>1&&(i+=`:nth-of-type(${w})`)}n.unshift(i);let c=n.join(" > ");try{if(document.querySelectorAll(c).length===1)return c}catch{}o=l,r++}return n.join(" > ")}function De(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Re=60,$s=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ks=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Re);if(!Ks.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Re);if(i&&!$s.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Re);let o=e.getAttribute("title");if(o)return o.trim().slice(0,Re);let r=e.getAttribute("alt");return r?r.trim().slice(0,Re):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Ar(e,t){if(t==="off")return null;if(t==="metadata")return Gs(e);let n=Zs(e);return n?{mode:"snapshot",...n}:null}function Gs(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:Mr(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:Mr(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Qs(e)}}}function Zs(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),o=e.parentElement,r=[];if(o)for(let s=0;s<o.children.length&&r.length<6;s++){let a=o.children[s];if(!a||a===e)continue;let u=a.getBoundingClientRect();r.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(u.x),y:Math.round(u.y),w:Math.round(u.width),h:Math.round(u.height)},interactive:ea(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:o?p(o):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Js(t),animations:i,siblings:r}}catch{return null}}function Mr(e,t){return e&&t.includes(e)?e:null}function Qs(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Js(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function ea(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var Rr=7e3,ta=500,na=1e4,Ir=50,Or=100,oa=3,Ie=6e4,bt="application/json",ra="application/json; encoding=gzip",ae=[],$=null,Nr="",Pr=Rr,Hr=Ir,_=null,yt={domMode:"off",compression:"auto"},ln=!1,un=null,dn=!1;function fn(e){un=e}function pn(e){dn=e}var ia=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),sa=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),aa=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function la(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>aa.has(n))}var ca=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Fr=f(da),Br=y(()=>J());function Vr(e,t,n,o,r){Nr=e,_=Object.assign(Object.create(null),t),yt={domMode:wa(r?.domMode),compression:ba(r?.compression)},Pr=Math.max(ta,Math.min(n??Rr,na)),Hr=Math.max(1,Math.min(o??Ir,Or)),document.addEventListener("visibilitychange",Fr),window.addEventListener("pagehide",Br)}function d(e){dn||ae.length>=Or||(ae.push(e),ae.length>=Hr?J():$||($=setTimeout(J,Pr)))}function J(){ua()}async function ua(){if(ln||!ae.length||!_)return;ln=!0,$&&(clearTimeout($),$=null);let e=ae;ae=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:yt.domMode},n=e.map(r=>ga(r,_.page,yt.domMode)),o=[];try{for(let r of n){let i=[...o,r];if(JSON.stringify({...t,events:i}).length>Ie)if(o.length>0)await cn({...t,events:o}),o=[r];else{let a={...t,events:[r]};JSON.stringify(a).length<=Ie?await cn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),o=[]}else o=i}o.length>0&&await cn({...t,events:o})}catch{}finally{ln=!1}}function mn(e){if(_)for(let t of Object.keys(e))ia.has(t)&&(_[t]=e[t])}function qr(){J(),dn=!1,document.removeEventListener("visibilitychange",Fr),window.removeEventListener("pagehide",Br),$&&(clearTimeout($),$=null)}function da(){document.visibilityState==="hidden"&&J()}async function cn(e){let t=JSON.stringify(e),n=await fa(t,yt.compression);n&&Wr(n,0)}async function fa(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>Ie)return null;if(t!=="off"){let r=await pa(e);if(r&&r.byteLength<=Ie)return{beaconBody:new Blob([r],{type:ra}),fetchBody:new Uint8Array(r),headers:{"Content-Type":bt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:bt}),fetchBody:e,headers:{"Content-Type":bt}}}async function pa(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=ma(e);if(!n)return null;let o=new t("gzip"),i=n.pipeThrough(o).getReader(),s=[],a=0;for(;;){let c=await i.read();if(c.done)break;if(a+=c.value.byteLength,a>Ie)return null;let m=new Uint8Array(c.value.byteLength);m.set(c.value),s.push(m)}let u=new Uint8Array(a),l=0;for(let c of s)u.set(c,l),l+=c.byteLength;return u.buffer}catch{return null}}function ma(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:bt});if(typeof n.stream=="function")return n.stream();let o=globalThis.ReadableStream;return typeof o!="function"?null:new o({start(r){r.enqueue(t),r.close()}})}function Wr(e,t,n=Nr){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<oa&&setTimeout(()=>Wr(e,t+1,n),1e3*(t+1))})}catch{}}function ga(e,t,n){let o=e.d??{},r=ha(e.t),i={type:r,ts:e.ts,page:typeof o.page=="string"?o.page.slice(0,2048):t},s=Dr(o.el,o.element,o.target);if(r==="signal"){i.signal_type=Dr(o.s,o.signal_type,o.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let u=s?Ea(s,n):null;u&&(i.dom=u),i.signal_type&&un&&un(i.signal_type)}let a=va(o);return Object.keys(a).length&&(i.metadata=a),i}function ha(e){return e==="pv"?"pageview":e==="sig"?"signal":sa.has(e)?e:"custom_signal"}function va(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let o=St(e[n],n);o!==void 0&&(t[n.slice(0,64)]=o)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=St(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function St(e,t="",n=0){if(!(n>4)&&!la(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return ca.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(r=>St(r,t,n+1)).filter(r=>r!==void 0);if(typeof e=="object"){let o=Object.create(null);for(let r of Object.keys(e).slice(0,40)){if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let i=St(e[r],r,n+1);i!==void 0&&(o[r.slice(0,64)]=i)}return o}}}function Ea(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Ar(n,t):null}catch{return null}}function Dr(...e){for(let t of e)if(typeof t=="string"&&t)return t}function wa(e){return e==="metadata"||e==="snapshot"?e:"off"}function ba(e){return e==="off"?"off":"auto"}function Ur(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let o=history.pushState,r=history.replaceState,i=function(...a){o.apply(this,a),n()},s=function(...a){r.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=o),history.replaceState===s&&(history.replaceState=r),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function gn(e,t){for(let n of t){let o=Sa(n.pattern);if(o&&o.test(e))return n.label}return _a(e)}var ya=/^[a-zA-Z0-9/:._*\-]+$/;function Sa(e){if(e.length>200||!ya.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function _a(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var Ta=[".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"]'],P=[],zr=3,Xr=2e3,hn=8,Yr=[],le=[],jr=0,_t=new Map,Tt=new Map,La=1e4,Lt=!1,$r=f(Ca);function vn(e,t){Lt||(Lt=!0,zr=e?.threshold??3,Xr=e?.windowMs??2e3,Yr=[...Ta,...t??[]],jr=Date.now(),P=[],le=[],_t.clear(),Tt.clear(),document.addEventListener("click",$r,{capture:!0,passive:!0}))}function En(){Lt&&(Lt=!1,document.removeEventListener("click",$r,{capture:!0,passive:!0}),P=[],le=[],_t.clear(),Tt.clear())}function Ca(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Yr)||Aa(t))return;let n=Date.now(),o=e.clientX,r=e.clientY;for(;P.length&&n-P[0].t>Xr;)P.shift();P.push({t:n,x:o,y:r});let i=ka();if(P.length<i)return;let s=P.slice(-i);for(let k=0;k<s.length-1;k++)for(let Ae=k+1;Ae<s.length;Ae++){let vt=s[k],Et=s[Ae],wt=Et.x-vt.x,se=Et.y-vt.y;if(wt*wt+se*se>hn*hn)return}let a=s[0].t,l=(s[s.length-1].t-a)/1e3,c=l>0?s.length/l:s.length,m=(s.length-i)/i+c/10,E=Math.round(Math.min(1,m)*100)/100,w=Ma(s,i,c),b=p(t),g=h(t);le.push({selector:b,ts:n});let U=le.length,ht=xa(n),_r=_t.get(b)??0,on=_r+1,Tr=Tt.get(b)??0,Us=Tr>0&&n-Tr<La;_t.set(b,on),Tt.set(b,n);let Lr=_r>=1,zs=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Ae=s.reduce((se,rn)=>se+rn.x,0)/s.length,vt=s.reduce((se,rn)=>se+rn.y,0)/s.length,Et=k.left+k.width/2,wt=k.top+k.height/2;return{click_dx:Math.round(Ae-Et),click_dy:Math.round(vt-wt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"rage_click",el:b,...g?{el_label:g}:{},cnt:s.length,vel:Math.round(c*10)/10,intensity:E,quality:w,burst_seq:U,burst_rate_per_min:ht,repeated_target:Lr,hot_repeat:Us,...zs??{}}}),Lr&&d({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...g?{el_label:g}:{},total_hits:on,burst_count:on,burst_seq:U}}),P=P.slice(-(i-1))}function ka(){return le.length>=3?2:zr}function xa(e){let t=(e-jr)/6e4;return t<=0?0:Math.round(le.length/t*10)/10}function Ma(e,t,n){let o=e.length-t,r=Math.min(4,o/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let l=0,c=0;for(let E=0;E<e.length-1;E++)for(let w=E+1;w<e.length;w++){let b=e[E],g=e[w],U=g.x-b.x,ht=g.y-b.y;l+=Math.sqrt(U*U+ht*ht),c++}let m=l/c;a=Math.max(0,2-m/hn*2)}let u=r+s+a;return Math.round(Math.min(10,Math.max(0,u)))}function Aa(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Da=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ra=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Ia=/^(A|BUTTON|LABEL)$/,Oa=20,Kr=[],ce=null,Na=5,Ct=new Map,Gr=f(Pa),Zr=f(Ba);function Pa(e){ce={x:e.clientX,y:e.clientY}}function wn(e){Kr=e??[],document.addEventListener("mousedown",Gr,{capture:!0,passive:!0}),document.addEventListener("click",Zr,{capture:!0,passive:!0})}function bn(){document.removeEventListener("mousedown",Gr,{capture:!0}),document.removeEventListener("click",Zr,{capture:!0}),ce=null,Ct.clear()}function yn(){Ct.clear()}function Ha(e){try{return window.getComputedStyle(e).cursor.slice(0,Oa)}catch{return""}}function Fa(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Ba(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Kr)||Ua())return;let n=za(e);if(ce=null,n||Va(t))return;let o=qa(t,e.clientX,e.clientY),r=o?Qr(e.clientX,e.clientY,o):null,i=p(t),a=(Ct.get(i)??0)+1;Ct.set(i,a);let u=a>=2,l=Ha(t),c=Fa(t),m=h(t),E=o?h(o):"";d({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...m?{el_label:m}:{},near:o?p(o):"",...E?{near_label:E}:{},dist:r?Math.round(r.dist):-1,...r?{click_dx:Math.round(r.dx),click_dy:Math.round(r.dy)}:{},cursor:l,...c?{looks_interactive:!0}:{},...u?{repeated:!0,repeat_cnt:a}:{}}})}function Va(e){if(Da.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ra.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Ia.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function qa(e,t,n){let o=e;for(let r=0;r<5&&o;r++){let i=o.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,u=1/0;for(let l=0;l<s.length;l++){let c=s[l];if(!c||c===e)continue;let m=Wa(t,n,c);m<u&&(u=m,a=c)}if(a&&u<100)return a;o=i}return null}function Qr(e,t,n){let o=n.getBoundingClientRect(),r=Math.max(o.left,Math.min(e,o.right)),i=Math.max(o.top,Math.min(t,o.bottom)),s=e-r,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Wa(e,t,n){return Qr(e,t,n).dist}function Ua(){let e=window.getSelection();return e!==null&&e.toString().length>0}function za(e){if(!ce)return!1;let t=e.clientX-ce.x,n=e.clientY-ce.y;return Math.sqrt(t*t+n*n)>Na}var T=null,Sn=3e3,Jr=[],kt="click",xt=0,Xa=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Ya=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,ei=f(Ka),ti=f(ja),ni=f($a);function _n(e,t){Sn=e?.delayMs??3e3,Jr=t??[],document.addEventListener("click",ei,{capture:!0,passive:!0}),document.addEventListener("keydown",ti,{capture:!0,passive:!0}),document.addEventListener("touchstart",ni,{capture:!0,passive:!0})}function Tn(){document.removeEventListener("click",ei,{capture:!0}),document.removeEventListener("keydown",ti,{capture:!0}),document.removeEventListener("touchstart",ni,{capture:!0}),ue()}function Ln(){ue()}function ja(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(kt="keydown",xt=Date.now()))}function $a(){kt="touch",xt=Date.now()}function Ka(e){let t=e.target;if(!t||v(t,Jr))return;let n=t.getAttribute("role");if(!Xa.test(t.tagName)&&!(n&&Ya.test(n)))return;let o=Date.now();if(o-xt>50&&(kt="click",xt=o),T){if(T.el===t||T.el.contains(t)){let l=o-T.ts;l>=Sn&&d({t:"sig",ts:o,d:{s:"speed_frustration",el:T.selector,delay:l,interaction_type:kt,observed_delay_ms:l}}),ue();return}ue()}let r=p(t),i=!1,s=new MutationObserver(l=>{for(let c of l){if(c.type==="childList"&&(c.addedNodes.length>0||c.removedNodes.length>0)){i=!0,ue();return}if(c.type==="attributes"&&c.target instanceof Element&&(c.target===t||t.contains(c.target)||c.target.contains(t))){i=!0,ue();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let u=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Sn+500);T={el:t,selector:r,ts:o,observer:s,timeout:u}}function ue(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Ga=100,Za=5,oi=800,ri=2e3,Qa=3,kn=0,Ja=16,Mt=0,At=0,Oe=0,Ne=0,Pe=0,Dt=0,Cn=0,ee=[],xn=0,de=null,ii=f(el);function Mn(e){oi=e?.velocityThreshold??800,ri=e?.windowMs??2e3,document.addEventListener("mousemove",ii,{passive:!0})}function An(){document.removeEventListener("mousemove",ii),de&&clearTimeout(de),Dn()}function el(e){let t=Date.now();t-kn<Ja||(kn=t,de&&clearTimeout(de),de=setTimeout(()=>Dn(),150),tl(e.clientX,e.clientY,t))}function tl(e,t,n){if(Oe===0){Mt=e,At=t,Oe=n,Cn=n;return}let o=(n-Oe)/1e3;if(o===0)return;let r=e-Mt,i=t-At;if(Math.abs(r)<2&&Math.abs(i)<2)return;let s=Math.sqrt(r*r+i*i),a=s/o;ee.length>=Ga&&(ee=ee.slice(-50)),ee.push(a),xn+=s;let u=Math.sign(r),l=Math.sign(i);if(s>=Za&&(Ne!==0&&u!==0&&u!==Ne||Pe!==0&&l!==0&&l!==Pe)&&Dt++,Ne=u||Ne,Pe=l||Pe,Mt=e,At=t,Oe=n,n-Cn>ri){if(Dt>=Qa){let c=ee.reduce((m,E)=>m+E,0)/ee.length;c>=oi&&d({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(c),rev:Dt,distance_px:Math.round(xn)}})}Dn(),Cn=n}}function Dn(){Dt=0,ee=[],xn=0,Ne=0,Pe=0,Oe=0,Mt=0,At=0,kn=0,de=null}var si=100,ai=5,nl=3,L=[],x=[],Rn=3e4;function In(e){Rn=e?.windowMs??3e4}function On(){L=[],x=[]}function Nn(e){let t=Date.now(),n=e.indexOf("#"),o=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Rn;)L.shift();for(;x.length&&t-x[0].ts>Rn;)x.shift();if(L.length>=si&&(L=L.slice(-50)),x.length>=si&&(x=x.slice(-50)),L.push({path:e,ts:t}),r){x.push({path:e,ts:t});let a=x.filter(l=>{let c=l.path.indexOf("#");return(c===-1?l.path:l.path.slice(0,c))===o}),u=new Set(a.map(l=>{let c=l.path.indexOf("#");return c===-1?"":l.path.slice(c)}));if(u.size>=nl&&a.length>u.size){let l=a.slice(-ai).map(c=>c.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(u).map(c=>o+c),path_sequence:l}}),x=x.filter(c=>{let m=c.path.indexOf("#");return(m===-1?c.path:c.path.slice(0,m))!==o});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let u=L.slice(a,L.length),l=new Set(u.map(c=>c.path));if(l.size>=2){s.push(...Array.from(l)),i=!0;break}}if(i){let a=L.slice(-ai).map(u=>u.path);d({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],x=x.filter(u=>{let l=u.path.indexOf("#");return(l===-1?u.path:u.path.slice(0,l))!==o})}}var ol=100,li=1e4,Hn=.5,C=[],Rt=0,Fn=0,He=!1,Pn=0,ci=f(rl);function Bn(e){li=e?.windowMs??1e4,Hn=e?.depthThreshold??.5,window.addEventListener("scroll",ci,{passive:!0})}function Vn(){window.removeEventListener("scroll",ci),C=[],He=!1}function qn(){C=[],Rt=0,Fn=0,He=!1}function rl(){He||(He=!0,requestAnimationFrame(()=>{He=!1,il()}))}function il(){let e=Date.now(),t=window.scrollY;if(Pn=document.documentElement.scrollHeight-window.innerHeight,Pn<=0)return;let n=t/Pn,o=t>Rt?"down":"up";if(e-Fn<100){Rt=t;return}for(;C.length&&e-C[0].ts>li;)C.shift();C.length>=ol&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:o}),Rt=t,Fn=e;let r=0,i=1,s=0,a=!1,u=0,l=0,c=0,m=1,E=0;for(let w=1;w<C.length;w++)C[w].direction!==C[w-1].direction&&E++;for(let w=0;w<C.length;w++){let b=C[w],g=b.depth;if(g>r&&(r=g),g>=Hn&&(a||(u=b.ts,c=g),a=!0),a&&g<i&&(i=g,l=b.ts,m=g),a&&i<.25&&g>=Hn){if(l-u<200){a=!1,i=1,u=b.ts,c=g;continue}s++,a=!1,i=1}}if(s>=1){let w=Math.max(l-u,1),b=Math.abs(c-m)*100,g=Math.round(b/w*1e3);d({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(r*100)/100,rev:s+1,vel:g,dir_changes:E}}),C=[]}}var sl=["textarea",'[role="textbox"]',"[contenteditable]"],Be=new Map,Ve=new Map,z=new Set,te=null,Wn=0,ui=5e3,di=[],al=50,fi=f(ll),pi=f(cl),mi=f(ul),gi=y(hi),Fe=null;function Un(e,t){ui=e?.pauseMs??5e3,di=t??[],document.addEventListener("focusin",fi,{capture:!0,passive:!0}),document.addEventListener("focusout",pi,{capture:!0,passive:!0}),document.addEventListener("submit",mi,{capture:!0,passive:!0}),window.addEventListener("pagehide",gi),Fe=y(()=>{document.visibilityState==="hidden"&&hi()}),document.addEventListener("visibilitychange",Fe)}function zn(){document.removeEventListener("focusin",fi,{capture:!0}),document.removeEventListener("focusout",pi,{capture:!0}),document.removeEventListener("submit",mi,{capture:!0}),window.removeEventListener("pagehide",gi),Fe&&(document.removeEventListener("visibilitychange",Fe),Fe=null),Be.clear(),Ve.clear(),z.clear(),te=null}function Xn(){Be.clear(),Ve.clear(),z.clear(),te=null,Wn=0}function ll(e){let t=e.target;if(!t||!vi(t)||v(t,di)||dl(t))return;let n=Date.now();Be.set(t,n),Ve.set(t,n);let o=t.closest("form");o&&o!==te&&(te=o,Wn=o.querySelectorAll("input, select, textarea").length)}function cl(e){let t=e.target;if(!t||!vi(t))return;let n=Be.get(t),o=Ve.get(t);Be.delete(t),Ve.delete(t);let r=Date.now();if(!(o!==void 0&&r-o<al)&&n!==void 0){let a=r-n;if(a>=ui){let u=h(t);d({t:"sig",ts:r,d:{s:"form_hesitation",el:p(t),...u?{el_label:u}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);fl(t)&&z.add(s)}function ul(){z.clear(),te=null}function hi(){if(z.size>0&&te){let e=Wn||z.size,t=Math.round(z.size/e*100)/100;d({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:z.size,total:e,field_count:e,completion_rate:t}}),z.clear(),te=null}}function vi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function dl(e){if(e.tagName==="TEXTAREA")return!0;for(let t of sl)try{if(e.matches(t))return!0}catch{return!1}return!1}function fl(e){return"value"in e?e.value.length>0:!1}var fe=null,qe=null,Ei=/flusterduck\.com|\/v1\/ingest/,bi=f(gl),yi=f(hl);function jn(){window.addEventListener("error",bi),window.addEventListener("unhandledrejection",yi),vl()}function $n(){window.removeEventListener("error",bi),window.removeEventListener("unhandledrejection",yi),El()}var Yn=/fetch|network|cors|timeout/i;function pl(e){return Yn.test(e)?"network":"script"}function ml(e){if(e instanceof TypeError&&Yn.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return Yn.test(t)?"network":"unhandled_promise"}function gl(e){let t=e.message||"Unknown error";d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:Kn(t,200),ep:"",status:0,error_category:pl(t),url:location.pathname}})}function hl(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:Kn(t,200),ep:"",status:0,error_category:ml(e.reason),url:location.pathname}})}function vl(){fe||(fe=window.fetch,qe=function(t,n){let o;try{o=fe.call(this,t,n)}catch(r){throw r}return o.then(r=>{try{if(r.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Ei.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${r.status} ${r.statusText}`,ep:wi(i),status:r.status,error_category:"network",url:location.pathname}})}}catch{}return r},r=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Ei.test(i)||d({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:Kn(r instanceof Error?r.message:"Fetch failed",200),ep:typeof t=="string"?wi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw r})},window.fetch=qe)}function El(){fe&&qe&&window.fetch===qe&&(window.fetch=fe),fe=null,qe=null}function wi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),o=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,o)||"/"}}function Kn(e,t){let n=e.length>t?e.slice(0,t):e;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,o=>{try{return new URL(o).origin+new URL(o).pathname}catch{return"[URL]"}}),n}var Si=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],wl=['[class*="map"]',"canvas",".gallery","[data-zoom]"],K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Gn=0,Zn=null,_i=[],Ti=f(bl),Li=f(yl),Ci=f(Tl),ki=f(kl),xi=f(Ll);function Qn(e){_i=e??[],document.addEventListener("touchstart",Ti,{passive:!0}),document.addEventListener("touchend",Li,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Ci,{passive:!0}),window.addEventListener("orientationchange",ki,{passive:!0})),window.visualViewport?.addEventListener("resize",xi)}function Jn(){document.removeEventListener("touchstart",Ti),document.removeEventListener("touchend",Li),document.removeEventListener("gesturechange",Ci),window.removeEventListener("orientationchange",ki),window.visualViewport?.removeEventListener("resize",xi),K=null,me=0,We=1,R=0,Ue=0,ze=0,pe=0,Gn=0,Zn=null}function Mi(e){let t=e[0],n=e[1];if(!t||!n)return 0;let o=t.clientX-n.clientX,r=t.clientY-n.clientY;return Math.sqrt(o*o+r*r)}function bl(e){let t=e.touches[0];e.touches.length===1&&t?(K={x:t.clientX,y:t.clientY,ts:Date.now()},me=0):e.touches.length===2&&(me=Mi(e.touches),K=null)}function yl(e){if(me>0){let s=e.touches.length>=2?Mi(e.touches):(()=>{let a=e.changedTouches[0],u=e.changedTouches[1];if(!a||!u)return 0;let l=a.clientX-u.clientX,c=a.clientY-u.clientY;return Math.sqrt(l*l+c*c)})();s>0&&(We=Math.round(s/me*100)/100),me=0}if(!K||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-K.x,o=t.clientY-K.y,r=Date.now()-K.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(o)<10&&r<300&&i&&Sl(i,t.clientX,t.clientY),r<500&&(Math.abs(n)>50||Math.abs(o)>50)&&_l(i,n,o),K=null}function Sl(e,t,n){if(v(e,_i))return;let o=xl(e,t,n);if(!o)return;let r=o.getBoundingClientRect(),i=Math.max(r.left,Math.min(t,r.right)),s=Math.max(r.top,Math.min(n,r.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let u=`${Math.round(r.width)}x${Math.round(r.height)}`;d({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(o),dist:Math.round(a),size:u}})}}function _l(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Si.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Si.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";d({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Tl(){let e=Date.now();if(e-Ue>3e4&&(R=0,Ue=e),R++,R>=2){let t=document.activeElement||document.body;!wl.some(o=>{try{return t.matches(o)||t.closest(o)}catch{return!1}})&&e-ze>200&&(ze=e,d({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:R,pinch_scale:We}})),R=0,We=1}}function Ll(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ue>3e4&&(R=0,Ue=t),R++,R>=2&&t-ze>200){let n=Math.round(e.scale*100)/100;ze=t,d({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:R,pinch_scale:n}}),R=0,We=1}}}function Cl(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function kl(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-Gn>3e4&&(pe=0,Gn=e),t!==Zn&&(pe++,Zn=t),pe>=3&&(d({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:pe,orientation:Cl()}}),pe=0)}function xl(e,t,n){let r=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<r.length;a++){let u=r[a];if(!u)continue;let l=u.getBoundingClientRect(),c=Math.max(l.left,Math.min(t,l.right)),m=Math.max(l.top,Math.min(n,l.bottom)),E=Math.sqrt((t-c)**2+(n-m)**2);E<s&&E>0&&(s=E,i=u)}return i}var M=[],ge=null,A=0,he=0,F="",H=[],eo=[],Ml=10,Al=5e3,Ai=5,Di=3e3,Dl=15,Rl=5e3,Ri=f(Il);function to(e){eo=e??[],document.addEventListener("keydown",Ri,{capture:!0,passive:!0})}function no(){document.removeEventListener("keydown",Ri,{capture:!0}),M=[],H=[],ge=null,A=0,he=0,F="",eo=[]}function Il(e){let t=Date.now(),n=e.target;n&&v(n,eo)||(e.key==="Tab"?Nl(t,n,e.shiftKey):e.key==="Escape"?Pl(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Hl(t,e.target))}function Ol(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Nl(e,t,n){for(;M.length&&e-M[0].ts>Al;)M.shift();M.length>=50&&(M=M.slice(-25));let o=t?p(t):"";if(M.push({ts:e,el:o,shift:n}),M.length>=Ml){let i=M.map(a=>a.el).filter(Boolean),s=Ol(M);d({t:"sig",ts:e,d:{s:"tab_thrash",cnt:M.length,els:i,direction_changes:s}}),M=[]}if(!t)return;let r=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(r){let i=p(t);r===ge?e-he<=Di?(A++,F=i,A>=Ai&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(r),attempts:A,trapped_element:F}}),A=0,F="",ge=null)):(he=e,A=1,F=i):(ge=r,he=e,A=1,F=i)}}function Pl(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===ge){if(e-he>Di){he=e,A=1,F=p(t);return}A++,F=p(t),A>=Ai&&(d({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:F}}),A=0,F="",ge=null)}}function Hl(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;H.length&&e-H[0].ts>Rl;)H.shift();H.length>=50&&(H=H.slice(-25)),H.push({ts:e,container:n});let o=H.filter(r=>r.container===n);o.length>=Dl&&(d({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:o.length}}),H=[])}var ve=0,It=0,Ot=null,oo=0,Nt=!1,Pt=0,ro=0,Fl=1e4,Bl=2,Vl=4,ql=3e3,Xe=null,Ht=0,Wl=2e3,Ii=f(Xl),Oi=f(Ul),Ni=f(zl);function io(){window.addEventListener("wheel",Oi,{passive:!0}),window.addEventListener("touchmove",Ni,{passive:!0}),window.addEventListener("scroll",Ii,{passive:!0})}function so(){window.removeEventListener("wheel",Oi),window.removeEventListener("touchmove",Ni),window.removeEventListener("scroll",Ii),Ft()}function Ft(){ve=0,It=0,Ot=null,oo=0,Nt=!1,Pt=0,ro=0,Xe=null,Ht=0}function Ul(){Xe="wheel",Ht=Date.now()}function zl(){Xe="touch",Ht=Date.now()}function Xl(){Nt||(Nt=!0,requestAnimationFrame(()=>{Nt=!1,Yl()}))}function Yl(){let e=Date.now(),t=window.scrollY,n=t-It;if(Math.abs(n)<2){It=t;return}let o=n>0?"down":"up";if(Ot&&o!==Ot&&(e-oo>ql&&(ve=0,oo=e),ve++,ve>=Vl&&Math.abs(n)>100)){let i=e-Ht,s=Xe!==null&&i<=Wl?Xe:"wheel";e-ro>Fl&&(Pt=0,ro=e),Pt++;let a=Pt>=Bl;d({t:"sig",ts:e,d:{s:"scroll_hijack",rev:ve,source:s,repeated:a}}),ve=0}Ot=o,It=t}var ne=0,Ee=0,Ye=!1,Hi=f(jl),je=null,$e=null;function ao(){window.addEventListener("scroll",Hi,{passive:!0}),$e=y(Pi),window.addEventListener("pagehide",$e),je=y(()=>{document.visibilityState==="hidden"&&Pi()}),document.addEventListener("visibilitychange",je)}function lo(){window.removeEventListener("scroll",Hi),$e&&(window.removeEventListener("pagehide",$e),$e=null),je&&(document.removeEventListener("visibilitychange",je),je=null),ne=0,Ee=0,Ye=!1}function co(){ne=0,Ee=0,Ye=!1}function jl(){Ye||(Ye=!0,requestAnimationFrame(()=>{Ye=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ne&&(ne=t,Ee===0&&(Ee=Date.now()))}}))}function Pi(){if(ne>.05){let e=Date.now(),t=Ee>0?Math.max(0,e-Ee):0;d({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ne*100)/100,max_depth:Math.round(ne*100),dwell_ms:t}})}}var Fi=1500,Bi=15e3,$l=5e3,Kl=.15,uo="",we=0,Bt=0,Ke=0,be=0,fo=0,Vt=null,qt=0,Wt=!1,Ut=f(Zl),Vi=f(Ql),ye=f(Gl);function po(){Wt||(Wt=!0,fo=qi(),Ge(),document.addEventListener("mouseenter",Ut,!0),document.addEventListener("mouseleave",Ut,!0),document.addEventListener("click",ye,{capture:!0,passive:!0}),document.addEventListener("keydown",ye,{capture:!0,passive:!0}),document.addEventListener("scroll",ye,{passive:!0}),window.addEventListener("resize",Vi,{passive:!0}))}function mo(){Wt&&(Wt=!1,document.removeEventListener("mouseenter",Ut,!0),document.removeEventListener("mouseleave",Ut,!0),document.removeEventListener("click",ye,{capture:!0}),document.removeEventListener("keydown",ye,{capture:!0}),document.removeEventListener("scroll",ye),window.removeEventListener("resize",Vi),Wi(),uo="",we=0,Bt=0,be=0,Ke=0,qt=0)}function Ge(){Wi(),qt+=1;let e=qt;Vt=setTimeout(()=>{d({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:Bi,cycle:e}})},Bi)}function go(){qt=0}function Gl(){Ge()}function Zl(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),o=Date.now();(n!==uo||o-Bt>Fi)&&(uo=n,Bt=o,we=0),we+=1,!(we<4)&&(d({t:"sig",ts:o,d:{s:"thrash_hover",el:n,cnt:we,window_ms:Fi}}),we=0,Bt=o)}function Ql(){let e=Date.now(),t=qi(),n=fo||t,o=Math.abs(t-n)/Math.max(n,1);fo=t,!(o<Kl)&&((!Ke||e-Ke>$l)&&(Ke=e,be=0),be+=1,!(be<3)&&(d({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:be,area_delta:Math.round(o*1e3)/1e3}}),be=0,Ke=e))}function qi(){return Math.max(1,window.innerWidth*window.innerHeight)}function Wi(){Vt&&(clearTimeout(Vt),Vt=null)}var Ui=6e4,Jl=3,ec=["[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"]'],tc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,B=[],zi=[],Xi=f(nc);function ho(e){zi=e??[],document.addEventListener("click",Xi,{capture:!0,passive:!0})}function vo(){document.removeEventListener("click",Xi,{capture:!0}),B=[]}function Eo(){B=[]}function nc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,zi)||!oc(t))return;let n=Date.now();for(;B.length&&n-B[0].t>Ui;)B.shift();let o=p(t);if(B.push({t:n,el:o}),B.length<Jl)return;let r=new Set(B.map(s=>s.el)).size,i=h(t);d({t:"sig",ts:n,d:{s:"help_hunt",cnt:B.length,unique_els:r,el:o,...i?{el_label:i}:{},window_ms:Ui}}),B=[]}function oc(e){let t=e;for(let n=0;n<3&&t;n++){if(rc(t)||ic(t))return!0;t=t.parentElement}return!1}function rc(e){for(let t of ec)try{if(e.matches(t))return!0}catch{}return!1}function ic(e){let t=e.id??"",n=e.className??"",o=typeof n=="string"?`${t} ${n}`:t;return tc.test(o)}var Yi=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,ji=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,zt=[],Xt=new Map,$i=[],Ki=f(sc);function wo(e){$i=e??[],document.addEventListener("click",Ki,{capture:!0,passive:!0})}function bo(){document.removeEventListener("click",Ki,{capture:!0}),zt=[],Xt.clear()}function yo(){zt=[],Xt.clear()}function sc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,$i)||!ac(t))return;let n=Date.now(),o=p(t),r=h(t);zt.push({t:n,el:o});let s=(Xt.get(o)??0)+1;Xt.set(o,s);let a=zt.length,u=(()=>{try{let l=t.getBoundingClientRect();return l.width===0&&l.height===0?null:{click_dx:Math.round(e.clientX-(l.left+l.width/2)),click_dy:Math.round(e.clientY-(l.top+l.height/2)),el_w:Math.round(l.width),el_h:Math.round(l.height)}}catch{return null}})();d({t:"sig",ts:n,d:{s:"close_click",el:o,...r?{el_label:r}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:cc(t),...u??{}}})}function ac(e){let t=e;for(let n=0;n<4&&t;n++){if(lc(t))return!0;t=t.parentElement}return!1}function lc(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let o=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(o&&ji.test(o))return!0;let r=e.id??"",i=typeof e.className=="string"?e.className:"";if(Yi.test(r)||Yi.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&ji.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let u=(e.textContent??"").trim();if(u==="\xD7"||u==="\u2715"||u==="\u2717"||u==="X"||u==="x")return!0}return!1}function cc(e){let t=[['[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(let[n,o]of t)try{if(e.closest(n))return o}catch{}return"unknown"}var uc=1500,I=null,Gi=[],Zi=f(dc),Qi=f(fc),Ji=f(pc);function So(e){Gi=e??[],document.addEventListener("click",Zi,{capture:!0,passive:!0}),document.addEventListener("keydown",Qi,{capture:!0,passive:!0}),window.addEventListener("popstate",Ji)}function _o(){document.removeEventListener("click",Zi,{capture:!0}),document.removeEventListener("keydown",Qi,{capture:!0}),window.removeEventListener("popstate",Ji),I=null}function To(){I=null}function dc(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,Gi)){if(mc(t)){I=null;return}I={el:p(t),label:h(t),t:Date.now()}}}function fc(e){e.key==="Escape"&&es("escape")}function pc(){es("back_nav")}function es(e){if(!I)return;let t=Date.now()-I.t;if(t>uc){I=null;return}d({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:I.el,...I.label?{el_label:I.label}:{},elapsed_ms:t}}),I=null}function mc(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var ts=1e4,gc=3,hc=/^(checkbox|radio)$/,ns=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,Ze=new Map,Lo=[],os=f(vc),rs=f(Ec);function Co(e){Lo=e??[],document.addEventListener("change",os,{capture:!0,passive:!0}),document.addEventListener("click",rs,{capture:!0,passive:!0})}function ko(){document.removeEventListener("change",os,{capture:!0}),document.removeEventListener("click",rs,{capture:!0}),Ze.clear()}function xo(){Ze.clear()}function vc(e){let t=e.target;t&&(v(t,Lo)||wc(t)&&is(t))}function Ec(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Lo))return;let n=t.getAttribute("role")??"";ns.test(n)&&t.tagName!=="INPUT"&&is(t)}function is(e){let t=p(e),n=Date.now(),o=Ze.get(t);for(o||(o=[],Ze.set(t,o));o.length&&n-o[0].t>ts;)o.shift();if(o.push({t:n}),o.length<gc)return;let r=h(e);d({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...r?{el_label:r}:{},cnt:o.length,window_ms:ts}}),Ze.delete(t)}function wc(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?hc.test(e.type??""):ns.test(e.getAttribute("role")??"")}var ss=15e3,bc=3,X=[],as=f(yc);function Mo(){document.addEventListener("copy",as,{capture:!0,passive:!0})}function Ao(){document.removeEventListener("copy",as,{capture:!0}),X=[]}function Do(){X=[]}function yc(e){let t=e.target;if(t){let r=t.tagName;if(r==="INPUT"||r==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let o=Date.now();for(;X.length&&o-X[0].t>ss;)X.shift();X.push({t:o}),!(X.length<bc)&&(d({t:"sig",ts:o,d:{s:"copy_frustration",cnt:X.length,window_ms:ss}}),X=[])}var ls=15e3,Sc=4,_c=5,Tc=500,Lc=2e3,D=[],Yt=0,Qe=null,oe=null;function Ro(){Qe=y(kc),oe=y(Cc),document.addEventListener("selectionchange",Qe),document.addEventListener("copy",oe,{capture:!0,passive:!0}),document.addEventListener("cut",oe,{capture:!0,passive:!0})}function Io(){Qe&&(document.removeEventListener("selectionchange",Qe),Qe=null),oe&&(document.removeEventListener("copy",oe,{capture:!0}),document.removeEventListener("cut",oe,{capture:!0}),oe=null),D=[],Yt=0}function Oo(){D=[],Yt=0}function Cc(){Yt=Date.now(),D=[]}function kc(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<_c)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let o=Date.now();if(o-Yt<Lc)return;for(;D.length&&o-D[0].t>ls;)D.shift();let r=D[D.length-1];r&&o-r.t<Tc||(D.push({t:o}),!(D.length<Sc)&&(d({t:"sig",ts:o,d:{s:"text_select_frustration",cnt:D.length,window_ms:ls}}),D=[]))}var No=6e4,xc=20,us="_fd_sess",Mc={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},Ac=10,cs={low:1,medium:2,high:3,critical:4},V=[],Se=null,$t=!1,Te=new Map,_e={totalSignals:0,pagesWithFrustration:0},Po="",Je=null,et=null,tt=null,nt=null;function jt(e){$t&&ds(e,Date.now())}function Dc(){try{let e=sessionStorage.getItem(us);if(e){let t=JSON.parse(e);_e={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function Rc(){try{sessionStorage.setItem(us,JSON.stringify(_e))}catch{}}function Ic(){let e=[],n=Date.now()-No,o=[];for(let[r,i]of Te.entries())for(let s of i)s>=n&&o.push({type:r,ts:s});o.sort((r,i)=>r.ts-i.ts);for(let r=0;r<o.length;r++)if(o[r].type==="rage_click"){for(let i=r+1;i<o.length;i++)if(o[i].type==="form_validation_loop"&&o[i].ts-o[r].ts<=3e4){e.push("rage_then_form_loop");break}}for(let r=0;r<o.length;r++)if(o[r].type==="dead_click")for(let i=r+1;i<o.length;i++){let s=o[i].type;if((s==="popstate"||s==="hashchange")&&o[i].ts-o[r].ts<=1e4){e.push("dead_then_bail");break}}for(let r=0;r<o.length;r++)if(o[r].type==="form_validation_loop"){for(let i=r+1;i<o.length;i++)if((o[i].type==="visibilitychange"||o[i].type==="pagehide")&&o[i].ts-o[r].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function ds(e,t){Te.has(e)||Te.set(e,[]);let n=Te.get(e);n.push(t),n.length>xc&&n.shift()}function Oc(e){let t=e-No,n=0;for(;n<V.length&&V[n].ts<t;)n++;n>0&&(V=V.slice(n))}function Nc(){let e=new Map,t=0;for(let n of V)e.set(n.type,(e.get(n.type)??0)+1),t+=Mc[n.type]??Ac;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function fs(e){let t="",n=0;for(let[o,r]of e)(r>n||r===n&&o<t)&&(t=o,n=r);return{type:t,count:n}}function Pc(e,t,n){return fs(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Hc(e,t,n,o){let r=fs(o),i=Ic();d({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Po||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:No,dominant:r.type,repeat_count:r.count,sequences:i,session_total_signals:_e.totalSignals,session_pages_with_frustration:_e.pagesWithFrustration}}),_e.totalSignals+=V.length,_e.pagesWithFrustration+=1,Rc()}function Fc(e){if(!$t||e==="frustration_burst")return;let t=Date.now();Oc(t),V.length===0&&(Se=null),V.push({type:e,ts:t}),ds(e,t);let{distinctTypes:n,totalWeight:o,typeCounts:r}=Nc(),i=Pc(n.size,o,r);i&&(Se!==null&&cs[i]<=cs[Se]||(Se=i,Hc(i,n,o,r)))}function Ho(e){Po=e}function Fo(e){V=[],Se=null,$t=!0,Te=new Map,Po=e??"",Dc(),fn(Fc),Je=()=>jt("popstate"),et=()=>jt("hashchange"),tt=()=>{document.visibilityState==="hidden"&&jt("visibilitychange")},nt=()=>jt("pagehide"),window.addEventListener("popstate",Je),window.addEventListener("hashchange",et),document.addEventListener("visibilitychange",tt),window.addEventListener("pagehide",nt)}function Bo(){$t=!1,V=[],Se=null,Te=new Map,fn(null),Je&&(window.removeEventListener("popstate",Je),Je=null),et&&(window.removeEventListener("hashchange",et),et=null),tt&&(document.removeEventListener("visibilitychange",tt),tt=null),nt&&(window.removeEventListener("pagehide",nt),nt=null)}var Bc=8,Vo=3e4,qo=5,Vc=5e3,O=[],G="",ot=!1,ps=f(Wc),ms=f(Uc);function Wo(){O=[],ot=!1,G=location.pathname+location.search+location.hash,window.addEventListener("popstate",ps),window.addEventListener("hashchange",ms)}function Uo(){window.removeEventListener("popstate",ps),window.removeEventListener("hashchange",ms),O=[],ot=!1,G=""}function zo(){O=[],ot=!1,G=location.pathname+location.search+location.hash}function rt(e){let t=Date.now();if(G&&G!==e){let n=O[O.length-1];n&&n.path===G&&n.leftAt===null&&(n.leftAt=t)}for(;O.length&&t-O[0].ts>Vo;)O.shift();e!==G&&(O.push({path:e,ts:t,leftAt:null}),G=e),!(O.length<qo)&&(ot||qc(t))}function qc(e){let t=O.filter(c=>e-c.ts<=Vo),n=t.filter(c=>c.leftAt!==null),o=new Set(t.map(c=>c.path));if(o.size<qo||n.length===0||n.some(c=>c.leftAt-c.ts>=Vc)||new Set(n.map(c=>c.path)).size<qo)return;let s=n.map(c=>c.leftAt-c.ts),a=Math.round(s.reduce((c,m)=>c+m,0)/s.length),u=Math.max(...s),l=t.map(c=>c.path).slice(-Bc);ot=!0,d({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:o.size,window_ms:Vo,avg_dwell_ms:a,pages:l,max_dwell_ms:u}})}function Wc(){let e=location.pathname+location.search+location.hash;rt(e)}function Uc(){let e=location.pathname+location.search+location.hash;rt(e)}var zc=.3,gs=3e3,Y=[],it=!1,re="none",ie=0,st=0,at=0,N=!1,hs=f(Xc),vs=f(jc);function Xo(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1,window.addEventListener("scroll",hs,{passive:!0}),window.addEventListener("click",vs,{capture:!0})}function Yo(){window.removeEventListener("scroll",hs),window.removeEventListener("click",vs,{capture:!0}),Kt()}function Kt(){Y=[],re="none",ie=0,st=0,at=0,N=!1,it=!1}function Xc(){it||(it=!0,requestAnimationFrame(Yc))}function Yc(){it=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,o=Y[Y.length-1];if(o&&e-o.ts<50||(Y.push({y:t,ts:e}),Y.length>60&&(Y=Y.slice(-40)),!o))return;let r=t-o.y;if(Math.abs(r)<2)return;if((r>0?"down":"up")==="down"){re!=="down"&&N&&(N=!1),t>ie&&(ie=t),re="down";return}if(N&&e-at>gs&&(N=!1),re==="down"){let s=ie-t,a=n*zc;s>=a&&!N&&(st=t,at=e,N=!0)}re="up"}function jc(e){if(!N)return;let t=Date.now();if(t-at>gs){N=!1;return}if(window.scrollY+e.clientY>st+window.innerHeight*.1)return;let o=window.innerHeight,r=Math.round(ie-st),i=Math.round(r/o*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",u=s?h(s):"";N=!1,ie=window.scrollY,re="none",Y=[],d({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:r,click_el:a,...u?{click_el_label:u}:{},scroll_back_pct:i}})}var $c=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Kc=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Gc=/^(A|BUTTON|LABEL)$/,Zc=3,Es=9e4,Qc=5,lt=new Map,ws=[],ct=null,Jc=5,bs=f(eu),ys=f(su);function eu(e){ct={x:e.clientX,y:e.clientY}}function jo(e){ws=e??[],document.addEventListener("mousedown",bs,{capture:!0,passive:!0}),document.addEventListener("click",ys,{capture:!0,passive:!0})}function $o(){document.removeEventListener("mousedown",bs,{capture:!0}),document.removeEventListener("click",ys,{capture:!0}),ct=null,lt.clear()}function Ko(){lt.clear()}function tu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function nu(e,t){return e*4+t}function ou(e){if($c.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Kc.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Gc.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function ru(){let e=window.getSelection();return e!==null&&e.toString().length>0}function iu(e){if(!ct)return!1;let t=e.clientX-ct.x,n=e.clientY-ct.y;return Math.sqrt(t*t+n*n)>Jc}function su(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ws)||ru()||iu(e)||ou(t))return;let{row:n,col:o}=tu(e.clientX,e.clientY),r=nu(n,o),i=Date.now(),s=p(t),u=(lt.get(r)??[]).filter(l=>i-l.ts<Es);if(u.push({ts:i,selector:s}),lt.set(r,u),u.length>=Zc){let l=new Map;for(let g of u)l.set(g.selector,(l.get(g.selector)??0)+1);let c="",m=0;for(let[g,U]of l)U>m&&(m=U,c=g);let E=new Set,w=[];for(let g of u)if(!E.has(g.selector)&&(E.add(g.selector),w.push(g.selector),w.length>=Qc))break;let b=(()=>{try{let g=c?document.querySelector(c):null;return g?h(g):""}catch{return""}})();d({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:o,cnt:u.length,dominant_el:c,...b?{dominant_el_label:b}:{},elements:w,window_ms:Es}}),lt.set(r,[])}}var Go=3,Le=12e4,S=new Map,Zt=[],ut=null,Ss=f(du),Gt=f(fu);function Qo(e){Zt=e??[],document.addEventListener("invalid",Ss,{capture:!0,passive:!0}),document.addEventListener("input",Gt,{capture:!0,passive:!0}),document.addEventListener("change",Gt,{capture:!0,passive:!0}),ut=new MutationObserver(pu),ut.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function Jo(){document.removeEventListener("invalid",Ss,{capture:!0}),document.removeEventListener("input",Gt,{capture:!0}),document.removeEventListener("change",Gt,{capture:!0}),ut&&(ut.disconnect(),ut=null);for(let e of S.values())Z(e);S.clear()}function er(){for(let e of S.values())Z(e);S.clear()}function Zo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function tr(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function Qt(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function au(e){for(let[t,n]of S)e-n.lastTs>Le&&(Z(n),S.delete(t))}function Z(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function lu(e){return f(t=>{Ls(e)})}function cu(e){return f(t=>{Ls(e)})}function _s(e,t){let n=lu(t),o=cu(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",o,{passive:!0});let r={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:o,el:e};return S.set(t,r),r}function Ts(e){if(!Qt(e)||v(e,Zt))return;let t=Date.now();au(t);let n=p(e),o=S.get(n);if(!o){_s(e,n);return}let r=o.lastTs;o.lastTs=t,o.phase==="edited"?(o.cycles+=1,o.phase="invalid",o.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Zo(e)}}),Z(o),S.delete(n))):o.phase==="invalid"&&t-r>500&&(o.cycles+=1,o.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:o.cycles,window_ms:Le,field_type:Zo(e)}}),Z(o),S.delete(n)))}function uu(e){if(!Qt(e))return;let t=Date.now(),n=p(e),o=S.get(n);if(o){if(t-o.lastTs>Le){Z(o),S.delete(n);return}o.phase==="invalid"&&(o.phase="edited",o.lastTs=t)}}function Ls(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Le){Z(n),S.delete(e);return}if(n.lastTs=t,tr(n.el)){n.cycles+=1,n.cycles>=Go&&(d({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Le,field_type:Zo(n.el)}}),Z(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function du(e){let t=e.target;t&&Ts(t)}function fu(e){let t=e.target;if(!t||!Qt(t)||v(t,Zt))return;let n=p(t);S.has(n)||tr(t)&&_s(t,n)}function pu(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!Qt(n)||v(n,Zt))continue;let o=t.oldValue,r=o==="true"||o==="",i=tr(n);i&&!r?Ts(n):!i&&r&&uu(n)}}var Ce=null,dt=null,or=[],Cs=0,ft=new Map;function rr(e){or=e?.length?e:["[data-fd-impression]"],Cs=Date.now(),!(typeof IntersectionObserver>"u")&&(Ce=new IntersectionObserver(y(gu),{threshold:[0,.5,1]}),ks(),dt=new MutationObserver(y(mu)),dt.observe(document.body,{childList:!0,subtree:!0}))}function ir(){Ce&&(Ce.disconnect(),Ce=null),dt&&(dt.disconnect(),dt=null),ft.clear()}function sr(){ft.clear(),Ce&&ks()}function ks(){for(let e of or)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)nr(t[n])}catch{}}function nr(e){ft.has(e)||(ft.set(e,{firstSeenTs:0,emitted:!1}),Ce.observe(e))}function mu(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let o=t.addedNodes[n];if(o instanceof Element)for(let r of or)try{o.matches(r)&&nr(o);let i=o.querySelectorAll(r);for(let s=0;s<i.length;s++)nr(i[s])}catch{}}}function gu(e){let t=Date.now();for(let n of e){let o=ft.get(n.target);if(!(!o||o.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){o.firstSeenTs||(o.firstSeenTs=t),o.emitted=!0;let r=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=r.top<i*.5?"above_fold":"below_fold",a=p(n.target),u=h(n.target);d({t:"sig",ts:t,d:{s:"element_impression",el:a,...u?{el_label:u}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Cs),viewport_position:s}})}}}var hu=2,vu=3,Eu=6e4,pt=new Map,xs=[],Ms=f(wu);function ar(e){xs=e??[],document.addEventListener("input",Ms,{capture:!0,passive:!0})}function lr(){document.removeEventListener("input",Ms,{capture:!0}),pt.clear()}function cr(){pt.clear()}function wu(e){let t=e.target;if(!t||!bu(t)||v(t,xs))return;let n=Date.now(),o=t.value??"",r=p(t),i=pt.get(r);if(!i){pt.set(r,{lastValue:o,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Eu){i.lastValue=o,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-o.length;if(i.phase==="typing"&&s>=vu)i.phase="deleted";else if(i.phase==="deleted"&&o.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=hu)){let a=h(t);d({t:"sig",ts:n,d:{s:"input_correction",el:r,...a?{el_label:a}:{},cycles:i.cycles,field_type:yu(t)}}),pt.delete(r);return}i.lastValue=o}function bu(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function yu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var As=2e3,Su=3e4,q=null,Ds=As,Rs=[],Jt=new Map,Is=f(_u),Os=f(Tu),Ns=f(mt);function ur(e,t){Ds=e?.dwellMs??As,Rs=t??[],document.addEventListener("mouseover",Is,{passive:!0}),document.addEventListener("mouseout",Os,{passive:!0}),document.addEventListener("click",Ns,{capture:!0,passive:!0})}function dr(){document.removeEventListener("mouseover",Is),document.removeEventListener("mouseout",Os),document.removeEventListener("click",Ns,{capture:!0}),mt(),Jt.clear()}function fr(){mt(),Jt.clear()}function _u(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Rs)||!Lu(t))return;let n=p(t);if(q?.selector===n)return;mt();let o=Date.now();if(o-(Jt.get(n)??0)<Su)return;let r=o,i=setTimeout(()=>{let s=Date.now(),a=h(t);Jt.set(n,s),q=null,d({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-r)}})},Ds);q={el:t,selector:n,startTs:r,timer:i}}function Tu(e){if(!q)return;let t=e.target;if(t!==q.el&&!q.el.contains(t))return;let n=e.relatedTarget;n&&q.el.contains(n)||mt()}function mt(){q&&(clearTimeout(q.timer),q=null)}function Lu(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let o=window.getComputedStyle(e);return o.cursor==="pointer"&&o.pointerEvents!=="none"}catch{return!1}}var Cu=20,ku=500,xu=3e3,Mu=6e4,en=0,tn=0,W=null,Ps=y(Au);function pr(){en=Date.now(),tn=0,document.addEventListener("mouseleave",Ps)}function mr(){document.removeEventListener("mouseleave",Ps),W&&(clearTimeout(W),W=null)}function gr(){en=Date.now(),tn=0,W&&(clearTimeout(W),W=null)}function Au(e){if(e.clientY>Cu)return;let t=Date.now();t-en<xu||t-tn<Mu||(W&&clearTimeout(W),W=setTimeout(y(()=>{let n=Date.now();tn=n,W=null,d({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-en)}})}),ku))}var Du=2500,Ru=4e3,Hs=200,Iu=500,Ou=.1,Nu=.25,xe=null,Me=null,j=null,ke=0;function hr(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function vr(){if(!(typeof PerformanceObserver>"u")){try{xe=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let o=Math.round(n.startTime);d({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:o,rating:hr(o,Du,Ru)}})})),xe.observe({type:"largest-contentful-paint",buffered:!0})}catch{xe=null}try{Me=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let o=Math.round(n.duration);o<Hs||d({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:o,rating:hr(o,Hs,Iu)}})}})),Me.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Me=null}try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!0})}catch{j=null}}}function Fs(){if(j){if(j.disconnect(),j=null,ke>0){let e=Math.round(ke*1e3)/1e3;d({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:hr(ke,Ou,Nu)}})}ke=0}}function Er(){xe&&(xe.disconnect(),xe=null),Me&&(Me.disconnect(),Me=null),Fs()}function wr(){if(Fs(),!(typeof PerformanceObserver>"u"))try{j=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(ke+=n.value)}})),j.observe({type:"layout-shift",buffered:!1})}catch{j=null}}var Bs=[],Vs=f(Pu);function br(e){Bs=e??[],document.addEventListener("paste",Vs,{capture:!0,passive:!0})}function yr(){document.removeEventListener("paste",Vs,{capture:!0})}function Pu(e){let t=e.target;if(!t||!Hu(t)||v(t,Bs))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let r=p(t),i=h(t);d({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:r,...i?{el_label:i}:{},field_type:Fu(t)}})},100)}function Hu(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Fu(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Bu="https://api.flusterduck.com/v1/ingest",Q=!1,nn=null,gt=null;function Vu(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function Ws(e){if(Q||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Yu()){gt=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){gt=e;return}gt=e,Q=!0;let t=kr(e.cookieless??!1),n=Vu(e.endpoint)??Bu,o=gn(location.pathname,e.pageRules??[]),r=ju(e.domMode);Vr(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:o,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:r,compression:e.compression});let i=qs(location.pathname,e.ignorePages??[]);i&&pn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||d({t:"pv",ts:Date.now(),d:{ref:a}});let u=e.ignoreElements??[],l=c=>e.signals?.[c]?.enabled!==!1;if(l("rageClick")&&vn(e.signals?.rageClick,u),l("deadClick")&&wn(u),l("speedFrustration")){let c=e.signals?.speedFrustration;_n(c?{delayMs:c.windowMs}:void 0,u)}if(e.trackMouse!==!1&&l("thrashCursor")){let c=e.signals?.thrashCursor;Mn(c?{velocityThreshold:c.threshold,windowMs:c.windowMs}:void 0)}if(l("loopNav")&&In(e.signals?.loopNav),l("scrollBounce")&&Bn(),e.trackForms!==!1){if(l("formHesitation")||l("formAbandon")){let c=e.signals?.formHesitation;Un(c?{pauseMs:c.threshold}:void 0,u)}l("formValidationLoop")&&Qo(u)}if(l("errorEncounter")&&jn(),("ontouchstart"in window||navigator.maxTouchPoints>0)&&Qn(u),(l("tabThrash")||l("focusTrap")||l("keyboardNavFrustration"))&&to(u),l("scrollHijack")&&io(),l("scrollDepthAbandon")&&ao(),l("advancedHeuristics")&&po(),l("helpHunt")&&ho(u),l("closeClick")&&wo(u),l("closeClickReversal")&&So(u),l("filterSpiral")&&Co(u),l("copyFrustration")&&Mo(),l("textSelectFrustration")&&Ro(),l("deadClickTrapZone")&&jo(u),Fo(o),l("navigationConfusion")&&Wo(),l("scrollToClickConfusion")&&Xo(),l("elementImpression")&&rr(e.elementImpressionSelectors),e.trackForms!==!1&&l("inputCorrection")&&ar(u),e.trackForms!==!1&&l("pasteBlocked")&&br(u),l("hoverDwell")){let c=e.signals?.hoverDwell;ur(c?.threshold?{dwellMs:c.threshold}:void 0,u)}l("exitIntent")&&pr(),l("performanceVitals")&&vr(),nn=Ur(y((c,m)=>{J(),qn(),Xn(),co(),Ln(),Ge(),go(),Eo(),yo(),To(),xo(),Do(),Oo(),Ko(),er(),yn(),Ft(),Kt(),zo(),sr(),cr(),fr(),gr(),wr(),rt(m),Ho(m);let E=gn(m,e.pageRules??[]),w=qs(m,e.ignorePages??[]);pn(w),mn({page:E,url:c}),Nn(m),w||d({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:o})}function qu(e,t){if(!Q||typeof e!="string"||!e||e.length>128)return;let n;try{let r=t?.metadata??{};n=JSON.stringify(r)}catch{return}if(n.length>2048)return;let o=JSON.parse(n);d({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:o,w:Math.max(0,Math.min(t?.weight??15,100))}})}function Wu(e,t={}){if(!Q||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||d({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function Uu(e){if(!Q||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let o of Object.keys(e)){if(n>=20)break;o==="__proto__"||o==="constructor"||o==="prototype"||(t[o.slice(0,64)]=String(e[o]).slice(0,256),n++)}mn({segment:t})}function zu(e){e&>&&!Q?Ws(gt):e||(Sr(),an())}function Xu(){Sr(),an()}function Sr(){Q&&(En(),bn(),Tn(),An(),On(),Vn(),zn(),$n(),Jn(),no(),so(),lo(),mo(),vo(),bo(),_o(),ko(),Ao(),Io(),$o(),Jo(),Bo(),Uo(),Yo(),ir(),lr(),dr(),mr(),Er(),yr(),qr(),nn&&(nn(),nn=null),Q=!1)}function Yu(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function ju(e){return e==="metadata"||e==="snapshot"?e:"off"}function qs(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}export{Sr as destroy,Uu as identify,Ws as init,Xu as optOut,zu as setConsent,qu as signal,Wu as track};
|
package/dist/queue.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { SDKEvent, QueueMeta, QueueOptions } from './types';
|
|
2
|
+
export declare function setCorrelatorHook(fn: ((signalType: string) => void) | null): void;
|
|
3
|
+
export declare function setQueuePaused(val: boolean): void;
|
|
2
4
|
export declare function initQueue(ep: string, meta: QueueMeta, interval?: number, maxSize?: number, options?: QueueOptions): void;
|
|
3
5
|
export declare function enqueue(event: SDKEvent): void;
|
|
4
6
|
export declare function flush(): void;
|
package/dist/selector.d.ts
CHANGED
package/dist/signals/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { initRageClick, destroyRageClick } from './rage-click';
|
|
2
|
-
export { initDeadClick, destroyDeadClick } from './dead-click';
|
|
3
|
-
export { initSpeedFrustration, destroySpeedFrustration } from './speed-frustration';
|
|
2
|
+
export { initDeadClick, destroyDeadClick, resetDeadClick } from './dead-click';
|
|
3
|
+
export { initSpeedFrustration, destroySpeedFrustration, resetSpeedFrustration } from './speed-frustration';
|
|
4
4
|
export { initThrashCursor, destroyThrashCursor } from './thrash-cursor';
|
|
5
5
|
export { initLoopNav, destroyLoopNav, recordNavigation } from './loop-nav';
|
|
6
6
|
export { initScrollBounce, destroyScrollBounce, resetScrollBounce, } from './scroll-bounce';
|
|
@@ -8,5 +8,23 @@ export { initFormSignals, destroyFormSignals, resetFormSignals, } from './form-s
|
|
|
8
8
|
export { initErrorEncounter, destroyErrorEncounter } from './error-encounter';
|
|
9
9
|
export { initMobileSignals, destroyMobileSignals } from './mobile-signals';
|
|
10
10
|
export { initKeyboardSignals, destroyKeyboardSignals, } from './keyboard-signals';
|
|
11
|
-
export { initScrollHijack, destroyScrollHijack } from './scroll-hijack';
|
|
11
|
+
export { initScrollHijack, destroyScrollHijack, resetScrollHijack } from './scroll-hijack';
|
|
12
12
|
export { initScrollDepthAbandon, destroyScrollDepthAbandon, resetScrollDepthAbandon, } from './scroll-depth-abandon';
|
|
13
|
+
export { initAdvancedSignals, destroyAdvancedSignals, resetAdvancedSignals, resetAdvancedCycle, } from './advanced-signals';
|
|
14
|
+
export { initHelpHunt, destroyHelpHunt, resetHelpHunt } from './help-hunt';
|
|
15
|
+
export { initCloseClick, destroyCloseClick, resetCloseClick } from './close-click';
|
|
16
|
+
export { initCloseClickReversal, destroyCloseClickReversal, resetCloseClickReversal, } from './close-click-reversal';
|
|
17
|
+
export { initFilterSpiral, destroyFilterSpiral, resetFilterSpiral } from './filter-spiral';
|
|
18
|
+
export { initCopyFrustration, destroyCopyFrustration, resetCopyFrustration } from './copy-frustration';
|
|
19
|
+
export { initTextSelectFrustration, destroyTextSelectFrustration, resetTextSelectFrustration, } from './text-select-frustration';
|
|
20
|
+
export { initFrustrationCorrelator, destroyFrustrationCorrelator, setFrustrationCorrelatorPage, } from './frustration-correlator';
|
|
21
|
+
export { initNavigationConfusion, destroyNavigationConfusion, resetNavigationConfusion, recordPageVisit, } from './navigation-confusion';
|
|
22
|
+
export { initScrollToClickConfusion, destroyScrollToClickConfusion, resetScrollToClickConfusion, } from './scroll-to-click-confusion';
|
|
23
|
+
export { initDeadClickTrapZone, destroyDeadClickTrapZone, resetDeadClickTrapZone, } from './dead-click-trap-zone';
|
|
24
|
+
export { initFormValidationLoop, destroyFormValidationLoop, resetFormValidationLoop, } from './form-validation-loop';
|
|
25
|
+
export { initElementImpression, destroyElementImpression, resetElementImpression, } from './element-impression';
|
|
26
|
+
export { initInputCorrection, destroyInputCorrection, resetInputCorrection, } from './input-correction';
|
|
27
|
+
export { initHoverDwell, destroyHoverDwell, resetHoverDwell, } from './hover-dwell';
|
|
28
|
+
export { initExitIntent, destroyExitIntent, resetExitIntent } from './exit-intent';
|
|
29
|
+
export { initPerformanceVitals, destroyPerformanceVitals, resetPerformanceVitals, } from './performance-vitals';
|
|
30
|
+
export { initPasteBlocked, destroyPasteBlocked } from './paste-blocked';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function initKeyboardSignals(): void;
|
|
1
|
+
export declare function initKeyboardSignals(ignore?: string[]): void;
|
|
2
2
|
export declare function destroyKeyboardSignals(): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -17,8 +17,10 @@ export interface Config {
|
|
|
17
17
|
debug?: boolean;
|
|
18
18
|
batchInterval?: number;
|
|
19
19
|
batchMaxSize?: number;
|
|
20
|
+
compression?: CompressionMode;
|
|
20
21
|
ignoreElements?: string[];
|
|
21
22
|
ignorePages?: string[];
|
|
23
|
+
elementImpressionSelectors?: string[];
|
|
22
24
|
}
|
|
23
25
|
export interface SignalOpts {
|
|
24
26
|
enabled?: boolean;
|
|
@@ -31,6 +33,7 @@ export interface SDKEvent {
|
|
|
31
33
|
d?: Record<string, unknown>;
|
|
32
34
|
}
|
|
33
35
|
export type DOMMode = 'off' | 'metadata' | 'snapshot';
|
|
36
|
+
export type CompressionMode = 'auto' | 'off';
|
|
34
37
|
export interface Batch {
|
|
35
38
|
v: 1;
|
|
36
39
|
sid: string;
|
|
@@ -42,6 +45,7 @@ export interface Batch {
|
|
|
42
45
|
vw: number;
|
|
43
46
|
vh: number;
|
|
44
47
|
environment?: string;
|
|
48
|
+
segment?: Record<string, string>;
|
|
45
49
|
dom_mode: DOMMode;
|
|
46
50
|
events: IngestEvent[];
|
|
47
51
|
}
|
|
@@ -58,6 +62,7 @@ export interface QueueMeta {
|
|
|
58
62
|
}
|
|
59
63
|
export interface QueueOptions {
|
|
60
64
|
domMode?: DOMMode;
|
|
65
|
+
compression?: CompressionMode;
|
|
61
66
|
}
|
|
62
67
|
export interface IngestEvent {
|
|
63
68
|
type: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flusterduck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Lightweight UX confusion monitoring SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"esbuild": "0.
|
|
29
|
+
"esbuild": "0.28.0",
|
|
30
|
+
"jsdom": "25.0.1",
|
|
30
31
|
"terser": "5.46.1",
|
|
31
32
|
"typescript": "5.9.3",
|
|
32
|
-
"vitest": "
|
|
33
|
-
"
|
|
34
|
-
"@flusterduck/tsconfig": "0.1.2"
|
|
33
|
+
"vitest": "4.1.8",
|
|
34
|
+
"@flusterduck/tsconfig": "0.2.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "node build.mjs",
|