pixijs-input-devices 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -89
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +165 -87
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
| | |
|
|
6
6
|
| ------ | ------ |
|
|
7
|
-
| 🎮 Handles [keyboards](#keyboarddevice), [gamepads](#gamepaddevice), and [more](#custom-devices)! | 🚀 Flexible [
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
7
|
+
| 🎮 Handles [keyboards](#keyboarddevice), [gamepads](#gamepaddevice), and [more](#custom-devices)! | 🚀 Flexible [update](#real-time) and [event-driven](#keyboarddevice-events) APIs |
|
|
8
|
+
| ⚡ Optimized for [INP performance](https://web.dev/articles/inp) | 🪄 Built-in [named binds](#named-binds) |
|
|
9
|
+
| 🔮 Highly configurable | 🌐 Built-in [international keyboard](#keyboard-layout---detection) support |
|
|
10
|
+
| ✅ Cross-platform & mobile-friendly <sup>[[1]](https://caniuse.com/mdn-api_keyboardlayoutmap) [[2]](https://caniuse.com/mdn-api_gamepad_vibrationactuator) [[3]](https://chromestatus.com/feature/5989275208253440)</sup> | 🧭 Built-in [UI navigation](#navigation-api) _(optional)_ |
|
|
11
11
|
| 🍃 Zero dependencies & tree-shakeable | ✨ Supports PixiJS v8, v7, v6.3+ |
|
|
12
12
|
|
|
13
13
|
|
|
@@ -45,10 +45,10 @@ The core concepts are:
|
|
|
45
45
|
|
|
46
46
|
1. **Devices:** _Any human interface device_
|
|
47
47
|
2. **Binds:** _Custom, named input actions that can be triggered by assigned keys or buttons_
|
|
48
|
-
3. **
|
|
48
|
+
3. **UINavigation:** _A global controller that allows non-pointer devices to navigate UIs_
|
|
49
49
|
|
|
50
50
|
> [!NOTE]
|
|
51
|
-
> _See [
|
|
51
|
+
> _See [UINavigation API](#uinavigation-api) for more information._
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
## Installation
|
|
@@ -68,32 +68,26 @@ yarn add pixijs-input-devices --dev
|
|
|
68
68
|
**2.** Register the update loop:
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
|
-
import
|
|
71
|
+
import { Ticker } from 'pixi.js';
|
|
72
72
|
import { InputDevice } from 'pixijs-input-devices';
|
|
73
73
|
|
|
74
|
-
// register `InputDevice.update()` with shared ticker
|
|
75
74
|
Ticker.shared.add(ticker => InputDevice.update());
|
|
76
75
|
```
|
|
77
76
|
|
|
78
77
|
> [!TIP]
|
|
79
|
-
> **Input polling:** In the context of a video game, you may want to put the input update at the start of your game event loop
|
|
80
|
-
|
|
81
|
-
> [!NOTE]
|
|
82
|
-
> _If not using a PixiJS ticker, then just put `Action.tick(elapsedMs)` in the appropriate equivalent place (i.e. your `requestAnimationFrame()` render loop)._
|
|
78
|
+
> **Input polling:** In the context of a video game, you may want to put the input update at the start of your game event loop instead.
|
|
83
79
|
|
|
84
|
-
**3.** (Optional) enable the
|
|
80
|
+
**3.** (Optional) enable the UINavigation API
|
|
85
81
|
|
|
86
82
|
```ts
|
|
87
83
|
import * as PIXI from 'pixi.js';
|
|
88
|
-
import {
|
|
89
|
-
|
|
90
|
-
// register container mixin
|
|
91
|
-
registerPixiJSInputDevicesMixin(PIXI.Container);
|
|
84
|
+
import { UINavigation, registerPixiJSNavigationMixin } from 'pixijs-input-devices';
|
|
92
85
|
|
|
93
86
|
const app = new PIXI.Application(/*…*/)
|
|
94
87
|
|
|
95
|
-
//
|
|
96
|
-
|
|
88
|
+
// enable the navigation API
|
|
89
|
+
UINavigation.configureWithRoot( app.stage )
|
|
90
|
+
registerPixiJSNavigationMixin( PIXI.Container )
|
|
97
91
|
```
|
|
98
92
|
|
|
99
93
|
✨ You are now ready to use inputs!
|
|
@@ -241,31 +235,40 @@ gamepad.playVibration({
|
|
|
241
235
|
|
|
242
236
|
The gamepad buttons reference **Standard Controller Layout**:
|
|
243
237
|
|
|
244
|
-
| Button
|
|
238
|
+
| Button | BindableCode | Standard | Nintendo <sup>[[1]](#gamepad---nintendo-layout-remapping)</sup> | Playstation | Xbox |
|
|
245
239
|
|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
246
|
-
| `0` | `"A"` | **A** | A | Cross | A |
|
|
247
|
-
| `1` | `"B"` | **B** | X | Circle | B |
|
|
248
|
-
| `2` | `"X"` | **X** | B | Square | X |
|
|
249
|
-
| `3` | `"Y"` | **Y** | Y | Triangle | Y |
|
|
240
|
+
| `0` | `"A"` | **A / FaceButton1** | A | Cross | A |
|
|
241
|
+
| `1` | `"B"` | **B / FaceButton2** | X | Circle | B |
|
|
242
|
+
| `2` | `"X"` | **X / FaceButton3** | B | Square | X |
|
|
243
|
+
| `3` | `"Y"` | **Y / FaceButton4** | Y | Triangle | Y |
|
|
250
244
|
| `4` | `"LeftShoulder"` | **Left Shoulder** | L | L1 | LB |
|
|
251
245
|
| `5` | `"RightShoulder"` | **Right Shoulder** | R | R1 | RB |
|
|
252
246
|
| `6` | `"LeftTrigger"` | **Left Trigger** | L2 | ZL | LT |
|
|
253
247
|
| `7` | `"RightTrigger"` | **Right Trigger** | R2 | ZR | RT |
|
|
254
248
|
| `8` | `"Back"` | **Back** | Minus | Options | Back |
|
|
255
249
|
| `9` | `"Start"` | **Start** | Plus | Select | Start |
|
|
256
|
-
| `10` | `"
|
|
257
|
-
| `11` | `"
|
|
250
|
+
| `10` | `"LeftStickClick"` | **Left Stick Click** | L3 | L3 | LSB |
|
|
251
|
+
| `11` | `"RightStickClick"` | **Right Stick Click** | R3 | R3 | RSB |
|
|
258
252
|
| `12` | `"DPadUp"` | **D-Pad Up** | ⬆️ | ⬆️ | ⬆️ |
|
|
259
253
|
| `13` | `"DPadDown"` | **D-Pad Down** | ⬇️ | ⬇️ | ⬇️ |
|
|
260
254
|
| `14` | `"DPadLeft"` | **D-Pad Left** | ⬅️ | ⬅️ | ⬅️ |
|
|
261
255
|
| `15` | `"DPadRight"` | **D-Pad Right** | ➡️ | ➡️ | ➡️ |
|
|
262
256
|
|
|
263
|
-
|
|
257
|
+
#### Gamepad Axis Codes
|
|
258
|
+
|
|
259
|
+
Bindable helpers are available for the joysticks.
|
|
260
|
+
|
|
261
|
+
| Axis # | AxisCode | Standard | Layout
|
|
262
|
+
|:---:|:---:|:---:|:---:|
|
|
263
|
+
| `0` | `"LeftStickLeft"`<br/>`"LeftStickRight"` | **Left Stick (Left/Right)** | ⬅️➡️ |
|
|
264
|
+
| `1` | `"LeftStickUp"`<br/>`"LeftStickDown"` | **Left Stick (Up/Down)** | ⬆️⬇️ |
|
|
265
|
+
| `2` | `"RightStickLeft"`<br/>`"RightStickRight"` | **Right Stick (Left/Right)** | ⬅️➡️ |
|
|
266
|
+
| `3` | `"RightStickUp"`<br/>`"RightStickDown"` | **Right Stick (Up/Down)** | ⬆️⬇️ |
|
|
264
267
|
|
|
265
268
|
#### Gamepad Layouts
|
|
266
269
|
|
|
267
270
|
```ts
|
|
268
|
-
gamepad.layout // "nintendo" | "xbox" | "playstation" | "logitech" | "steam" | "
|
|
271
|
+
gamepad.layout // "nintendo" | "xbox" | "playstation" | "logitech" | "steam" | "standard"
|
|
269
272
|
```
|
|
270
273
|
|
|
271
274
|
Layout detection is **highly non-standard** across major browsers, it should generally be used for aesthetic
|
|
@@ -280,10 +283,10 @@ only major brand controller that deviates from the standard.
|
|
|
280
283
|
> ***Nintendo:** Both the labels and physical positions of the A,B,X,Y buttons are different
|
|
281
284
|
> on Nintendo controllers.
|
|
282
285
|
>
|
|
283
|
-
> Set `GamepadDevice.defaultOptions.
|
|
286
|
+
> Set `GamepadDevice.defaultOptions.nintendoRemapMode` to apply the remapping as required.
|
|
284
287
|
>
|
|
285
|
-
> - `"physical"` _**(default)**_ – The A,B,X,Y button codes will refer the
|
|
286
|
-
> - `"accurate"` – The A,B,X,Y button codes will
|
|
288
|
+
> - `"physical"` _**(default)**_ – The A,B,X,Y button codes will refer the standard face button positions (Left=X, Top=Y, Bottom=A, Right=B).
|
|
289
|
+
> - `"accurate"` – The A,B,X,Y button codes will refer to the exact Nintendo labels (Left=Y, Top=X, Bottom=B, Right=A).
|
|
287
290
|
> - `"none"` – The A,B,X,Y button codes mapping stay at the default indices (Left=Y, Top=B, Bottom=X, Right=A).
|
|
288
291
|
>
|
|
289
292
|
> ```
|
|
@@ -303,8 +306,11 @@ only major brand controller that deviates from the standard.
|
|
|
303
306
|
You can manually override this per-gamepad, or for all gamepads:
|
|
304
307
|
|
|
305
308
|
```ts
|
|
306
|
-
|
|
307
|
-
GamepadDevice.defaultOptions.
|
|
309
|
+
// set default
|
|
310
|
+
GamepadDevice.defaultOptions.nintendoRemapMode = "none"
|
|
311
|
+
|
|
312
|
+
// set for a single gamepad
|
|
313
|
+
gamepad.options.nintendoRemapMode = "accurate"
|
|
308
314
|
```
|
|
309
315
|
|
|
310
316
|
#### GamepadDevice Events
|
|
@@ -351,18 +357,18 @@ This allows you to change the keys/buttons later (e.g. allow users to override i
|
|
|
351
357
|
|
|
352
358
|
```ts
|
|
353
359
|
// keyboard:
|
|
354
|
-
InputDevice.keyboard.
|
|
360
|
+
InputDevice.keyboard.configureBinds({
|
|
355
361
|
jump: [ "ArrowUp", "Space", "KeyW" ],
|
|
356
362
|
crouch: [ "ArrowDown", "KeyS" ],
|
|
357
363
|
toggleGraphics: [ "KeyB" ],
|
|
358
|
-
}
|
|
364
|
+
})
|
|
359
365
|
|
|
360
366
|
// all gamepads:
|
|
361
|
-
GamepadDevice.
|
|
362
|
-
jump: [ "A" ],
|
|
367
|
+
GamepadDevice.configureDefaultBinds({
|
|
368
|
+
jump: [ "A", "LeftStickUp" ],
|
|
363
369
|
crouch: [ "B", "X", "RightTrigger" ],
|
|
364
|
-
toggleGraphics: [ "
|
|
365
|
-
}
|
|
370
|
+
toggleGraphics: [ "RightStickUp", "RightStickDown" ],
|
|
371
|
+
})
|
|
366
372
|
```
|
|
367
373
|
|
|
368
374
|
These can then be used with either the real-time and event-based APIs.
|
|
@@ -384,14 +390,14 @@ InputDevice.gamepads[0].onBind( "jump", ( e ) => doJump() )
|
|
|
384
390
|
let jump = false, crouch = false, moveX = 0
|
|
385
391
|
|
|
386
392
|
const keyboard = InputDevice.keyboard
|
|
387
|
-
if ( keyboard.
|
|
388
|
-
if ( keyboard.
|
|
393
|
+
if ( keyboard.pressedBind( "jump" ) ) jump = true
|
|
394
|
+
if ( keyboard.pressedBind( "crouch" ) ) crouch = true
|
|
389
395
|
if ( keyboard.key.ArrowLeft ) moveX = -1
|
|
390
396
|
else if ( keyboard.key.ArrowRight ) moveX = 1
|
|
391
397
|
|
|
392
398
|
for ( const gamepad of InputDevice.gamepads ) {
|
|
393
|
-
if ( gamepad.
|
|
394
|
-
if ( gamepad.
|
|
399
|
+
if ( gamepad.pressedBind( "jump" ) ) jump = true
|
|
400
|
+
if ( gamepad.pressedBind( "crouch" ) ) crouch = true
|
|
395
401
|
|
|
396
402
|
// gamepads have additional analog inputs
|
|
397
403
|
// we're going to apply these only if touched
|
|
@@ -400,42 +406,55 @@ for ( const gamepad of InputDevice.gamepads ) {
|
|
|
400
406
|
}
|
|
401
407
|
```
|
|
402
408
|
|
|
403
|
-
##
|
|
409
|
+
## UINavigation API
|
|
404
410
|
|
|
405
411
|
_Traverse a UI using input devices._
|
|
406
412
|
|
|
407
|
-
|
|
408
|
-
|
|
413
|
+
```ts
|
|
414
|
+
UINavigation.configureWithRoot( app.stage ) // (or any Container)
|
|
415
|
+
```
|
|
409
416
|
|
|
410
|
-
|
|
411
|
-
example, you might add a `NavigationResponder` for a drop-down UI. A normal `Container` can be used as a `NavigationResponder`, and any
|
|
412
|
-
container on the stack will become the **current root container**.
|
|
417
|
+
You can manually take control of navigation using:
|
|
413
418
|
|
|
414
|
-
|
|
415
|
-
|
|
419
|
+
```ts
|
|
420
|
+
// take control
|
|
421
|
+
UINavigation.pushResponder( myModalView )
|
|
422
|
+
|
|
423
|
+
// relinquish control
|
|
424
|
+
UINavigation.popResponder()
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
The Navigation API is centered around the **UINavigation** manager, which
|
|
428
|
+
receives navigation intents from devices and forwards it to the UI context.
|
|
416
429
|
|
|
417
|
-
|
|
418
|
-
|
|
430
|
+
The **UINavigation** manager maintains a stack of responders, which can be a
|
|
431
|
+
`Container`, or any object that implements the `NavigationResponder` interface.
|
|
419
432
|
|
|
420
|
-
|
|
433
|
+
When a device sends a navigation intent, the **UINavigation** manager is
|
|
434
|
+
responsible for asking the **first responder** whether it can handle the intent.
|
|
435
|
+
|
|
436
|
+
If it returns `false`, any other responders are checked (if they exist),
|
|
437
|
+
otherwise the default global navigation behavior kicks in.
|
|
438
|
+
|
|
439
|
+
### Default Global Navigation Behaviors
|
|
421
440
|
|
|
422
441
|
When a navigation intent is **not** handled manually by a responder, it is handled in one of the following ways:
|
|
423
442
|
|
|
424
443
|
| Intent | Behavior |
|
|
425
444
|
|---|---|
|
|
426
|
-
|`"
|
|
427
|
-
|`"
|
|
428
|
-
|`"trigger"`|<ul><li>Checks if we are currently focused on a container, and then issue a `"
|
|
445
|
+
|`"navigate.back"`|<ul><li>No action.</li></ul>|
|
|
446
|
+
|`"navigate.left"`, `"navigate.right"`, `"navigate.up"`, `"navigate.down"`|<ul><li>Looks for the nearest `Container` where `container.isNavigatable` in the direction given, and if found, receives a `"deviceover"` event.</li><li>Additionally, if the newly focused container has registered an event handler for either `"pointerover"` or `"mouseover"` (in that order), it will fire that too.</li><li>If we were previously focused on a container, that previous container receives a `"deviceout"` event.</li><li>If the blurred container has register an event handler for either `"pointerout"` or `"mouseout"` (in that order), that event handler will be fired too.</li></ul>|
|
|
447
|
+
|`"navigate.trigger"`|<ul><li>Checks if we are currently focused on a container, and then issue a `"devicedown"` event.</li><li>If the focused container has registered an event handler for either `"pointerdown"` or `"mousedown"` (in that order), that event handler will be fired too.</li></ul>|
|
|
429
448
|
|
|
430
|
-
Container event | Description |
|
|
449
|
+
Container event | Description | Compatibility
|
|
431
450
|
-----------------|--------------------------------------------------------
|
|
432
|
-
`
|
|
433
|
-
`
|
|
434
|
-
`
|
|
451
|
+
`"devicedown"` | Target was triggered. | `"pointerdown"`, `"mousedown"`
|
|
452
|
+
`"deviceover"` | Target became focused. | `"pointerover"`, `"mouseover"`
|
|
453
|
+
`"deviceout"` | Target lost focus. | `"pointerout"`, `"mouseout"`
|
|
435
454
|
|
|
436
|
-
### Container
|
|
455
|
+
### Container Navigatability
|
|
437
456
|
|
|
438
|
-
Containers are extended with a few properties/
|
|
457
|
+
Containers are extended with a few properties/accessors:
|
|
439
458
|
|
|
440
459
|
Container properties | type | default | description
|
|
441
460
|
---------------------|------|---------|--------------
|
|
@@ -447,18 +466,9 @@ Container properties | type | default | description
|
|
|
447
466
|
> **isNavigatable:** By default, any element with `"pointerdown"` or `"mousedown"` handlers is navigatable.
|
|
448
467
|
|
|
449
468
|
> [!WARNING]
|
|
450
|
-
> **Fallback Hover Effect:** If there is no `"pointerover"` or `"mouseover"` handler detected on a container, `
|
|
469
|
+
> **Fallback Hover Effect:** If there is no `"pointerover"` or `"mouseover"` handler detected on a container, `UINavigation`
|
|
451
470
|
> will apply abasic alpha effect to the selected item to indicate which container is currently the navigation target. This
|
|
452
|
-
> can be disabled by setting `
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
### Disable Navigation
|
|
456
|
-
|
|
457
|
-
You can **disable** the navigation API entirely, either permanently or temporaril):
|
|
458
|
-
|
|
459
|
-
```ts
|
|
460
|
-
Navigation.options.enabled = false
|
|
461
|
-
```
|
|
471
|
+
> can be disabled by setting `UINavigation.options.useFallbackHoverEffect` to `false`.
|
|
462
472
|
|
|
463
473
|
|
|
464
474
|
## Advanced usage
|
|
@@ -517,7 +527,7 @@ InputDevice.remove( onscreen )
|
|
|
517
527
|
You could set up multiple named inputs:
|
|
518
528
|
|
|
519
529
|
```ts
|
|
520
|
-
InputDevice.keyboard.
|
|
530
|
+
InputDevice.keyboard.configureBinds({
|
|
521
531
|
jump: [ "ArrowUp", "KeyW" ],
|
|
522
532
|
defend: [ "ArrowDown", "KeyS" ],
|
|
523
533
|
left: [ "ArrowLeft", "KeyA" ],
|
|
@@ -532,7 +542,7 @@ InputDevice.keyboard.options.binds = {
|
|
|
532
542
|
p2_defend: [ "ArrowDown" ],
|
|
533
543
|
p2_left: [ "ArrowLeft" ],
|
|
534
544
|
p2_right: [ "ArrowRight" ],
|
|
535
|
-
}
|
|
545
|
+
})
|
|
536
546
|
```
|
|
537
547
|
|
|
538
548
|
and then switch groups depending on the mode:
|
|
@@ -540,22 +550,22 @@ and then switch groups depending on the mode:
|
|
|
540
550
|
```ts
|
|
541
551
|
if ( gameMode === "multiplayer" )
|
|
542
552
|
{
|
|
543
|
-
player1.jump = device.
|
|
544
|
-
player1.defend = device.
|
|
545
|
-
player1.moveX += device.
|
|
546
|
-
player1.moveX += device.
|
|
547
|
-
|
|
548
|
-
player2.jump = device.
|
|
549
|
-
player2.defend = device.
|
|
550
|
-
player2.moveX += device.
|
|
551
|
-
player2.moveX += device.
|
|
553
|
+
player1.jump = device.pressedBind( "p1_jump" )
|
|
554
|
+
player1.defend = device.pressedBind( "p1_defend" )
|
|
555
|
+
player1.moveX += device.pressedBind( "p1_left" ) ? -1 : 0
|
|
556
|
+
player1.moveX += device.pressedBind( "p1_right" ) ? 1 : 0
|
|
557
|
+
|
|
558
|
+
player2.jump = device.pressedBind( "p2_jump" )
|
|
559
|
+
player2.defend = device.pressedBind( "p2_defend" )
|
|
560
|
+
player2.moveX += device.pressedBind( "p2_left" ) ? -1 : 0
|
|
561
|
+
player2.moveX += device.pressedBind( "p2_right" ) ? 1 : 0
|
|
552
562
|
}
|
|
553
563
|
else
|
|
554
564
|
{
|
|
555
|
-
player1.jump = device.
|
|
556
|
-
player1.defend = device.
|
|
557
|
-
player1.moveX += device.
|
|
558
|
-
player1.moveX += device.
|
|
565
|
+
player1.jump = device.pressedBind( "jump" )
|
|
566
|
+
player1.defend = device.pressedBind( "defend" )
|
|
567
|
+
player1.moveX += device.pressedBind( "left" ) ? -1 : 0
|
|
568
|
+
player1.moveX += device.pressedBind( "right" ) ? 1 : 0
|
|
559
569
|
|
|
560
570
|
updateComputerPlayerInput( player2 )
|
|
561
571
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=0,t=1,i=2,s=3,o={A:0,B:1,X:2,Y:3,LeftShoulder:4,RightShoulder:5,LeftTrigger:6,RightTrigger:7,Back:8,Start:9,LeftStick:10,RightStick:11,DPadUp:12,DPadDown:13,DPadLeft:14,DPadRight:15},n=["A","B","X","Y","LeftShoulder","RightShoulder","LeftTrigger","RightTrigger","Back","Start","LeftStick","RightStick","DPadUp","DPadDown","DPadLeft","DPadRight"];function getAllNavigatables(e,t=[]){for(const i of e.children)i.isNavigatable?t.push(i):getAllNavigatables(i,t);return t}function getFirstNavigatable(e,t,i,{minimumDistance:s=3}={}){return function chooseFirstNavigatableInDirection(e,t,i,{minimumDistance:s=3}={}){var o,n,a,r,d,c,u,l,h;const g=e.filter((e=>e.isNavigatable&&null!=e.parent&&function isVisible(e){for(;null!=e;){if(!e.visible)return!1;e=e.parent}return!0}(e))),p=g.find((e=>e===t));if(void 0===p)return g.sort(((e,t)=>t.navigationPriority-e.navigationPriority)),g[0];if(void 0===i&&p)return p;const m=null!=p?p:g[Math.floor(Math.random()*g.length)];if(void 0===p)return null!==(o=e[0])&&void 0!==o?o:m;const v=p.getBounds(),y={x:v.left+v.width/2,y:v.top+v.height/2},f=g.filter((e=>e!==p)).map((e=>{const t=e.getBounds(),i={x:t.left+t.width/2,y:t.top+t.height/2};return{element:e,bounds:t,center:i,distSqrd:squaredDist(i,y)}}));switch(i){case"navigateUp":return null!==(a=null===(n=f.filter((e=>e.center.y<y.y-s)).sort(((e,t)=>e.distSqrd-t.distSqrd))[0])||void 0===n?void 0:n.element)&&void 0!==a?a:m;case"navigateLeft":return null!==(d=null===(r=f.filter((e=>e.center.x<y.x-s)).sort(((e,t)=>e.distSqrd-t.distSqrd))[0])||void 0===r?void 0:r.element)&&void 0!==d?d:m;case"navigateRight":return null!==(u=null===(c=f.filter((e=>e.center.x>y.x+s)).sort(((e,t)=>e.distSqrd-t.distSqrd))[0])||void 0===c?void 0:c.element)&&void 0!==u?u:m;case"navigateDown":return null!==(h=null===(l=f.filter((e=>e.center.y>y.y+s)).sort(((e,t)=>e.distSqrd-t.distSqrd))[0])||void 0===l?void 0:l.element)&&void 0!==h?h:m;default:return p}}(getAllNavigatables(e),t,i,{minimumDistance:s})}function isChildOf(e,t){for(;null!=e;){if(e===t)return!0;e=e.parent}return!1}function squaredDist(e,t){const i=t.x-e.x,s=t.y-e.y;return i*i+s*s}class NavigationManager{constructor(){this.options={enabled:!0,useFallbackHoverEffect:!0},this._responderStack=[]}get firstResponder(){return this._responderStack[0]}get responders(){return this._responderStack}commit(e,t){this.options.enabled&&this._propagateIntent(e,t)}popResponder(){var e,t,i,s;const o=this._responderStack.shift();return null===(e=null==o?void 0:o.resignedAsFirstResponder)||void 0===e||e.call(o),this._clearFocusIfNeeded(),this.firstResponder&&(null===(i=(t=this.firstResponder).becameFirstResponder)||void 0===i||i.call(t),(null===(s=this.firstResponder.autoFocus)||void 0===s||s)&&this.autoFocus()),o}pushResponder(e){var t,i,s;if(this._responderStack.includes(e))throw new Error("Responder already in stack.");const o=this.firstResponder;this._responderStack.unshift(e),null===(t=null==o?void 0:o.resignedAsFirstResponder)||void 0===t||t.call(o),this._clearFocusIfNeeded(),null===(i=e.becameFirstResponder)||void 0===i||i.call(e),(null===(s=e.autoFocus)||void 0===s||s)&&this.autoFocus()}autoFocus(){var e;const t=null!==(e=this.responders.find(isContainer))&&void 0!==e?e:this.stage;if(!t)return;const i=getFirstNavigatable(t);void 0!==i?i!==this._focused&&(this._focused&&this._emitBlur(this._focused),this._emitFocus(i),this._focused=i):console.debug("navigation: no navigatable containers found")}_propagateIntent(e,t){var i,s;for(const s of this._responderStack)if(null===(i=s.handledNavigationIntent)||void 0===i?void 0:i.call(s,e,t))return;if(void 0===this.stage)console.warn("navigation: no stage root set");else{const t=null!==(s=this.responders.find(isContainer))&&void 0!==s?s:this.stage;this._handleGlobalIntent(t,e)}}_handleGlobalIntent(e,t){var i,s;if(void 0===this._focused)return void this.autoFocus();if("navigateBack"===t)return this._emitBlur(this._focused),void(this._focused=void 0);if("trigger"===t)return void this._emitTrigger(this._focused);const o=null!==(s=getFirstNavigatable(null!==(i=this.responders.find(isContainer))&&void 0!==i?i:this.stage,this._focused,t))&&void 0!==s?s:this._focused;o!==this._focused&&(this._emitBlur(this._focused),this._emitFocus(o),this._focused=o)}_emitBlur(e){const t=e.eventNames();t.includes("pointerout")?e.emit("pointerout"):t.includes("mouseout")?e.emit("mouseout"):"auto"===e.navigationMode&&this.options.useFallbackHoverEffect&&(e.alpha=1),e.emit("blur")}_emitFocus(e){const t=e.eventNames();t.includes("pointerover")?e.emit("pointerover"):t.includes("mouseover")?e.emit("mouseover"):"auto"===e.navigationMode&&this.options.useFallbackHoverEffect&&(e.alpha=.5),e.emit("focus")}_emitTrigger(e){const t=e.eventNames();t.includes("pointerdown")?e.emit("pointerdown"):t.includes("mousedown")?e.emit("mousedown"):"auto"===e.navigationMode&&this.options.useFallbackHoverEffect&&(e.alpha=.75),e.emit("trigger")}_clearFocusIfNeeded(){var e;const t=null!==(e=this.responders.find(isContainer))&&void 0!==e?e:this.stage;t&&this._focused&&!isChildOf(this._focused,t)&&(this._focused=void 0)}}function isContainer(e){return"children"in e}NavigationManager.global=new NavigationManager;const a=NavigationManager.global;let r=new Map;function throttle(e,t){var i;const s=Date.now();return(null!==(i=r.get(e))&&void 0!==i?i:0)>s||(r.set(e,s+t),!1)}class EventEmitter{constructor(){this._listeners={}}hasListener(e){return void 0!==this._listeners[e]}emit(e,t){var i;null===(i=this._listeners[e])||void 0===i||i.forEach((e=>e(t)))}on(e,t){var i;this._listeners[e]||(this._listeners[e]=[]),null===(i=this._listeners[e])||void 0===i||i.push(t)}off(e,t){var i,s;this._listeners[e]=void 0===t||null===(i=this._listeners[e])||void 0===i?void 0:i.filter((e=>e!==t)),0===(null===(s=this._listeners[e])||void 0===s?void 0:s.length)&&(this._listeners[e]=void 0)}}class GamepadDevice{pressedBind(e){return void 0!==this.options.binds[e]&&this.pressedAny(this.options.binds[e])}pressedAny(e){for(let t=0;t<e.length;t++)if(this.button[e[t]])return!0;return!1}pressedAll(e){for(let t=0;t<e.length;t++)if(!this.button[e[t]])return!1;return!0}on(e,t){const i="number"==typeof e?n[e]:e;return this._emitter.on(i,t),this}off(e,t){const i="number"==typeof e?n[e]:e;return this._emitter.off(i,t),this}onBind(e,t){return this._bindEmitter.on(e,t),this}offBind(e,t){return this._bindEmitter.off(e,t),this}playVibration({duration:e=200,weakMagnitude:t=.5,strongMagnitude:i=.5,vibrationType:s="dual-rumble",rightTrigger:o=0,leftTrigger:n=0,startDelay:a=0}={}){if(!this.options.vibration.enabled)return;if(!this.source.vibrationActuator)return;const r=this.options.vibration.intensity;try{this.source.vibrationActuator.playEffect(s,{duration:e,startDelay:a,weakMagnitude:r*t,strongMagnitude:r*i,leftTrigger:r*n,rightTrigger:r*o})}catch(e){}}update(e,t){this.updatePresses(e,t),this.source=e}clear(){this._axisIntents=this._axisIntents.map((()=>!1)),this._btnPrevState=this._btnPrevState.map((()=>!1))}constructor(e){this.source=e,this.type="gamepad",this.meta={},this.lastInteraction=performance.now(),this.options=JSON.parse(JSON.stringify(GamepadDevice.defaultOptions)),this.leftJoystick={x:0,y:0},this.rightJoystick={x:0,y:0},this.button=Object.keys(o).reduce(((e,t)=>(e[t]=!1,e)),{}),this._btnPrevState=new Array(16),this._axisIntents=new Array(2),this._emitter=new EventEmitter,this._bindEmitter=new EventEmitter,this.leftTrigger=0,this.rightTrigger=0,this.leftShoulder=0,this.rightShoulder=0,this.id="gamepad"+e.index,this.layout=function detectLayout(e){const t=(e.id||"").toLowerCase();return/(steam|28de)/.test(t)?"steam":/(logitech|046d|c216)/.test(t)?"logitech":/(nintendo|switch|joycon|057e)/.test(t)?"nintendo":/(dualshock|dualsense|sony|054c|0ce6|0810)/.test(t)?"playstation":/(xbox|xinput|045e|028e|0291|02a0|02a1|02ea|02ff)/.test(t)?"xbox":"generic"}(e),this._throttleIdLeftStickX=this.id+"-lsx",this._throttleIdLeftStickY=this.id+"-lsy"}updatePresses(r,d){var c,u,l,h,g,p,m;const v=this._btnPrevState.length;for(let e=0;e<v;e++){let t=e;if("nintendo"===this.layout&&"none"!==this.options.remapNintendoMode&&("physical"===this.options.remapNintendoMode?t===o.B?t=o.A:t===o.A?t=o.B:t===o.X?t=o.Y:t===o.Y&&(t=o.X):t===o.B?t=o.X:t===o.X&&(t=o.B)),this._btnPrevState[t]===(null===(c=r.buttons[e])||void 0===c?void 0:c.pressed))continue;this.lastInteraction=d;const i=null!==(l=null===(u=r.buttons[e])||void 0===u?void 0:u.pressed)&&void 0!==l&&l,s=n[t];this._btnPrevState[t]=i,this.button[s]=i,i&&(this._emitter.hasListener(s)&&setTimeout((()=>this._emitter.emit(s,{device:this,button:t,buttonCode:s}))),Object.entries(this.options.binds).forEach((([e,i])=>{i.includes(s)&&setTimeout((()=>{const i={device:this,button:t,buttonCode:s,name:e};this._bindEmitter.emit(e,i),this._emitter.emit("bind",i)}))})),a.options.enabled&&this.options.navigation.enabled&&void 0!==this.options.navigation.binds[t]&&setTimeout((()=>a.commit(this.options.navigation.binds[t],this))))}const y=this.options.triggerDeadzone;this.leftTrigger=_scale(this.source.buttons[o.LeftTrigger].value,y),this.rightTrigger=_scale(this.source.buttons[o.RightTrigger].value,y),this.leftShoulder=_scale(this.source.buttons[o.LeftShoulder].value,y),this.rightShoulder=_scale(this.source.buttons[o.RightShoulder].value,y);const f=this.options.joystickDeadzone;this.leftJoystick.x=_scale(null!==(h=r.axes[e])&&void 0!==h?h:0,f),this.leftJoystick.y=_scale(null!==(g=r.axes[t])&&void 0!==g?g:0,f),this.rightJoystick.x=_scale(null!==(p=r.axes[i])&&void 0!==p?p:0,f),this.rightJoystick.y=_scale(null!==(m=r.axes[s])&&void 0!==m?m:0,f),0===this.leftJoystick.x&&0===this.leftJoystick.y&&0===this.rightJoystick.x&&0===this.rightJoystick.y||(this.lastInteraction=d);const b=this.options.navigation.joystick;if(Math.abs(this.leftJoystick.x)>=b.commitSensitivity){const t=this.leftJoystick.x<0?"navigateLeft":"navigateRight",i=this._axisIntents[e]?b.repeatCooldownMs:b.firstRepeatCooldownMs;this._axisIntents[e]=!0,this.options.navigation.enabled&&!throttle(this._throttleIdLeftStickX,i)&&setTimeout((()=>a.commit(t,this)))}else this._axisIntents[e]=!1;if(Math.abs(this.leftJoystick.y)>=b.commitSensitivity){const e=this.leftJoystick.y<0?"navigateUp":"navigateDown",i=this._axisIntents[t]?b.repeatCooldownMs:b.firstRepeatCooldownMs;this._axisIntents[t]=!0,this.options.navigation.enabled&&!throttle(this._throttleIdLeftStickY,i)&&setTimeout((()=>a.commit(e,this)))}else this._axisIntents[t]=!1}}function _scale(e,t){const i=(Math.abs(e)-t[0])/(t[1]-t[0]);return i>=0&&i<=1?Math.sign(e)*i:i>1?1*Math.sign(e):0}GamepadDevice.defaultOptions={remapNintendoMode:"physical",binds:{},navigation:{enabled:!0,binds:{[o.A]:"trigger",[o.B]:"navigateBack",[o.Back]:"navigateBack",[o.DPadDown]:"navigateDown",[o.DPadLeft]:"navigateLeft",[o.DPadRight]:"navigateRight",[o.DPadUp]:"navigateUp"},joystick:{commitSensitivity:.5,repeatCooldownMs:80,firstRepeatCooldownMs:400}},joystickDeadzone:[0,1],triggerDeadzone:[0,1],vibration:{enabled:!0,intensity:1}};const d={AltLeft:"AltLeft",AltRight:"AltRight",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",ArrowUp:"ArrowUp",Backquote:"Backquote",Backslash:"Backslash",Backspace:"Backspace",BracketLeft:"BracketLeft",BracketRight:"BracketRight",CapsLock:"CapsLock",Comma:"Comma",ContextMenu:"ContextMenu",ControlLeft:"ControlLeft",ControlRight:"ControlRight",Delete:"Delete",Digit0:"Digit0",Digit1:"Digit1",Digit2:"Digit2",Digit3:"Digit3",Digit4:"Digit4",Digit5:"Digit5",Digit6:"Digit6",Digit7:"Digit7",Digit8:"Digit8",Digit9:"Digit9",End:"End",Enter:"Enter",Equal:"Equal",Escape:"Escape",F1:"F1",F10:"F10",F11:"F11",F12:"F12",F13:"F13",F14:"F14",F15:"F15",F16:"F16",F17:"F17",F18:"F18",F19:"F19",F2:"F2",F20:"F20",F21:"F21",F22:"F22",F23:"F23",F24:"F24",F25:"F25",F26:"F26",F27:"F27",F28:"F28",F29:"F29",F3:"F3",F30:"F30",F31:"F31",F32:"F32",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",Home:"Home",IntlBackslash:"IntlBackslash",IntlRo:"IntlRo",IntlYen:"IntlYen",KeyA:"KeyA",KeyB:"KeyB",KeyC:"KeyC",KeyD:"KeyD",KeyE:"KeyE",KeyF:"KeyF",KeyG:"KeyG",KeyH:"KeyH",KeyI:"KeyI",KeyJ:"KeyJ",KeyK:"KeyK",KeyL:"KeyL",KeyM:"KeyM",KeyN:"KeyN",KeyO:"KeyO",KeyP:"KeyP",KeyQ:"KeyQ",KeyR:"KeyR",KeyS:"KeyS",KeyT:"KeyT",KeyU:"KeyU",KeyV:"KeyV",KeyW:"KeyW",KeyX:"KeyX",KeyY:"KeyY",KeyZ:"KeyZ",Lang1:"Lang1",Lang2:"Lang2",MediaTrackNext:"MediaTrackNext",MediaTrackPrevious:"MediaTrackPrevious",MetaLeft:"MetaLeft",MetaRight:"MetaRight",Minus:"Minus",NumLock:"NumLock",Numpad0:"Numpad0",Numpad1:"Numpad1",Numpad2:"Numpad2",Numpad3:"Numpad3",Numpad4:"Numpad4",Numpad5:"Numpad5",Numpad6:"Numpad6",Numpad7:"Numpad7",Numpad8:"Numpad8",Numpad9:"Numpad9",NumpadAdd:"NumpadAdd",NumpadComma:"NumpadComma",NumpadDecimal:"NumpadDecimal",NumpadDivide:"NumpadDivide",NumpadMultiply:"NumpadMultiply",NumpadSubtract:"NumpadSubtract",OSLeft:"OSLeft",Pause:"Pause",Period:"Period",Quote:"Quote",ScrollLock:"ScrollLock",Semicolon:"Semicolon",ShiftLeft:"ShiftLeft",ShiftRight:"ShiftRight",Slash:"Slash",Space:"Space",Tab:"Tab",VolumeDown:"VolumeDown",VolumeMute:"VolumeMute",VolumeUp:"VolumeUp",WakeUp:"WakeUp"};function __awaiter(e,t,i,s){return new(i||(i=Promise))((function(o,n){function fulfilled(e){try{step(s.next(e))}catch(e){n(e)}}function rejected(e){try{step(s.throw(e))}catch(e){n(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof i?e:new i((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,t||[])).next())}))}let c,u;"function"==typeof SuppressedError&&SuppressedError;const l=["fr","mg","lu"],h=["ab","ba","be","bg","ch","kk","ky","mk","mn","ru","sr","tg","tt","uk","uz"],g=["de","cs","sk","sl","hu","hr","bs","ro","sq","me","lt","lv","et"],p=/ф|и|с|в|у|а|п|р|ш|о|л|д|ь|т|щ|з|й|к|ы|е|г|м|ц|ч|н|я|ё|х|ъ|б|ю|э|ж|и/i,m=/[a-z]/i;function inferKeyboardLayoutFromLang(e=function getLang(){var e;const t=navigator;return null!=(null===(e=t.languages)||void 0===e?void 0:e.length)?t.languages[0]:t.userLanguage||t.language||t.browserLanguage}()){const t=(e||"").toLowerCase(),i=t.split("-")[0];return l.includes(i)||t.startsWith("nl-be")?"AZERTY":h.includes(i)?"JCUKEN":g.includes(i)||t.startsWith("sr-latn")?"QWERTZ":"QWERTY"}const v=new Set(["AZERTY","JCUKEN","QWERTY","QWERTZ"]);function getLayoutKeyLabel(e,t){var i,s;if(void 0===u){const e={ArrowLeft:"⬅",ArrowRight:"➡",ArrowUp:"⬆",ArrowDown:"⬇",AltLeft:"Left Alt",AltRight:"Right Alt",Backquote:"`",Backslash:"\\",Backspace:"Backspace",BracketLeft:"[",BracketRight:"]",CapsLock:"CapsLock",Comma:",",ContextMenu:"Context Menu",ControlLeft:"Left Ctrl",ControlRight:"Right Ctrl",Delete:"Delete",Digit0:"0",Digit1:"1",Digit2:"2",Digit3:"3",Digit4:"4",Digit5:"5",Digit6:"6",Digit7:"7",Digit8:"8",Digit9:"9",End:"End",Enter:"Enter",Equal:"=",Escape:"Esc",F1:"F1",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",F10:"F10",F11:"F11",F12:"F12",F13:"F13",F14:"F14",F15:"F15",F16:"F16",F17:"F17",F18:"F18",F19:"F19",F20:"F20",F21:"F21",F22:"F22",F23:"F23",F24:"F24",F25:"F25",F26:"F26",F27:"F27",F28:"F28",F29:"F29",F30:"F30",F31:"F31",F32:"F32",Home:"Home",IntlBackslash:"\\",IntlRo:"Ro",IntlYen:"¥",KeyA:"A",KeyB:"B",KeyC:"C",KeyD:"D",KeyE:"E",KeyF:"F",KeyG:"G",KeyH:"H",KeyI:"I",KeyJ:"J",KeyK:"K",KeyL:"L",KeyM:"M",KeyN:"N",KeyO:"O",KeyP:"P",KeyQ:"Q",KeyR:"R",KeyS:"S",KeyT:"T",KeyU:"U",KeyV:"V",KeyW:"W",KeyX:"X",KeyY:"Y",KeyZ:"Z",Lang1:"Language 1",Lang2:"Language 2",MediaTrackNext:"Next Track",MediaTrackPrevious:"Previous Track",MetaLeft:"Left "+getMetaKeyLabel(),MetaRight:"Right "+getMetaKeyLabel(),Minus:"-",NumLock:"Num Lock",Numpad0:"Num0",Numpad1:"Num1",Numpad2:"Num2",Numpad3:"Num3",Numpad4:"Num4",Numpad5:"Num5",Numpad6:"Num6",Numpad7:"Num7",Numpad8:"Num8",Numpad9:"Num9",NumpadAdd:"+",NumpadComma:",",NumpadDecimal:".",NumpadDivide:"/",NumpadMultiply:"*",NumpadSubtract:"-",OSLeft:"OS Left",Pause:"Pause",Period:".",Quote:"'",ScrollLock:"Scroll Lock",Semicolon:";",ShiftLeft:"Left Shift",ShiftRight:"Right Shift",Slash:"/",Space:"Space",Tab:"Tab",VolumeDown:"Volume Down",VolumeMute:"Volume Mute",VolumeUp:"Volume Up",WakeUp:"Wake Up"};u={AZERTY:{KeyA:"Q",KeyQ:"A",KeyW:"Z",KeyZ:"W",Backquote:"²",BracketLeft:"«",BracketRight:"»"},JCUKEN:{KeyA:"Ф",KeyB:"И",KeyC:"С",KeyD:"В",KeyE:"У",KeyF:"А",KeyG:"П",KeyH:"Р",KeyI:"Ш",KeyJ:"О",KeyK:"Л",KeyL:"Д",KeyM:"Ь",KeyN:"Т",KeyO:"Щ",KeyP:"З",KeyQ:"Й",KeyR:"К",KeyS:"Ы",KeyT:"Е",KeyU:"Г",KeyV:"М",KeyW:"Ц",KeyX:"Ч",KeyY:"Н",KeyZ:"Я",Backquote:"Ё",BracketLeft:"х",BracketRight:"ъ",Comma:"Б",Period:"Ю",Quote:"Э",Semicolon:"Ж",Slash:"И"},QWERTY:e,QWERTZ:{KeyY:"Z",KeyZ:"Y",BracketLeft:"ü",BracketRight:"ö",Slash:"-"}}}return null!==(s=null!==(i=u[t][e])&&void 0!==i?i:u.QWERTY[e])&&void 0!==s?s:e}function getMetaKeyLabel(){var e,t,i,s;const o=navigator,n=null!==(t=null===(e=o.platform)||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:"",a=null!==(s=null===(i=o.userAgent)||void 0===i?void 0:i.toLowerCase())&&void 0!==s?s:"";return n.includes("mac")?"⌘":n.includes("win")||n.includes("linux")?"⊞":a.includes("android")?"Search":a.includes("iphone")||a.includes("ipad")?"⌘":"⊞"}const y=["navigateLeft","navigateRight","navigateUp","navigateDown"];class KeyboardDevice{constructor(){this.type="keyboard",this.id="keyboard",this.meta={},this.lastInteraction=performance.now(),this.detectLayoutOnKeypress=!0,this.detected=!1,this.options={binds:{},navigation:{enabled:!0,binds:{Space:"trigger",Enter:"trigger",Escape:"navigateBack",Backspace:"navigateBack",ArrowDown:"navigateDown",ArrowLeft:"navigateLeft",ArrowRight:"navigateRight",ArrowUp:"navigateUp",KeyA:"navigateLeft",KeyD:"navigateRight",KeyS:"navigateDown",KeyW:"navigateUp"}}},this.key=Object.keys(d).reduce(((e,t)=>(e[t]=!1,e)),{}),this._emitter=new EventEmitter,this._bindEmitter=new EventEmitter,this._deferredKeydown=[],this._layout=inferKeyboardLayoutFromLang(),this._layoutSource="lang",function requestKeyboardLayout(){return __awaiter(this,void 0,void 0,(function*(){const e=navigator;if(e.keyboard&&e.keyboard.getLayoutMap)try{const t=yield e.keyboard.getLayoutMap();c=t;const i=t.get("KeyQ"),s=t.get("KeyA"),o=t.get("KeyZ");if("a"===i&&"w"===o&&"q"===s)return"AZERTY";if("q"===i&&"y"===o&&"a"===s)return"QWERTZ";if("q"===i&&"z"===o&&"a"===s)return"QWERTY";if("й"===i&&"я"===o&&"ф"===s)return"JCUKEN"}catch(e){}}))}().then((e=>{void 0!==e&&(this._layoutSource="browser",this._layout=e,this.detectLayoutOnKeypress=!1,this._emitter.emit("layoutdetected",{layoutSource:"browser",layout:e,device:this}))})),this._configureEventListeners()}get layout(){return this._layout}set layout(e){this._layoutSource="manual",this._layout=e,this.detectLayoutOnKeypress=!1}get layoutSource(){return this._layoutSource}pressedBind(e){return void 0!==this.options.binds[e]&&this.pressedAny(this.options.binds[e])}pressedAny(e){for(let t=0;t<e.length;t++)if(this.key[e[t]])return!0;return!1}pressedAll(e){for(let t=0;t<e.length;t++)if(!this.key[e[t]])return!1;return!0}on(e,t){return this._emitter.on(e,t),this}off(e,t){return this._emitter.off(e,t),this}onBind(e,t){return this._bindEmitter.on(e,t),this}offBind(e,t){return this._bindEmitter.off(e,t),this}getKeyLabel(e,t){var i;return t?getLayoutKeyLabel(e,t):null!==(i=function getNavigatorKeyLabel(e){const t=null==c?void 0:c.get(e);return void 0===t?void 0:function _toLocaleTitleCase(e){return e.split(/\s+/).map((e=>e.charAt(0).toLocaleUpperCase()+e.slice(1))).join(" ")}(t)}(e))&&void 0!==i?i:getLayoutKeyLabel(e,null!=t?t:this._layout)}update(e){this._deferredKeydown.length>0&&(this._deferredKeydown.forEach((e=>this._processDeferredKeydownEvent(e))),this._deferredKeydown.length=0)}clear(){for(const e of Object.keys(d))this.key[e]=!1}_configureEventListeners(){const e=this.key,t=this._deferredKeydown;window.addEventListener("keydown",(i=>{e[i.code]=!0,t.push(i),this.lastInteraction=performance.now()}),{passive:!0,capture:!0}),window.addEventListener("keyup",(t=>{e[t.code]=!1,this.lastInteraction=performance.now()}),{passive:!0,capture:!0})}_processDeferredKeydownEvent(e){const t=e.code;if(!e.repeat){if(this.detectLayoutOnKeypress&&"lang"===this._layoutSource){const t=function detectKeyboardLayoutFromKeydown(e){const t=e.key.toLowerCase(),i=e.code;return p.test(t)?(v.delete("AZERTY"),v.delete("QWERTY"),v.delete("QWERTZ")):"Backquote"===i&&"²"===t||"BracketLeft"===i&&"«"===t||"BracketRight"===i&&"»"===t||"KeyA"===i&&"q"===t||"KeyQ"===i&&"a"===t||"KeyW"===i&&"z"===t||"KeyZ"===i&&"w"===t?(v.delete("JCUKEN"),v.delete("QWERTY"),v.delete("QWERTZ")):"BracketLeft"===i&&"ü"===t||"BracketRight"===i&&"ö"===t||"KeyY"===i&&"z"===t||"KeyZ"===i&&"y"===t||"Slash"===i&&"-"===t?(v.delete("AZERTY"),v.delete("JCUKEN"),v.delete("QWERTY")):"BracketLeft"===i&&"["===t||"BracketRight"===i&&"]"===t||"KeyZ"===i&&"z"===t?(v.delete("AZERTY"),v.delete("JCUKEN"),v.delete("QWERTZ")):"KeyQ"===i&&"q"===t||"KeyW"===i&&"w"===t?(v.delete("AZERTY"),v.delete("JCUKEN")):"KeyY"===i&&"Y"===t?(v.delete("QWERTZ"),v.delete("JCUKEN")):m.test(t)&&v.delete("JCUKEN"),1===v.size?[...v][0]:void 0}(e);void 0!==t&&(this._layout=t,this._layoutSource="keypress",this.detectLayoutOnKeypress=!1,this._emitter.emit("layoutdetected",{layout:t,layoutSource:"keypress",device:this}))}this._emitter.hasListener(t)&&setTimeout((()=>this._emitter.emit(t,{device:this,keyCode:t,keyLabel:this.getKeyLabel(t),event:e}))),Object.entries(this.options.binds).forEach((([i,s])=>{s.includes(t)&&setTimeout((()=>{const s={device:this,keyCode:t,keyLabel:this.getKeyLabel(t),event:e,name:i};this._bindEmitter.emit(i,s),this._emitter.emit("bind",s)}))}))}if(a.options.enabled&&this.options.navigation.enabled&&void 0!==this.options.navigation.binds[t]){const i=this.options.navigation.binds[t];e.repeat&&!y.includes(i)||setTimeout((()=>a.commit(this.options.navigation.binds[t],this)))}}}KeyboardDevice.global=new KeyboardDevice;class InputDeviceManager{constructor(){this.isMobile=(()=>{let e=!1;var t;return t=navigator.userAgent||navigator.vendor,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),e})(),this.isTouchCapable=function isTouchCapable(){return"ontouchstart"in window||navigator.maxTouchPoints>0}(),this.options={requireFocus:!0,clearInputInBackground:!0},this._devices=[],this._gamepadDevices=[],this._gamepadDeviceMap=new Map,this._customDevices=[],this._emitter=new EventEmitter,this._bindEmitter=new EventEmitter,this._hasFocus=!1,this.keyboard=KeyboardDevice.global,this.isTouchCapable||this.isMobile?window.addEventListener("keydown",(()=>this.add(this.keyboard)),{once:!0}):this.add(this.keyboard),window.addEventListener("gamepadconnected",(()=>this._pollGamepads(performance.now()))),window.addEventListener("gamepaddisconnected",(e=>this._removeGamepad(e.gamepad.index)))}get devices(){return this._devices}get gamepads(){return this._gamepadDevices}get custom(){return this._customDevices}get lastInteractedDevice(){return this._lastInteractedDevice}on(e,t){return this._emitter.on(e,t),this}off(e,t){return this._emitter.off(e,t),this}onBind(e,t){return this._bindEmitter.on(e,t),this}offBind(e,t){return this._bindEmitter.off(e,t),this}emitBind(e){this._bindEmitter.emit(e.name,e)}add(e){-1===this._devices.indexOf(e)&&(this._devices.push(e),e instanceof KeyboardDevice?(e.detected=!0,e.on("bind",(e=>this.emitBind(e)))):e instanceof GamepadDevice?(this._gamepadDeviceMap.set(e.source.index,e),this._gamepadDevices.push(e),e.on("bind",(e=>this.emitBind(e)))):this._customDevices.push(e),this._emitter.emit("deviceadded",{device:e}))}remove(e){if(!(e instanceof KeyboardDevice||e instanceof GamepadDevice)){const t=this._customDevices.indexOf(e);-1!==t&&this._devices.splice(t,1)}const t=this._devices.indexOf(e);-1!==t&&(this._devices.splice(t,1),this._emitter.emit("deviceremoved",{device:e}))}update(){if(this.options.requireFocus&&!document.hasFocus())return this._hasFocus&&this.options.clearInputInBackground&&this.devices.forEach((e=>{var t;return null===(t=e.clear)||void 0===t?void 0:t.call(e)})),this._hasFocus=!1,this._devices;this._hasFocus=!0;const e=performance.now();return this.keyboard.detected&&this.keyboard.update(e),this._gamepadDevices.length>0&&this._pollGamepads(e),this._customDevices.length>0&&this._customDevices.forEach((t=>t.update(e))),this._updateLastInteracted(),this._devices}_updateLastInteracted(){if(0===this._devices.length)return;let e;if(1===this._devices.length)e=this._devices[0];else for(const t of this._devices)(void 0===e||t.lastInteraction>e.lastInteraction)&&(e=t);this._lastInteractedDevice=e}_pollGamepads(e){if(!document.hasFocus())return this._gamepadDevices;if(void 0===navigator.getGamepads)return this._gamepadDevices;for(const t of navigator.getGamepads())if(null!=t)if(this._gamepadDeviceMap.has(t.index)){this._gamepadDeviceMap.get(t.index).update(t,e)}else{const i=new GamepadDevice(t);this.add(i),i.update(t,e)}return this._gamepadDevices}_removeGamepad(e){const t=this._gamepadDeviceMap.get(e);if(!t)return;const i=this._gamepadDevices.indexOf(t);-1!==i&&this._gamepadDevices.splice(i,1),this.remove(t),this._gamepadDeviceMap.delete(e)}}InputDeviceManager.global=new InputDeviceManager;const f=InputDeviceManager.global;exports.Button=o,exports.GamepadDevice=GamepadDevice,exports.InputDevice=f,exports.KeyCode=d,exports.KeyboardDevice=KeyboardDevice,exports.Navigation=a,exports.REPEATABLE_NAV_INTENTS=y,exports.getAllNavigatables=getAllNavigatables,exports.getFirstNavigatable=getFirstNavigatable,exports.isChildOf=isChildOf,exports.registerPixiJSInputDeviceMixin=function registerPixiJSInputDeviceMixin(e){const t=e.prototype;t.navigationPriority=0,t.navigationMode="auto",Object.defineProperty(t,"isNavigatable",{get:function(){if("auto"===this.navigationMode){if(!this.isInteractive)return!1;const e=this.eventNames();return e.includes("pointerdown")||e.includes("mousedown")}return"target"===this.navigationMode},configurable:!0,enumerable:!1})};
|
|
1
|
+
"use strict";const e=0,t=1,i=2,s=3,o=["LeftStickLeft","LeftStickRight","LeftStickUp","LeftStickDown","RightStickLeft","RightStickRight","RightStickUp","RightStickDown"],n={A:0,B:1,X:2,Y:3,LeftShoulder:4,RightShoulder:5,LeftTrigger:6,RightTrigger:7,Back:8,Start:9,LeftStickClick:10,RightStickClick:11,DPadUp:12,DPadDown:13,DPadLeft:14,DPadRight:15},a=["A","B","X","Y","LeftShoulder","RightShoulder","LeftTrigger","RightTrigger","Back","Start","LStick","RStick","DPadUp","DPadDown","DPadLeft","DPadRight"];let r=new Map;function throttle(e,t){var i;const s=Date.now();return(null!==(i=r.get(e))&&void 0!==i?i:0)>s||(r.set(e,s+t),!1)}class EventEmitter{constructor(){this._listeners={}}hasListener(e){return void 0!==this._listeners[e]}emit(e,t){var i;null===(i=this._listeners[e])||void 0===i||i.forEach((e=>e(t)))}on(e,t){var i;this._listeners[e]||(this._listeners[e]=[]),null===(i=this._listeners[e])||void 0===i||i.push(t)}off(e,t){var i,s;this._listeners[e]=void 0===t||null===(i=this._listeners[e])||void 0===i?void 0:i.filter((e=>e!==t)),0===(null===(s=this._listeners[e])||void 0===s?void 0:s.length)&&(this._listeners[e]=void 0)}}class GamepadDevice{static configureDefaultBinds(e){this.defaultOptions.binds=Object.assign(Object.assign({},this.defaultOptions.binds),e)}pressedBind(e){return void 0!==this.options.binds[e]&&this.pressedAny(this.options.binds[e])}pressedAny(e){for(let t=0;t<e.length;t++)if(this.button[e[t]])return!0;return!1}pressedAll(e){for(let t=0;t<e.length;t++)if(!this.button[e[t]])return!1;return!0}configureBinds(e){this.options.binds=Object.assign(Object.assign({},this.options.binds),e)}on(e,t){return this._emitter.on(e,t),this}off(e,t){return this._emitter.off(e,t),this}onBind(e,t){return this._bindEmitter.on(e,t),this}offBind(e,t){return this._bindEmitter.off(e,t),this}playVibration({duration:e=200,weakMagnitude:t=.5,strongMagnitude:i=.5,vibrationType:s="dual-rumble",rightTrigger:o=0,leftTrigger:n=0,startDelay:a=0}={}){if(!this.options.vibration.enabled)return;if(!this.source.vibrationActuator)return;const r=this.options.vibration.intensity;try{this.source.vibrationActuator.playEffect(s,{duration:e,startDelay:a,weakMagnitude:r*t,strongMagnitude:r*i,leftTrigger:r*n,rightTrigger:r*o})}catch(e){}}update(e,t){this.updatePresses(e,t),this.source=e}clear(){this.button=[...o,...a].reduce(((e,t)=>(e[t]=!1,e)),{})}constructor(e){this.source=e,this.type="gamepad",this.meta={},this.lastInteraction=performance.now(),this.options=JSON.parse(JSON.stringify(GamepadDevice.defaultOptions)),this.leftJoystick={x:0,y:0},this.rightJoystick={x:0,y:0},this.button=[...a,...o].reduce(((e,t)=>(e[t]=!1,e)),{}),this._emitter=new EventEmitter,this._bindEmitter=new EventEmitter,this.leftTrigger=0,this.rightTrigger=0,this.leftShoulder=0,this.rightShoulder=0,this.id="gamepad"+e.index,this.layout=function detectLayout(e){const t=(e.id||"").toLowerCase();return/(steam|28de)/.test(t)?"steam":/(logitech|046d|c216)/.test(t)?"logitech":/(nintendo|switch|joycon|057e)/.test(t)?"nintendo":/(dualshock|dualsense|sony|054c|0ce6|0810)/.test(t)?"playstation":/(xbox|xinput|045e|028e|0291|02a0|02a1|02ea|02ff)/.test(t)?"xbox":"standard"}(e)}updatePresses(r,d){var c,u,l,h,g,p,m;const v=this.options.joystick;for(let e=0;e<4;e++){const t=_scale(r.axes[e],v.deadzone),i=o[2*e+(t>0?1:0)];if(Math.abs(t)<v.threshold)this.button[i]=!1;else{const t=v.autoRepeatDelayMs[+this.button[i]];this.button[i]=!0,throttle(i,t)||(this.lastInteraction=d,this._emitter.hasListener(i)&&setTimeout((()=>this._emitter.emit(i,{device:this,axis:e,axisCode:i}))),Object.entries(this.options.binds).forEach((([t,s])=>{s.includes(i)&&setTimeout((()=>{const s={device:this,type:"axis",axis:e,axisCode:i,name:t};this._bindEmitter.emit(t,s),this._emitter.emit("bind",s)}))})))}}for(let e=0;e<16;e++){let t=e;"nintendo"===this.layout&&"none"!==this.options.nintendoRemapMode&&("physical"===this.options.nintendoRemapMode?t===n.B?t=n.A:t===n.A?t=n.B:t===n.X?t=n.Y:t===n.Y&&(t=n.X):t===n.B?t=n.X:t===n.X&&(t=n.B));const i=a[t];if(this.button[i]===(null===(c=r.buttons[e])||void 0===c?void 0:c.pressed))continue;this.lastInteraction=d;const s=null!==(l=null===(u=r.buttons[e])||void 0===u?void 0:u.pressed)&&void 0!==l&&l;this.button[i]=s,s&&(this._emitter.hasListener(i)&&setTimeout((()=>this._emitter.emit(i,{device:this,button:t,buttonCode:i}))),Object.entries(this.options.binds).forEach((([e,s])=>{s.includes(i)&&setTimeout((()=>{const s={device:this,type:"button",button:t,buttonCode:i,name:e};this._bindEmitter.emit(e,s),this._emitter.emit("bind",s)}))})))}const f=this.options.trigger.deadzone;this.leftTrigger=_scale(r.buttons[n.LeftTrigger].value,f),this.rightTrigger=_scale(r.buttons[n.RightTrigger].value,f),this.leftShoulder=_scale(r.buttons[n.LeftShoulder].value,f),this.rightShoulder=_scale(r.buttons[n.RightShoulder].value,f);const y=v.deadzone;this.leftJoystick.x=_scale(null!==(h=r.axes[e])&&void 0!==h?h:0,y),this.leftJoystick.y=_scale(null!==(g=r.axes[t])&&void 0!==g?g:0,y),this.rightJoystick.x=_scale(null!==(p=r.axes[i])&&void 0!==p?p:0,y),this.rightJoystick.y=_scale(null!==(m=r.axes[s])&&void 0!==m?m:0,y)}}function _scale(e,t){const i=(Math.abs(e)-t[0])/(t[1]-t[0]);return i>=0&&i<=1?Math.sign(e)*i:i>1?1*Math.sign(e):0}GamepadDevice.defaultOptions={nintendoRemapMode:"physical",binds:{"navigate.back":["B","Back"],"navigate.down":["DPadDown","LeftStickDown"],"navigate.left":["DPadLeft","LeftStickLeft"],"navigate.right":["DPadRight","LeftStickRight"],"navigate.trigger":["A"],"navigate.up":["DPadUp","LeftStickUp"]},joystick:{deadzone:[0,1],threshold:.25,autoRepeatDelayMs:[400,80]},trigger:{deadzone:[0,1]},vibration:{enabled:!0,intensity:1}};const d={AltLeft:"AltLeft",AltRight:"AltRight",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",ArrowUp:"ArrowUp",Backquote:"Backquote",Backslash:"Backslash",Backspace:"Backspace",BracketLeft:"BracketLeft",BracketRight:"BracketRight",CapsLock:"CapsLock",Comma:"Comma",ContextMenu:"ContextMenu",ControlLeft:"ControlLeft",ControlRight:"ControlRight",Delete:"Delete",Digit0:"Digit0",Digit1:"Digit1",Digit2:"Digit2",Digit3:"Digit3",Digit4:"Digit4",Digit5:"Digit5",Digit6:"Digit6",Digit7:"Digit7",Digit8:"Digit8",Digit9:"Digit9",End:"End",Enter:"Enter",Equal:"Equal",Escape:"Escape",F1:"F1",F10:"F10",F11:"F11",F12:"F12",F13:"F13",F14:"F14",F15:"F15",F16:"F16",F17:"F17",F18:"F18",F19:"F19",F2:"F2",F20:"F20",F21:"F21",F22:"F22",F23:"F23",F24:"F24",F25:"F25",F26:"F26",F27:"F27",F28:"F28",F29:"F29",F3:"F3",F30:"F30",F31:"F31",F32:"F32",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",Home:"Home",IntlBackslash:"IntlBackslash",IntlRo:"IntlRo",IntlYen:"IntlYen",KeyA:"KeyA",KeyB:"KeyB",KeyC:"KeyC",KeyD:"KeyD",KeyE:"KeyE",KeyF:"KeyF",KeyG:"KeyG",KeyH:"KeyH",KeyI:"KeyI",KeyJ:"KeyJ",KeyK:"KeyK",KeyL:"KeyL",KeyM:"KeyM",KeyN:"KeyN",KeyO:"KeyO",KeyP:"KeyP",KeyQ:"KeyQ",KeyR:"KeyR",KeyS:"KeyS",KeyT:"KeyT",KeyU:"KeyU",KeyV:"KeyV",KeyW:"KeyW",KeyX:"KeyX",KeyY:"KeyY",KeyZ:"KeyZ",Lang1:"Lang1",Lang2:"Lang2",MediaTrackNext:"MediaTrackNext",MediaTrackPrevious:"MediaTrackPrevious",MetaLeft:"MetaLeft",MetaRight:"MetaRight",Minus:"Minus",NumLock:"NumLock",Numpad0:"Numpad0",Numpad1:"Numpad1",Numpad2:"Numpad2",Numpad3:"Numpad3",Numpad4:"Numpad4",Numpad5:"Numpad5",Numpad6:"Numpad6",Numpad7:"Numpad7",Numpad8:"Numpad8",Numpad9:"Numpad9",NumpadAdd:"NumpadAdd",NumpadComma:"NumpadComma",NumpadDecimal:"NumpadDecimal",NumpadDivide:"NumpadDivide",NumpadMultiply:"NumpadMultiply",NumpadSubtract:"NumpadSubtract",OSLeft:"OSLeft",Pause:"Pause",Period:"Period",Quote:"Quote",ScrollLock:"ScrollLock",Semicolon:"Semicolon",ShiftLeft:"ShiftLeft",ShiftRight:"ShiftRight",Slash:"Slash",Space:"Space",Tab:"Tab",VolumeDown:"VolumeDown",VolumeMute:"VolumeMute",VolumeUp:"VolumeUp",WakeUp:"WakeUp"};function __awaiter(e,t,i,s){return new(i||(i=Promise))((function(o,n){function fulfilled(e){try{step(s.next(e))}catch(e){n(e)}}function rejected(e){try{step(s.throw(e))}catch(e){n(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof i?e:new i((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,t||[])).next())}))}let c,u;"function"==typeof SuppressedError&&SuppressedError;const l=["fr","mg","lu"],h=["ab","ba","be","bg","ch","kk","ky","mk","mn","ru","sr","tg","tt","uk","uz"],g=["de","cs","sk","sl","hu","hr","bs","ro","sq","me","lt","lv","et"],p=/ф|и|с|в|у|а|п|р|ш|о|л|д|ь|т|щ|з|й|к|ы|е|г|м|ц|ч|н|я|ё|х|ъ|б|ю|э|ж|и/i,m=/[a-z]/i;function inferKeyboardLayoutFromLang(e=function getLang(){var e;const t=navigator;return null!=(null===(e=t.languages)||void 0===e?void 0:e.length)?t.languages[0]:t.userLanguage||t.language||t.browserLanguage}()){const t=(e||"").toLowerCase(),i=t.split("-")[0];return l.includes(i)||t.startsWith("nl-be")?"AZERTY":h.includes(i)?"JCUKEN":g.includes(i)||t.startsWith("sr-latn")?"QWERTZ":"QWERTY"}const v=new Set(["AZERTY","JCUKEN","QWERTY","QWERTZ"]);function getLayoutKeyLabel(e,t){var i,s;if(void 0===u){const e={ArrowLeft:"⬅",ArrowRight:"➡",ArrowUp:"⬆",ArrowDown:"⬇",AltLeft:"Left Alt",AltRight:"Right Alt",Backquote:"`",Backslash:"\\",Backspace:"Backspace",BracketLeft:"[",BracketRight:"]",CapsLock:"CapsLock",Comma:",",ContextMenu:"Context Menu",ControlLeft:"Left Ctrl",ControlRight:"Right Ctrl",Delete:"Delete",Digit0:"0",Digit1:"1",Digit2:"2",Digit3:"3",Digit4:"4",Digit5:"5",Digit6:"6",Digit7:"7",Digit8:"8",Digit9:"9",End:"End",Enter:"Enter",Equal:"=",Escape:"Esc",F1:"F1",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",F10:"F10",F11:"F11",F12:"F12",F13:"F13",F14:"F14",F15:"F15",F16:"F16",F17:"F17",F18:"F18",F19:"F19",F20:"F20",F21:"F21",F22:"F22",F23:"F23",F24:"F24",F25:"F25",F26:"F26",F27:"F27",F28:"F28",F29:"F29",F30:"F30",F31:"F31",F32:"F32",Home:"Home",IntlBackslash:"\\",IntlRo:"Ro",IntlYen:"¥",KeyA:"A",KeyB:"B",KeyC:"C",KeyD:"D",KeyE:"E",KeyF:"F",KeyG:"G",KeyH:"H",KeyI:"I",KeyJ:"J",KeyK:"K",KeyL:"L",KeyM:"M",KeyN:"N",KeyO:"O",KeyP:"P",KeyQ:"Q",KeyR:"R",KeyS:"S",KeyT:"T",KeyU:"U",KeyV:"V",KeyW:"W",KeyX:"X",KeyY:"Y",KeyZ:"Z",Lang1:"Language 1",Lang2:"Language 2",MediaTrackNext:"Next Track",MediaTrackPrevious:"Previous Track",MetaLeft:"Left "+getMetaKeyLabel(),MetaRight:"Right "+getMetaKeyLabel(),Minus:"-",NumLock:"Num Lock",Numpad0:"Num0",Numpad1:"Num1",Numpad2:"Num2",Numpad3:"Num3",Numpad4:"Num4",Numpad5:"Num5",Numpad6:"Num6",Numpad7:"Num7",Numpad8:"Num8",Numpad9:"Num9",NumpadAdd:"+",NumpadComma:",",NumpadDecimal:".",NumpadDivide:"/",NumpadMultiply:"*",NumpadSubtract:"-",OSLeft:"OS Left",Pause:"Pause",Period:".",Quote:"'",ScrollLock:"Scroll Lock",Semicolon:";",ShiftLeft:"Left Shift",ShiftRight:"Right Shift",Slash:"/",Space:"Space",Tab:"Tab",VolumeDown:"Volume Down",VolumeMute:"Volume Mute",VolumeUp:"Volume Up",WakeUp:"Wake Up"};u={AZERTY:{KeyA:"Q",KeyQ:"A",KeyW:"Z",KeyZ:"W",Backquote:"²",BracketLeft:"«",BracketRight:"»"},JCUKEN:{KeyA:"Ф",KeyB:"И",KeyC:"С",KeyD:"В",KeyE:"У",KeyF:"А",KeyG:"П",KeyH:"Р",KeyI:"Ш",KeyJ:"О",KeyK:"Л",KeyL:"Д",KeyM:"Ь",KeyN:"Т",KeyO:"Щ",KeyP:"З",KeyQ:"Й",KeyR:"К",KeyS:"Ы",KeyT:"Е",KeyU:"Г",KeyV:"М",KeyW:"Ц",KeyX:"Ч",KeyY:"Н",KeyZ:"Я",Backquote:"Ё",BracketLeft:"х",BracketRight:"ъ",Comma:"Б",Period:"Ю",Quote:"Э",Semicolon:"Ж",Slash:"И"},QWERTY:e,QWERTZ:{KeyY:"Z",KeyZ:"Y",BracketLeft:"ü",BracketRight:"ö",Slash:"-"}}}return null!==(s=null!==(i=u[t][e])&&void 0!==i?i:u.QWERTY[e])&&void 0!==s?s:e}function getMetaKeyLabel(){var e,t,i,s;const o=navigator,n=null!==(t=null===(e=o.platform)||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:"",a=null!==(s=null===(i=o.userAgent)||void 0===i?void 0:i.toLowerCase())&&void 0!==s?s:"";return n.includes("mac")?"⌘":n.includes("win")||n.includes("linux")?"⊞":a.includes("android")?"Search":a.includes("iphone")||a.includes("ipad")?"⌘":"⊞"}class KeyboardDevice{constructor(){this.type="keyboard",this.id="keyboard",this.meta={},this.lastInteraction=performance.now(),this.detectLayoutOnKeypress=!0,this.detected=!1,this.options={binds:{"navigate.back":["Escape","Backspace"],"navigate.down":["ArrowDown","KeyS"],"navigate.left":["ArrowLeft","KeyA"],"navigate.right":["ArrowRight","KeyD"],"navigate.trigger":["Enter","Space"],"navigate.up":["ArrowUp","KeyW"]},repeatableBinds:["navigate.down","navigate.left","navigate.right","navigate.up"]},this.key=Object.keys(d).reduce(((e,t)=>(e[t]=!1,e)),{}),this._emitter=new EventEmitter,this._bindEmitter=new EventEmitter,this._deferredKeydown=[],this._layout=inferKeyboardLayoutFromLang(),this._layoutSource="lang",function requestKeyboardLayout(){return __awaiter(this,void 0,void 0,(function*(){const e=navigator;if(e.keyboard&&e.keyboard.getLayoutMap)try{const t=yield e.keyboard.getLayoutMap();c=t;const i=t.get("KeyQ"),s=t.get("KeyA"),o=t.get("KeyZ");if("a"===i&&"w"===o&&"q"===s)return"AZERTY";if("q"===i&&"y"===o&&"a"===s)return"QWERTZ";if("q"===i&&"z"===o&&"a"===s)return"QWERTY";if("й"===i&&"я"===o&&"ф"===s)return"JCUKEN"}catch(e){}}))}().then((e=>{void 0!==e&&(this._layoutSource="browser",this._layout=e,this.detectLayoutOnKeypress=!1,this._emitter.emit("layoutdetected",{layoutSource:"browser",layout:e,device:this}))})),this._configureEventListeners()}get layout(){return this._layout}set layout(e){this._layoutSource="manual",this._layout=e,this.detectLayoutOnKeypress=!1}get layoutSource(){return this._layoutSource}pressedBind(e){return void 0!==this.options.binds[e]&&this.pressedAny(this.options.binds[e])}pressedAny(e){for(let t=0;t<e.length;t++)if(this.key[e[t]])return!0;return!1}pressedAll(e){for(let t=0;t<e.length;t++)if(!this.key[e[t]])return!1;return!0}configureBinds(e){this.options.binds=Object.assign(Object.assign({},this.options.binds),e)}on(e,t){return this._emitter.on(e,t),this}off(e,t){return this._emitter.off(e,t),this}onBind(e,t){return this._bindEmitter.on(e,t),this}offBind(e,t){return this._bindEmitter.off(e,t),this}getKeyLabel(e,t){var i;return t?getLayoutKeyLabel(e,t):null!==(i=function getNavigatorKeyLabel(e){const t=null==c?void 0:c.get(e);return void 0===t?void 0:function _toLocaleTitleCase(e){return e.split(/\s+/).map((e=>e.charAt(0).toLocaleUpperCase()+e.slice(1))).join(" ")}(t)}(e))&&void 0!==i?i:getLayoutKeyLabel(e,null!=t?t:this._layout)}update(e){this._deferredKeydown.length>0&&(this._deferredKeydown.forEach((e=>this._processDeferredKeydownEvent(e))),this._deferredKeydown.length=0)}clear(){for(const e of Object.keys(d))this.key[e]=!1}_configureEventListeners(){const e=this.key,t=this._deferredKeydown;window.addEventListener("keydown",(i=>{e[i.code]=!0,t.push(i),this.lastInteraction=performance.now()}),{passive:!0,capture:!0}),window.addEventListener("keyup",(t=>{e[t.code]=!1,this.lastInteraction=performance.now()}),{passive:!0,capture:!0})}_processDeferredKeydownEvent(e){const t=e.code;if(!e.repeat){if(this.detectLayoutOnKeypress&&"lang"===this._layoutSource){const t=function detectKeyboardLayoutFromKeydown(e){const t=e.key.toLowerCase(),i=e.code;return p.test(t)?(v.delete("AZERTY"),v.delete("QWERTY"),v.delete("QWERTZ")):"Backquote"===i&&"²"===t||"BracketLeft"===i&&"«"===t||"BracketRight"===i&&"»"===t||"KeyA"===i&&"q"===t||"KeyQ"===i&&"a"===t||"KeyW"===i&&"z"===t||"KeyZ"===i&&"w"===t?(v.delete("JCUKEN"),v.delete("QWERTY"),v.delete("QWERTZ")):"BracketLeft"===i&&"ü"===t||"BracketRight"===i&&"ö"===t||"KeyY"===i&&"z"===t||"KeyZ"===i&&"y"===t||"Slash"===i&&"-"===t?(v.delete("AZERTY"),v.delete("JCUKEN"),v.delete("QWERTY")):"BracketLeft"===i&&"["===t||"BracketRight"===i&&"]"===t||"KeyZ"===i&&"z"===t?(v.delete("AZERTY"),v.delete("JCUKEN"),v.delete("QWERTZ")):"KeyQ"===i&&"q"===t||"KeyW"===i&&"w"===t?(v.delete("AZERTY"),v.delete("JCUKEN")):"KeyY"===i&&"y"===t?(v.delete("QWERTZ"),v.delete("JCUKEN")):m.test(t)&&v.delete("JCUKEN"),1===v.size?[...v][0]:void 0}(e);void 0!==t&&(this._layout=t,this._layoutSource="keypress",this.detectLayoutOnKeypress=!1,this._emitter.emit("layoutdetected",{layout:t,layoutSource:"keypress",device:this}))}this._emitter.hasListener(t)&&setTimeout((()=>this._emitter.emit(t,{device:this,keyCode:t,keyLabel:this.getKeyLabel(t),event:e})))}Object.entries(this.options.binds).forEach((([i,s])=>{s.includes(t)&&(e.repeat&&!this.options.repeatableBinds.includes(i)||setTimeout((()=>{const s={device:this,keyCode:t,keyLabel:this.getKeyLabel(t),event:e,name:i,repeat:e.repeat};this._bindEmitter.emit(i,s),this._emitter.emit("bind",s)})))}))}}KeyboardDevice.global=new KeyboardDevice;class InputDeviceManager{constructor(){this.isMobile=(()=>{let e=!1;var t;return t=navigator.userAgent||navigator.vendor,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),e})(),this.isTouchCapable=function isTouchCapable(){return"ontouchstart"in window||navigator.maxTouchPoints>0}(),this.options={requireFocus:!0,clearInputInBackground:!0},this._devices=[],this._gamepadDevices=[],this._gamepadDeviceMap=new Map,this._customDevices=[],this._emitter=new EventEmitter,this._bindEmitter=new EventEmitter,this._hasFocus=!1,this.keyboard=KeyboardDevice.global,this.isTouchCapable||this.isMobile?window.addEventListener("keydown",(()=>this.add(this.keyboard)),{once:!0}):this.add(this.keyboard),window.addEventListener("gamepadconnected",(()=>this._pollGamepads(performance.now()))),window.addEventListener("gamepaddisconnected",(e=>this._removeGamepad(e.gamepad.index)))}get devices(){return this._devices}get gamepads(){return this._gamepadDevices}get custom(){return this._customDevices}get lastInteractedDevice(){return this._lastInteractedDevice}on(e,t){return this._emitter.on(e,t),this}off(e,t){return this._emitter.off(e,t),this}onBind(e,t){return(e=Array.isArray(e)?e:[e]).forEach((e=>this._bindEmitter.on(e,t))),this}offBind(e,t){return(e=Array.isArray(e)?e:[e]).forEach((e=>this._bindEmitter.off(e,t))),this}emitBind(e){this._bindEmitter.emit(e.name,e)}add(e){-1===this._devices.indexOf(e)&&(this._devices.push(e),e instanceof KeyboardDevice?(e.detected=!0,e.on("bind",(e=>this.emitBind(e)))):e instanceof GamepadDevice?(this._gamepadDeviceMap.set(e.source.index,e),this._gamepadDevices.push(e),e.on("bind",(e=>this.emitBind(e)))):this._customDevices.push(e),this._emitter.emit("deviceadded",{device:e}))}remove(e){if(!(e instanceof KeyboardDevice||e instanceof GamepadDevice)){const t=this._customDevices.indexOf(e);-1!==t&&this._devices.splice(t,1)}const t=this._devices.indexOf(e);-1!==t&&(this._devices.splice(t,1),this._emitter.emit("deviceremoved",{device:e}))}update(){if(this.options.requireFocus&&!document.hasFocus())return this._hasFocus&&this.options.clearInputInBackground&&this.devices.forEach((e=>{var t;return null===(t=e.clear)||void 0===t?void 0:t.call(e)})),this._hasFocus=!1,this._devices;this._hasFocus=!0;const e=performance.now();return this.keyboard.detected&&this.keyboard.update(e),this._gamepadDevices.length>0&&this._pollGamepads(e),this._customDevices.length>0&&this._customDevices.forEach((t=>t.update(e))),this._updateLastInteracted(),this._devices}_updateLastInteracted(){if(0===this._devices.length)return;let e;if(1===this._devices.length)e=this._devices[0];else for(const t of this._devices)(void 0===e||t.lastInteraction>e.lastInteraction)&&(e=t);this._lastInteractedDevice=e}_pollGamepads(e){if(!document.hasFocus())return this._gamepadDevices;if(void 0===navigator.getGamepads)return this._gamepadDevices;for(const t of navigator.getGamepads())if(null!=t)if(this._gamepadDeviceMap.has(t.index)){this._gamepadDeviceMap.get(t.index).update(t,e)}else{const i=new GamepadDevice(t);this.add(i),i.update(t,e)}return this._gamepadDevices}_removeGamepad(e){const t=this._gamepadDeviceMap.get(e);if(!t)return;const i=this._gamepadDevices.indexOf(t);-1!==i&&this._gamepadDevices.splice(i,1),this.remove(t),this._gamepadDeviceMap.delete(e)}}InputDeviceManager.global=new InputDeviceManager;const f=InputDeviceManager.global;function getAllNavigatables(e,t=[]){var i;for(const s of null!==(i=e.children)&&void 0!==i?i:[])s.isNavigatable?t.push(s):getAllNavigatables(s,t);return t}function getFirstNavigatable(e,t,i,{minimumDistance:s=0}={}){return function chooseFirstNavigatableInDirection(e,t,i,s=0){var o,n,a,r,d,c,u,l,h;const g=e.filter((e=>e.isNavigatable&&null!=e.parent&&isVisible(e))),p=g.find((e=>e===t));if(void 0===p)return g.sort(((e,t)=>t.navigationPriority-e.navigationPriority)),g[0];if(void 0===i&&p)return p;const m=null!=p?p:g[Math.floor(Math.random()*g.length)];if(void 0===p)return null!==(o=e[0])&&void 0!==o?o:m;const v=p.getGlobalPosition(),f=p.getBounds(),y={x:v.x+f.left+f.width/2,y:v.y+f.top+f.height/2},b=g.filter((e=>e!==p)).map((e=>{const t=e.getGlobalPosition(),i=e.getBounds(),s={x:t.x+i.left+i.width/2,y:t.y+i.top+i.height/2};return{element:e,bounds:i,center:s,xDistSqrd:weightedDistSquared(s,y,1,3),yDistSqrd:weightedDistSquared(s,y,3,1)}}));switch(i){case"navigate.up":return null!==(a=null===(n=b.filter((e=>e.center.y<y.y-s)).sort(((e,t)=>e.yDistSqrd-t.yDistSqrd))[0])||void 0===n?void 0:n.element)&&void 0!==a?a:m;case"navigate.left":return null!==(d=null===(r=b.filter((e=>e.center.x<y.x-s)).sort(((e,t)=>e.xDistSqrd-t.xDistSqrd))[0])||void 0===r?void 0:r.element)&&void 0!==d?d:m;case"navigate.right":return null!==(u=null===(c=b.filter((e=>e.center.x>y.x+s)).sort(((e,t)=>e.xDistSqrd-t.xDistSqrd))[0])||void 0===c?void 0:c.element)&&void 0!==u?u:m;case"navigate.down":return null!==(h=null===(l=b.filter((e=>e.center.y>y.y+s)).sort(((e,t)=>e.yDistSqrd-t.yDistSqrd))[0])||void 0===l?void 0:l.element)&&void 0!==h?h:m;default:return p}}(getAllNavigatables(e),t,i,s)}function isChildOf(e,t){for(;null!=e;){if(e===t)return!0;e=e.parent}return!1}function weightedDistSquared(e,t,i,s){const o=t.x-e.x,n=t.y-e.y;return o*o*i+n*n*s}function isVisible(e){for(;null!=e;){if(!e.visible)return!1;e=e.parent}return!0}const y=["navigate.left","navigate.right","navigate.up","navigate.down","navigate.back","navigate.trigger"];class NavigationManager{constructor(){this.options={useFallbackHoverEffect:!0,minimumDirectionDistance:10},this.enabled=!1,this._responders=[]}get focusTarget(){var e,t;return null!==(t=null===(e=this.responders.find((e=>null!=e.focusTarget&&isVisible(e.focusTarget))))||void 0===e?void 0:e.focusTarget)&&void 0!==t?t:this._rootFocused}set focusTarget(e){const t=this.focusTarget;if(t===e)return;const i=this.getResponderStage();i&&(!e||e.isNavigatable&&isChildOf(e,i))&&(t&&this._emitBlur(t),e&&this._emitFocus(e),this.firstResponder?this.firstResponder.focusTarget=e:this._rootFocused=e)}get firstResponder(){return this._responders[0]}get responders(){return this._responders}configureWithRoot(e){null==this._root&&f.onBind(y,(e=>this._propagate(e))),this._root=e,this.enabled=!0}popResponder(){var e,t,i,s,o;const n=this.focusTarget,a=this._responders.shift();a.focusTarget=void 0;const r=this.focusTarget;return null===(e=null==a?void 0:a.resignedAsFirstResponder)||void 0===e||e.call(a),this._invalidateFocusedIfNeeded(),this.firstResponder&&(null===(i=(t=this.firstResponder).becameFirstResponder)||void 0===i||i.call(t)),n!==r&&(null!==(o=null===(s=this.firstResponder)||void 0===s?void 0:s.autoFocus)&&void 0!==o?o:void 0===r)&&this.autoFocus(),a}pushResponder(e){var t,i,s;const o=e;if(this._responders.includes(o))throw new Error("Responder already in stack.");const n=this.firstResponder;this._responders.unshift(o),null===(t=null==n?void 0:n.resignedAsFirstResponder)||void 0===t||t.call(n),this._invalidateFocusedIfNeeded(),null===(i=o.becameFirstResponder)||void 0===i||i.call(o),(null===(s=o.autoFocus)||void 0===s||s)&&this.autoFocus()}autoFocus(){if(!b.enabled)return;const e=this.getResponderStage();if(!e)return;const t=getFirstNavigatable(e);void 0!==t?t!==this.focusTarget&&(this.focusTarget=t):console.debug("navigation: no navigatable containers found")}getResponderStage(){var e;return null!==(e=this.responders.find(isContainer))&&void 0!==e?e:this._root}_propagate({device:e,name:t}){var i;if(this.enabled){for(const s of this._responders)if(null===(i=s.handledNavigationIntent)||void 0===i?void 0:i.call(s,t,e))return;if(null==this._root)throw this.enabled=!1,new Error("Navigation requires root responder to be configured");{const e=this.getResponderStage();this._handleGlobalIntent(e,t)}}}_handleGlobalIntent(e,t){var i;this._invalidateFocusedIfNeeded(e);const s=this.focusTarget;if(void 0===s)return void this.autoFocus();if("navigate.back"===t)return this._emitBlur(s),void(this.focusTarget=void 0);if("navigate.trigger"===t)return void this._emitTrigger(s);const o=null!==(i=getFirstNavigatable(e,s,t,{minimumDistance:this.options.minimumDirectionDistance}))&&void 0!==i?i:s;o!==s&&(this.focusTarget=o)}_emitBlur(e){const t=e.eventNames();t.includes("pointerout")?e.emit("pointerout"):t.includes("mouseout")?e.emit("mouseout"):this.options.useFallbackHoverEffect&&(e.alpha=1),e.emit("deviceout")}_emitFocus(e){const t=e.eventNames();t.includes("pointerover")?e.emit("pointerover"):t.includes("mouseover")?e.emit("mouseover"):this.options.useFallbackHoverEffect&&(e.alpha=.5),e.emit("deviceover")}_emitTrigger(e){const t=e.eventNames();t.includes("pointerdown")?e.emit("pointerdown"):t.includes("mousedown")?e.emit("mousedown"):this.options.useFallbackHoverEffect&&(e.alpha=.75),e.emit("devicedown")}_invalidateFocusedIfNeeded(e=this.getResponderStage()){if(!e)return;const t=this.focusTarget;t&&!isChildOf(t,e)&&(this._emitBlur(t),this.focusTarget=void 0)}}function isContainer(e){return"children"in e}NavigationManager.global=new NavigationManager;const b=NavigationManager.global;let K=!1;exports.Button=n,exports.GamepadDevice=GamepadDevice,exports.InputDevice=f,exports.KeyCode=d,exports.KeyboardDevice=KeyboardDevice,exports.UINavigation=b,exports.getAllNavigatables=getAllNavigatables,exports.getFirstNavigatable=getFirstNavigatable,exports.isChildOf=isChildOf,exports.isVisible=isVisible,exports.navigationIntents=y,exports.registerPixiJSNavigationMixin=function registerPixiJSNavigationMixin(e){if(K)return;K=!0;const t=e.prototype;t.navigationPriority=0,t.navigationMode="auto",Object.defineProperty(t,"isNavigatable",{get:function(){if("target"===this.navigationMode)return!0;if("none"===this.navigationMode)return!1;const e=this.eventNames();return e.includes("pointerdown")||e.includes("mousedown")},configurable:!0,enumerable:!1})};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|