import{U as h}from"./index-DFVuS8SP.js";import{r as c}from"./vendor-react-DgEFbQIi.js";const g='button, [role="button"], [data-analytics-ignore]';function M(t,e){try{const r=e==null?void 0:e.target;if(r instanceof Element&&r.closest(g))return;h("search_result_clicked",{listingId:t.listingId,position:t.position,source:t.source,...t.category?{category:t.category}:{},...t.searchQuery?{searchQuery:t.searchQuery}:{}})}catch{}}const f=.04,a=.35,p=.03;function E(t){return f*a**t}function m(t){return t===0?0:f/2*(1+a)*(1-a**t)/(1-a)*100}function C(t,e,r=!1,n="row"){if(r||t===null)return{};const s=e-t,o=Math.abs(s);if(n==="grid")return o!==0?{}:{transform:`scale(${1+p})`,zIndex:10,position:"relative"};const i=1+E(o);return{transform:`translateX(${Math.sign(s)*m(o)}%) scale(${i})`,zIndex:Math.max(1,Math.round(10-o)),position:"relative"}}function d(t){const[e,r]=c.useState(!1);return c.useEffect(()=>{const n=window.matchMedia(t);r(n.matches);const s=()=>r(n.matches);return n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[t]),e}function v(t="row"){const[e,r]=c.useState(null),n=d("(prefers-reduced-motion: reduce)"),s=d("(hover: hover) and (pointer: fine)"),o=n||!s,i=c.useCallback(u=>r(u),[]),l=c.useCallback(u=>C(e,u,o,t),[e,o,t]);return{onItemHover:i,getStyle:l}}export{M as t,v as u};