gesturx 2.0.0 → 2.1.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.d.ts +8 -8
- package/dist/index.js +47 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare interface HoldRecognizerInterface extends Recognizer<HoldRecognizerOptio
|
|
|
22
22
|
update(options: RecognizerConfig<HoldRecognizerOptions>): void;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
declare interface HoldRecognizerOptions {
|
|
25
|
+
export declare interface HoldRecognizerOptions {
|
|
26
26
|
posThreshold?: number;
|
|
27
27
|
delay?: number;
|
|
28
28
|
numInputs?: number;
|
|
@@ -55,7 +55,7 @@ declare interface PanRecognizerInterface extends Recognizer<PanRecognizerOptions
|
|
|
55
55
|
update(options: RecognizerConfig<PanRecognizerOptions>): void;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
declare interface PanRecognizerOptions {
|
|
58
|
+
export declare interface PanRecognizerOptions {
|
|
59
59
|
/**
|
|
60
60
|
* @default 15
|
|
61
61
|
*/
|
|
@@ -99,7 +99,7 @@ declare interface PinchRecognizerInterface extends Recognizer<PinchRecognizerOpt
|
|
|
99
99
|
update(options: RecognizerConfig<PinchRecognizerOptions>): void;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
declare interface PinchRecognizerOptions {
|
|
102
|
+
export declare interface PinchRecognizerOptions {
|
|
103
103
|
posThreshold?: number;
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -156,7 +156,7 @@ declare type RecognizableOptions<T extends Recognizer<any, any>[]> = {
|
|
|
156
156
|
disableTextSelection?: boolean;
|
|
157
157
|
} & RecognizerConfig<unknown>;
|
|
158
158
|
|
|
159
|
-
declare type RecognizableState = {
|
|
159
|
+
export declare type RecognizableState = {
|
|
160
160
|
/**
|
|
161
161
|
* Number of maximum simultaneous fingers currently registered
|
|
162
162
|
* by all recognizers.
|
|
@@ -212,7 +212,7 @@ export declare type RecognizerConfig<Options> = {
|
|
|
212
212
|
failWith?: FailWith[];
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
-
declare interface RecognizerEvent {
|
|
215
|
+
export declare interface RecognizerEvent {
|
|
216
216
|
center: {
|
|
217
217
|
x: number;
|
|
218
218
|
y: number;
|
|
@@ -282,7 +282,7 @@ declare interface RotateRecognizerInterface extends Recognizer<RotateRecognizerO
|
|
|
282
282
|
update(options: RecognizerConfig<RotateRecognizerOptions>): void;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
declare interface RotateRecognizerOptions {
|
|
285
|
+
export declare interface RotateRecognizerOptions {
|
|
286
286
|
/**
|
|
287
287
|
* @default 15
|
|
288
288
|
*/
|
|
@@ -330,7 +330,7 @@ declare interface SwipeRecognizerInterface extends Recognizer<SwipeRecognizerOpt
|
|
|
330
330
|
update(options: RecognizerConfig<SwipeRecognizerOptions>): void;
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
declare interface SwipeRecognizerOptions {
|
|
333
|
+
export declare interface SwipeRecognizerOptions {
|
|
334
334
|
/**
|
|
335
335
|
* The minimum velocity (px/ms) that the gesture has to obtain by the end event.
|
|
336
336
|
*
|
|
@@ -355,7 +355,7 @@ declare interface TapRecognizerInterface extends Recognizer<TapRecognizerOptions
|
|
|
355
355
|
update(options: RecognizerConfig<TapRecognizerOptions>): void;
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
declare interface TapRecognizerOptions {
|
|
358
|
+
export declare interface TapRecognizerOptions {
|
|
359
359
|
/**
|
|
360
360
|
* Introduce a delay before recognizing a tap. This can be used to register more taps.
|
|
361
361
|
*
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,10 @@ function k(e, t) {
|
|
|
11
11
|
let n = t.x - e.x, r = t.y - e.y;
|
|
12
12
|
return Math.atan2(r, n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function te(e, t) {
|
|
15
15
|
return k(e, t) * (180 / Math.PI);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function A(e) {
|
|
18
18
|
let t = e.reduce((e, t) => (e.x += t.x, e.y += t.y, e), {
|
|
19
19
|
x: 0,
|
|
20
20
|
y: 0
|
|
@@ -24,9 +24,9 @@ function j(e) {
|
|
|
24
24
|
y: t.y / n
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function j(e, t) {
|
|
28
28
|
if (e.length !== t.length) throw Error("Initial and new points arrays must have the same length.");
|
|
29
|
-
let n =
|
|
29
|
+
let n = A(e), r = A(t), i = 0;
|
|
30
30
|
e.forEach((e, a) => {
|
|
31
31
|
let o = k(n, e), s = k(r, t[a] ?? e) - o;
|
|
32
32
|
s > Math.PI ? s -= 2 * Math.PI : s < -Math.PI && (s += 2 * Math.PI), i += s;
|
|
@@ -39,24 +39,24 @@ function M(e, t) {
|
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/core/utils/utils.ts
|
|
42
|
-
function
|
|
42
|
+
function M(e) {
|
|
43
43
|
return e != null;
|
|
44
44
|
}
|
|
45
|
-
var P = (e) => e.length > 0, F = (e) => e.pipe(c(P));
|
|
45
|
+
var N = (e) => Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e !== void 0 && !Number.isNaN(e))), P = (e) => e.length > 0, F = (e) => e.pipe(c(P));
|
|
46
46
|
function I(e, t, n) {
|
|
47
|
-
let r =
|
|
47
|
+
let r = A([e]), i = A([t]);
|
|
48
48
|
return Math.abs(i.x - r.x) >= n || Math.abs(i.y - r.y) >= n;
|
|
49
49
|
}
|
|
50
|
-
var
|
|
50
|
+
var ne = (e, t, n) => ({
|
|
51
51
|
velocityX: e > 0 ? t / e : 0,
|
|
52
52
|
velocityY: e > 0 ? n / e : 0
|
|
53
53
|
});
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/core/utils/events.ts
|
|
56
|
-
function
|
|
56
|
+
function L(e) {
|
|
57
57
|
return (t) => t.pipe(c((t) => t.pointerId === e.pointerId));
|
|
58
58
|
}
|
|
59
|
-
var
|
|
59
|
+
var R = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type === "pointerup", re = (e) => e.button === 0, z = ({ container: e, afterEventReceived: t = (e) => e }) => d(e, "pointerdown").pipe(p(t), c(re)), B = ({ pointerEvent$: e }) => (t) => {
|
|
60
60
|
let n = e.pipe(c((e) => e.type === "pointerup")), r = e.pipe(c((e) => e.type === "pointerleave")), i = e.pipe(c((e) => e.type === "pointercancel")), o = e.pipe(c((e) => e.type === "pointermove")), s = d(window, "contextmenu"), l = (e) => [
|
|
61
61
|
"pointercancel",
|
|
62
62
|
"pointerleave",
|
|
@@ -65,7 +65,7 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
65
65
|
].includes(e.type);
|
|
66
66
|
return t.pipe(h((e) => {
|
|
67
67
|
let t = a(() => g(e));
|
|
68
|
-
return m(t, m(o, i, r, n, s)).pipe(
|
|
68
|
+
return m(t, m(o, i, r, n, s)).pipe(L(e), C((e) => !l(e), !0));
|
|
69
69
|
}), _((e, t) => {
|
|
70
70
|
if (l(t)) {
|
|
71
71
|
let { [t.pointerId]: n, ...r } = (e == null ? void 0 : e.pointers) ?? {};
|
|
@@ -83,16 +83,16 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
83
83
|
};
|
|
84
84
|
}, void 0), p(({ event: e, pointers: t }) => ({
|
|
85
85
|
event: e,
|
|
86
|
-
pointers: Object.values(t).filter(
|
|
86
|
+
pointers: Object.values(t).filter(M)
|
|
87
87
|
})));
|
|
88
88
|
}, V = () => y({
|
|
89
89
|
bufferSize: 1,
|
|
90
90
|
refCount: !0
|
|
91
|
-
}), H = (e) => e.pipe(c((e) => !!e.container)), U = (e) => e.pipe(c(
|
|
91
|
+
}), H = (e) => e.pipe(c((e) => !!e.container)), U = (e) => e.pipe(c(R)), W = (e, t, n, r) => ({
|
|
92
92
|
deltaX: e.x - t.x + n,
|
|
93
93
|
deltaY: e.y - t.y + r
|
|
94
94
|
}), G = (e) => {
|
|
95
|
-
let t = (e) =>
|
|
95
|
+
let t = (e) => A(e.latestActivePointers.length ? e.latestActivePointers : [e.event]);
|
|
96
96
|
return e.pipe(_((e, n) => {
|
|
97
97
|
var r, i;
|
|
98
98
|
let a = t(n), o = (e == null ? void 0 : e.center) ?? a, s = (e == null ? void 0 : e.deltaX) ?? 0, c = (e == null ? void 0 : e.deltaY) ?? 0, l = (e == null || (r = e.latestActivePointers) == null ? void 0 : r.length) ?? 1, u = ((i = n.latestActivePointers) == null ? void 0 : i.length) ?? 1, { deltaX: d, deltaY: f } = [
|
|
@@ -100,7 +100,7 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
100
100
|
"pointercancel",
|
|
101
101
|
"pointerleave",
|
|
102
102
|
"pointerup"
|
|
103
|
-
].includes(n.event.type) && l !== u && u > 0 || n.event.type === "pointercancel" ? W(a, a, s, c) : W(a, o, s, c), { degreesDelta: p } = l === u && l >= 2 && u >= 2 && n.event.type !== "pointercancel" ?
|
|
103
|
+
].includes(n.event.type) && l !== u && u > 0 || n.event.type === "pointercancel" ? W(a, a, s, c) : W(a, o, s, c), { degreesDelta: p } = l === u && l >= 2 && u >= 2 && n.event.type !== "pointercancel" ? j((e == null ? void 0 : e.latestActivePointers) ?? [], n.latestActivePointers ?? []) : { degreesDelta: 0 };
|
|
104
104
|
return {
|
|
105
105
|
startTime: Date.now(),
|
|
106
106
|
...e,
|
|
@@ -111,7 +111,7 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
111
111
|
deltaPointersAngle: p
|
|
112
112
|
};
|
|
113
113
|
}, void 0), p((e) => {
|
|
114
|
-
let { deltaX: t, deltaY: n, latestActivePointers: r, startTime: i, center: a, event: o, deltaPointersAngle: s } = e, c = r ?? [], l = Date.now() - i, { velocityX: u, velocityY: d } =
|
|
114
|
+
let { deltaX: t, deltaY: n, latestActivePointers: r, startTime: i, center: a, event: o, deltaPointersAngle: s } = e, c = r ?? [], l = Date.now() - i, { velocityX: u, velocityY: d } = ne(l, t, n);
|
|
115
115
|
return {
|
|
116
116
|
deltaX: t,
|
|
117
117
|
deltaY: n,
|
|
@@ -127,7 +127,7 @@ var z = (e) => e.type === "pointerleave" || e.type === "pointercancel" || e.type
|
|
|
127
127
|
};
|
|
128
128
|
}));
|
|
129
129
|
}, K = ({ container: e, afterEventReceived: t = (e) => e }) => {
|
|
130
|
-
let n =
|
|
130
|
+
let n = z({
|
|
131
131
|
afterEventReceived: t,
|
|
132
132
|
container: e
|
|
133
133
|
}), r = d(e, "pointerup").pipe(p(t)), i = d(e, "pointermove").pipe(p(t)), a = d(e, "pointerleave").pipe(p(t)), o = d(e, "pointercancel").pipe(p(t));
|
|
@@ -204,7 +204,7 @@ var Z = class {
|
|
|
204
204
|
trackMove: !0
|
|
205
205
|
}), V()), d = (e) => e.pipe(c((e) => e.pointers.length >= i)), f = (e) => e.pipe(c((e) => e.pointers.length < i));
|
|
206
206
|
return l.pipe(d, s(({ pointers: e }) => {
|
|
207
|
-
let t = l.pipe(f, u(), v()), n = T(o), r = m(...e.map((e) => g(e)), this.pointerDown$).pipe(h((e) => m(this.pointerMove$, g(e)).pipe(
|
|
207
|
+
let t = l.pipe(f, u(), v()), n = T(o), r = m(...e.map((e) => g(e)), this.pointerDown$).pipe(h((e) => m(this.pointerMove$, g(e)).pipe(L(e), c((t) => I(e, t, a)))), u()).pipe(x(() => n), E(l), p(([, { event: e, pointers: t }]) => ({
|
|
208
208
|
type: "start",
|
|
209
209
|
event: e,
|
|
210
210
|
latestActivePointers: t
|
|
@@ -229,26 +229,28 @@ var Z = class {
|
|
|
229
229
|
this.configSubject.next({
|
|
230
230
|
...n,
|
|
231
231
|
...e,
|
|
232
|
+
failWith: e.failWith ?? n.failWith,
|
|
233
|
+
afterEventReceived: e.afterEventReceived ?? n.afterEventReceived,
|
|
232
234
|
...e.options && { options: {
|
|
233
235
|
...n.options,
|
|
234
|
-
...e.options
|
|
236
|
+
...N(e.options)
|
|
235
237
|
} },
|
|
236
238
|
panConfig: {
|
|
237
239
|
...n.panConfig,
|
|
238
|
-
...t
|
|
240
|
+
...N(t)
|
|
239
241
|
}
|
|
240
242
|
});
|
|
241
243
|
}
|
|
242
244
|
update(e, t) {
|
|
243
245
|
this.updateInternal(e, t);
|
|
244
246
|
}
|
|
245
|
-
},
|
|
247
|
+
}, ie = class extends Z {
|
|
246
248
|
constructor(e = {}) {
|
|
247
249
|
super(e, {
|
|
248
250
|
numInputs: 1,
|
|
249
251
|
delay: 0,
|
|
250
252
|
posThreshold: 0,
|
|
251
|
-
...e.options
|
|
253
|
+
...N(e.options)
|
|
252
254
|
}), X(this, "events$", void 0);
|
|
253
255
|
let t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => ({
|
|
254
256
|
type: "holdStart",
|
|
@@ -268,37 +270,36 @@ var Z = class {
|
|
|
268
270
|
update(e) {
|
|
269
271
|
super.update(e, e.options);
|
|
270
272
|
}
|
|
271
|
-
},
|
|
273
|
+
}, ae = class extends Z {
|
|
272
274
|
constructor(e) {
|
|
273
|
-
var t;
|
|
274
275
|
super(e, {
|
|
275
|
-
|
|
276
|
-
|
|
276
|
+
posThreshold: 15,
|
|
277
|
+
...N(e == null ? void 0 : e.options)
|
|
277
278
|
}), X(this, "events$", void 0), X(this, "start$", void 0), X(this, "end$", void 0);
|
|
278
|
-
let
|
|
279
|
+
let t = this.panStart$.pipe(p((e) => ({
|
|
279
280
|
type: "panStart",
|
|
280
281
|
...e
|
|
281
|
-
})), E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), v()),
|
|
282
|
+
})), E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), v()), n = this.panEnd$.pipe(p((e) => ({
|
|
282
283
|
type: "panEnd",
|
|
283
284
|
...e
|
|
284
|
-
})), v()),
|
|
285
|
+
})), v()), r = this.panMove$.pipe(p((e) => ({
|
|
285
286
|
type: "panMove",
|
|
286
287
|
...e
|
|
287
288
|
})));
|
|
288
|
-
this.events$ =
|
|
289
|
-
let t = e,
|
|
289
|
+
this.events$ = t.pipe(x((e) => {
|
|
290
|
+
let t = e, i = g(e), a = this.failWithActive$.pipe(c((e) => e), u()), o = m(i, r, n).pipe(w((e) => {
|
|
290
291
|
t = e;
|
|
291
292
|
}), S(a)), s = a.pipe(p(() => ({
|
|
292
293
|
...t,
|
|
293
294
|
type: "panEnd"
|
|
294
|
-
})), S(
|
|
295
|
+
})), S(n));
|
|
295
296
|
return m(o, s);
|
|
296
297
|
}), this.reportFingers((e) => e.type === "panEnd"), v()), this.start$ = this.events$.pipe(c((e) => e.type === "panStart")), this.end$ = this.events$.pipe(c((e) => e.type === "panEnd"));
|
|
297
298
|
}
|
|
298
299
|
update(e) {
|
|
299
300
|
super.update(e, e.options);
|
|
300
301
|
}
|
|
301
|
-
},
|
|
302
|
+
}, Q = ({ type: e, initialEvent: t }) => (n) => n.pipe(_((t, n) => {
|
|
302
303
|
let r = ((t == null ? void 0 : t.pointers.length) ?? 0) !== n.pointers.length, i = (t == null ? void 0 : t.pointersAverageDistance) ?? n.pointersAverageDistance, a = !r && t && "reference" in t ? t.reference : {
|
|
303
304
|
pointersAverageDistance: r ? n.pointersAverageDistance : i,
|
|
304
305
|
scale: t && "scale" in t ? t.scale : 1,
|
|
@@ -314,16 +315,16 @@ var Z = class {
|
|
|
314
315
|
deltaDistance: c,
|
|
315
316
|
deltaDistanceScale: l
|
|
316
317
|
};
|
|
317
|
-
}, t), p(({ reference: e, ...t }) => t)),
|
|
318
|
+
}, t), p(({ reference: e, ...t }) => t)), oe = class extends Z {
|
|
318
319
|
constructor(e) {
|
|
319
320
|
super(e, {
|
|
320
321
|
...e == null ? void 0 : e.options,
|
|
321
322
|
numInputs: 2
|
|
322
323
|
}), X(this, "events$", void 0), X(this, "start$", void 0), X(this, "end$", void 0), this.events$ = this.config$.pipe(x(() => {
|
|
323
|
-
let e, t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), x((e) => g(e).pipe(
|
|
324
|
+
let e, t = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => e), x((e) => g(e).pipe(Q({
|
|
324
325
|
type: "pinchStart",
|
|
325
326
|
initialEvent: void 0
|
|
326
|
-
}))), V()), n = this.failWithActive$.pipe(c((e) => e), u()), r = t.pipe(x((e) => this.pan$.pipe(C((e) => e.type !== "end"),
|
|
327
|
+
}))), V()), n = this.failWithActive$.pipe(c((e) => e), u()), r = t.pipe(x((e) => this.pan$.pipe(C((e) => e.type !== "end"), Q({
|
|
327
328
|
type: "pinchMove",
|
|
328
329
|
initialEvent: e
|
|
329
330
|
}), S(n)))), a = t.pipe(x((t) => this.pan$.pipe(c((e) => e.type === "end"), S(n), i(null), p((n) => {
|
|
@@ -345,7 +346,7 @@ var Z = class {
|
|
|
345
346
|
update(e) {
|
|
346
347
|
super.update(e, e.options);
|
|
347
348
|
}
|
|
348
|
-
},
|
|
349
|
+
}, $ = class {
|
|
349
350
|
constructor(e) {
|
|
350
351
|
X(this, "options", void 0), X(this, "events$", void 0), X(this, "recognizers", void 0), X(this, "state$", void 0), this.options = e, this.recognizers = e.recognizers, this.events$ = m(...e.recognizers.map((e) => e.events$.pipe(p((t) => ({
|
|
351
352
|
event: t,
|
|
@@ -356,12 +357,12 @@ var Z = class {
|
|
|
356
357
|
t.container && (t.container.style.touchAction = "none", e && (t.container.style.userSelect = "none"));
|
|
357
358
|
for (let e of this.options.recognizers) e.update(t);
|
|
358
359
|
}
|
|
359
|
-
},
|
|
360
|
+
}, se = class extends Z {
|
|
360
361
|
constructor(e = {}) {
|
|
361
362
|
super(e, {
|
|
362
363
|
numInputs: 2,
|
|
363
364
|
posThreshold: 15,
|
|
364
|
-
...e.options
|
|
365
|
+
...N(e.options)
|
|
365
366
|
}), X(this, "events$", void 0), this.events$ = this.config$.pipe(x(() => {
|
|
366
367
|
let e = this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), p(([e]) => ({
|
|
367
368
|
...e,
|
|
@@ -401,16 +402,16 @@ var Z = class {
|
|
|
401
402
|
update(e) {
|
|
402
403
|
super.update(e, e.options);
|
|
403
404
|
}
|
|
404
|
-
},
|
|
405
|
+
}, ce = (e) => (t) => t.pipe(c((t) => Math.abs(t.velocityX) >= e || Math.abs(t.velocityY) >= e)), le = class extends Z {
|
|
405
406
|
constructor(e) {
|
|
406
407
|
super(e, {
|
|
407
408
|
posThreshold: 0,
|
|
408
409
|
numInputs: 1
|
|
409
410
|
}), X(this, "events$", void 0), this.events$ = this.config$.pipe(x((e) => {
|
|
410
411
|
let { escapeVelocity: t = .9 } = e.options ?? {};
|
|
411
|
-
return this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), x(([e]) => this.panEnd$.pipe(
|
|
412
|
+
return this.panStart$.pipe(E(this.failWithActive$), c(([, e]) => !e), x(([e]) => this.panEnd$.pipe(ce(t), p((t) => ({
|
|
412
413
|
type: "swipe",
|
|
413
|
-
angle:
|
|
414
|
+
angle: te(e.event, t.event),
|
|
414
415
|
...t
|
|
415
416
|
})), S(this.failWithActive$.pipe(c((e) => e))))), v());
|
|
416
417
|
}));
|
|
@@ -418,7 +419,7 @@ var Z = class {
|
|
|
418
419
|
update(e) {
|
|
419
420
|
super.update(e);
|
|
420
421
|
}
|
|
421
|
-
},
|
|
422
|
+
}, ue = ({ timeout: e, pointerEvent$: t }) => (n) => n.pipe(h((n) => T(e).pipe(S(t.pipe(U, L(n)))))), de = ({ initialPointerEvent: e, pointerEvent$: t, tolerance: n }) => (r) => r.pipe(h((r) => t.pipe(L(r), C((e) => !R(e), !0), c((t) => I(e, t, n))))), fe = class extends Z {
|
|
422
423
|
constructor(e) {
|
|
423
424
|
super(e), X(this, "events$", void 0), this.events$ = this.config$.pipe(x((e) => {
|
|
424
425
|
var n, i;
|
|
@@ -427,11 +428,11 @@ var Z = class {
|
|
|
427
428
|
trackMove: !0
|
|
428
429
|
}), V()), _ = h.pipe(c(({ pointers: e }) => e.length > 1)), v = (e) => e.pipe(t(m(this.pointerDown$, this.pointerUp$).pipe(r(o), c((e) => e.type === "pointerup"))), u());
|
|
429
430
|
return m(this.pointerDown$, h.pipe(f())).pipe(s((e) => {
|
|
430
|
-
let t = m(g(e), this.pointerDown$).pipe(V()), n = t.pipe(v), r = t.pipe(
|
|
431
|
+
let t = m(g(e), this.pointerDown$).pipe(V()), n = t.pipe(v), r = t.pipe(de({
|
|
431
432
|
initialPointerEvent: e,
|
|
432
433
|
pointerEvent$: this.pointerEvent$,
|
|
433
434
|
tolerance: d
|
|
434
|
-
})), i = t.pipe(
|
|
435
|
+
})), i = t.pipe(ue({
|
|
435
436
|
pointerEvent$: this.pointerEvent$,
|
|
436
437
|
timeout: l
|
|
437
438
|
})), o = m(this.failWithActive$.pipe(c((e) => e)), this.pointerCancel$, _, r, i), s = n.pipe(F, c((e) => e.length <= a), p((e) => {
|
|
@@ -456,6 +457,6 @@ var Z = class {
|
|
|
456
457
|
}
|
|
457
458
|
};
|
|
458
459
|
//#endregion
|
|
459
|
-
export {
|
|
460
|
+
export { ie as HoldRecognizer, ae as PanRecognizer, oe as PinchRecognizer, $ as Recognizable, Z as Recognizer, se as RotateRecognizer, le as SwipeRecognizer, fe as TapRecognizer };
|
|
460
461
|
|
|
461
462
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["calculateDistance","pointB","pointA","calculateAverageDistance","n","pointerEvents","sum","i","innerSum","event1","event2","calculateRadianAngleBetweenPoints","deltaX","pointerB","pointerA","deltaY","calculateDegreeAngleBetweenPoints","calculateCentroid","points","point","acc","numPoints","calculateAngleDelta","initialPoints","newPoints","initialCentroid","newCentroid","totalAngleDelta","initialAngle","initialPoint","angleDelta","index","radianDelta","isDefined","arg","hasAtLeastOneItem","events","filterNotEmpty","stream","filter","isWithinPosThreshold","start","startEvent","end","endEvent","posThreshold","calculateVelocity","delay","matchPointer","newPointer","pointer","isPointerOffEvent","pointerEvent","isPrimaryButtonPress","event","fromPointerDown","fromEvent","container","map","afterEventReceived","trackPointers","pointerUp$","pointerEvent$","pointerLeave$","pointerCancel$","pointerMove$","contextMenu$","isPointerRemoved","mergeMap","pointerDown$","defer","of","pointerDown","merge","takeWhile","scan","_deleted","rest","pointers","shareLatest","shareReplay","isValidConfig","config","filterPointerOff","calculateNewDelta","newCenter","prevCenter","prevDeltaX","prevDeltaY","scanToRecognizerEvent","getCenterFromData","data","_acc$latestActivePoin","_curr$latestActivePoi","curr","prevActivePointersNumber","currActivePointersNumber","deltaPointersAngle","latestActivePointers","startTime","getPointerEvents","_typeof","o","toPrimitive","t","e","r","toPropertyKey","_defineProperty","Recognizer","BehaviorSubject","events$","tap","isEnd","finalize","switchMap","share","failWith$","failWith","distinctUntilChanged","areRunnings$","start$","recognizer","end$","startWith","combineLatest","runnings","running","_config$panConfig","_config$panConfig2","_config$panConfig3","numInputs","trackPointers$","hasEnoughFingers","hasNotEnoughFingers","exhaustMap","initialPointerEvents","panReleased$","first","delay$","timer","panStart$","withLatestFrom","takeUntil","panUpdate$","skip","panEnd$","rawEvent$","recognizerEvent","previous","current","panConfig","existingConfig","HoldRecognizer","options","failWithActive","failingActive$","isActive","trailingEndEventIfFailed$","holdStartEvent","PanRecognizer","_config$options","panMove$","latestEvent","panStartEvent","panStarted$","scanPanEventToPinchEvent","hasChangedFingers","previousPointersAverageDistance","reference","scale","distance","deltaDistance","deltaDistanceScale","initialEvent","PinchRecognizer","latestPinchEvent","pinchStarted$","pinchMove$","pinchEnd$","defaultIfEmpty","pinchStartEvent","Recognizable","states","state","disableTextSelection","RotateRecognizer","rotateStart$","rotate$","rotateStartEvent","angle","rotateMove$","rotateEnd$","isRecognizedAsSwipe","escapeVelocity","SwipeRecognizer","initializedWith","takeWhenPressedTooLong","timeout","takeWhenOutsideThreshold","initialPointerEvent","tolerance","TapRecognizer","_config$options2","maxTaps","multiTapThreshold","activePointers$","hasMoreThanOneActivePointer$","bufferPointerDowns","buffer","debounceTime","ignoreElements","pointerDowns$","pointerDownsBuffered$","clickedTooFarFromOriginalTap$","hasFingersPressedForTooLong$","maximumPressTime","takeUntil$","active","lastPress"],"sources":["../src/core/utils/geometry.ts","../src/core/utils/utils.ts","../src/core/utils/events.ts","../src/core/utils/operators.ts","../src/core/recognizer/operators.ts","../src/core/recognizer/scanToRecognizerEvent.ts","../src/core/recognizer/utils.ts","../src/core/recognizer/Recognizer.ts","../src/core/hold/HoldRecognizer.ts","../src/core/pan/PanRecognizer.ts","../src/core/pinch/scanPanEventToPinchEvent.ts","../src/core/pinch/PinchRecognizer.ts","../src/core/recognizable/Recognizable.ts","../src/core/rotate/RotateRecognizer.ts","../src/core/swipe/operators.ts","../src/core/swipe/SwipeRecognizer.ts","../src/core/tap/operators.ts","../src/core/tap/TapRecognizer.ts"],"sourcesContent":["export type Point = { x: number; y: number };\n\nexport function calculateDistance(pointA: Point, pointB: Point): number {\n\treturn Math.sqrt((pointB.x - pointA.x) ** 2 + (pointB.y - pointA.y) ** 2);\n}\n\nexport function calculateAverageDistance(pointerEvents: Point[]): number {\n\tconst n = pointerEvents.length;\n\tif (n < 2) return 0; // No distance if fewer than 2 pointers\n\n\tconst totalDistance = pointerEvents.reduce((sum, event1, i) => {\n\t\treturn (\n\t\t\tsum +\n\t\t\tpointerEvents.slice(i + 1).reduce((innerSum, event2) => {\n\t\t\t\treturn innerSum + calculateDistance(event1, event2);\n\t\t\t}, 0)\n\t\t);\n\t}, 0);\n\n\t// Number of pairs is n choose 2: n * (n - 1) / 2\n\tconst numberOfPairs = (n * (n - 1)) / 2;\n\treturn totalDistance / numberOfPairs;\n}\n\nexport function calculateRadianAngleBetweenPoints(\n\tpointerA: Point,\n\tpointerB: Point,\n): number {\n\t// Calculate the differences in coordinates\n\tconst deltaX = pointerB.x - pointerA.x;\n\tconst deltaY = pointerB.y - pointerA.y;\n\n\t// Calculate the angle in radians\n\tconst angleInRadians = Math.atan2(deltaY, deltaX);\n\n\t// Return the angle in degrees\n\treturn angleInRadians;\n}\n\nexport function calculateDegreeAngleBetweenPoints(\n\tpointerA: Point,\n\tpointerB: Point,\n): number {\n\t// Calculate the angle in radians\n\tconst angleInRadians = calculateRadianAngleBetweenPoints(pointerA, pointerB);\n\n\t// Convert the angle to degrees (optional)\n\tconst angleInDegrees = angleInRadians * (180 / Math.PI);\n\n\t// Return the angle in degrees\n\treturn angleInDegrees;\n}\n\nexport function calculateCentroid(points: Point[]) {\n\tconst sum = points.reduce(\n\t\t(acc, point) => {\n\t\t\tacc.x += point.x;\n\t\t\tacc.y += point.y;\n\n\t\t\treturn acc;\n\t\t},\n\t\t{ x: 0, y: 0 },\n\t);\n\n\tconst numPoints = points.length || 1;\n\n\treturn {\n\t\tx: sum.x / numPoints,\n\t\ty: sum.y / numPoints,\n\t};\n}\n\nexport function calculateAngleDelta(\n\tinitialPoints: Point[],\n\tnewPoints: Point[],\n) {\n\tif (initialPoints.length !== newPoints.length) {\n\t\tthrow new Error(\"Initial and new points arrays must have the same length.\");\n\t}\n\n\tconst initialCentroid = calculateCentroid(initialPoints);\n\tconst newCentroid = calculateCentroid(newPoints);\n\n\tlet totalAngleDelta = 0;\n\n\tinitialPoints.forEach((initialPoint, index) => {\n\t\tconst initialAngle = calculateRadianAngleBetweenPoints(\n\t\t\tinitialCentroid,\n\t\t\tinitialPoint,\n\t\t);\n\t\tconst newAngle = calculateRadianAngleBetweenPoints(\n\t\t\tnewCentroid,\n\t\t\tnewPoints[index] ?? initialPoint,\n\t\t);\n\n\t\tlet angleDelta = newAngle - initialAngle;\n\n\t\t// Normalize the angle delta to be within [-PI, PI]\n\t\tif (angleDelta > Math.PI) {\n\t\t\tangleDelta -= 2 * Math.PI;\n\t\t} else if (angleDelta < -Math.PI) {\n\t\t\tangleDelta += 2 * Math.PI;\n\t\t}\n\n\t\ttotalAngleDelta += angleDelta;\n\t});\n\n\t// Return the average angle delta\n\tconst radianDelta = totalAngleDelta / initialPoints.length;\n\tconst degreesDelta = radianDelta * (180 / Math.PI);\n\n\treturn { radianDelta, degreesDelta };\n}\n","import { filter, type Observable } from \"rxjs\";\nimport { calculateCentroid } from \"./geometry\";\n\nexport function isDefined<T>(\n\targ: T | null | undefined,\n): arg is T extends null | undefined ? never : T {\n\treturn arg !== null && arg !== undefined;\n}\n\nexport const hasAtLeastOneItem = <T>(events: T[]): events is [T, ...T[]] =>\n\tevents.length > 0;\n\nexport const filterNotEmpty = <T>(\n\tstream: Observable<T[]>,\n): Observable<[T, ...T[]]> => stream.pipe(filter(hasAtLeastOneItem));\n\nexport function isWithinPosThreshold(\n\tstartEvent: PointerEvent,\n\tendEvent: PointerEvent,\n\tposThreshold: number,\n) {\n\tconst start = calculateCentroid([startEvent]);\n\tconst end = calculateCentroid([endEvent]);\n\n\t// Determines if the movement qualifies as a drag\n\treturn (\n\t\tMath.abs(end.x - start.x) >= posThreshold ||\n\t\tMath.abs(end.y - start.y) >= posThreshold\n\t);\n}\n\n/**\n * Avoid division by zero\n * Calculate velocity in pixels per second\n */\nexport const calculateVelocity = (\n\tdelay: number,\n\tdeltaX: number,\n\tdeltaY: number,\n) => {\n\tconst velocityX = delay > 0 ? deltaX / delay : 0;\n\tconst velocityY = delay > 0 ? deltaY / delay : 0;\n\n\treturn {\n\t\tvelocityX,\n\t\tvelocityY,\n\t};\n};\n","import {\n\tdefer,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tmerge,\n\tmergeMap,\n\ttype Observable,\n\tof,\n\tscan,\n\ttakeWhile,\n} from \"rxjs\";\nimport { isDefined } from \"./utils\";\n\nexport function matchPointer(pointer: PointerEvent) {\n\treturn (stream: Observable<PointerEvent>) =>\n\t\tstream.pipe(\n\t\t\tfilter((newPointer) => newPointer.pointerId === pointer.pointerId),\n\t\t);\n}\n\nexport const isPointerOffEvent = (pointerEvent: PointerEvent) =>\n\tpointerEvent.type === \"pointerleave\" ||\n\tpointerEvent.type === \"pointercancel\" ||\n\tpointerEvent.type === \"pointerup\";\n\n/**\n * A press of the primary button: a left click, a finger or a pen's tip. A\n * right click is for the context menu, a middle click for the browser, and a\n * pen's barrel button or eraser for the app.\n *\n * @see https://w3c.github.io/pointerevents/#the-button-property\n */\nconst isPrimaryButtonPress = (event: PointerEvent) => event.button === 0;\n\n/**\n * The presses that start a gesture. Every recognizer tracks a pointer from its\n * press, so a pointer pressed with another button starts none: no tap, pan or\n * pinch, and no share of a multi tap.\n */\nexport const fromPointerDown = ({\n\tcontainer,\n\tafterEventReceived = (event) => event,\n}: {\n\tcontainer: HTMLElement;\n\tafterEventReceived?: (event: PointerEvent) => PointerEvent;\n}) =>\n\tfromEvent<PointerEvent>(container, \"pointerdown\").pipe(\n\t\tmap(afterEventReceived),\n\t\tfilter(isPrimaryButtonPress),\n\t);\n\n/**\n * Track all pointerEvent for active fingers\n */\nexport const trackPointers =\n\t({\n\t\tpointerEvent$,\n\t}: {\n\t\tpointerEvent$: Observable<PointerEvent>;\n\t\t/**\n\t\t * Setting this value to false will not update the list\n\t\t * on pointer move. Use it if you only need to track number of active\n\t\t * fingers.\n\t\t */\n\t\ttrackMove: boolean;\n\t}) =>\n\t(stream: Observable<PointerEvent>) => {\n\t\ttype PointersState = {\n\t\t\tevent: PointerEvent;\n\t\t\tpointers: Record<number, PointerEvent | undefined>;\n\t\t};\n\n\t\tconst pointerUp$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerup\"),\n\t\t);\n\t\tconst pointerLeave$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerleave\"),\n\t\t);\n\t\tconst pointerCancel$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointercancel\"),\n\t\t);\n\t\tconst pointerMove$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointermove\"),\n\t\t);\n\t\tconst contextMenu$ = fromEvent<PointerEvent>(window, \"contextmenu\");\n\n\t\tconst isPointerRemoved = (event: PointerEvent) =>\n\t\t\t[\"pointercancel\", \"pointerleave\", \"pointerup\", \"contextmenu\"].includes(\n\t\t\t\tevent.type,\n\t\t\t);\n\n\t\treturn stream.pipe(\n\t\t\tmergeMap((pointerDown) => {\n\t\t\t\tconst pointerDown$ = defer(() => of(pointerDown));\n\n\t\t\t\tconst tracking$ = merge(\n\t\t\t\t\tpointerDown$,\n\t\t\t\t\tmerge(\n\t\t\t\t\t\tpointerMove$,\n\t\t\t\t\t\tpointerCancel$,\n\t\t\t\t\t\tpointerLeave$,\n\t\t\t\t\t\tpointerUp$,\n\t\t\t\t\t\tcontextMenu$,\n\t\t\t\t\t),\n\t\t\t\t).pipe(\n\t\t\t\t\tmatchPointer(pointerDown),\n\t\t\t\t\ttakeWhile((event) => !isPointerRemoved(event), true),\n\t\t\t\t);\n\n\t\t\t\treturn tracking$;\n\t\t\t}),\n\t\t\tscan<PointerEvent, PointersState, undefined>((acc, event) => {\n\t\t\t\tif (isPointerRemoved(event)) {\n\t\t\t\t\tconst { [event.pointerId]: _deleted, ...rest } = acc?.pointers ?? {};\n\n\t\t\t\t\tvoid _deleted;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\tpointers: rest,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tevent,\n\t\t\t\t\tpointers: {\n\t\t\t\t\t\t...(acc?.pointers ?? {}),\n\t\t\t\t\t\t[event.pointerId]: event,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}, undefined),\n\t\t\tmap(({ event, pointers }) => ({\n\t\t\t\tevent,\n\t\t\t\tpointers: Object.values(pointers).filter(isDefined),\n\t\t\t})),\n\t\t);\n\t};\n","import {\n\tdistinctUntilChanged,\n\tfilter,\n\ttype Observable,\n\tshareReplay,\n} from \"rxjs\";\n\nexport const emitOnceWhen =\n\t<T>(condition: (value: T) => boolean) =>\n\t(stream: Observable<T>) =>\n\t\tstream.pipe(\n\t\t\t// only emit once when we have a condition switch\n\t\t\tdistinctUntilChanged((previous, current) => {\n\t\t\t\tconst previousHasLessThan = condition(previous);\n\t\t\t\tconst currentHasLessThan = condition(current);\n\n\t\t\t\treturn previousHasLessThan === currentHasLessThan;\n\t\t\t}),\n\t\t\t// make sure to only pass true\n\t\t\tfilter(condition),\n\t\t);\n\n/**\n * Shares the latest value with late subscribers, and unsubscribes from the\n * source along with the last subscriber, which shareReplay(1) doesn't do.\n */\nexport const shareLatest = <T>() =>\n\tshareReplay<T>({ bufferSize: 1, refCount: true });\n","import { filter, type Observable } from \"rxjs\";\nimport { isPointerOffEvent } from \"../utils/events\";\n\nexport const isValidConfig = <T extends { container?: HTMLElement }>(\n\tstream: Observable<T>,\n) =>\n\tstream.pipe(\n\t\tfilter(\n\t\t\t(config): config is T & { container: HTMLElement } => !!config.container,\n\t\t),\n\t);\n\nexport const filterPointerOff = (stream: Observable<PointerEvent>) =>\n\tstream.pipe(filter(isPointerOffEvent));\n","import { map, type Observable, scan } from \"rxjs\";\nimport {\n\tcalculateAngleDelta,\n\tcalculateAverageDistance,\n\tcalculateCentroid,\n} from \"../utils/geometry\";\nimport { calculateVelocity } from \"../utils/utils\";\nimport type { RecognizerEvent } from \"./RecognizerEvent\";\n\nexport interface RecognizerEventInput {\n\tevent: PointerEvent;\n\tlatestActivePointers: PointerEvent[];\n}\n\ninterface RecognizerEventState extends RecognizerEventInput {\n\tstartTime: number;\n\tcenter: { x: number; y: number };\n\tdeltaX: number;\n\tdeltaY: number;\n\tdeltaPointersAngle: number;\n}\n\nconst calculateNewDelta = (\n\tnewCenter: { x: number; y: number },\n\tprevCenter: { x: number; y: number },\n\tprevDeltaX: number,\n\tprevDeltaY: number,\n) => {\n\tconst deltaX = newCenter.x - prevCenter.x + prevDeltaX;\n\tconst deltaY = newCenter.y - prevCenter.y + prevDeltaY;\n\n\treturn {\n\t\tdeltaX,\n\t\tdeltaY,\n\t};\n};\n\nexport const scanToRecognizerEvent = <T extends RecognizerEventInput>(\n\tstream: Observable<T>,\n): Observable<RecognizerEvent> => {\n\tconst getCenterFromData = (data: T) =>\n\t\tcalculateCentroid(\n\t\t\t!data.latestActivePointers.length\n\t\t\t\t? [data.event]\n\t\t\t\t: data.latestActivePointers,\n\t\t);\n\n\treturn stream.pipe(\n\t\tscan<T, RecognizerEventState, undefined>((acc, curr) => {\n\t\t\tconst newCenter = getCenterFromData(curr);\n\t\t\tconst prevCenter = acc?.center ?? newCenter;\n\t\t\tconst prevDeltaX = acc?.deltaX ?? 0;\n\t\t\tconst prevDeltaY = acc?.deltaY ?? 0;\n\t\t\tconst prevActivePointersNumber = acc?.latestActivePointers?.length ?? 1;\n\t\t\tconst currActivePointersNumber = curr.latestActivePointers?.length ?? 1;\n\n\t\t\tconst hasAddedOrRemovedAFinger =\n\t\t\t\t[\"pointerdown\", \"pointercancel\", \"pointerleave\", \"pointerup\"].includes(\n\t\t\t\t\tcurr.event.type,\n\t\t\t\t) && prevActivePointersNumber !== currActivePointersNumber;\n\n\t\t\tconst hasAtLeastOneFinger = currActivePointersNumber > 0;\n\n\t\t\tconst { deltaX, deltaY } =\n\t\t\t\t(hasAddedOrRemovedAFinger && hasAtLeastOneFinger) ||\n\t\t\t\t/**\n\t\t\t\t * A pointercancel cean come after a drag event and heven being completely\n\t\t\t\t * desync, leading to erroned values. We should just ignore it.\n\t\t\t\t */\n\t\t\t\tcurr.event.type === \"pointercancel\"\n\t\t\t\t\t? calculateNewDelta(newCenter, newCenter, prevDeltaX, prevDeltaY)\n\t\t\t\t\t: calculateNewDelta(newCenter, prevCenter, prevDeltaX, prevDeltaY);\n\n\t\t\tconst { degreesDelta: deltaPointersAngle } =\n\t\t\t\tprevActivePointersNumber === currActivePointersNumber &&\n\t\t\t\tprevActivePointersNumber >= 2 &&\n\t\t\t\tcurrActivePointersNumber >= 2 &&\n\t\t\t\t/**\n\t\t\t\t * A pointercancel cean come after a drag event and heven being completely\n\t\t\t\t * desync, leading to erroned values. We should just ignore it.\n\t\t\t\t */\n\t\t\t\tcurr.event.type !== \"pointercancel\"\n\t\t\t\t\t? calculateAngleDelta(\n\t\t\t\t\t\t\tacc?.latestActivePointers ?? [],\n\t\t\t\t\t\t\tcurr.latestActivePointers ?? [],\n\t\t\t\t\t\t)\n\t\t\t\t\t: { degreesDelta: 0 };\n\n\t\t\treturn {\n\t\t\t\tstartTime: Date.now(),\n\t\t\t\t...acc,\n\t\t\t\t...curr,\n\t\t\t\tcenter: newCenter,\n\t\t\t\tdeltaX,\n\t\t\t\tdeltaY,\n\t\t\t\tdeltaPointersAngle,\n\t\t\t};\n\t\t}, undefined),\n\t\tmap((data) => {\n\t\t\tconst {\n\t\t\t\tdeltaX,\n\t\t\t\tdeltaY,\n\t\t\t\tlatestActivePointers,\n\t\t\t\tstartTime,\n\t\t\t\tcenter,\n\t\t\t\tevent,\n\t\t\t\tdeltaPointersAngle,\n\t\t\t} = data;\n\t\t\tconst events = latestActivePointers ?? [];\n\n\t\t\t// Calculate the change in time\n\t\t\tconst now = Date.now();\n\t\t\tconst delay = now - startTime;\n\n\t\t\tconst { velocityX, velocityY } = calculateVelocity(delay, deltaX, deltaY);\n\t\t\tconst pointersAverageDistance =\n\t\t\t\tcalculateAverageDistance(latestActivePointers);\n\n\t\t\treturn {\n\t\t\t\tdeltaX,\n\t\t\t\tdeltaY,\n\t\t\t\tvelocityX,\n\t\t\t\tvelocityY,\n\t\t\t\tdelay,\n\t\t\t\tcenter,\n\t\t\t\tpointers: events,\n\t\t\t\tstartTime,\n\t\t\t\tevent,\n\t\t\t\tdeltaPointersAngle,\n\t\t\t\tpointersAverageDistance,\n\t\t\t} satisfies RecognizerEvent;\n\t\t}),\n\t);\n};\n","import { fromEvent, map, merge } from \"rxjs\";\nimport { fromPointerDown } from \"../utils/events\";\n\nexport const getPointerEvents = ({\n\tcontainer,\n\tafterEventReceived = (event) => event,\n}: {\n\tcontainer: HTMLElement;\n\tafterEventReceived?: (event: PointerEvent) => PointerEvent;\n}) => {\n\tconst pointerDown$ = fromPointerDown({ afterEventReceived, container });\n\tconst pointerUp$ = fromEvent<PointerEvent>(container, \"pointerup\").pipe(\n\t\tmap(afterEventReceived),\n\t);\n\tconst pointerMove$ = fromEvent<PointerEvent>(container, \"pointermove\").pipe(\n\t\tmap(afterEventReceived),\n\t);\n\t/**\n\t * Mostly used to handle cursor leaving window on mouse pointers.\n\t */\n\tconst pointerLeave$ = fromEvent<PointerEvent>(container, \"pointerleave\").pipe(\n\t\tmap(afterEventReceived),\n\t);\n\t/**\n\t * Handle things such as contextual menu popup or\n\t * native swipe navigation conflict.\n\t */\n\tconst pointerCancel$ = fromEvent<PointerEvent>(\n\t\tcontainer,\n\t\t\"pointercancel\",\n\t).pipe(map(afterEventReceived));\n\n\tconst pointerEvents$ = merge(\n\t\tpointerDown$,\n\t\tpointerCancel$,\n\t\tpointerLeave$,\n\t\tpointerUp$,\n\t\tpointerMove$,\n\t);\n\n\treturn {\n\t\tpointerEvents$,\n\t\tpointerDown$,\n\t\tpointerCancel$,\n\t\tpointerLeave$,\n\t\tpointerUp$,\n\t\tpointerMove$,\n\t};\n};\n","import {\n\tBehaviorSubject,\n\tcombineLatest,\n\tdistinctUntilChanged,\n\texhaustMap,\n\tfilter,\n\tfinalize,\n\tfirst,\n\tmap,\n\tmerge,\n\tmergeMap,\n\ttype Observable,\n\tof,\n\tshare,\n\tshareReplay,\n\tskip,\n\tstartWith,\n\tswitchMap,\n\ttakeUntil,\n\ttap,\n\ttimer,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { matchPointer, trackPointers } from \"../utils/events\";\nimport { shareLatest } from \"../utils/operators\";\nimport { isWithinPosThreshold } from \"../utils/utils\";\nimport { filterPointerOff, isValidConfig } from \"./operators\";\nimport type { RecognizerEvent } from \"./RecognizerEvent\";\nimport { scanToRecognizerEvent } from \"./scanToRecognizerEvent\";\nimport { getPointerEvents } from \"./utils\";\n\ntype PanConfig = {\n\tposThreshold?: number;\n\tdelay?: number;\n\t/**\n\t * Number of inputs to trigger the event.\n\t * Default to 1\n\t */\n\tnumInputs?: number;\n};\n\nexport interface FailWith {\n\tstart$: Observable<unknown>;\n\tend$: Observable<unknown>;\n}\n\nexport type RecognizerConfig<Options> = {\n\tcontainer?: HTMLElement;\n\tafterEventReceived?: (event: PointerEvent) => PointerEvent;\n\toptions?: Options;\n\tfailWith?: FailWith[];\n};\n\nexport interface RecognizerPanEvent extends RecognizerEvent {\n\ttype: \"start\" | \"move\" | \"end\";\n}\n\nexport type State = {\n\t/**\n\t * Fingers of the gesture the recognizer recognizes, as of its latest\n\t * event, from its start event until its end event. None the rest of the\n\t * time, and none for a gesture recognized once the fingers are lifted,\n\t * as a tap or a swipe.\n\t */\n\tfingers: number;\n};\n\nexport abstract class Recognizer<\n\tOptions extends object = never,\n\tEvent extends RecognizerEvent = RecognizerEvent,\n> {\n\tprotected configSubject = new BehaviorSubject<\n\t\tRecognizerConfig<Options> & {\n\t\t\tpanConfig?: PanConfig;\n\t\t}\n\t>({});\n\tprivate stateSubject = new BehaviorSubject<State>({\n\t\tfingers: 0,\n\t});\n\tprotected pan$: Observable<RecognizerPanEvent>;\n\tprotected panStart$: Observable<RecognizerEvent>;\n\tprotected panMove$: Observable<RecognizerEvent>;\n\tprotected panEnd$: Observable<RecognizerEvent>;\n\n\tprotected pointerEvent$: Observable<PointerEvent>;\n\tprotected pointerDown$: Observable<PointerEvent>;\n\tprotected pointerUp$: Observable<PointerEvent>;\n\tprotected pointerCancel$: Observable<PointerEvent>;\n\tprotected pointerMove$: Observable<PointerEvent>;\n\tprotected pointerOff$: Observable<PointerEvent>;\n\n\tpublic state$: Observable<State>;\n\tpublic config$ = this.configSubject.pipe(isValidConfig);\n\n\tabstract events$: Observable<Event>;\n\n\t/**\n\t * Track active running failWith recognizers\n\t */\n\tprotected failWithActive$: Observable<boolean>;\n\n\t/**\n\t * Reports in state$ the fingers of the gesture the recognizer's events\n\t * recognize, until `isEnd` tells its end event, or until nothing listens\n\t * to them anymore.\n\t */\n\tprotected reportFingers =\n\t\t(isEnd: (event: Event) => boolean) => (events$: Observable<Event>) =>\n\t\t\tevents$.pipe(\n\t\t\t\ttap((event) => {\n\t\t\t\t\tthis.stateSubject.next({\n\t\t\t\t\t\tfingers: isEnd(event) ? 0 : event.pointers.length,\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\t\tfinalize(() => {\n\t\t\t\t\tthis.stateSubject.next({ fingers: 0 });\n\t\t\t\t}),\n\t\t\t);\n\n\tconstructor(config?: RecognizerConfig<Options>, panConfig?: PanConfig) {\n\t\tthis.pointerEvent$ = this.config$.pipe(\n\t\t\tswitchMap(\n\t\t\t\t({ container, afterEventReceived }) =>\n\t\t\t\t\tgetPointerEvents({\n\t\t\t\t\t\tcontainer,\n\t\t\t\t\t\tafterEventReceived,\n\t\t\t\t\t}).pointerEvents$,\n\t\t\t),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.pointerDown$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerdown\"),\n\t\t);\n\n\t\tthis.pointerUp$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerup\"),\n\t\t);\n\n\t\tthis.pointerMove$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointermove\"),\n\t\t);\n\n\t\tthis.pointerCancel$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointercancel\"),\n\t\t);\n\n\t\tthis.pointerOff$ = this.pointerEvent$.pipe(filterPointerOff);\n\n\t\tconst failWith$ = this.config$.pipe(\n\t\t\tmap(({ failWith }) => failWith),\n\t\t\tdistinctUntilChanged(),\n\t\t);\n\n\t\tthis.failWithActive$ = failWith$.pipe(\n\t\t\tswitchMap((failWith) => {\n\t\t\t\tconst areRunnings$ = failWith?.map((recognizer) => {\n\t\t\t\t\tconst start$ = recognizer.start$.pipe(map(() => true));\n\n\t\t\t\t\tconst end$ = recognizer.end$.pipe(map(() => false));\n\n\t\t\t\t\tconst isRunning$ = merge(start$, end$).pipe(startWith(false));\n\n\t\t\t\t\treturn isRunning$;\n\t\t\t\t});\n\n\t\t\t\tif (!areRunnings$?.length) {\n\t\t\t\t\treturn combineLatest([of(false)]);\n\t\t\t\t}\n\n\t\t\t\treturn combineLatest(areRunnings$);\n\t\t\t}),\n\t\t\tmap((runnings) => runnings.some((running) => running)),\n\t\t\t/**\n\t\t\t * Keeps following the failWith recognizers once subscribed: they can't\n\t\t\t * be asked whether they run, so a recognizer subscribing again later\n\t\t\t * would miss the gesture of one that started in between.\n\t\t\t */\n\t\t\tshareReplay(1),\n\t\t);\n\n\t\tthis.pan$ = this.configSubject.pipe(\n\t\t\tisValidConfig,\n\t\t\tswitchMap((config) => {\n\t\t\t\tconst numInputs = Math.max(1, config.panConfig?.numInputs ?? 1);\n\t\t\t\tconst posThreshold = Math.max(0, config.panConfig?.posThreshold ?? 0);\n\t\t\t\tconst delay = Math.max(0, config.panConfig?.delay ?? 0);\n\n\t\t\t\tconst trackPointers$ = this.pointerDown$.pipe(\n\t\t\t\t\ttrackPointers({\n\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\ttrackMove: true,\n\t\t\t\t\t}),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst hasEnoughFingers = (\n\t\t\t\t\tstream: Observable<{ event: PointerEvent; pointers: PointerEvent[] }>,\n\t\t\t\t) =>\n\t\t\t\t\tstream.pipe(\n\t\t\t\t\t\tfilter(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tevents,\n\t\t\t\t\t\t\t): events is { event: PointerEvent; pointers: [PointerEvent] } =>\n\t\t\t\t\t\t\t\tevents.pointers.length >= numInputs,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\n\t\t\t\tconst hasNotEnoughFingers = (\n\t\t\t\t\tstream: Observable<{\n\t\t\t\t\t\tevent: PointerEvent;\n\t\t\t\t\t\tpointers: PointerEvent[];\n\t\t\t\t\t}>,\n\t\t\t\t) =>\n\t\t\t\t\tstream.pipe(filter((events) => events.pointers.length < numInputs));\n\n\t\t\t\treturn trackPointers$.pipe(\n\t\t\t\t\thasEnoughFingers,\n\t\t\t\t\texhaustMap(({ pointers: initialPointerEvents }) => {\n\t\t\t\t\t\tconst panReleased$ = trackPointers$.pipe(\n\t\t\t\t\t\t\thasNotEnoughFingers,\n\t\t\t\t\t\t\tfirst(),\n\t\t\t\t\t\t\tshare(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst delay$ = timer(delay);\n\n\t\t\t\t\t\tconst pointerDownPassingThreshold$ = merge(\n\t\t\t\t\t\t\t...initialPointerEvents.map((pointerEvent) => of(pointerEvent)),\n\t\t\t\t\t\t\tthis.pointerDown$,\n\t\t\t\t\t\t).pipe(\n\t\t\t\t\t\t\tmergeMap((pointerDown) =>\n\t\t\t\t\t\t\t\tmerge(this.pointerMove$, of(pointerDown)).pipe(\n\t\t\t\t\t\t\t\t\tmatchPointer(pointerDown),\n\t\t\t\t\t\t\t\t\tfilter((pointerEvent) =>\n\t\t\t\t\t\t\t\t\t\tisWithinPosThreshold(\n\t\t\t\t\t\t\t\t\t\t\tpointerDown,\n\t\t\t\t\t\t\t\t\t\t\tpointerEvent,\n\t\t\t\t\t\t\t\t\t\t\tposThreshold,\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfirst(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst panStart$ = pointerDownPassingThreshold$.pipe(\n\t\t\t\t\t\t\tswitchMap(() => delay$),\n\t\t\t\t\t\t\twithLatestFrom(trackPointers$),\n\t\t\t\t\t\t\tmap(([, { event, pointers }]) => ({\n\t\t\t\t\t\t\t\ttype: \"start\" as const,\n\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\tlatestActivePointers: pointers,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\tshareLatest(),\n\t\t\t\t\t\t\ttakeUntil(panReleased$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst panUpdate$ = panStart$.pipe(\n\t\t\t\t\t\t\tmergeMap(() =>\n\t\t\t\t\t\t\t\ttrackPointers$.pipe(\n\t\t\t\t\t\t\t\t\tskip(1),\n\t\t\t\t\t\t\t\t\tmap(({ event, pointers }) => ({\n\t\t\t\t\t\t\t\t\t\ttype: \"move\" as const,\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tlatestActivePointers: pointers,\n\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttakeUntil(panReleased$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst panEnd$ = panStart$.pipe(\n\t\t\t\t\t\t\tmergeMap(() =>\n\t\t\t\t\t\t\t\tpanReleased$.pipe(\n\t\t\t\t\t\t\t\t\tmap(({ event, pointers }) => ({\n\t\t\t\t\t\t\t\t\t\ttype: \"end\" as const,\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tlatestActivePointers: pointers,\n\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst rawEvent$ = merge(panStart$, panUpdate$, panEnd$).pipe(\n\t\t\t\t\t\t\tshareLatest(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn rawEvent$.pipe(\n\t\t\t\t\t\t\tscanToRecognizerEvent,\n\t\t\t\t\t\t\twithLatestFrom(rawEvent$),\n\t\t\t\t\t\t\tmap(([recognizerEvent, { type }]) => ({\n\t\t\t\t\t\t\t\t...recognizerEvent,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.panStart$ = this.pan$.pipe(\n\t\t\tfilter((event) => event.type === \"start\"),\n\t\t\tmap(({ type, ...rest }) => rest),\n\t\t);\n\n\t\tthis.panMove$ = this.pan$.pipe(\n\t\t\tfilter((event) => event.type === \"move\"),\n\t\t\tmap(({ type, ...rest }) => rest),\n\t\t);\n\n\t\tthis.panEnd$ = this.pan$.pipe(\n\t\t\tfilter((event) => event.type === \"end\"),\n\t\t\tmap(({ type, ...rest }) => rest),\n\t\t);\n\n\t\tthis.state$ = this.stateSubject.pipe(\n\t\t\tdistinctUntilChanged(\n\t\t\t\t(previous, current) => previous.fingers === current.fingers,\n\t\t\t),\n\t\t);\n\n\t\tthis.updateInternal(config ?? {}, panConfig);\n\t}\n\n\tprivate updateInternal(\n\t\tconfig: Partial<RecognizerConfig<Options>>,\n\t\tpanConfig?: PanConfig,\n\t) {\n\t\tconst existingConfig = this.configSubject.getValue();\n\n\t\tthis.configSubject.next({\n\t\t\t...existingConfig,\n\t\t\t...config,\n\t\t\t...(config.options && {\n\t\t\t\toptions: { ...existingConfig.options, ...config.options },\n\t\t\t}),\n\t\t\tpanConfig: {\n\t\t\t\t...existingConfig.panConfig,\n\t\t\t\t...panConfig,\n\t\t\t},\n\t\t});\n\t}\n\n\tpublic update(\n\t\tconfig: Partial<RecognizerConfig<Options>>,\n\t\tpanConfig?: PanConfig,\n\t) {\n\t\tthis.updateInternal(config, panConfig);\n\t}\n}\n","import {\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport type {\n\tHoldEvent,\n\tHoldRecognizerInterface,\n\tHoldRecognizerOptions,\n} from \"./HoldRecognizerInterface\";\n\nexport type { HoldEvent };\n\nexport class HoldRecognizer\n\textends Recognizer<HoldRecognizerOptions, HoldEvent>\n\timplements HoldRecognizerInterface\n{\n\tpublic events$: Observable<HoldEvent>;\n\n\tconstructor(options: RecognizerConfig<HoldRecognizerOptions> = {}) {\n\t\tsuper(options, {\n\t\t\tnumInputs: 1,\n\t\t\tdelay: 0,\n\t\t\tposThreshold: 0,\n\t\t\t...options.options,\n\t\t});\n\n\t\tconst start$ = this.panStart$.pipe(\n\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\tmap(([event]) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"holdStart\" as const,\n\t\t\t\t\t...event,\n\t\t\t\t};\n\t\t\t}),\n\t\t);\n\n\t\tthis.events$ = start$.pipe(\n\t\t\tswitchMap((holdStartEvent) => {\n\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\tfirst(),\n\t\t\t\t);\n\n\t\t\t\tconst end$ = this.panEnd$.pipe(\n\t\t\t\t\tfirst(),\n\t\t\t\t\tmap((event) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttype: \"holdEnd\" as const,\n\t\t\t\t\t\t\t...event,\n\t\t\t\t\t\t};\n\t\t\t\t\t}),\n\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t);\n\n\t\t\t\t// cancelled by failWith: it ends where it started\n\t\t\t\tconst trailingEndEventIfFailed$ = failingActive$.pipe(\n\t\t\t\t\tmap(() => ({ ...holdStartEvent, type: \"holdEnd\" as const })),\n\t\t\t\t\ttakeUntil(this.panEnd$),\n\t\t\t\t);\n\n\t\t\t\treturn merge(of(holdStartEvent), end$, trailingEndEventIfFailed$);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"holdEnd\"),\n\t\t\tshare(),\n\t\t);\n\t}\n\n\tpublic update(options: RecognizerConfig<HoldRecognizerOptions>) {\n\t\tsuper.update(options, options.options);\n\t}\n}\n","import {\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\ttap,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport type {\n\tPanEvent,\n\tPanRecognizerInterface,\n\tPanRecognizerOptions,\n} from \"./PanRecognizerInterface\";\n\nexport type { PanEvent };\n\nexport class PanRecognizer\n\textends Recognizer<PanRecognizerOptions, PanEvent>\n\timplements PanRecognizerInterface\n{\n\tpublic events$: Observable<PanEvent>;\n\tpublic start$: Observable<PanEvent>;\n\tpublic end$: Observable<PanEvent>;\n\n\tconstructor(config?: RecognizerConfig<PanRecognizerOptions>) {\n\t\tsuper(config, {\n\t\t\t...config?.options,\n\t\t\tposThreshold: config?.options?.posThreshold ?? 15,\n\t\t});\n\n\t\tconst panStart$ = this.panStart$.pipe(\n\t\t\tmap((event) => ({\n\t\t\t\ttype: \"panStart\" as const,\n\t\t\t\t...event,\n\t\t\t})),\n\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\tmap(([event]) => event),\n\t\t\tshare(),\n\t\t);\n\n\t\tconst panEnd$ = this.panEnd$.pipe(\n\t\t\tmap((event) => ({\n\t\t\t\ttype: \"panEnd\" as const,\n\t\t\t\t...event,\n\t\t\t})),\n\t\t\tshare(),\n\t\t);\n\n\t\tconst panMove$ = this.panMove$.pipe(\n\t\t\tmap((event) => ({\n\t\t\t\ttype: \"panMove\" as const,\n\t\t\t\t...event,\n\t\t\t})),\n\t\t);\n\n\t\tthis.events$ = panStart$.pipe(\n\t\t\tswitchMap((panStartEvent) => {\n\t\t\t\tlet latestEvent: PanEvent = panStartEvent;\n\n\t\t\t\tconst panStarted$ = of(panStartEvent);\n\n\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\tfirst(),\n\t\t\t\t);\n\n\t\t\t\tconst events$ = merge(panStarted$, panMove$, panEnd$).pipe(\n\t\t\t\t\ttap((event) => {\n\t\t\t\t\t\tlatestEvent = event;\n\t\t\t\t\t}),\n\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t);\n\n\t\t\t\tconst trailingEndEventIfFailed$ = failingActive$.pipe(\n\t\t\t\t\tmap(() => ({\n\t\t\t\t\t\t...latestEvent,\n\t\t\t\t\t\ttype: \"panEnd\" as const,\n\t\t\t\t\t})),\n\t\t\t\t\ttakeUntil(panEnd$),\n\t\t\t\t);\n\n\t\t\t\treturn merge(events$, trailingEndEventIfFailed$);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"panEnd\"),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.start$ = this.events$.pipe(\n\t\t\tfilter((event) => event.type === \"panStart\"),\n\t\t);\n\n\t\tthis.end$ = this.events$.pipe(filter((event) => event.type === \"panEnd\"));\n\t}\n\n\tpublic update(config: RecognizerConfig<PanRecognizerOptions>) {\n\t\tsuper.update(config, config.options);\n\t}\n}\n","import { map, type Observable, scan } from \"rxjs\";\nimport type { RecognizerEvent } from \"../recognizer/RecognizerEvent\";\nimport type { PinchEvent } from \"./PinchRecognizerInterface\";\n\n/**\n * What the scale and distance are measured from: an average distance between\n * the fingers, and the scale and distance reached there.\n */\ntype Reference = Pick<\n\tPinchEvent,\n\t\"pointersAverageDistance\" | \"scale\" | \"distance\"\n>;\n\nexport const scanPanEventToPinchEvent =\n\t({\n\t\ttype,\n\t\tinitialEvent,\n\t}: {\n\t\ttype: PinchEvent[\"type\"];\n\t\tinitialEvent: PinchEvent | RecognizerEvent | undefined;\n\t}) =>\n\t(stream: Observable<RecognizerEvent | PinchEvent>) =>\n\t\tstream.pipe(\n\t\t\tscan<\n\t\t\t\tRecognizerEvent | PinchEvent,\n\t\t\t\tPinchEvent & {\n\t\t\t\t\treference: Reference;\n\t\t\t\t},\n\t\t\t\tPinchEvent | RecognizerEvent | undefined\n\t\t\t>((acc, curr) => {\n\t\t\t\tconst previousPointersLength = acc?.pointers.length ?? 0;\n\t\t\t\tconst hasChangedFingers =\n\t\t\t\t\tpreviousPointersLength !== curr.pointers.length;\n\t\t\t\tconst previousPointersAverageDistance =\n\t\t\t\t\tacc?.pointersAverageDistance ?? curr.pointersAverageDistance;\n\n\t\t\t\t/**\n\t\t\t\t * The reference is reset every time we change fingers, as the average\n\t\t\t\t * distance between 3 fingers can't be compared with the one between 2:\n\t\t\t\t * the scale and distance reached carry over. Otherwise it is the one\n\t\t\t\t * of the event we continue from (the pinch start for the first move).\n\t\t\t\t * @important in case of 1 finger, distance will be 0\n\t\t\t\t */\n\t\t\t\tconst reference: Reference =\n\t\t\t\t\t!hasChangedFingers && acc && \"reference\" in acc\n\t\t\t\t\t\t? acc.reference\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tpointersAverageDistance: hasChangedFingers\n\t\t\t\t\t\t\t\t\t? curr.pointersAverageDistance\n\t\t\t\t\t\t\t\t\t: previousPointersAverageDistance,\n\t\t\t\t\t\t\t\tscale: acc && \"scale\" in acc ? acc.scale : 1,\n\t\t\t\t\t\t\t\tdistance: acc && \"distance\" in acc ? acc.distance : 0,\n\t\t\t\t\t\t\t};\n\n\t\t\t\t/**\n\t\t\t\t * @important When finger is 1, distance is 0\n\t\t\t\t */\n\t\t\t\tconst scale =\n\t\t\t\t\treference.pointersAverageDistance === 0\n\t\t\t\t\t\t? reference.scale\n\t\t\t\t\t\t: reference.scale *\n\t\t\t\t\t\t\t(curr.pointersAverageDistance /\n\t\t\t\t\t\t\t\treference.pointersAverageDistance);\n\n\t\t\t\tconst distance =\n\t\t\t\t\treference.distance +\n\t\t\t\t\t(curr.pointersAverageDistance - reference.pointersAverageDistance);\n\n\t\t\t\tconst deltaDistance = hasChangedFingers\n\t\t\t\t\t? 0\n\t\t\t\t\t: curr.pointersAverageDistance - previousPointersAverageDistance;\n\n\t\t\t\t/**\n\t\t\t\t * @important When finger is 1, distance is 0\n\t\t\t\t * Same when fingers change\n\t\t\t\t */\n\t\t\t\tconst deltaDistanceScale =\n\t\t\t\t\thasChangedFingers || previousPointersAverageDistance === 0\n\t\t\t\t\t\t? 1\n\t\t\t\t\t\t: curr.pointersAverageDistance / previousPointersAverageDistance;\n\n\t\t\t\treturn {\n\t\t\t\t\t...acc,\n\t\t\t\t\t...curr,\n\t\t\t\t\ttype,\n\t\t\t\t\treference,\n\t\t\t\t\tscale,\n\t\t\t\t\tdistance,\n\t\t\t\t\tdeltaDistance,\n\t\t\t\t\tdeltaDistanceScale,\n\t\t\t\t};\n\t\t\t}, initialEvent),\n\t\t\tmap(({ reference, ...rest }): PinchEvent => rest),\n\t\t);\n","import {\n\tdefaultIfEmpty,\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\ttakeWhile,\n\ttap,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { shareLatest } from \"../utils/operators\";\nimport type {\n\tPinchEvent,\n\tPinchRecognizerInterface,\n\tPinchRecognizerOptions,\n} from \"./PinchRecognizerInterface\";\nimport { scanPanEventToPinchEvent } from \"./scanPanEventToPinchEvent\";\n\nexport type { PinchEvent } from \"./PinchRecognizerInterface\";\n\nexport class PinchRecognizer\n\textends Recognizer<PinchRecognizerOptions, PinchEvent>\n\timplements PinchRecognizerInterface\n{\n\tpublic events$: Observable<PinchEvent>;\n\n\tpublic start$: Observable<PinchEvent>;\n\tpublic end$: Observable<PinchEvent>;\n\n\tconstructor(config?: RecognizerConfig<PinchRecognizerOptions>) {\n\t\tsuper(config, {\n\t\t\t...config?.options,\n\t\t\tnumInputs: 2,\n\t\t});\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap(() => {\n\t\t\t\tlet latestPinchEvent: PinchEvent | undefined;\n\n\t\t\t\tconst pinchStarted$ = this.panStart$.pipe(\n\t\t\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\t\t\tmap(([event]) => event),\n\t\t\t\t\tswitchMap((event) =>\n\t\t\t\t\t\tof(event).pipe(\n\t\t\t\t\t\t\t// we don't want a scan on pinch start\n\t\t\t\t\t\t\tscanPanEventToPinchEvent({\n\t\t\t\t\t\t\t\ttype: \"pinchStart\",\n\t\t\t\t\t\t\t\tinitialEvent: undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\tfirst(),\n\t\t\t\t);\n\n\t\t\t\tconst pinchMove$ = pinchStarted$.pipe(\n\t\t\t\t\tswitchMap((initialEvent) => {\n\t\t\t\t\t\treturn this.pan$.pipe(\n\t\t\t\t\t\t\ttakeWhile((event) => event.type !== \"end\"),\n\t\t\t\t\t\t\tscanPanEventToPinchEvent({\n\t\t\t\t\t\t\t\ttype: \"pinchMove\",\n\t\t\t\t\t\t\t\tinitialEvent,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t// only for this pinch, the next ones may move again\n\t\t\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst pinchEnd$ = pinchStarted$.pipe(\n\t\t\t\t\tswitchMap((pinchStartEvent) =>\n\t\t\t\t\t\tthis.pan$.pipe(\n\t\t\t\t\t\t\tfilter((event) => event.type === \"end\"),\n\t\t\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t\t\t\tdefaultIfEmpty(null),\n\t\t\t\t\t\t\tmap((endEvent) => {\n\t\t\t\t\t\t\t\tconst latestEvent = latestPinchEvent ?? pinchStartEvent;\n\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * It ends where it got to: lifting a finger leaves too few\n\t\t\t\t\t\t\t\t * to measure the distance, and a failWith cancelling it\n\t\t\t\t\t\t\t\t * moves none. So nothing changed since the latest event.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...(endEvent ?? latestEvent),\n\t\t\t\t\t\t\t\t\ttype: \"pinchEnd\" as const,\n\t\t\t\t\t\t\t\t\tscale: latestEvent.scale,\n\t\t\t\t\t\t\t\t\tdistance: latestEvent.distance,\n\t\t\t\t\t\t\t\t\tdeltaDistance: 0,\n\t\t\t\t\t\t\t\t\tdeltaDistanceScale: 1,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tshare(),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn merge(pinchStarted$, pinchMove$, pinchEnd$).pipe(\n\t\t\t\t\ttap((event) => {\n\t\t\t\t\t\tlatestPinchEvent = event;\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"pinchEnd\"),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.start$ = this.events$.pipe(\n\t\t\tfilter((event) => event.type === \"pinchStart\"),\n\t\t);\n\n\t\tthis.end$ = this.events$.pipe(filter((event) => event.type === \"pinchEnd\"));\n\t}\n\n\tpublic update(options: RecognizerConfig<PinchRecognizerOptions>) {\n\t\tsuper.update(options, options.options);\n\t}\n}\n","import {\n\tcombineLatest,\n\tdistinctUntilChanged,\n\tmap,\n\tmerge,\n\ttype Observable,\n\ttype ObservedValueOf,\n\tshare,\n} from \"rxjs\";\nimport type { Recognizer, RecognizerConfig } from \"../recognizer/Recognizer\";\nimport type {\n\tRecognizableInterface,\n\tRecognizableState,\n} from \"./RecognizableInterface\";\n\n// biome-ignore lint/suspicious/noExplicitAny: TODO\ntype RecognizableOptions<T extends Recognizer<any, any>[]> = {\n\trecognizers: T;\n\t/**\n\t * If you don't need to have text selection, set this to true\n\t * to improve dragging gesture. This will prevent accidental\n\t * text selection on your component.\n\t */\n\tdisableTextSelection?: boolean;\n} & RecognizerConfig<unknown>;\n\n// biome-ignore lint/suspicious/noExplicitAny: TODO\nexport class Recognizable<T extends Recognizer<any, any>[]>\n\timplements RecognizableInterface<T>\n{\n\tevents$: Observable<{\n\t\tevent: ObservedValueOf<T[number][\"events$\"]>;\n\t\trecognizer: T[number];\n\t}>;\n\n\trecognizers: T;\n\n\tstate$: Observable<RecognizableState>;\n\n\tconstructor(protected options: RecognizableOptions<T>) {\n\t\tthis.recognizers = options.recognizers;\n\n\t\tthis.events$ = merge(\n\t\t\t...options.recognizers.map((recognizer) =>\n\t\t\t\trecognizer.events$.pipe(map((event) => ({ event, recognizer }))),\n\t\t\t),\n\t\t).pipe(share());\n\n\t\tthis.state$ = combineLatest(\n\t\t\tthis.recognizers.map((recognizer) => recognizer.state$),\n\t\t).pipe(\n\t\t\tmap((states) =>\n\t\t\t\tstates.reduce((acc, state) => ({\n\t\t\t\t\tfingers: Math.max(acc.fingers, state.fingers),\n\t\t\t\t})),\n\t\t\t),\n\t\t\tdistinctUntilChanged(\n\t\t\t\t(previous, current) => previous.fingers === current.fingers,\n\t\t\t),\n\t\t);\n\n\t\tthis.update(options);\n\t}\n\n\tpublic update({\n\t\tdisableTextSelection,\n\t\t...rest\n\t}: Partial<Omit<RecognizableOptions<T>, \"recognizers\">>) {\n\t\tif (rest.container) {\n\t\t\t/**\n\t\t\t * We have to disable touch-action otherwise every events will be followed\n\t\t\t * by a cancel event since the browser will try to handle touch.\n\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action\n\t\t\t */\n\t\t\trest.container.style.touchAction = \"none\";\n\n\t\t\t/**\n\t\t\t * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n\t\t\t */\n\t\t\tif (disableTextSelection) {\n\t\t\t\trest.container.style.userSelect = \"none\";\n\t\t\t}\n\t\t}\n\n\t\tfor (const recognizer of this.options.recognizers) {\n\t\t\trecognizer.update(rest);\n\t\t}\n\t}\n}\n","import {\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tscan,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\ttap,\n\twithLatestFrom,\n} from \"rxjs\";\nimport {\n\tRecognizer,\n\ttype RecognizerConfig,\n\ttype RecognizerPanEvent,\n} from \"../recognizer/Recognizer\";\nimport { shareLatest } from \"../utils/operators\";\nimport type {\n\tRotateEvent,\n\tRotateRecognizerInterface,\n\tRotateRecognizerOptions,\n} from \"./RotateRecognizerInterface\";\n\nexport type { RotateEvent };\n\ntype RotatingEvent = RecognizerPanEvent & { angle: number; deltaAngle: number };\n\nexport class RotateRecognizer\n\textends Recognizer<RotateRecognizerOptions, RotateEvent>\n\timplements RotateRecognizerInterface\n{\n\tpublic events$: Observable<RotateEvent>;\n\n\tconstructor(config: RecognizerConfig<RotateRecognizerOptions> = {}) {\n\t\tsuper(config, {\n\t\t\tnumInputs: 2,\n\t\t\tposThreshold: 15,\n\t\t\t...config.options,\n\t\t});\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap(() => {\n\t\t\t\tconst rotateStart$ = this.panStart$.pipe(\n\t\t\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\t\t\tmap(([event]) => ({\n\t\t\t\t\t\t...event,\n\t\t\t\t\t\ttype: \"rotateStart\" as const,\n\t\t\t\t\t\tangle: 0,\n\t\t\t\t\t\tdeltaAngle: 0,\n\t\t\t\t\t})),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst rotate$ = rotateStart$.pipe(\n\t\t\t\t\tswitchMap((rotateStartEvent) => {\n\t\t\t\t\t\tlet latestEvent: RotatingEvent = {\n\t\t\t\t\t\t\t...rotateStartEvent,\n\t\t\t\t\t\t\ttype: \"start\",\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\t\t\tfirst(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst events$ = this.pan$.pipe(\n\t\t\t\t\t\t\tscan<RecognizerPanEvent, RotatingEvent, undefined>(\n\t\t\t\t\t\t\t\t(acc, current) => {\n\t\t\t\t\t\t\t\t\tconst angle = (acc?.angle ?? 0) + current.deltaPointersAngle;\n\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t\t\t...current,\n\t\t\t\t\t\t\t\t\t\tangle,\n\t\t\t\t\t\t\t\t\t\tdeltaAngle: current.deltaPointersAngle,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttap((event) => {\n\t\t\t\t\t\t\t\tlatestEvent = event;\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// cancelled by failWith: it ends on the angle it reached\n\t\t\t\t\t\tconst trailingEndEventIfFailed$ = failingActive$.pipe(\n\t\t\t\t\t\t\tmap(() => ({\n\t\t\t\t\t\t\t\t...latestEvent,\n\t\t\t\t\t\t\t\ttype: \"end\" as const,\n\t\t\t\t\t\t\t\tdeltaAngle: 0,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\ttakeUntil(this.panEnd$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn merge(events$, trailingEndEventIfFailed$);\n\t\t\t\t\t}),\n\t\t\t\t\tshare(),\n\t\t\t\t);\n\n\t\t\t\tconst rotateMove$ = rotate$.pipe(\n\t\t\t\t\tfilter((event) => event.type === \"move\"),\n\t\t\t\t\tmap((event) => ({ ...event, type: \"rotateMove\" as const })),\n\t\t\t\t);\n\n\t\t\t\tconst rotateEnd$ = rotate$.pipe(\n\t\t\t\t\tfilter((event) => event.type === \"end\"),\n\t\t\t\t\tmap((event) => ({ ...event, type: \"rotateEnd\" as const })),\n\t\t\t\t);\n\n\t\t\t\treturn merge(rotateStart$, rotateMove$, rotateEnd$);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"rotateEnd\"),\n\t\t\tshare(),\n\t\t);\n\t}\n\n\tpublic update(options: RecognizerConfig<RotateRecognizerOptions>) {\n\t\tsuper.update(options, options.options);\n\t}\n}\n","import { filter, type Observable } from \"rxjs\";\nimport type { RecognizerEvent } from \"../recognizer/RecognizerEvent\";\n\nexport const isRecognizedAsSwipe =\n\t(escapeVelocity: number) => (stream: Observable<RecognizerEvent>) =>\n\t\tstream.pipe(\n\t\t\tfilter((event) => {\n\t\t\t\treturn (\n\t\t\t\t\tMath.abs(event.velocityX) >= escapeVelocity ||\n\t\t\t\t\tMath.abs(event.velocityY) >= escapeVelocity\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n","import {\n\tfilter,\n\tmap,\n\ttype Observable,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { calculateDegreeAngleBetweenPoints } from \"../utils/geometry\";\nimport { isRecognizedAsSwipe } from \"./operators\";\nimport type {\n\tSwipeEvent,\n\tSwipeRecognizerInterface,\n\tSwipeRecognizerOptions,\n} from \"./SwipeRecognizerInterface\";\n\nexport type { SwipeEvent };\n\nexport class SwipeRecognizer\n\textends Recognizer<SwipeRecognizerOptions, SwipeEvent>\n\timplements SwipeRecognizerInterface\n{\n\tpublic events$: Observable<SwipeEvent>;\n\n\tconstructor(config?: RecognizerConfig<SwipeRecognizerOptions>) {\n\t\tsuper(config, {\n\t\t\tposThreshold: 0,\n\t\t\tnumInputs: 1,\n\t\t});\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap((initializedWith) => {\n\t\t\t\tconst { escapeVelocity = 0.9 } = initializedWith.options ?? {};\n\n\t\t\t\treturn this.panStart$.pipe(\n\t\t\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\t\t\tswitchMap(([startEvent]) => {\n\t\t\t\t\t\treturn this.panEnd$.pipe(\n\t\t\t\t\t\t\tisRecognizedAsSwipe(escapeVelocity),\n\t\t\t\t\t\t\tmap((event) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: \"swipe\" as const,\n\t\t\t\t\t\t\t\t\tangle: calculateDegreeAngleBetweenPoints(\n\t\t\t\t\t\t\t\t\t\tstartEvent.event,\n\t\t\t\t\t\t\t\t\t\tevent.event,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t...event,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\ttakeUntil(\n\t\t\t\t\t\t\t\tthis.failWithActive$.pipe(filter((isActive) => isActive)),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t\tshare(),\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic update(config: RecognizerConfig<SwipeRecognizerOptions>) {\n\t\tsuper.update(config);\n\t}\n}\n","import {\n\tfilter,\n\tmergeMap,\n\ttype Observable,\n\ttakeUntil,\n\ttakeWhile,\n\ttimer,\n} from \"rxjs\";\nimport { filterPointerOff } from \"../recognizer/operators\";\nimport { isPointerOffEvent, matchPointer } from \"../utils/events\";\nimport { isWithinPosThreshold } from \"../utils/utils\";\n\nexport const takeWhenPressedTooLong =\n\t({\n\t\ttimeout,\n\t\tpointerEvent$,\n\t}: {\n\t\ttimeout: number;\n\t\tpointerEvent$: Observable<PointerEvent>;\n\t}) =>\n\t(stream: Observable<PointerEvent>) =>\n\t\tstream.pipe(\n\t\t\tmergeMap((pointerDown) =>\n\t\t\t\ttimer(timeout).pipe(\n\t\t\t\t\ttakeUntil(\n\t\t\t\t\t\tpointerEvent$.pipe(filterPointerOff, matchPointer(pointerDown)),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\nexport const takeWhenOutsideThreshold =\n\t({\n\t\tinitialPointerEvent,\n\t\tpointerEvent$,\n\t\ttolerance,\n\t}: {\n\t\tinitialPointerEvent: PointerEvent;\n\t\ttolerance: number;\n\t\tpointerEvent$: Observable<PointerEvent>;\n\t}) =>\n\t(stream: Observable<PointerEvent>) =>\n\t\tstream.pipe(\n\t\t\tmergeMap((pointerDown) =>\n\t\t\t\tpointerEvent$.pipe(\n\t\t\t\t\tmatchPointer(pointerDown),\n\t\t\t\t\ttakeWhile((event) => !isPointerOffEvent(event), true),\n\t\t\t\t\tfilter((event) =>\n\t\t\t\t\t\tisWithinPosThreshold(initialPointerEvent, event, tolerance),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n","import {\n\tbuffer,\n\tdebounceTime,\n\texhaustMap,\n\tfilter,\n\tfirst,\n\tignoreElements,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { scanToRecognizerEvent } from \"../recognizer/scanToRecognizerEvent\";\nimport { trackPointers } from \"../utils/events\";\nimport { shareLatest } from \"../utils/operators\";\nimport { filterNotEmpty } from \"../utils/utils\";\nimport { takeWhenOutsideThreshold, takeWhenPressedTooLong } from \"./operators\";\nimport type {\n\tTapEvent,\n\tTapRecognizerInterface,\n\tTapRecognizerOptions,\n} from \"./TapRecognizerInterface\";\n\nexport type { TapEvent };\n\nexport class TapRecognizer\n\textends Recognizer<TapRecognizerOptions, TapEvent>\n\timplements TapRecognizerInterface\n{\n\tpublic events$: Observable<TapEvent>;\n\n\tconstructor(options?: RecognizerConfig<TapRecognizerOptions>) {\n\t\tsuper(options);\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap((config) => {\n\t\t\t\tconst maxTaps = config.options?.maxTaps ?? 1;\n\t\t\t\t/**\n\t\t\t\t * We default to reasonable multiplier of 100 to give time\n\t\t\t\t * for each tap\n\t\t\t\t */\n\t\t\t\tconst multiTapThreshold =\n\t\t\t\t\tconfig.options?.multiTapThreshold ?? 100 * (maxTaps - 1);\n\n\t\t\t\tconst { maximumPressTime = 150, tolerance = 10 } = config.options ?? {};\n\n\t\t\t\tconst activePointers$ = this.pointerDown$.pipe(\n\t\t\t\t\ttrackPointers({\n\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\ttrackMove: true,\n\t\t\t\t\t}),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst hasMoreThanOneActivePointer$ = activePointers$.pipe(\n\t\t\t\t\tfilter(({ pointers }) => pointers.length > 1),\n\t\t\t\t);\n\n\t\t\t\t/**\n\t\t\t\t * Collects the presses until `multiTapThreshold` after a release\n\t\t\t\t * that no press followed: a press still down is part of the taps.\n\t\t\t\t */\n\t\t\t\tconst bufferPointerDowns = (stream: Observable<PointerEvent>) =>\n\t\t\t\t\tstream.pipe(\n\t\t\t\t\t\tbuffer(\n\t\t\t\t\t\t\tmerge(this.pointerDown$, this.pointerUp$).pipe(\n\t\t\t\t\t\t\t\tdebounceTime(multiTapThreshold),\n\t\t\t\t\t\t\t\tfilter((event) => event.type === \"pointerup\"),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfirst(),\n\t\t\t\t\t);\n\n\t\t\t\tconst tap$ = merge(\n\t\t\t\t\tthis.pointerDown$,\n\t\t\t\t\tactivePointers$.pipe(ignoreElements()),\n\t\t\t\t).pipe(\n\t\t\t\t\texhaustMap((initialPointerEvent) => {\n\t\t\t\t\t\tconst pointerDowns$ = merge(\n\t\t\t\t\t\t\tof(initialPointerEvent),\n\t\t\t\t\t\t\tthis.pointerDown$,\n\t\t\t\t\t\t).pipe(shareLatest());\n\n\t\t\t\t\t\tconst pointerDownsBuffered$ =\n\t\t\t\t\t\t\tpointerDowns$.pipe(bufferPointerDowns);\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Exit condition for `tolerance`\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst clickedTooFarFromOriginalTap$ = pointerDowns$.pipe(\n\t\t\t\t\t\t\ttakeWhenOutsideThreshold({\n\t\t\t\t\t\t\t\tinitialPointerEvent,\n\t\t\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\t\t\ttolerance,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Exit condition for `maximumPressTime`\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst hasFingersPressedForTooLong$ = pointerDowns$.pipe(\n\t\t\t\t\t\t\ttakeWhenPressedTooLong({\n\t\t\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\t\t\ttimeout: maximumPressTime,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst takeUntil$ = merge(\n\t\t\t\t\t\t\tthis.failWithActive$.pipe(filter((active) => active)),\n\t\t\t\t\t\t\tthis.pointerCancel$,\n\t\t\t\t\t\t\thasMoreThanOneActivePointer$,\n\t\t\t\t\t\t\tclickedTooFarFromOriginalTap$,\n\t\t\t\t\t\t\thasFingersPressedForTooLong$,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst rawEvent$ = pointerDownsBuffered$.pipe(\n\t\t\t\t\t\t\tfilterNotEmpty,\n\t\t\t\t\t\t\tfilter((events) => events.length <= maxTaps),\n\t\t\t\t\t\t\tmap((events) => {\n\t\t\t\t\t\t\t\t// the finger, where it last pressed: `taps` counts the presses\n\t\t\t\t\t\t\t\tconst lastPress = events[events.length - 1] ?? events[0];\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: \"tap\" as const,\n\t\t\t\t\t\t\t\t\ttaps: events.length,\n\t\t\t\t\t\t\t\t\tlatestActivePointers: [lastPress],\n\t\t\t\t\t\t\t\t\tevent: lastPress,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tshareLatest(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn rawEvent$.pipe(\n\t\t\t\t\t\t\tscanToRecognizerEvent,\n\t\t\t\t\t\t\twithLatestFrom(rawEvent$),\n\t\t\t\t\t\t\tmap(([recognizerEvent, { type, taps }]) => ({\n\t\t\t\t\t\t\t\t...recognizerEvent,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\ttaps,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\ttakeUntil(takeUntil$),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\treturn tap$;\n\t\t\t}),\n\t\t\tshare(),\n\t\t);\n\t}\n\n\tpublic update(config: RecognizerConfig<TapRecognizerOptions>): void {\n\t\tsuper.update(config);\n\t}\n}\n"],"mappings":";;AAEA,SAAgBA,EAAkB,GAAe,GAAuB;CACvE,OAAO,KAAK,MAAMC,EAAO,IAAIC,EAAO,MAAM,KAAKD,EAAO,IAAIC,EAAO,MAAM,CAAC;AACzE;AAEA,SAAgBC,EAAyB,GAAgC;CACxE,IAAMC,IAAIC,EAAc;CAcxB,OAbID,IAAI,IAAU,IAEIC,EAAc,QAAQ,GAAK,GAAQ,MAEvDC,IACAD,EAAc,MAAME,IAAI,CAAC,CAAC,CAAC,QAAQ,GAAU,MACrCC,IAAWR,EAAkBS,GAAQC,CAAM,GAChD,CAAC,GAEH,CAII,KADgBN,KAAKA,IAAI,KAAM;AAEvC;AAEA,SAAgBO,EACf,GACA,GACS;CAET,IAAMC,IAASC,EAAS,IAAI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Q,MAAWH,EAAO,UAAUwK,CAAO,GAC3ClJ,GAAK,MAAW;KAEf,IAAMiK,IAAYvL,EAAOA,EAAO,SAAS,MAAMA,EAAO;KAEtD,OAAO;MACN,MAAM;MACN,MAAMA,EAAO;MACb,sBAAsB,CAACuL,CAAS;MAChC,OAAOA;KACR;IACD,CAAC,GACD5I,EAAY,CACb;IAEA,OAAOoE,EAAU,KAChB1D,GACAqD,EAAeK,CAAS,GACxBzF,GAAK,CAAC0F,GAAiB,EAAE,SAAM,gBAAa;KAC3C,GAAGA;KACH;KACA;IACD,EAAE,GACFL,EAAU0E,CAAU,CACrB;GACD,CAAC,CAGK;EACR,CAAC,GACDrG,EAAM,CACP;CACD;CAEA,OAAc,GAAsD;EACnE,MAAM,OAAOlC,CAAM;CACpB;AACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["calculateDistance","pointB","pointA","calculateAverageDistance","n","pointerEvents","sum","i","innerSum","event1","event2","calculateRadianAngleBetweenPoints","deltaX","pointerB","pointerA","deltaY","calculateDegreeAngleBetweenPoints","calculateCentroid","points","point","acc","numPoints","calculateAngleDelta","initialPoints","newPoints","initialCentroid","newCentroid","totalAngleDelta","initialAngle","initialPoint","angleDelta","index","radianDelta","isDefined","arg","omitUnset","values","value","hasAtLeastOneItem","events","filterNotEmpty","stream","filter","isWithinPosThreshold","start","startEvent","end","endEvent","posThreshold","calculateVelocity","delay","matchPointer","newPointer","pointer","isPointerOffEvent","pointerEvent","isPrimaryButtonPress","event","fromPointerDown","fromEvent","container","map","afterEventReceived","trackPointers","pointerUp$","pointerEvent$","pointerLeave$","pointerCancel$","pointerMove$","contextMenu$","isPointerRemoved","mergeMap","pointerDown$","defer","of","pointerDown","merge","takeWhile","scan","_deleted","rest","pointers","shareLatest","shareReplay","isValidConfig","config","filterPointerOff","calculateNewDelta","newCenter","prevCenter","prevDeltaX","prevDeltaY","scanToRecognizerEvent","getCenterFromData","data","_acc$latestActivePoin","_curr$latestActivePoi","curr","prevActivePointersNumber","currActivePointersNumber","deltaPointersAngle","latestActivePointers","startTime","getPointerEvents","_typeof","o","toPrimitive","t","e","r","toPropertyKey","_defineProperty","Recognizer","BehaviorSubject","events$","tap","isEnd","finalize","switchMap","share","failWith$","failWith","distinctUntilChanged","areRunnings$","start$","recognizer","end$","startWith","combineLatest","runnings","running","_config$panConfig","_config$panConfig2","_config$panConfig3","numInputs","trackPointers$","hasEnoughFingers","hasNotEnoughFingers","exhaustMap","initialPointerEvents","panReleased$","first","delay$","timer","panStart$","withLatestFrom","takeUntil","panUpdate$","skip","panEnd$","rawEvent$","recognizerEvent","previous","current","panConfig","existingConfig","HoldRecognizer","options","failWithActive","failingActive$","isActive","trailingEndEventIfFailed$","holdStartEvent","PanRecognizer","panMove$","latestEvent","panStartEvent","panStarted$","scanPanEventToPinchEvent","hasChangedFingers","previousPointersAverageDistance","reference","scale","distance","deltaDistance","deltaDistanceScale","initialEvent","PinchRecognizer","latestPinchEvent","pinchStarted$","pinchMove$","pinchEnd$","defaultIfEmpty","pinchStartEvent","Recognizable","states","state","disableTextSelection","RotateRecognizer","rotateStart$","rotate$","rotateStartEvent","angle","rotateMove$","rotateEnd$","isRecognizedAsSwipe","escapeVelocity","SwipeRecognizer","initializedWith","takeWhenPressedTooLong","timeout","takeWhenOutsideThreshold","initialPointerEvent","tolerance","TapRecognizer","_config$options","_config$options2","maxTaps","multiTapThreshold","activePointers$","hasMoreThanOneActivePointer$","bufferPointerDowns","buffer","debounceTime","ignoreElements","pointerDowns$","pointerDownsBuffered$","clickedTooFarFromOriginalTap$","hasFingersPressedForTooLong$","maximumPressTime","takeUntil$","active","lastPress"],"sources":["../src/core/utils/geometry.ts","../src/core/utils/utils.ts","../src/core/utils/events.ts","../src/core/utils/operators.ts","../src/core/recognizer/operators.ts","../src/core/recognizer/scanToRecognizerEvent.ts","../src/core/recognizer/utils.ts","../src/core/recognizer/Recognizer.ts","../src/core/hold/HoldRecognizer.ts","../src/core/pan/PanRecognizer.ts","../src/core/pinch/scanPanEventToPinchEvent.ts","../src/core/pinch/PinchRecognizer.ts","../src/core/recognizable/Recognizable.ts","../src/core/rotate/RotateRecognizer.ts","../src/core/swipe/operators.ts","../src/core/swipe/SwipeRecognizer.ts","../src/core/tap/operators.ts","../src/core/tap/TapRecognizer.ts"],"sourcesContent":["export type Point = { x: number; y: number };\n\nexport function calculateDistance(pointA: Point, pointB: Point): number {\n\treturn Math.sqrt((pointB.x - pointA.x) ** 2 + (pointB.y - pointA.y) ** 2);\n}\n\nexport function calculateAverageDistance(pointerEvents: Point[]): number {\n\tconst n = pointerEvents.length;\n\tif (n < 2) return 0; // No distance if fewer than 2 pointers\n\n\tconst totalDistance = pointerEvents.reduce((sum, event1, i) => {\n\t\treturn (\n\t\t\tsum +\n\t\t\tpointerEvents.slice(i + 1).reduce((innerSum, event2) => {\n\t\t\t\treturn innerSum + calculateDistance(event1, event2);\n\t\t\t}, 0)\n\t\t);\n\t}, 0);\n\n\t// Number of pairs is n choose 2: n * (n - 1) / 2\n\tconst numberOfPairs = (n * (n - 1)) / 2;\n\treturn totalDistance / numberOfPairs;\n}\n\nexport function calculateRadianAngleBetweenPoints(\n\tpointerA: Point,\n\tpointerB: Point,\n): number {\n\t// Calculate the differences in coordinates\n\tconst deltaX = pointerB.x - pointerA.x;\n\tconst deltaY = pointerB.y - pointerA.y;\n\n\t// Calculate the angle in radians\n\tconst angleInRadians = Math.atan2(deltaY, deltaX);\n\n\t// Return the angle in degrees\n\treturn angleInRadians;\n}\n\nexport function calculateDegreeAngleBetweenPoints(\n\tpointerA: Point,\n\tpointerB: Point,\n): number {\n\t// Calculate the angle in radians\n\tconst angleInRadians = calculateRadianAngleBetweenPoints(pointerA, pointerB);\n\n\t// Convert the angle to degrees (optional)\n\tconst angleInDegrees = angleInRadians * (180 / Math.PI);\n\n\t// Return the angle in degrees\n\treturn angleInDegrees;\n}\n\nexport function calculateCentroid(points: Point[]) {\n\tconst sum = points.reduce(\n\t\t(acc, point) => {\n\t\t\tacc.x += point.x;\n\t\t\tacc.y += point.y;\n\n\t\t\treturn acc;\n\t\t},\n\t\t{ x: 0, y: 0 },\n\t);\n\n\tconst numPoints = points.length || 1;\n\n\treturn {\n\t\tx: sum.x / numPoints,\n\t\ty: sum.y / numPoints,\n\t};\n}\n\nexport function calculateAngleDelta(\n\tinitialPoints: Point[],\n\tnewPoints: Point[],\n) {\n\tif (initialPoints.length !== newPoints.length) {\n\t\tthrow new Error(\"Initial and new points arrays must have the same length.\");\n\t}\n\n\tconst initialCentroid = calculateCentroid(initialPoints);\n\tconst newCentroid = calculateCentroid(newPoints);\n\n\tlet totalAngleDelta = 0;\n\n\tinitialPoints.forEach((initialPoint, index) => {\n\t\tconst initialAngle = calculateRadianAngleBetweenPoints(\n\t\t\tinitialCentroid,\n\t\t\tinitialPoint,\n\t\t);\n\t\tconst newAngle = calculateRadianAngleBetweenPoints(\n\t\t\tnewCentroid,\n\t\t\tnewPoints[index] ?? initialPoint,\n\t\t);\n\n\t\tlet angleDelta = newAngle - initialAngle;\n\n\t\t// Normalize the angle delta to be within [-PI, PI]\n\t\tif (angleDelta > Math.PI) {\n\t\t\tangleDelta -= 2 * Math.PI;\n\t\t} else if (angleDelta < -Math.PI) {\n\t\t\tangleDelta += 2 * Math.PI;\n\t\t}\n\n\t\ttotalAngleDelta += angleDelta;\n\t});\n\n\t// Return the average angle delta\n\tconst radianDelta = totalAngleDelta / initialPoints.length;\n\tconst degreesDelta = radianDelta * (180 / Math.PI);\n\n\treturn { radianDelta, degreesDelta };\n}\n","import { filter, type Observable } from \"rxjs\";\nimport { calculateCentroid } from \"./geometry\";\n\nexport function isDefined<T>(\n\targ: T | null | undefined,\n): arg is T extends null | undefined ? never : T {\n\treturn arg !== null && arg !== undefined;\n}\n\n/**\n * `values` without the ones that aren't set: `undefined`, as forwarding an\n * optional value passes, or `NaN`, as `parseInt` gives for an empty field.\n * Spread over defaults or current values, they then leave them alone.\n */\nexport const omitUnset = <T extends object>(values: T | undefined) =>\n\tObject.fromEntries(\n\t\tObject.entries(values ?? {}).filter(\n\t\t\t([, value]) => value !== undefined && !Number.isNaN(value),\n\t\t),\n\t) as Partial<T>;\n\nexport const hasAtLeastOneItem = <T>(events: T[]): events is [T, ...T[]] =>\n\tevents.length > 0;\n\nexport const filterNotEmpty = <T>(\n\tstream: Observable<T[]>,\n): Observable<[T, ...T[]]> => stream.pipe(filter(hasAtLeastOneItem));\n\nexport function isWithinPosThreshold(\n\tstartEvent: PointerEvent,\n\tendEvent: PointerEvent,\n\tposThreshold: number,\n) {\n\tconst start = calculateCentroid([startEvent]);\n\tconst end = calculateCentroid([endEvent]);\n\n\t// Determines if the movement qualifies as a drag\n\treturn (\n\t\tMath.abs(end.x - start.x) >= posThreshold ||\n\t\tMath.abs(end.y - start.y) >= posThreshold\n\t);\n}\n\n/**\n * Avoid division by zero\n * Calculate velocity in pixels per second\n */\nexport const calculateVelocity = (\n\tdelay: number,\n\tdeltaX: number,\n\tdeltaY: number,\n) => {\n\tconst velocityX = delay > 0 ? deltaX / delay : 0;\n\tconst velocityY = delay > 0 ? deltaY / delay : 0;\n\n\treturn {\n\t\tvelocityX,\n\t\tvelocityY,\n\t};\n};\n","import {\n\tdefer,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tmerge,\n\tmergeMap,\n\ttype Observable,\n\tof,\n\tscan,\n\ttakeWhile,\n} from \"rxjs\";\nimport { isDefined } from \"./utils\";\n\nexport function matchPointer(pointer: PointerEvent) {\n\treturn (stream: Observable<PointerEvent>) =>\n\t\tstream.pipe(\n\t\t\tfilter((newPointer) => newPointer.pointerId === pointer.pointerId),\n\t\t);\n}\n\nexport const isPointerOffEvent = (pointerEvent: PointerEvent) =>\n\tpointerEvent.type === \"pointerleave\" ||\n\tpointerEvent.type === \"pointercancel\" ||\n\tpointerEvent.type === \"pointerup\";\n\n/**\n * A press of the primary button: a left click, a finger or a pen's tip. A\n * right click is for the context menu, a middle click for the browser, and a\n * pen's barrel button or eraser for the app.\n *\n * @see https://w3c.github.io/pointerevents/#the-button-property\n */\nconst isPrimaryButtonPress = (event: PointerEvent) => event.button === 0;\n\n/**\n * The presses that start a gesture. Every recognizer tracks a pointer from its\n * press, so a pointer pressed with another button starts none: no tap, pan or\n * pinch, and no share of a multi tap.\n */\nexport const fromPointerDown = ({\n\tcontainer,\n\tafterEventReceived = (event) => event,\n}: {\n\tcontainer: HTMLElement;\n\tafterEventReceived?: (event: PointerEvent) => PointerEvent;\n}) =>\n\tfromEvent<PointerEvent>(container, \"pointerdown\").pipe(\n\t\tmap(afterEventReceived),\n\t\tfilter(isPrimaryButtonPress),\n\t);\n\n/**\n * Track all pointerEvent for active fingers\n */\nexport const trackPointers =\n\t({\n\t\tpointerEvent$,\n\t}: {\n\t\tpointerEvent$: Observable<PointerEvent>;\n\t\t/**\n\t\t * Setting this value to false will not update the list\n\t\t * on pointer move. Use it if you only need to track number of active\n\t\t * fingers.\n\t\t */\n\t\ttrackMove: boolean;\n\t}) =>\n\t(stream: Observable<PointerEvent>) => {\n\t\ttype PointersState = {\n\t\t\tevent: PointerEvent;\n\t\t\tpointers: Record<number, PointerEvent | undefined>;\n\t\t};\n\n\t\tconst pointerUp$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerup\"),\n\t\t);\n\t\tconst pointerLeave$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerleave\"),\n\t\t);\n\t\tconst pointerCancel$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointercancel\"),\n\t\t);\n\t\tconst pointerMove$ = pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointermove\"),\n\t\t);\n\t\tconst contextMenu$ = fromEvent<PointerEvent>(window, \"contextmenu\");\n\n\t\tconst isPointerRemoved = (event: PointerEvent) =>\n\t\t\t[\"pointercancel\", \"pointerleave\", \"pointerup\", \"contextmenu\"].includes(\n\t\t\t\tevent.type,\n\t\t\t);\n\n\t\treturn stream.pipe(\n\t\t\tmergeMap((pointerDown) => {\n\t\t\t\tconst pointerDown$ = defer(() => of(pointerDown));\n\n\t\t\t\tconst tracking$ = merge(\n\t\t\t\t\tpointerDown$,\n\t\t\t\t\tmerge(\n\t\t\t\t\t\tpointerMove$,\n\t\t\t\t\t\tpointerCancel$,\n\t\t\t\t\t\tpointerLeave$,\n\t\t\t\t\t\tpointerUp$,\n\t\t\t\t\t\tcontextMenu$,\n\t\t\t\t\t),\n\t\t\t\t).pipe(\n\t\t\t\t\tmatchPointer(pointerDown),\n\t\t\t\t\ttakeWhile((event) => !isPointerRemoved(event), true),\n\t\t\t\t);\n\n\t\t\t\treturn tracking$;\n\t\t\t}),\n\t\t\tscan<PointerEvent, PointersState, undefined>((acc, event) => {\n\t\t\t\tif (isPointerRemoved(event)) {\n\t\t\t\t\tconst { [event.pointerId]: _deleted, ...rest } = acc?.pointers ?? {};\n\n\t\t\t\t\tvoid _deleted;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\tpointers: rest,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tevent,\n\t\t\t\t\tpointers: {\n\t\t\t\t\t\t...(acc?.pointers ?? {}),\n\t\t\t\t\t\t[event.pointerId]: event,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}, undefined),\n\t\t\tmap(({ event, pointers }) => ({\n\t\t\t\tevent,\n\t\t\t\tpointers: Object.values(pointers).filter(isDefined),\n\t\t\t})),\n\t\t);\n\t};\n","import {\n\tdistinctUntilChanged,\n\tfilter,\n\ttype Observable,\n\tshareReplay,\n} from \"rxjs\";\n\nexport const emitOnceWhen =\n\t<T>(condition: (value: T) => boolean) =>\n\t(stream: Observable<T>) =>\n\t\tstream.pipe(\n\t\t\t// only emit once when we have a condition switch\n\t\t\tdistinctUntilChanged((previous, current) => {\n\t\t\t\tconst previousHasLessThan = condition(previous);\n\t\t\t\tconst currentHasLessThan = condition(current);\n\n\t\t\t\treturn previousHasLessThan === currentHasLessThan;\n\t\t\t}),\n\t\t\t// make sure to only pass true\n\t\t\tfilter(condition),\n\t\t);\n\n/**\n * Shares the latest value with late subscribers, and unsubscribes from the\n * source along with the last subscriber, which shareReplay(1) doesn't do.\n */\nexport const shareLatest = <T>() =>\n\tshareReplay<T>({ bufferSize: 1, refCount: true });\n","import { filter, type Observable } from \"rxjs\";\nimport { isPointerOffEvent } from \"../utils/events\";\n\nexport const isValidConfig = <T extends { container?: HTMLElement }>(\n\tstream: Observable<T>,\n) =>\n\tstream.pipe(\n\t\tfilter(\n\t\t\t(config): config is T & { container: HTMLElement } => !!config.container,\n\t\t),\n\t);\n\nexport const filterPointerOff = (stream: Observable<PointerEvent>) =>\n\tstream.pipe(filter(isPointerOffEvent));\n","import { map, type Observable, scan } from \"rxjs\";\nimport {\n\tcalculateAngleDelta,\n\tcalculateAverageDistance,\n\tcalculateCentroid,\n} from \"../utils/geometry\";\nimport { calculateVelocity } from \"../utils/utils\";\nimport type { RecognizerEvent } from \"./RecognizerEvent\";\n\nexport interface RecognizerEventInput {\n\tevent: PointerEvent;\n\tlatestActivePointers: PointerEvent[];\n}\n\ninterface RecognizerEventState extends RecognizerEventInput {\n\tstartTime: number;\n\tcenter: { x: number; y: number };\n\tdeltaX: number;\n\tdeltaY: number;\n\tdeltaPointersAngle: number;\n}\n\nconst calculateNewDelta = (\n\tnewCenter: { x: number; y: number },\n\tprevCenter: { x: number; y: number },\n\tprevDeltaX: number,\n\tprevDeltaY: number,\n) => {\n\tconst deltaX = newCenter.x - prevCenter.x + prevDeltaX;\n\tconst deltaY = newCenter.y - prevCenter.y + prevDeltaY;\n\n\treturn {\n\t\tdeltaX,\n\t\tdeltaY,\n\t};\n};\n\nexport const scanToRecognizerEvent = <T extends RecognizerEventInput>(\n\tstream: Observable<T>,\n): Observable<RecognizerEvent> => {\n\tconst getCenterFromData = (data: T) =>\n\t\tcalculateCentroid(\n\t\t\t!data.latestActivePointers.length\n\t\t\t\t? [data.event]\n\t\t\t\t: data.latestActivePointers,\n\t\t);\n\n\treturn stream.pipe(\n\t\tscan<T, RecognizerEventState, undefined>((acc, curr) => {\n\t\t\tconst newCenter = getCenterFromData(curr);\n\t\t\tconst prevCenter = acc?.center ?? newCenter;\n\t\t\tconst prevDeltaX = acc?.deltaX ?? 0;\n\t\t\tconst prevDeltaY = acc?.deltaY ?? 0;\n\t\t\tconst prevActivePointersNumber = acc?.latestActivePointers?.length ?? 1;\n\t\t\tconst currActivePointersNumber = curr.latestActivePointers?.length ?? 1;\n\n\t\t\tconst hasAddedOrRemovedAFinger =\n\t\t\t\t[\"pointerdown\", \"pointercancel\", \"pointerleave\", \"pointerup\"].includes(\n\t\t\t\t\tcurr.event.type,\n\t\t\t\t) && prevActivePointersNumber !== currActivePointersNumber;\n\n\t\t\tconst hasAtLeastOneFinger = currActivePointersNumber > 0;\n\n\t\t\tconst { deltaX, deltaY } =\n\t\t\t\t(hasAddedOrRemovedAFinger && hasAtLeastOneFinger) ||\n\t\t\t\t/**\n\t\t\t\t * A pointercancel cean come after a drag event and heven being completely\n\t\t\t\t * desync, leading to erroned values. We should just ignore it.\n\t\t\t\t */\n\t\t\t\tcurr.event.type === \"pointercancel\"\n\t\t\t\t\t? calculateNewDelta(newCenter, newCenter, prevDeltaX, prevDeltaY)\n\t\t\t\t\t: calculateNewDelta(newCenter, prevCenter, prevDeltaX, prevDeltaY);\n\n\t\t\tconst { degreesDelta: deltaPointersAngle } =\n\t\t\t\tprevActivePointersNumber === currActivePointersNumber &&\n\t\t\t\tprevActivePointersNumber >= 2 &&\n\t\t\t\tcurrActivePointersNumber >= 2 &&\n\t\t\t\t/**\n\t\t\t\t * A pointercancel cean come after a drag event and heven being completely\n\t\t\t\t * desync, leading to erroned values. We should just ignore it.\n\t\t\t\t */\n\t\t\t\tcurr.event.type !== \"pointercancel\"\n\t\t\t\t\t? calculateAngleDelta(\n\t\t\t\t\t\t\tacc?.latestActivePointers ?? [],\n\t\t\t\t\t\t\tcurr.latestActivePointers ?? [],\n\t\t\t\t\t\t)\n\t\t\t\t\t: { degreesDelta: 0 };\n\n\t\t\treturn {\n\t\t\t\tstartTime: Date.now(),\n\t\t\t\t...acc,\n\t\t\t\t...curr,\n\t\t\t\tcenter: newCenter,\n\t\t\t\tdeltaX,\n\t\t\t\tdeltaY,\n\t\t\t\tdeltaPointersAngle,\n\t\t\t};\n\t\t}, undefined),\n\t\tmap((data) => {\n\t\t\tconst {\n\t\t\t\tdeltaX,\n\t\t\t\tdeltaY,\n\t\t\t\tlatestActivePointers,\n\t\t\t\tstartTime,\n\t\t\t\tcenter,\n\t\t\t\tevent,\n\t\t\t\tdeltaPointersAngle,\n\t\t\t} = data;\n\t\t\tconst events = latestActivePointers ?? [];\n\n\t\t\t// Calculate the change in time\n\t\t\tconst now = Date.now();\n\t\t\tconst delay = now - startTime;\n\n\t\t\tconst { velocityX, velocityY } = calculateVelocity(delay, deltaX, deltaY);\n\t\t\tconst pointersAverageDistance =\n\t\t\t\tcalculateAverageDistance(latestActivePointers);\n\n\t\t\treturn {\n\t\t\t\tdeltaX,\n\t\t\t\tdeltaY,\n\t\t\t\tvelocityX,\n\t\t\t\tvelocityY,\n\t\t\t\tdelay,\n\t\t\t\tcenter,\n\t\t\t\tpointers: events,\n\t\t\t\tstartTime,\n\t\t\t\tevent,\n\t\t\t\tdeltaPointersAngle,\n\t\t\t\tpointersAverageDistance,\n\t\t\t} satisfies RecognizerEvent;\n\t\t}),\n\t);\n};\n","import { fromEvent, map, merge } from \"rxjs\";\nimport { fromPointerDown } from \"../utils/events\";\n\nexport const getPointerEvents = ({\n\tcontainer,\n\tafterEventReceived = (event) => event,\n}: {\n\tcontainer: HTMLElement;\n\tafterEventReceived?: (event: PointerEvent) => PointerEvent;\n}) => {\n\tconst pointerDown$ = fromPointerDown({ afterEventReceived, container });\n\tconst pointerUp$ = fromEvent<PointerEvent>(container, \"pointerup\").pipe(\n\t\tmap(afterEventReceived),\n\t);\n\tconst pointerMove$ = fromEvent<PointerEvent>(container, \"pointermove\").pipe(\n\t\tmap(afterEventReceived),\n\t);\n\t/**\n\t * Mostly used to handle cursor leaving window on mouse pointers.\n\t */\n\tconst pointerLeave$ = fromEvent<PointerEvent>(container, \"pointerleave\").pipe(\n\t\tmap(afterEventReceived),\n\t);\n\t/**\n\t * Handle things such as contextual menu popup or\n\t * native swipe navigation conflict.\n\t */\n\tconst pointerCancel$ = fromEvent<PointerEvent>(\n\t\tcontainer,\n\t\t\"pointercancel\",\n\t).pipe(map(afterEventReceived));\n\n\tconst pointerEvents$ = merge(\n\t\tpointerDown$,\n\t\tpointerCancel$,\n\t\tpointerLeave$,\n\t\tpointerUp$,\n\t\tpointerMove$,\n\t);\n\n\treturn {\n\t\tpointerEvents$,\n\t\tpointerDown$,\n\t\tpointerCancel$,\n\t\tpointerLeave$,\n\t\tpointerUp$,\n\t\tpointerMove$,\n\t};\n};\n","import {\n\tBehaviorSubject,\n\tcombineLatest,\n\tdistinctUntilChanged,\n\texhaustMap,\n\tfilter,\n\tfinalize,\n\tfirst,\n\tmap,\n\tmerge,\n\tmergeMap,\n\ttype Observable,\n\tof,\n\tshare,\n\tshareReplay,\n\tskip,\n\tstartWith,\n\tswitchMap,\n\ttakeUntil,\n\ttap,\n\ttimer,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { matchPointer, trackPointers } from \"../utils/events\";\nimport { shareLatest } from \"../utils/operators\";\nimport { isWithinPosThreshold, omitUnset } from \"../utils/utils\";\nimport { filterPointerOff, isValidConfig } from \"./operators\";\nimport type { RecognizerEvent } from \"./RecognizerEvent\";\nimport { scanToRecognizerEvent } from \"./scanToRecognizerEvent\";\nimport { getPointerEvents } from \"./utils\";\n\nexport type { RecognizerEvent };\n\ntype PanConfig = {\n\tposThreshold?: number;\n\tdelay?: number;\n\t/**\n\t * Number of inputs to trigger the event.\n\t * Default to 1\n\t */\n\tnumInputs?: number;\n};\n\nexport interface FailWith {\n\tstart$: Observable<unknown>;\n\tend$: Observable<unknown>;\n}\n\nexport type RecognizerConfig<Options> = {\n\tcontainer?: HTMLElement;\n\tafterEventReceived?: (event: PointerEvent) => PointerEvent;\n\toptions?: Options;\n\tfailWith?: FailWith[];\n};\n\nexport interface RecognizerPanEvent extends RecognizerEvent {\n\ttype: \"start\" | \"move\" | \"end\";\n}\n\nexport type State = {\n\t/**\n\t * Fingers of the gesture the recognizer recognizes, as of its latest\n\t * event, from its start event until its end event. None the rest of the\n\t * time, and none for a gesture recognized once the fingers are lifted,\n\t * as a tap or a swipe.\n\t */\n\tfingers: number;\n};\n\nexport abstract class Recognizer<\n\tOptions extends object = never,\n\tEvent extends RecognizerEvent = RecognizerEvent,\n> {\n\tprotected configSubject = new BehaviorSubject<\n\t\tRecognizerConfig<Options> & {\n\t\t\tpanConfig?: PanConfig;\n\t\t}\n\t>({});\n\tprivate stateSubject = new BehaviorSubject<State>({\n\t\tfingers: 0,\n\t});\n\tprotected pan$: Observable<RecognizerPanEvent>;\n\tprotected panStart$: Observable<RecognizerEvent>;\n\tprotected panMove$: Observable<RecognizerEvent>;\n\tprotected panEnd$: Observable<RecognizerEvent>;\n\n\tprotected pointerEvent$: Observable<PointerEvent>;\n\tprotected pointerDown$: Observable<PointerEvent>;\n\tprotected pointerUp$: Observable<PointerEvent>;\n\tprotected pointerCancel$: Observable<PointerEvent>;\n\tprotected pointerMove$: Observable<PointerEvent>;\n\tprotected pointerOff$: Observable<PointerEvent>;\n\n\tpublic state$: Observable<State>;\n\tpublic config$ = this.configSubject.pipe(isValidConfig);\n\n\tabstract events$: Observable<Event>;\n\n\t/**\n\t * Track active running failWith recognizers\n\t */\n\tprotected failWithActive$: Observable<boolean>;\n\n\t/**\n\t * Reports in state$ the fingers of the gesture the recognizer's events\n\t * recognize, until `isEnd` tells its end event, or until nothing listens\n\t * to them anymore.\n\t */\n\tprotected reportFingers =\n\t\t(isEnd: (event: Event) => boolean) => (events$: Observable<Event>) =>\n\t\t\tevents$.pipe(\n\t\t\t\ttap((event) => {\n\t\t\t\t\tthis.stateSubject.next({\n\t\t\t\t\t\tfingers: isEnd(event) ? 0 : event.pointers.length,\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\t\tfinalize(() => {\n\t\t\t\t\tthis.stateSubject.next({ fingers: 0 });\n\t\t\t\t}),\n\t\t\t);\n\n\tconstructor(config?: RecognizerConfig<Options>, panConfig?: PanConfig) {\n\t\tthis.pointerEvent$ = this.config$.pipe(\n\t\t\tswitchMap(\n\t\t\t\t({ container, afterEventReceived }) =>\n\t\t\t\t\tgetPointerEvents({\n\t\t\t\t\t\tcontainer,\n\t\t\t\t\t\tafterEventReceived,\n\t\t\t\t\t}).pointerEvents$,\n\t\t\t),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.pointerDown$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerdown\"),\n\t\t);\n\n\t\tthis.pointerUp$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointerup\"),\n\t\t);\n\n\t\tthis.pointerMove$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointermove\"),\n\t\t);\n\n\t\tthis.pointerCancel$ = this.pointerEvent$.pipe(\n\t\t\tfilter((event) => event.type === \"pointercancel\"),\n\t\t);\n\n\t\tthis.pointerOff$ = this.pointerEvent$.pipe(filterPointerOff);\n\n\t\tconst failWith$ = this.config$.pipe(\n\t\t\tmap(({ failWith }) => failWith),\n\t\t\tdistinctUntilChanged(),\n\t\t);\n\n\t\tthis.failWithActive$ = failWith$.pipe(\n\t\t\tswitchMap((failWith) => {\n\t\t\t\tconst areRunnings$ = failWith?.map((recognizer) => {\n\t\t\t\t\tconst start$ = recognizer.start$.pipe(map(() => true));\n\n\t\t\t\t\tconst end$ = recognizer.end$.pipe(map(() => false));\n\n\t\t\t\t\tconst isRunning$ = merge(start$, end$).pipe(startWith(false));\n\n\t\t\t\t\treturn isRunning$;\n\t\t\t\t});\n\n\t\t\t\tif (!areRunnings$?.length) {\n\t\t\t\t\treturn combineLatest([of(false)]);\n\t\t\t\t}\n\n\t\t\t\treturn combineLatest(areRunnings$);\n\t\t\t}),\n\t\t\tmap((runnings) => runnings.some((running) => running)),\n\t\t\t/**\n\t\t\t * Keeps following the failWith recognizers once subscribed: they can't\n\t\t\t * be asked whether they run, so a recognizer subscribing again later\n\t\t\t * would miss the gesture of one that started in between.\n\t\t\t */\n\t\t\tshareReplay(1),\n\t\t);\n\n\t\tthis.pan$ = this.configSubject.pipe(\n\t\t\tisValidConfig,\n\t\t\tswitchMap((config) => {\n\t\t\t\tconst numInputs = Math.max(1, config.panConfig?.numInputs ?? 1);\n\t\t\t\tconst posThreshold = Math.max(0, config.panConfig?.posThreshold ?? 0);\n\t\t\t\tconst delay = Math.max(0, config.panConfig?.delay ?? 0);\n\n\t\t\t\tconst trackPointers$ = this.pointerDown$.pipe(\n\t\t\t\t\ttrackPointers({\n\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\ttrackMove: true,\n\t\t\t\t\t}),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst hasEnoughFingers = (\n\t\t\t\t\tstream: Observable<{ event: PointerEvent; pointers: PointerEvent[] }>,\n\t\t\t\t) =>\n\t\t\t\t\tstream.pipe(\n\t\t\t\t\t\tfilter(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tevents,\n\t\t\t\t\t\t\t): events is { event: PointerEvent; pointers: [PointerEvent] } =>\n\t\t\t\t\t\t\t\tevents.pointers.length >= numInputs,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\n\t\t\t\tconst hasNotEnoughFingers = (\n\t\t\t\t\tstream: Observable<{\n\t\t\t\t\t\tevent: PointerEvent;\n\t\t\t\t\t\tpointers: PointerEvent[];\n\t\t\t\t\t}>,\n\t\t\t\t) =>\n\t\t\t\t\tstream.pipe(filter((events) => events.pointers.length < numInputs));\n\n\t\t\t\treturn trackPointers$.pipe(\n\t\t\t\t\thasEnoughFingers,\n\t\t\t\t\texhaustMap(({ pointers: initialPointerEvents }) => {\n\t\t\t\t\t\tconst panReleased$ = trackPointers$.pipe(\n\t\t\t\t\t\t\thasNotEnoughFingers,\n\t\t\t\t\t\t\tfirst(),\n\t\t\t\t\t\t\tshare(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst delay$ = timer(delay);\n\n\t\t\t\t\t\tconst pointerDownPassingThreshold$ = merge(\n\t\t\t\t\t\t\t...initialPointerEvents.map((pointerEvent) => of(pointerEvent)),\n\t\t\t\t\t\t\tthis.pointerDown$,\n\t\t\t\t\t\t).pipe(\n\t\t\t\t\t\t\tmergeMap((pointerDown) =>\n\t\t\t\t\t\t\t\tmerge(this.pointerMove$, of(pointerDown)).pipe(\n\t\t\t\t\t\t\t\t\tmatchPointer(pointerDown),\n\t\t\t\t\t\t\t\t\tfilter((pointerEvent) =>\n\t\t\t\t\t\t\t\t\t\tisWithinPosThreshold(\n\t\t\t\t\t\t\t\t\t\t\tpointerDown,\n\t\t\t\t\t\t\t\t\t\t\tpointerEvent,\n\t\t\t\t\t\t\t\t\t\t\tposThreshold,\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfirst(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst panStart$ = pointerDownPassingThreshold$.pipe(\n\t\t\t\t\t\t\tswitchMap(() => delay$),\n\t\t\t\t\t\t\twithLatestFrom(trackPointers$),\n\t\t\t\t\t\t\tmap(([, { event, pointers }]) => ({\n\t\t\t\t\t\t\t\ttype: \"start\" as const,\n\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\tlatestActivePointers: pointers,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\tshareLatest(),\n\t\t\t\t\t\t\ttakeUntil(panReleased$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst panUpdate$ = panStart$.pipe(\n\t\t\t\t\t\t\tmergeMap(() =>\n\t\t\t\t\t\t\t\ttrackPointers$.pipe(\n\t\t\t\t\t\t\t\t\tskip(1),\n\t\t\t\t\t\t\t\t\tmap(({ event, pointers }) => ({\n\t\t\t\t\t\t\t\t\t\ttype: \"move\" as const,\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tlatestActivePointers: pointers,\n\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttakeUntil(panReleased$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst panEnd$ = panStart$.pipe(\n\t\t\t\t\t\t\tmergeMap(() =>\n\t\t\t\t\t\t\t\tpanReleased$.pipe(\n\t\t\t\t\t\t\t\t\tmap(({ event, pointers }) => ({\n\t\t\t\t\t\t\t\t\t\ttype: \"end\" as const,\n\t\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\t\tlatestActivePointers: pointers,\n\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst rawEvent$ = merge(panStart$, panUpdate$, panEnd$).pipe(\n\t\t\t\t\t\t\tshareLatest(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn rawEvent$.pipe(\n\t\t\t\t\t\t\tscanToRecognizerEvent,\n\t\t\t\t\t\t\twithLatestFrom(rawEvent$),\n\t\t\t\t\t\t\tmap(([recognizerEvent, { type }]) => ({\n\t\t\t\t\t\t\t\t...recognizerEvent,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.panStart$ = this.pan$.pipe(\n\t\t\tfilter((event) => event.type === \"start\"),\n\t\t\tmap(({ type, ...rest }) => rest),\n\t\t);\n\n\t\tthis.panMove$ = this.pan$.pipe(\n\t\t\tfilter((event) => event.type === \"move\"),\n\t\t\tmap(({ type, ...rest }) => rest),\n\t\t);\n\n\t\tthis.panEnd$ = this.pan$.pipe(\n\t\t\tfilter((event) => event.type === \"end\"),\n\t\t\tmap(({ type, ...rest }) => rest),\n\t\t);\n\n\t\tthis.state$ = this.stateSubject.pipe(\n\t\t\tdistinctUntilChanged(\n\t\t\t\t(previous, current) => previous.fingers === current.fingers,\n\t\t\t),\n\t\t);\n\n\t\tthis.updateInternal(config ?? {}, panConfig);\n\t}\n\n\tprivate updateInternal(\n\t\tconfig: Partial<RecognizerConfig<Options>>,\n\t\tpanConfig?: PanConfig,\n\t) {\n\t\tconst existingConfig = this.configSubject.getValue();\n\n\t\tthis.configSubject.next({\n\t\t\t...existingConfig,\n\t\t\t...config,\n\t\t\t// unset, as when forwarding an optional value, they stay as they are\n\t\t\tfailWith: config.failWith ?? existingConfig.failWith,\n\t\t\tafterEventReceived:\n\t\t\t\tconfig.afterEventReceived ?? existingConfig.afterEventReceived,\n\t\t\t...(config.options && {\n\t\t\t\t// every option is optional, so leaving out the unset ones keeps them valid\n\t\t\t\toptions: {\n\t\t\t\t\t...existingConfig.options,\n\t\t\t\t\t...omitUnset(config.options),\n\t\t\t\t} as Options,\n\t\t\t}),\n\t\t\tpanConfig: {\n\t\t\t\t...existingConfig.panConfig,\n\t\t\t\t...omitUnset(panConfig),\n\t\t\t},\n\t\t});\n\t}\n\n\tpublic update(\n\t\tconfig: Partial<RecognizerConfig<Options>>,\n\t\tpanConfig?: PanConfig,\n\t) {\n\t\tthis.updateInternal(config, panConfig);\n\t}\n}\n","import {\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { omitUnset } from \"../utils/utils\";\nimport type {\n\tHoldEvent,\n\tHoldRecognizerInterface,\n\tHoldRecognizerOptions,\n} from \"./HoldRecognizerInterface\";\n\nexport type { HoldEvent, HoldRecognizerOptions };\n\nexport class HoldRecognizer\n\textends Recognizer<HoldRecognizerOptions, HoldEvent>\n\timplements HoldRecognizerInterface\n{\n\tpublic events$: Observable<HoldEvent>;\n\n\tconstructor(options: RecognizerConfig<HoldRecognizerOptions> = {}) {\n\t\tsuper(options, {\n\t\t\tnumInputs: 1,\n\t\t\tdelay: 0,\n\t\t\tposThreshold: 0,\n\t\t\t...omitUnset(options.options),\n\t\t});\n\n\t\tconst start$ = this.panStart$.pipe(\n\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\tmap(([event]) => {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"holdStart\" as const,\n\t\t\t\t\t...event,\n\t\t\t\t};\n\t\t\t}),\n\t\t);\n\n\t\tthis.events$ = start$.pipe(\n\t\t\tswitchMap((holdStartEvent) => {\n\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\tfirst(),\n\t\t\t\t);\n\n\t\t\t\tconst end$ = this.panEnd$.pipe(\n\t\t\t\t\tfirst(),\n\t\t\t\t\tmap((event) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttype: \"holdEnd\" as const,\n\t\t\t\t\t\t\t...event,\n\t\t\t\t\t\t};\n\t\t\t\t\t}),\n\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t);\n\n\t\t\t\t// cancelled by failWith: it ends where it started\n\t\t\t\tconst trailingEndEventIfFailed$ = failingActive$.pipe(\n\t\t\t\t\tmap(() => ({ ...holdStartEvent, type: \"holdEnd\" as const })),\n\t\t\t\t\ttakeUntil(this.panEnd$),\n\t\t\t\t);\n\n\t\t\t\treturn merge(of(holdStartEvent), end$, trailingEndEventIfFailed$);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"holdEnd\"),\n\t\t\tshare(),\n\t\t);\n\t}\n\n\tpublic update(options: RecognizerConfig<HoldRecognizerOptions>) {\n\t\tsuper.update(options, options.options);\n\t}\n}\n","import {\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\ttap,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { omitUnset } from \"../utils/utils\";\nimport type {\n\tPanEvent,\n\tPanRecognizerInterface,\n\tPanRecognizerOptions,\n} from \"./PanRecognizerInterface\";\n\nexport type { PanEvent, PanRecognizerOptions };\n\nexport class PanRecognizer\n\textends Recognizer<PanRecognizerOptions, PanEvent>\n\timplements PanRecognizerInterface\n{\n\tpublic events$: Observable<PanEvent>;\n\tpublic start$: Observable<PanEvent>;\n\tpublic end$: Observable<PanEvent>;\n\n\tconstructor(config?: RecognizerConfig<PanRecognizerOptions>) {\n\t\tsuper(config, {\n\t\t\tposThreshold: 15,\n\t\t\t...omitUnset(config?.options),\n\t\t});\n\n\t\tconst panStart$ = this.panStart$.pipe(\n\t\t\tmap((event) => ({\n\t\t\t\ttype: \"panStart\" as const,\n\t\t\t\t...event,\n\t\t\t})),\n\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\tmap(([event]) => event),\n\t\t\tshare(),\n\t\t);\n\n\t\tconst panEnd$ = this.panEnd$.pipe(\n\t\t\tmap((event) => ({\n\t\t\t\ttype: \"panEnd\" as const,\n\t\t\t\t...event,\n\t\t\t})),\n\t\t\tshare(),\n\t\t);\n\n\t\tconst panMove$ = this.panMove$.pipe(\n\t\t\tmap((event) => ({\n\t\t\t\ttype: \"panMove\" as const,\n\t\t\t\t...event,\n\t\t\t})),\n\t\t);\n\n\t\tthis.events$ = panStart$.pipe(\n\t\t\tswitchMap((panStartEvent) => {\n\t\t\t\tlet latestEvent: PanEvent = panStartEvent;\n\n\t\t\t\tconst panStarted$ = of(panStartEvent);\n\n\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\tfirst(),\n\t\t\t\t);\n\n\t\t\t\tconst events$ = merge(panStarted$, panMove$, panEnd$).pipe(\n\t\t\t\t\ttap((event) => {\n\t\t\t\t\t\tlatestEvent = event;\n\t\t\t\t\t}),\n\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t);\n\n\t\t\t\tconst trailingEndEventIfFailed$ = failingActive$.pipe(\n\t\t\t\t\tmap(() => ({\n\t\t\t\t\t\t...latestEvent,\n\t\t\t\t\t\ttype: \"panEnd\" as const,\n\t\t\t\t\t})),\n\t\t\t\t\ttakeUntil(panEnd$),\n\t\t\t\t);\n\n\t\t\t\treturn merge(events$, trailingEndEventIfFailed$);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"panEnd\"),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.start$ = this.events$.pipe(\n\t\t\tfilter((event) => event.type === \"panStart\"),\n\t\t);\n\n\t\tthis.end$ = this.events$.pipe(filter((event) => event.type === \"panEnd\"));\n\t}\n\n\tpublic update(config: RecognizerConfig<PanRecognizerOptions>) {\n\t\tsuper.update(config, config.options);\n\t}\n}\n","import { map, type Observable, scan } from \"rxjs\";\nimport type { RecognizerEvent } from \"../recognizer/RecognizerEvent\";\nimport type { PinchEvent } from \"./PinchRecognizerInterface\";\n\n/**\n * What the scale and distance are measured from: an average distance between\n * the fingers, and the scale and distance reached there.\n */\ntype Reference = Pick<\n\tPinchEvent,\n\t\"pointersAverageDistance\" | \"scale\" | \"distance\"\n>;\n\nexport const scanPanEventToPinchEvent =\n\t({\n\t\ttype,\n\t\tinitialEvent,\n\t}: {\n\t\ttype: PinchEvent[\"type\"];\n\t\tinitialEvent: PinchEvent | RecognizerEvent | undefined;\n\t}) =>\n\t(stream: Observable<RecognizerEvent | PinchEvent>) =>\n\t\tstream.pipe(\n\t\t\tscan<\n\t\t\t\tRecognizerEvent | PinchEvent,\n\t\t\t\tPinchEvent & {\n\t\t\t\t\treference: Reference;\n\t\t\t\t},\n\t\t\t\tPinchEvent | RecognizerEvent | undefined\n\t\t\t>((acc, curr) => {\n\t\t\t\tconst previousPointersLength = acc?.pointers.length ?? 0;\n\t\t\t\tconst hasChangedFingers =\n\t\t\t\t\tpreviousPointersLength !== curr.pointers.length;\n\t\t\t\tconst previousPointersAverageDistance =\n\t\t\t\t\tacc?.pointersAverageDistance ?? curr.pointersAverageDistance;\n\n\t\t\t\t/**\n\t\t\t\t * The reference is reset every time we change fingers, as the average\n\t\t\t\t * distance between 3 fingers can't be compared with the one between 2:\n\t\t\t\t * the scale and distance reached carry over. Otherwise it is the one\n\t\t\t\t * of the event we continue from (the pinch start for the first move).\n\t\t\t\t * @important in case of 1 finger, distance will be 0\n\t\t\t\t */\n\t\t\t\tconst reference: Reference =\n\t\t\t\t\t!hasChangedFingers && acc && \"reference\" in acc\n\t\t\t\t\t\t? acc.reference\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tpointersAverageDistance: hasChangedFingers\n\t\t\t\t\t\t\t\t\t? curr.pointersAverageDistance\n\t\t\t\t\t\t\t\t\t: previousPointersAverageDistance,\n\t\t\t\t\t\t\t\tscale: acc && \"scale\" in acc ? acc.scale : 1,\n\t\t\t\t\t\t\t\tdistance: acc && \"distance\" in acc ? acc.distance : 0,\n\t\t\t\t\t\t\t};\n\n\t\t\t\t/**\n\t\t\t\t * @important When finger is 1, distance is 0\n\t\t\t\t */\n\t\t\t\tconst scale =\n\t\t\t\t\treference.pointersAverageDistance === 0\n\t\t\t\t\t\t? reference.scale\n\t\t\t\t\t\t: reference.scale *\n\t\t\t\t\t\t\t(curr.pointersAverageDistance /\n\t\t\t\t\t\t\t\treference.pointersAverageDistance);\n\n\t\t\t\tconst distance =\n\t\t\t\t\treference.distance +\n\t\t\t\t\t(curr.pointersAverageDistance - reference.pointersAverageDistance);\n\n\t\t\t\tconst deltaDistance = hasChangedFingers\n\t\t\t\t\t? 0\n\t\t\t\t\t: curr.pointersAverageDistance - previousPointersAverageDistance;\n\n\t\t\t\t/**\n\t\t\t\t * @important When finger is 1, distance is 0\n\t\t\t\t * Same when fingers change\n\t\t\t\t */\n\t\t\t\tconst deltaDistanceScale =\n\t\t\t\t\thasChangedFingers || previousPointersAverageDistance === 0\n\t\t\t\t\t\t? 1\n\t\t\t\t\t\t: curr.pointersAverageDistance / previousPointersAverageDistance;\n\n\t\t\t\treturn {\n\t\t\t\t\t...acc,\n\t\t\t\t\t...curr,\n\t\t\t\t\ttype,\n\t\t\t\t\treference,\n\t\t\t\t\tscale,\n\t\t\t\t\tdistance,\n\t\t\t\t\tdeltaDistance,\n\t\t\t\t\tdeltaDistanceScale,\n\t\t\t\t};\n\t\t\t}, initialEvent),\n\t\t\tmap(({ reference, ...rest }): PinchEvent => rest),\n\t\t);\n","import {\n\tdefaultIfEmpty,\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\ttakeWhile,\n\ttap,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { shareLatest } from \"../utils/operators\";\nimport type {\n\tPinchEvent,\n\tPinchRecognizerInterface,\n\tPinchRecognizerOptions,\n} from \"./PinchRecognizerInterface\";\nimport { scanPanEventToPinchEvent } from \"./scanPanEventToPinchEvent\";\n\nexport type {\n\tPinchEvent,\n\tPinchRecognizerOptions,\n} from \"./PinchRecognizerInterface\";\n\nexport class PinchRecognizer\n\textends Recognizer<PinchRecognizerOptions, PinchEvent>\n\timplements PinchRecognizerInterface\n{\n\tpublic events$: Observable<PinchEvent>;\n\n\tpublic start$: Observable<PinchEvent>;\n\tpublic end$: Observable<PinchEvent>;\n\n\tconstructor(config?: RecognizerConfig<PinchRecognizerOptions>) {\n\t\tsuper(config, {\n\t\t\t...config?.options,\n\t\t\tnumInputs: 2,\n\t\t});\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap(() => {\n\t\t\t\tlet latestPinchEvent: PinchEvent | undefined;\n\n\t\t\t\tconst pinchStarted$ = this.panStart$.pipe(\n\t\t\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\t\t\tmap(([event]) => event),\n\t\t\t\t\tswitchMap((event) =>\n\t\t\t\t\t\tof(event).pipe(\n\t\t\t\t\t\t\t// we don't want a scan on pinch start\n\t\t\t\t\t\t\tscanPanEventToPinchEvent({\n\t\t\t\t\t\t\t\ttype: \"pinchStart\",\n\t\t\t\t\t\t\t\tinitialEvent: undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\tfirst(),\n\t\t\t\t);\n\n\t\t\t\tconst pinchMove$ = pinchStarted$.pipe(\n\t\t\t\t\tswitchMap((initialEvent) => {\n\t\t\t\t\t\treturn this.pan$.pipe(\n\t\t\t\t\t\t\ttakeWhile((event) => event.type !== \"end\"),\n\t\t\t\t\t\t\tscanPanEventToPinchEvent({\n\t\t\t\t\t\t\t\ttype: \"pinchMove\",\n\t\t\t\t\t\t\t\tinitialEvent,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t// only for this pinch, the next ones may move again\n\t\t\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tconst pinchEnd$ = pinchStarted$.pipe(\n\t\t\t\t\tswitchMap((pinchStartEvent) =>\n\t\t\t\t\t\tthis.pan$.pipe(\n\t\t\t\t\t\t\tfilter((event) => event.type === \"end\"),\n\t\t\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t\t\t\tdefaultIfEmpty(null),\n\t\t\t\t\t\t\tmap((endEvent) => {\n\t\t\t\t\t\t\t\tconst latestEvent = latestPinchEvent ?? pinchStartEvent;\n\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * It ends where it got to: lifting a finger leaves too few\n\t\t\t\t\t\t\t\t * to measure the distance, and a failWith cancelling it\n\t\t\t\t\t\t\t\t * moves none. So nothing changed since the latest event.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...(endEvent ?? latestEvent),\n\t\t\t\t\t\t\t\t\ttype: \"pinchEnd\" as const,\n\t\t\t\t\t\t\t\t\tscale: latestEvent.scale,\n\t\t\t\t\t\t\t\t\tdistance: latestEvent.distance,\n\t\t\t\t\t\t\t\t\tdeltaDistance: 0,\n\t\t\t\t\t\t\t\t\tdeltaDistanceScale: 1,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tshare(),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn merge(pinchStarted$, pinchMove$, pinchEnd$).pipe(\n\t\t\t\t\ttap((event) => {\n\t\t\t\t\t\tlatestPinchEvent = event;\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"pinchEnd\"),\n\t\t\tshare(),\n\t\t);\n\n\t\tthis.start$ = this.events$.pipe(\n\t\t\tfilter((event) => event.type === \"pinchStart\"),\n\t\t);\n\n\t\tthis.end$ = this.events$.pipe(filter((event) => event.type === \"pinchEnd\"));\n\t}\n\n\tpublic update(options: RecognizerConfig<PinchRecognizerOptions>) {\n\t\tsuper.update(options, options.options);\n\t}\n}\n","import {\n\tcombineLatest,\n\tdistinctUntilChanged,\n\tmap,\n\tmerge,\n\ttype Observable,\n\ttype ObservedValueOf,\n\tshare,\n} from \"rxjs\";\nimport type { Recognizer, RecognizerConfig } from \"../recognizer/Recognizer\";\nimport type {\n\tRecognizableInterface,\n\tRecognizableState,\n} from \"./RecognizableInterface\";\n\nexport type { RecognizableState };\n\n// biome-ignore lint/suspicious/noExplicitAny: TODO\ntype RecognizableOptions<T extends Recognizer<any, any>[]> = {\n\trecognizers: T;\n\t/**\n\t * If you don't need to have text selection, set this to true\n\t * to improve dragging gesture. This will prevent accidental\n\t * text selection on your component.\n\t */\n\tdisableTextSelection?: boolean;\n} & RecognizerConfig<unknown>;\n\n// biome-ignore lint/suspicious/noExplicitAny: TODO\nexport class Recognizable<T extends Recognizer<any, any>[]>\n\timplements RecognizableInterface<T>\n{\n\tevents$: Observable<{\n\t\tevent: ObservedValueOf<T[number][\"events$\"]>;\n\t\trecognizer: T[number];\n\t}>;\n\n\trecognizers: T;\n\n\tstate$: Observable<RecognizableState>;\n\n\tconstructor(protected options: RecognizableOptions<T>) {\n\t\tthis.recognizers = options.recognizers;\n\n\t\tthis.events$ = merge(\n\t\t\t...options.recognizers.map((recognizer) =>\n\t\t\t\trecognizer.events$.pipe(map((event) => ({ event, recognizer }))),\n\t\t\t),\n\t\t).pipe(share());\n\n\t\tthis.state$ = combineLatest(\n\t\t\tthis.recognizers.map((recognizer) => recognizer.state$),\n\t\t).pipe(\n\t\t\tmap((states) =>\n\t\t\t\tstates.reduce((acc, state) => ({\n\t\t\t\t\tfingers: Math.max(acc.fingers, state.fingers),\n\t\t\t\t})),\n\t\t\t),\n\t\t\tdistinctUntilChanged(\n\t\t\t\t(previous, current) => previous.fingers === current.fingers,\n\t\t\t),\n\t\t);\n\n\t\tthis.update(options);\n\t}\n\n\tpublic update({\n\t\tdisableTextSelection,\n\t\t...rest\n\t}: Partial<Omit<RecognizableOptions<T>, \"recognizers\">>) {\n\t\tif (rest.container) {\n\t\t\t/**\n\t\t\t * We have to disable touch-action otherwise every events will be followed\n\t\t\t * by a cancel event since the browser will try to handle touch.\n\t\t\t * @see https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action\n\t\t\t */\n\t\t\trest.container.style.touchAction = \"none\";\n\n\t\t\t/**\n\t\t\t * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n\t\t\t */\n\t\t\tif (disableTextSelection) {\n\t\t\t\trest.container.style.userSelect = \"none\";\n\t\t\t}\n\t\t}\n\n\t\tfor (const recognizer of this.options.recognizers) {\n\t\t\trecognizer.update(rest);\n\t\t}\n\t}\n}\n","import {\n\tfilter,\n\tfirst,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tscan,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\ttap,\n\twithLatestFrom,\n} from \"rxjs\";\nimport {\n\tRecognizer,\n\ttype RecognizerConfig,\n\ttype RecognizerPanEvent,\n} from \"../recognizer/Recognizer\";\nimport { shareLatest } from \"../utils/operators\";\nimport { omitUnset } from \"../utils/utils\";\nimport type {\n\tRotateEvent,\n\tRotateRecognizerInterface,\n\tRotateRecognizerOptions,\n} from \"./RotateRecognizerInterface\";\n\nexport type { RotateEvent, RotateRecognizerOptions };\n\ntype RotatingEvent = RecognizerPanEvent & { angle: number; deltaAngle: number };\n\nexport class RotateRecognizer\n\textends Recognizer<RotateRecognizerOptions, RotateEvent>\n\timplements RotateRecognizerInterface\n{\n\tpublic events$: Observable<RotateEvent>;\n\n\tconstructor(config: RecognizerConfig<RotateRecognizerOptions> = {}) {\n\t\tsuper(config, {\n\t\t\tnumInputs: 2,\n\t\t\tposThreshold: 15,\n\t\t\t...omitUnset(config.options),\n\t\t});\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap(() => {\n\t\t\t\tconst rotateStart$ = this.panStart$.pipe(\n\t\t\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\t\t\tmap(([event]) => ({\n\t\t\t\t\t\t...event,\n\t\t\t\t\t\ttype: \"rotateStart\" as const,\n\t\t\t\t\t\tangle: 0,\n\t\t\t\t\t\tdeltaAngle: 0,\n\t\t\t\t\t})),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst rotate$ = rotateStart$.pipe(\n\t\t\t\t\tswitchMap((rotateStartEvent) => {\n\t\t\t\t\t\tlet latestEvent: RotatingEvent = {\n\t\t\t\t\t\t\t...rotateStartEvent,\n\t\t\t\t\t\t\ttype: \"start\",\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst failingActive$ = this.failWithActive$.pipe(\n\t\t\t\t\t\t\tfilter((isActive) => isActive),\n\t\t\t\t\t\t\tfirst(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst events$ = this.pan$.pipe(\n\t\t\t\t\t\t\tscan<RecognizerPanEvent, RotatingEvent, undefined>(\n\t\t\t\t\t\t\t\t(acc, current) => {\n\t\t\t\t\t\t\t\t\tconst angle = (acc?.angle ?? 0) + current.deltaPointersAngle;\n\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t\t\t\t...current,\n\t\t\t\t\t\t\t\t\t\tangle,\n\t\t\t\t\t\t\t\t\t\tdeltaAngle: current.deltaPointersAngle,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttap((event) => {\n\t\t\t\t\t\t\t\tlatestEvent = event;\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\ttakeUntil(failingActive$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// cancelled by failWith: it ends on the angle it reached\n\t\t\t\t\t\tconst trailingEndEventIfFailed$ = failingActive$.pipe(\n\t\t\t\t\t\t\tmap(() => ({\n\t\t\t\t\t\t\t\t...latestEvent,\n\t\t\t\t\t\t\t\ttype: \"end\" as const,\n\t\t\t\t\t\t\t\tdeltaAngle: 0,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\ttakeUntil(this.panEnd$),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn merge(events$, trailingEndEventIfFailed$);\n\t\t\t\t\t}),\n\t\t\t\t\tshare(),\n\t\t\t\t);\n\n\t\t\t\tconst rotateMove$ = rotate$.pipe(\n\t\t\t\t\tfilter((event) => event.type === \"move\"),\n\t\t\t\t\tmap((event) => ({ ...event, type: \"rotateMove\" as const })),\n\t\t\t\t);\n\n\t\t\t\tconst rotateEnd$ = rotate$.pipe(\n\t\t\t\t\tfilter((event) => event.type === \"end\"),\n\t\t\t\t\tmap((event) => ({ ...event, type: \"rotateEnd\" as const })),\n\t\t\t\t);\n\n\t\t\t\treturn merge(rotateStart$, rotateMove$, rotateEnd$);\n\t\t\t}),\n\t\t\tthis.reportFingers((event) => event.type === \"rotateEnd\"),\n\t\t\tshare(),\n\t\t);\n\t}\n\n\tpublic update(options: RecognizerConfig<RotateRecognizerOptions>) {\n\t\tsuper.update(options, options.options);\n\t}\n}\n","import { filter, type Observable } from \"rxjs\";\nimport type { RecognizerEvent } from \"../recognizer/RecognizerEvent\";\n\nexport const isRecognizedAsSwipe =\n\t(escapeVelocity: number) => (stream: Observable<RecognizerEvent>) =>\n\t\tstream.pipe(\n\t\t\tfilter((event) => {\n\t\t\t\treturn (\n\t\t\t\t\tMath.abs(event.velocityX) >= escapeVelocity ||\n\t\t\t\t\tMath.abs(event.velocityY) >= escapeVelocity\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n","import {\n\tfilter,\n\tmap,\n\ttype Observable,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { calculateDegreeAngleBetweenPoints } from \"../utils/geometry\";\nimport { isRecognizedAsSwipe } from \"./operators\";\nimport type {\n\tSwipeEvent,\n\tSwipeRecognizerInterface,\n\tSwipeRecognizerOptions,\n} from \"./SwipeRecognizerInterface\";\n\nexport type { SwipeEvent, SwipeRecognizerOptions };\n\nexport class SwipeRecognizer\n\textends Recognizer<SwipeRecognizerOptions, SwipeEvent>\n\timplements SwipeRecognizerInterface\n{\n\tpublic events$: Observable<SwipeEvent>;\n\n\tconstructor(config?: RecognizerConfig<SwipeRecognizerOptions>) {\n\t\tsuper(config, {\n\t\t\tposThreshold: 0,\n\t\t\tnumInputs: 1,\n\t\t});\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap((initializedWith) => {\n\t\t\t\tconst { escapeVelocity = 0.9 } = initializedWith.options ?? {};\n\n\t\t\t\treturn this.panStart$.pipe(\n\t\t\t\t\twithLatestFrom(this.failWithActive$),\n\t\t\t\t\tfilter(([, failWithActive]) => !failWithActive),\n\t\t\t\t\tswitchMap(([startEvent]) => {\n\t\t\t\t\t\treturn this.panEnd$.pipe(\n\t\t\t\t\t\t\tisRecognizedAsSwipe(escapeVelocity),\n\t\t\t\t\t\t\tmap((event) => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: \"swipe\" as const,\n\t\t\t\t\t\t\t\t\tangle: calculateDegreeAngleBetweenPoints(\n\t\t\t\t\t\t\t\t\t\tstartEvent.event,\n\t\t\t\t\t\t\t\t\t\tevent.event,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t...event,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\ttakeUntil(\n\t\t\t\t\t\t\t\tthis.failWithActive$.pipe(filter((isActive) => isActive)),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t\tshare(),\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t}\n\n\tpublic update(config: RecognizerConfig<SwipeRecognizerOptions>) {\n\t\tsuper.update(config);\n\t}\n}\n","import {\n\tfilter,\n\tmergeMap,\n\ttype Observable,\n\ttakeUntil,\n\ttakeWhile,\n\ttimer,\n} from \"rxjs\";\nimport { filterPointerOff } from \"../recognizer/operators\";\nimport { isPointerOffEvent, matchPointer } from \"../utils/events\";\nimport { isWithinPosThreshold } from \"../utils/utils\";\n\nexport const takeWhenPressedTooLong =\n\t({\n\t\ttimeout,\n\t\tpointerEvent$,\n\t}: {\n\t\ttimeout: number;\n\t\tpointerEvent$: Observable<PointerEvent>;\n\t}) =>\n\t(stream: Observable<PointerEvent>) =>\n\t\tstream.pipe(\n\t\t\tmergeMap((pointerDown) =>\n\t\t\t\ttimer(timeout).pipe(\n\t\t\t\t\ttakeUntil(\n\t\t\t\t\t\tpointerEvent$.pipe(filterPointerOff, matchPointer(pointerDown)),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\nexport const takeWhenOutsideThreshold =\n\t({\n\t\tinitialPointerEvent,\n\t\tpointerEvent$,\n\t\ttolerance,\n\t}: {\n\t\tinitialPointerEvent: PointerEvent;\n\t\ttolerance: number;\n\t\tpointerEvent$: Observable<PointerEvent>;\n\t}) =>\n\t(stream: Observable<PointerEvent>) =>\n\t\tstream.pipe(\n\t\t\tmergeMap((pointerDown) =>\n\t\t\t\tpointerEvent$.pipe(\n\t\t\t\t\tmatchPointer(pointerDown),\n\t\t\t\t\ttakeWhile((event) => !isPointerOffEvent(event), true),\n\t\t\t\t\tfilter((event) =>\n\t\t\t\t\t\tisWithinPosThreshold(initialPointerEvent, event, tolerance),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n","import {\n\tbuffer,\n\tdebounceTime,\n\texhaustMap,\n\tfilter,\n\tfirst,\n\tignoreElements,\n\tmap,\n\tmerge,\n\ttype Observable,\n\tof,\n\tshare,\n\tswitchMap,\n\ttakeUntil,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { Recognizer, type RecognizerConfig } from \"../recognizer/Recognizer\";\nimport { scanToRecognizerEvent } from \"../recognizer/scanToRecognizerEvent\";\nimport { trackPointers } from \"../utils/events\";\nimport { shareLatest } from \"../utils/operators\";\nimport { filterNotEmpty } from \"../utils/utils\";\nimport { takeWhenOutsideThreshold, takeWhenPressedTooLong } from \"./operators\";\nimport type {\n\tTapEvent,\n\tTapRecognizerInterface,\n\tTapRecognizerOptions,\n} from \"./TapRecognizerInterface\";\n\nexport type { TapEvent, TapRecognizerOptions };\n\nexport class TapRecognizer\n\textends Recognizer<TapRecognizerOptions, TapEvent>\n\timplements TapRecognizerInterface\n{\n\tpublic events$: Observable<TapEvent>;\n\n\tconstructor(options?: RecognizerConfig<TapRecognizerOptions>) {\n\t\tsuper(options);\n\n\t\tthis.events$ = this.config$.pipe(\n\t\t\tswitchMap((config) => {\n\t\t\t\tconst maxTaps = config.options?.maxTaps ?? 1;\n\t\t\t\t/**\n\t\t\t\t * We default to reasonable multiplier of 100 to give time\n\t\t\t\t * for each tap\n\t\t\t\t */\n\t\t\t\tconst multiTapThreshold =\n\t\t\t\t\tconfig.options?.multiTapThreshold ?? 100 * (maxTaps - 1);\n\n\t\t\t\tconst { maximumPressTime = 150, tolerance = 10 } = config.options ?? {};\n\n\t\t\t\tconst activePointers$ = this.pointerDown$.pipe(\n\t\t\t\t\ttrackPointers({\n\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\ttrackMove: true,\n\t\t\t\t\t}),\n\t\t\t\t\tshareLatest(),\n\t\t\t\t);\n\n\t\t\t\tconst hasMoreThanOneActivePointer$ = activePointers$.pipe(\n\t\t\t\t\tfilter(({ pointers }) => pointers.length > 1),\n\t\t\t\t);\n\n\t\t\t\t/**\n\t\t\t\t * Collects the presses until `multiTapThreshold` after a release\n\t\t\t\t * that no press followed: a press still down is part of the taps.\n\t\t\t\t */\n\t\t\t\tconst bufferPointerDowns = (stream: Observable<PointerEvent>) =>\n\t\t\t\t\tstream.pipe(\n\t\t\t\t\t\tbuffer(\n\t\t\t\t\t\t\tmerge(this.pointerDown$, this.pointerUp$).pipe(\n\t\t\t\t\t\t\t\tdebounceTime(multiTapThreshold),\n\t\t\t\t\t\t\t\tfilter((event) => event.type === \"pointerup\"),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfirst(),\n\t\t\t\t\t);\n\n\t\t\t\tconst tap$ = merge(\n\t\t\t\t\tthis.pointerDown$,\n\t\t\t\t\tactivePointers$.pipe(ignoreElements()),\n\t\t\t\t).pipe(\n\t\t\t\t\texhaustMap((initialPointerEvent) => {\n\t\t\t\t\t\tconst pointerDowns$ = merge(\n\t\t\t\t\t\t\tof(initialPointerEvent),\n\t\t\t\t\t\t\tthis.pointerDown$,\n\t\t\t\t\t\t).pipe(shareLatest());\n\n\t\t\t\t\t\tconst pointerDownsBuffered$ =\n\t\t\t\t\t\t\tpointerDowns$.pipe(bufferPointerDowns);\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Exit condition for `tolerance`\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst clickedTooFarFromOriginalTap$ = pointerDowns$.pipe(\n\t\t\t\t\t\t\ttakeWhenOutsideThreshold({\n\t\t\t\t\t\t\t\tinitialPointerEvent,\n\t\t\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\t\t\ttolerance,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Exit condition for `maximumPressTime`\n\t\t\t\t\t\t */\n\t\t\t\t\t\tconst hasFingersPressedForTooLong$ = pointerDowns$.pipe(\n\t\t\t\t\t\t\ttakeWhenPressedTooLong({\n\t\t\t\t\t\t\t\tpointerEvent$: this.pointerEvent$,\n\t\t\t\t\t\t\t\ttimeout: maximumPressTime,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst takeUntil$ = merge(\n\t\t\t\t\t\t\tthis.failWithActive$.pipe(filter((active) => active)),\n\t\t\t\t\t\t\tthis.pointerCancel$,\n\t\t\t\t\t\t\thasMoreThanOneActivePointer$,\n\t\t\t\t\t\t\tclickedTooFarFromOriginalTap$,\n\t\t\t\t\t\t\thasFingersPressedForTooLong$,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst rawEvent$ = pointerDownsBuffered$.pipe(\n\t\t\t\t\t\t\tfilterNotEmpty,\n\t\t\t\t\t\t\tfilter((events) => events.length <= maxTaps),\n\t\t\t\t\t\t\tmap((events) => {\n\t\t\t\t\t\t\t\t// the finger, where it last pressed: `taps` counts the presses\n\t\t\t\t\t\t\t\tconst lastPress = events[events.length - 1] ?? events[0];\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: \"tap\" as const,\n\t\t\t\t\t\t\t\t\ttaps: events.length,\n\t\t\t\t\t\t\t\t\tlatestActivePointers: [lastPress],\n\t\t\t\t\t\t\t\t\tevent: lastPress,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tshareLatest(),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn rawEvent$.pipe(\n\t\t\t\t\t\t\tscanToRecognizerEvent,\n\t\t\t\t\t\t\twithLatestFrom(rawEvent$),\n\t\t\t\t\t\t\tmap(([recognizerEvent, { type, taps }]) => ({\n\t\t\t\t\t\t\t\t...recognizerEvent,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\ttaps,\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\ttakeUntil(takeUntil$),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\treturn tap$;\n\t\t\t}),\n\t\t\tshare(),\n\t\t);\n\t}\n\n\tpublic update(config: RecognizerConfig<TapRecognizerOptions>): void {\n\t\tsuper.update(config);\n\t}\n}\n"],"mappings":";;AAEA,SAAgBA,EAAkB,GAAe,GAAuB;CACvE,OAAO,KAAK,MAAMC,EAAO,IAAIC,EAAO,MAAM,KAAKD,EAAO,IAAIC,EAAO,MAAM,CAAC;AACzE;AAEA,SAAgBC,EAAyB,GAAgC;CACxE,IAAMC,IAAIC,EAAc;C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