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