@micjanic/recursive-grid 1.0.2

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.
@@ -0,0 +1,1866 @@
1
+ import { T as A, U as Z, P as _, r as te, E as b, a as ie, w as g, e as w, C as V } from "./PixiApp-D4xu0PT4.js";
2
+ import "./webworkerAll-CI8_Z7rX.js";
3
+ class q {
4
+ constructor(e) {
5
+ this._lastTransform = "", this._observer = null, this._tickerAttached = !1, this.updateTranslation = () => {
6
+ if (!this._canvas)
7
+ return;
8
+ const t = this._canvas.getBoundingClientRect(), i = this._canvas.width, n = this._canvas.height, s = t.width / i * this._renderer.resolution, o = t.height / n * this._renderer.resolution, r = t.left, l = t.top, d = `translate(${r}px, ${l}px) scale(${s}, ${o})`;
9
+ d !== this._lastTransform && (this._domElement.style.transform = d, this._lastTransform = d);
10
+ }, this._domElement = e.domElement, this._renderer = e.renderer, !(globalThis.OffscreenCanvas && this._renderer.canvas instanceof OffscreenCanvas) && (this._canvas = this._renderer.canvas, this._attachObserver());
11
+ }
12
+ /** The canvas element that this CanvasObserver is associated with. */
13
+ get canvas() {
14
+ return this._canvas;
15
+ }
16
+ /** Attaches the DOM element to the canvas parent if it is not already attached. */
17
+ ensureAttached() {
18
+ !this._domElement.parentNode && this._canvas.parentNode && (this._canvas.parentNode.appendChild(this._domElement), this.updateTranslation());
19
+ }
20
+ /** Sets up a ResizeObserver if available. This ensures that the DOM element is kept in sync with the canvas size . */
21
+ _attachObserver() {
22
+ "ResizeObserver" in globalThis ? (this._observer && (this._observer.disconnect(), this._observer = null), this._observer = new ResizeObserver((e) => {
23
+ for (const t of e) {
24
+ if (t.target !== this._canvas)
25
+ continue;
26
+ const i = this.canvas.width, n = this.canvas.height, s = t.contentRect.width / i * this._renderer.resolution, o = t.contentRect.height / n * this._renderer.resolution;
27
+ (this._lastScaleX !== s || this._lastScaleY !== o) && (this.updateTranslation(), this._lastScaleX = s, this._lastScaleY = o);
28
+ }
29
+ }), this._observer.observe(this._canvas)) : this._tickerAttached || A.shared.add(this.updateTranslation, this, Z.HIGH);
30
+ }
31
+ /** Destroys the CanvasObserver instance, cleaning up observers and Ticker. */
32
+ destroy() {
33
+ this._observer ? (this._observer.disconnect(), this._observer = null) : this._tickerAttached && A.shared.remove(this.updateTranslation), this._domElement = null, this._renderer = null, this._canvas = null, this._tickerAttached = !1, this._lastTransform = "", this._lastScaleX = null, this._lastScaleY = null;
34
+ }
35
+ }
36
+ class M {
37
+ /**
38
+ * @param manager - The event boundary which manages this event. Propagation can only occur
39
+ * within the boundary's jurisdiction.
40
+ */
41
+ constructor(e) {
42
+ this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = M.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = new _(), this.page = new _(), this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = e;
43
+ }
44
+ /** @readonly */
45
+ get layerX() {
46
+ return this.layer.x;
47
+ }
48
+ /** @readonly */
49
+ get layerY() {
50
+ return this.layer.y;
51
+ }
52
+ /** @readonly */
53
+ get pageX() {
54
+ return this.page.x;
55
+ }
56
+ /** @readonly */
57
+ get pageY() {
58
+ return this.page.y;
59
+ }
60
+ /**
61
+ * Fallback for the deprecated `InteractionEvent.data`.
62
+ * @deprecated since 7.0.0
63
+ */
64
+ get data() {
65
+ return this;
66
+ }
67
+ /**
68
+ * The propagation path for this event. Alias for {@link EventBoundary.propagationPath}.
69
+ * @advanced
70
+ */
71
+ composedPath() {
72
+ return this.manager && (!this.path || this.path[this.path.length - 1] !== this.target) && (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.path;
73
+ }
74
+ /**
75
+ * Unimplemented method included for implementing the DOM interface `Event`. It will throw an `Error`.
76
+ * @deprecated
77
+ * @ignore
78
+ * @param _type
79
+ * @param _bubbles
80
+ * @param _cancelable
81
+ */
82
+ initEvent(e, t, i) {
83
+ throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
84
+ }
85
+ /**
86
+ * Unimplemented method included for implementing the DOM interface `UIEvent`. It will throw an `Error`.
87
+ * @ignore
88
+ * @deprecated
89
+ * @param _typeArg
90
+ * @param _bubblesArg
91
+ * @param _cancelableArg
92
+ * @param _viewArg
93
+ * @param _detailArg
94
+ */
95
+ initUIEvent(e, t, i, n, s) {
96
+ throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
97
+ }
98
+ /**
99
+ * Prevent default behavior of both PixiJS and the user agent.
100
+ * @example
101
+ * ```ts
102
+ * sprite.on('click', (event) => {
103
+ * // Prevent both browser's default click behavior
104
+ * // and PixiJS's default handling
105
+ * event.preventDefault();
106
+ *
107
+ * // Custom handling
108
+ * customClickHandler();
109
+ * });
110
+ * ```
111
+ * @remarks
112
+ * - Only works if the native event is cancelable
113
+ * - Does not stop event propagation
114
+ */
115
+ preventDefault() {
116
+ this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault(), this.defaultPrevented = !0;
117
+ }
118
+ /**
119
+ * Stop this event from propagating to any additional listeners, including those
120
+ * on the current target and any following targets in the propagation path.
121
+ * @example
122
+ * ```ts
123
+ * container.on('pointerdown', (event) => {
124
+ * // Stop all further event handling
125
+ * event.stopImmediatePropagation();
126
+ *
127
+ * // These handlers won't be called:
128
+ * // - Other pointerdown listeners on this container
129
+ * // - Any pointerdown listeners on parent containers
130
+ * });
131
+ * ```
132
+ * @remarks
133
+ * - Immediately stops all event propagation
134
+ * - Prevents other listeners on same target from being called
135
+ * - More aggressive than stopPropagation()
136
+ */
137
+ stopImmediatePropagation() {
138
+ this.propagationImmediatelyStopped = !0;
139
+ }
140
+ /**
141
+ * Stop this event from propagating to the next target in the propagation path.
142
+ * The rest of the listeners on the current target will still be notified.
143
+ * @example
144
+ * ```ts
145
+ * child.on('pointermove', (event) => {
146
+ * // Handle event on child
147
+ * updateChild();
148
+ *
149
+ * // Prevent parent handlers from being called
150
+ * event.stopPropagation();
151
+ * });
152
+ *
153
+ * // This won't be called if child handles the event
154
+ * parent.on('pointermove', (event) => {
155
+ * updateParent();
156
+ * });
157
+ * ```
158
+ * @remarks
159
+ * - Stops event bubbling to parent containers
160
+ * - Does not prevent other listeners on same target
161
+ * - Less aggressive than stopImmediatePropagation()
162
+ */
163
+ stopPropagation() {
164
+ this.propagationStopped = !0;
165
+ }
166
+ }
167
+ var I = /iPhone/i, C = /iPod/i, L = /iPad/i, U = /\biOS-universal(?:.+)Mac\b/i, k = /\bAndroid(?:.+)Mobile\b/i, R = /Android/i, E = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i, O = /Silk/i, m = /Windows Phone/i, X = /\bWindows(?:.+)ARM\b/i, Y = /BlackBerry/i, H = /BB10/i, F = /Opera Mini/i, N = /\b(CriOS|Chrome)(?:.+)Mobile/i, $ = /Mobile(?:.+)Firefox\b/i, K = function(a) {
168
+ return typeof a < "u" && a.platform === "MacIntel" && typeof a.maxTouchPoints == "number" && a.maxTouchPoints > 1 && typeof MSStream > "u";
169
+ };
170
+ function ne(a) {
171
+ return function(e) {
172
+ return e.test(a);
173
+ };
174
+ }
175
+ function G(a) {
176
+ var e = {
177
+ userAgent: "",
178
+ platform: "",
179
+ maxTouchPoints: 0
180
+ };
181
+ !a && typeof navigator < "u" ? e = {
182
+ userAgent: navigator.userAgent,
183
+ platform: navigator.platform,
184
+ maxTouchPoints: navigator.maxTouchPoints || 0
185
+ } : typeof a == "string" ? e.userAgent = a : a && a.userAgent && (e = {
186
+ userAgent: a.userAgent,
187
+ platform: a.platform,
188
+ maxTouchPoints: a.maxTouchPoints || 0
189
+ });
190
+ var t = e.userAgent, i = t.split("[FBAN");
191
+ typeof i[1] < "u" && (t = i[0]), i = t.split("Twitter"), typeof i[1] < "u" && (t = i[0]);
192
+ var n = ne(t), s = {
193
+ apple: {
194
+ phone: n(I) && !n(m),
195
+ ipod: n(C),
196
+ tablet: !n(I) && (n(L) || K(e)) && !n(m),
197
+ universal: n(U),
198
+ device: (n(I) || n(C) || n(L) || n(U) || K(e)) && !n(m)
199
+ },
200
+ amazon: {
201
+ phone: n(E),
202
+ tablet: !n(E) && n(O),
203
+ device: n(E) || n(O)
204
+ },
205
+ android: {
206
+ phone: !n(m) && n(E) || !n(m) && n(k),
207
+ tablet: !n(m) && !n(E) && !n(k) && (n(O) || n(R)),
208
+ device: !n(m) && (n(E) || n(O) || n(k) || n(R)) || n(/\bokhttp\b/i)
209
+ },
210
+ windows: {
211
+ phone: n(m),
212
+ tablet: n(X),
213
+ device: n(m) || n(X)
214
+ },
215
+ other: {
216
+ blackberry: n(Y),
217
+ blackberry10: n(H),
218
+ opera: n(F),
219
+ firefox: n($),
220
+ chrome: n(N),
221
+ device: n(Y) || n(H) || n(F) || n($) || n(N)
222
+ },
223
+ any: !1,
224
+ phone: !1,
225
+ tablet: !1
226
+ };
227
+ return s.any = s.apple.device || s.android.device || s.windows.device || s.other.device, s.phone = s.apple.phone || s.android.phone || s.windows.phone, s.tablet = s.apple.tablet || s.android.tablet || s.windows.tablet, s;
228
+ }
229
+ const se = G.default ?? G, oe = se(globalThis.navigator), re = 9, W = 100, ae = 0, he = 0, j = 2, z = 1, le = -1e3, ce = -1e3, de = 2, S = class J {
230
+ // eslint-disable-next-line jsdoc/require-param
231
+ /**
232
+ * @param {WebGLRenderer|WebGPURenderer} renderer - A reference to the current renderer
233
+ */
234
+ constructor(e, t = oe) {
235
+ this._mobileInfo = t, this.debug = !1, this._activateOnTab = !0, this._deactivateOnMouseMove = !0, this._isActive = !1, this._isMobileAccessibility = !1, this._div = null, this._pool = [], this._renderId = 0, this._children = [], this._androidUpdateCount = 0, this._androidUpdateFrequency = 500, this._hookDiv = null, (t.tablet || t.phone) && this._createTouchHook(), this._renderer = e;
236
+ }
237
+ /**
238
+ * Value of `true` if accessibility is currently active and accessibility layers are showing.
239
+ * @type {boolean}
240
+ * @readonly
241
+ */
242
+ get isActive() {
243
+ return this._isActive;
244
+ }
245
+ /**
246
+ * Value of `true` if accessibility is enabled for touch devices.
247
+ * @type {boolean}
248
+ * @readonly
249
+ */
250
+ get isMobileAccessibility() {
251
+ return this._isMobileAccessibility;
252
+ }
253
+ /**
254
+ * The DOM element that will sit over the PixiJS element. This is where the div overlays will go.
255
+ * @readonly
256
+ */
257
+ get hookDiv() {
258
+ return this._hookDiv;
259
+ }
260
+ /**
261
+ * Creates the touch hooks.
262
+ * @private
263
+ */
264
+ _createTouchHook() {
265
+ const e = document.createElement("button");
266
+ e.style.width = `${z}px`, e.style.height = `${z}px`, e.style.position = "absolute", e.style.top = `${le}px`, e.style.left = `${ce}px`, e.style.zIndex = de.toString(), e.style.backgroundColor = "#FF0000", e.title = "select to enable accessibility for this content", e.addEventListener("focus", () => {
267
+ this._isMobileAccessibility = !0, this._activate(), this._destroyTouchHook();
268
+ }), document.body.appendChild(e), this._hookDiv = e;
269
+ }
270
+ /**
271
+ * Destroys the touch hooks.
272
+ * @private
273
+ */
274
+ _destroyTouchHook() {
275
+ this._hookDiv && (document.body.removeChild(this._hookDiv), this._hookDiv = null);
276
+ }
277
+ /**
278
+ * Activating will cause the Accessibility layer to be shown.
279
+ * This is called when a user presses the tab key.
280
+ * @private
281
+ */
282
+ _activate() {
283
+ if (this._isActive)
284
+ return;
285
+ this._isActive = !0, this._div || (this._div = document.createElement("div"), this._div.style.position = "absolute", this._div.style.top = `${ae}px`, this._div.style.left = `${he}px`, this._div.style.pointerEvents = "none", this._div.style.zIndex = j.toString(), this._canvasObserver = new q({
286
+ domElement: this._div,
287
+ renderer: this._renderer
288
+ })), this._activateOnTab && (this._onKeyDown = this._onKeyDown.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, !1)), this._deactivateOnMouseMove && (this._onMouseMove = this._onMouseMove.bind(this), globalThis.document.addEventListener("mousemove", this._onMouseMove, !0));
289
+ const e = this._renderer.view.canvas;
290
+ if (e.parentNode)
291
+ this._canvasObserver.ensureAttached(), this._initAccessibilitySetup();
292
+ else {
293
+ const t = new MutationObserver(() => {
294
+ e.parentNode && (t.disconnect(), this._canvasObserver.ensureAttached(), this._initAccessibilitySetup());
295
+ });
296
+ t.observe(document.body, { childList: !0, subtree: !0 });
297
+ }
298
+ }
299
+ // New method to handle initialization after div is ready
300
+ _initAccessibilitySetup() {
301
+ this._renderer.runners.postrender.add(this), this._renderer.lastObjectRendered && this._updateAccessibleObjects(this._renderer.lastObjectRendered);
302
+ }
303
+ /**
304
+ * Deactivates the accessibility system. Removes listeners and accessibility elements.
305
+ * @private
306
+ */
307
+ _deactivate() {
308
+ if (!(!this._isActive || this._isMobileAccessibility)) {
309
+ this._isActive = !1, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), this._activateOnTab && globalThis.addEventListener("keydown", this._onKeyDown, !1), this._renderer.runners.postrender.remove(this);
310
+ for (const e of this._children)
311
+ e._accessibleDiv && e._accessibleDiv.parentNode && (e._accessibleDiv.parentNode.removeChild(e._accessibleDiv), e._accessibleDiv = null), e._accessibleActive = !1;
312
+ this._pool.forEach((e) => {
313
+ e.parentNode && e.parentNode.removeChild(e);
314
+ }), this._div && this._div.parentNode && this._div.parentNode.removeChild(this._div), this._pool = [], this._children = [];
315
+ }
316
+ }
317
+ /**
318
+ * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.
319
+ * @private
320
+ * @param {Container} container - The Container to check.
321
+ */
322
+ _updateAccessibleObjects(e) {
323
+ if (!e.visible || !e.accessibleChildren)
324
+ return;
325
+ e.accessible && (e._accessibleActive || this._addChild(e), e._renderId = this._renderId);
326
+ const t = e.children;
327
+ if (t)
328
+ for (let i = 0; i < t.length; i++)
329
+ this._updateAccessibleObjects(t[i]);
330
+ }
331
+ /**
332
+ * Runner init called, view is available at this point.
333
+ * @ignore
334
+ */
335
+ init(e) {
336
+ const i = {
337
+ accessibilityOptions: {
338
+ ...J.defaultOptions,
339
+ ...(e == null ? void 0 : e.accessibilityOptions) || {}
340
+ }
341
+ };
342
+ this.debug = i.accessibilityOptions.debug, this._activateOnTab = i.accessibilityOptions.activateOnTab, this._deactivateOnMouseMove = i.accessibilityOptions.deactivateOnMouseMove, i.accessibilityOptions.enabledByDefault ? this._activate() : this._activateOnTab && (this._onKeyDown = this._onKeyDown.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, !1)), this._renderer.runners.postrender.remove(this);
343
+ }
344
+ /**
345
+ * Updates the accessibility layer during rendering.
346
+ * - Removes divs for containers no longer in the scene
347
+ * - Updates the position and dimensions of the root div
348
+ * - Updates positions of active accessibility divs
349
+ * Only fires while the accessibility system is active.
350
+ * @ignore
351
+ */
352
+ postrender() {
353
+ const e = performance.now();
354
+ if (this._mobileInfo.android.device && e < this._androidUpdateCount || (this._androidUpdateCount = e + this._androidUpdateFrequency, !this._renderer.renderingToScreen || !this._renderer.view.canvas))
355
+ return;
356
+ const t = /* @__PURE__ */ new Set();
357
+ if (this._renderer.lastObjectRendered) {
358
+ this._updateAccessibleObjects(this._renderer.lastObjectRendered);
359
+ for (const i of this._children)
360
+ i._renderId === this._renderId && t.add(this._children.indexOf(i));
361
+ }
362
+ for (let i = this._children.length - 1; i >= 0; i--) {
363
+ const n = this._children[i];
364
+ t.has(i) || (n._accessibleDiv && n._accessibleDiv.parentNode && (n._accessibleDiv.parentNode.removeChild(n._accessibleDiv), this._pool.push(n._accessibleDiv), n._accessibleDiv = null), n._accessibleActive = !1, te(this._children, i, 1));
365
+ }
366
+ this._renderer.renderingToScreen && this._canvasObserver.ensureAttached();
367
+ for (let i = 0; i < this._children.length; i++) {
368
+ const n = this._children[i];
369
+ if (!n._accessibleActive || !n._accessibleDiv)
370
+ continue;
371
+ const s = n._accessibleDiv, o = n.hitArea || n.getBounds().rectangle;
372
+ if (n.hitArea) {
373
+ const r = n.worldTransform;
374
+ s.style.left = `${r.tx + o.x * r.a}px`, s.style.top = `${r.ty + o.y * r.d}px`, s.style.width = `${o.width * r.a}px`, s.style.height = `${o.height * r.d}px`;
375
+ } else
376
+ this._capHitArea(o), s.style.left = `${o.x}px`, s.style.top = `${o.y}px`, s.style.width = `${o.width}px`, s.style.height = `${o.height}px`;
377
+ }
378
+ this._renderId++;
379
+ }
380
+ /**
381
+ * private function that will visually add the information to the
382
+ * accessibility div
383
+ * @param {HTMLElement} div -
384
+ */
385
+ _updateDebugHTML(e) {
386
+ e.innerHTML = `type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`;
387
+ }
388
+ /**
389
+ * Adjust the hit area based on the bounds of a display object
390
+ * @param {Rectangle} hitArea - Bounds of the child
391
+ */
392
+ _capHitArea(e) {
393
+ e.x < 0 && (e.width += e.x, e.x = 0), e.y < 0 && (e.height += e.y, e.y = 0);
394
+ const { width: t, height: i } = this._renderer;
395
+ e.x + e.width > t && (e.width = t - e.x), e.y + e.height > i && (e.height = i - e.y);
396
+ }
397
+ /**
398
+ * Creates or reuses a div element for a Container and adds it to the accessibility layer.
399
+ * Sets up ARIA attributes, event listeners, and positioning based on the container's properties.
400
+ * @private
401
+ * @param {Container} container - The child to make accessible.
402
+ */
403
+ _addChild(e) {
404
+ let t = this._pool.pop();
405
+ t || (e.accessibleType === "button" ? t = document.createElement("button") : (t = document.createElement(e.accessibleType), t.style.cssText = `
406
+ color: transparent;
407
+ pointer-events: none;
408
+ padding: 0;
409
+ margin: 0;
410
+ border: 0;
411
+ outline: 0;
412
+ background: transparent;
413
+ box-sizing: border-box;
414
+ user-select: none;
415
+ -webkit-user-select: none;
416
+ -moz-user-select: none;
417
+ -ms-user-select: none;
418
+ `, e.accessibleText && (t.innerText = e.accessibleText)), t.style.width = `${W}px`, t.style.height = `${W}px`, t.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent", t.style.position = "absolute", t.style.zIndex = j.toString(), t.style.borderStyle = "none", navigator.userAgent.toLowerCase().includes("chrome") ? t.setAttribute("aria-live", "off") : t.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? t.setAttribute("aria-relevant", "additions") : t.setAttribute("aria-relevant", "text"), t.addEventListener("click", this._onClick.bind(this)), t.addEventListener("focus", this._onFocus.bind(this)), t.addEventListener("focusout", this._onFocusOut.bind(this))), t.style.pointerEvents = e.accessiblePointerEvents, t.type = e.accessibleType, e.accessibleTitle && e.accessibleTitle !== null ? t.title = e.accessibleTitle : (!e.accessibleHint || e.accessibleHint === null) && (t.title = `container ${e.tabIndex}`), e.accessibleHint && e.accessibleHint !== null && t.setAttribute("aria-label", e.accessibleHint), this.debug && this._updateDebugHTML(t), e._accessibleActive = !0, e._accessibleDiv = t, t.container = e, this._children.push(e), this._div.appendChild(e._accessibleDiv), e.interactive && (e._accessibleDiv.tabIndex = e.tabIndex);
419
+ }
420
+ /**
421
+ * Dispatch events with the EventSystem.
422
+ * @param e
423
+ * @param type
424
+ * @private
425
+ */
426
+ _dispatchEvent(e, t) {
427
+ const { container: i } = e.target, n = this._renderer.events.rootBoundary, s = Object.assign(new M(n), { target: i });
428
+ n.rootTarget = this._renderer.lastObjectRendered, t.forEach((o) => n.dispatchEvent(s, o));
429
+ }
430
+ /**
431
+ * Maps the div button press to pixi's EventSystem (click)
432
+ * @private
433
+ * @param {MouseEvent} e - The click event.
434
+ */
435
+ _onClick(e) {
436
+ this._dispatchEvent(e, ["click", "pointertap", "tap"]);
437
+ }
438
+ /**
439
+ * Maps the div focus events to pixi's EventSystem (mouseover)
440
+ * @private
441
+ * @param {FocusEvent} e - The focus event.
442
+ */
443
+ _onFocus(e) {
444
+ e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "assertive"), this._dispatchEvent(e, ["mouseover"]);
445
+ }
446
+ /**
447
+ * Maps the div focus events to pixi's EventSystem (mouseout)
448
+ * @private
449
+ * @param {FocusEvent} e - The focusout event.
450
+ */
451
+ _onFocusOut(e) {
452
+ e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "polite"), this._dispatchEvent(e, ["mouseout"]);
453
+ }
454
+ /**
455
+ * Is called when a key is pressed
456
+ * @private
457
+ * @param {KeyboardEvent} e - The keydown event.
458
+ */
459
+ _onKeyDown(e) {
460
+ e.keyCode !== re || !this._activateOnTab || this._activate();
461
+ }
462
+ /**
463
+ * Is called when the mouse moves across the renderer element
464
+ * @private
465
+ * @param {MouseEvent} e - The mouse event.
466
+ */
467
+ _onMouseMove(e) {
468
+ e.movementX === 0 && e.movementY === 0 || this._deactivate();
469
+ }
470
+ /**
471
+ * Destroys the accessibility system. Removes all elements and listeners.
472
+ * > [!IMPORTANT] This is typically called automatically when the {@link Application} is destroyed.
473
+ * > A typically user should not need to call this method directly.
474
+ */
475
+ destroy() {
476
+ var e;
477
+ this._deactivate(), this._destroyTouchHook(), (e = this._canvasObserver) == null || e.destroy(), this._canvasObserver = null, this._div = null, this._pool = null, this._children = null, this._renderer = null, this._activateOnTab && globalThis.removeEventListener("keydown", this._onKeyDown);
478
+ }
479
+ /**
480
+ * Enables or disables the accessibility system.
481
+ * @param enabled - Whether to enable or disable accessibility.
482
+ * @example
483
+ * ```js
484
+ * app.renderer.accessibility.setAccessibilityEnabled(true); // Enable accessibility
485
+ * app.renderer.accessibility.setAccessibilityEnabled(false); // Disable accessibility
486
+ * ```
487
+ */
488
+ setAccessibilityEnabled(e) {
489
+ e ? this._activate() : this._deactivate();
490
+ }
491
+ };
492
+ S.extension = {
493
+ type: [
494
+ b.WebGLSystem,
495
+ b.WebGPUSystem
496
+ ],
497
+ name: "accessibility"
498
+ };
499
+ S.defaultOptions = {
500
+ /**
501
+ * Whether to enable accessibility features on initialization
502
+ * @default false
503
+ */
504
+ enabledByDefault: !1,
505
+ /**
506
+ * Whether to visually show the accessibility divs for debugging
507
+ * @default false
508
+ */
509
+ debug: !1,
510
+ /**
511
+ * Whether to activate accessibility when tab key is pressed
512
+ * @default true
513
+ */
514
+ activateOnTab: !0,
515
+ /**
516
+ * Whether to deactivate accessibility when mouse moves
517
+ * @default true
518
+ */
519
+ deactivateOnMouseMove: !0
520
+ };
521
+ let ue = S;
522
+ const pe = {
523
+ accessible: !1,
524
+ accessibleTitle: null,
525
+ accessibleHint: null,
526
+ tabIndex: 0,
527
+ accessibleType: "button",
528
+ accessibleText: null,
529
+ accessiblePointerEvents: "auto",
530
+ accessibleChildren: !0,
531
+ _accessibleActive: !1,
532
+ _accessibleDiv: null,
533
+ _renderId: -1
534
+ };
535
+ class Q {
536
+ /**
537
+ * Constructor for the DOMPipe class.
538
+ * @param renderer - The renderer instance that this DOMPipe will be associated with.
539
+ */
540
+ constructor(e) {
541
+ this._attachedDomElements = [], this._renderer = e, this._renderer.runners.postrender.add(this), this._renderer.runners.init.add(this), this._domElement = document.createElement("div"), this._domElement.style.position = "absolute", this._domElement.style.top = "0", this._domElement.style.left = "0", this._domElement.style.pointerEvents = "none", this._domElement.style.zIndex = "1000";
542
+ }
543
+ /** Initializes the DOMPipe, setting up the main DOM element and adding it to the document body. */
544
+ init() {
545
+ this._canvasObserver = new q({
546
+ domElement: this._domElement,
547
+ renderer: this._renderer
548
+ });
549
+ }
550
+ /**
551
+ * Adds a renderable DOM container to the list of attached elements.
552
+ * @param domContainer - The DOM container to be added.
553
+ * @param _instructionSet - The instruction set (unused).
554
+ */
555
+ addRenderable(e, t) {
556
+ this._attachedDomElements.includes(e) || this._attachedDomElements.push(e);
557
+ }
558
+ /**
559
+ * Updates a renderable DOM container.
560
+ * @param _domContainer - The DOM container to be updated (unused).
561
+ */
562
+ updateRenderable(e) {
563
+ }
564
+ /**
565
+ * Validates a renderable DOM container.
566
+ * @param _domContainer - The DOM container to be validated (unused).
567
+ * @returns Always returns true as validation is not required.
568
+ */
569
+ validateRenderable(e) {
570
+ return !0;
571
+ }
572
+ /** Handles the post-rendering process, ensuring DOM elements are correctly positioned and visible. */
573
+ postrender() {
574
+ const e = this._attachedDomElements;
575
+ if (e.length === 0) {
576
+ this._domElement.remove();
577
+ return;
578
+ }
579
+ this._canvasObserver.ensureAttached();
580
+ for (let t = 0; t < e.length; t++) {
581
+ const i = e[t], n = i.element;
582
+ if (!i.parent || i.globalDisplayStatus < 7)
583
+ n == null || n.remove(), e.splice(t, 1), t--;
584
+ else {
585
+ this._domElement.contains(n) || (n.style.position = "absolute", n.style.pointerEvents = "auto", this._domElement.appendChild(n));
586
+ const s = i.worldTransform, o = i._anchor, r = i.width * o.x, l = i.height * o.y;
587
+ n.style.transformOrigin = `${r}px ${l}px`, n.style.transform = `matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, ${s.tx - r}, ${s.ty - l})`, n.style.opacity = i.groupAlpha.toString();
588
+ }
589
+ }
590
+ }
591
+ /** Destroys the DOMPipe, removing all attached DOM elements and cleaning up resources. */
592
+ destroy() {
593
+ var e;
594
+ this._renderer.runners.postrender.remove(this);
595
+ for (let t = 0; t < this._attachedDomElements.length; t++)
596
+ (e = this._attachedDomElements[t].element) == null || e.remove();
597
+ this._attachedDomElements.length = 0, this._domElement.remove(), this._canvasObserver.destroy(), this._renderer = null;
598
+ }
599
+ }
600
+ Q.extension = {
601
+ type: [
602
+ b.WebGLPipes,
603
+ b.WebGPUPipes,
604
+ b.CanvasPipes
605
+ ],
606
+ name: "dom"
607
+ };
608
+ class ve {
609
+ constructor() {
610
+ this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
611
+ }
612
+ /**
613
+ * Initializes the event ticker.
614
+ * @param events - The event system.
615
+ */
616
+ init(e) {
617
+ this.removeTickerListener(), this.events = e, this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
618
+ }
619
+ /** Whether to pause the update checks or not. */
620
+ get pauseUpdate() {
621
+ return this._pauseUpdate;
622
+ }
623
+ set pauseUpdate(e) {
624
+ this._pauseUpdate = e;
625
+ }
626
+ /** Adds the ticker listener. */
627
+ addTickerListener() {
628
+ this._tickerAdded || !this.domElement || (A.system.add(this._tickerUpdate, this, Z.INTERACTION), this._tickerAdded = !0);
629
+ }
630
+ /** Removes the ticker listener. */
631
+ removeTickerListener() {
632
+ this._tickerAdded && (A.system.remove(this._tickerUpdate, this), this._tickerAdded = !1);
633
+ }
634
+ /** Sets flag to not fire extra events when the user has already moved there mouse */
635
+ pointerMoved() {
636
+ this._didMove = !0;
637
+ }
638
+ /** Updates the state of interactive objects. */
639
+ _update() {
640
+ if (!this.domElement || this._pauseUpdate)
641
+ return;
642
+ if (this._didMove) {
643
+ this._didMove = !1;
644
+ return;
645
+ }
646
+ const e = this.events._rootPointerEvent;
647
+ this.events.supportsTouchEvents && e.pointerType === "touch" || globalThis.document.dispatchEvent(this.events.supportsPointerEvents ? new PointerEvent("pointermove", {
648
+ clientX: e.clientX,
649
+ clientY: e.clientY,
650
+ pointerType: e.pointerType,
651
+ pointerId: e.pointerId
652
+ }) : new MouseEvent("mousemove", {
653
+ clientX: e.clientX,
654
+ clientY: e.clientY
655
+ }));
656
+ }
657
+ /**
658
+ * Updates the state of interactive objects if at least {@link interactionFrequency}
659
+ * milliseconds have passed since the last invocation.
660
+ *
661
+ * Invoked by a throttled ticker update from {@link Ticker.system}.
662
+ * @param ticker - The throttled ticker.
663
+ */
664
+ _tickerUpdate(e) {
665
+ this._deltaTime += e.deltaTime, !(this._deltaTime < this.interactionFrequency) && (this._deltaTime = 0, this._update());
666
+ }
667
+ }
668
+ const y = new ve();
669
+ class D extends M {
670
+ constructor() {
671
+ super(...arguments), this.client = new _(), this.movement = new _(), this.offset = new _(), this.global = new _(), this.screen = new _();
672
+ }
673
+ /** @readonly */
674
+ get clientX() {
675
+ return this.client.x;
676
+ }
677
+ /** @readonly */
678
+ get clientY() {
679
+ return this.client.y;
680
+ }
681
+ /**
682
+ * Alias for {@link FederatedMouseEvent.clientX this.clientX}.
683
+ * @readonly
684
+ */
685
+ get x() {
686
+ return this.clientX;
687
+ }
688
+ /**
689
+ * Alias for {@link FederatedMouseEvent.clientY this.clientY}.
690
+ * @readonly
691
+ */
692
+ get y() {
693
+ return this.clientY;
694
+ }
695
+ /** @readonly */
696
+ get movementX() {
697
+ return this.movement.x;
698
+ }
699
+ /** @readonly */
700
+ get movementY() {
701
+ return this.movement.y;
702
+ }
703
+ /** @readonly */
704
+ get offsetX() {
705
+ return this.offset.x;
706
+ }
707
+ /** @readonly */
708
+ get offsetY() {
709
+ return this.offset.y;
710
+ }
711
+ /** @readonly */
712
+ get globalX() {
713
+ return this.global.x;
714
+ }
715
+ /** @readonly */
716
+ get globalY() {
717
+ return this.global.y;
718
+ }
719
+ /**
720
+ * The pointer coordinates in the renderer's screen. Alias for `screen.x`.
721
+ * @readonly
722
+ */
723
+ get screenX() {
724
+ return this.screen.x;
725
+ }
726
+ /**
727
+ * The pointer coordinates in the renderer's screen. Alias for `screen.y`.
728
+ * @readonly
729
+ */
730
+ get screenY() {
731
+ return this.screen.y;
732
+ }
733
+ /**
734
+ * Converts global coordinates into container-local coordinates.
735
+ *
736
+ * This method transforms coordinates from world space to a container's local space,
737
+ * useful for precise positioning and hit testing.
738
+ * @param container - The Container to get local coordinates for
739
+ * @param point - Optional Point object to store the result. If not provided, a new Point will be created
740
+ * @param globalPos - Optional custom global coordinates. If not provided, the event's global position is used
741
+ * @returns The local coordinates as a Point object
742
+ * @example
743
+ * ```ts
744
+ * // Basic usage - get local coordinates relative to a container
745
+ * sprite.on('pointermove', (event: FederatedMouseEvent) => {
746
+ * // Get position relative to the sprite
747
+ * const localPos = event.getLocalPosition(sprite);
748
+ * console.log('Local position:', localPos.x, localPos.y);
749
+ * });
750
+ * // Using custom global coordinates
751
+ * const customGlobal = new Point(100, 100);
752
+ * sprite.on('pointermove', (event: FederatedMouseEvent) => {
753
+ * // Transform custom coordinates
754
+ * const localPos = event.getLocalPosition(sprite, undefined, customGlobal);
755
+ * console.log('Custom local position:', localPos.x, localPos.y);
756
+ * });
757
+ * ```
758
+ * @see {@link Container.worldTransform} For the transformation matrix
759
+ * @see {@link Point} For the point class used to store coordinates
760
+ */
761
+ getLocalPosition(e, t, i) {
762
+ return e.worldTransform.applyInverse(i || this.global, t);
763
+ }
764
+ /**
765
+ * Whether the modifier key was pressed when this event natively occurred.
766
+ * @param key - The modifier key.
767
+ */
768
+ getModifierState(e) {
769
+ return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(e);
770
+ }
771
+ /**
772
+ * Not supported.
773
+ * @param _typeArg
774
+ * @param _canBubbleArg
775
+ * @param _cancelableArg
776
+ * @param _viewArg
777
+ * @param _detailArg
778
+ * @param _screenXArg
779
+ * @param _screenYArg
780
+ * @param _clientXArg
781
+ * @param _clientYArg
782
+ * @param _ctrlKeyArg
783
+ * @param _altKeyArg
784
+ * @param _shiftKeyArg
785
+ * @param _metaKeyArg
786
+ * @param _buttonArg
787
+ * @param _relatedTargetArg
788
+ * @deprecated since 7.0.0
789
+ * @ignore
790
+ */
791
+ // eslint-disable-next-line max-params
792
+ initMouseEvent(e, t, i, n, s, o, r, l, d, p, u, h, v, c, Ee) {
793
+ throw new Error("Method not implemented.");
794
+ }
795
+ }
796
+ class f extends D {
797
+ constructor() {
798
+ super(...arguments), this.width = 0, this.height = 0, this.isPrimary = !1;
799
+ }
800
+ /**
801
+ * Only included for completeness for now
802
+ * @ignore
803
+ */
804
+ getCoalescedEvents() {
805
+ return this.type === "pointermove" || this.type === "mousemove" || this.type === "touchmove" ? [this] : [];
806
+ }
807
+ /**
808
+ * Only included for completeness for now
809
+ * @ignore
810
+ */
811
+ getPredictedEvents() {
812
+ throw new Error("getPredictedEvents is not supported!");
813
+ }
814
+ }
815
+ class T extends D {
816
+ constructor() {
817
+ super(...arguments), this.DOM_DELTA_PIXEL = 0, this.DOM_DELTA_LINE = 1, this.DOM_DELTA_PAGE = 2;
818
+ }
819
+ }
820
+ T.DOM_DELTA_PIXEL = 0;
821
+ T.DOM_DELTA_LINE = 1;
822
+ T.DOM_DELTA_PAGE = 2;
823
+ const fe = 2048, me = new _(), P = new _();
824
+ class _e {
825
+ /**
826
+ * @param rootTarget - The holder of the event boundary.
827
+ */
828
+ constructor(e) {
829
+ this.dispatch = new ie(), this.moveOnAll = !1, this.enableGlobalMoveEvents = !0, this.mappingState = {
830
+ trackingData: {}
831
+ }, this.eventPool = /* @__PURE__ */ new Map(), this._allInteractiveElements = [], this._hitElements = [], this._isPointerMoveEvent = !1, this.rootTarget = e, this.hitPruneFn = this.hitPruneFn.bind(this), this.hitTestFn = this.hitTestFn.bind(this), this.mapPointerDown = this.mapPointerDown.bind(this), this.mapPointerMove = this.mapPointerMove.bind(this), this.mapPointerOut = this.mapPointerOut.bind(this), this.mapPointerOver = this.mapPointerOver.bind(this), this.mapPointerUp = this.mapPointerUp.bind(this), this.mapPointerUpOutside = this.mapPointerUpOutside.bind(this), this.mapWheel = this.mapWheel.bind(this), this.mappingTable = {}, this.addEventMapping("pointerdown", this.mapPointerDown), this.addEventMapping("pointermove", this.mapPointerMove), this.addEventMapping("pointerout", this.mapPointerOut), this.addEventMapping("pointerleave", this.mapPointerOut), this.addEventMapping("pointerover", this.mapPointerOver), this.addEventMapping("pointerup", this.mapPointerUp), this.addEventMapping("pointerupoutside", this.mapPointerUpOutside), this.addEventMapping("wheel", this.mapWheel);
832
+ }
833
+ /**
834
+ * Adds an event mapping for the event `type` handled by `fn`.
835
+ *
836
+ * Event mappings can be used to implement additional or custom events. They take an event
837
+ * coming from the upstream scene (or directly from the {@link EventSystem}) and dispatch new downstream events
838
+ * generally trickling down and bubbling up to {@link EventBoundary.rootTarget this.rootTarget}.
839
+ *
840
+ * To modify the semantics of existing events, the built-in mapping methods of EventBoundary should be overridden
841
+ * instead.
842
+ * @param type - The type of upstream event to map.
843
+ * @param fn - The mapping method. The context of this function must be bound manually, if desired.
844
+ */
845
+ addEventMapping(e, t) {
846
+ this.mappingTable[e] || (this.mappingTable[e] = []), this.mappingTable[e].push({
847
+ fn: t,
848
+ priority: 0
849
+ }), this.mappingTable[e].sort((i, n) => i.priority - n.priority);
850
+ }
851
+ /**
852
+ * Dispatches the given event
853
+ * @param e - The event to dispatch.
854
+ * @param type - The type of event to dispatch. Defaults to `e.type`.
855
+ */
856
+ dispatchEvent(e, t) {
857
+ e.propagationStopped = !1, e.propagationImmediatelyStopped = !1, this.propagate(e, t), this.dispatch.emit(t || e.type, e);
858
+ }
859
+ /**
860
+ * Maps the given upstream event through the event boundary and propagates it downstream.
861
+ * @param e - The event to map.
862
+ */
863
+ mapEvent(e) {
864
+ if (!this.rootTarget)
865
+ return;
866
+ const t = this.mappingTable[e.type];
867
+ if (t)
868
+ for (let i = 0, n = t.length; i < n; i++)
869
+ t[i].fn(e);
870
+ else
871
+ g(`[EventBoundary]: Event mapping not defined for ${e.type}`);
872
+ }
873
+ /**
874
+ * Finds the Container that is the target of a event at the given coordinates.
875
+ *
876
+ * The passed (x,y) coordinates are in the world space above this event boundary.
877
+ * @param x - The x coordinate of the event.
878
+ * @param y - The y coordinate of the event.
879
+ */
880
+ hitTest(e, t) {
881
+ y.pauseUpdate = !0;
882
+ const n = this._isPointerMoveEvent && this.enableGlobalMoveEvents ? "hitTestMoveRecursive" : "hitTestRecursive", s = this[n](
883
+ this.rootTarget,
884
+ this.rootTarget.eventMode,
885
+ me.set(e, t),
886
+ this.hitTestFn,
887
+ this.hitPruneFn
888
+ );
889
+ return s && s[0];
890
+ }
891
+ /**
892
+ * Propagate the passed event from from {@link EventBoundary.rootTarget this.rootTarget} to its
893
+ * target `e.target`.
894
+ * @param e - The event to propagate.
895
+ * @param type - The type of event to propagate. Defaults to `e.type`.
896
+ */
897
+ propagate(e, t) {
898
+ if (!e.target)
899
+ return;
900
+ const i = e.composedPath();
901
+ e.eventPhase = e.CAPTURING_PHASE;
902
+ for (let n = 0, s = i.length - 1; n < s; n++)
903
+ if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
904
+ return;
905
+ if (e.eventPhase = e.AT_TARGET, e.currentTarget = e.target, this.notifyTarget(e, t), !(e.propagationStopped || e.propagationImmediatelyStopped)) {
906
+ e.eventPhase = e.BUBBLING_PHASE;
907
+ for (let n = i.length - 2; n >= 0; n--)
908
+ if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
909
+ return;
910
+ }
911
+ }
912
+ /**
913
+ * Emits the event `e` to all interactive containers. The event is propagated in the bubbling phase always.
914
+ *
915
+ * This is used in the `globalpointermove` event.
916
+ * @param e - The emitted event.
917
+ * @param type - The listeners to notify.
918
+ * @param targets - The targets to notify.
919
+ */
920
+ all(e, t, i = this._allInteractiveElements) {
921
+ if (i.length === 0)
922
+ return;
923
+ e.eventPhase = e.BUBBLING_PHASE;
924
+ const n = Array.isArray(t) ? t : [t];
925
+ for (let s = i.length - 1; s >= 0; s--)
926
+ n.forEach((o) => {
927
+ e.currentTarget = i[s], this.notifyTarget(e, o);
928
+ });
929
+ }
930
+ /**
931
+ * Finds the propagation path from {@link EventBoundary.rootTarget rootTarget} to the passed
932
+ * `target`. The last element in the path is `target`.
933
+ * @param target - The target to find the propagation path to.
934
+ */
935
+ propagationPath(e) {
936
+ const t = [e];
937
+ for (let i = 0; i < fe && e !== this.rootTarget && e.parent; i++) {
938
+ if (!e.parent)
939
+ throw new Error("Cannot find propagation path to disconnected target");
940
+ t.push(e.parent), e = e.parent;
941
+ }
942
+ return t.reverse(), t;
943
+ }
944
+ hitTestMoveRecursive(e, t, i, n, s, o = !1) {
945
+ let r = !1;
946
+ if (this._interactivePrune(e))
947
+ return null;
948
+ if ((e.eventMode === "dynamic" || t === "dynamic") && (y.pauseUpdate = !1), e.interactiveChildren && e.children) {
949
+ const p = e.children;
950
+ for (let u = p.length - 1; u >= 0; u--) {
951
+ const h = p[u], v = this.hitTestMoveRecursive(
952
+ h,
953
+ this._isInteractive(t) ? t : h.eventMode,
954
+ i,
955
+ n,
956
+ s,
957
+ o || s(e, i)
958
+ );
959
+ if (v) {
960
+ if (v.length > 0 && !v[v.length - 1].parent)
961
+ continue;
962
+ const c = e.isInteractive();
963
+ (v.length > 0 || c) && (c && this._allInteractiveElements.push(e), v.push(e)), this._hitElements.length === 0 && (this._hitElements = v), r = !0;
964
+ }
965
+ }
966
+ }
967
+ const l = this._isInteractive(t), d = e.isInteractive();
968
+ return d && d && this._allInteractiveElements.push(e), o || this._hitElements.length > 0 ? null : r ? this._hitElements : l && !s(e, i) && n(e, i) ? d ? [e] : [] : null;
969
+ }
970
+ /**
971
+ * Recursive implementation for {@link EventBoundary.hitTest hitTest}.
972
+ * @param currentTarget - The Container that is to be hit tested.
973
+ * @param eventMode - The event mode for the `currentTarget` or one of its parents.
974
+ * @param location - The location that is being tested for overlap.
975
+ * @param testFn - Callback that determines whether the target passes hit testing. This callback
976
+ * can assume that `pruneFn` failed to prune the container.
977
+ * @param pruneFn - Callback that determiness whether the target and all of its children
978
+ * cannot pass the hit test. It is used as a preliminary optimization to prune entire subtrees
979
+ * of the scene graph.
980
+ * @returns An array holding the hit testing target and all its ancestors in order. The first element
981
+ * is the target itself and the last is {@link EventBoundary.rootTarget rootTarget}. This is the opposite
982
+ * order w.r.t. the propagation path. If no hit testing target is found, null is returned.
983
+ */
984
+ hitTestRecursive(e, t, i, n, s) {
985
+ if (this._interactivePrune(e) || s(e, i))
986
+ return null;
987
+ if ((e.eventMode === "dynamic" || t === "dynamic") && (y.pauseUpdate = !1), e.interactiveChildren && e.children) {
988
+ const l = e.children, d = i;
989
+ for (let p = l.length - 1; p >= 0; p--) {
990
+ const u = l[p], h = this.hitTestRecursive(
991
+ u,
992
+ this._isInteractive(t) ? t : u.eventMode,
993
+ d,
994
+ n,
995
+ s
996
+ );
997
+ if (h) {
998
+ if (h.length > 0 && !h[h.length - 1].parent)
999
+ continue;
1000
+ const v = e.isInteractive();
1001
+ return (h.length > 0 || v) && h.push(e), h;
1002
+ }
1003
+ }
1004
+ }
1005
+ const o = this._isInteractive(t), r = e.isInteractive();
1006
+ return o && n(e, i) ? r ? [e] : [] : null;
1007
+ }
1008
+ _isInteractive(e) {
1009
+ return e === "static" || e === "dynamic";
1010
+ }
1011
+ _interactivePrune(e) {
1012
+ return !e || !e.visible || !e.renderable || !e.measurable || e.eventMode === "none" || e.eventMode === "passive" && !e.interactiveChildren;
1013
+ }
1014
+ /**
1015
+ * Checks whether the container or any of its children cannot pass the hit test at all.
1016
+ *
1017
+ * {@link EventBoundary}'s implementation uses the {@link Container.hitArea hitArea}
1018
+ * and {@link Container._maskEffect} for pruning.
1019
+ * @param container - The container to prune.
1020
+ * @param location - The location to test for overlap.
1021
+ */
1022
+ hitPruneFn(e, t) {
1023
+ if (e.hitArea && (e.worldTransform.applyInverse(t, P), !e.hitArea.contains(P.x, P.y)))
1024
+ return !0;
1025
+ if (e.effects && e.effects.length)
1026
+ for (let i = 0; i < e.effects.length; i++) {
1027
+ const n = e.effects[i];
1028
+ if (n.containsPoint && !n.containsPoint(t, this.hitTestFn))
1029
+ return !0;
1030
+ }
1031
+ return !1;
1032
+ }
1033
+ /**
1034
+ * Checks whether the container passes hit testing for the given location.
1035
+ * @param container - The container to test.
1036
+ * @param location - The location to test for overlap.
1037
+ * @returns - Whether `container` passes hit testing for `location`.
1038
+ */
1039
+ hitTestFn(e, t) {
1040
+ return e.hitArea ? !0 : e != null && e.containsPoint ? (e.worldTransform.applyInverse(t, P), e.containsPoint(P)) : !1;
1041
+ }
1042
+ /**
1043
+ * Notify all the listeners to the event's `currentTarget`.
1044
+ *
1045
+ * If the `currentTarget` contains the property `on<type>`, then it is called here,
1046
+ * simulating the behavior from version 6.x and prior.
1047
+ * @param e - The event passed to the target.
1048
+ * @param type - The type of event to notify. Defaults to `e.type`.
1049
+ */
1050
+ notifyTarget(e, t) {
1051
+ var s, o;
1052
+ if (!e.currentTarget.isInteractive())
1053
+ return;
1054
+ t ?? (t = e.type);
1055
+ const i = `on${t}`;
1056
+ (o = (s = e.currentTarget)[i]) == null || o.call(s, e);
1057
+ const n = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? `${t}capture` : t;
1058
+ this._notifyListeners(e, n), e.eventPhase === e.AT_TARGET && this._notifyListeners(e, t);
1059
+ }
1060
+ /**
1061
+ * Maps the upstream `pointerdown` events to a downstream `pointerdown` event.
1062
+ *
1063
+ * `touchstart`, `rightdown`, `mousedown` events are also dispatched for specific pointer types.
1064
+ * @param from - The upstream `pointerdown` event.
1065
+ */
1066
+ mapPointerDown(e) {
1067
+ if (!(e instanceof f)) {
1068
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1069
+ return;
1070
+ }
1071
+ const t = this.createPointerEvent(e);
1072
+ if (this.dispatchEvent(t, "pointerdown"), t.pointerType === "touch")
1073
+ this.dispatchEvent(t, "touchstart");
1074
+ else if (t.pointerType === "mouse" || t.pointerType === "pen") {
1075
+ const n = t.button === 2;
1076
+ this.dispatchEvent(t, n ? "rightdown" : "mousedown");
1077
+ }
1078
+ const i = this.trackingData(e.pointerId);
1079
+ i.pressTargetsByButton[e.button] = t.composedPath(), this.freeEvent(t);
1080
+ }
1081
+ /**
1082
+ * Maps the upstream `pointermove` to downstream `pointerout`, `pointerover`, and `pointermove` events, in that order.
1083
+ *
1084
+ * The tracking data for the specific pointer has an updated `overTarget`. `mouseout`, `mouseover`,
1085
+ * `mousemove`, and `touchmove` events are fired as well for specific pointer types.
1086
+ * @param from - The upstream `pointermove` event.
1087
+ */
1088
+ mapPointerMove(e) {
1089
+ var l, d;
1090
+ if (!(e instanceof f)) {
1091
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1092
+ return;
1093
+ }
1094
+ this._allInteractiveElements.length = 0, this._hitElements.length = 0, this._isPointerMoveEvent = !0;
1095
+ const t = this.createPointerEvent(e);
1096
+ this._isPointerMoveEvent = !1;
1097
+ const i = t.pointerType === "mouse" || t.pointerType === "pen", n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.overTargets);
1098
+ if (((l = n.overTargets) == null ? void 0 : l.length) > 0 && s !== t.target) {
1099
+ const p = e.type === "mousemove" ? "mouseout" : "pointerout", u = this.createPointerEvent(e, p, s);
1100
+ if (this.dispatchEvent(u, "pointerout"), i && this.dispatchEvent(u, "mouseout"), !t.composedPath().includes(s)) {
1101
+ const h = this.createPointerEvent(e, "pointerleave", s);
1102
+ for (h.eventPhase = h.AT_TARGET; h.target && !t.composedPath().includes(h.target); )
1103
+ h.currentTarget = h.target, this.notifyTarget(h), i && this.notifyTarget(h, "mouseleave"), h.target = h.target.parent;
1104
+ this.freeEvent(h);
1105
+ }
1106
+ this.freeEvent(u);
1107
+ }
1108
+ if (s !== t.target) {
1109
+ const p = e.type === "mousemove" ? "mouseover" : "pointerover", u = this.clonePointerEvent(t, p);
1110
+ this.dispatchEvent(u, "pointerover"), i && this.dispatchEvent(u, "mouseover");
1111
+ let h = s == null ? void 0 : s.parent;
1112
+ for (; h && h !== this.rootTarget.parent && h !== t.target; )
1113
+ h = h.parent;
1114
+ if (!h || h === this.rootTarget.parent) {
1115
+ const c = this.clonePointerEvent(t, "pointerenter");
1116
+ for (c.eventPhase = c.AT_TARGET; c.target && c.target !== s && c.target !== this.rootTarget.parent; )
1117
+ c.currentTarget = c.target, this.notifyTarget(c), i && this.notifyTarget(c, "mouseenter"), c.target = c.target.parent;
1118
+ this.freeEvent(c);
1119
+ }
1120
+ this.freeEvent(u);
1121
+ }
1122
+ const o = [], r = this.enableGlobalMoveEvents ?? !0;
1123
+ this.moveOnAll ? o.push("pointermove") : this.dispatchEvent(t, "pointermove"), r && o.push("globalpointermove"), t.pointerType === "touch" && (this.moveOnAll ? o.splice(1, 0, "touchmove") : this.dispatchEvent(t, "touchmove"), r && o.push("globaltouchmove")), i && (this.moveOnAll ? o.splice(1, 0, "mousemove") : this.dispatchEvent(t, "mousemove"), r && o.push("globalmousemove"), this.cursor = (d = t.target) == null ? void 0 : d.cursor), o.length > 0 && this.all(t, o), this._allInteractiveElements.length = 0, this._hitElements.length = 0, n.overTargets = t.composedPath(), this.freeEvent(t);
1124
+ }
1125
+ /**
1126
+ * Maps the upstream `pointerover` to downstream `pointerover` and `pointerenter` events, in that order.
1127
+ *
1128
+ * The tracking data for the specific pointer gets a new `overTarget`.
1129
+ * @param from - The upstream `pointerover` event.
1130
+ */
1131
+ mapPointerOver(e) {
1132
+ var o;
1133
+ if (!(e instanceof f)) {
1134
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1135
+ return;
1136
+ }
1137
+ const t = this.trackingData(e.pointerId), i = this.createPointerEvent(e), n = i.pointerType === "mouse" || i.pointerType === "pen";
1138
+ this.dispatchEvent(i, "pointerover"), n && this.dispatchEvent(i, "mouseover"), i.pointerType === "mouse" && (this.cursor = (o = i.target) == null ? void 0 : o.cursor);
1139
+ const s = this.clonePointerEvent(i, "pointerenter");
1140
+ for (s.eventPhase = s.AT_TARGET; s.target && s.target !== this.rootTarget.parent; )
1141
+ s.currentTarget = s.target, this.notifyTarget(s), n && this.notifyTarget(s, "mouseenter"), s.target = s.target.parent;
1142
+ t.overTargets = i.composedPath(), this.freeEvent(i), this.freeEvent(s);
1143
+ }
1144
+ /**
1145
+ * Maps the upstream `pointerout` to downstream `pointerout`, `pointerleave` events, in that order.
1146
+ *
1147
+ * The tracking data for the specific pointer is cleared of a `overTarget`.
1148
+ * @param from - The upstream `pointerout` event.
1149
+ */
1150
+ mapPointerOut(e) {
1151
+ if (!(e instanceof f)) {
1152
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1153
+ return;
1154
+ }
1155
+ const t = this.trackingData(e.pointerId);
1156
+ if (t.overTargets) {
1157
+ const i = e.pointerType === "mouse" || e.pointerType === "pen", n = this.findMountedTarget(t.overTargets), s = this.createPointerEvent(e, "pointerout", n);
1158
+ this.dispatchEvent(s), i && this.dispatchEvent(s, "mouseout");
1159
+ const o = this.createPointerEvent(e, "pointerleave", n);
1160
+ for (o.eventPhase = o.AT_TARGET; o.target && o.target !== this.rootTarget.parent; )
1161
+ o.currentTarget = o.target, this.notifyTarget(o), i && this.notifyTarget(o, "mouseleave"), o.target = o.target.parent;
1162
+ t.overTargets = null, this.freeEvent(s), this.freeEvent(o);
1163
+ }
1164
+ this.cursor = null;
1165
+ }
1166
+ /**
1167
+ * Maps the upstream `pointerup` event to downstream `pointerup`, `pointerupoutside`,
1168
+ * and `click`/`rightclick`/`pointertap` events, in that order.
1169
+ *
1170
+ * The `pointerupoutside` event bubbles from the original `pointerdown` target to the most specific
1171
+ * ancestor of the `pointerdown` and `pointerup` targets, which is also the `click` event's target. `touchend`,
1172
+ * `rightup`, `mouseup`, `touchendoutside`, `rightupoutside`, `mouseupoutside`, and `tap` are fired as well for
1173
+ * specific pointer types.
1174
+ * @param from - The upstream `pointerup` event.
1175
+ */
1176
+ mapPointerUp(e) {
1177
+ if (!(e instanceof f)) {
1178
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1179
+ return;
1180
+ }
1181
+ const t = performance.now(), i = this.createPointerEvent(e);
1182
+ if (this.dispatchEvent(i, "pointerup"), i.pointerType === "touch")
1183
+ this.dispatchEvent(i, "touchend");
1184
+ else if (i.pointerType === "mouse" || i.pointerType === "pen") {
1185
+ const r = i.button === 2;
1186
+ this.dispatchEvent(i, r ? "rightup" : "mouseup");
1187
+ }
1188
+ const n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.pressTargetsByButton[e.button]);
1189
+ let o = s;
1190
+ if (s && !i.composedPath().includes(s)) {
1191
+ let r = s;
1192
+ for (; r && !i.composedPath().includes(r); ) {
1193
+ if (i.currentTarget = r, this.notifyTarget(i, "pointerupoutside"), i.pointerType === "touch")
1194
+ this.notifyTarget(i, "touchendoutside");
1195
+ else if (i.pointerType === "mouse" || i.pointerType === "pen") {
1196
+ const l = i.button === 2;
1197
+ this.notifyTarget(i, l ? "rightupoutside" : "mouseupoutside");
1198
+ }
1199
+ r = r.parent;
1200
+ }
1201
+ delete n.pressTargetsByButton[e.button], o = r;
1202
+ }
1203
+ if (o) {
1204
+ const r = this.clonePointerEvent(i, "click");
1205
+ r.target = o, r.path = null, n.clicksByButton[e.button] || (n.clicksByButton[e.button] = {
1206
+ clickCount: 0,
1207
+ target: r.target,
1208
+ timeStamp: t
1209
+ });
1210
+ const l = n.clicksByButton[e.button];
1211
+ if (l.target === r.target && t - l.timeStamp < 200 ? ++l.clickCount : l.clickCount = 1, l.target = r.target, l.timeStamp = t, r.detail = l.clickCount, r.pointerType === "mouse") {
1212
+ const d = r.button === 2;
1213
+ this.dispatchEvent(r, d ? "rightclick" : "click");
1214
+ } else r.pointerType === "touch" && this.dispatchEvent(r, "tap");
1215
+ this.dispatchEvent(r, "pointertap"), this.freeEvent(r);
1216
+ }
1217
+ this.freeEvent(i);
1218
+ }
1219
+ /**
1220
+ * Maps the upstream `pointerupoutside` event to a downstream `pointerupoutside` event, bubbling from the original
1221
+ * `pointerdown` target to `rootTarget`.
1222
+ *
1223
+ * (The most specific ancestor of the `pointerdown` event and the `pointerup` event must the
1224
+ * `{@link EventBoundary}'s root because the `pointerup` event occurred outside of the boundary.)
1225
+ *
1226
+ * `touchendoutside`, `mouseupoutside`, and `rightupoutside` events are fired as well for specific pointer
1227
+ * types. The tracking data for the specific pointer is cleared of a `pressTarget`.
1228
+ * @param from - The upstream `pointerupoutside` event.
1229
+ */
1230
+ mapPointerUpOutside(e) {
1231
+ if (!(e instanceof f)) {
1232
+ g("EventBoundary cannot map a non-pointer event as a pointer event");
1233
+ return;
1234
+ }
1235
+ const t = this.trackingData(e.pointerId), i = this.findMountedTarget(t.pressTargetsByButton[e.button]), n = this.createPointerEvent(e);
1236
+ if (i) {
1237
+ let s = i;
1238
+ for (; s; )
1239
+ n.currentTarget = s, this.notifyTarget(n, "pointerupoutside"), n.pointerType === "touch" ? this.notifyTarget(n, "touchendoutside") : (n.pointerType === "mouse" || n.pointerType === "pen") && this.notifyTarget(n, n.button === 2 ? "rightupoutside" : "mouseupoutside"), s = s.parent;
1240
+ delete t.pressTargetsByButton[e.button];
1241
+ }
1242
+ this.freeEvent(n);
1243
+ }
1244
+ /**
1245
+ * Maps the upstream `wheel` event to a downstream `wheel` event.
1246
+ * @param from - The upstream `wheel` event.
1247
+ */
1248
+ mapWheel(e) {
1249
+ if (!(e instanceof T)) {
1250
+ g("EventBoundary cannot map a non-wheel event as a wheel event");
1251
+ return;
1252
+ }
1253
+ const t = this.createWheelEvent(e);
1254
+ this.dispatchEvent(t), this.freeEvent(t);
1255
+ }
1256
+ /**
1257
+ * Finds the most specific event-target in the given propagation path that is still mounted in the scene graph.
1258
+ *
1259
+ * This is used to find the correct `pointerup` and `pointerout` target in the case that the original `pointerdown`
1260
+ * or `pointerover` target was unmounted from the scene graph.
1261
+ * @param propagationPath - The propagation path was valid in the past.
1262
+ * @returns - The most specific event-target still mounted at the same location in the scene graph.
1263
+ */
1264
+ findMountedTarget(e) {
1265
+ if (!e)
1266
+ return null;
1267
+ let t = e[0];
1268
+ for (let i = 1; i < e.length && e[i].parent === t; i++)
1269
+ t = e[i];
1270
+ return t;
1271
+ }
1272
+ /**
1273
+ * Creates an event whose `originalEvent` is `from`, with an optional `type` and `target` override.
1274
+ *
1275
+ * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
1276
+ * @param from - The `originalEvent` for the returned event.
1277
+ * @param [type=from.type] - The type of the returned event.
1278
+ * @param target - The target of the returned event.
1279
+ */
1280
+ createPointerEvent(e, t, i) {
1281
+ const n = this.allocateEvent(f);
1282
+ return this.copyPointerData(e, n), this.copyMouseData(e, n), this.copyData(e, n), n.nativeEvent = e.nativeEvent, n.originalEvent = e, n.target = i ?? this.hitTest(n.global.x, n.global.y) ?? this._hitElements[0], typeof t == "string" && (n.type = t), n;
1283
+ }
1284
+ /**
1285
+ * Creates a wheel event whose `originalEvent` is `from`.
1286
+ *
1287
+ * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
1288
+ * @param from - The upstream wheel event.
1289
+ */
1290
+ createWheelEvent(e) {
1291
+ const t = this.allocateEvent(T);
1292
+ return this.copyWheelData(e, t), this.copyMouseData(e, t), this.copyData(e, t), t.nativeEvent = e.nativeEvent, t.originalEvent = e, t.target = this.hitTest(t.global.x, t.global.y), t;
1293
+ }
1294
+ /**
1295
+ * Clones the event `from`, with an optional `type` override.
1296
+ *
1297
+ * The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
1298
+ * @param from - The event to clone.
1299
+ * @param [type=from.type] - The type of the returned event.
1300
+ */
1301
+ clonePointerEvent(e, t) {
1302
+ const i = this.allocateEvent(f);
1303
+ return i.nativeEvent = e.nativeEvent, i.originalEvent = e.originalEvent, this.copyPointerData(e, i), this.copyMouseData(e, i), this.copyData(e, i), i.target = e.target, i.path = e.composedPath().slice(), i.type = t ?? i.type, i;
1304
+ }
1305
+ /**
1306
+ * Copies wheel {@link FederatedWheelEvent} data from `from` into `to`.
1307
+ *
1308
+ * The following properties are copied:
1309
+ * + deltaMode
1310
+ * + deltaX
1311
+ * + deltaY
1312
+ * + deltaZ
1313
+ * @param from - The event to copy data from.
1314
+ * @param to - The event to copy data into.
1315
+ */
1316
+ copyWheelData(e, t) {
1317
+ t.deltaMode = e.deltaMode, t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ;
1318
+ }
1319
+ /**
1320
+ * Copies pointer {@link FederatedPointerEvent} data from `from` into `to`.
1321
+ *
1322
+ * The following properties are copied:
1323
+ * + pointerId
1324
+ * + width
1325
+ * + height
1326
+ * + isPrimary
1327
+ * + pointerType
1328
+ * + pressure
1329
+ * + tangentialPressure
1330
+ * + tiltX
1331
+ * + tiltY
1332
+ * @param from - The event to copy data from.
1333
+ * @param to - The event to copy data into.
1334
+ */
1335
+ copyPointerData(e, t) {
1336
+ e instanceof f && t instanceof f && (t.pointerId = e.pointerId, t.width = e.width, t.height = e.height, t.isPrimary = e.isPrimary, t.pointerType = e.pointerType, t.pressure = e.pressure, t.tangentialPressure = e.tangentialPressure, t.tiltX = e.tiltX, t.tiltY = e.tiltY, t.twist = e.twist);
1337
+ }
1338
+ /**
1339
+ * Copies mouse {@link FederatedMouseEvent} data from `from` to `to`.
1340
+ *
1341
+ * The following properties are copied:
1342
+ * + altKey
1343
+ * + button
1344
+ * + buttons
1345
+ * + clientX
1346
+ * + clientY
1347
+ * + metaKey
1348
+ * + movementX
1349
+ * + movementY
1350
+ * + pageX
1351
+ * + pageY
1352
+ * + x
1353
+ * + y
1354
+ * + screen
1355
+ * + shiftKey
1356
+ * + global
1357
+ * @param from - The event to copy data from.
1358
+ * @param to - The event to copy data into.
1359
+ */
1360
+ copyMouseData(e, t) {
1361
+ e instanceof D && t instanceof D && (t.altKey = e.altKey, t.button = e.button, t.buttons = e.buttons, t.client.copyFrom(e.client), t.ctrlKey = e.ctrlKey, t.metaKey = e.metaKey, t.movement.copyFrom(e.movement), t.screen.copyFrom(e.screen), t.shiftKey = e.shiftKey, t.global.copyFrom(e.global));
1362
+ }
1363
+ /**
1364
+ * Copies base {@link FederatedEvent} data from `from` into `to`.
1365
+ *
1366
+ * The following properties are copied:
1367
+ * + isTrusted
1368
+ * + srcElement
1369
+ * + timeStamp
1370
+ * + type
1371
+ * @param from - The event to copy data from.
1372
+ * @param to - The event to copy data into.
1373
+ */
1374
+ copyData(e, t) {
1375
+ t.isTrusted = e.isTrusted, t.srcElement = e.srcElement, t.timeStamp = performance.now(), t.type = e.type, t.detail = e.detail, t.view = e.view, t.which = e.which, t.layer.copyFrom(e.layer), t.page.copyFrom(e.page);
1376
+ }
1377
+ /**
1378
+ * @param id - The pointer ID.
1379
+ * @returns The tracking data stored for the given pointer. If no data exists, a blank
1380
+ * state will be created.
1381
+ */
1382
+ trackingData(e) {
1383
+ return this.mappingState.trackingData[e] || (this.mappingState.trackingData[e] = {
1384
+ pressTargetsByButton: {},
1385
+ clicksByButton: {},
1386
+ overTarget: null
1387
+ }), this.mappingState.trackingData[e];
1388
+ }
1389
+ /**
1390
+ * Allocate a specific type of event from {@link EventBoundary#eventPool this.eventPool}.
1391
+ *
1392
+ * This allocation is constructor-agnostic, as long as it only takes one argument - this event
1393
+ * boundary.
1394
+ * @param constructor - The event's constructor.
1395
+ * @returns An event of the given type.
1396
+ */
1397
+ allocateEvent(e) {
1398
+ this.eventPool.has(e) || this.eventPool.set(e, []);
1399
+ const t = this.eventPool.get(e).pop() || new e(this);
1400
+ return t.eventPhase = t.NONE, t.currentTarget = null, t.defaultPrevented = !1, t.path = null, t.target = null, t;
1401
+ }
1402
+ /**
1403
+ * Frees the event and puts it back into the event pool.
1404
+ *
1405
+ * It is illegal to reuse the event until it is allocated again, using `this.allocateEvent`.
1406
+ *
1407
+ * It is also advised that events not allocated from {@link EventBoundary#allocateEvent this.allocateEvent}
1408
+ * not be freed. This is because of the possibility that the same event is freed twice, which can cause
1409
+ * it to be allocated twice & result in overwriting.
1410
+ * @param event - The event to be freed.
1411
+ * @throws Error if the event is managed by another event boundary.
1412
+ */
1413
+ freeEvent(e) {
1414
+ if (e.manager !== this)
1415
+ throw new Error("It is illegal to free an event not managed by this EventBoundary!");
1416
+ const t = e.constructor;
1417
+ this.eventPool.has(t) || this.eventPool.set(t, []), this.eventPool.get(t).push(e);
1418
+ }
1419
+ /**
1420
+ * Similar to {@link EventEmitter.emit}, except it stops if the `propagationImmediatelyStopped` flag
1421
+ * is set on the event.
1422
+ * @param e - The event to call each listener with.
1423
+ * @param type - The event key.
1424
+ */
1425
+ _notifyListeners(e, t) {
1426
+ const i = e.currentTarget._events[t];
1427
+ if (i)
1428
+ if ("fn" in i)
1429
+ i.once && e.currentTarget.removeListener(t, i.fn, void 0, !0), i.fn.call(i.context, e);
1430
+ else
1431
+ for (let n = 0, s = i.length; n < s && !e.propagationImmediatelyStopped; n++)
1432
+ i[n].once && e.currentTarget.removeListener(t, i[n].fn, void 0, !0), i[n].fn.call(i[n].context, e);
1433
+ }
1434
+ }
1435
+ const ge = 1, ye = {
1436
+ touchstart: "pointerdown",
1437
+ touchend: "pointerup",
1438
+ touchendoutside: "pointerupoutside",
1439
+ touchmove: "pointermove",
1440
+ touchcancel: "pointercancel"
1441
+ }, B = class x {
1442
+ /**
1443
+ * @param {Renderer} renderer
1444
+ */
1445
+ constructor(e) {
1446
+ this.supportsTouchEvents = "ontouchstart" in globalThis, this.supportsPointerEvents = !!globalThis.PointerEvent, this.domElement = null, this.resolution = 1, this.renderer = e, this.rootBoundary = new _e(null), y.init(this), this.autoPreventDefault = !0, this._eventsAdded = !1, this._rootPointerEvent = new f(null), this._rootWheelEvent = new T(null), this.cursorStyles = {
1447
+ default: "inherit",
1448
+ pointer: "pointer"
1449
+ }, this.features = new Proxy({ ...x.defaultEventFeatures }, {
1450
+ set: (t, i, n) => (i === "globalMove" && (this.rootBoundary.enableGlobalMoveEvents = n), t[i] = n, !0)
1451
+ }), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.onWheel = this.onWheel.bind(this);
1452
+ }
1453
+ /**
1454
+ * The default interaction mode for all display objects.
1455
+ * @see Container.eventMode
1456
+ * @type {EventMode}
1457
+ * @readonly
1458
+ * @since 7.2.0
1459
+ */
1460
+ static get defaultEventMode() {
1461
+ return this._defaultEventMode;
1462
+ }
1463
+ /**
1464
+ * Runner init called, view is available at this point.
1465
+ * @ignore
1466
+ */
1467
+ init(e) {
1468
+ const { canvas: t, resolution: i } = this.renderer;
1469
+ this.setTargetElement(t), this.resolution = i, x._defaultEventMode = e.eventMode ?? "passive", Object.assign(this.features, e.eventFeatures ?? {}), this.rootBoundary.enableGlobalMoveEvents = this.features.globalMove;
1470
+ }
1471
+ /**
1472
+ * Handle changing resolution.
1473
+ * @ignore
1474
+ */
1475
+ resolutionChange(e) {
1476
+ this.resolution = e;
1477
+ }
1478
+ /** Destroys all event listeners and detaches the renderer. */
1479
+ destroy() {
1480
+ this.setTargetElement(null), this.renderer = null, this._currentCursor = null;
1481
+ }
1482
+ /**
1483
+ * Sets the current cursor mode, handling any callbacks or CSS style changes.
1484
+ * The cursor can be a CSS cursor string, a custom callback function, or a key from the cursorStyles dictionary.
1485
+ * @param mode - Cursor mode to set. Can be:
1486
+ * - A CSS cursor string (e.g., 'pointer', 'grab')
1487
+ * - A key from the cursorStyles dictionary
1488
+ * - null/undefined to reset to default
1489
+ * @example
1490
+ * ```ts
1491
+ * // Using predefined cursor styles
1492
+ * app.renderer.events.setCursor('pointer'); // Set standard pointer cursor
1493
+ * app.renderer.events.setCursor('grab'); // Set grab cursor
1494
+ * app.renderer.events.setCursor(null); // Reset to default
1495
+ *
1496
+ * // Using custom cursor styles
1497
+ * app.renderer.events.cursorStyles.custom = 'url("cursor.png"), auto';
1498
+ * app.renderer.events.setCursor('custom'); // Apply custom cursor
1499
+ *
1500
+ * // Using callback-based cursor
1501
+ * app.renderer.events.cursorStyles.dynamic = (mode) => {
1502
+ * document.body.style.cursor = mode === 'hover' ? 'pointer' : 'default';
1503
+ * };
1504
+ * app.renderer.events.setCursor('dynamic'); // Trigger cursor callback
1505
+ * ```
1506
+ * @remarks
1507
+ * - Has no effect on OffscreenCanvas except for callback-based cursors
1508
+ * - Caches current cursor to avoid unnecessary DOM updates
1509
+ * - Supports CSS cursor values, style objects, and callback functions
1510
+ * @see {@link EventSystem.cursorStyles} For defining custom cursor styles
1511
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/cursor} MDN Cursor Reference
1512
+ */
1513
+ setCursor(e) {
1514
+ e || (e = "default");
1515
+ let t = !0;
1516
+ if (globalThis.OffscreenCanvas && this.domElement instanceof OffscreenCanvas && (t = !1), this._currentCursor === e)
1517
+ return;
1518
+ this._currentCursor = e;
1519
+ const i = this.cursorStyles[e];
1520
+ if (i)
1521
+ switch (typeof i) {
1522
+ case "string":
1523
+ t && (this.domElement.style.cursor = i);
1524
+ break;
1525
+ case "function":
1526
+ i(e);
1527
+ break;
1528
+ case "object":
1529
+ t && Object.assign(this.domElement.style, i);
1530
+ break;
1531
+ }
1532
+ else t && typeof e == "string" && !Object.prototype.hasOwnProperty.call(this.cursorStyles, e) && (this.domElement.style.cursor = e);
1533
+ }
1534
+ /**
1535
+ * The global pointer event instance containing the most recent pointer state.
1536
+ * This is useful for accessing pointer information without listening to events.
1537
+ * @example
1538
+ * ```ts
1539
+ * // Access current pointer position at any time
1540
+ * const eventSystem = app.renderer.events;
1541
+ * const pointer = eventSystem.pointer;
1542
+ *
1543
+ * // Get global coordinates
1544
+ * console.log('Position:', pointer.global.x, pointer.global.y);
1545
+ *
1546
+ * // Check button state
1547
+ * console.log('Buttons pressed:', pointer.buttons);
1548
+ *
1549
+ * // Get pointer type and pressure
1550
+ * console.log('Type:', pointer.pointerType);
1551
+ * console.log('Pressure:', pointer.pressure);
1552
+ * ```
1553
+ * @readonly
1554
+ * @since 7.2.0
1555
+ * @see {@link FederatedPointerEvent} For all available pointer properties
1556
+ */
1557
+ get pointer() {
1558
+ return this._rootPointerEvent;
1559
+ }
1560
+ /**
1561
+ * Event handler for pointer down events on {@link EventSystem#domElement this.domElement}.
1562
+ * @param nativeEvent - The native mouse/pointer/touch event.
1563
+ */
1564
+ _onPointerDown(e) {
1565
+ if (!this.features.click)
1566
+ return;
1567
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
1568
+ const t = this._normalizeToPointerData(e);
1569
+ this.autoPreventDefault && t[0].isNormalized && (e.cancelable || !("cancelable" in e)) && e.preventDefault();
1570
+ for (let i = 0, n = t.length; i < n; i++) {
1571
+ const s = t[i], o = this._bootstrapEvent(this._rootPointerEvent, s);
1572
+ this.rootBoundary.mapEvent(o);
1573
+ }
1574
+ this.setCursor(this.rootBoundary.cursor);
1575
+ }
1576
+ /**
1577
+ * Event handler for pointer move events on on {@link EventSystem#domElement this.domElement}.
1578
+ * @param nativeEvent - The native mouse/pointer/touch events.
1579
+ */
1580
+ _onPointerMove(e) {
1581
+ if (!this.features.move)
1582
+ return;
1583
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, y.pointerMoved();
1584
+ const t = this._normalizeToPointerData(e);
1585
+ for (let i = 0, n = t.length; i < n; i++) {
1586
+ const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
1587
+ this.rootBoundary.mapEvent(s);
1588
+ }
1589
+ this.setCursor(this.rootBoundary.cursor);
1590
+ }
1591
+ /**
1592
+ * Event handler for pointer up events on {@link EventSystem#domElement this.domElement}.
1593
+ * @param nativeEvent - The native mouse/pointer/touch event.
1594
+ */
1595
+ _onPointerUp(e) {
1596
+ if (!this.features.click)
1597
+ return;
1598
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
1599
+ let t = e.target;
1600
+ e.composedPath && e.composedPath().length > 0 && (t = e.composedPath()[0]);
1601
+ const i = t !== this.domElement ? "outside" : "", n = this._normalizeToPointerData(e);
1602
+ for (let s = 0, o = n.length; s < o; s++) {
1603
+ const r = this._bootstrapEvent(this._rootPointerEvent, n[s]);
1604
+ r.type += i, this.rootBoundary.mapEvent(r);
1605
+ }
1606
+ this.setCursor(this.rootBoundary.cursor);
1607
+ }
1608
+ /**
1609
+ * Event handler for pointer over & out events on {@link EventSystem#domElement this.domElement}.
1610
+ * @param nativeEvent - The native mouse/pointer/touch event.
1611
+ */
1612
+ _onPointerOverOut(e) {
1613
+ if (!this.features.click)
1614
+ return;
1615
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
1616
+ const t = this._normalizeToPointerData(e);
1617
+ for (let i = 0, n = t.length; i < n; i++) {
1618
+ const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
1619
+ this.rootBoundary.mapEvent(s);
1620
+ }
1621
+ this.setCursor(this.rootBoundary.cursor);
1622
+ }
1623
+ /**
1624
+ * Passive handler for `wheel` events on {@link EventSystem.domElement this.domElement}.
1625
+ * @param nativeEvent - The native wheel event.
1626
+ */
1627
+ onWheel(e) {
1628
+ if (!this.features.wheel)
1629
+ return;
1630
+ const t = this.normalizeWheelEvent(e);
1631
+ this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, this.rootBoundary.mapEvent(t);
1632
+ }
1633
+ /**
1634
+ * Sets the {@link EventSystem#domElement domElement} and binds event listeners.
1635
+ * This method manages the DOM event bindings for the event system, allowing you to
1636
+ * change or remove the target element that receives input events.
1637
+ * > [!IMPORTANT] This will default to the canvas element of the renderer, so you
1638
+ * > should not need to call this unless you are using a custom element.
1639
+ * @param element - The new DOM element to bind events to, or null to remove all event bindings
1640
+ * @example
1641
+ * ```ts
1642
+ * // Set a new canvas element as the target
1643
+ * const canvas = document.createElement('canvas');
1644
+ * app.renderer.events.setTargetElement(canvas);
1645
+ *
1646
+ * // Remove all event bindings
1647
+ * app.renderer.events.setTargetElement(null);
1648
+ *
1649
+ * // Switch to a different canvas
1650
+ * const newCanvas = document.querySelector('#game-canvas');
1651
+ * app.renderer.events.setTargetElement(newCanvas);
1652
+ * ```
1653
+ * @remarks
1654
+ * - Automatically removes event listeners from previous element
1655
+ * - Required for the event system to function
1656
+ * - Safe to call multiple times
1657
+ * @see {@link EventSystem#domElement} The current DOM element
1658
+ * @see {@link EventsTicker} For the ticker system that tracks pointer movement
1659
+ */
1660
+ setTargetElement(e) {
1661
+ this._removeEvents(), this.domElement = e, y.domElement = e, this._addEvents();
1662
+ }
1663
+ /** Register event listeners on {@link Renderer#domElement this.domElement}. */
1664
+ _addEvents() {
1665
+ if (this._eventsAdded || !this.domElement)
1666
+ return;
1667
+ y.addTickerListener();
1668
+ const e = this.domElement.style;
1669
+ e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "none", e.msTouchAction = "none") : this.supportsPointerEvents && (e.touchAction = "none")), this.supportsPointerEvents ? (globalThis.document.addEventListener("pointermove", this._onPointerMove, !0), this.domElement.addEventListener("pointerdown", this._onPointerDown, !0), this.domElement.addEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.addEventListener("pointerover", this._onPointerOverOut, !0), globalThis.addEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.addEventListener("mousemove", this._onPointerMove, !0), this.domElement.addEventListener("mousedown", this._onPointerDown, !0), this.domElement.addEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.addEventListener("mouseover", this._onPointerOverOut, !0), globalThis.addEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.addEventListener("touchstart", this._onPointerDown, !0), this.domElement.addEventListener("touchend", this._onPointerUp, !0), this.domElement.addEventListener("touchmove", this._onPointerMove, !0))), this.domElement.addEventListener("wheel", this.onWheel, {
1670
+ passive: !0,
1671
+ capture: !0
1672
+ }), this._eventsAdded = !0;
1673
+ }
1674
+ /** Unregister event listeners on {@link EventSystem#domElement this.domElement}. */
1675
+ _removeEvents() {
1676
+ if (!this._eventsAdded || !this.domElement)
1677
+ return;
1678
+ y.removeTickerListener();
1679
+ const e = this.domElement.style;
1680
+ e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "", e.msTouchAction = "") : this.supportsPointerEvents && (e.touchAction = "")), this.supportsPointerEvents ? (globalThis.document.removeEventListener("pointermove", this._onPointerMove, !0), this.domElement.removeEventListener("pointerdown", this._onPointerDown, !0), this.domElement.removeEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.removeEventListener("pointerover", this._onPointerOverOut, !0), globalThis.removeEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.removeEventListener("mousemove", this._onPointerMove, !0), this.domElement.removeEventListener("mousedown", this._onPointerDown, !0), this.domElement.removeEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.removeEventListener("mouseover", this._onPointerOverOut, !0), globalThis.removeEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.removeEventListener("touchstart", this._onPointerDown, !0), this.domElement.removeEventListener("touchend", this._onPointerUp, !0), this.domElement.removeEventListener("touchmove", this._onPointerMove, !0))), this.domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this._eventsAdded = !1;
1681
+ }
1682
+ /**
1683
+ * Maps coordinates from DOM/screen space into PixiJS normalized coordinates.
1684
+ * This takes into account the current scale, position, and resolution of the DOM element.
1685
+ * @param point - The point to store the mapped coordinates in
1686
+ * @param x - The x coordinate in DOM/client space
1687
+ * @param y - The y coordinate in DOM/client space
1688
+ * @example
1689
+ * ```ts
1690
+ * // Map mouse coordinates to PixiJS space
1691
+ * const point = new Point();
1692
+ * app.renderer.events.mapPositionToPoint(
1693
+ * point,
1694
+ * event.clientX,
1695
+ * event.clientY
1696
+ * );
1697
+ * console.log('Mapped position:', point.x, point.y);
1698
+ *
1699
+ * // Using with pointer events
1700
+ * sprite.on('pointermove', (event) => {
1701
+ * // event.global already contains mapped coordinates
1702
+ * console.log('Global:', event.global.x, event.global.y);
1703
+ *
1704
+ * // Map to local coordinates
1705
+ * const local = event.getLocalPosition(sprite);
1706
+ * console.log('Local:', local.x, local.y);
1707
+ * });
1708
+ * ```
1709
+ * @remarks
1710
+ * - Accounts for element scaling and positioning
1711
+ * - Adjusts for device pixel ratio/resolution
1712
+ */
1713
+ mapPositionToPoint(e, t, i) {
1714
+ const n = this.domElement.isConnected ? this.domElement.getBoundingClientRect() : {
1715
+ width: this.domElement.width,
1716
+ height: this.domElement.height,
1717
+ left: 0,
1718
+ top: 0
1719
+ }, s = 1 / this.resolution;
1720
+ e.x = (t - n.left) * (this.domElement.width / n.width) * s, e.y = (i - n.top) * (this.domElement.height / n.height) * s;
1721
+ }
1722
+ /**
1723
+ * Ensures that the original event object contains all data that a regular pointer event would have
1724
+ * @param event - The original event data from a touch or mouse event
1725
+ * @returns An array containing a single normalized pointer event, in the case of a pointer
1726
+ * or mouse event, or a multiple normalized pointer events if there are multiple changed touches
1727
+ */
1728
+ _normalizeToPointerData(e) {
1729
+ const t = [];
1730
+ if (this.supportsTouchEvents && e instanceof TouchEvent)
1731
+ for (let i = 0, n = e.changedTouches.length; i < n; i++) {
1732
+ const s = e.changedTouches[i];
1733
+ typeof s.button > "u" && (s.button = 0), typeof s.buttons > "u" && (s.buttons = 1), typeof s.isPrimary > "u" && (s.isPrimary = e.touches.length === 1 && e.type === "touchstart"), typeof s.width > "u" && (s.width = s.radiusX || 1), typeof s.height > "u" && (s.height = s.radiusY || 1), typeof s.tiltX > "u" && (s.tiltX = 0), typeof s.tiltY > "u" && (s.tiltY = 0), typeof s.pointerType > "u" && (s.pointerType = "touch"), typeof s.pointerId > "u" && (s.pointerId = s.identifier || 0), typeof s.pressure > "u" && (s.pressure = s.force || 0.5), typeof s.twist > "u" && (s.twist = 0), typeof s.tangentialPressure > "u" && (s.tangentialPressure = 0), typeof s.layerX > "u" && (s.layerX = s.offsetX = s.clientX), typeof s.layerY > "u" && (s.layerY = s.offsetY = s.clientY), s.isNormalized = !0, s.type = e.type, t.push(s);
1734
+ }
1735
+ else if (!globalThis.MouseEvent || e instanceof MouseEvent && (!this.supportsPointerEvents || !(e instanceof globalThis.PointerEvent))) {
1736
+ const i = e;
1737
+ typeof i.isPrimary > "u" && (i.isPrimary = !0), typeof i.width > "u" && (i.width = 1), typeof i.height > "u" && (i.height = 1), typeof i.tiltX > "u" && (i.tiltX = 0), typeof i.tiltY > "u" && (i.tiltY = 0), typeof i.pointerType > "u" && (i.pointerType = "mouse"), typeof i.pointerId > "u" && (i.pointerId = ge), typeof i.pressure > "u" && (i.pressure = 0.5), typeof i.twist > "u" && (i.twist = 0), typeof i.tangentialPressure > "u" && (i.tangentialPressure = 0), i.isNormalized = !0, t.push(i);
1738
+ } else
1739
+ t.push(e);
1740
+ return t;
1741
+ }
1742
+ /**
1743
+ * Normalizes the native {@link https://w3c.github.io/uievents/#interface-wheelevent WheelEvent}.
1744
+ *
1745
+ * The returned {@link FederatedWheelEvent} is a shared instance. It will not persist across
1746
+ * multiple native wheel events.
1747
+ * @param nativeEvent - The native wheel event that occurred on the canvas.
1748
+ * @returns A federated wheel event.
1749
+ */
1750
+ normalizeWheelEvent(e) {
1751
+ const t = this._rootWheelEvent;
1752
+ return this._transferMouseData(t, e), t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ, t.deltaMode = e.deltaMode, this.mapPositionToPoint(t.screen, e.clientX, e.clientY), t.global.copyFrom(t.screen), t.offset.copyFrom(t.screen), t.nativeEvent = e, t.type = e.type, t;
1753
+ }
1754
+ /**
1755
+ * Normalizes the `nativeEvent` into a federateed {@link FederatedPointerEvent}.
1756
+ * @param event
1757
+ * @param nativeEvent
1758
+ */
1759
+ _bootstrapEvent(e, t) {
1760
+ return e.originalEvent = null, e.nativeEvent = t, e.pointerId = t.pointerId, e.width = t.width, e.height = t.height, e.isPrimary = t.isPrimary, e.pointerType = t.pointerType, e.pressure = t.pressure, e.tangentialPressure = t.tangentialPressure, e.tiltX = t.tiltX, e.tiltY = t.tiltY, e.twist = t.twist, this._transferMouseData(e, t), this.mapPositionToPoint(e.screen, t.clientX, t.clientY), e.global.copyFrom(e.screen), e.offset.copyFrom(e.screen), e.isTrusted = t.isTrusted, e.type === "pointerleave" && (e.type = "pointerout"), e.type.startsWith("mouse") && (e.type = e.type.replace("mouse", "pointer")), e.type.startsWith("touch") && (e.type = ye[e.type] || e.type), e;
1761
+ }
1762
+ /**
1763
+ * Transfers base & mouse event data from the `nativeEvent` to the federated event.
1764
+ * @param event
1765
+ * @param nativeEvent
1766
+ */
1767
+ _transferMouseData(e, t) {
1768
+ e.isTrusted = t.isTrusted, e.srcElement = t.srcElement, e.timeStamp = performance.now(), e.type = t.type, e.altKey = t.altKey, e.button = t.button, e.buttons = t.buttons, e.client.x = t.clientX, e.client.y = t.clientY, e.ctrlKey = t.ctrlKey, e.metaKey = t.metaKey, e.movement.x = t.movementX, e.movement.y = t.movementY, e.page.x = t.pageX, e.page.y = t.pageY, e.relatedTarget = null, e.shiftKey = t.shiftKey;
1769
+ }
1770
+ };
1771
+ B.extension = {
1772
+ name: "events",
1773
+ type: [
1774
+ b.WebGLSystem,
1775
+ b.CanvasSystem,
1776
+ b.WebGPUSystem
1777
+ ],
1778
+ priority: -1
1779
+ };
1780
+ B.defaultEventFeatures = {
1781
+ /** Enables pointer events associated with pointer movement. */
1782
+ move: !0,
1783
+ /** Enables global pointer move events. */
1784
+ globalMove: !0,
1785
+ /** Enables pointer events associated with clicking. */
1786
+ click: !0,
1787
+ /** Enables wheel events. */
1788
+ wheel: !0
1789
+ };
1790
+ let ee = B;
1791
+ const be = {
1792
+ onclick: null,
1793
+ onmousedown: null,
1794
+ onmouseenter: null,
1795
+ onmouseleave: null,
1796
+ onmousemove: null,
1797
+ onglobalmousemove: null,
1798
+ onmouseout: null,
1799
+ onmouseover: null,
1800
+ onmouseup: null,
1801
+ onmouseupoutside: null,
1802
+ onpointercancel: null,
1803
+ onpointerdown: null,
1804
+ onpointerenter: null,
1805
+ onpointerleave: null,
1806
+ onpointermove: null,
1807
+ onglobalpointermove: null,
1808
+ onpointerout: null,
1809
+ onpointerover: null,
1810
+ onpointertap: null,
1811
+ onpointerup: null,
1812
+ onpointerupoutside: null,
1813
+ onrightclick: null,
1814
+ onrightdown: null,
1815
+ onrightup: null,
1816
+ onrightupoutside: null,
1817
+ ontap: null,
1818
+ ontouchcancel: null,
1819
+ ontouchend: null,
1820
+ ontouchendoutside: null,
1821
+ ontouchmove: null,
1822
+ onglobaltouchmove: null,
1823
+ ontouchstart: null,
1824
+ onwheel: null,
1825
+ get interactive() {
1826
+ return this.eventMode === "dynamic" || this.eventMode === "static";
1827
+ },
1828
+ set interactive(a) {
1829
+ this.eventMode = a ? "static" : "passive";
1830
+ },
1831
+ _internalEventMode: void 0,
1832
+ get eventMode() {
1833
+ return this._internalEventMode ?? ee.defaultEventMode;
1834
+ },
1835
+ set eventMode(a) {
1836
+ this._internalEventMode = a;
1837
+ },
1838
+ isInteractive() {
1839
+ return this.eventMode === "static" || this.eventMode === "dynamic";
1840
+ },
1841
+ interactiveChildren: !0,
1842
+ hitArea: null,
1843
+ addEventListener(a, e, t) {
1844
+ const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof t == "object" ? t.signal : void 0, s = typeof t == "object" ? t.once === !0 : !1, o = typeof e == "function" ? void 0 : e;
1845
+ a = i ? `${a}capture` : a;
1846
+ const r = typeof e == "function" ? e : e.handleEvent, l = this;
1847
+ n && n.addEventListener("abort", () => {
1848
+ l.off(a, r, o);
1849
+ }), s ? l.once(a, r, o) : l.on(a, r, o);
1850
+ },
1851
+ removeEventListener(a, e, t) {
1852
+ const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof e == "function" ? void 0 : e;
1853
+ a = i ? `${a}capture` : a, e = typeof e == "function" ? e : e.handleEvent, this.off(a, e, n);
1854
+ },
1855
+ dispatchEvent(a) {
1856
+ if (!(a instanceof M))
1857
+ throw new Error("Container cannot propagate events outside of the Federated Events API");
1858
+ return a.defaultPrevented = !1, a.path = null, a.target = this, a.manager.dispatchEvent(a), !a.defaultPrevented;
1859
+ }
1860
+ };
1861
+ w.add(ue);
1862
+ w.mixin(V, pe);
1863
+ w.add(ee);
1864
+ w.mixin(V, be);
1865
+ w.add(Q);
1866
+ //# sourceMappingURL=browserAll-qgahyZIY.js.map