flusterduck 0.3.0 → 0.5.0

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