flusterduck 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/flusterduck.mjs +23 -0
- package/dist/core.d.ts +7 -1
- package/dist/d.global.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/queue.d.ts +4 -3
- package/dist/signals/frustration-correlator.d.ts +1 -1
- package/dist/types.d.ts +25 -0
- package/package.json +5 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var bn=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Pa=Object.getOwnPropertyNames;var Ha=Object.prototype.hasOwnProperty;var Fa=(e,t)=>{for(var n in t)bn(e,n,{get:t[n],enumerable:!0})},Ba=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pa(t))!Ha.call(e,o)&&o!==n&&bn(e,o,{get:()=>t[o],enumerable:!(r=Na(t,o))||r.enumerable});return e};var Wa=e=>Ba(bn({},"__esModule",{value:!0}),e);var nf={};Fa(nf,{destroy:()=>fn,destroyPostHogTrigger:()=>Aa,identify:()=>da,init:()=>Ho,initPostHogTrigger:()=>xa,optOut:()=>pa,setConsent:()=>fa,signal:()=>ca,track:()=>ua});module.exports=Wa(nf);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var yn="_fd_s";var Va=/^[0-9a-f]{32}$/;function $o(e){if(e)return Xo();let t=Ua(yn);if(t&&Va.test(t))return t;let n=Xo();return Yo(yn,n,30),n}function _n(){Yo(yn,"",-1)}function Xo(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function Ua(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function Yo(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var qa=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${Ne(t)}"]`;if(e.id&&!qa.test(e.id)&&e.id.length<64)return"#"+Ne(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${Ne(s)}"]`:a?i+=`[role="${Ne(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${Ne(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function Ne(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Pe=60,za=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Xa=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Pe);if(!Xa.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Pe);if(i&&!za.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Pe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Pe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Pe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function Ko(e,t){if(t==="off")return null;if(t==="metadata")return $a(e);let n=Ya(e);return n?{mode:"snapshot",...n}:null}function $a(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:jo(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:jo(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:ja(e)}}}function Ya(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:Ga(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Ka(t),animations:i,siblings:o}}catch{return null}}function jo(e,t){return e&&t.includes(e)?e:null}function ja(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Ka(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function Ga(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var Zo=7e3,Za=500,Qa=1e4,Qo=50,Jo=100,Ja=3,He=6e4,Ct="application/json",el="application/json; encoding=gzip",ue=[],Z=null,ei="",ti=Zo,ni=Qo,S=null,Mt={domMode:"off",compression:"auto"},Sn=!1,Ln=null,Cn=!1;function Mn(e){Ln=e}var kt=new Set;function ri(e){return kt.add(e),()=>{kt.delete(e)}}function tl(e){if(e.t!=="sig"||!kt.size)return;let t=typeof e.d?.s=="string"?e.d.s:"";if(t)for(let n of kt)try{n(t,e.ts)}catch{}}function kn(e){Cn=e}var nl=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),rl=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),ol=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function il(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>ol.has(n))}var sl=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,oi=f(ll),ii=y(()=>ne());function si(e,t,n,r,o){ei=e,S=Object.assign(Object.create(null),t),Mt={domMode:hl(o?.domMode),compression:vl(o?.compression)},ti=Math.max(Za,Math.min(n??Zo,Qa)),ni=Math.max(1,Math.min(r??Qo,Jo)),document.addEventListener("visibilitychange",oi),window.addEventListener("pagehide",ii)}function u(e){Cn||ue.length>=Jo||(tl(e),ue.push(e),ue.length>=ni?ne():Z||(Z=setTimeout(ne,ti)))}function ne(){al()}async function al(){if(Sn||!ue.length||!S)return;Sn=!0,Z&&(clearTimeout(Z),Z=null);let e=ue;ue=[];let t={v:1,sid:S.sid,key:S.key,url:S.url,page:S.page,ts:Date.now(),ua:S.ua,vw:S.vw,vh:S.vh,environment:S.environment,...S.segment?{segment:S.segment}:{},dom_mode:Mt.domMode},n=e.map(o=>fl(o,S.page,Mt.domMode)),r=[];try{for(let o of n){let i=[...r,o];if(JSON.stringify({...t,events:i}).length>He)if(r.length>0)await Tn({...t,events:r}),r=[o];else{let a={...t,events:[o]};JSON.stringify(a).length<=He?await Tn(a):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r=[]}else r=i}r.length>0&&await Tn({...t,events:r})}catch{}finally{Sn=!1}}function xn(e){if(S)for(let t of Object.keys(e))nl.has(t)&&(S[t]=e[t])}function ai(){ne(),Cn=!1,document.removeEventListener("visibilitychange",oi),window.removeEventListener("pagehide",ii),Z&&(clearTimeout(Z),Z=null)}function ll(){document.visibilityState==="hidden"&&ne()}async function Tn(e){let t=JSON.stringify(e),n=await cl(t,Mt.compression);n&&li(n,0)}async function cl(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>He)return null;if(t!=="off"){let o=await ul(e);if(o&&o.byteLength<=He)return{beaconBody:new Blob([o],{type:el}),fetchBody:new Uint8Array(o),headers:{"Content-Type":Ct,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:Ct}),fetchBody:e,headers:{"Content-Type":Ct}}}async function ul(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=dl(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>He)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function dl(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:Ct});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}function li(e,t,n=ei){if(n&&!(navigator.sendBeacon&&navigator.sendBeacon(n,e.beaconBody)))try{fetch(n,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}).catch(()=>{t<Ja&&setTimeout(()=>li(e,t+1,n),1e3*(t+1))})}catch{}}function fl(e,t,n){let r=e.d??{},o=pl(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=Go(r.el,r.element,r.target);if(o==="signal"){i.signal_type=Go(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?gl(s,n):null;c&&(i.dom=c),i.signal_type&&Ln&&Ln(i.signal_type)}let a=ml(r);return Object.keys(a).length&&(i.metadata=a),i}function pl(e){return e==="pv"?"pageview":e==="sig"?"signal":rl.has(e)?e:"custom_signal"}function ml(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=xt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=xt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function xt(e,t="",n=0){if(!(n>4)&&!il(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return sl.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>xt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=xt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function gl(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?Ko(n,t):null}catch{return null}}function Go(...e){for(let t of e)if(typeof t=="string"&&t)return t}function hl(e){return e==="metadata"||e==="snapshot"?e:"off"}function vl(e){return e==="off"?"off":"auto"}function ci(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function An(e,t){for(let n of t){let r=El(n.pattern);if(r&&r.test(e))return n.label}return bl(e)}var wl=/^[a-zA-Z0-9/:._*\-]+$/;function El(e){if(e.length>200||!wl.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function bl(e){return e.replace(/\/\d+/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:id")}var yl=[".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"]'],B=[],ui=3,di=2e3,fi=24,At=fi,pi=[],de=[],mi=0,Dt=new Map,Rt=new Map,_l=1e4,It=!1,gi=f(Sl);function Dn(e,t){It||(It=!0,ui=e?.threshold??3,di=e?.windowMs??2e3,At=e?.radius&&e.radius>0?e.radius:fi,pi=[...yl,...t??[]],mi=Date.now(),B=[],de=[],Dt.clear(),Rt.clear(),document.addEventListener("click",gi,{capture:!0,passive:!0}))}function Rn(){It&&(It=!1,document.removeEventListener("click",gi,{capture:!0,passive:!0}),B=[],de=[],Dt.clear(),Rt.clear())}function Sl(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,pi)||Ml(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;B.length&&n-B[0].t>di;)B.shift();B.push({t:n,x:r,y:o});let i=Tl();if(B.length<i)return;let s=B.slice(-i);for(let M=0;M<s.length-1;M++)for(let Oe=M+1;Oe<s.length;Oe++){let St=s[M],Tt=s[Oe],Lt=Tt.x-St.x,ce=Tt.y-St.y;if(Lt*Lt+ce*ce>At*At)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=Cl(s,i,l),b=p(t),m=h(t);de.push({selector:b,ts:n});let $=de.length,_t=Ll(n),Uo=Dt.get(b)??0,wn=Uo+1,qo=Rt.get(b)??0,Ia=qo>0&&n-qo<_l;Dt.set(b,wn),Rt.set(b,n);let zo=Uo>=1,Oa=(()=>{try{let M=t.getBoundingClientRect();if(M.width===0&&M.height===0)return null;let Oe=s.reduce((ce,En)=>ce+En.x,0)/s.length,St=s.reduce((ce,En)=>ce+En.y,0)/s.length,Tt=M.left+M.width/2,Lt=M.top+M.height/2;return{click_dx:Math.round(Oe-Tt),click_dy:Math.round(St-Lt),el_w:Math.round(M.width),el_h:Math.round(M.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:$,burst_rate_per_min:_t,repeated_target:zo,hot_repeat:Ia,...Oa??{}}}),zo&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:wn,burst_count:wn,burst_seq:$}}),B=B.slice(-(i-1))}function Tl(){return de.length>=3?2:ui}function Ll(e){let t=(e-mi)/6e4;return t<=0?0:Math.round(de.length/t*10)/10}function Cl(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],$=m.x-b.x,_t=m.y-b.y;d+=Math.sqrt($*$+_t*_t),l++}let g=d/l;a=Math.max(0,2-g/At*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function Ml(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var kl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,xl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Al=/^(A|BUTTON|LABEL)$/,Dl=20,hi=[],fe=null,Rl=5,Ot=new Map,vi=f(Il),wi=f(Pl);function Il(e){fe={x:e.clientX,y:e.clientY}}function In(e){hi=e??[],document.addEventListener("mousedown",vi,{capture:!0,passive:!0}),document.addEventListener("click",wi,{capture:!0,passive:!0})}function On(){document.removeEventListener("mousedown",vi,{capture:!0}),document.removeEventListener("click",wi,{capture:!0}),fe=null,Ot.clear()}function Nn(){Ot.clear()}function Ol(e){try{return window.getComputedStyle(e).cursor.slice(0,Dl)}catch{return""}}function Nl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function Pl(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,hi)||Wl())return;let n=Vl(e);if(fe=null,n||Hl(t))return;let r=Fl(t,e.clientX,e.clientY),o=r?Ei(e.clientX,e.clientY,r):null,i=p(t),a=(Ot.get(i)??0)+1;Ot.set(i,a);let c=a>=2,d=Ol(t),l=Nl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function Hl(e){if(kl.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&xl.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Al.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function Fl(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=Bl(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function Ei(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Bl(e,t,n){return Ei(e,t,n).dist}function Wl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function Vl(e){if(!fe)return!1;let t=e.clientX-fe.x,n=e.clientY-fe.y;return Math.sqrt(t*t+n*n)>Rl}var T=null,Pn=3e3,bi=[],Nt="click",Pt=0,Ul=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,ql=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,yi=f($l),_i=f(zl),Si=f(Xl);function Hn(e,t){Pn=e?.delayMs??3e3,bi=t??[],document.addEventListener("click",yi,{capture:!0,passive:!0}),document.addEventListener("keydown",_i,{capture:!0,passive:!0}),document.addEventListener("touchstart",Si,{capture:!0,passive:!0})}function Fn(){document.removeEventListener("click",yi,{capture:!0}),document.removeEventListener("keydown",_i,{capture:!0}),document.removeEventListener("touchstart",Si,{capture:!0}),pe()}function Bn(){pe()}function zl(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Nt="keydown",Pt=Date.now()))}function Xl(){Nt="touch",Pt=Date.now()}function $l(e){let t=e.target;if(!t||v(t,bi))return;let n=t.getAttribute("role");if(!Ul.test(t.tagName)&&!(n&&ql.test(n)))return;let r=Date.now();if(r-Pt>50&&(Nt="click",Pt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=Pn&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Nt,observed_delay_ms:d}}),pe();return}pe()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,pe();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,pe();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},Pn+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function pe(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var Yl=100,jl=5,Ti=800,Li=2e3,Kl=3,Vn=0,Gl=16,Ht=0,Ft=0,Fe=0,Be=0,We=0,Bt=0,Wn=0,re=[],Un=0,me=null,Ci=f(Zl);function qn(e){Ti=e?.velocityThreshold??800,Li=e?.windowMs??2e3,document.addEventListener("mousemove",Ci,{passive:!0})}function zn(){document.removeEventListener("mousemove",Ci),me&&clearTimeout(me),Xn()}function Zl(e){let t=Date.now();t-Vn<Gl||(Vn=t,me&&clearTimeout(me),me=setTimeout(()=>Xn(),150),Ql(e.clientX,e.clientY,t))}function Ql(e,t,n){if(Fe===0){Ht=e,Ft=t,Fe=n,Wn=n;return}let r=(n-Fe)/1e3;if(r===0)return;let o=e-Ht,i=t-Ft;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;re.length>=Yl&&(re=re.slice(-50)),re.push(a),Un+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=jl&&(Be!==0&&c!==0&&c!==Be||We!==0&&d!==0&&d!==We)&&Bt++,Be=c||Be,We=d||We,Ht=e,Ft=t,Fe=n,n-Wn>Li){if(Bt>=Kl){let l=re.reduce((g,w)=>g+w,0)/re.length;l>=Ti&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Bt,distance_px:Math.round(Un)}})}Xn(),Wn=n}}function Xn(){Bt=0,re=[],Un=0,Be=0,We=0,Fe=0,Ht=0,Ft=0,Vn=0,me=null}var Mi=100,ki=5,Jl=3,L=[],k=[],$n=3e4;function Yn(e){$n=e?.windowMs??3e4}function jn(){L=[],k=[]}function Kn(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>$n;)L.shift();for(;k.length&&t-k[0].ts>$n;)k.shift();if(L.length>=Mi&&(L=L.slice(-50)),k.length>=Mi&&(k=k.slice(-50)),L.push({path:e,ts:t}),o){k.push({path:e,ts:t});let a=k.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=Jl&&a.length>c.size){let d=a.slice(-ki).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),k=k.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-ki).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],k=k.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var ec=100,xi=1e4,Zn=.5,C=[],Wt=0,Qn=0,Ve=!1,Gn=0,Ai=f(tc);function Jn(e){xi=e?.windowMs??1e4,Zn=e?.depthThreshold??.5,window.addEventListener("scroll",Ai,{passive:!0})}function er(){window.removeEventListener("scroll",Ai),C=[],Ve=!1}function tr(){C=[],Wt=0,Qn=0,Ve=!1}function tc(){Ve||(Ve=!0,requestAnimationFrame(()=>{Ve=!1,nc()}))}function nc(){let e=Date.now(),t=window.scrollY;if(Gn=document.documentElement.scrollHeight-window.innerHeight,Gn<=0)return;let n=t/Gn,r=t>Wt?"down":"up";if(e-Qn<100){Wt=t;return}for(;C.length&&e-C[0].ts>xi;)C.shift();C.length>=ec&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),Wt=t,Qn=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=Zn&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=Zn){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var rc=["textarea",'[role="textbox"]',"[contenteditable]"],qe=new Map,ze=new Map,Y=new Set,oe=null,nr=0,Di=5e3,Ri=[],oc=50,Ii=f(ic),Oi=f(sc),Ni=f(ac),Pi=y(Hi),Ue=null;function rr(e,t){Di=e?.pauseMs??5e3,Ri=t??[],document.addEventListener("focusin",Ii,{capture:!0,passive:!0}),document.addEventListener("focusout",Oi,{capture:!0,passive:!0}),document.addEventListener("submit",Ni,{capture:!0,passive:!0}),window.addEventListener("pagehide",Pi),Ue=y(()=>{document.visibilityState==="hidden"&&Hi()}),document.addEventListener("visibilitychange",Ue)}function or(){document.removeEventListener("focusin",Ii,{capture:!0}),document.removeEventListener("focusout",Oi,{capture:!0}),document.removeEventListener("submit",Ni,{capture:!0}),window.removeEventListener("pagehide",Pi),Ue&&(document.removeEventListener("visibilitychange",Ue),Ue=null),qe.clear(),ze.clear(),Y.clear(),oe=null}function ir(){qe.clear(),ze.clear(),Y.clear(),oe=null,nr=0}function ic(e){let t=e.target;if(!t||!Fi(t)||v(t,Ri)||lc(t))return;let n=Date.now();qe.set(t,n),ze.set(t,n);let r=t.closest("form");r&&r!==oe&&(oe=r,nr=r.querySelectorAll("input, select, textarea").length)}function sc(e){let t=e.target;if(!t||!Fi(t))return;let n=qe.get(t),r=ze.get(t);qe.delete(t),ze.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<oc)&&n!==void 0){let a=o-n;if(a>=Di){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);cc(t)&&Y.add(s)}function ac(){Y.clear(),oe=null}function Hi(){if(Y.size>0&&oe){let e=nr||Y.size,t=Math.round(Y.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:Y.size,total:e,field_count:e,completion_rate:t}}),Y.clear(),oe=null}}function Fi(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function lc(e){if(e.tagName==="TEXTAREA")return!0;for(let t of rc)try{if(e.matches(t))return!0}catch{return!1}return!1}function cc(e){return"value"in e?e.value.length>0:!1}var ge=null,Xe=null,Bi=/flusterduck\.com|\/v1\/ingest/,Vi=f(fc),Ui=f(pc);function ar(){window.addEventListener("error",Vi),window.addEventListener("unhandledrejection",Ui),mc()}function lr(){window.removeEventListener("error",Vi),window.removeEventListener("unhandledrejection",Ui),gc()}var sr=/fetch|network|cors|timeout/i;function uc(e){return sr.test(e)?"network":"script"}function dc(e){if(e instanceof TypeError&&sr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return sr.test(t)?"network":"unhandled_promise"}function fc(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:cr(t,200),ep:"",status:0,error_category:uc(t),url:location.pathname}})}function pc(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:cr(t,200),ep:"",status:0,error_category:dc(e.reason),url:location.pathname}})}function mc(){ge||(ge=window.fetch,Xe=function(t,n){let r;try{r=ge.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Bi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:Wi(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Bi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:cr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?Wi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=Xe)}function gc(){ge&&Xe&&window.fetch===Xe&&(window.fetch=ge),ge=null,Xe=null}function Wi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function cr(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var qi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],hc=['[class*="map"]',"canvas",".gallery","[data-zoom]"],Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,ur=0,dr=null,zi=[],Xi=f(vc),$i=f(wc),Yi=f(yc),ji=f(Tc),Ki=f(_c);function fr(e){zi=e??[],document.addEventListener("touchstart",Xi,{passive:!0}),document.addEventListener("touchend",$i,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Yi,{passive:!0}),window.addEventListener("orientationchange",ji,{passive:!0})),window.visualViewport?.addEventListener("resize",Ki)}function pr(){document.removeEventListener("touchstart",Xi),document.removeEventListener("touchend",$i),document.removeEventListener("gesturechange",Yi),window.removeEventListener("orientationchange",ji),window.visualViewport?.removeEventListener("resize",Ki),Q=null,ve=0,$e=1,I=0,Ye=0,je=0,he=0,ur=0,dr=null}function Gi(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function vc(e){let t=e.touches[0];e.touches.length===1&&t?(Q={x:t.clientX,y:t.clientY,ts:Date.now()},ve=0):e.touches.length===2&&(ve=Gi(e.touches),Q=null)}function wc(e){if(ve>0){let s=e.touches.length>=2?Gi(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&($e=Math.round(s/ve*100)/100),ve=0}if(!Q||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-Q.x,r=t.clientY-Q.y,o=Date.now()-Q.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&Ec(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&bc(i,n,r),Q=null}function Ec(e,t,n){if(v(e,zi))return;let r=Lc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function bc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||qi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!qi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function yc(){let e=Date.now();if(e-Ye>3e4&&(I=0,Ye=e),I++,I>=2){let t=document.activeElement||document.body;!hc.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-je>200&&(je=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:$e}})),I=0,$e=1}}function _c(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ye>3e4&&(I=0,Ye=t),I++,I>=2&&t-je>200){let n=Math.round(e.scale*100)/100;je=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,$e=1}}}function Sc(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function Tc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-ur>3e4&&(he=0,ur=e),t!==dr&&(he++,dr=t),he>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:he,orientation:Sc()}}),he=0)}function Lc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],we=null,A=0,Ee=0,V="",W=[],mr=[],Cc=10,Mc=5e3,Zi=5,Qi=3e3,kc=15,xc=5e3,Ji=f(Ac);function gr(e){mr=e??[],document.addEventListener("keydown",Ji,{capture:!0,passive:!0})}function hr(){document.removeEventListener("keydown",Ji,{capture:!0}),x=[],W=[],we=null,A=0,Ee=0,V="",mr=[]}function Ac(e){let t=Date.now(),n=e.target;n&&v(n,mr)||(e.key==="Tab"?Rc(t,n,e.shiftKey):e.key==="Escape"?Ic(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Oc(t,e.target))}function Dc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Rc(e,t,n){for(;x.length&&e-x[0].ts>Mc;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=Cc){let i=x.map(a=>a.el).filter(Boolean),s=Dc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===we?e-Ee<=Qi?(A++,V=i,A>=Zi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",we=null)):(Ee=e,A=1,V=i):(we=o,Ee=e,A=1,V=i)}}function Ic(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===we){if(e-Ee>Qi){Ee=e,A=1,V=p(t);return}A++,V=p(t),A>=Zi&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",we=null)}}function Oc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;W.length&&e-W[0].ts>xc;)W.shift();W.length>=50&&(W=W.slice(-25)),W.push({ts:e,container:n});let r=W.filter(o=>o.container===n);r.length>=kc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),W=[])}var be=0,Vt=0,Ut=null,vr=0,qt=!1,zt=0,wr=0,Nc=1e4,Pc=2,Hc=4,Fc=3e3,Ke=null,Xt=0,Bc=2e3,es=f(Uc),ts=f(Wc),ns=f(Vc);function Er(){window.addEventListener("wheel",ts,{passive:!0}),window.addEventListener("touchmove",ns,{passive:!0}),window.addEventListener("scroll",es,{passive:!0})}function br(){window.removeEventListener("wheel",ts),window.removeEventListener("touchmove",ns),window.removeEventListener("scroll",es),$t()}function $t(){be=0,Vt=0,Ut=null,vr=0,qt=!1,zt=0,wr=0,Ke=null,Xt=0}function Wc(){Ke="wheel",Xt=Date.now()}function Vc(){Ke="touch",Xt=Date.now()}function Uc(){qt||(qt=!0,requestAnimationFrame(()=>{qt=!1,qc()}))}function qc(){let e=Date.now(),t=window.scrollY,n=t-Vt;if(Math.abs(n)<2){Vt=t;return}let r=n>0?"down":"up";if(Ut&&r!==Ut&&(e-vr>Fc&&(be=0,vr=e),be++,be>=Hc&&Math.abs(n)>100)){let i=e-Xt,s=Ke!==null&&i<=Bc?Ke:"wheel";e-wr>Nc&&(zt=0,wr=e),zt++;let a=zt>=Pc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:be,source:s,repeated:a}}),be=0}Ut=r,Vt=t}var ie=0,ye=0,Ge=!1,os=f(zc),Ze=null,Qe=null;function yr(){window.addEventListener("scroll",os,{passive:!0}),Qe=y(rs),window.addEventListener("pagehide",Qe),Ze=y(()=>{document.visibilityState==="hidden"&&rs()}),document.addEventListener("visibilitychange",Ze)}function _r(){window.removeEventListener("scroll",os),Qe&&(window.removeEventListener("pagehide",Qe),Qe=null),Ze&&(document.removeEventListener("visibilitychange",Ze),Ze=null),ie=0,ye=0,Ge=!1}function Sr(){ie=0,ye=0,Ge=!1}function zc(){Ge||(Ge=!0,requestAnimationFrame(()=>{Ge=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>ie&&(ie=t,ye===0&&(ye=Date.now()))}}))}function rs(){if(ie>.05){let e=Date.now(),t=ye>0?Math.max(0,e-ye):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(ie*100)/100,max_depth:Math.round(ie*100),dwell_ms:t}})}}var is=1500,ss=15e3,Xc=5e3,$c=.15,Tr="",_e=0,Yt=0,Je=0,Se=0,Lr=0,jt=null,Kt=0,Gt=!1,Zt=f(jc),as=f(Kc),Te=f(Yc);function Cr(){Gt||(Gt=!0,Lr=ls(),et(),document.addEventListener("mouseenter",Zt,!0),document.addEventListener("mouseleave",Zt,!0),document.addEventListener("click",Te,{capture:!0,passive:!0}),document.addEventListener("keydown",Te,{capture:!0,passive:!0}),document.addEventListener("scroll",Te,{passive:!0}),window.addEventListener("resize",as,{passive:!0}))}function Mr(){Gt&&(Gt=!1,document.removeEventListener("mouseenter",Zt,!0),document.removeEventListener("mouseleave",Zt,!0),document.removeEventListener("click",Te,{capture:!0}),document.removeEventListener("keydown",Te,{capture:!0}),document.removeEventListener("scroll",Te),window.removeEventListener("resize",as),cs(),Tr="",_e=0,Yt=0,Se=0,Je=0,Kt=0)}function et(){cs(),Kt+=1;let e=Kt;jt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:ss,cycle:e}})},ss)}function kr(){Kt=0}function Yc(){et()}function jc(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==Tr||r-Yt>is)&&(Tr=n,Yt=r,_e=0),_e+=1,!(_e<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:_e,window_ms:is}}),_e=0,Yt=r)}function Kc(){let e=Date.now(),t=ls(),n=Lr||t,r=Math.abs(t-n)/Math.max(n,1);Lr=t,!(r<$c)&&((!Je||e-Je>Xc)&&(Je=e,Se=0),Se+=1,!(Se<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Se,area_delta:Math.round(r*1e3)/1e3}}),Se=0,Je=e))}function ls(){return Math.max(1,window.innerWidth*window.innerHeight)}function cs(){jt&&(clearTimeout(jt),jt=null)}var us=6e4,Gc=3,Zc=["[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"]'],Qc=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,U=[],ds=[],fs=f(Jc);function xr(e){ds=e??[],document.addEventListener("click",fs,{capture:!0,passive:!0})}function Ar(){document.removeEventListener("click",fs,{capture:!0}),U=[]}function Dr(){U=[]}function Jc(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ds)||!eu(t))return;let n=Date.now();for(;U.length&&n-U[0].t>us;)U.shift();let r=p(t);if(U.push({t:n,el:r}),U.length<Gc)return;let o=new Set(U.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:U.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:us}}),U=[]}function eu(e){let t=e;for(let n=0;n<3&&t;n++){if(tu(t)||nu(t))return!0;t=t.parentElement}return!1}function tu(e){for(let t of Zc)try{if(e.matches(t))return!0}catch{}return!1}function nu(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return Qc.test(r)}var ps=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,ms=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,Qt=[],Jt=new Map,gs=[],hs=f(ru);function Rr(e){gs=e??[],document.addEventListener("click",hs,{capture:!0,passive:!0})}function Ir(){document.removeEventListener("click",hs,{capture:!0}),Qt=[],Jt.clear()}function Or(){Qt=[],Jt.clear()}function ru(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,gs)||!ou(t))return;let n=Date.now(),r=p(t),o=h(t);Qt.push({t:n,el:r});let s=(Jt.get(r)??0)+1;Jt.set(r,s);let a=Qt.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:su(t),...c??{}}})}function ou(e){let t=e;for(let n=0;n<4&&t;n++){if(iu(t))return!0;t=t.parentElement}return!1}function iu(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&ms.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(ps.test(o)||ps.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&ms.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function su(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var au=1500,O=null,vs=[],ws=f(lu),Es=f(cu),bs=f(uu);function Nr(e){vs=e??[],document.addEventListener("click",ws,{capture:!0,passive:!0}),document.addEventListener("keydown",Es,{capture:!0,passive:!0}),window.addEventListener("popstate",bs)}function Pr(){document.removeEventListener("click",ws,{capture:!0}),document.removeEventListener("keydown",Es,{capture:!0}),window.removeEventListener("popstate",bs),O=null}function Hr(){O=null}function lu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,vs)){if(du(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function cu(e){e.key==="Escape"&&ys("escape")}function uu(){ys("back_nav")}function ys(e){if(!O)return;let t=Date.now()-O.t;if(t>au){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function du(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var _s=1e4,fu=3,pu=/^(checkbox|radio)$/,Ss=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,tt=new Map,Fr=[],Ts=f(mu),Ls=f(gu);function Br(e){Fr=e??[],document.addEventListener("change",Ts,{capture:!0,passive:!0}),document.addEventListener("click",Ls,{capture:!0,passive:!0})}function Wr(){document.removeEventListener("change",Ts,{capture:!0}),document.removeEventListener("click",Ls,{capture:!0}),tt.clear()}function Vr(){tt.clear()}function mu(e){let t=e.target;t&&(v(t,Fr)||hu(t)&&Cs(t))}function gu(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Fr))return;let n=t.getAttribute("role")??"";Ss.test(n)&&t.tagName!=="INPUT"&&Cs(t)}function Cs(e){let t=p(e),n=Date.now(),r=tt.get(t);for(r||(r=[],tt.set(t,r));r.length&&n-r[0].t>_s;)r.shift();if(r.push({t:n}),r.length<fu)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:_s}}),tt.delete(t)}function hu(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?pu.test(e.type??""):Ss.test(e.getAttribute("role")??"")}var Ms=15e3,vu=3,j=[],ks=f(wu);function Ur(){document.addEventListener("copy",ks,{capture:!0,passive:!0})}function qr(){document.removeEventListener("copy",ks,{capture:!0}),j=[]}function zr(){j=[]}function wu(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;j.length&&r-j[0].t>Ms;)j.shift();j.push({t:r}),!(j.length<vu)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:j.length,window_ms:Ms}}),j=[])}var xs=15e3,Eu=4,bu=5,yu=500,_u=2e3,D=[],en=0,nt=null,se=null;function Xr(){nt=y(Tu),se=y(Su),document.addEventListener("selectionchange",nt),document.addEventListener("copy",se,{capture:!0,passive:!0}),document.addEventListener("cut",se,{capture:!0,passive:!0})}function $r(){nt&&(document.removeEventListener("selectionchange",nt),nt=null),se&&(document.removeEventListener("copy",se,{capture:!0}),document.removeEventListener("cut",se,{capture:!0}),se=null),D=[],en=0}function Yr(){D=[],en=0}function Su(){en=Date.now(),D=[]}function Tu(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<bu)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-en<_u)return;for(;D.length&&r-D[0].t>xs;)D.shift();let o=D[D.length-1];o&&r-o.t<yu||(D.push({t:r}),!(D.length<Eu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:xs}}),D=[]))}var jr=6e4,Lu=20,Ds="_fd_sess",Cu={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},Mu=10,As={low:1,medium:2,high:3,critical:4},q=[],Le=null,nn=!1,Me=new Map,Ce={totalSignals:0,pagesWithFrustration:0},Kr="",rt=null,ot=null,it=null,st=null;function tn(e){nn&&Rs(e,Date.now())}function ku(){try{let e=sessionStorage.getItem(Ds);if(e){let t=JSON.parse(e);Ce={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function xu(){try{sessionStorage.setItem(Ds,JSON.stringify(Ce))}catch{}}function Au(){let e=[],n=Date.now()-jr,r=[];for(let[o,i]of Me.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Rs(e,t){Me.has(e)||Me.set(e,[]);let n=Me.get(e);n.push(t),n.length>Lu&&n.shift()}function Du(e){let t=e-jr,n=0;for(;n<q.length&&q[n].ts<t;)n++;n>0&&(q=q.slice(n))}function Ru(){let e=new Map,t=0;for(let n of q)e.set(n.type,(e.get(n.type)??0)+1),t+=Cu[n.type]??Mu;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Is(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Iu(e,t,n){return Is(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Ou(e,t,n,r){let o=Is(r),i=Au();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:Kr||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:jr,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Ce.totalSignals,session_pages_with_frustration:Ce.pagesWithFrustration}}),Ce.totalSignals+=q.length,Ce.pagesWithFrustration+=1,xu()}function Nu(e){if(!nn||e==="frustration_burst")return;let t=Date.now();Du(t),q.length===0&&(Le=null),q.push({type:e,ts:t}),Rs(e,t);let{distinctTypes:n,totalWeight:r,typeCounts:o}=Ru(),i=Iu(n.size,r,o);i&&(Le!==null&&As[i]<=As[Le]||(Le=i,Ou(i,n,r,o)))}function Gr(e){Kr=e}function Zr(e){q=[],Le=null,nn=!0,Me=new Map,Kr=e??"",ku(),Mn(Nu),rt=()=>tn("popstate"),ot=()=>tn("hashchange"),it=()=>{document.visibilityState==="hidden"&&tn("visibilitychange")},st=()=>tn("pagehide"),window.addEventListener("popstate",rt),window.addEventListener("hashchange",ot),document.addEventListener("visibilitychange",it),window.addEventListener("pagehide",st)}function Qr(){nn=!1,q=[],Le=null,Me=new Map,Mn(null),rt&&(window.removeEventListener("popstate",rt),rt=null),ot&&(window.removeEventListener("hashchange",ot),ot=null),it&&(document.removeEventListener("visibilitychange",it),it=null),st&&(window.removeEventListener("pagehide",st),st=null)}var Pu=8,Jr=3e4,eo=5,Hu=5e3,N=[],J="",at=!1,Os=f(Bu),Ns=f(Wu);function to(){N=[],at=!1,J=location.pathname+location.search+location.hash,window.addEventListener("popstate",Os),window.addEventListener("hashchange",Ns)}function no(){window.removeEventListener("popstate",Os),window.removeEventListener("hashchange",Ns),N=[],at=!1,J=""}function ro(){N=[],at=!1,J=location.pathname+location.search+location.hash}function lt(e){let t=Date.now();if(J&&J!==e){let n=N[N.length-1];n&&n.path===J&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>Jr;)N.shift();e!==J&&(N.push({path:e,ts:t,leftAt:null}),J=e),!(N.length<eo)&&(at||Fu(t))}function Fu(e){let t=N.filter(l=>e-l.ts<=Jr),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<eo||n.length===0||n.some(l=>l.leftAt-l.ts>=Hu)||new Set(n.map(l=>l.path)).size<eo)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-Pu);at=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:Jr,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Bu(){let e=location.pathname+location.search+location.hash;lt(e)}function Wu(){let e=location.pathname+location.search+location.hash;lt(e)}var Vu=.3,Ps=3e3,K=[],ct=!1,ae="none",le=0,ut=0,dt=0,P=!1,Hs=f(Uu),Fs=f(zu);function oo(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1,window.addEventListener("scroll",Hs,{passive:!0}),window.addEventListener("click",Fs,{capture:!0})}function io(){window.removeEventListener("scroll",Hs),window.removeEventListener("click",Fs,{capture:!0}),rn()}function rn(){K=[],ae="none",le=0,ut=0,dt=0,P=!1,ct=!1}function Uu(){ct||(ct=!0,requestAnimationFrame(qu))}function qu(){ct=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=K[K.length-1];if(r&&e-r.ts<50||(K.push({y:t,ts:e}),K.length>60&&(K=K.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){ae!=="down"&&P&&(P=!1),t>le&&(le=t),ae="down";return}if(P&&e-dt>Ps&&(P=!1),ae==="down"){let s=le-t,a=n*Vu;s>=a&&!P&&(ut=t,dt=e,P=!0)}ae="up"}function zu(e){if(!P)return;let t=Date.now();if(t-dt>Ps){P=!1;return}if(window.scrollY+e.clientY>ut+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(le-ut),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,le=window.scrollY,ae="none",K=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Xu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,$u=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Yu=/^(A|BUTTON|LABEL)$/,ju=3,Bs=9e4,Ku=5,ft=new Map,Ws=[],pt=null,Gu=5,Vs=f(Zu),Us=f(rd);function Zu(e){pt={x:e.clientX,y:e.clientY}}function so(e){Ws=e??[],document.addEventListener("mousedown",Vs,{capture:!0,passive:!0}),document.addEventListener("click",Us,{capture:!0,passive:!0})}function ao(){document.removeEventListener("mousedown",Vs,{capture:!0}),document.removeEventListener("click",Us,{capture:!0}),pt=null,ft.clear()}function lo(){ft.clear()}function Qu(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function Ju(e,t){return e*4+t}function ed(e){if(Xu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&$u.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Yu.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function td(){let e=window.getSelection();return e!==null&&e.toString().length>0}function nd(e){if(!pt)return!1;let t=e.clientX-pt.x,n=e.clientY-pt.y;return Math.sqrt(t*t+n*n)>Gu}function rd(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Ws)||td()||nd(e)||ed(t))return;let{row:n,col:r}=Qu(e.clientX,e.clientY),o=Ju(n,r),i=Date.now(),s=p(t),c=(ft.get(o)??[]).filter(d=>i-d.ts<Bs);if(c.push({ts:i,selector:s}),ft.set(o,c),c.length>=ju){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,$]of d)$>g&&(g=$,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=Ku))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Bs}}),ft.set(o,[])}}var co=3,ke=12e4,_=new Map,sn=[],mt=null,qs=f(ld),on=f(cd);function fo(e){sn=e??[],document.addEventListener("invalid",qs,{capture:!0,passive:!0}),document.addEventListener("input",on,{capture:!0,passive:!0}),document.addEventListener("change",on,{capture:!0,passive:!0}),mt=new MutationObserver(ud),mt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function po(){document.removeEventListener("invalid",qs,{capture:!0}),document.removeEventListener("input",on,{capture:!0}),document.removeEventListener("change",on,{capture:!0}),mt&&(mt.disconnect(),mt=null);for(let e of _.values())ee(e);_.clear()}function mo(){for(let e of _.values())ee(e);_.clear()}function uo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function go(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function an(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function od(e){for(let[t,n]of _)e-n.lastTs>ke&&(ee(n),_.delete(t))}function ee(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function id(e){return f(t=>{$s(e)})}function sd(e){return f(t=>{$s(e)})}function zs(e,t){let n=id(t),r=sd(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return _.set(t,o),o}function Xs(e){if(!an(e)||v(e,sn))return;let t=Date.now();od(t);let n=p(e),r=_.get(n);if(!r){zs(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=co&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:uo(e)}}),ee(r),_.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=co&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:ke,field_type:uo(e)}}),ee(r),_.delete(n)))}function ad(e){if(!an(e))return;let t=Date.now(),n=p(e),r=_.get(n);if(r){if(t-r.lastTs>ke){ee(r),_.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function $s(e){let t=Date.now(),n=_.get(e);if(n){if(t-n.lastTs>ke){ee(n),_.delete(e);return}if(n.lastTs=t,go(n.el)){n.cycles+=1,n.cycles>=co&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:ke,field_type:uo(n.el)}}),ee(n),_.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function ld(e){let t=e.target;t&&Xs(t)}function cd(e){let t=e.target;if(!t||!an(t)||v(t,sn))return;let n=p(t);_.has(n)||go(t)&&zs(t,n)}function ud(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!an(n)||v(n,sn))continue;let r=t.oldValue,o=r==="true"||r==="",i=go(n);i&&!o?Xs(n):!i&&o&&ad(n)}}var xe=null,gt=null,vo=[],Ys=0,ht=new Map;function wo(e){vo=e?.length?e:["[data-fd-impression]"],Ys=Date.now(),!(typeof IntersectionObserver>"u")&&(xe=new IntersectionObserver(y(fd),{threshold:[0,.5,1]}),js(),gt=new MutationObserver(y(dd)),gt.observe(document.body,{childList:!0,subtree:!0}))}function Eo(){xe&&(xe.disconnect(),xe=null),gt&&(gt.disconnect(),gt=null),ht.clear()}function bo(){ht.clear(),xe&&js()}function js(){for(let e of vo)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)ho(t[n])}catch{}}function ho(e){ht.has(e)||(ht.set(e,{firstSeenTs:0,emitted:!1}),xe.observe(e))}function dd(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of vo)try{r.matches(o)&&ho(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)ho(i[s])}catch{}}}function fd(e){let t=Date.now();for(let n of e){let r=ht.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Ys),viewport_position:s}})}}}var pd=2,md=3,gd=6e4,vt=new Map,Ks=[],Gs=f(hd);function yo(e){Ks=e??[],document.addEventListener("input",Gs,{capture:!0,passive:!0})}function _o(){document.removeEventListener("input",Gs,{capture:!0}),vt.clear()}function So(){vt.clear()}function hd(e){let t=e.target;if(!t||!vd(t)||v(t,Ks))return;let n=Date.now(),r=t.value??"",o=p(t),i=vt.get(o);if(!i){vt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>gd){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=md)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=pd)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:wd(t)}}),vt.delete(o);return}i.lastValue=r}function vd(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function wd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Zs=2e3,Ed=3e4,z=null,Qs=Zs,Js=[],ln=new Map,ea=f(bd),ta=f(yd),na=f(wt);function To(e,t){Qs=e?.dwellMs??Zs,Js=t??[],document.addEventListener("mouseover",ea,{passive:!0}),document.addEventListener("mouseout",ta,{passive:!0}),document.addEventListener("click",na,{capture:!0,passive:!0})}function Lo(){document.removeEventListener("mouseover",ea),document.removeEventListener("mouseout",ta),document.removeEventListener("click",na,{capture:!0}),wt(),ln.clear()}function Co(){wt(),ln.clear()}function bd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Js)||!_d(t))return;let n=p(t);if(z?.selector===n)return;wt();let r=Date.now();if(r-(ln.get(n)??0)<Ed)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);ln.set(n,s),z=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},Qs);z={el:t,selector:n,startTs:o,timer:i}}function yd(e){if(!z)return;let t=e.target;if(t!==z.el&&!z.el.contains(t))return;let n=e.relatedTarget;n&&z.el.contains(n)||wt()}function wt(){z&&(clearTimeout(z.timer),z=null)}function _d(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var Sd=20,Td=500,Ld=3e3,Cd=6e4,cn=0,un=0,X=null,ra=y(Md);function Mo(){cn=Date.now(),un=0,document.addEventListener("mouseleave",ra)}function ko(){document.removeEventListener("mouseleave",ra),X&&(clearTimeout(X),X=null)}function xo(){cn=Date.now(),un=0,X&&(clearTimeout(X),X=null)}function Md(e){if(e.clientY>Sd)return;let t=Date.now();t-cn<Ld||t-un<Cd||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();un=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-cn)}})}),Td))}var kd=2500,xd=4e3,oa=200,Ad=500,Dd=.1,Rd=.25,De=null,Re=null,G=null,Ae=0;function Ao(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Do(){if(!(typeof PerformanceObserver>"u")){try{De=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:Ao(r,kd,xd)}})})),De.observe({type:"largest-contentful-paint",buffered:!0})}catch{De=null}try{Re=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<oa||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:Ao(r,oa,Ad)}})}})),Re.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Re=null}try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!0})}catch{G=null}}}function ia(){if(G){if(G.disconnect(),G=null,Ae>0){let e=Math.round(Ae*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Ao(Ae,Dd,Rd)}})}Ae=0}}function Ro(){De&&(De.disconnect(),De=null),Re&&(Re.disconnect(),Re=null),ia()}function Io(){if(ia(),!(typeof PerformanceObserver>"u"))try{G=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Ae+=n.value)}})),G.observe({type:"layout-shift",buffered:!1})}catch{G=null}}var sa=[],aa=f(Id);function Oo(e){sa=e??[],document.addEventListener("paste",aa,{capture:!0,passive:!0})}function No(){document.removeEventListener("paste",aa,{capture:!0})}function Id(e){let t=e.target;if(!t||!Od(t)||v(t,sa))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:Nd(t)}})},100)}function Od(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Nd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var Pd="https://api.flusterduck.com/v1/ingest",te=!1,dn=null,Ie=null,Et="__flusterduck_instance__",Po=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function Hd(){let e=window;return e[Et]&&e[Et]!==Po?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[Et]=Po,!0)}function Fd(){let e=window;e[Et]===Po&&delete e[Et]}var bt=[];function Bd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Dn(e.signals?.rageClick,t),stop:Rn},{when:()=>r("deadClick"),start:()=>In(t),stop:On,reset:Nn},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;Hn(i?{delayMs:i.windowMs}:void 0,t)},stop:Fn,reset:Bn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;qn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:zn},{when:()=>r("loopNav"),start:()=>Yn(e.signals?.loopNav),stop:jn},{when:()=>r("scrollBounce"),start:Jn,stop:er,reset:tr},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;rr(i?{pauseMs:i.threshold}:void 0,t)},stop:or,reset:ir},{when:()=>o&&r("formValidationLoop"),start:()=>fo(t),stop:po,reset:mo},{when:()=>r("errorEncounter"),start:ar,stop:lr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>fr(t),stop:pr},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>gr(t),stop:hr},{when:()=>r("scrollHijack"),start:Er,stop:br,reset:$t},{when:()=>r("scrollDepthAbandon"),start:yr,stop:_r,reset:Sr},{when:()=>r("advancedHeuristics"),start:Cr,stop:Mr,reset:()=>{et(),kr()}},{when:()=>r("helpHunt"),start:()=>xr(t),stop:Ar,reset:Dr},{when:()=>r("closeClick"),start:()=>Rr(t),stop:Ir,reset:Or},{when:()=>r("closeClickReversal"),start:()=>Nr(t),stop:Pr,reset:Hr},{when:()=>r("filterSpiral"),start:()=>Br(t),stop:Wr,reset:Vr},{when:()=>r("copyFrustration"),start:Ur,stop:qr,reset:zr},{when:()=>r("textSelectFrustration"),start:Xr,stop:$r,reset:Yr},{when:()=>r("deadClickTrapZone"),start:()=>so(t),stop:ao,reset:lo},{when:()=>!0,start:()=>Zr(n),stop:Qr},{when:()=>r("navigationConfusion"),start:to,stop:no,reset:ro},{when:()=>r("scrollToClickConfusion"),start:oo,stop:io,reset:rn},{when:()=>r("elementImpression"),start:()=>wo(e.elementImpressionSelectors),stop:Eo,reset:bo},{when:()=>o&&r("inputCorrection"),start:()=>yo(t),stop:_o,reset:So},{when:()=>o&&r("pasteBlocked"),start:()=>Oo(t),stop:No},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;To(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Lo,reset:Co},{when:()=>r("exitIntent"),start:Mo,stop:ko,reset:xo},{when:()=>r("performanceVitals"),start:Do,stop:Ro,reset:Io}]}function Wd(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function Ho(e){if(te||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Vd()){Ie=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ie=e;return}if(!Hd()){Ie=e;return}Ie=e,te=!0;let t=$o(e.cookieless??!1),n=Wd(e.endpoint)??Pd,r=An(location.pathname,e.pageRules??[]),o=Ud(e.domMode);si(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=la(location.pathname,e.ignorePages??[]);i&&kn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];bt=[];for(let d of Bd(e,c,r))d.when()&&(d.start(),bt.push({stop:d.stop,reset:d.reset}));dn=ci(y((d,l)=>{ne();for(let E of bt)E.reset?.();lt(l),Gr(l);let g=An(l,e.pageRules??[]),w=la(l,e.ignorePages??[]);kn(w),xn({page:g,url:d}),Kn(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function ca(e,t){if(!te||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function ua(e,t={}){if(!te||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function da(e){if(!te||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;r==="__proto__"||r==="constructor"||r==="prototype"||(t[r.slice(0,64)]=String(e[r]).slice(0,256),n++)}xn({segment:t})}function fa(e){e&&Ie&&!te?Ho(Ie):e||(fn(),_n())}function pa(){fn(),_n()}function fn(){if(te){for(let e of bt)e.stop();bt=[],ai(),dn&&(dn(),dn=null),Fd(),te=!1}}function Vd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Ud(e){return e==="metadata"||e==="snapshot"?e:"off"}function la(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var va=.1,wa=.01,Ea=3e4,ba=50,ya=1e4,qd=500,zd=3e4,Xd=6e4,ma=10,$d=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),Yd=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,jd=/^\$\$?(heatmap|scroll)/,_a=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],hn=!1,pn=null,mn=null,yt=null,H=null,gn=null,Sa=va,Ta=wa,La=new Set,Ca=new Set(_a),Ma=Ea,Wo=ba,ka=ya,R=[],vn=0,F=[];function ga(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function xa(e){hn||(hn=!0,Sa=ga(e?.baselineSampleRate,va),Ta=ga(e?.scrollSampleRate,wa),La=new Set(e?.conversionEvents??[]),Ca=new Set(e?.criticalSignals?.length?e.criticalSignals:_a),Ma=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:Ea,Wo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:ba,ka=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:ya,R=[],vn=0,F=[],mn=ri(tf),ha()||(pn=setInterval(()=>{ha()&&Vo()},qd),setTimeout(()=>Vo(),zd)))}function Aa(){hn&&(hn=!1,Vo(),mn&&(mn(),mn=null),yt&&gn&&yt.capture.__fd_wrapped&&(yt.capture=gn),yt=null,H=null,gn=null,R=[],F=[],vn=0)}function Vo(){pn&&(clearInterval(pn),pn=null)}function ha(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;gn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return Gd(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,yt=e,!0}catch{return!1}}function Kd(e){return $d.has(e)?"critical":La.has(e)||Yd.test(e)?"conversion":jd.test(e)?"scroll":"baseline"}function Gd(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=Kd(e);if(o==="critical"||o==="conversion")return H(e,Bo(t,r),n);if(r<vn)return H(e,{...Bo(t,r),fd_boosted:!0},n);if(Zd(o==="scroll"?Ta:Sa))return H(e,Bo(t,r),n);ef({name:e,properties:t,ts:r})}function Zd(e){if(e>=1)return!0;if(e<=0)return!1;let t=Qd();return t?Jd(t)%1e4/1e4<e:Math.random()<e}var Fo="";function Qd(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return Fo||(Fo=Math.random().toString(36).slice(2)),Fo}function Jd(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Bo(e,t){return Ra(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function ef(e){R.push(e),Da(e.ts)}function Da(e){let t=e-Ma;for(;R.length&&R[0].ts<t;)R.shift();R.length>Wo&&(R=R.slice(-Wo))}function Ra(e){let t=e-Xd;F=F.filter(n=>n.ts>=t),F.length>ma&&(F=F.slice(-ma))}function tf(e,t){if(F.push({name:e,ts:t}),Ra(t),!Ca.has(e)||(vn=t+ka,!H||!R.length))return;Da(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}
|
|
1
|
+
"use strict";var _n=Object.defineProperty;var Ba=Object.getOwnPropertyDescriptor;var Wa=Object.getOwnPropertyNames;var Ua=Object.prototype.hasOwnProperty;var Va=(e,t)=>{for(var n in t)_n(e,n,{get:t[n],enumerable:!0})},qa=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wa(t))!Ua.call(e,o)&&o!==n&&_n(e,o,{get:()=>t[o],enumerable:!(r=Ba(t,o))||r.enumerable});return e};var za=e=>qa(_n({},"__esModule",{value:!0}),e);var df={};Va(df,{destroy:()=>gn,destroyPostHogTrigger:()=>Oa,identify:()=>ma,init:()=>$o,initPostHogTrigger:()=>Ia,onSignal:()=>va,optOut:()=>ha,setConsent:()=>ga,signal:()=>fa,track:()=>pa});module.exports=za(df);function y(e){return((...t)=>{try{return e(...t)}catch{}})}function f(e){return t=>{try{e(t)}catch{}}}var Tn="_fd_s";var $a=/^[0-9a-f]{32}$/;function ei(e){if(e)return Jo();let t=Xa(Tn);if(t&&$a.test(t))return t;let n=Jo();return ti(Tn,n,30),n}function Ln(){ti(Tn,"",-1)}function Jo(){let e=new Uint8Array(16);crypto.getRandomValues(e);let t="";for(let n of e)t+=n.toString(16).padStart(2,"0");return t}function Xa(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?.[1]?decodeURIComponent(t[1]):null}function ti(e,t,n){let r=new Date;r.setTime(r.getTime()+n*864e5);let o=location.protocol==="https:"?";Secure":"";document.cookie=`${e}=${encodeURIComponent(t)};path=/;expires=${r.toUTCString()};SameSite=Lax${o}`}var Ya=/^[:\d]|--|^(ember|react|ng-|__)/;function p(e){if(!e||e===document.documentElement)return"html";let t=e.getAttribute("data-fd");if(t)return`[data-fd="${He(t)}"]`;if(e.id&&!Ya.test(e.id)&&e.id.length<64)return"#"+He(e.id);let n=[],r=e,o=0;for(;r&&r!==document.body&&o<5;){let i=r.tagName.toLowerCase(),s=r.getAttribute("name"),a=r.getAttribute("role"),c=r.getAttribute("type");s&&s.length<64?i+=`[name="${He(s)}"]`:a?i+=`[role="${He(a)}"]`:c&&(i==="input"||i==="button")&&(i+=`[type="${He(c)}"]`);let d=r.parentElement;if(d){let g=d.children,w=0,E=0;for(let b=0;b<g.length;b++){let m=g[b];m&&m.tagName===r.tagName&&(w++,m===r&&(E=w))}w>1&&(i+=`:nth-of-type(${E})`)}n.unshift(i);let l=n.join(" > ");try{if(document.querySelectorAll(l).length===1)return l}catch{}r=d,o++}return n.join(" > ")}function He(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/([^\w-])/g,"\\$1")}var Fe=60,ja=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Ka=/^(INPUT|TEXTAREA|SELECT)$/;function h(e){try{let t=e.getAttribute("aria-label");if(t)return t.trim().slice(0,Fe);if(!Ka.test(e.tagName)){let i=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,Fe);if(i&&!ja.test(i))return i}let n=e.getAttribute("placeholder");if(n)return n.trim().slice(0,Fe);let r=e.getAttribute("title");if(r)return r.trim().slice(0,Fe);let o=e.getAttribute("alt");return o?o.trim().slice(0,Fe):""}catch{return""}}function v(e,t){if(e.hasAttribute("data-fd-ignore")||e.closest("[data-fd-ignore]"))return!0;for(let n of t)try{if(e.matches(n)||e.closest(n))return!0}catch{}return!1}function ri(e,t){if(t==="off")return null;if(t==="metadata")return Ga(e);let n=Za(e);return n?{mode:"snapshot",...n}:null}function Ga(e){return{mode:"metadata",selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),attributes:{disabled:e.disabled===!0,required:e.required===!0,ariaDisabled:e.getAttribute("aria-disabled")==="true",ariaExpanded:ni(e.getAttribute("aria-expanded"),["true","false"]),ariaInvalid:ni(e.getAttribute("aria-invalid"),["true","false","grammar","spelling"]),type:Qa(e)}}}function Za(e){try{let t=e.getBoundingClientRect(),n=getComputedStyle(e),r=e.parentElement,o=[];if(r)for(let s=0;s<r.children.length&&o.length<6;s++){let a=r.children[s];if(!a||a===e)continue;let c=a.getBoundingClientRect();o.push({selector:p(a),tag:a.tagName.toLowerCase(),box:{x:Math.round(c.x),y:Math.round(c.y),w:Math.round(c.width),h:Math.round(c.height)},interactive:el(a)})}let i=[];try{let s=e.getAnimations();for(let a of s)"animationName"in a&&i.push(a.animationName)}catch{}return{selector:p(e),tag:e.tagName.toLowerCase(),role:e.getAttribute("role"),parent:r?p(r):"",box:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},styles:{opacity:n.opacity,cursor:n.cursor,pointerEvents:n.pointerEvents,display:n.display,visibility:n.visibility,disabled:e.disabled===!0},inView:Ja(t),animations:i,siblings:o}}catch{return null}}function ni(e,t){return e&&t.includes(e)?e:null}function Qa(e){let t=e.tagName.toLowerCase();if(t!=="input"&&t!=="button")return null;let n=e.getAttribute("type");return n&&/^[a-z0-9_-]{1,32}$/i.test(n)?n.toLowerCase():null}function Ja(e){return e.top<window.innerHeight&&e.bottom>0&&e.left<window.innerWidth&&e.right>0}function el(e){let t=e.tagName;if(/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t))return!0;let n=e.getAttribute("role");return!!(n&&/^(button|link|tab|menuitem|checkbox|radio)$/.test(n))}var si=7e3,tl=500,nl=1e4,ai=50,Be=100,rl=3,We=6e4,xt="application/json",ol="application/json; encoding=gzip",j=[],B=null,li="",Dn=si,ci=ai,_=null,At={domMode:"off",compression:"auto"},Cn=!1,kn=null,Rn=!1,ui=!0;function In(e){ui=e}var oi=new WeakMap;function On(e){kn=e}var Dt=new Set;function fe(e){return Dt.add(e),()=>{Dt.delete(e)}}function il(e){if(e.t!=="sig"||!Dt.size)return;let t=e.d??{},n=typeof t.s=="string"?t.s:"";if(!n)return;let r={name:n,element:typeof t.el=="string"?t.el:"",weight:typeof t.w=="number"?t.w:0,meta:t.meta&&typeof t.meta=="object"?t.meta:{},ts:e.ts};for(let o of Dt)try{o(r)}catch{}}function sl(e){if(!kn||e.t!=="sig")return;let t=An(e.d?.s,e.d?.signal_type,e.d?.name);if(t)try{kn(t.slice(0,128),e.ts)}catch{}}function Nn(e){Rn=e}var al=new Set(["sid","key","url","page","ua","vw","vh","segment","environment"]),ll=new Set(["click","move","scroll","keyboard","form_focus","form_blur","form_submit","touch","navigation","error","signal","pageview","custom_signal","performance","visibility","sdk_error"]),cl=new Set(["value","text","label","email","name","phone","address","password","token","secret","cookie","session","jwt","auth","credential","card","cc","cvv","ssn"]);function ul(e){return e.replace(/([a-z])([A-Z])/g,"$1\0$2").toLowerCase().split(/[\x00_\-.\s]+/).some(n=>cl.has(n))}var dl=/(?:[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}|\b(?:\d[ -]*?){13,19}\b)/i,Mn=f(pl),xn=y(()=>J());function di(e,t,n,r,o){li=e,_=Object.assign(Object.create(null),t),At={domMode:_l(o?.domMode),compression:Tl(o?.compression)},Dn=Math.max(tl,Math.min(n??si,nl)),ci=Math.max(1,Math.min(r??ai,Be)),document.removeEventListener("visibilitychange",Mn),window.removeEventListener("pagehide",xn),document.addEventListener("visibilitychange",Mn),window.addEventListener("pagehide",xn)}function u(e){Rn||j.length>=Be||(il(e),sl(e),ui&&(j.push(e),j.length>=ci?J():B||(B=setTimeout(J,Dn))))}function J(){fl()}async function fl(){if(Cn||!j.length||!_)return;Cn=!0,B&&(clearTimeout(B),B=null);let e=j;j=[];let t={v:1,sid:_.sid,key:_.key,url:_.url,page:_.page,ts:Date.now(),ua:_.ua,vw:_.vw,vh:_.vh,environment:_.environment,..._.segment?{segment:_.segment}:{},dom_mode:At.domMode},n=[],r={source:[],events:[]};try{for(let o of e){let i=El(o,_.page,At.domMode),s=[...r.events,i];JSON.stringify({...t,events:s}).length>We?r.events.length>0?(n.push(r),r={source:[o],events:[i]}):(JSON.stringify({...t,events:[i]}).length<=We?n.push({source:[o],events:[i]}):console.warn("[flusterduck] event dropped: serialized size exceeds limit. Reduce metadata payload size."),r={source:[],events:[]}):(r.source.push(o),r.events=s)}r.events.length>0&&n.push(r);for(let o of n)ml({...t,events:o.events}).then(i=>{i||ii(o.source)}).catch(()=>ii(o.source))}catch(o){console.error("[flusterduck] batch serialization failed, events dropped:",o instanceof Error?o.message:"unknown error")}finally{Cn=!1}}function ii(e){let t=e.filter(r=>{let o=oi.get(r)??0;return o>=rl?!1:(oi.set(r,o+1),!0)});if(!t.length)return;let n=[...t,...j];n.length>Be?(console.warn(`[flusterduck] event queue overflow, dropped ${n.length-Be} oldest events`),j=n.slice(-Be)):j=n,B||(B=setTimeout(J,Dn))}function Pn(e){if(_)for(let t of Object.keys(e))al.has(t)&&(_[t]=e[t])}function fi(){J(),Rn=!1,document.removeEventListener("visibilitychange",Mn),window.removeEventListener("pagehide",xn),B&&(clearTimeout(B),B=null)}function pl(){document.visibilityState==="hidden"&&J()}async function ml(e){let t=JSON.stringify(e),n=await gl(t,At.compression);return n?wl(n):!0}async function gl(e,t){let n=new TextEncoder().encode(e);if(n.byteLength>We)return null;if(t!=="off"){let o=await hl(e);if(o&&o.byteLength<=We)return{beaconBody:new Blob([o],{type:ol}),fetchBody:new Uint8Array(o),headers:{"Content-Type":xt,"Content-Encoding":"gzip"}}}return{beaconBody:new Blob([n],{type:xt}),fetchBody:e,headers:{"Content-Type":xt}}}async function hl(e){let t=globalThis.CompressionStream;if(typeof t!="function")return null;try{let n=vl(e);if(!n)return null;let r=new t("gzip"),i=n.pipeThrough(r).getReader(),s=[],a=0;for(;;){let l=await i.read();if(l.done)break;if(a+=l.value.byteLength,a>We)return null;let g=new Uint8Array(l.value.byteLength);g.set(l.value),s.push(g)}let c=new Uint8Array(a),d=0;for(let l of s)c.set(l,d),d+=l.byteLength;return c.buffer}catch{return null}}function vl(e){let t=new TextEncoder().encode(e),n=new Blob([t],{type:xt});if(typeof n.stream=="function")return n.stream();let r=globalThis.ReadableStream;return typeof r!="function"?null:new r({start(o){o.enqueue(t),o.close()}})}async function wl(e,t=li){if(!t)return!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(t,e.beaconBody))return!0}catch{}try{return await fetch(t,{method:"POST",body:e.fetchBody,headers:e.headers,keepalive:!0}),!0}catch{return!1}}function El(e,t,n){let r=e.d??{},o=bl(e.t),i={type:o,ts:e.ts,page:typeof r.page=="string"?r.page.slice(0,2048):t},s=An(r.el,r.element,r.target);if(o==="signal"){i.signal_type=An(r.s,r.signal_type,r.name)?.slice(0,128),s&&(i.element=s.slice(0,2048));let c=s?Sl(s,n):null;c&&(i.dom=c)}let a=yl(r);return Object.keys(a).length&&(i.metadata=a),i}function bl(e){return e==="pv"?"pageview":e==="sig"?"signal":ll.has(e)?e:"custom_signal"}function yl(e){let t=Object.create(null);for(let n of Object.keys(e)){if(["s","signal_type","name","el","element","target","dom","page","meta"].includes(n))continue;let r=Rt(e[n],n);r!==void 0&&(t[n.slice(0,64)]=r)}if(e.meta&&typeof e.meta=="object"&&!Array.isArray(e.meta)){let n=Rt(e.meta,"meta");n&&typeof n=="object"&&!Array.isArray(n)&&Object.assign(t,n)}return t}function Rt(e,t="",n=0){if(!(n>4)&&!ul(t)){if(e===null||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string")return dl.test(e)?void 0:e.slice(0,500);if(Array.isArray(e))return e.slice(0,20).map(o=>Rt(o,t,n+1)).filter(o=>o!==void 0);if(typeof e=="object"){let r=Object.create(null);for(let o of Object.keys(e).slice(0,40)){if(o==="__proto__"||o==="constructor"||o==="prototype")continue;let i=Rt(e[o],o,n+1);i!==void 0&&(r[o.slice(0,64)]=i)}return r}}}function Sl(e,t){if(t==="off")return null;try{let n=document.querySelector(e);return n?ri(n,t):null}catch{return null}}function An(...e){for(let t of e)if(typeof t=="string"&&t)return t}function _l(e){return e==="metadata"||e==="snapshot"?e:"off"}function Tl(e){return e==="off"?"off":"auto"}function pi(e){let t=location.href;function n(){let a=location.href;a!==t&&(t=a,e(a,location.pathname))}let r=history.pushState,o=history.replaceState,i=function(...a){r.apply(this,a),n()},s=function(...a){o.apply(this,a),n()};return history.pushState=i,history.replaceState=s,window.addEventListener("popstate",n),window.addEventListener("hashchange",n),function(){history.pushState===i&&(history.pushState=r),history.replaceState===s&&(history.replaceState=o),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}}function Hn(e,t){for(let n of t){let r=Cl(n.pattern);if(r&&r.test(e))return n.label}return kl(e)}var Ll=/^[a-zA-Z0-9/:._*\-]+$/;function Cl(e){if(e.length>200||!Ll.test(e))return null;let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/:\w+/g,"[^/]+");try{return new RegExp("^"+t+"$")}catch{return null}}function kl(e){return e.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")}var Ml=[".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"]'],W=[],mi=3,gi=2e3,hi=24,It=hi,vi=[],pe=[],wi=0,Ot=new Map,Nt=new Map,xl=1e4,Pt=!1,Ei=f(Al);function Fn(e,t){Pt||(Pt=!0,mi=e?.threshold??3,gi=e?.windowMs??2e3,It=e?.radius&&e.radius>0?e.radius:hi,vi=[...Ml,...t??[]],wi=Date.now(),W=[],pe=[],Ot.clear(),Nt.clear(),document.addEventListener("click",Ei,{capture:!0,passive:!0}))}function Bn(){Pt&&(Pt=!1,document.removeEventListener("click",Ei,{capture:!0,passive:!0}),W=[],pe=[],Ot.clear(),Nt.clear())}function Al(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,vi)||Ol(t))return;let n=Date.now(),r=e.clientX,o=e.clientY;for(;W.length&&n-W[0].t>gi;)W.shift();W.push({t:n,x:r,y:o});let i=Dl();if(W.length<i)return;let s=W.slice(-i);for(let k=0;k<s.length-1;k++)for(let Pe=k+1;Pe<s.length;Pe++){let Ct=s[k],kt=s[Pe],Mt=kt.x-Ct.x,de=kt.y-Ct.y;if(Mt*Mt+de*de>It*It)return}let a=s[0].t,d=(s[s.length-1].t-a)/1e3,l=d>0?s.length/d:s.length,g=(s.length-i)/i+l/10,w=Math.round(Math.min(1,g)*100)/100,E=Il(s,i,l),b=p(t),m=h(t);pe.push({selector:b,ts:n});let Y=pe.length,Lt=Rl(n),Go=Ot.get(b)??0,yn=Go+1,Zo=Nt.get(b)??0,Ha=Zo>0&&n-Zo<xl;Ot.set(b,yn),Nt.set(b,n);let Qo=Go>=1,Fa=(()=>{try{let k=t.getBoundingClientRect();if(k.width===0&&k.height===0)return null;let Pe=s.reduce((de,Sn)=>de+Sn.x,0)/s.length,Ct=s.reduce((de,Sn)=>de+Sn.y,0)/s.length,kt=k.left+k.width/2,Mt=k.top+k.height/2;return{click_dx:Math.round(Pe-kt),click_dy:Math.round(Ct-Mt),el_w:Math.round(k.width),el_h:Math.round(k.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"rage_click",el:b,...m?{el_label:m}:{},cnt:s.length,vel:Math.round(l*10)/10,intensity:w,quality:E,burst_seq:Y,burst_rate_per_min:Lt,repeated_target:Qo,hot_repeat:Ha,...Fa??{}}}),Qo&&u({t:"sig",ts:n,d:{s:"rage_click_repeat_target",el:b,...m?{el_label:m}:{},total_hits:yn,burst_count:yn,burst_seq:Y}}),W=W.slice(-(i-1))}function Dl(){return pe.length>=3?2:mi}function Rl(e){let t=(e-wi)/6e4;return t<=0?0:Math.round(pe.length/t*10)/10}function Il(e,t,n){let r=e.length-t,o=Math.min(4,r/5*4),s=Math.min(4,n/10*4),a=2;if(e.length>=2){let d=0,l=0;for(let w=0;w<e.length-1;w++)for(let E=w+1;E<e.length;E++){let b=e[w],m=e[E],Y=m.x-b.x,Lt=m.y-b.y;d+=Math.sqrt(Y*Y+Lt*Lt),l++}let g=d/l;a=Math.max(0,2-g/It*2)}let c=o+s+a;return Math.round(Math.min(10,Math.max(0,c)))}function Ol(e){let t=e.tagName;return!!(t==="VIDEO"||t==="AUDIO"||e.hasAttribute("ondblclick")||e.hasAttribute("data-dbl")||e.getAttribute("role")==="spinbutton")}var Nl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Pl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,Hl=/^(A|BUTTON|LABEL)$/,Fl=20,bi=[],me=null,Bl=5,Ht=new Map,yi=f(Wl),Si=f(ql);function Wl(e){me={x:e.clientX,y:e.clientY}}function Wn(e){bi=e??[],document.addEventListener("mousedown",yi,{capture:!0,passive:!0}),document.addEventListener("click",Si,{capture:!0,passive:!0})}function Un(){document.removeEventListener("mousedown",yi,{capture:!0}),document.removeEventListener("click",Si,{capture:!0}),me=null,Ht.clear()}function Vn(){Ht.clear()}function Ul(e){try{return window.getComputedStyle(e).cursor.slice(0,Fl)}catch{return""}}function Vl(e){try{let t=window.getComputedStyle(e);return t.cursor==="pointer"&&t.pointerEvents!=="none"}catch{return!1}}function ql(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,bi)||Yl())return;let n=jl(e);if(me=null,n||zl(t))return;let r=$l(t,e.clientX,e.clientY),o=r?_i(e.clientX,e.clientY,r):null,i=p(t),a=(Ht.get(i)??0)+1;Ht.set(i,a);let c=a>=2,d=Ul(t),l=Vl(t),g=h(t),w=r?h(r):"";u({t:"sig",ts:Date.now(),d:{s:"dead_click",el:i,...g?{el_label:g}:{},near:r?p(r):"",...w?{near_label:w}:{},dist:o?Math.round(o.dist):-1,...o?{click_dx:Math.round(o.dx),click_dy:Math.round(o.dy)}:{},cursor:d,...l?{looks_interactive:!0}:{},...c?{repeated:!0,repeat_cnt:a}:{}}})}function zl(e){if(Nl.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Pl.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&Hl.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function $l(e,t,n){let r=e;for(let o=0;o<5&&r;o++){let i=r.parentElement;if(!i)break;let s=i.querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]'),a=null,c=1/0;for(let d=0;d<s.length;d++){let l=s[d];if(!l||l===e)continue;let g=Xl(t,n,l);g<c&&(c=g,a=l)}if(a&&c<100)return a;r=i}return null}function _i(e,t,n){let r=n.getBoundingClientRect(),o=Math.max(r.left,Math.min(e,r.right)),i=Math.max(r.top,Math.min(t,r.bottom)),s=e-o,a=t-i;return{dist:Math.sqrt(s*s+a*a),dx:s,dy:a}}function Xl(e,t,n){return _i(e,t,n).dist}function Yl(){let e=window.getSelection();return e!==null&&e.toString().length>0}function jl(e){if(!me)return!1;let t=e.clientX-me.x,n=e.clientY-me.y;return Math.sqrt(t*t+n*n)>Bl}var T=null,qn=3e3,Ti=[],Ft="click",Bt=0,Kl=/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/,Gl=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton)$/,Li=f(Jl),Ci=f(Zl),ki=f(Ql);function zn(e,t){qn=e?.delayMs??3e3,Ti=t??[],document.addEventListener("click",Li,{capture:!0,passive:!0}),document.addEventListener("keydown",Ci,{capture:!0,passive:!0}),document.addEventListener("touchstart",ki,{capture:!0,passive:!0})}function $n(){document.removeEventListener("click",Li,{capture:!0}),document.removeEventListener("keydown",Ci,{capture:!0}),document.removeEventListener("touchstart",ki,{capture:!0}),ge()}function Xn(){ge()}function Zl(e){e.target&&(e.key!=="Enter"&&e.key!==" "||(Ft="keydown",Bt=Date.now()))}function Ql(){Ft="touch",Bt=Date.now()}function Jl(e){let t=e.target;if(!t||v(t,Ti))return;let n=t.getAttribute("role");if(!Kl.test(t.tagName)&&!(n&&Gl.test(n)))return;let r=Date.now();if(r-Bt>50&&(Ft="click",Bt=r),T){if(T.el===t||T.el.contains(t)){let d=r-T.ts;d>=qn&&u({t:"sig",ts:r,d:{s:"speed_frustration",el:T.selector,delay:d,interaction_type:Ft,observed_delay_ms:d}}),ge();return}ge()}let o=p(t),i=!1,s=new MutationObserver(d=>{for(let l of d){if(l.type==="childList"&&(l.addedNodes.length>0||l.removedNodes.length>0)){i=!0,ge();return}if(l.type==="attributes"&&l.target instanceof Element&&(l.target===t||t.contains(l.target)||l.target.contains(t))){i=!0,ge();return}}}),a=t.parentElement||document.body;s.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","aria-hidden","disabled"]});let c=setTimeout(()=>{!i&&T&&(T.observer.disconnect(),T={...T,timeout:null})},qn+500);T={el:t,selector:o,ts:r,observer:s,timeout:c}}function ge(){T&&(T.observer.disconnect(),T.timeout&&clearTimeout(T.timeout),T=null)}var ec=100,tc=5,Mi=800,xi=2e3,nc=3,jn=0,rc=16,Wt=0,Ut=0,Ue=0,Ve=0,qe=0,Vt=0,Yn=0,oe=[],Kn=0,he=null,Ai=f(oc);function Gn(e){Mi=e?.velocityThreshold??800,xi=e?.windowMs??2e3,document.addEventListener("mousemove",Ai,{passive:!0})}function Zn(){document.removeEventListener("mousemove",Ai),he&&clearTimeout(he),Qn()}function oc(e){let t=Date.now();t-jn<rc||(jn=t,he&&clearTimeout(he),he=setTimeout(()=>Qn(),150),ic(e.clientX,e.clientY,t))}function ic(e,t,n){if(Ue===0){Wt=e,Ut=t,Ue=n,Yn=n;return}let r=(n-Ue)/1e3;if(r===0)return;let o=e-Wt,i=t-Ut;if(Math.abs(o)<2&&Math.abs(i)<2)return;let s=Math.sqrt(o*o+i*i),a=s/r;oe.length>=ec&&(oe=oe.slice(-50)),oe.push(a),Kn+=s;let c=Math.sign(o),d=Math.sign(i);if(s>=tc&&(Ve!==0&&c!==0&&c!==Ve||qe!==0&&d!==0&&d!==qe)&&Vt++,Ve=c||Ve,qe=d||qe,Wt=e,Ut=t,Ue=n,n-Yn>xi){if(Vt>=nc){let l=oe.reduce((g,w)=>g+w,0)/oe.length;l>=Mi&&u({t:"sig",ts:n,d:{s:"thrash_cursor",vel:Math.round(l),rev:Vt,distance_px:Math.round(Kn)}})}Qn(),Yn=n}}function Qn(){Vt=0,oe=[],Kn=0,Ve=0,qe=0,Ue=0,Wt=0,Ut=0,jn=0,he=null}var Di=100,Ri=5,sc=3,L=[],M=[],Jn=3e4;function er(e){Jn=e?.windowMs??3e4}function tr(){L=[],M=[]}function nr(e){let t=Date.now(),n=e.indexOf("#"),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);for(;L.length&&t-L[0].ts>Jn;)L.shift();for(;M.length&&t-M[0].ts>Jn;)M.shift();if(L.length>=Di&&(L=L.slice(-50)),M.length>=Di&&(M=M.slice(-50)),L.push({path:e,ts:t}),o){M.push({path:e,ts:t});let a=M.filter(d=>{let l=d.path.indexOf("#");return(l===-1?d.path:d.path.slice(0,l))===r}),c=new Set(a.map(d=>{let l=d.path.indexOf("#");return l===-1?"":d.path.slice(l)}));if(c.size>=sc&&a.length>c.size){let d=a.slice(-Ri).map(l=>l.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"hash",pages:Array.from(c).map(l=>r+l),path_sequence:d}}),M=M.filter(l=>{let g=l.path.indexOf("#");return(g===-1?l.path:l.path.slice(0,g))!==r});return}}if(L.length<4)return;let i=!1,s=[];for(let a=0;a<L.length-1;a++)if(L[a].path===e){let c=L.slice(a,L.length),d=new Set(c.map(l=>l.path));if(d.size>=2){s.push(...Array.from(d)),i=!0;break}}if(i){let a=L.slice(-Ri).map(c=>c.path);u({t:"sig",ts:t,d:{s:"loop_nav",loop_type:"path",pages:s,path_sequence:a}}),L=[{path:e,ts:t}],M=M.filter(c=>{let d=c.path.indexOf("#");return(d===-1?c.path:c.path.slice(0,d))!==r})}}var ac=100,Ii=1e4,or=.5,C=[],qt=0,ir=0,ze=!1,rr=0,Oi=f(lc);function sr(e){Ii=e?.windowMs??1e4,or=e?.depthThreshold??.5,window.addEventListener("scroll",Oi,{passive:!0})}function ar(){window.removeEventListener("scroll",Oi),C=[],ze=!1}function lr(){C=[],qt=0,ir=0,ze=!1}function lc(){ze||(ze=!0,requestAnimationFrame(()=>{ze=!1,cc()}))}function cc(){let e=Date.now(),t=window.scrollY;if(rr=document.documentElement.scrollHeight-window.innerHeight,rr<=0)return;let n=t/rr,r=t>qt?"down":"up";if(e-ir<100){qt=t;return}for(;C.length&&e-C[0].ts>Ii;)C.shift();C.length>=ac&&(C=C.slice(-50)),C.push({depth:n,ts:e,direction:r}),qt=t,ir=e;let o=0,i=1,s=0,a=!1,c=0,d=0,l=0,g=1,w=0;for(let E=1;E<C.length;E++)C[E].direction!==C[E-1].direction&&w++;for(let E=0;E<C.length;E++){let b=C[E],m=b.depth;if(m>o&&(o=m),m>=or&&(a||(c=b.ts,l=m),a=!0),a&&m<i&&(i=m,d=b.ts,g=m),a&&i<.25&&m>=or){if(d-c<200){a=!1,i=1,c=b.ts,l=m;continue}s++,a=!1,i=1}}if(s>=1){let E=Math.max(d-c,1),b=Math.abs(l-g)*100,m=Math.round(b/E*1e3);u({t:"sig",ts:e,d:{s:"scroll_bounce",depth:Math.round(o*100)/100,rev:s+1,vel:m,dir_changes:w}}),C=[]}}var uc=["textarea",'[role="textbox"]',"[contenteditable]"],Xe=new Map,Ye=new Map,K=new Set,ie=null,cr=0,Ni=5e3,Pi=[],dc=50,Hi=f(fc),Fi=f(pc),Bi=f(mc),Wi=y(pr),$e=null;function ur(e,t){Ni=e?.pauseMs??5e3,Pi=t??[],document.addEventListener("focusin",Hi,{capture:!0,passive:!0}),document.addEventListener("focusout",Fi,{capture:!0,passive:!0}),document.addEventListener("submit",Bi,{capture:!0,passive:!0}),window.addEventListener("pagehide",Wi),$e=y(()=>{document.visibilityState==="hidden"&&pr()}),document.addEventListener("visibilitychange",$e)}function dr(){document.removeEventListener("focusin",Hi,{capture:!0}),document.removeEventListener("focusout",Fi,{capture:!0}),document.removeEventListener("submit",Bi,{capture:!0}),window.removeEventListener("pagehide",Wi),$e&&(document.removeEventListener("visibilitychange",$e),$e=null),Xe.clear(),Ye.clear(),K.clear(),ie=null}function fr(){pr(),Xe.clear(),Ye.clear(),K.clear(),ie=null,cr=0}function fc(e){let t=e.target;if(!t||!Ui(t)||v(t,Pi)||gc(t))return;let n=Date.now();Xe.set(t,n),Ye.set(t,n);let r=t.closest("form");r&&r!==ie&&(ie=r,cr=r.querySelectorAll("input, select, textarea").length)}function pc(e){let t=e.target;if(!t||!Ui(t))return;let n=Xe.get(t),r=Ye.get(t);Xe.delete(t),Ye.delete(t);let o=Date.now();if(!(r!==void 0&&o-r<dc)&&n!==void 0){let a=o-n;if(a>=Ni){let c=h(t);u({t:"sig",ts:o,d:{s:"form_hesitation",el:p(t),...c?{el_label:c}:{},pause:a}})}}let s=t.getAttribute("name")||t.getAttribute("id")||p(t);hc(t)&&K.add(s)}function mc(){K.clear(),ie=null}function pr(){if(K.size>0&&ie){let e=cr||K.size,t=Math.round(K.size/e*100)/100;u({t:"sig",ts:Date.now(),d:{s:"form_abandon",filled:K.size,total:e,field_count:e,completion_rate:t}}),K.clear(),ie=null}}function Ui(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function gc(e){if(e.tagName==="TEXTAREA")return!0;for(let t of uc)try{if(e.matches(t))return!0}catch{return!1}return!1}function hc(e){return"value"in e?e.value.length>0:!1}var ve=null,je=null,Vi=/flusterduck\.com|\/v1\/ingest/,zi=f(Ec),$i=f(bc);function gr(){window.addEventListener("error",zi),window.addEventListener("unhandledrejection",$i),yc()}function hr(){window.removeEventListener("error",zi),window.removeEventListener("unhandledrejection",$i),Sc()}var mr=/fetch|network|cors|timeout/i;function vc(e){return mr.test(e)?"network":"script"}function wc(e){if(e instanceof TypeError&&mr.test(e.message)||typeof Response<"u"&&e instanceof Response)return"network";let t=e instanceof Error?e.message:String(e??"");return mr.test(t)?"network":"unhandled_promise"}function Ec(e){let t=e.message||"Unknown error";u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"js_error",msg:vr(t,200),ep:"",status:0,error_category:vc(t),url:location.pathname}})}function bc(e){let t=e.reason instanceof Error?e.reason.message:String(e.reason??"");u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"unhandled_rejection",msg:vr(t,200),ep:"",status:0,error_category:wc(e.reason),url:location.pathname}})}function yc(){ve||(ve=window.fetch,je=function(t,n){let r;try{r=ve.call(this,t,n)}catch(o){throw o}return r.then(o=>{try{if(o.status>=400){let i=typeof t=="string"?t:t instanceof URL?t.pathname:t.url;Vi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:`${o.status} ${o.statusText}`,ep:qi(i),status:o.status,error_category:"network",url:location.pathname}})}}catch{}return o},o=>{try{let i=typeof t=="string"?t:t instanceof URL?t.href:t.url;Vi.test(i)||u({t:"sig",ts:Date.now(),d:{s:"error_encounter",type:"network_error",msg:vr(o instanceof Error?o.message:"Fetch failed",200),ep:typeof t=="string"?qi(t):"",status:0,error_category:"network",url:location.pathname}})}catch{}throw o})},window.fetch=je)}function Sc(){ve&&je&&window.fetch===je&&(window.fetch=ve),ve=null,je=null}function qi(e){try{return new URL(e,location.origin).pathname}catch{let t=e.indexOf("?"),n=e.indexOf("#"),r=Math.min(t>=0?t:e.length,n>=0?n:e.length);return e.slice(0,r)||"/"}}function vr(e,t){let n=e.length>t?e.slice(0,t):e;return n=n.replace(/(?:token|key|secret|password|auth|bearer|jwt|session|cookie|credential)[=:]\s*\S+/gi,"[REDACTED]"),n=n.replace(/https?:\/\/[^\s]*[?&][^\s]*/g,r=>{try{return new URL(r).origin+new URL(r).pathname}catch{return"[URL]"}}),n}var Xi=[".carousel",".slider",".swiper","[data-swipeable]",".drawer"],_c=['[class*="map"]',"canvas",".gallery","[data-zoom]"],ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,wr=0,Er=null,Yi=[],ji=f(Tc),Ki=f(Lc),Gi=f(Mc),Zi=f(Dc),Qi=f(xc);function br(e){Yi=e??[],document.addEventListener("touchstart",ji,{passive:!0}),document.addEventListener("touchend",Ki,{passive:!0}),"ontouchstart"in window&&(document.addEventListener("gesturechange",Gi,{passive:!0}),window.addEventListener("orientationchange",Zi,{passive:!0})),window.visualViewport?.addEventListener("resize",Qi)}function yr(){document.removeEventListener("touchstart",ji),document.removeEventListener("touchend",Ki),document.removeEventListener("gesturechange",Gi),window.removeEventListener("orientationchange",Zi),window.visualViewport?.removeEventListener("resize",Qi),ee=null,Ee=0,Ke=1,I=0,Ge=0,Ze=0,we=0,wr=0,Er=null}function Ji(e){let t=e[0],n=e[1];if(!t||!n)return 0;let r=t.clientX-n.clientX,o=t.clientY-n.clientY;return Math.sqrt(r*r+o*o)}function Tc(e){let t=e.touches[0];e.touches.length===1&&t?(ee={x:t.clientX,y:t.clientY,ts:Date.now()},Ee=0):e.touches.length===2&&(Ee=Ji(e.touches),ee=null)}function Lc(e){if(Ee>0){let s=e.touches.length>=2?Ji(e.touches):(()=>{let a=e.changedTouches[0],c=e.changedTouches[1];if(!a||!c)return 0;let d=a.clientX-c.clientX,l=a.clientY-c.clientY;return Math.sqrt(d*d+l*l)})();s>0&&(Ke=Math.round(s/Ee*100)/100),Ee=0}if(!ee||e.changedTouches.length!==1)return;let t=e.changedTouches[0];if(!t)return;let n=t.clientX-ee.x,r=t.clientY-ee.y,o=Date.now()-ee.ts,i=document.elementFromPoint(t.clientX,t.clientY);Math.abs(n)<10&&Math.abs(r)<10&&o<300&&i&&Cc(i,t.clientX,t.clientY),o<500&&(Math.abs(n)>50||Math.abs(r)>50)&&kc(i,n,r),ee=null}function Cc(e,t,n){if(v(e,Yi))return;let r=Rc(e,t,n);if(!r)return;let o=r.getBoundingClientRect(),i=Math.max(o.left,Math.min(t,o.right)),s=Math.max(o.top,Math.min(n,o.bottom)),a=Math.sqrt((t-i)**2+(n-s)**2);if(a>0&&a<=20){let c=`${Math.round(o.width)}x${Math.round(o.height)}`;u({t:"sig",ts:Date.now(),d:{s:"tap_miss",el:p(r),dist:Math.round(a),size:c}})}}function kc(e,t,n){if(Math.abs(n)>Math.abs(t)||!e||Xi.some(s=>{try{return e.matches(s)||e.closest(s)}catch{return!1}})||!Xi.some(s=>{try{return document.querySelector(s)!==null}catch{return!1}}))return;let i=t>0?"right":"left";u({t:"sig",ts:Date.now(),d:{s:"swipe_miss",dir:i}})}function Mc(){let e=Date.now();if(e-Ge>3e4&&(I=0,Ge=e),I++,I>=2){let t=document.activeElement||document.body;!_c.some(r=>{try{return t.matches(r)||t.closest(r)}catch{return!1}})&&e-Ze>200&&(Ze=e,u({t:"sig",ts:e,d:{s:"pinch_zoom",cnt:I,pinch_scale:Ke}})),I=0,Ke=1}}function xc(){let e=window.visualViewport;if(e&&e.scale>1.1){let t=Date.now();if(t-Ge>3e4&&(I=0,Ge=t),I++,I>=2&&t-Ze>200){let n=Math.round(e.scale*100)/100;Ze=t,u({t:"sig",ts:t,d:{s:"pinch_zoom",cnt:I,pinch_scale:n}}),I=0,Ke=1}}}function Ac(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function Dc(){let e=Date.now(),t=screen.orientation?.type||"unknown";e-wr>3e4&&(we=0,wr=e),t!==Er&&(we++,Er=t),we>=3&&(u({t:"sig",ts:e,d:{s:"orientation_thrash",cnt:we,orientation:Ac()}}),we=0)}function Rc(e,t,n){let o=(e.parentElement||document.body).querySelectorAll('a, button, input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])'),i=null,s=21;for(let a=0;a<o.length;a++){let c=o[a];if(!c)continue;let d=c.getBoundingClientRect(),l=Math.max(d.left,Math.min(t,d.right)),g=Math.max(d.top,Math.min(n,d.bottom)),w=Math.sqrt((t-l)**2+(n-g)**2);w<s&&w>0&&(s=w,i=c)}return i}var x=[],be=null,A=0,ye=0,V="",U=[],Sr=[],Ic=10,Oc=5e3,es=5,ts=3e3,Nc=15,Pc=5e3,ns=f(Hc);function _r(e){Sr=e??[],document.addEventListener("keydown",ns,{capture:!0,passive:!0})}function Tr(){document.removeEventListener("keydown",ns,{capture:!0}),x=[],U=[],be=null,A=0,ye=0,V="",Sr=[]}function Hc(e){let t=Date.now(),n=e.target;n&&v(n,Sr)||(e.key==="Tab"?Bc(t,n,e.shiftKey):e.key==="Escape"?Wc(t,e.target):(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight")&&Uc(t,e.target))}function Fc(e){let t=0;for(let n=1;n<e.length;n++)e[n].shift!==e[n-1].shift&&t++;return t}function Bc(e,t,n){for(;x.length&&e-x[0].ts>Oc;)x.shift();x.length>=50&&(x=x.slice(-25));let r=t?p(t):"";if(x.push({ts:e,el:r,shift:n}),x.length>=Ic){let i=x.map(a=>a.el).filter(Boolean),s=Fc(x);u({t:"sig",ts:e,d:{s:"tab_thrash",cnt:x.length,els:i,direction_changes:s}}),x=[]}if(!t)return;let o=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(o){let i=p(t);o===be?e-ye<=ts?(A++,V=i,A>=es&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(o),attempts:A,trapped_element:V}}),A=0,V="",be=null)):(ye=e,A=1,V=i):(be=o,ye=e,A=1,V=i)}}function Wc(e,t){if(!t)return;let n=t.closest('[role="dialog"]')||t.closest('[role="menu"]')||t.closest(".modal")||t.closest('[aria-modal="true"]');if(n&&n===be){if(e-ye>ts){ye=e,A=1,V=p(t);return}A++,V=p(t),A>=es&&(u({t:"sig",ts:e,d:{s:"focus_trap",container:p(n),attempts:A,trapped_element:V}}),A=0,V="",be=null)}}function Uc(e,t){if(!t)return;let n=t.closest('[role="listbox"]')||t.closest('[role="menu"]')||t.closest('[role="tree"]')||t.closest("select");if(!n)return;for(;U.length&&e-U[0].ts>Pc;)U.shift();U.length>=50&&(U=U.slice(-25)),U.push({ts:e,container:n});let r=U.filter(o=>o.container===n);r.length>=Nc&&(u({t:"sig",ts:e,d:{s:"keyboard_nav_frustration",container:p(n),keys:r.length}}),U=[])}var Se=0,zt=0,$t=null,Lr=0,Xt=!1,Yt=0,Cr=0,Vc=1e4,qc=2,zc=4,$c=3e3,Qe=null,jt=0,Xc=2e3,rs=f(Kc),os=f(Yc),is=f(jc);function kr(){window.addEventListener("wheel",os,{passive:!0}),window.addEventListener("touchmove",is,{passive:!0}),window.addEventListener("scroll",rs,{passive:!0})}function Mr(){window.removeEventListener("wheel",os),window.removeEventListener("touchmove",is),window.removeEventListener("scroll",rs),Kt()}function Kt(){Se=0,zt=0,$t=null,Lr=0,Xt=!1,Yt=0,Cr=0,Qe=null,jt=0}function Yc(){Qe="wheel",jt=Date.now()}function jc(){Qe="touch",jt=Date.now()}function Kc(){Xt||(Xt=!0,requestAnimationFrame(()=>{Xt=!1,Gc()}))}function Gc(){let e=Date.now(),t=window.scrollY,n=t-zt;if(Math.abs(n)<2){zt=t;return}let r=n>0?"down":"up";if($t&&r!==$t&&(e-Lr>$c&&(Se=0,Lr=e),Se++,Se>=zc&&Math.abs(n)>100)){let i=e-jt,s=Qe!==null&&i<=Xc?Qe:"wheel";e-Cr>Vc&&(Yt=0,Cr=e),Yt++;let a=Yt>=qc;u({t:"sig",ts:e,d:{s:"scroll_hijack",rev:Se,source:s,repeated:a}}),Se=0}$t=r,zt=t}var se=0,_e=0,Je=!1,as=f(Zc),et=null,tt=null;function xr(){window.addEventListener("scroll",as,{passive:!0}),tt=y(ss),window.addEventListener("pagehide",tt),et=y(()=>{document.visibilityState==="hidden"&&ss()}),document.addEventListener("visibilitychange",et)}function Ar(){window.removeEventListener("scroll",as),tt&&(window.removeEventListener("pagehide",tt),tt=null),et&&(document.removeEventListener("visibilitychange",et),et=null),se=0,_e=0,Je=!1}function Dr(){se=0,_e=0,Je=!1}function Zc(){Je||(Je=!0,requestAnimationFrame(()=>{Je=!1;let e=document.documentElement.scrollHeight-window.innerHeight;if(e>0){let t=window.scrollY/e;t>se&&(se=t,_e===0&&(_e=Date.now()))}}))}function ss(){if(se>.05){let e=Date.now(),t=_e>0?Math.max(0,e-_e):0;u({t:"sig",ts:e,d:{s:"scroll_depth_abandon",depth:Math.round(se*100)/100,max_depth:Math.round(se*100),dwell_ms:t}})}}var ls=1500,cs=15e3,Qc=5e3,Jc=.15,Rr="",Te=0,Gt=0,nt=0,Le=0,Ir=0,Zt=null,Qt=0,Jt=!1,en=f(tu),us=f(nu),Ce=f(eu);function Or(){Jt||(Jt=!0,Ir=ds(),rt(),document.addEventListener("mouseenter",en,!0),document.addEventListener("mouseleave",en,!0),document.addEventListener("click",Ce,{capture:!0,passive:!0}),document.addEventListener("keydown",Ce,{capture:!0,passive:!0}),document.addEventListener("scroll",Ce,{passive:!0}),window.addEventListener("resize",us,{passive:!0}))}function Nr(){Jt&&(Jt=!1,document.removeEventListener("mouseenter",en,!0),document.removeEventListener("mouseleave",en,!0),document.removeEventListener("click",Ce,{capture:!0}),document.removeEventListener("keydown",Ce,{capture:!0}),document.removeEventListener("scroll",Ce),window.removeEventListener("resize",us),fs(),Rr="",Te=0,Gt=0,Le=0,nt=0,Qt=0)}function rt(){fs(),Qt+=1;let e=Qt;Zt=setTimeout(()=>{u({t:"sig",ts:Date.now(),d:{s:"user_confusion_idle",idle_ms:cs,cycle:e}})},cs)}function Pr(){Qt=0}function eu(){rt()}function tu(e){if(e.type!=="mouseenter")return;let t=e.target;if(!t)return;let n=p(t),r=Date.now();(n!==Rr||r-Gt>ls)&&(Rr=n,Gt=r,Te=0),Te+=1,!(Te<4)&&(u({t:"sig",ts:r,d:{s:"thrash_hover",el:n,cnt:Te,window_ms:ls}}),Te=0,Gt=r)}function nu(){let e=Date.now(),t=ds(),n=Ir||t,r=Math.abs(t-n)/Math.max(n,1);Ir=t,!(r<Jc)&&((!nt||e-nt>Qc)&&(nt=e,Le=0),Le+=1,!(Le<3)&&(u({t:"sig",ts:e,d:{s:"viewport_thrashing",cnt:Le,area_delta:Math.round(r*1e3)/1e3}}),Le=0,nt=e))}function ds(){return Math.max(1,window.innerWidth*window.innerHeight)}function fs(){Zt&&(clearTimeout(Zt),Zt=null)}var ps=6e4,ru=3,ou=["[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"]'],iu=/\b(help|faq|support|tooltip|hint|guide|explain|learn.?more)\b/i,q=[],ms=[],gs=f(su);function Hr(e){ms=e??[],document.addEventListener("click",gs,{capture:!0,passive:!0})}function Fr(){document.removeEventListener("click",gs,{capture:!0}),q=[]}function Br(){q=[]}function su(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ms)||!au(t))return;let n=Date.now();for(;q.length&&n-q[0].t>ps;)q.shift();let r=p(t);if(q.push({t:n,el:r}),q.length<ru)return;let o=new Set(q.map(s=>s.el)).size,i=h(t);u({t:"sig",ts:n,d:{s:"help_hunt",cnt:q.length,unique_els:o,el:r,...i?{el_label:i}:{},window_ms:ps}}),q=[]}function au(e){let t=e;for(let n=0;n<3&&t;n++){if(lu(t)||cu(t))return!0;t=t.parentElement}return!1}function lu(e){for(let t of ou)try{if(e.matches(t))return!0}catch{}return!1}function cu(e){let t=e.id??"",n=e.className??"",r=typeof n=="string"?`${t} ${n}`:t;return iu.test(r)}var hs=/^(close|dismiss|modal-close|dialog-close|sheet-close|drawer-close)$/i,vs=/\b(close|dismiss|no\s*thanks?|maybe\s*later|skip|got\s*it|hide\s*this|don.?t\s*show)\b/i,tn=[],nn=new Map,ws=[],Es=f(uu);function Wr(e){ws=e??[],document.addEventListener("click",Es,{capture:!0,passive:!0})}function Ur(){document.removeEventListener("click",Es,{capture:!0}),tn=[],nn.clear()}function Vr(){tn=[],nn.clear()}function uu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,ws)||!du(t))return;let n=Date.now(),r=p(t),o=h(t);tn.push({t:n,el:r});let s=(nn.get(r)??0)+1;nn.set(r,s);let a=tn.length,c=(()=>{try{let d=t.getBoundingClientRect();return d.width===0&&d.height===0?null:{click_dx:Math.round(e.clientX-(d.left+d.width/2)),click_dy:Math.round(e.clientY-(d.top+d.height/2)),el_w:Math.round(d.width),el_h:Math.round(d.height)}}catch{return null}})();u({t:"sig",ts:n,d:{s:"close_click",el:r,...o?{el_label:o}:{},session_cnt:a,element_cnt:s,repeated:s>1,container:pu(t),...c??{}}})}function du(e){let t=e;for(let n=0;n<4&&t;n++){if(fu(t))return!0;t=t.parentElement}return!1}function fu(e){let t=e.getAttribute("data-dismiss")??"",n=e.getAttribute("data-close")??"";if(t||n)return!0;let r=e.getAttribute("aria-label")??e.getAttribute("title")??"";if(r&&vs.test(r))return!0;let o=e.id??"",i=typeof e.className=="string"?e.className:"";if(hs.test(o)||hs.test(i))return!0;let s=(e.textContent??"").trim().slice(0,60);if(s&&vs.test(s))return!0;if(e.tagName==="BUTTON"&&e.closest('[role="dialog"], [role="alertdialog"], dialog, .modal, .drawer, .sheet, .overlay, .popup, [data-modal], [data-dialog]')){let c=(e.textContent??"").trim();if(c==="\xD7"||c==="\u2715"||c==="\u2717"||c==="X"||c==="x")return!0}return!1}function pu(e){let t=[['[role="dialog"], dialog',"dialog"],['[role="alertdialog"]',"alert_dialog"],[".modal, [data-modal]","modal"],[".drawer, [data-drawer], .sheet, [data-sheet]","drawer"],[".toast, [data-toast], .notification, [data-notification]","toast"],['.banner, [data-banner], [role="banner"]',"banner"],[".cookie, [data-cookie], .consent, [data-consent]","consent"],[".popup, [data-popup], .overlay, [data-overlay]","popup"]];for(let[n,r]of t)try{if(e.closest(n))return r}catch{}return"unknown"}var mu=1500,O=null,bs=[],ys=f(gu),Ss=f(hu),_s=f(vu);function qr(e){bs=e??[],document.addEventListener("click",ys,{capture:!0,passive:!0}),document.addEventListener("keydown",Ss,{capture:!0,passive:!0}),window.addEventListener("popstate",_s)}function zr(){document.removeEventListener("click",ys,{capture:!0}),document.removeEventListener("keydown",Ss,{capture:!0}),window.removeEventListener("popstate",_s),O=null}function $r(){O=null}function gu(e){if(e.button!==0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(t&&!v(t,bs)){if(wu(t)){O=null;return}O={el:p(t),label:h(t),t:Date.now()}}}function hu(e){e.key==="Escape"&&Ts("escape")}function vu(){Ts("back_nav")}function Ts(e){if(!O)return;let t=Date.now()-O.t;if(t>mu){O=null;return}u({t:"sig",ts:Date.now(),d:{s:"close_click_reversal",reversal:e,el:O.el,...O.label?{el_label:O.label}:{},elapsed_ms:t}}),O=null}function wu(e){return e.tagName==="A"?!0:e.closest('a, [role="link"], nav')!==null}var Ls=1e4,Eu=3,bu=/^(checkbox|radio)$/,Cs=/^(checkbox|radio|switch|tab|option|menuitemcheckbox|menuitemradio)$/,ot=new Map,Xr=[],ks=f(yu),Ms=f(Su);function Yr(e){Xr=e??[],document.addEventListener("change",ks,{capture:!0,passive:!0}),document.addEventListener("click",Ms,{capture:!0,passive:!0})}function jr(){document.removeEventListener("change",ks,{capture:!0}),document.removeEventListener("click",Ms,{capture:!0}),ot.clear()}function Kr(){ot.clear()}function yu(e){let t=e.target;t&&(v(t,Xr)||_u(t)&&xs(t))}function Su(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,Xr))return;let n=t.getAttribute("role")??"";Cs.test(n)&&t.tagName!=="INPUT"&&xs(t)}function xs(e){let t=p(e),n=Date.now(),r=ot.get(t);for(r||(r=[],ot.set(t,r));r.length&&n-r[0].t>Ls;)r.shift();if(r.push({t:n}),r.length<Eu)return;let o=h(e);u({t:"sig",ts:n,d:{s:"filter_spiral",el:t,...o?{el_label:o}:{},cnt:r.length,window_ms:Ls}}),ot.delete(t)}function _u(e){return e.tagName==="SELECT"?!0:e.tagName==="INPUT"?bu.test(e.type??""):Cs.test(e.getAttribute("role")??"")}var As=15e3,Tu=3,G=[],Ds=f(Lu);function Gr(){document.addEventListener("copy",Ds,{capture:!0,passive:!0})}function Zr(){document.removeEventListener("copy",Ds,{capture:!0}),G=[]}function Qr(){G=[]}function Lu(e){let t=e.target;if(t){let o=t.tagName;if(o==="INPUT"||o==="TEXTAREA"||t.isContentEditable)return}let n=window.getSelection();if(!n||n.toString().length<2)return;let r=Date.now();for(;G.length&&r-G[0].t>As;)G.shift();G.push({t:r}),!(G.length<Tu)&&(u({t:"sig",ts:r,d:{s:"copy_frustration",cnt:G.length,window_ms:As}}),G=[])}var Rs=15e3,Cu=4,ku=5,Mu=500,xu=2e3,D=[],rn=0,it=null,ae=null;function Jr(){it=y(Du),ae=y(Au),document.addEventListener("selectionchange",it),document.addEventListener("copy",ae,{capture:!0,passive:!0}),document.addEventListener("cut",ae,{capture:!0,passive:!0})}function eo(){it&&(document.removeEventListener("selectionchange",it),it=null),ae&&(document.removeEventListener("copy",ae,{capture:!0}),document.removeEventListener("cut",ae,{capture:!0}),ae=null),D=[],rn=0}function to(){D=[],rn=0}function Au(){rn=Date.now(),D=[]}function Du(){let e=window.getSelection();if(!e||e.isCollapsed||e.toString().length<ku)return;let n=e.anchorNode?.parentElement;if(n){let i=n.tagName;if(i==="INPUT"||i==="TEXTAREA"||n.isContentEditable)return}let r=Date.now();if(r-rn<xu)return;for(;D.length&&r-D[0].t>Rs;)D.shift();let o=D[D.length-1];o&&r-o.t<Mu||(D.push({t:r}),!(D.length<Cu)&&(u({t:"sig",ts:r,d:{s:"text_select_frustration",cnt:D.length,window_ms:Rs}}),D=[]))}var no=6e4,Ru=20,Os="_fd_sess",Iu={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},Ou=10,Is={low:1,medium:2,high:3,critical:4},z=[],ke=null,sn=!1,xe=new Map,Me={totalSignals:0,pagesWithFrustration:0},ro="",st=null,at=null,lt=null,ct=null;function on(e){sn&&Ns(e,Date.now())}function Nu(){try{let e=sessionStorage.getItem(Os);if(e){let t=JSON.parse(e);Me={totalSignals:typeof t.totalSignals=="number"?t.totalSignals:0,pagesWithFrustration:typeof t.pagesWithFrustration=="number"?t.pagesWithFrustration:0}}}catch{}}function Pu(){try{sessionStorage.setItem(Os,JSON.stringify(Me))}catch{}}function Hu(){let e=[],n=Date.now()-no,r=[];for(let[o,i]of xe.entries())for(let s of i)s>=n&&r.push({type:o,ts:s});r.sort((o,i)=>o.ts-i.ts);for(let o=0;o<r.length;o++)if(r[o].type==="rage_click"){for(let i=o+1;i<r.length;i++)if(r[i].type==="form_validation_loop"&&r[i].ts-r[o].ts<=3e4){e.push("rage_then_form_loop");break}}for(let o=0;o<r.length;o++)if(r[o].type==="dead_click")for(let i=o+1;i<r.length;i++){let s=r[i].type;if((s==="popstate"||s==="hashchange")&&r[i].ts-r[o].ts<=1e4){e.push("dead_then_bail");break}}for(let o=0;o<r.length;o++)if(r[o].type==="form_validation_loop"){for(let i=o+1;i<r.length;i++)if((r[i].type==="visibilitychange"||r[i].type==="pagehide")&&r[i].ts-r[o].ts<=2e4){e.push("form_loop_then_abandon");break}}return e}function Ns(e,t){xe.has(e)||xe.set(e,[]);let n=xe.get(e);n.push(t),n.length>Ru&&n.shift()}function Fu(e){let t=e-no,n=0;for(;n<z.length&&z[n].ts<t;)n++;n>0&&(z=z.slice(n))}function Bu(){let e=new Map,t=0;for(let n of z)e.set(n.type,(e.get(n.type)??0)+1),t+=Iu[n.type]??Ou;return{distinctTypes:new Set(e.keys()),totalWeight:t,typeCounts:e}}function Ps(e){let t="",n=0;for(let[r,o]of e)(o>n||o===n&&r<t)&&(t=r,n=o);return{type:t,count:n}}function Wu(e,t,n){return Ps(n).count>=3&&e>=3?"critical":e>=4&&t>=70?"high":e>=3&&t>=40?"medium":e>=2&&t>=20?"low":null}function Uu(e,t,n,r){let o=Ps(r),i=Hu();u({t:"sig",ts:Date.now(),d:{s:"frustration_burst",level:e,page:ro||void 0,distinct_types:t.size,total_weight:n,signals:Array.from(t).sort(),window_ms:no,dominant:o.type,repeat_count:o.count,sequences:i,session_total_signals:Me.totalSignals,session_pages_with_frustration:Me.pagesWithFrustration}}),Me.totalSignals+=z.length,Me.pagesWithFrustration+=1,Pu()}function Vu(e,t){if(!sn||e==="frustration_burst")return;let n=t??Date.now();Fu(n),z.length===0&&(ke=null),z.push({type:e,ts:n}),Ns(e,n);let{distinctTypes:r,totalWeight:o,typeCounts:i}=Bu(),s=Wu(r.size,o,i);s&&(ke!==null&&Is[s]<=Is[ke]||(ke=s,Uu(s,r,o,i)))}function oo(e){ro=e}function io(e){z=[],ke=null,sn=!0,xe=new Map,ro=e??"",Nu(),On(Vu),st=()=>on("popstate"),at=()=>on("hashchange"),lt=()=>{document.visibilityState==="hidden"&&on("visibilitychange")},ct=()=>on("pagehide"),window.addEventListener("popstate",st),window.addEventListener("hashchange",at),document.addEventListener("visibilitychange",lt),window.addEventListener("pagehide",ct)}function so(){sn=!1,z=[],ke=null,xe=new Map,On(null),st&&(window.removeEventListener("popstate",st),st=null),at&&(window.removeEventListener("hashchange",at),at=null),lt&&(document.removeEventListener("visibilitychange",lt),lt=null),ct&&(window.removeEventListener("pagehide",ct),ct=null)}var qu=8,ao=3e4,lo=5,zu=5e3,N=[],te="",ut=!1,Hs=f(Xu),Fs=f(Yu);function co(){N=[],ut=!1,te=location.pathname+location.search+location.hash,window.addEventListener("popstate",Hs),window.addEventListener("hashchange",Fs)}function uo(){window.removeEventListener("popstate",Hs),window.removeEventListener("hashchange",Fs),N=[],ut=!1,te=""}function fo(){N=[],ut=!1,te=location.pathname+location.search+location.hash}function dt(e){let t=Date.now();if(te&&te!==e){let n=N[N.length-1];n&&n.path===te&&n.leftAt===null&&(n.leftAt=t)}for(;N.length&&t-N[0].ts>ao;)N.shift();e!==te&&(N.push({path:e,ts:t,leftAt:null}),te=e),!(N.length<lo)&&(ut||$u(t))}function $u(e){let t=N.filter(l=>e-l.ts<=ao),n=t.filter(l=>l.leftAt!==null),r=new Set(t.map(l=>l.path));if(r.size<lo||n.length===0||n.some(l=>l.leftAt-l.ts>=zu)||new Set(n.map(l=>l.path)).size<lo)return;let s=n.map(l=>l.leftAt-l.ts),a=Math.round(s.reduce((l,g)=>l+g,0)/s.length),c=Math.max(...s),d=t.map(l=>l.path).slice(-qu);ut=!0,u({t:"sig",ts:e,d:{s:"navigation_confusion",page_count:r.size,window_ms:ao,avg_dwell_ms:a,pages:d,max_dwell_ms:c}})}function Xu(){let e=location.pathname+location.search+location.hash;dt(e)}function Yu(){let e=location.pathname+location.search+location.hash;dt(e)}var ju=.3,Bs=3e3,Z=[],ft=!1,le="none",ce=0,pt=0,mt=0,P=!1,Ws=f(Ku),Us=f(Zu);function po(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1,window.addEventListener("scroll",Ws,{passive:!0}),window.addEventListener("click",Us,{capture:!0})}function mo(){window.removeEventListener("scroll",Ws),window.removeEventListener("click",Us,{capture:!0}),an()}function an(){Z=[],le="none",ce=0,pt=0,mt=0,P=!1,ft=!1}function Ku(){ft||(ft=!0,requestAnimationFrame(Gu))}function Gu(){ft=!1;let e=Date.now(),t=window.scrollY,n=window.innerHeight,r=Z[Z.length-1];if(r&&e-r.ts<50||(Z.push({y:t,ts:e}),Z.length>60&&(Z=Z.slice(-40)),!r))return;let o=t-r.y;if(Math.abs(o)<2)return;if((o>0?"down":"up")==="down"){le!=="down"&&P&&(P=!1),t>ce&&(ce=t),le="down";return}if(P&&e-mt>Bs&&(P=!1),le==="down"){let s=ce-t,a=n*ju;s>=a&&!P&&(pt=t,mt=e,P=!0)}le="up"}function Zu(e){if(!P)return;let t=Date.now();if(t-mt>Bs){P=!1;return}if(window.scrollY+e.clientY>pt+window.innerHeight*.1)return;let r=window.innerHeight,o=Math.round(ce-pt),i=Math.round(o/r*100),s=e.target instanceof Element?e.target:null,a=s?p(s):"",c=s?h(s):"";P=!1,ce=window.scrollY,le="none",Z=[],u({t:"sig",ts:t,d:{s:"scroll_to_click_confusion",reversal_depth_px:o,click_el:a,...c?{click_el_label:c}:{},scroll_back_pct:i}})}var Qu=/^(A|BUTTON|INPUT|SELECT|TEXTAREA|DETAILS|SUMMARY)$/,Ju=/^(button|link|tab|menuitem|checkbox|radio|switch|option|combobox|slider|spinbutton|textbox)$/,ed=/^(A|BUTTON|LABEL)$/,td=3,Vs=9e4,nd=5,gt=new Map,qs=[],ht=null,rd=5,zs=f(od),$s=f(ud);function od(e){ht={x:e.clientX,y:e.clientY}}function go(e){qs=e??[],document.addEventListener("mousedown",zs,{capture:!0,passive:!0}),document.addEventListener("click",$s,{capture:!0,passive:!0})}function ho(){document.removeEventListener("mousedown",zs,{capture:!0}),document.removeEventListener("click",$s,{capture:!0}),ht=null,gt.clear()}function vo(){gt.clear()}function id(e,t){let n=Math.min(3,Math.floor(e/window.innerWidth*4));return{row:Math.min(3,Math.floor(t/window.innerHeight*4)),col:n}}function sd(e,t){return e*4+t}function ad(e){if(Qu.test(e.tagName))return!0;let t=e.getAttribute("role");if(t&&Ju.test(t)||e.hasAttribute("contenteditable")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1"||e.hasAttribute("onclick")||e.hasAttribute("onmousedown")||e.hasAttribute("onmouseup"))return!0;let n=e.parentElement;return!!(n&&ed.test(n.tagName)||e.closest('a, button, [role="button"], label, [onclick]'))}function ld(){let e=window.getSelection();return e!==null&&e.toString().length>0}function cd(e){if(!ht)return!1;let t=e.clientX-ht.x,n=e.clientY-ht.y;return Math.sqrt(t*t+n*n)>rd}function ud(e){if(e.button!==0||e.detail===0)return;let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,qs)||ld()||cd(e)||ad(t))return;let{row:n,col:r}=id(e.clientX,e.clientY),o=sd(n,r),i=Date.now(),s=p(t),c=(gt.get(o)??[]).filter(d=>i-d.ts<Vs);if(c.push({ts:i,selector:s}),gt.set(o,c),c.length>=td){let d=new Map;for(let m of c)d.set(m.selector,(d.get(m.selector)??0)+1);let l="",g=0;for(let[m,Y]of d)Y>g&&(g=Y,l=m);let w=new Set,E=[];for(let m of c)if(!w.has(m.selector)&&(w.add(m.selector),E.push(m.selector),E.length>=nd))break;let b=(()=>{try{let m=l?document.querySelector(l):null;return m?h(m):""}catch{return""}})();u({t:"sig",ts:i,d:{s:"dead_click_trap_zone",zone_row:n,zone_col:r,cnt:c.length,dominant_el:l,...b?{dominant_el_label:b}:{},elements:E,window_ms:Vs}}),gt.set(o,[])}}var wo=3,Ae=12e4,S=new Map,cn=[],vt=null,Xs=f(gd),ln=f(hd);function bo(e){cn=e??[],document.addEventListener("invalid",Xs,{capture:!0,passive:!0}),document.addEventListener("input",ln,{capture:!0,passive:!0}),document.addEventListener("change",ln,{capture:!0,passive:!0}),vt=new MutationObserver(vd),vt.observe(document.body,{subtree:!0,attributeFilter:["aria-invalid"],attributes:!0,attributeOldValue:!0})}function yo(){document.removeEventListener("invalid",Xs,{capture:!0}),document.removeEventListener("input",ln,{capture:!0}),document.removeEventListener("change",ln,{capture:!0}),vt&&(vt.disconnect(),vt=null);for(let e of S.values())ne(e);S.clear()}function So(){for(let e of S.values())ne(e);S.clear()}function Eo(e){let t=e.tagName.toLowerCase();return t==="select"?"select":t==="textarea"?"textarea":t==="input"?e.type||"text":t}function _o(e){let t=e.getAttribute("aria-invalid");if(t==="true"||t==="")return!0;if("validity"in e){let n=e;if(n.validity&&!n.validity.valid)return!0}try{return e.matches(":invalid")}catch{return!1}}function un(e){let t=e.tagName;return t==="INPUT"||t==="SELECT"||t==="TEXTAREA"}function dd(e){for(let[t,n]of S)e-n.lastTs>Ae&&(ne(n),S.delete(t))}function ne(e){e.el.removeEventListener("input",e.inputHandler),e.el.removeEventListener("change",e.changeHandler)}function fd(e){return f(t=>{Ks(e)})}function pd(e){return f(t=>{Ks(e)})}function Ys(e,t){let n=fd(t),r=pd(t);e.addEventListener("input",n,{passive:!0}),e.addEventListener("change",r,{passive:!0});let o={cycles:0,lastTs:Date.now(),phase:"invalid",inputHandler:n,changeHandler:r,el:e};return S.set(t,o),o}function js(e){if(!un(e)||v(e,cn))return;let t=Date.now();dd(t);let n=p(e),r=S.get(n);if(!r){Ys(e,n);return}let o=r.lastTs;r.lastTs=t,r.phase==="edited"?(r.cycles+=1,r.phase="invalid",r.cycles>=wo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:Eo(e)}}),ne(r),S.delete(n))):r.phase==="invalid"&&t-o>500&&(r.cycles+=1,r.cycles>=wo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:n,...h(e)?{el_label:h(e)}:{},cycles:r.cycles,window_ms:Ae,field_type:Eo(e)}}),ne(r),S.delete(n)))}function md(e){if(!un(e))return;let t=Date.now(),n=p(e),r=S.get(n);if(r){if(t-r.lastTs>Ae){ne(r),S.delete(n);return}r.phase==="invalid"&&(r.phase="edited",r.lastTs=t)}}function Ks(e){let t=Date.now(),n=S.get(e);if(n){if(t-n.lastTs>Ae){ne(n),S.delete(e);return}if(n.lastTs=t,_o(n.el)){n.cycles+=1,n.cycles>=wo&&(u({t:"sig",ts:t,d:{s:"form_validation_loop",el:e,...h(n.el)?{el_label:h(n.el)}:{},cycles:n.cycles,window_ms:Ae,field_type:Eo(n.el)}}),ne(n),S.delete(e));return}n.phase==="invalid"&&(n.phase="edited")}}function gd(e){let t=e.target;t&&js(t)}function hd(e){let t=e.target;if(!t||!un(t)||v(t,cn))return;let n=p(t);S.has(n)||_o(t)&&Ys(t,n)}function vd(e){for(let t of e){if(t.type!=="attributes"||t.attributeName!=="aria-invalid")continue;let n=t.target;if(!un(n)||v(n,cn))continue;let r=t.oldValue,o=r==="true"||r==="",i=_o(n);i&&!o?js(n):!i&&o&&md(n)}}var De=null,wt=null,Lo=[],Gs=0,Et=new Map;function Co(e){Lo=e?.length?e:["[data-fd-impression]"],Gs=Date.now(),!(typeof IntersectionObserver>"u")&&(De=new IntersectionObserver(y(Ed),{threshold:[0,.5,1]}),Zs(),wt=new MutationObserver(y(wd)),wt.observe(document.body,{childList:!0,subtree:!0}))}function ko(){De&&(De.disconnect(),De=null),wt&&(wt.disconnect(),wt=null),Et.clear()}function Mo(){Et.clear(),De&&Zs()}function Zs(){for(let e of Lo)try{let t=document.querySelectorAll(e);for(let n=0;n<t.length;n++)To(t[n])}catch{}}function To(e){Et.has(e)||(Et.set(e,{firstSeenTs:0,emitted:!1}),De.observe(e))}function wd(e){for(let t of e)for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];if(r instanceof Element)for(let o of Lo)try{r.matches(o)&&To(r);let i=r.querySelectorAll(o);for(let s=0;s<i.length;s++)To(i[s])}catch{}}}function Ed(e){let t=Date.now();for(let n of e){let r=Et.get(n.target);if(!(!r||r.emitted)&&n.isIntersecting&&n.intersectionRatio>=.5){r.firstSeenTs||(r.firstSeenTs=t),r.emitted=!0;let o=n.boundingClientRect,i=n.rootBounds?.height??window.innerHeight,s=o.top<i*.5?"above_fold":"below_fold",a=p(n.target),c=h(n.target);u({t:"sig",ts:t,d:{s:"element_impression",el:a,...c?{el_label:c}:{},visible_pct:Math.round(n.intersectionRatio*100),time_to_visible_ms:Math.round(t-Gs),viewport_position:s}})}}}var bd=2,yd=3,Sd=6e4,bt=new Map,Qs=[],Js=f(_d);function xo(e){Qs=e??[],document.addEventListener("input",Js,{capture:!0,passive:!0})}function Ao(){document.removeEventListener("input",Js,{capture:!0}),bt.clear()}function Do(){bt.clear()}function _d(e){let t=e.target;if(!t||!Td(t)||v(t,Qs))return;let n=Date.now(),r=t.value??"",o=p(t),i=bt.get(o);if(!i){bt.set(o,{lastValue:r,cycles:0,phase:"typing",lastTs:n});return}if(n-i.lastTs>Sd){i.lastValue=r,i.cycles=0,i.phase="typing",i.lastTs=n;return}i.lastTs=n;let s=i.lastValue.length-r.length;if(i.phase==="typing"&&s>=yd)i.phase="deleted";else if(i.phase==="deleted"&&r.length>i.lastValue.length&&(i.cycles++,i.phase="typing",i.cycles>=bd)){let a=h(t);u({t:"sig",ts:n,d:{s:"input_correction",el:o,...a?{el_label:a}:{},cycles:i.cycles,field_type:Ld(t)}}),bt.delete(o);return}i.lastValue=r}function Td(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Ld(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var ea=2e3,Cd=3e4,$=null,ta=ea,na=[],dn=new Map,ra=f(kd),oa=f(Md),ia=f(yt);function Ro(e,t){ta=e?.dwellMs??ea,na=t??[],document.addEventListener("mouseover",ra,{passive:!0}),document.addEventListener("mouseout",oa,{passive:!0}),document.addEventListener("click",ia,{capture:!0,passive:!0})}function Io(){document.removeEventListener("mouseover",ra),document.removeEventListener("mouseout",oa),document.removeEventListener("click",ia,{capture:!0}),yt(),dn.clear()}function Oo(){yt(),dn.clear()}function kd(e){let t=e.composedPath&&e.composedPath()[0]||e.target;if(!t||v(t,na)||!xd(t))return;let n=p(t);if($?.selector===n)return;yt();let r=Date.now();if(r-(dn.get(n)??0)<Cd)return;let o=r,i=setTimeout(()=>{let s=Date.now(),a=h(t);dn.set(n,s),$=null,u({t:"sig",ts:s,d:{s:"hover_dwell",el:n,...a?{el_label:a}:{},dwell_ms:Math.round(s-o)}})},ta);$={el:t,selector:n,startTs:o,timer:i}}function Md(e){if(!$)return;let t=e.target;if(t!==$.el&&!$.el.contains(t))return;let n=e.relatedTarget;n&&$.el.contains(n)||yt()}function yt(){$&&(clearTimeout($.timer),$=null)}function xd(e){let t=e.tagName;if(/^(A|BUTTON|SELECT)$/.test(t))return!0;let n=e.getAttribute("role")??"";if(/^(button|link|tab|menuitem|option|checkbox|radio)$/.test(n))return!0;try{let r=window.getComputedStyle(e);return r.cursor==="pointer"&&r.pointerEvents!=="none"}catch{return!1}}var Ad=20,Dd=500,Rd=3e3,Id=6e4,fn=0,pn=0,X=null,sa=y(Od);function No(){fn=Date.now(),pn=0,document.addEventListener("mouseleave",sa)}function Po(){document.removeEventListener("mouseleave",sa),X&&(clearTimeout(X),X=null)}function Ho(){fn=Date.now(),pn=0,X&&(clearTimeout(X),X=null)}function Od(e){if(e.clientY>Ad)return;let t=Date.now();t-fn<Rd||t-pn<Id||(X&&clearTimeout(X),X=setTimeout(y(()=>{let n=Date.now();pn=n,X=null,u({t:"sig",ts:n,d:{s:"exit_intent",method:"top_chrome",time_on_page_ms:Math.round(n-fn)}})}),Dd))}var Nd=2500,Pd=4e3,aa=200,Hd=500,Fd=.1,Bd=.25,Ie=null,Oe=null,Q=null,Re=0;function Fo(e,t,n){return e<=t?"good":e<=n?"needs_improvement":"poor"}function Bo(){if(!(typeof PerformanceObserver>"u")){try{Ie=new PerformanceObserver(y(e=>{let t=e.getEntries(),n=t[t.length-1];if(!n)return;let r=Math.round(n.startTime);u({t:"sig",ts:Date.now(),d:{s:"lcp",value_ms:r,rating:Fo(r,Nd,Pd)}})})),Ie.observe({type:"largest-contentful-paint",buffered:!0})}catch{Ie=null}try{Oe=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;if(!n.interactionId)continue;let r=Math.round(n.duration);r<aa||u({t:"sig",ts:Date.now(),d:{s:"slow_interaction",value_ms:r,rating:Fo(r,aa,Hd)}})}})),Oe.observe({type:"event",buffered:!1,durationThreshold:200})}catch{Oe=null}try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!0})}catch{Q=null}}}function la(){if(Q){if(Q.disconnect(),Q=null,Re>0){let e=Math.round(Re*1e3)/1e3;u({t:"sig",ts:Date.now(),d:{s:"cls",value:e,rating:Fo(Re,Fd,Bd)}})}Re=0}}function Wo(){Ie&&(Ie.disconnect(),Ie=null),Oe&&(Oe.disconnect(),Oe=null),la()}function Uo(){if(la(),!(typeof PerformanceObserver>"u"))try{Q=new PerformanceObserver(y(e=>{for(let t of e.getEntries()){let n=t;n.hadRecentInput||(Re+=n.value)}})),Q.observe({type:"layout-shift",buffered:!1})}catch{Q=null}}var ca=[],ua=f(Wd);function Vo(e){ca=e??[],document.addEventListener("paste",ua,{capture:!0,passive:!0})}function qo(){document.removeEventListener("paste",ua,{capture:!0})}function Wd(e){let t=e.target;if(!t||!Ud(t)||v(t,ca))return;let n=t.value??"";setTimeout(()=>{if((t.value??"")!==n)return;let o=p(t),i=h(t);u({t:"sig",ts:Date.now(),d:{s:"paste_blocked",el:o,...i?{el_label:i}:{},field_type:Vd(t)}})},100)}function Ud(e){if(e.tagName==="TEXTAREA")return!0;if(e.tagName==="INPUT"){let t=e.type?.toLowerCase()??"text";return/^(text|email|search|url|tel|number|password)$/.test(t)}return!1}function Vd(e){return e.tagName==="TEXTAREA"?"textarea":e.type?.toLowerCase()||"text"}var qd="https://api.flusterduck.com/v1/ingest",re=!1,mn=null,Ne=null,ue=[],St="__flusterduck_instance__",zo=`fd_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function zd(){let e=window;return e[St]&&e[St]!==zo?(console.warn("[flusterduck] Another SDK instance is already active on this page. Skipping init to avoid double tracking. Load the SDK either via npm or via the script tag, not both."),!1):(e[St]=zo,!0)}function $d(){let e=window;e[St]===zo&&delete e[St]}var _t=[];function Xd(e,t,n){let r=i=>e.signals?.[i]?.enabled!==!1,o=e.trackForms!==!1;return[{when:()=>r("rageClick"),start:()=>Fn(e.signals?.rageClick,t),stop:Bn},{when:()=>r("deadClick"),start:()=>Wn(t),stop:Un,reset:Vn},{when:()=>r("speedFrustration"),start:()=>{let i=e.signals?.speedFrustration;zn(i?{delayMs:i.windowMs}:void 0,t)},stop:$n,reset:Xn},{when:()=>e.trackMouse!==!1&&r("thrashCursor"),start:()=>{let i=e.signals?.thrashCursor;Gn(i?{velocityThreshold:i.threshold,windowMs:i.windowMs}:void 0)},stop:Zn},{when:()=>r("loopNav"),start:()=>er(e.signals?.loopNav),stop:tr},{when:()=>r("scrollBounce"),start:sr,stop:ar,reset:lr},{when:()=>o&&(r("formHesitation")||r("formAbandon")),start:()=>{let i=e.signals?.formHesitation;ur(i?{pauseMs:i.threshold}:void 0,t)},stop:dr,reset:fr},{when:()=>o&&r("formValidationLoop"),start:()=>bo(t),stop:yo,reset:So},{when:()=>r("errorEncounter"),start:gr,stop:hr},{when:()=>"ontouchstart"in window||navigator.maxTouchPoints>0,start:()=>br(t),stop:yr},{when:()=>r("tabThrash")||r("focusTrap")||r("keyboardNavFrustration"),start:()=>_r(t),stop:Tr},{when:()=>r("scrollHijack"),start:kr,stop:Mr,reset:Kt},{when:()=>r("scrollDepthAbandon"),start:xr,stop:Ar,reset:Dr},{when:()=>r("advancedHeuristics"),start:Or,stop:Nr,reset:()=>{rt(),Pr()}},{when:()=>r("helpHunt"),start:()=>Hr(t),stop:Fr,reset:Br},{when:()=>r("closeClick"),start:()=>Wr(t),stop:Ur,reset:Vr},{when:()=>r("closeClickReversal"),start:()=>qr(t),stop:zr,reset:$r},{when:()=>r("filterSpiral"),start:()=>Yr(t),stop:jr,reset:Kr},{when:()=>r("copyFrustration"),start:Gr,stop:Zr,reset:Qr},{when:()=>r("textSelectFrustration"),start:Jr,stop:eo,reset:to},{when:()=>r("deadClickTrapZone"),start:()=>go(t),stop:ho,reset:vo},{when:()=>!0,start:()=>io(n),stop:so},{when:()=>r("navigationConfusion"),start:co,stop:uo,reset:fo},{when:()=>r("scrollToClickConfusion"),start:po,stop:mo,reset:an},{when:()=>r("elementImpression"),start:()=>Co(e.elementImpressionSelectors),stop:ko,reset:Mo},{when:()=>o&&r("inputCorrection"),start:()=>xo(t),stop:Ao,reset:Do},{when:()=>o&&r("pasteBlocked"),start:()=>Vo(t),stop:qo},{when:()=>r("hoverDwell"),start:()=>{let i=e.signals?.hoverDwell;Ro(i?.threshold?{dwellMs:i.threshold}:void 0,t)},stop:Io,reset:Oo},{when:()=>r("exitIntent"),start:No,stop:Po,reset:Ho},{when:()=>r("performanceVitals"),start:Bo,stop:Wo,reset:Uo}]}function Yd(e){if(e)try{let t=new URL(e),n=t.protocol==="http:"&&/^(localhost|127\.0\.0\.1|\[::1\])$/.test(t.hostname);return t.protocol!=="https:"&&!n?void 0:t.origin+t.pathname}catch{return}}function $o(e){if(re||!e.key)return;if(e.key.startsWith("fd_sec_")){console.error("[flusterduck] Secret key detected in browser. Use a publishable key (fd_pub_) instead. Aborting.");return}if(!e.key.startsWith("fd_pub_"))return;if(e.respectDoNotTrack!==!1&&Kd()){Ne=e;return}if(e.sampleRate!==void 0&&e.sampleRate<1&&Math.random()>e.sampleRate){Ne=e;return}if(!zd()){Ne=e;return}Ne=e,re=!0,In(e.transport!=="none"),typeof e.onSignal=="function"&&ue.push(fe(e.onSignal)),e.emitSignalEvents&&ue.push(fe(jd));let t=ei(e.cookieless??!1),n=Yd(e.endpoint)??qd,r=Hn(location.pathname,e.pageRules??[]),o=Gd(e.domMode);di(n,{sid:t,key:e.key,url:location.origin+location.pathname,page:r,ua:navigator.userAgent.slice(0,200),vw:window.innerWidth,vh:window.innerHeight,segment:e.segment,environment:e.environment},e.batchInterval,e.batchMaxSize,{domMode:o,compression:e.compression});let i=da(location.pathname,e.ignorePages??[]);i&&Nn(!0);let s=document.referrer,a="";if(s)try{a=new URL(s).origin+new URL(s).pathname}catch{a=""}i||u({t:"pv",ts:Date.now(),d:{ref:a}});let c=e.ignoreElements??[];_t=[];for(let d of Xd(e,c,r))d.when()&&(d.start(),_t.push({stop:d.stop,reset:d.reset}));mn=pi(y((d,l)=>{for(let E of _t)E.reset?.();J(),dt(l),oo(l);let g=Hn(l,e.pageRules??[]),w=da(l,e.ignorePages??[]);Nn(w),Pn({page:g,url:d}),nr(l),w||u({t:"pv",ts:Date.now(),d:{ref:""}})})),e.debug&&console.warn("[flusterduck] initialized",{sid:t.slice(0,6)+"...",endpoint:n,page:r})}function fa(e,t){if(!re||typeof e!="string"||!e||e.length>128)return;let n;try{let o=t?.metadata??{};n=JSON.stringify(o)}catch{return}if(n.length>2048)return;let r=JSON.parse(n);u({t:"sig",ts:Date.now(),d:{s:e.slice(0,128),el:typeof t?.element=="string"?t.element.slice(0,256):"",meta:r,w:Math.max(0,Math.min(t?.weight??15,100))}})}function pa(e,t={}){if(!re||typeof e!="string"||!/^[a-z0-9_.-]{1,120}$/i.test(e))return;let n;try{n=JSON.stringify(t??{})}catch{return}n.length>2048||u({t:"custom_signal",ts:Date.now(),d:{business_event:e.slice(0,120),meta:JSON.parse(n)}})}function ma(e){if(!re||!e||typeof e!="object")return;let t=Object.create(null),n=0;for(let r of Object.keys(e)){if(n>=20)break;if(r==="__proto__"||r==="constructor"||r==="prototype")continue;let o=e[r];typeof o!="string"&&typeof o!="number"&&typeof o!="boolean"||(t[r.slice(0,64)]=String(o).slice(0,256),n++)}Pn({segment:t})}function ga(e){e&&Ne&&!re?$o(Ne):e||(gn(),Ln())}function ha(){gn(),Ln()}function va(e){let t=fe(e);return ue.push(t),()=>{t(),ue=ue.filter(n=>n!==t)}}function jd(e){if(!(typeof window>"u"||typeof CustomEvent>"u"))try{window.dispatchEvent(new CustomEvent("flusterduck:signal",{detail:e}))}catch{}}function gn(){if(re){for(let e of ue)e();ue=[],In(!0);for(let e of _t)e.stop();_t=[],fi(),mn&&(mn(),mn=null),$d(),re=!1}}function Kd(){return!!(navigator.doNotTrack==="1"||navigator.globalPrivacyControl)}function Gd(e){return e==="metadata"||e==="snapshot"?e:"off"}function da(e,t){for(let n of t)if(n){if(n.endsWith("*")){if(e.startsWith(n.slice(0,-1)))return!0}else if(n.startsWith("*")){if(e.endsWith(n.slice(1)))return!0}else if(e===n)return!0}return!1}var ya=.1,Sa=.01,_a=3e4,Ta=50,La=1e4,Zd=500,Qd=3e4,Jd=6e4,wa=10,ef=new Set(["$rageclick","$dead_click","$exception","$identify","$create_alias","$groupidentify","$survey_sent","$survey_dismissed","$feature_flag_called"]),tf=/(sign(ed)?[\s_-]?up|check(ed)?[\s_-]?out|purchase|subscri|payment|paid|upgrade|convert|trial|onboard.*complete|order[\s_-]?(placed|completed))/i,nf=/^\$\$?(heatmap|scroll)/,Ca=["rage_click","rage_click_repeat_target","dead_click","error_encounter","form_validation_loop","thrash_cursor"],En=!1,hn=null,vn=null,Tt=null,H=null,wn=null,ka=ya,Ma=Sa,xa=new Set,Aa=new Set(Ca),Da=_a,jo=Ta,Ra=La,R=[],bn=0,F=[];function Ea(e,t){return e===void 0||Number.isNaN(e)?t:Math.max(0,Math.min(e,1))}function Ia(e){En||(En=!0,ka=Ea(e?.baselineSampleRate,ya),Ma=Ea(e?.scrollSampleRate,Sa),xa=new Set(e?.conversionEvents??[]),Aa=new Set(e?.criticalSignals?.length?e.criticalSignals:Ca),Da=e?.bufferWindowMs&&e.bufferWindowMs>0?e.bufferWindowMs:_a,jo=e?.bufferMaxEvents&&e.bufferMaxEvents>0?e.bufferMaxEvents:Ta,Ra=e?.boostWindowMs&&e.boostWindowMs>0?e.boostWindowMs:La,R=[],bn=0,F=[],vn=fe(uf),ba()||(hn=setInterval(()=>{ba()&&Ko()},Zd),setTimeout(()=>Ko(),Qd)))}function Oa(){En&&(En=!1,Ko(),vn&&(vn(),vn=null),Tt&&wn&&Tt.capture.__fd_wrapped&&(Tt.capture=wn),Tt=null,H=null,wn=null,R=[],F=[],bn=0)}function Ko(){hn&&(clearInterval(hn),hn=null)}function ba(){try{let e=window.posthog;if(!e||typeof e.capture!="function"||e.__loaded!==!0)return!1;if(e.capture.__fd_wrapped)return!0;wn=e.capture,H=e.capture.bind(e);let n=(r,o,i)=>{try{return of(r,o,i)}catch{return H?H(r,o,i):void 0}};return n.__fd_wrapped=!0,e.capture=n,Tt=e,!0}catch{return!1}}function rf(e){return ef.has(e)?"critical":xa.has(e)||tf.test(e)?"conversion":nf.test(e)?"scroll":"baseline"}function of(e,t,n){if(!H)return;if(typeof e!="string"||!e)return H(e,t,n);let r=Date.now(),o=rf(e);if(o==="critical"||o==="conversion")return H(e,Yo(t,r),n);if(r<bn)return H(e,{...Yo(t,r),fd_boosted:!0},n);if(sf(o==="scroll"?Ma:ka))return H(e,Yo(t,r),n);cf({name:e,properties:t,ts:r})}function sf(e){if(e>=1)return!0;if(e<=0)return!1;let t=af();return t?lf(t)%1e4/1e4<e:Math.random()<e}var Xo="";function af(){try{let e=window.posthog;if(e?.get_distinct_id){let t=e.get_distinct_id();if(typeof t=="string"&&t)return t}}catch{}return Xo||(Xo=Math.random().toString(36).slice(2)),Xo}function lf(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Yo(e,t){return Pa(t),F.length?{...e,fd_recent_signals:F.map(n=>n.name),fd_signal_count:F.length}:e??{}}function cf(e){R.push(e),Na(e.ts)}function Na(e){let t=e-Da;for(;R.length&&R[0].ts<t;)R.shift();R.length>jo&&(R=R.slice(-jo))}function Pa(e){let t=e-Jd;F=F.filter(n=>n.ts>=t),F.length>wa&&(F=F.slice(-wa))}function uf({name:e,ts:t}){if(F.push({name:e,ts:t}),Pa(t),!Aa.has(e)||(bn=t+Ra,!H||!R.length))return;Na(t);let n=R;R=[];for(let r of n)try{H(r.name,{...r.properties,fd_recovered:!0,fd_recovered_reason:e,fd_original_ts:r.ts},{timestamp:new Date(r.ts)})}catch{}}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { init, signal, track, identify, setConsent, optOut, destroy } from './core';
|
|
1
|
+
export { init, signal, track, identify, setConsent, optOut, destroy, onSignal } from './core';
|
|
2
2
|
export { initPostHogTrigger, destroyPostHogTrigger } from './posthog-trigger';
|
|
3
3
|
export type { PostHogTriggerOptions } from './posthog-trigger';
|
|
4
|
-
export type { Config, SDKEvent, SnapshotData } from './types';
|
|
4
|
+
export type { Config, SDKEvent, SnapshotData, EmittedSignal } from './types';
|