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