eligius 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1407,19 +1407,22 @@ var EngineEventbusAdapter = class {
1407
1407
  };
1408
1408
 
1409
1409
  //#endregion
1410
- //#region src/adapters/engine-input-adapter.ts
1410
+ //#region src/util/keyboard-input-registry.ts
1411
1411
  /**
1412
- * Elements whose own keyboard behaviour (activating a button, typing a
1413
- * space) the play toggle hotkey must not take over.
1412
+ * Shared bookkeeping for the hotkeys-js handlers of the engine play toggle
1413
+ * (`EngineInputAdapter`) and of `KeyboardController`.
1414
+ *
1415
+ * hotkeys-js calls every handler bound to a key, so the handlers of one key
1416
+ * press agree through this registry on who handles it: the one engine that
1417
+ * handles a press while nothing has focus, and whether a KeyboardController
1418
+ * takes a key away from the play toggle of its own engine.
1414
1419
  */
1415
- const interactiveSelector = "button, a[href], input, select, textarea, summary, [contenteditable]:not([contenteditable=\"false\"]), [role=\"button\"], [role=\"link\"]";
1416
- const inputScopes = ["document", "engineRoot"];
1417
1420
  /**
1418
1421
  * Splits a hotkeys-js key description into its comma separated shortcuts,
1419
- * the way hotkeys-js does, lower cased so `'Space'` and `'space'` match.
1422
+ * the way hotkeys-js does.
1420
1423
  */
