PageSourceSearch

https://agenticcommerce.web.app/assets/useSwipeDismiss-CWTLEQMg.js

js agenticcommerce.web.app collected 2026-10-03 12:16:11 UTC 10,967 bytes, 1 lines download raw bytes

1import{r as c}from"./chunk-UVKPFVEO-D2TLaFU0.js";import{a as Fe,d as Ze,e as et,f as mt,c as O,g as pt}from"./button-Df6fUqzT.js";import{o as _e,c as je,g as Je}from"./createBaseUIEventDetails-DcZQVu7k.js";function He(r,f,l=!1){const a=mt(r);if(f==="vertical"){const P=a.overflowY;return P!=="auto"&&P!=="scroll"?!1:l?r.clientHeight>0:r.scrollHeight>r.clientHeight}const o=a.overflowX;return o!=="auto"&&o!=="scroll"?!1:l?r.clientWidth>0:r.scrollWidth>r.clientWidth}function yt(r,f,l){let a=r;for(;Fe(a)&&a!==f&&!Ze(a);){for(const o of l)if(He(a,o))return!0;a=et(a)}return!1}function Ee(r,f,l="vertical",a=!1){let o=Fe(r)?r:null;for(;Fe(o)&&o!==f&&!Ze(o);){if(He(o,l,a))return o;o=et(o)}return He(f,l,a)?f:null}function gt(r,f=Number.MIN_SAFE_INTEGER,l=Number.MAX_SAFE_INTEGER){return Math.max(f,Math.min(r,l))}function xt(r,f,l){return typeof(r==null?void 0:r.elementFromPoint)=="function"?r.elementFromPoint(f,l):null}const St=40,wt=10,Rt=1,Dt=50,Ke=16,bt=80,Et='button,a,input,select,textarea,label,[role="button"]';function Ie(r,f,l){switch(r){case"up":return-l;case"down":return l;case"left":return-f;case"right":return f;default:return 0}}function Tt(r){const l=pt(r).getComputedStyle(r).transform;let a=0,o=0,P=1;if(l&&l!=="none"){const ae=l.match(/matrix(?:3d)?\(([^)]+)\)/);if(ae){const w=ae[1].split(", ").map(parseFloat);w.length===6?(a=w[4],o=w[5],P=Math.sqrt(w[0]*w[0]+w[1]*w[1])):w.length===16&&(a=w[12],o=w[13],P=w[0])}}return{x:a,y:o,scale:P}}function Te(r){return Number.isFinite(r)&&r>0?r:null}function Qe(r,f){return`translate3d(${r.x}px,${r.y}px,0) scale(${f})`}function Pt(r){return r%2===1}function Ne(r,f,l){const a=r[l];if(typeof a=="function")try{a.call(r,f)}catch(o){if(o&&typeof o=="object"&&"name"in o&&o.name==="NotFoundError")return;throw o}}function Yt(r){const{enabled:f,directions:l,elementRef:a,movementCssVars:o,canStart:P,ignoreSelectorWhenTouch:ae=!0,ignoreScrollableAncestors:w=!1,swipeThreshold:$,onDismiss:Pe,onProgress:Me,onCancel:Ae,onSwipeStart:ve,onRelease:Ye,onSwipingChange:Xe,trackDrag:tt=!0}=r,nt=Et,Z=l.length===1?l[0]:void 0,B=Math.max(0,typeof $=="number"?$:St),ee=l.includes("left"),te=l.includes("right"),ne=l.includes("up"),re=l.includes("down"),Y=ee||te,X=ne||re,ke=c.useMemo(()=>{const e=[];return X&&e.push("vertical"),Y&&e.push("horizontal"),e},[Y,X]),[rt,k]=c.useState(void 0),[G,ct]=c.useState(!1),[Ce,Ve]=c.useState(!1),q=c.useRef({x:0,y:0}),_=c.useRef({x:0,y:0}),j=c.useRef(null),R=c.useRef({x:0,y:0,scale:1}),C=c.useRef(void 0),fe=c.useRef(0),ce=c.useRef(!1),D=c.useRef({x:0,y:0}),J=c.useRef(null),se=c.useRef(!1),de=c.useRef(!1),he=c.useRef(null),V=c.useRef(!1),K=c.useRef(!1),me=c.useRef({width:0,height:0}),ze=c.useRef(0),I=c.useRef(B),oe=c.useRef(null),pe=c.useRef(null),ye=c.useRef({x:0,y:0}),ge=c.useRef(null),Q=c.useRef(!1),xe=c.useRef(null),ie=O(e=>{Q.current!==e&&(Q.current=e,ct(e),Xe==null||Xe(e))});function Ue(e){if(!e)return;if(typeof $!="function"){I.current=B;return}const t=a.current;if(!t)return;const n=$({element:t,direction:e});I.current=Math.max(0,n)}const M=O((e,t)=>{const n=Number.isFinite(e)?gt(e,0,1):0,s=n!==ze.current;let i=!1;if(t){const d=ge.current;i=!d||d.deltaX!==t.deltaX||d.deltaY!==t.deltaY||d.direction!==t.direction}!s&&!i||(ze.current=n,t?ge.current=t:s&&(ge.current=null),Me==null||Me(n,t))}),N=O(e=>{const t=a.current;if(!tt||!t){e||(xe.current=null);return}const n=t.style,s=xe.current;e?(s||(xe.current=[n.transition,n.transform]),n.transition="none"):s&&([n.transition,n.transform]=s,xe.current=null);const i=_.current,d=R.current,u=i.x-d.x,p=i.y-d.y;e&&(n.transform=Qe(i,d.scale)),n.setProperty(o.x,`${u}px`),n.setProperty(o.y,`${p}px`)});function We(e,t){if(t===null)return;const n=pe.current;if(n&&t>n.time){const s=Math.max(t-n.time,Ke);ye.current={x:(e.x-n.x)/s,y:(e.y-n.y)/s}}pe.current={x:e.x,y:e.y,time:t}}const st=c.useCallback(()=>{k(void 0),ie(!1),Ve(!1),M(0),I.current=B,q.current={x:0,y:0},_.current={x:0,y:0},R.current={x:0,y:0,scale:1},C.current=void 0,fe.current=0,ce.current=!1,D.current={x:0,y:0},J.current=null,se.current=!1,j.current=null,de.current=!1,he.current=null,V.current=!1,K.current=!1,me.current={width:0,height:0},oe.current=null,pe.current=null,ye.current={x:0,y:0},ge.current=null,N(!1)},[ie,B,N,M]);c.useEffect(()=>{typeof $!="function"&&(I.current=B)},[B,$]);function Oe(e){if("touches"in e){const t=e.touches[0];return t?{x:t.clientX,y:t.clientY}:null}return{x:e.clientX,y:e.clientY}}function Se(e){return"touches"in e?!0:e.pointerType==="touch"}function $e(e,t){const n=_e(a.current);return xt(n,e.x,e.y)??Je(t)}function Le(e,t){return Y&&!X?Ee(e,t,"horizontal"):X&&!Y?Ee(e,t,"vertical"):Ee(e,t,"vertical")??Ee(e,t,"horizontal")}function Be(e,t,n){V.current=!1;const s=Se(e),i=$e(t,e.nativeEvent),u=_e(a.current).body,p=s&&u?Le(i,u):null,h=(n==null?void 0:n.ignoreScrollableTarget)??!1;if(p&&!h||(V.current=!!(p&&h),(i?i.closest(nt):!1)&&(!s||ae)))return!1;const g=a.current;if(w&&g&&i&&ke.length>0&&!((n==null?void 0:n.ignoreScrollableAncestors)??!1)&&yt(i,g,ke))return!1;if(ce.current=!1,C.current=void 0,fe.current=0,q.current=t,oe.current=Te(e.timeStamp),D.current=t,j.current=t,g){me.current={width:g.offsetWidth,height:g.offsetHeight},Ue(Z);const S=Tt(g);R.current=S,_.current={x:S.x,y:S.y},We({x:S.x,y:S.y},oe.current),"touches"in e||Ne(g,e.pointerId,"setPointerCapture")}return ve==null||ve(e.nativeEvent),ie(!0),J.current=null,se.current=!0,M(0),N(!0),!0}function we(){Re(),V.current=!1,j.current=null}function Re(){de.current=!1,he.current=null}function ot(e){if(we(),!Q.current)return;ie(!1),J.current=null;const t=R.current;_.current={x:t.x,y:t.y},k(void 0),K.current=!1,N(!1);const n=a.current;n&&Ne(n,e.pointerId,"releasePointerCapture"),M(0,{deltaX:0,deltaY:0,direction:void 0}),Ae==null||Ae(e.nativeEvent)}function it(e,t){const n=u=>u>=0?u**.5:-(Math.abs(u)**.5),s=(u,p,h)=>!p&&u<0||!h&&u>0?n(u):u,i=Y?s(e,ee,te):n(e),d=X?s(t,ne,re):n(t);return{x:i,y:d}}function ut(e,t,n){const s=Math.abs(t),i=Math.abs(n);if(X&&n!==0&&(!Y||i>=s)){const p=Math.max(0,e.scrollHeight-e.clientHeight),h=e.scrollTop<=0,y=e.scrollTop>=p,g=n>0,S=n<0;return g&&h&&re||S&&y&&ne}if(Y&&t!==0&&(!X||s>i)){const p=Math.max(0,e.scrollWidth-e.clientWidth),h=e.scrollLeft<=0,y=e.scrollLeft>=p,g=t>0,S=t<0;return g&&h&&te||S&&y&&ee}return null}const De=O(e=>{if(!f||e.defaultPrevented||e.nativeEvent.defaultPrevented||!("touches"in e)&&e.button!==0)return;const t=Oe(e);!t||(de.current=!0,he.current=t,V.current=!1,K.current=!1,!(P?P(t,{nativeEvent:e.nativeEvent,direction:Z}):!0))||Be(e,t)&&Re()});function lt(e,t,n){if(!f||!Q.current)return;const s=Je(e.nativeEvent);if(Se(e)&&!V.current){const v=e.currentTarget;if(Le(s,v))return}if("touches"in e||e.preventDefault(),se.current){q.current=t;const v=Te(e.timeStamp);v!==null&&(oe.current=v),se.current=!1}const i=t.x,d=t.y,u=n.x,p=n.y;(p<0&&d>D.current.y||p>0&&d<D.current.y)&&(D.current={x:D.current.x,y:d}),(u<0&&i>D.current.x||u>0&&i<D.current.x)&&(D.current={x:i,y:D.current.y});const h=i-q.current.x,y=d-q.current.y,g=d-D.current.y,S=i-D.current.x;let x=J.current;x===null&&Y&&X&&Math.sqrt(h*h+y*y)>=Rt&&(x=Math.abs(h)>Math.abs(y)?"horizontal":"vertical",J.current=x);let m;if(!C.current)x==="vertical"?y>0?m="down":y<0&&(m="up"):x==="horizontal"?h>0?m="right":h<0&&(m="left"):Math.abs(h)>=Math.abs(y)?m=h>0?"right":"left":m=y>0?"down":"up",m&&(m==="left"&&ee||m==="right"&&te||m==="up"&&ne||m==="down"&&re)&&(C.current=m,fe.current=Ie(m,h,y),k(m),Ue(m));else{const v=C.current,be=Ie(v,S,g);be>I.current?(ce.current=!1,k(v)):!(ee&&te)&&!(ne&&re)&&fe.current-be>=wt&&(ce.current=!0)}const H=it(h,y);let E=R.current.x,b=R.current.y;x==="horizontal"?Y&&(E+=H.x):(x==="vertical"||Y&&(E+=H.x),X&&(b+=H.y)),_.current={x:E,y:b},N(!0),We({x:E,y:b},Te(e.timeStamp));const L=E-R.current.x,z=b-R.current.y,U=C.current,T=Z??C.current;if(!T){M(0,{deltaX:L,deltaY:z,direction:U});return}const A=T==="left"||T==="right"?me.current.width:me.current.height,W=R.current.scale||1;if(A<=0||W<=0){M(0,{deltaX:L,deltaY:z,direction:U});return}const le=Ie(T,E-R.current.x,b-R.current.y);if(le<=0){M(0,{deltaX:L,deltaY:z,direction:U});return}M(le/(A*W),{deltaX:L,deltaY:z,direction:U})}const F=O(e=>{if(!f)return;const t=_.current,n=R.current,s=t.x-n.x,i=t.y-n.y,d={deltaX:s,deltaY:i,direction:C.current};if(!Q.current){we(),M(0,d);return}ie(!1),J.current=null,we(),K.current=!1;const u=a.current;u&&("touches"in e||Ne(u,e.pointerId,"releasePointerCapture"));const p=s,h=i,y=oe.current,g=Te(e.timeStamp),S=y!==null&&g!==null&&g>y?g-y:0,x=S>0?Math.max(S,Dt):0,m=x>0?p/x:0,H=x>0?h/x:0;let E=ye.current.x,b=ye.current.y;const L=pe.current;if(L&&g!==null&&g>=L.time){const W=g-L.time;if(W<=bt){const le=Math.max(W,Ke),v=t.x-L.x,be=t.y-L.y,Ge=v/le,qe=be/le;Ge!==0&&(E=Ge),qe!==0&&(b=qe)}else E=0,b=0}const z=Ye==null?void 0:Ye({event:e.nativeEvent,direction:C.current,deltaX:p,deltaY:h,velocityX:m,velocityY:H,releaseVelocityX:E,releaseVelocityY:b}),U=typeof z=="boolean";if(ce.current&&!U){_.current={x:n.x,y:n.y},k(void 0),N(!1),M(0,d);return}let T=!1,A;if(U)T=z,A=C.current??Z;else for(const W of l){switch(W){case"right":p>I.current&&(T=!0,A="right");break;case"left":p<-I.current&&(T=!0,A="left");break;case"down":h>I.current&&(T=!0,A="down");break;case"up":h<-I.current&&(T=!0,A="up");break}if(T)break}T&&A?(k(A),Ve(!0),N(!1),Pe==null||Pe(e.nativeEvent,{direction:A})):(_.current={x:n.x,y:n.y},k(void 0),N(!1),M(0,d))}),ue=O(e=>{const t=Oe(e);if(!t)return;let n=!1;if(!("touches"in e)){const d=Pt(e.buttons);if(d&&(K.current=!0),e.buttons!==0&&!d){ot(e);return}if(e.buttons===0&&K.current){if(!Q.current){F(e);return}n=!0}}if(!G&&de.current){if(!Se(e)&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)){we();return}if(P?P(t,{nativeEvent:e.nativeEvent,direction:Z}):!0){const u=he.current;let p=!1;if(Se(e)){const y=a.current;if(u&&y){const g=$e(t,e.nativeEvent),x=_e(y).body,m=x?Le(g,x):null;if(m&&(je(y,m)||je(m,y))){const H=t.x-u.x,E=t.y-u.y,b=ut(m,H,E);if(b===!1)return;b===!0&&(p=!0)}}}Be(e,t,{ignoreScrollableTarget:p,ignoreScrollableAncestors:p})&&(u&&p?(Re(),q.current=u,D.current=u,j.current=u,se.current=!1):(Re(),V.current=!1))}}const s=j.current,i=s===null?{x:0,y:0}:{x:t.x-s.x,y:t.y-s.y};j.current=t,lt(e,t,i),n&&!("touches"in e)&&F(e)}),at=O((e,t)=>{ue({touches:e.touches,currentTarget:t,nativeEvent:e,defaultPrevented:e.defaultPrevented,timeStamp:e.timeStamp})}),ft=c.useCallback(()=>{const e=_.current,t=R.current,n=e.x-t.x,s=e.y-t.y;return!G&&n===0&&s===0&&!Ce?{[o.x]:"0px",[o.y]:"0px"}:{transition:G?"none":void 0,transform:G?Qe(e,t.scale):void 0,[o.x]:`${n}px`,[o.y]:`${s}px`}},[Ce,G,o]),dt=c.useCallback(()=>f?{onPointerDown:De,onPointerMove:ue,onPointerUp:F,onPointerCancel:F}:{},[f,F,ue,De]),ht=c.useCallback(()=>f?{onTouchStart:De,onTouchMove:ue,onTouchEnd:F,onTouchCancel:F}:{},[f,F,ue,De]);return{swiping:G,swipeDirection:rt,dragDismissed:Ce,getPointerProps:dt,getTouchProps:ht,moveNative:at,getDragStyles:ft,reset:st}}export{Tt as a,xt as b,gt as c,Ee as f,Ie as g,Yt as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.