1421
1424
  function splitShortcuts(key) {
1422
- const keys = key.replace(/\s/g, "").toLowerCase().split(",");
1425
+ const keys = key.replace(/\s/g, "").split(",");
1423
1426
  const last = keys.lastIndexOf("");
1424
1427
  if (last >= 0) {
1425
1428
  keys.splice(last, 1);
@@ -1428,24 +1431,99 @@ function splitShortcuts(key) {
1428
1431
  return keys;
1429
1432
  }
1430
1433
  /**
1431
- * Participants per document. Every adapter binds its own hotkeys-js handler,
1432
- * and hotkeys-js calls all handlers bound to a key, so the handlers of one
1433
- * key press agree through this registry on the one engine that toggles when
1434
- * nothing has focus.
1435
- */
1436
- const playToggleRegistries = /* @__PURE__ */ new Map();
1437
- function createPlayToggleRegistry(doc) {
1434
+ * Names hotkeys-js treats as the same key (they share a key code), mapped to
1435
+ * one of them.
1436
+ */
1437
+ const keyAliases = {
1438
+ "⌫": "backspace",
1439
+ "↩": "enter",
1440
+ return: "enter",
1441
+ escape: "esc",
1442
+ arrowup: "up",
1443
+ arrowdown: "down",
1444
+ arrowleft: "left",
1445
+ arrowright: "right",
1446
+ delete: "del",
1447
+ insert: "ins",
1448
+ "⇪": "capslock",
1449
+ "{": "[",
1450
+ "}": "]",
1451
+ "⇧": "shift",
1452
+ "⌥": "alt",
1453
+ option: "alt",
1454
+ "⌃": "ctrl",
1455
+ control: "ctrl",
1456
+ "⌘": "meta",
1457
+ cmd: "meta",
1458
+ command: "meta"
1459
+ };
1460
+ const canonicalKey = (name) => {
1461
+ const lower = name.toLowerCase();
1462
+ return keyAliases[lower] ?? lower;
1463
+ };
1464
+ /**
1465
+ * Returns one id for every spelling of a shortcut, so `'Space'` and
1466
+ * `'space'`, `'ArrowRight'` and `'right'`, `'cmd+s'` and `'command+s'` match.
1467
+ *
1468
+ * @param shortcut - One shortcut, such as `'shift+right'`
1469
+ */
1470
+ function shortcutId(shortcut) {
1471
+ const parts = shortcut.replace(/\s/g, "").split("+");
1472
+ const key = canonicalKey(parts.pop() ?? "");
1473
+ return [...[...new Set(parts.map(canonicalKey))].sort(), key].join("+");
1474
+ }
1475
+ /**
1476
+ * Returns the first part of a shortcut that hotkeys-js can't match, or
1477
+ * `undefined` when every part is valid. The last part must be a hotkeys-js
1478
+ * key name (case insensitive, which includes the `KeyboardEvent.key` names
1479
+ * of the arrow keys, `Enter`, `Escape`, `Home`, `F1` and so on) or a single
1480
+ * letter or digit. Any parts before it must be modifiers.
1481
+ *
1482
+ * @param shortcut - One shortcut, such as `'shift+right'`
1483
+ */
1484
+ function findInvalidKeyName(shortcut) {
1485
+ const parts = shortcut.split("+");
1486
+ const key = parts.pop() ?? "";
1487
+ const invalidModifier = parts.find((part) => !Object.hasOwn(hotkeys.modifier, part.toLowerCase()));
1488
+ if (invalidModifier !== void 0) return invalidModifier;
1489
+ return Object.hasOwn(hotkeys.keyMap, key.toLowerCase()) || /^[a-z0-9]$/i.test(key) ? void 0 : key;
1490
+ }
1491
+ /**
1492
+ * The shortcut id of a hotkeys-js handler call, falling back to the first
1493
+ * shortcut when hotkeys-js passes no handler info.
1494
+ */
1495
+ function pressedShortcutId(hotkeysEvent, shortcutIds) {
1496
+ return typeof hotkeysEvent?.key === "string" ? shortcutId(hotkeysEvent.key) : shortcutIds[0];
1497
+ }
1498
+ /**
1499
+ * Returns the focused element of a key press, or `undefined` when nothing
1500
+ * has focus: the target is missing, the document, its body or its root
1501
+ * element.
1502
+ */
1503
+ function focusedElement(target) {
1504
+ const element = target;
1505
+ if (!element || typeof element.closest !== "function") return;
1506
+ const { ownerDocument } = element;
1507
+ if (element === ownerDocument?.body || element === ownerDocument?.documentElement) return;
1508
+ return element;
1509
+ }
1510
+ /** Registries per document */
1511
+ const registries = /* @__PURE__ */ new Map();
1512
+ function createRegistry(doc) {
1438
1513
  const registry = {
1439
1514
  participants: /* @__PURE__ */ new Set(),
1440
- lastInteracted: void 0,
1515
+ lastInteractedRoot: void 0,
1441
1516
  removeInteractionListeners: () => {}
1442
1517
  };
1443
1518
  const onInteraction = (event) => {
1444
1519
  const target = event.target;
1445
1520
  if (!target) return;
1446
- for (const candidate of registry.participants) if (candidate.root()?.contains(target)) {
1447
- registry.lastInteracted = candidate;
1448
- return;
1521
+ for (const candidate of registry.participants) {
1522
+ const root = candidate.root();
1523
+ if (root?.contains(target)) {
1524
+ registry.lastInteractedRoot = root;
1525
+ return;
1526
+ }
1449
1527
  }
1450
1528
  };
1451
1529
  const listenerOptions = {
@@ -1467,38 +1545,75 @@ function createPlayToggleRegistry(doc) {
1467
1545
  * @returns A function that removes the participant again, and the registry
1468
1546
  * with its listeners after the last one
1469
1547
  */
1470
- function joinPlayToggleRegistry(doc, participant) {
1471
- let registry = playToggleRegistries.get(doc);
1548
+ function joinKeyboardRegistry(doc, participant) {
1549
+ let registry = registries.get(doc);
1472
1550
  if (!registry) {
1473
- registry = createPlayToggleRegistry(doc);
1474
- playToggleRegistries.set(doc, registry);
1551
+ registry = createRegistry(doc);
1552
+ registries.set(doc, registry);
1475
1553
  }
1476
1554
  const joined = registry;
1477
1555
  joined.participants.add(participant);
1478
1556
  return () => {
1479
1557
  joined.participants.delete(participant);
1480
- if (joined.lastInteracted === participant) joined.lastInteracted = void 0;
1558
+ const root = joined.lastInteractedRoot;
1559
+ if (root && ![...joined.participants].some((p) => p.root() === root)) joined.lastInteractedRoot = void 0;
1481
1560
  if (joined.participants.size === 0) {
1482
1561
  joined.removeInteractionListeners();
1483
- if (playToggleRegistries.get(doc) === joined) playToggleRegistries.delete(doc);
1562
+ if (registries.get(doc) === joined) registries.delete(doc);
1484
1563
  }
1485
1564
  };
1486
1565
  }
1487
1566
  /**
1488
- * The participant that handles a press of `shortcut` made while nothing has
1489
- * focus: among the engines that bind that shortcut and have an active
1490
- * timeline, the one the user last clicked or focused inside, otherwise the
1491
- * first connected one.
1567
+ * The participant whose engine handles a press of the shortcut made while
1568
+ * nothing has focus: among the ready participants that bind the shortcut and
1569
+ * handle unfocused presses, the first one inside the root the user last
1570
+ * clicked or focused inside, otherwise the first connected one.
1571
+ */
1572
+ function electParticipant(registry, id) {
1573
+ const candidates = [...registry.participants].filter((p) => p.unfocused && p.shortcutIds.includes(id) && p.isReady());
1574
+ const { lastInteractedRoot } = registry;
1575
+ return lastInteractedRoot && candidates.find((p) => p.root() === lastInteractedRoot) || candidates[0];
1576
+ }
1577
+ /**
1578
+ * Whether the participant handles this press of the shortcut. A press made
1579
+ * while nothing has focus goes to the participants of one engine root only;
1580
+ * see {@link IKeyboardParticipant.unfocused}.
1581
+ *
1582
+ * @param doc - The document the participant joined, if there is one
1583
+ * @param participant - The participant
1584
+ * @param event - The key press
1585
+ * @param id - The {@link shortcutId} of the pressed shortcut
1492
1586
  */
1493
- function electPlayToggleParticipant(doc, shortcut) {
1494
- const registry = playToggleRegistries.get(doc);
1495
- if (!registry) return;
1496
- const candidates = [...registry.participants].filter((participant) => participant.shortcuts.includes(shortcut) && participant.isReady());
1497
- const { lastInteracted } = registry;
1498
- if (lastInteracted && candidates.includes(lastInteracted)) return lastInteracted;
1499
- return candidates[0];
1587
+ function handlesKeyPress(doc, participant, event, id) {
1588
+ if (!participant.isReady()) return false;
1589
+ const element = focusedElement(event.target);
1590
+ if (element) return participant.acceptsFocus(element);
1591
+ const registry = doc && registries.get(doc);
1592
+ if (!participant.unfocused || !registry) return false;
1593
+ const elected = electParticipant(registry, id);
1594
+ if (elected === participant) return true;
1595
+ const root = participant.root();
1596
+ return root !== void 0 && elected?.root() === root;
1500
1597
  }
1501
1598
  /**
1599
+ * Whether a KeyboardController of the engine with this root handles this
1600
+ * press of the shortcut, so the play toggle of that engine leaves it alone.
1601
+ */
1602
+ function isClaimedByController(doc, root, event, id) {
1603
+ const registry = doc && registries.get(doc);
1604
+ if (!registry || !root) return false;
1605
+ return [...registry.participants].some((p) => p.kind === "controller" && p.root() === root && p.shortcutIds.includes(id) && handlesKeyPress(doc, p, event, id));
1606
+ }
1607
+
1608
+ //#endregion
1609
+ //#region src/adapters/engine-input-adapter.ts
1610
+ /**
1611
+ * Elements whose own keyboard behaviour (activating a button, typing a
1612
+ * space) the play toggle hotkey must not take over.
1613
+ */
1614
+ const interactiveSelector = "button, a[href], input, select, textarea, summary, [contenteditable]:not([contenteditable=\"false\"]), [role=\"button\"], [role=\"link\"]";
1615
+ const inputScopes = ["document", "engineRoot"];
1616
+ /**
1502
1617
  * Handles external input sources (hotkeys, resize).
1503
1618
  *
1504
1619
  * This adapter:
@@ -1511,7 +1626,9 @@ function electPlayToggleParticipant(doc, shortcut) {
1511
1626
  * When several engines on a page could handle an unfocused press, only
1512
1627
  * one toggles: the engine the user last clicked or focused inside,
1513
1628
  * otherwise the first connected one. With `scope: 'engineRoot'` it only
1514
- * handles presses while the focus is inside the engine root.
1629
+ * handles presses while the focus is inside the engine root. A press that
1630
+ * a KeyboardController of the same engine handles is left to that
1631
+ * controller.
1515
1632
  * - Handles window resize events with debouncing, unless `resize` is
1516
1633
  * `false`.
1517
1634
  */
@@ -1569,27 +1686,23 @@ var EngineInputAdapter = class {
1569
1686
  _registerHotkeys() {
1570
1687
  const key = this._playToggleHotkey;
1571
1688
  if (key === false) return;
1572
- const shortcuts = splitShortcuts(key);
1573
1689
  const doc = this._document();
1574
- let participant;
1575
- if (this._scope === "document" && doc) {
1576
- participant = {
1577
- shortcuts,
1578
- isReady: () => this._engine.duration !== void 0,
1579
- root: () => this._root()
1580
- };
1581
- this._removers.push(joinPlayToggleRegistry(doc, participant));
1582
- }
1583
- const handler = (keyboardEvent, hotkeysEvent) => this._handlePlayToggle(keyboardEvent, hotkeysEvent, shortcuts, doc, participant);
1690
+ const participant = {
1691
+ kind: "playToggle",
1692
+ shortcutIds: splitShortcuts(key).map(shortcutId),
1693
+ unfocused: this._scope === "document",
1694
+ isReady: () => this._engine.duration !== void 0,
1695
+ root: () => this._root(),
1696
+ acceptsFocus: (element) => !element.closest(interactiveSelector) && (this._root()?.contains(element) ?? false)
1697
+ };
1698
+ if (doc) this._removers.push(joinKeyboardRegistry(doc, participant));
1699
+ const handler = (keyboardEvent, hotkeysEvent) => this._handlePlayToggle(keyboardEvent, hotkeysEvent, doc, participant);
1584
1700
  hotkeys(key, { scope: "all" }, handler);
1585
1701
  this._removers.push(() => hotkeys.unbind(key, "all", handler));
1586
1702
  }
1587
- _handlePlayToggle(keyboardEvent, hotkeysEvent, shortcuts, doc, participant) {
1588
- if (this._engine.duration === void 0) return;
1589
- const focus = this._focusLocation(keyboardEvent.target);
1590
- let handles = focus === "engineRoot";
1591
- if (focus === "none" && participant && doc) handles = electPlayToggleParticipant(doc, typeof hotkeysEvent?.key === "string" ? hotkeysEvent.key.replace(/\s/g, "").toLowerCase() : shortcuts[0]) === participant;
1592
- if (!handles) return;
1703
+ _handlePlayToggle(keyboardEvent, hotkeysEvent, doc, participant) {
1704
+ const id = pressedShortcutId(hotkeysEvent, participant.shortcutIds);
1705
+ if (!handlesKeyPress(doc, participant, keyboardEvent, id) || isClaimedByController(doc, this._root(), keyboardEvent, id)) return;
1593
1706
  keyboardEvent.preventDefault();
1594
1707
  if (this._engine.playState === "playing") this._engine.pause();
1595
1708
  else this._engine.start()?.catch((error) => {
@@ -1597,19 +1710,6 @@ var EngineInputAdapter = class {
1597
1710
  });
1598
1711
  return false;
1599
1712
  }
1600
- /**
1601
- * Where the focus is for a key press with this target: nowhere (the
1602
- * target is missing, the document or its body), on an interactive
1603
- * element, inside the engine root, or elsewhere on the page.
1604
- */
1605
- _focusLocation(target) {
1606
- const element = target;
1607
- if (!element || typeof element.closest !== "function") return "none";
1608
- const { ownerDocument } = element;
1609
- if (element === ownerDocument?.body || element === ownerDocument?.documentElement) return "none";
1610
- if (element.closest(interactiveSelector)) return "interactive";
1611
- return this._root()?.contains(element) ? "engineRoot" : "elsewhere";
1612
- }
1613
1713
  _root() {
1614
1714
  return this._engine.engineRoot?.[0];
1615
1715
  }
@@ -7325,7 +7425,8 @@ var ActionCreatorFactory = class {
7325
7425
  *
7326
7426
  * @param name
7327
7427
  * @param eventName the event that starts the action. Without it the action can
7328
- * only be started by name (for example by a `DOMEventListenerController`).
7428
+ * only be started by name (for example by a `DOMEventListenerController` or
7429
+ * `KeyboardController`).
7329
7430
  * @param eventTopic optional topic of the event
7330
7431
  * @returns
7331
7432
  */
@@ -8488,7 +8589,8 @@ var ConfigurationFactory = class ConfigurationFactory {
8488
8589
  *
8489
8590
  * @param name
8490
8591
  * @param eventName the event that starts the action. Without it the action can
8491
- * only be started by name (for example by a `DOMEventListenerController`).
8592
+ * only be started by name (for example by a `DOMEventListenerController` or
8593
+ * `KeyboardController`).
8492
8594
  * @param eventTopic optional topic of the event
8493
8595
  * @returns
8494
8596
  *
@@ -8677,7 +8779,9 @@ executes the given actions with the given operation data.
8677
8779
  By default the \`start\` operations of the specified actions are executed. To execute the \`end\` operations instead,
8678
8780
  prefix the action name with \`end:\`.
8679
8781
 
8680
- The actions run in order, each receiving the operation data the previous one returned. When an action fails, the
8782
+ The actions receive a copy of \`actionOperationData\` plus \`eventTarget\` (the event's target) and, for key events,
8783
+ \`eventKey\` (the \`KeyboardEvent.key\`). They run in order, each receiving the operation data the previous one
8784
+ returned. When an action fails, the
8681
8785
  remaining actions are skipped and the failure is reported through the eventbus's \`reportError\` (an error naming
8682
8786
  this controller, the action and the DOM event, with the original error as \`cause\`), or logged with
8683
8787
  \`console.error\` when the eventbus has no \`reportError\`.`,
@@ -8696,6 +8800,49 @@ this controller, the action and the DOM event, with the original error as \`caus
8696
8800
  };
8697
8801
  }
8698
8802
 
8803
+ //#endregion
8804
+ //#region src/controllers/metadata/keyboard-controller.ts
8805
+ function KeyboardController$1() {
8806
+ return {
8807
+ description: `This controller runs the given actions when one of the given keys is pressed.
8808
+
8809
+ By default the \`start\` operations of the specified actions are executed. To execute the \`end\` operations instead,
8810
+ prefix the action name with \`end:\`.
8811
+
8812
+ The actions receive a copy of \`actionOperationData\` plus \`eventTarget\` (the focused element, or the body when
8813
+ nothing has focus) and \`eventKey\` (the \`KeyboardEvent.key\`). They run in order, each receiving the operation data
8814
+ the previous one returned. When an action fails, the remaining actions are skipped and the failure is reported
8815
+ through the eventbus's \`reportError\`, or logged with \`console.error\` when the eventbus has no \`reportError\`.
8816
+
8817
+ With \`scope: 'document'\` (the default) the keys work while the focus is inside the engine root, or while nothing
8818
+ has focus. With \`scope: 'element'\` they only work while the focus is inside the selected element. Presses in
8819
+ \`input\`, \`select\`, \`textarea\` and contenteditable elements are ignored, so typing keeps working. A handled press
8820
+ has its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not
8821
+ again for every key repeat.
8822
+
8823
+ When the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's
8824
+ KeyboardStepSource binds (the arrow keys, \`shift+left\`/\`shift+right\`, \`home\` and \`end\`), the controller wins: a
8825
+ press it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for
8826
+ example outside the selected element with \`scope: 'element'\`) still does.
8827
+
8828
+ The keys are bound in the hotkeys-js \`'all'\` scope, so they work whatever scope a KeyboardStepSource sets. The
8829
+ hotkeys-js global \`filter\` still applies. Detaching removes only this controller's handler.`,
8830
+ dependentProperties: ["selectedElement"],
8831
+ properties: {
8832
+ keys: {
8833
+ type: "ParameterType:string",
8834
+ required: true
8835
+ },
8836
+ actions: {
8837
+ type: "ParameterType:array",
8838
+ itemType: "ParameterType:string"
8839
+ },
8840
+ actionOperationData: { type: "ParameterType:object" },
8841
+ scope: { type: [{ value: "document" }, { value: "element" }] }
8842
+ }
8843
+ };
8844
+ }
8845
+
8699
8846
  //#endregion
8700
8847
  //#region src/controllers/metadata/label-controller.ts
8701
8848
  function LabelController$1() {
@@ -8853,6 +9000,7 @@ Subtitle texts may contain simple inline markup. They are passed through
8853
9000
  //#region src/controllers/metadata/index.ts
8854
9001
  var metadata_exports = /* @__PURE__ */ __exportAll({
8855
9002
  DOMEventListenerController: () => DOMEventListenerController$1,
9003
+ KeyboardController: () => KeyboardController$1,
8856
9004
  LabelController: () => LabelController$1,
8857
9005
  LottieController: () => LottieController$1,
8858
9006
  MutationObserverController: () => MutationObserverController$1,
@@ -9178,6 +9326,9 @@ function isObject(value) {
9178
9326
  * names a `systemName` the importer does not provide, or leaves out a setting that the provider
9179
9327
  * requires (for example `selector` of `ScrollPositionSource`) once it is merged over the type's
9180
9328
  * settings.
9329
+ * @throws When a VideoPositionSource has an 'options' key, at timelineProviderSettings.<type>.positionSource
9330
+ * or at a timeline's positionSource override (also when the override inherits VideoPositionSource from its
9331
+ * type). 4.0.0 removed the video.js player options.
9181
9332
  * @throws When a `template:`, `json:` or `config:` placeholder cannot be resolved.
9182
9333
  */
9183
9334
  var ConfigurationResolver = class {
@@ -9246,12 +9397,14 @@ function assertArray(value, path) {
9246
9397
  */
9247
9398
  function assertTimelineProviderSettings(configuration, importer) {
9248
9399
  const settings = configuration.timelineProviderSettings ?? {};
9400
+ for (const [type, typeSettings] of Object.entries(settings)) if (isObject(typeSettings) && isObject(typeSettings.positionSource)) assertNoVideoOptions(typeSettings.positionSource, typeSettings.positionSource.systemName, `timelineProviderSettings.${type}.positionSource`);
9249
9401
  configuration.timelines.forEach((timeline, index) => {
9250
9402
  const path = `timelines[${index}]`;
9251
9403
  const { type } = timeline;
9252
9404
  const typeSettings = Object.hasOwn(settings, type) && isObject(settings[type]) ? settings[type] : void 0;
9253
9405
  assertProviderOverride(timeline.positionSource, `${path}.positionSource`, "position source", importer);
9254
9406
  assertProviderOverride(timeline.containerProvider, `${path}.containerProvider`, "container provider", importer);
9407
+ if (isObject(timeline.positionSource)) assertNoVideoOptions(timeline.positionSource, effectivePositionSource(timeline, typeSettings)?.systemName, `${path}.positionSource`);
9255
9408
  if (!typeSettings && !isString(timeline.positionSource?.systemName)) throw new Error(`Missing timeline provider settings at timelineProviderSettings.${type} for ${path} (type '${type}'). Add a provider for the '${type}' timeline type, or give ${path}.positionSource a systemName of its own.`);
9256
9409
  if (isDefined(timeline.positionSource)) assertMergedProviderSettings(effectivePositionSource(timeline, typeSettings), `${path}.positionSource`, `timelineProviderSettings.${type}.positionSource`, "position source");
9257
9410
  if (isDefined(timeline.containerProvider)) assertMergedProviderSettings(effectiveContainerProvider(timeline, typeSettings), `${path}.containerProvider`, `timelineProviderSettings.${type}.container`, "container provider");
@@ -9274,6 +9427,21 @@ const REQUIRED_PROVIDER_SETTINGS = {
9274
9427
  DomContainerProvider: ["selector"]
9275
9428
  };
9276
9429
  /**
9430
+ * VideoPositionSource took video.js player options under `options` until
9431
+ * 4.0.0 removed video.js. Other position sources may still take an
9432
+ * `options` key, so only the effective system name `VideoPositionSource` is
9433
+ * checked.
9434
+ *
9435
+ * @param positionSource - The settings object as written in the configuration
9436
+ * @param systemName - The effective system name (inherited for overrides without one)
9437
+ * @param path - JSON path of `positionSource`
9438
+ * @throws When a VideoPositionSource has an `options` key
9439
+ */
9440
+ function assertNoVideoOptions(positionSource, systemName, path) {
9441
+ if (systemName !== "VideoPositionSource" || !Object.hasOwn(positionSource, "options")) return;
9442
+ throw new Error(`Invalid configuration at ${path}.options: VideoPositionSource no longer accepts 'options' (the video.js player options were removed in 4.0.0). Put 'sources' and 'poster' directly in ${path} and delete 'options'. See the 4.0.0 migration steps in CHANGELOG.md.`);
9443
+ }
9444
+ /**
9277
9445
  * Checks the shape of a per-timeline provider override and that its
9278
9446
  * `systemName`, when given, is provided by the importer.
9279
9447
  */
@@ -9308,11 +9476,7 @@ function assertMergedProviderSettings(merged, path, typePath, kind) {
9308
9476
  for (const key of required) if (!hasRequiredSetting(merged, key)) throw new Error(`Missing setting at ${path}.${key}: '${systemName}' requires '${key}', and neither ${path} nor ${typePath} provides it.`);
9309
9477
  }
9310
9478
  function hasRequiredSetting(settings, key) {
9311
- if (key === "sources") {
9312
- const options = settings.options;
9313
- const fromOptions = isObject(options) ? options.sources : void 0;
9314
- return isNonEmptyArray(settings.sources) || isNonEmptyArray(fromOptions);
9315
- }
9479
+ if (key === "sources") return isNonEmptyArray(settings.sources);
9316
9480
  const value = settings[key];
9317
9481
  return isString(value) ? value.length > 0 : isDefined(value);
9318
9482
  }
@@ -9530,6 +9694,76 @@ function resolveConfigPlaceholder(placeholder, rootConfig, path, visited = /* @_
9530
9694
  return value;
9531
9695
  }
9532
9696
 
9697
+ //#endregion
9698
+ //#region src/controllers/helper/controller-actions.ts
9699
+ /**
9700
+ * Splits off the `end:` prefix of an action name.
9701
+ *
9702
+ * @returns Whether the `start` operations run, and the action name
9703
+ */
9704
+ function parseActionName(actionName) {
9705
+ return actionName.startsWith("end:") ? [false, actionName.substring(4)] : [true, actionName];
9706
+ }
9707
+ /**
9708
+ * Looks up the actions by name. A name prefixed with `end:` runs the `end`
9709
+ * operations of the action instead of its `start` operations.
9710
+ *
9711
+ * @param eventbus - The eventbus to request the actions from
9712
+ * @param actionNames - The action names, optionally prefixed with `end:`
9713
+ * @param controllerName - The controller, named in error messages
9714
+ * @param trigger - What runs the actions, named in error messages
9715
+ * @returns The actions in the given order
9716
+ * @throws when an action name is unknown (`request-action` throws or
9717
+ * returns nothing); the message names the controller, the action and the
9718
+ * trigger, and keeps the responder's "did you mean" hint
9719
+ */
9720
+ function requestControllerActions(eventbus, actionNames, controllerName, trigger) {
9721
+ return actionNames.map((actionName) => {
9722
+ const [start, name] = parseActionName(actionName);
9723
+ const unknown = `${controllerName}: unknown action "${name}" for ${trigger.kind} "${trigger.name}"`;
9724
+ let action;
9725
+ try {
9726
+ action = eventbus.request("request-action", name);
9727
+ } catch (error) {
9728
+ const reason = error instanceof Error ? error.message : String(error);
9729
+ throw new Error(`${unknown}. ${reason}`, { cause: error });
9730
+ }
9731
+ if (!action) throw new Error(unknown);
9732
+ return {
9733
+ start,
9734
+ action
9735
+ };
9736
+ });
9737
+ }
9738
+ /**
9739
+ * Runs the actions one after another, merging each action's result into the
9740
+ * operation data for the next. A failing action stops the chain, since later
9741
+ * actions consume the earlier actions' output. The failure is reported
9742
+ * through the eventbus's `reportError` (an error naming the controller, the
9743
+ * action, the phase and the trigger, with the original error as `cause`), or
9744
+ * logged with `console.error` when the eventbus has no `reportError`. The
9745
+ * operation data is never logged.
9746
+ *
9747
+ * Never rejects, so an input handler leaves no floating rejection behind.
9748
+ *
9749
+ * @param actions - The actions to run
9750
+ * @param operationData - The operation data for the first action
9751
+ * @param controllerName - The controller, named in error messages
9752
+ * @param trigger - What runs the actions, named in error messages
9753
+ * @param eventbus - The eventbus to report failures through
9754
+ */
9755
+ async function runControllerActions(actions, operationData, controllerName, trigger, eventbus) {
9756
+ for (const { start, action } of actions) try {
9757
+ const resultOperationData = start ? await action.start(operationData) : await action.end(operationData);
9758
+ Object.assign(operationData, resultOperationData);
9759
+ } catch (error) {
9760
+ const message = `${controllerName}: action '${action.name}' (${start ? "start" : "end"}) failed for ${trigger.kind} '${trigger.name}'`;
9761
+ if (eventbus && typeof eventbus.reportError === "function") eventbus.reportError(new Error(message, { cause: error }), { source: controllerName });
9762
+ else console.error(message, error);
9763
+ return;
9764
+ }
9765
+ }
9766
+
9533
9767
  //#endregion
9534
9768
  //#region src/controllers/dom-event-listener-controller.ts
9535
9769
  /**
@@ -9539,7 +9773,9 @@ function resolveConfigPlaceholder(placeholder, rootConfig, path, visited = /* @_
9539
9773
  * By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
9540
9774
  * prefix the action name with `end:`.
9541
9775
  *
9542
- * The actions run in order, each receiving the operation data the previous one returned. When an action fails, the
9776
+ * The actions receive a copy of `actionOperationData` plus `eventTarget` (the event's target) and, for key events,
9777
+ * `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data the previous one
9778
+ * returned. When an action fails, the
9543
9779
  * remaining actions are skipped and the failure is reported through the eventbus's `reportError` (an error naming
9544
9780
  * this controller, the action and the DOM event, with the original error as `cause`), or logged with
9545
9781
  * `console.error` when the eventbus has no `reportError`.
@@ -9571,76 +9807,177 @@ var DOMEventListenerController = class {
9571
9807
  if (!this.operationData) return;
9572
9808
  const { selectedElement, actions, eventName } = this.operationData;
9573
9809
  if (!this.actionInstanceInfos) {
9574
- const actionInstanceInfos = actions.map((actionName) => {
9575
- const [isStart, name] = this._isStartAction(actionName);
9576
- let actionInstance;
9577
- try {
9578
- actionInstance = eventbus.request("request-action", name);
9579
- } catch (error) {
9580
- const reason = error instanceof Error ? error.message : String(error);
9581
- throw new Error(`${this.name}: unknown action "${name}" for DOM event "${eventName}". ${reason}`, { cause: error });
9582
- }
9583
- if (!actionInstance) throw new Error(`${this.name}: unknown action "${name}" for DOM event "${eventName}"`);
9584
- return {
9585
- start: isStart,
9586
- action: actionInstance
9587
- };
9810
+ this.actionInstanceInfos = requestControllerActions(eventbus, actions, this.name, {
9811
+ kind: "DOM event",
9812
+ name: eventName
9588
9813
  });
9589
- this.actionInstanceInfos = actionInstanceInfos;
9590
9814
  this._eventbus = eventbus;
9591
9815
  this._boundEventHandler = this._eventHandler.bind(this);
9592
9816
  selectedElement.on(eventName, this._boundEventHandler);
9593
9817
  }
9594
9818
  }
9595
- _isStartAction(actionName) {
9596
- if (actionName.substring(0, 4) === "end:") return [false, actionName.substring(4)];
9597
- else return [true, actionName];
9598
- }
9599
9819
  _eventHandler(event) {
9600
9820
  if (!this.operationData || !this.actionInstanceInfos) return;
9601
9821
  const actionOperationData = this.operationData.actionOperationData ? deepCopy(this.operationData.actionOperationData) : {};
9602
9822
  if (event?.target) actionOperationData.eventTarget = event.target;
9603
- this._executeActions(this.actionInstanceInfos, actionOperationData, this.operationData.eventName);
9823
+ if (typeof event?.key === "string") actionOperationData.eventKey = event.key;
9824
+ runControllerActions(this.actionInstanceInfos, actionOperationData, this.name, {
9825
+ kind: "DOM event",
9826
+ name: this.operationData.eventName
9827
+ }, this._eventbus);
9604
9828
  }
9605
9829
  /**
9606
- * Runs the actions one after another, merging each action's result into the
9607
- * operation data for the next. A failing action stops the chain, since later
9608
- * actions consume the earlier actions' output, and is reported with an error
9609
- * naming this controller, the action, the phase and the DOM event (see
9610
- * `_reportFailure`). The operation data is never logged.
9830
+ * Removes only the handler this controller registered, so other handlers for
9831
+ * the same event on the element keep working, and resets the action
9832
+ * instances so a later attach registers again.
9611
9833
  */
9612
- async _executeActions(actions, operationData, eventName) {
9613
- for (const { start, action } of actions) try {
9614
- const resultOperationData = start ? await action.start(operationData) : await action.end(operationData);
9615
- Object.assign(operationData, resultOperationData);
9616
- } catch (error) {
9617
- this._reportFailure(`${this.name}: action '${action.name}' (${start ? "start" : "end"}) failed for DOM event '${eventName}'`, error);
9618
- return;
9619
- }
9834
+ detach(_eventbus) {
9835
+ if (this.operationData && this._boundEventHandler) this.operationData.selectedElement.off(this.operationData.eventName, this._boundEventHandler);
9836
+ this._boundEventHandler = null;
9837
+ this._eventbus = null;
9838
+ this.actionInstanceInfos = void 0;
9620
9839
  }
9840
+ };
9841
+
9842
+ //#endregion
9843
+ //#region src/controllers/keyboard-controller.ts
9844
+ /**
9845
+ * Elements where a key press types, so it is left to the element.
9846
+ */
9847
+ const editableSelector = "input, select, textarea, [contenteditable]:not([contenteditable=\"false\"])";
9848
+ const scopes = ["document", "element"];
9849
+ /**
9850
+ * This controller runs the given actions when one of the given keys is pressed.
9851
+ *
9852
+ * By default the `start` operations of the specified actions are executed. To execute the `end` operations instead,
9853
+ * prefix the action name with `end:`.
9854
+ *
9855
+ * The actions receive a copy of `actionOperationData` plus `eventTarget` (the focused element, or the body when
9856
+ * nothing has focus) and `eventKey` (the `KeyboardEvent.key`). They run in order, each receiving the operation data
9857
+ * the previous one returned. When an action fails, the remaining actions are skipped and the failure is reported
9858
+ * through the eventbus's `reportError`, or logged with `console.error` when the eventbus has no `reportError`.
9859
+ *
9860
+ * With `scope: 'document'` (the default) the keys work while the focus is inside the engine root, or while nothing
9861
+ * has focus. With `scope: 'element'` they only work while the focus is inside the selected element. Presses in
9862
+ * `input`, `select`, `textarea` and contenteditable elements are ignored, so typing keeps working. A handled press
9863
+ * has its default action prevented (no scrolling for arrow keys and space); a held key runs the actions once, not
9864
+ * again for every key repeat.
9865
+ *
9866
+ * When the keys include the play toggle hotkey of the engine (space by default), or a key that the engine's
9867
+ * KeyboardStepSource binds (the arrow keys, `shift+left`/`shift+right`, `home` and `end`), the controller wins: a
9868
+ * press it handles runs its actions and does not toggle playback or step the timeline. A press it ignores (for
9869
+ * example outside the selected element with `scope: 'element'`) still does.
9870
+ *
9871
+ * The keys are bound in the hotkeys-js `'all'` scope, so they work whatever scope a KeyboardStepSource sets. The
9872
+ * hotkeys-js global `filter` still applies. Detaching removes only this controller's handler.
9873
+ *
9874
+ * @example
9875
+ * ```json
9876
+ * {"systemName": "addControllerToElement", "operationData": {"keys": "ArrowRight", "actions": ["NextChapter"]}}
9877
+ * ```
9878
+ */
9879
+ var KeyboardController = class {
9880
+ operationData;
9881
+ actionInstanceInfos;
9882
+ name = "KeyboardController";
9883
+ _handler = null;
9884
+ _leaveRegistry = null;
9885
+ /** The eventbus passed to attach(), used to report failing actions */
9886
+ _eventbus = null;
9621
9887
  /**
9622
- * Reports through the eventbus's `reportError` when it has one, so the
9623
- * application's `onHandlerError` sees it; otherwise logs it.
9888
+ * @param operationData - The keys, actions and scope
9889
+ * @throws when `keys` is empty or names a key hotkeys-js can't match, or
9890
+ * when `scope` is not `'document'` or `'element'`
9624
9891
  */
9625
- _reportFailure(message, error) {
9626
- const eventbus = this._eventbus;
9627
- if (eventbus && typeof eventbus.reportError === "function") {
9628
- eventbus.reportError(new Error(message, { cause: error }), { source: this.name });
9629
- return;
9630
- }
9631
- console.error(message, error);
9892
+ init(operationData) {
9893
+ const scope = operationData.scope ?? "document";
9894
+ if (!scopes.includes(scope)) throw new Error(`${this.name}: unknown scope '${String(scope)}'. Use 'document' or 'element'.`);
9895
+ this.operationData = {
9896
+ selectedElement: operationData.selectedElement,
9897
+ keys: this._normalizeKeys(operationData.keys),
9898
+ actions: operationData.actions.slice(),
9899
+ actionOperationData: deepCopy(operationData.actionOperationData),
9900
+ scope
9901
+ };
9632
9902
  }
9633
9903
  /**
9634
- * Removes only the handler this controller registered, so other handlers for
9635
- * the same event on the element keep working, and resets the action
9636
- * instances so a later attach registers again.
9904
+ * Looks up the configured actions and starts listening for the keys.
9905
+ *
9906
+ * @param eventbus - The eventbus to request the actions and the engine root
9907
+ * from
9908
+ * @throws when an action name is unknown (`request-action` throws or
9909
+ * returns nothing); the message names the controller, the action and the
9910
+ * keys, and keeps the responder's "did you mean" hint
9911
+ */
9912
+ attach(eventbus) {
9913
+ if (!this.operationData || this.actionInstanceInfos) return;
9914
+ const { selectedElement, keys, actions, scope } = this.operationData;
9915
+ this.actionInstanceInfos = requestControllerActions(eventbus, actions, this.name, this._trigger());
9916
+ this._eventbus = eventbus;
9917
+ const element = selectedElement[0];
9918
+ const root = this._requestEngineRoot(eventbus) ?? element;
9919
+ const container = scope === "element" ? element : root;
9920
+ const doc = element?.ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
9921
+ const participant = {
9922
+ kind: "controller",
9923
+ shortcutIds: splitShortcuts(keys).map(shortcutId),
9924
+ unfocused: scope === "document",
9925
+ isReady: () => true,
9926
+ root: () => root,
9927
+ acceptsFocus: (focused) => !focused.closest(editableSelector) && (container?.contains(focused) ?? false)
9928
+ };
9929
+ if (doc) this._leaveRegistry = joinKeyboardRegistry(doc, participant);
9930
+ const handler = (event, hotkeysEvent) => this._handleKey(event, hotkeysEvent, doc, participant);
9931
+ hotkeys(keys, { scope: "all" }, handler);
9932
+ this._handler = handler;
9933
+ }
9934
+ /**
9935
+ * Removes only the handler this controller bound, so other bindings of the
9936
+ * same keys keep working, and resets the action instances so a later
9937
+ * attach binds again.
9637
9938
  */
9638
9939
  detach(_eventbus) {
9639
- if (this.operationData && this._boundEventHandler) this.operationData.selectedElement.off(this.operationData.eventName, this._boundEventHandler);
9640
- this._boundEventHandler = null;
9940
+ if (this.operationData && this._handler) hotkeys.unbind(this.operationData.keys, "all", this._handler);
9941
+ this._leaveRegistry?.();
9942
+ this._leaveRegistry = null;
9943
+ this._handler = null;
9641
9944
  this._eventbus = null;
9642
9945
  this.actionInstanceInfos = void 0;
9643
9946
  }
9947
+ _handleKey(event, hotkeysEvent, doc, participant) {
9948
+ if (!this.operationData || !this.actionInstanceInfos) return;
9949
+ const id = pressedShortcutId(hotkeysEvent, participant.shortcutIds);
9950
+ if (!handlesKeyPress(doc, participant, event, id)) return;
9951
+ event.preventDefault();
9952
+ if (event.repeat) return;
9953
+ const actionOperationData = this.operationData.actionOperationData ? deepCopy(this.operationData.actionOperationData) : {};
9954
+ actionOperationData.eventTarget = event.target;
9955
+ actionOperationData.eventKey = event.key;
9956
+ runControllerActions(this.actionInstanceInfos, actionOperationData, this.name, this._trigger(), this._eventbus);
9957
+ }
9958
+ _trigger() {
9959
+ return {
9960
+ kind: "key",
9961
+ name: this.operationData?.keys ?? ""
9962
+ };
9963
+ }
9964
+ _requestEngineRoot(eventbus) {
9965
+ const root = eventbus.request("request-engine-root")?.[0];
9966
+ return root && typeof root.contains === "function" ? root : void 0;
9967
+ }
9968
+ /**
9969
+ * @returns The keys with `' '` replaced by `space`
9970
+ * @throws when the keys are empty or name a key hotkeys-js can't match
9971
+ */
9972
+ _normalizeKeys(keys) {
9973
+ if (typeof keys !== "string" || keys.length === 0) throw new Error(`${this.name}: 'keys' must be a non-empty string of hotkeys-js shortcuts, such as 'right' or 'shift+right, space'.`);
9974
+ const normalized = keys.trim() === "" ? "space" : keys;
9975
+ for (const shortcut of splitShortcuts(normalized)) {
9976
+ const invalid = findInvalidKeyName(shortcut);
9977
+ if (invalid !== void 0) throw new Error(`${this.name}: unknown key '${invalid}' in keys '${keys}'. Use hotkeys-js names such as 'right', 'space', 'enter' or 'shift+a', or KeyboardEvent.key names such as 'ArrowRight' or 'Escape'.`);
9978
+ }
9979
+ return normalized;
9980
+ }
9644
9981
  };
9645
9982
 
9646
9983
  //#endregion
@@ -10856,6 +11193,7 @@ var SubtitlesController = class extends BaseController {
10856
11193
  //#region src/controllers/index.ts
10857
11194
  var controllers_exports = /* @__PURE__ */ __exportAll({
10858
11195
  DOMEventListenerController: () => DOMEventListenerController,
11196
+ KeyboardController: () => KeyboardController,
10859
11197
  LabelController: () => LabelController,
10860
11198
  LottieController: () => LottieController,
10861
11199
  MutationObserverController: () => MutationObserverController,
@@ -12148,6 +12486,11 @@ const toMs = (seconds) => Math.round(seconds * 1e3);
12148
12486
  * one on suspend, deactivate and destroy. The source never changes the
12149
12487
  * global hotkeys-js scope.
12150
12488
  *
12489
+ * A key that a KeyboardController of the owning engine handles is left to
12490
+ * that controller: the press runs the controller's actions and does not step
12491
+ * the timeline. The engine tells the source its root through
12492
+ * {@link KeyboardStepSource.setEngineRoot}.
12493
+ *
12151
12494
  * Supports:
12152
12495
  * - Left/Right arrows: step by `stepSize` (default 1s)
12153
12496
  * - Shift+Left/Right: large step by `largeStepSize` (default 10s)
@@ -12183,6 +12526,8 @@ var KeyboardStepSource = class extends BasePositionSource {
12183
12526
  _markers;
12184
12527
  _targetElementConfig;
12185
12528
  _targetElement;
12529
+ /** Returns the root element of the owning engine, see setEngineRoot() */
12530
+ _getEngineRoot;
12186
12531
  /** Handlers currently bound in hotkeys-js, for exact removal. */
12187
12532
  _bindings = [];
12188
12533
  _timelineChangeCallbacks = [];
@@ -12254,6 +12599,19 @@ var KeyboardStepSource = class extends BasePositionSource {
12254
12599
  };
12255
12600
  }
12256
12601
  /**
12602
+ * Tells the source the root element of the engine that owns it, so a key
12603
+ * press that a KeyboardController of that engine handles is left to the
12604
+ * controller instead of stepping the timeline. EligiusEngine calls this
12605
+ * for every source it wires; a source without an engine root handles
12606
+ * every press of its keys.
12607
+ *
12608
+ * @param getRoot - Returns the engine root, or `undefined` before the
12609
+ * engine is initialised
12610
+ */
12611
+ setEngineRoot(getRoot) {
12612
+ this._getEngineRoot = getRoot;
12613
+ }
12614
+ /**
12257
12615
  * Register callback for marker jumps (chapter-navigation mode).
12258
12616
  *
12259
12617
  * @param callback - Called with marker index and position when jumping
@@ -12291,8 +12649,9 @@ var KeyboardStepSource = class extends BasePositionSource {
12291
12649
  * returns false the key keeps its default browser behaviour
12292
12650
  */
12293
12651
  _bind(key, action, handles = () => true) {
12652
+ const id = shortcutId(key);
12294
12653
  const method = (event) => {
12295
- if (this.state !== "active" || !handles()) return;
12654
+ if (this.state !== "active" || !handles() || isClaimedByController(typeof document === "undefined" ? void 0 : document, this._getEngineRoot?.(), event, id)) return;
12296
12655
  event.preventDefault();
12297
12656
  action();
12298
12657
  };
@@ -12850,34 +13209,49 @@ var ScrollPositionSource = class extends BasePositionSource {
12850
13209
 
12851
13210
  //#endregion
12852
13211
  //#region src/timelineproviders/position-sources/video-position-source.ts
12853
- let videojsLoader = null;
13212
+ /** CSS class of the video element the source creates. */
13213
+ const VIDEO_ELEMENT_CLASS = "eligius-video";
13214
+ /** HTMLMediaElement constants, without reading a global of one realm. */
13215
+ const HAVE_NOTHING = 0;
13216
+ const NETWORK_NO_SOURCE = 3;
13217
+ /** Default of {@link VideoPositionSourceConfig.loadTimeout}. */
13218
+ const DEFAULT_LOAD_TIMEOUT_MS = 3e4;
13219
+ const OPTIONS_REMOVED_MESSAGE = "VideoPositionSource: 'options' is no longer supported (the video.js player options were removed in 4.0.0). Put 'sources' and 'poster' directly in the position source settings and delete 'options'.";
13220
+ function isNonEmptyString(value) {
13221
+ return typeof value === "string" && value.length > 0;
13222
+ }
13223
+ function createSourceElement(doc, { src, type }) {
13224
+ const element = doc.createElement("source");
13225
+ element.src = src;
13226
+ if (isNonEmptyString(type)) element.type = type;
13227
+ return element;
13228
+ }
12854
13229
  /**
12855
- * Loads video.js, an optional peer dependency, on first use and caches it.
12856
- * A failed load is not cached, so a later init can try again.
12857
- *
12858
- * @returns the videojs function
12859
- * @throws when video.js cannot be imported
13230
+ * jsdom has no `error` property at all, so read it defensively.
12860
13231
  */
12861
- function loadVideojs() {
12862
- videojsLoader ??= import("video.js").then((module) => {
12863
- const exported = module.default;
12864
- return exported.default ?? exported;
12865
- }, (error) => {
12866
- videojsLoader = null;
12867
- throw new Error("VideoPositionSource requires the optional peer dependency 'video.js'. Install it with: npm install video.js", { cause: error });
12868
- });
12869
- return videojsLoader;
13232
+ function describeMediaError(error) {
13233
+ if (error?.message) return `: ${error.message}`;
13234
+ return error?.code !== void 0 ? `: MediaError code ${error.code}` : "";
12870
13235
  }
12871
13236
  /**
12872
- * Video.js-based position source.
13237
+ * Position source driven by a native HTML `<video>` element.
12873
13238
  *
12874
- * Wraps a video.js player to provide position updates based on video playback.
12875
- * Implements `IPositionSource`, `ISeekable`, and `IContainerProvider`.
13239
+ * `init()` creates `<video id="video-…" class="eligius-video" preload="auto"
13240
+ * playsinline>` with one `<source>` child per playable entry of `sources`,
13241
+ * and appends it to the first element matching `selector`. The element has
13242
+ * no controls and no styling: size it with CSS on `.eligius-video`. Host
13243
+ * code can reach it as `container.querySelector('video.eligius-video')`.
13244
+ *
13245
+ * Only browser-playable media files are supported (video or audio); there
13246
+ * is no HLS or DASH player. `init()` resolves on the first `canplay` and
13247
+ * rejects when no source can be played, on a media error, when no source
13248
+ * becomes playable within `loadTimeout` (30 s by default), when the
13249
+ * container or the sources are missing, when an entry has no `src`, or when
13250
+ * the removed `options` key is present. `getContainer()` returns the
13251
+ * selector's element. Browser autoplay policies may reject `activate()`
13252
+ * with a `NotAllowedError`.
12876
13253
  *
12877
- * video.js is an optional peer dependency. It is loaded with a dynamic
12878
- * `import()` during the first `init()`, so applications that never create a
12879
- * video timeline do not need it installed. `init()` rejects with an error
12880
- * naming the package when it cannot be loaded.
13254
+ * Implements `IPositionSource`, `ISeekable`, and `IContainerProvider`.
12881
13255
  *
12882
13256
  * @example
12883
13257
  * ```typescript
@@ -12904,15 +13278,21 @@ function loadVideojs() {
12904
13278
  */
12905
13279
  var VideoPositionSource = class extends BasePositionSource {
12906
13280
  _config;
12907
- _player = null;
12908
13281
  _videoElementId;
13282
+ _video = null;
13283
+ /** Only the appended (playable) source elements, in document order */
13284
+ _sourceElements = [];
13285
+ _initPromise = null;
13286
+ _pendingInit = null;
13287
+ /** timeupdate, ended, playing and seek listeners */
13288
+ _listeners = /* @__PURE__ */ new Set();
13289
+ /** canplay and the capture-phase error listener of a pending init */
13290
+ _initListeners = /* @__PURE__ */ new Set();
12909
13291
  _containerReadyCallbacks = [];
12910
- _eventHandlers = [];
12911
13292
  _containerReady = false;
12912
- _pendingInit = null;
12913
13293
  _pendingSeeks = /* @__PURE__ */ new Set();
12914
13294
  /**
12915
- * Create a new video.js-based position source.
13295
+ * Create a new video position source.
12916
13296
  *
12917
13297
  * @param config - Configuration options
12918
13298
  */
@@ -12922,93 +13302,73 @@ var VideoPositionSource = class extends BasePositionSource {
12922
13302
  this._videoElementId = `video-${crypto.randomUUID?.() ?? Math.random().toString(36).slice(2)}`;
12923
13303
  }
12924
13304
  doInit() {
12925
- return new Promise((resolve, reject) => {
12926
- if ($(this._config.selector).length === 0) {
12927
- reject(/* @__PURE__ */ new Error(`VideoPositionSource: container not found for selector '${this._config.selector}'`));
12928
- return;
12929
- }
12930
- const sources = this._getSources();
12931
- if (!Array.isArray(sources) || sources.length === 0) {
12932
- reject(/* @__PURE__ */ new Error("VideoPositionSource: 'sources' is required (an array of {src, type})"));
12933
- return;
12934
- }
12935
- const pendingInit = {
12936
- resolve,
12937
- reject
12938
- };
12939
- this._pendingInit = pendingInit;
12940
- this._createVideoElement();
12941
- loadVideojs().then((videojsFactory) => {
12942
- if (this._pendingInit !== pendingInit) return;
12943
- try {
12944
- this._createPlayer(videojsFactory);
12945
- } catch (error) {
12946
- this._settleInit(error);
12947
- }
12948
- }, (error) => {
12949
- if (this._pendingInit === pendingInit) this._settleInit(error);
12950
- });
13305
+ this._initPromise ??= this._load().catch((error) => {
13306
+ this._initPromise = null;
13307
+ throw error;
12951
13308
  });
13309
+ return this._initPromise;
12952
13310
  }
12953
13311
  doDestroy() {
12954
13312
  this._settleInit(/* @__PURE__ */ new Error("VideoPositionSource: destroyed before init completed"));
12955
- const position = this._player?.currentTime() ?? this.getPosition();
12956
- for (const settleSeek of [...this._pendingSeeks]) settleSeek(position);
12957
- for (const removeHandler of this._eventHandlers) removeHandler();
12958
- this._eventHandlers.length = 0;
12959
- if (this._player) {
12960
- this._player.dispose?.();
12961
- this._player = null;
12962
- }
12963
- $(`#${this._videoElementId}`).remove();
13313
+ this._initPromise = null;
13314
+ this._teardown();
13315
+ this._containerReadyCallbacks.length = 0;
12964
13316
  }
12965
13317
  async startTicking() {
12966
- await this._player?.play();
13318
+ await this._video?.play();
12967
13319
  }
12968
13320
  stopTicking() {
12969
- this._player?.pause();
13321
+ this._video?.pause();
12970
13322
  }
12971
13323
  /**
12972
- * Seek to a specific position in the video.
13324
+ * Seek to a specific position in the media.
13325
+ *
13326
+ * Resolves on 'seeked' with the position the media landed on. A seek
13327
+ * that cannot complete also settles, with the media's current time: on a
13328
+ * media 'error' (also at a `<source>`), when the media is reset
13329
+ * ('emptied', for example by a new load), or when the source is
13330
+ * destroyed. Callers awaiting the seek (such as the engine, which ignores
13331
+ * position updates while seeking) are therefore never left waiting.
12973
13332
  *
12974
- * Resolves on 'seeked' with the position the player landed on. A seek
12975
- * that cannot complete also settles, with the player's current time: on a
12976
- * media 'error', when the media is reset ('emptied', for example by a new
12977
- * load), or when the source is destroyed. Callers awaiting the seek (such
12978
- * as the engine, which ignores position updates while seeking) are
12979
- * therefore never left waiting.
13333
+ * Seeks that the media would never complete settle at once:
13334
+ * - before `init()` or after `destroy()`: with `getPosition()`;
13335
+ * - after a fatal media error, or when nothing is seekable: with the
13336
+ * media's current time;
13337
+ * - before the media metadata is loaded: with the requested position,
13338
+ * which the element keeps as the position playback starts from.
12980
13339
  *
12981
13340
  * @param position - Target position in seconds
12982
13341
  * @returns Actual position after seek
12983
13342
  */
12984
13343
  async seek(position) {
12985
- if (!this._player || this.isDestroyed) return this.getPosition();
12986
- const player = this._player;
13344
+ const video = this._video;
13345
+ if (!video || this.isDestroyed) return this.getPosition();
13346
+ if (video.error) return video.currentTime;
13347
+ if (video.readyState === HAVE_NOTHING) {
13348
+ video.currentTime = position;
13349
+ this.setPosition(position);
13350
+ return position;
13351
+ }
13352
+ if (video.seekable.length === 0) return video.currentTime;
12987
13353
  return new Promise((resolve) => {
12988
13354
  let settled = false;
13355
+ const removers = [];
12989
13356
  const settle = (actualPosition) => {
12990
13357
  if (settled) return;
12991
13358
  settled = true;
12992
13359
  this._pendingSeeks.delete(settle);
12993
- player.off("seeked", onSeeked);
12994
- player.off("error", onAborted);
12995
- player.off("emptied", onAborted);
13360
+ for (const remove of removers) remove();
12996
13361
  resolve(actualPosition);
12997
13362
  };
12998
13363
  const onSeeked = () => {
12999
- if (settled) return;
13000
- const actualPosition = this._player?.currentTime() ?? 0;
13364
+ const actualPosition = video.currentTime;
13001
13365
  this.setPosition(actualPosition);
13002
13366
  settle(actualPosition);
13003
13367
  };
13004
- const onAborted = () => {
13005
- settle(this._player?.currentTime() ?? this.getPosition());
13006
- };
13368
+ const onAborted = () => settle(video.currentTime);
13007
13369
  this._pendingSeeks.add(settle);
13008
- player.one("seeked", onSeeked);
13009
- player.one("error", onAborted);
13010
- player.one("emptied", onAborted);
13011
- player.currentTime(position);
13370
+ removers.push(this._listen(video, "seeked", onSeeked), this._listen(video, "error", onAborted, true), this._listen(video, "emptied", onAborted));
13371
+ video.currentTime = position;
13012
13372
  });
13013
13373
  }
13014
13374
  /**
@@ -13035,120 +13395,218 @@ var VideoPositionSource = class extends BasePositionSource {
13035
13395
  this._containerReadyCallbacks.push(callback);
13036
13396
  }
13037
13397
  /**
13038
- * Get the video duration.
13398
+ * Get the media duration.
13039
13399
  *
13040
- * @returns Duration in seconds from video.js player
13400
+ * @returns Duration in seconds from the media: 0 until its metadata is
13401
+ * loaded, `Infinity` for unbounded media
13041
13402
  */
13042
13403
  getDuration() {
13043
- return this._player?.duration() ?? 0;
13404
+ const duration = this._video?.duration;
13405
+ return duration === void 0 || Number.isNaN(duration) ? 0 : duration;
13044
13406
  }
13045
13407
  /**
13046
13408
  * Deactivate the source and reset position.
13047
13409
  *
13048
- * Overrides base to also reset video currentTime.
13410
+ * Overrides base to also reset the media's currentTime.
13049
13411
  */
13050
13412
  deactivate() {
13051
13413
  if (this.state === "inactive") return;
13052
- if (this.state === "active") this.stopTicking();
13053
- this._player?.currentTime(0);
13054
13414
  super.deactivate();
13415
+ if (this._video) this._video.currentTime = 0;
13055
13416
  }
13056
13417
  /**
13057
- * Create the video.js player and settle the pending init on 'canplay'
13058
- * (resolve) or 'error' (reject).
13059
- *
13060
- * @param videojsFactory - The loaded video.js function
13061
- */
13062
- _createPlayer(videojsFactory) {
13063
- this._player = videojsFactory(this._videoElementId, {
13064
- controls: false,
13065
- controlBar: false,
13066
- liveui: false,
13067
- autoplay: false,
13068
- preload: "auto",
13069
- loop: this.loop,
13070
- sources: this._config.sources,
13071
- ...this._config.poster !== void 0 ? { poster: this._config.poster } : {},
13072
- ...this._config.options
13073
- }, () => {
13074
- const player = this._player;
13075
- if (!player) return;
13076
- this._addPlayerListener("timeupdate", this._handleTimeUpdate.bind(this));
13077
- this._addPlayerListener("ended", this._handleEnded.bind(this));
13078
- player.one("playing", () => {
13079
- this._notifyContainerReady();
13080
- });
13081
- player.one("error", () => {
13082
- const mediaError = player.error?.();
13083
- const sources = (this._getSources() ?? []).map((s) => s.src).join(", ");
13084
- this._settleInit(/* @__PURE__ */ new Error(`VideoPositionSource: failed to load video (${sources})${mediaError?.message ? `: ${mediaError.message}` : ""}`));
13085
- });
13086
- player.one("canplay", () => {
13087
- this._settleInit();
13088
- });
13089
- player.load();
13418
+ * Validate the configuration, create the video element with its sources
13419
+ * and start loading. Resolves on 'canplay', rejects when no source can be
13420
+ * played or on a media error.
13421
+ */
13422
+ _load() {
13423
+ return new Promise((resolve, reject) => {
13424
+ if (this.isDestroyed) {
13425
+ reject(/* @__PURE__ */ new Error("VideoPositionSource: cannot init a destroyed position source"));
13426
+ return;
13427
+ }
13428
+ if (Object.hasOwn(this._config, "options")) {
13429
+ reject(/* @__PURE__ */ new Error(OPTIONS_REMOVED_MESSAGE));
13430
+ return;
13431
+ }
13432
+ const container = $(this._config.selector).get(0);
13433
+ if (!container) {
13434
+ reject(/* @__PURE__ */ new Error(`VideoPositionSource: container not found for selector '${this._config.selector}'`));
13435
+ return;
13436
+ }
13437
+ const { sources } = this._config;
13438
+ if (!Array.isArray(sources) || sources.length === 0) {
13439
+ reject(/* @__PURE__ */ new Error("VideoPositionSource: 'sources' is required (an array of {src, type})"));
13440
+ return;
13441
+ }
13442
+ const loadTimeout = this._config.loadTimeout ?? DEFAULT_LOAD_TIMEOUT_MS;
13443
+ if (typeof loadTimeout !== "number" || !Number.isFinite(loadTimeout) || loadTimeout < 0) {
13444
+ reject(/* @__PURE__ */ new Error("VideoPositionSource: 'loadTimeout' must be a finite number of milliseconds, 0 or more (0 disables the limit)"));
13445
+ return;
13446
+ }
13447
+ const invalid = sources.findIndex((source) => !isNonEmptyString(source?.src));
13448
+ if (invalid !== -1) {
13449
+ reject(/* @__PURE__ */ new Error(`VideoPositionSource: sources[${invalid}].src must be a non-empty string`));
13450
+ return;
13451
+ }
13452
+ const doc = container.ownerDocument;
13453
+ const video = this._createVideoElement(doc);
13454
+ const playable = sources.filter(({ type }) => !isNonEmptyString(type) || video.canPlayType(type) !== "");
13455
+ if (playable.length === 0) {
13456
+ reject(/* @__PURE__ */ new Error(`VideoPositionSource: failed to load video (${this._sourceList()}): none of the sources has a type this browser can play`));
13457
+ return;
13458
+ }
13459
+ this._pendingInit = {
13460
+ resolve,
13461
+ reject
13462
+ };
13463
+ this._video = video;
13464
+ this._sourceElements = playable.map((source) => createSourceElement(doc, source));
13465
+ this._attachListeners(video);
13466
+ if (loadTimeout > 0) this._startLoadTimer(video, loadTimeout);
13467
+ for (const element of this._sourceElements) video.appendChild(element);
13468
+ container.appendChild(video);
13469
+ video.load();
13090
13470
  });
13091
13471
  }
13472
+ _sourceList() {
13473
+ return this._config.sources.map((source) => source.src).join(", ");
13474
+ }
13475
+ /**
13476
+ * Create the video element (DOM APIs, so `src` and `poster` need no
13477
+ * escaping).
13478
+ */
13479
+ _createVideoElement(doc) {
13480
+ const video = doc.createElement("video");
13481
+ video.id = this._videoElementId;
13482
+ video.className = VIDEO_ELEMENT_CLASS;
13483
+ video.preload = "auto";
13484
+ video.controls = false;
13485
+ video.autoplay = false;
13486
+ video.playsInline = true;
13487
+ if (this._config.poster !== void 0) video.poster = this._config.poster;
13488
+ return video;
13489
+ }
13490
+ /**
13491
+ * Add an event listener and record its remover in `group`. The only
13492
+ * place that calls addEventListener.
13493
+ */
13494
+ _listen(target, type, handler, capture = false, group = this._listeners) {
13495
+ target.addEventListener(type, handler, capture);
13496
+ const remove = () => {
13497
+ target.removeEventListener(type, handler, capture);
13498
+ group.delete(remove);
13499
+ };
13500
+ group.add(remove);
13501
+ return remove;
13502
+ }
13092
13503
  /**
13093
- * The sources video.js will load: `options.sources` when given (options
13094
- * override the defaults), otherwise the top-level `sources`.
13504
+ * Attach the media listeners. Each handler first checks that its element
13505
+ * is still the current one, so nothing from an old element can drive a
13506
+ * new attempt.
13095
13507
  */
13096
- _getSources() {
13097
- return this._config.options?.sources ?? this._config.sources;
13508
+ _attachListeners(video) {
13509
+ const current = () => this._video === video;
13510
+ this._listen(video, "timeupdate", () => {
13511
+ if (current()) this._handleTimeUpdate();
13512
+ });
13513
+ this._listen(video, "ended", () => {
13514
+ if (current()) this._handleEnded();
13515
+ });
13516
+ const removePlaying = this._listen(video, "playing", () => {
13517
+ removePlaying();
13518
+ if (current()) this._notifyContainerReady();
13519
+ });
13520
+ this._listen(video, "canplay", () => {
13521
+ if (current()) this._settleInit();
13522
+ }, false, this._initListeners);
13523
+ this._listen(video, "error", (event) => {
13524
+ if (current()) this._handleInitError(event, video);
13525
+ }, true, this._initListeners);
13526
+ }
13527
+ /**
13528
+ * Reject the pending init when no source has become playable within
13529
+ * `ms`. The timer is an init listener, so settling or tearing down init
13530
+ * clears it.
13531
+ */
13532
+ _startLoadTimer(video, ms) {
13533
+ const timer = setTimeout(() => {
13534
+ if (this._video === video) this._failInit(/* @__PURE__ */ new Error(`VideoPositionSource: failed to load video (${this._sourceList()}): no source became playable within ${ms} ms`));
13535
+ }, ms);
13536
+ const clear = () => {
13537
+ clearTimeout(timer);
13538
+ this._initListeners.delete(clear);
13539
+ };
13540
+ this._initListeners.add(clear);
13541
+ }
13542
+ _handleInitError(event, video) {
13543
+ let detail;
13544
+ if (event.target === video) detail = describeMediaError(video.error);
13545
+ else if (event.target === this._sourceElements.at(-1) || video.networkState === NETWORK_NO_SOURCE) detail = ": none of the sources could be played";
13546
+ else return;
13547
+ this._failInit(/* @__PURE__ */ new Error(`VideoPositionSource: failed to load video (${this._sourceList()})${detail}`));
13098
13548
  }
13099
13549
  /**
13100
13550
  * Settle the pending init promise once: resolve without an error, reject
13101
- * with one.
13551
+ * with one. Removes the init listeners either way.
13102
13552
  */
13103
13553
  _settleInit(error) {
13104
13554
  const pending = this._pendingInit;
13105
13555
  if (!pending) return;
13106
13556
  this._pendingInit = null;
13557
+ for (const remove of [...this._initListeners]) remove();
13107
13558
  if (error === void 0) pending.resolve();
13108
13559
  else pending.reject(error);
13109
13560
  }
13110
13561
  /**
13111
- * Create the video element in the container.
13562
+ * Reject the pending init and remove the element, so no element or
13563
+ * listener survives a failed init.
13112
13564
  */
13113
- _createVideoElement() {
13114
- const $container = $(this._config.selector);
13115
- const videoHtml = `<video id="${this._videoElementId}" class="video-js"></video>`;
13116
- $container.append(videoHtml);
13565
+ _failInit(error) {
13566
+ this._settleInit(error);
13567
+ this._teardown();
13117
13568
  }
13118
13569
  /**
13119
- * Add an event listener to the player and track for cleanup.
13120
- *
13121
- * @param event - Event name
13122
- * @param handler - Event handler
13570
+ * Settle pending seeks, remove every listener and release the media
13571
+ * element.
13123
13572
  */
13124
- _addPlayerListener(event, handler) {
13125
- if (this._player) {
13126
- this._player.on(event, handler);
13127
- this._eventHandlers.push(() => {
13128
- this._player?.off(event, handler);
13129
- });
13130
- }
13573
+ _teardown() {
13574
+ const video = this._video;
13575
+ const position = video?.currentTime ?? this.getPosition();
13576
+ for (const settleSeek of [...this._pendingSeeks]) settleSeek(position);
13577
+ for (const remove of [...this._listeners, ...this._initListeners]) remove();
13578
+ this._video = null;
13579
+ this._sourceElements = [];
13580
+ if (!video) return;
13581
+ video.pause();
13582
+ for (const source of [...video.querySelectorAll("source")]) source.remove();
13583
+ video.removeAttribute("src");
13584
+ video.load();
13585
+ video.remove();
13131
13586
  }
13132
13587
  /**
13133
- * Handle timeupdate event from video.js.
13588
+ * Handle the media's timeupdate event.
13134
13589
  */
13135
13590
  _handleTimeUpdate() {
13136
- if (this.state !== "active" || !this._player) return;
13137
- const currentTime = this._player.currentTime();
13138
- if (currentTime !== void 0) this.setPosition(currentTime);
13591
+ if (this.state !== "active" || !this._video) return;
13592
+ this.setPosition(this._video.currentTime);
13139
13593
  }
13140
13594
  /**
13141
- * Handle ended event from video.js.
13595
+ * Handle the media's ended event.
13142
13596
  */
13143
13597
  _handleEnded() {
13144
13598
  if (this.state !== "active") return;
13145
13599
  this.emitBoundary("end");
13146
- if (this.loop) {
13147
- this._player?.currentTime(0);
13148
- this.setPosition(0);
13149
- this.emitBoundary("start");
13150
- this._player?.play()?.catch(() => {});
13151
- } else this.deactivate();
13600
+ if (!this.loop) {
13601
+ this.deactivate();
13602
+ return;
13603
+ }
13604
+ if (this.state !== "active") return;
13605
+ if (this._video) this._video.currentTime = 0;
13606
+ this.setPosition(0);
13607
+ this.emitBoundary("start");
13608
+ if (this.state !== "active") return;
13609
+ this._video?.play()?.catch(() => {});
13152
13610
  }
13153
13611
  /**
13154
13612
  * Notify all container ready callbacks.
@@ -14057,7 +14515,7 @@ var EligiusEngine = class EligiusEngine {
14057
14515
  _createLayoutTemplate() {
14058
14516
  const { containerSelector } = this.configuration;
14059
14517
  const container = $(containerSelector);
14060
- if (!container || !container.length) throw new Error(`Container selector not found: ${containerSelector}`);
14518
+ if (!container?.length) throw new Error(`Container selector not found: ${containerSelector}`);
14061
14519
  this._engineRoot = container;
14062
14520
  const { layoutTemplate } = this.configuration;
14063
14521
  if (layoutTemplate?.length) {
@@ -14128,6 +14586,15 @@ var EligiusEngine = class EligiusEngine {
14128
14586
  if (source === this._activePositionSource) this._onFirstFrameCallback();
14129
14587
  });
14130
14588
  this._wireTimelineChangeRequests(source);
14589
+ this._wireEngineRoot(source);
14590
+ }
14591
+ /**
14592
+ * Sources that bind keys (KeyboardStepSource) get the engine root, so they
14593
+ * leave a key to a KeyboardController of this engine that handles it.
14594
+ */
14595
+ _wireEngineRoot(source) {
14596
+ const receiver = source;
14597
+ if (typeof receiver.setEngineRoot === "function") receiver.setEngineRoot(() => this._engineRoot?.[0]);
14131
14598
  }
14132
14599
  /**
14133
14600
  * Sources that ask for timeline changes (KeyboardStepSource in
@@ -14817,6 +15284,56 @@ function describeKind(value) {
14817
15284
  return type === "undefined" ? "undefined" : `${/^[aeiou]/.test(type) ? "an" : "a"} ${type}`;
14818
15285
  }
14819
15286
 
15287
+ //#endregion
15288
+ //#region src/operation/metadata/parameter-types.ts
15289
+ /**
15290
+ * Every parameter type the operation and controller metadata may use. The
15291
+ * metadata generator fails on a type name that is not in this list.
15292
+ *
15293
+ * `RegExp` and the DOM node types (`Element`, `Text`, `Comment`, `Document`,
15294
+ * `DocumentFragment`) are the names the generator emits for `string | RegExp`
15295
+ * and `string | JQuery.Node` properties.
15296
+ *
15297
+ * Kept out of `types.ts`: the generated metadata index re-exports `types.ts`
15298
+ * into the `metadata` namespace, whose consumers expect only metadata
15299
+ * functions there.
15300
+ */
15301
+ const PARAMETER_TYPES = [
15302
+ "ParameterType:htmlElementName",
15303
+ "ParameterType:className",
15304
+ "ParameterType:selector",
15305
+ "ParameterType:string",
15306
+ "ParameterType:number",
15307
+ "ParameterType:object",
15308
+ "ParameterType:boolean",
15309
+ "ParameterType:array",
15310
+ "ParameterType:eventTopic",
15311
+ "ParameterType:eventName",
15312
+ "ParameterType:systemName",
15313
+ "ParameterType:actionName",
15314
+ "ParameterType:controllerName",
15315
+ "ParameterType:dimensions",
15316
+ "ParameterType:dimensionsModifier",
15317
+ "ParameterType:url",
15318
+ "ParameterType:htmlContent",
15319
+ "ParameterType:labelId",
15320
+ "ParameterType:ImagePath",
15321
+ "ParameterType:QuadrantPosition",
15322
+ "ParameterType:jQuery",
15323
+ "ParameterType:expression",
15324
+ "ParameterType:mathfunction",
15325
+ "ParameterType:cssProperties",
15326
+ "ParameterType:function",
15327
+ "ParameterType:Date",
15328
+ "ParameterType:languagecode",
15329
+ "ParameterType:RegExp",
15330
+ "ParameterType:Element",
15331
+ "ParameterType:Text",
15332
+ "ParameterType:Comment",
15333
+ "ParameterType:Document",
15334
+ "ParameterType:DocumentFragment"
15335
+ ];
15336
+
14820
15337
  //#endregion
14821
15338
  //#region src/locale/locale-loader.ts
14822
15339
  /**
@@ -15714,9 +16231,9 @@ var EngineFactory = class {
15714
16231
  * `IContainerProvider`, like VideoPositionSource) take their duration from
15715
16232
  * the media rather than from the timeline. They are shared by all timelines
15716
16233
  * of a type with the same effective settings, so switching timelines does
15717
- * not create a second player; a timeline whose override changes the video
15718
- * settings gets a player of its own. Overridden container providers are
15719
- * shared the same way.
16234
+ * not create a second video element; a timeline whose override changes the
16235
+ * video settings gets a video element of its own. Overridden container
16236
+ * providers are shared the same way.
15720
16237
  *
15721
16238
  * @param configuration - The resolved engine configuration
15722
16239
  * @param providersByType - The providers created per timeline type
@@ -15819,5 +16336,5 @@ function representativeTimeline(timelines, type, settings) {
15819
16336
  }
15820
16337
 
15821
16338
  //#endregion
15822
- export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, BasePositionSource, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DOMEventListenerController, DomContainerProvider, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineActionError, EngineEventbusAdapter, EngineFactory, EngineInputAdapter, Eventbus, KeyboardStepSource, LabelController, LocaleEventbusAdapter, LocaleLoader, LocaleManager, LottieController, MutationObserverController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, ProgressbarController, RafPositionSource, RequestVideoUriInterceptor, RoutingController, ScrollPositionSource, SimplePlaylist, SubtitleEditor, SubtitleImporter, SubtitlesController, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, TypedEventEmitter, VideoPositionSource, addClass, addControllerToElement, addGlobalsToOperation, animate, animateWithClass, announceToScreenReader, breakForEach, broadcastEvent, calc, clearElement, clearGlobals, clearJsonCache, clearOperationData, clearStorage, compareDate, concatenateStrings, continueForEach, createElement, metadata_exports as ctrlmetadata, customFunction, endAction, endForEach, endWhen, metadata_exports$1 as eventmetadata, extendController, filterArray, findInArray, forEach, formatDate, formatText, getAttributesFromElement, getControllerFromElement, getControllerInstance, getCurrentTime, getElementDimensions, getFocusedElement, getFormData, getImport, getQueryParams, getScrollPosition, getTextContent, httpDelete, httpPost, httpPut, invokeObjectMethod, isElementInViewport, isLocaleReference, isSeekable, loadFromStorage, loadJson, log, mapArray, math, metadata_exports$2 as metadata, otherwise, removeClass, removeControllerFromElement, removeElement, removePropertiesFromOperationData, reparentElement, replaceString, replaceText, requestAction, saveToStorage, scrollToElement, scrollToPosition, selectElement, setData, setElementAttributes, setElementContent, setFocus, setFormValue, setGlobalData, setOperationData, setStyle, setVariable, sortArray, splitString, startAction, substringText, toggleClass, toggleElement, toggleFormElement, validateForm, wait, when };
16339
+ export { Action, ActionCreator, ActionCreatorFactory, ActionEditor, ActionRegistryEventbusListener, BasePositionSource, ConfigurationFactory, ConfigurationResolver, ControllerNamesProvider, DOMEventListenerController, DomContainerProvider, EligiusEngine, EligiusResourceImporter, EndableAction, EndableActionCreator, EndableActionEditor, EngineActionError, EngineEventbusAdapter, EngineFactory, EngineInputAdapter, Eventbus, KeyboardController, KeyboardStepSource, LabelController, LocaleEventbusAdapter, LocaleLoader, LocaleManager, LottieController, MutationObserverController, NavigationController, OperationEditor, OperationMetadataProvider, OperationNamesProvider, PARAMETER_TYPES, ProgressbarController, RafPositionSource, RequestVideoUriInterceptor, RoutingController, ScrollPositionSource, SimplePlaylist, SubtitleEditor, SubtitleImporter, SubtitlesController, TimelineAction, TimelineActionCreator, TimelineActionEditor, TimelineProviderSettingsEditor, TimelineProvidersSettingsEditor, TypedEventEmitter, VideoPositionSource, addClass, addControllerToElement, addGlobalsToOperation, animate, animateWithClass, announceToScreenReader, breakForEach, broadcastEvent, calc, clearElement, clearGlobals, clearJsonCache, clearOperationData, clearStorage, compareDate, concatenateStrings, continueForEach, createElement, metadata_exports as ctrlmetadata, customFunction, endAction, endForEach, endWhen, metadata_exports$1 as eventmetadata, extendController, filterArray, findInArray, forEach, formatDate, formatText, getAttributesFromElement, getControllerFromElement, getControllerInstance, getCurrentTime, getElementDimensions, getFocusedElement, getFormData, getImport, getQueryParams, getScrollPosition, getTextContent, httpDelete, httpPost, httpPut, invokeObjectMethod, isElementInViewport, isLocaleReference, isSeekable, loadFromStorage, loadJson, log, mapArray, math, metadata_exports$2 as metadata, otherwise, removeClass, removeControllerFromElement, removeElement, removePropertiesFromOperationData, reparentElement, replaceString, replaceText, requestAction, saveToStorage, scrollToElement, scrollToPosition, selectElement, setData, setElementAttributes, setElementContent, setFocus, setFormValue, setGlobalData, setOperationData, setStyle, setVariable, sortArray, splitString, startAction, substringText, toggleClass, toggleElement, toggleFormElement, validateForm, wait, when };
15823
16340
  //# sourceMappingURL=index.mjs.map