@edrlab/thorium-web 1.3.0 → 1.3.1

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.
Files changed (59) hide show
  1. package/dist/{actionsReducer-BhG1wicI.d.mts → actionsReducer-XWTGGNUd.d.mts} +10 -3
  2. package/dist/{chunk-OWHP7ONM.mjs → chunk-2ORXUOH3.mjs} +4 -4
  3. package/dist/{chunk-OWHP7ONM.mjs.map → chunk-2ORXUOH3.mjs.map} +1 -1
  4. package/dist/{chunk-UCTMVCW7.mjs → chunk-6BUN7DEA.mjs} +35 -14
  5. package/dist/chunk-6BUN7DEA.mjs.map +1 -0
  6. package/dist/{chunk-IYAFKTPL.mjs → chunk-6EHFW43Y.mjs} +5 -4
  7. package/dist/chunk-6EHFW43Y.mjs.map +1 -0
  8. package/dist/{chunk-XBZWGRDM.mjs → chunk-A3FZBEUL.mjs} +2 -2
  9. package/dist/{chunk-XBZWGRDM.mjs.map → chunk-A3FZBEUL.mjs.map} +1 -1
  10. package/dist/{chunk-4ODYHZKD.mjs → chunk-DETZMFZ7.mjs} +27 -27
  11. package/dist/chunk-DETZMFZ7.mjs.map +1 -0
  12. package/dist/{chunk-4TVEDX7L.mjs → chunk-DMZFSOHK.mjs} +14 -13
  13. package/dist/chunk-DMZFSOHK.mjs.map +1 -0
  14. package/dist/{chunk-C236BQQB.mjs → chunk-DTPO3J2C.mjs} +10 -3
  15. package/dist/chunk-DTPO3J2C.mjs.map +1 -0
  16. package/dist/{chunk-YZ3KCMKY.mjs → chunk-EZG6SBSO.mjs} +145 -35
  17. package/dist/chunk-EZG6SBSO.mjs.map +1 -0
  18. package/dist/{chunk-WECWPYZB.mjs → chunk-GPWW5OML.mjs} +20 -15
  19. package/dist/chunk-GPWW5OML.mjs.map +1 -0
  20. package/dist/{chunk-RRVLWDT3.mjs → chunk-I4BKU5NN.mjs} +12 -11
  21. package/dist/chunk-I4BKU5NN.mjs.map +1 -0
  22. package/dist/{chunk-D7MFLHXV.mjs → chunk-LP3JFZ4A.mjs} +311 -188
  23. package/dist/chunk-LP3JFZ4A.mjs.map +1 -0
  24. package/dist/{chunk-3LDWKC5N.mjs → chunk-NKO3K3QS.mjs} +4 -4
  25. package/dist/{chunk-3LDWKC5N.mjs.map → chunk-NKO3K3QS.mjs.map} +1 -1
  26. package/dist/{chunk-T2E6MRVP.mjs → chunk-SAUOY37Q.mjs} +9 -9
  27. package/dist/{chunk-T2E6MRVP.mjs.map → chunk-SAUOY37Q.mjs.map} +1 -1
  28. package/dist/components/Audio/index.d.mts +3 -3
  29. package/dist/components/Audio/index.mjs +15 -15
  30. package/dist/components/Epub/index.d.mts +3 -3
  31. package/dist/components/Epub/index.mjs +16 -16
  32. package/dist/components/Misc/index.css +2 -2
  33. package/dist/components/Misc/index.css.map +1 -1
  34. package/dist/components/Misc/index.mjs +4 -4
  35. package/dist/components/Reader/index.css +2 -2
  36. package/dist/components/Reader/index.css.map +1 -1
  37. package/dist/components/Reader/index.d.mts +2 -2
  38. package/dist/components/Reader/index.mjs +24 -24
  39. package/dist/components/Reader/index.mjs.map +1 -1
  40. package/dist/components/WebPub/index.d.mts +3 -3
  41. package/dist/components/WebPub/index.mjs +16 -16
  42. package/dist/core/Components/index.d.mts +1 -1
  43. package/dist/core/Components/index.mjs +1 -1
  44. package/dist/core/Hooks/index.mjs +1 -1
  45. package/dist/i18n/index.mjs +5 -5
  46. package/dist/lib/index.d.mts +2 -2
  47. package/dist/lib/index.mjs +1 -1
  48. package/dist/preferences/index.mjs +5 -5
  49. package/dist/{useReaderTransitions-JDzlBFsu.d.mts → useReaderTransitions-IBGdE7qi.d.mts} +1 -1
  50. package/package.json +3 -3
  51. package/dist/chunk-4ODYHZKD.mjs.map +0 -1
  52. package/dist/chunk-4TVEDX7L.mjs.map +0 -1
  53. package/dist/chunk-C236BQQB.mjs.map +0 -1
  54. package/dist/chunk-D7MFLHXV.mjs.map +0 -1
  55. package/dist/chunk-IYAFKTPL.mjs.map +0 -1
  56. package/dist/chunk-RRVLWDT3.mjs.map +0 -1
  57. package/dist/chunk-UCTMVCW7.mjs.map +0 -1
  58. package/dist/chunk-WECWPYZB.mjs.map +0 -1
  59. package/dist/chunk-YZ3KCMKY.mjs.map +0 -1
@@ -1,19 +1,19 @@
1
- import { makeBreakpointsMap, isKeyboardTriggered, isActiveElement } from './chunk-ITDBOMY5.mjs';
2
- import { useFullscreen, useEpubNavigator, useLocalStorage } from './chunk-XBZWGRDM.mjs';
3
- import { useAppDispatch, setFullscreen, useAppSelector, setActionOpen, dockAction, setHovering, setSettingsContainer, debounce, setColumnCount, setWebPubFontFamily, setFontFamily, setWebPubFontWeight, setFontWeight, setWebPubHyphens, setHyphens, setScroll, setWebPubLetterSpacing, setLetterSpacing, setWebPubLineHeight, setLineHeight, setWebPubParagraphIndent, setParagraphIndent, setWebPubParagraphSpacing, setParagraphSpacing, setWebPubWordSpacing, setWordSpacing, setWebPubSpacingPreset, setWebPubPublisherStyles, setSpacingPreset, setPublisherStyles, setWebPubTextAlign, setTextAlign, setWebPubTextNormalization, setTextNormalization, setTheme, setWebPubZoom, setFontSize, setSkipBackwardInterval, setSkipForwardInterval, setSkipInterval, setAutoPlay, toggleActionOpen, setVolume, setPlaybackRate, setSleepTimerRemainingSeconds, setSleepTimerOnTrackEnd, setSleepTimerOnFragmentEnd, setRemotePlaybackState, ThReduxPreferencesAdapter, setReaderProfile, setPositionsList, setTocTree, setRTL, setFXL, setHasDisplayTransformability, setImmersive, setOverflow, setUserNavigated, setTocEntry, collapseDockPanel, expandDockPanel, activateDockPanel, deactivateDockPanel, setDockPanelWidth } from './chunk-YZ3KCMKY.mjs';
4
- import { buildTocTree, findTocItemById } from './chunk-TEZB4ULX.mjs';
5
- import { useActionsPreferences, prefixString, useAudioPreferences, usePreferences, usePreferenceKeys, buildThemeObject, ThPreferencesProvider } from './chunk-WECWPYZB.mjs';
6
- import { useSharedPreferences, ThDockingTypes, ThSheetTypes, defaultSpacingSettingsSubpanel, defaultSpacingSettingsMain, defaultTextSettingsSubpanel, defaultTextSettingsMain, ThTextSettingsKeys, ThSpacingSettingsKeys, defaultAudioSkipBackwardInterval, defaultAudioSkipForwardInterval, defaultAudioSkipInterval, defaultPreferences } from './chunk-C236BQQB.mjs';
7
- import { isIOSish, buildShortcut, metaKeys } from './chunk-5LUMM7FW.mjs';
8
1
  import { ErrorHandler } from './chunk-RRDEPGBK.mjs';
9
- import { ThMenuItem, ThActionButton, ThMenu, ThCollapsibleActionsBar, ThPopover, ThContainerHeader, ThNavigationButton, ThContainerBody, ThModal, ThBottomSheet, ThCloseButton, ThDockedPanel, useFirstFocusable, ThTypedComponentRenderer, useActions, useActionComponentStatus, ThForm, ThFormNumberField, usePlugins, ThSettingsWrapper, ThRadioGroup, ThDropdown, ThSwitch, ThNumberField, ThSlider, ThSliderWithPresets, ThLink, ThLibrary, ThHome, ThBackArrow, ThFormSearchField } from './chunk-4ODYHZKD.mjs';
2
+ import { useFullscreen, useEpubNavigator, useLocalStorage } from './chunk-A3FZBEUL.mjs';
3
+ import { useAppDispatch, setFullscreen, useAppSelector, setActionOpen, dockAction, setHovering, setSettingsContainer, debounce, setColumnCount, setWebPubFontFamily, setFontFamily, setWebPubFontWeight, setFontWeight, setWebPubHyphens, setHyphens, setScroll, setWebPubLetterSpacing, setLetterSpacing, setWebPubLineHeight, setLineHeight, setWebPubParagraphIndent, setParagraphIndent, setWebPubParagraphSpacing, setParagraphSpacing, setWebPubWordSpacing, setWordSpacing, setWebPubSpacingPreset, setWebPubPublisherStyles, setSpacingPreset, setPublisherStyles, setWebPubTextAlign, setTextAlign, setWebPubTextNormalization, setTextNormalization, setTheme, setWebPubZoom, setFontSize, setSkipBackwardInterval, setSkipForwardInterval, setSkipInterval, setAutoPlay, toggleActionOpen, setVolume, setPlaybackRate, setSleepTimerRemainingSeconds, setSleepTimerOnTrackEnd, setSleepTimerOnFragmentEnd, setRemotePlaybackState, ThReduxPreferencesAdapter, setReaderProfile, setPositionsList, setTocTree, setRTL, setFXL, setHasDisplayTransformability, setImmersive, setOverflow, setUserNavigated, setTocEntry, collapseDockPanel, expandDockPanel, activateDockPanel, deactivateDockPanel, setDockPanelWidth } from './chunk-EZG6SBSO.mjs';
4
+ import { buildTocTree, findTocItemById } from './chunk-TEZB4ULX.mjs';
5
+ import { useActionsPreferences, prefixString, useAudioPreferences, usePreferences, usePreferenceKeys, buildThemeObject, ThPreferencesProvider } from './chunk-GPWW5OML.mjs';
6
+ import { useI18n } from './chunk-6EHFW43Y.mjs';
7
+ import { useSharedPreferences, ThDockingTypes, ThSheetTypes, defaultSpacingSettingsSubpanel, defaultSpacingSettingsMain, defaultTextSettingsSubpanel, defaultTextSettingsMain, ThTextSettingsKeys, ThSpacingSettingsKeys, defaultAudioSkipBackwardInterval, defaultAudioSkipForwardInterval, defaultAudioSkipInterval, defaultPreferences } from './chunk-DTPO3J2C.mjs';
8
+ import { ThMenuItem, ThActionButton, ThMenu, ThCollapsibleActionsBar, ThPopover, ThContainerHeader, ThNavigationButton, ThContainerBody, ThModal, ThBottomSheet, ThCloseButton, ThDockedPanel, useFirstFocusable, ThTypedComponentRenderer, useActions, useActionComponentStatus, ThForm, ThFormNumberField, usePlugins, ThSettingsWrapper, ThRadioGroup, ThDropdown, ThSwitch, ThNumberField, ThSlider, ThSliderWithPresets, ThLink, ThLibrary, ThHome, ThBackArrow, ThFormSearchField } from './chunk-DETZMFZ7.mjs';
10
9
  import { usePrevious } from './chunk-YZ73DHRU.mjs';
11
- import { useI18n } from './chunk-IYAFKTPL.mjs';
10
+ import { makeBreakpointsMap, isKeyboardTriggered, isActiveElement } from './chunk-ITDBOMY5.mjs';
11
+ import { isIOSish, buildShortcut, metaKeys } from './chunk-5LUMM7FW.mjs';
12
12
  import { Text, Popover, Dialog, ListBox, ListBoxItem, Radio, Button, Keyboard, Toolbar, useFilter, Tree, TreeItem, TreeItemContent, Collection } from 'react-aria-components';
13
13
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
14
14
  import { useObjectRef, useNumberFormatter, FocusScope, useFocusWithin } from 'react-aria';
15
15
  import classNames4 from 'classnames';
16
- import React24, { createContext, useCallback, useRef, useContext, useEffect, useMemo, useState } from 'react';
16
+ import React24, { createContext, useCallback, useRef, useContext, useMemo, useEffect, useState } from 'react';
17
17
  import { Link, HttpFetcher, Manifest, Publication, ReadingProgression, Layout, Feature, Profile } from '@readium/shared';
18
18
  import { TextAlignment } from '@readium/navigator';
19
19
  import { useStore } from 'react-redux';
@@ -320,68 +320,71 @@ var useNavigator = () => {
320
320
  if (!context) {
321
321
  throw new Error("useNavigator must be used within NavigatorProvider");
322
322
  }
323
- return {
323
+ const unified = useMemo(() => {
324
+ const navigator = context.visual || context.media;
325
+ if (!navigator) throw new Error("No navigator available");
326
+ const isVisual = isVisualNavigator(navigator, context.visual);
327
+ return {
328
+ go: (locator, animated, callback) => {
329
+ return navigator.go(locator, animated, callback);
330
+ },
331
+ goLink: (link, animated, callback) => {
332
+ return navigator.goLink(link, animated, callback);
333
+ },
334
+ currentLocator: () => navigator.currentLocator(),
335
+ previousLocator: () => {
336
+ if (isVisual && navigator.previousLocator) {
337
+ return navigator.previousLocator() || null;
338
+ }
339
+ return null;
340
+ },
341
+ nextLocator: () => {
342
+ if (isVisual && navigator.nextLocator) {
343
+ return navigator.nextLocator() || null;
344
+ }
345
+ return null;
346
+ },
347
+ goForward: (animated, callback) => {
348
+ if (navigator.goForward) {
349
+ return navigator.goForward(animated, callback);
350
+ }
351
+ return callback?.(false);
352
+ },
353
+ goBackward: (animated, callback) => {
354
+ if (navigator.goBackward) {
355
+ return navigator.goBackward(animated, callback);
356
+ }
357
+ return callback?.(false);
358
+ },
359
+ isVisual: () => isVisual,
360
+ getCframes: isVisual ? navigator.getCframes?.bind(navigator) : void 0,
361
+ underlying: navigator
362
+ };
363
+ }, [context.visual, context.media]);
364
+ const visualMemo = useMemo(() => {
365
+ if (!context.visual) return null;
366
+ const visualNavigator = context.visual;
367
+ return {
368
+ ...visualNavigator,
369
+ getSetting: createUnifiedGetSetting(visualNavigator)
370
+ };
371
+ }, [context.visual]);
372
+ const mediaMemo = useMemo(() => {
373
+ return context.media;
374
+ }, [context.media]);
375
+ return useMemo(() => ({
324
376
  get visual() {
325
- if (!context.visual) throw new Error("Visual navigator not available");
326
- const visualNavigator = context.visual;
327
- return {
328
- ...visualNavigator,
329
- getSetting: createUnifiedGetSetting(visualNavigator)
330
- };
377
+ if (!visualMemo) throw new Error("Visual navigator not available");
378
+ return visualMemo;
331
379
  },
332
380
  get media() {
333
- if (!context.media) throw new Error("Media navigator not available");
334
- return context.media;
381
+ if (!mediaMemo) throw new Error("Media navigator not available");
382
+ return mediaMemo;
335
383
  },
336
- // Unified interface that automatically selects the appropriate navigator
337
384
  get unified() {
338
- const navigator = context.visual || context.media;
339
- if (!navigator) throw new Error("No navigator available");
340
- const isVisual = isVisualNavigator(navigator, context.visual);
341
- return {
342
- // Navigation methods available in both
343
- go: (locator, animated, callback) => {
344
- return navigator.go(locator, animated, callback);
345
- },
346
- goLink: (link, animated, callback) => {
347
- return navigator.goLink(link, animated, callback);
348
- },
349
- currentLocator: () => navigator.currentLocator(),
350
- // Unified previous/next navigation
351
- previousLocator: () => {
352
- if (isVisual && navigator.previousLocator) {
353
- return navigator.previousLocator() || null;
354
- }
355
- return null;
356
- },
357
- nextLocator: () => {
358
- if (isVisual && navigator.nextLocator) {
359
- return navigator.nextLocator() || null;
360
- }
361
- return null;
362
- },
363
- // Unified forward/backward navigation
364
- goForward: (animated, callback) => {
365
- if (navigator.goForward) {
366
- return navigator.goForward(animated, callback);
367
- }
368
- return callback?.(false);
369
- },
370
- goBackward: (animated, callback) => {
371
- if (navigator.goBackward) {
372
- return navigator.goBackward(animated, callback);
373
- }
374
- return callback?.(false);
375
- },
376
- // Check if navigator is visual
377
- isVisual: () => isVisual,
378
- // Visual-specific methods (only available when isVisual() is true)
379
- getCframes: isVisual ? navigator.getCframes?.bind(navigator) : void 0,
380
- // Access to underlying navigator for advanced use cases
381
- underlying: navigator
382
- };
385
+ return unified;
383
386
  }
384
- };
387
+ }), [visualMemo, mediaMemo, unified]);
385
388
  };
386
389
 
387
390
  // src/components/Sheets/assets/styles/thorium-web.sheets.module.css
@@ -425,15 +428,15 @@ var StatefulDockStart = ({ variant, associatedKey }) => {
425
428
  const preferences = useActionsPreferences();
426
429
  const { t } = useI18n();
427
430
  const direction = useAppSelector((state) => state.reader.direction);
428
- const actionsMap = useAppSelector((state) => state.actions.keys);
429
431
  const profile = useAppSelector((state) => state.reader.profile);
432
+ const actionsMap = useAppSelector((state) => profile ? state.actions.keys[profile] : void 0);
433
+ const actions = useActions(actionsMap || {});
430
434
  const isRTL = direction === "rtl" /* rtl */;
431
435
  const translationKey = isRTL ? "reader.app.docker.dockToRight" : "reader.app.docker.dockToLeft";
432
436
  const localeKey = {
433
437
  trigger: t(`${translationKey}.trigger`),
434
438
  tooltip: t(`${translationKey}.tooltip`)
435
439
  };
436
- const actions = useActions(actionsMap);
437
440
  const isDisabled = actions.whichDocked(associatedKey) === "dockingStart" /* start */;
438
441
  const dispatch = useAppDispatch();
439
442
  const handlePress = useCallback(() => {
@@ -472,15 +475,15 @@ var StatefulDockEnd = ({ variant, associatedKey }) => {
472
475
  const preferences = useActionsPreferences();
473
476
  const { t } = useI18n();
474
477
  const direction = useAppSelector((state) => state.reader.direction);
475
- const actionsMap = useAppSelector((state) => state.actions.keys);
476
478
  const profile = useAppSelector((state) => state.reader.profile);
479
+ const actionsMap = useAppSelector((state) => profile ? state.actions.keys[profile] : void 0);
480
+ const actions = useActions(actionsMap || {});
477
481
  const isRTL = direction === "rtl" /* rtl */;
478
482
  const translationKey = isRTL ? "reader.app.docker.dockToLeft" : "reader.app.docker.dockToRight";
479
483
  const localeKey = {
480
484
  trigger: t(`${translationKey}.trigger`),
481
485
  tooltip: t(`${translationKey}.tooltip`)
482
486
  };
483
- const actions = useActions(actionsMap);
484
487
  const isDisabled = actions.whichDocked(associatedKey) === "dockingEnd" /* end */;
485
488
  const dispatch = useAppDispatch();
486
489
  const handlePress = useCallback(() => {
@@ -520,9 +523,9 @@ var stack_default = SvgStack;
520
523
  var StatefulDockTransientPopover = ({ variant, associatedKey }) => {
521
524
  const preferences = useActionsPreferences();
522
525
  const { t } = useI18n();
523
- const actionsMap = useAppSelector((state) => state.actions.keys);
524
526
  const profile = useAppSelector((state) => state.reader.profile);
525
- const actions = useActions(actionsMap);
527
+ const actionsMap = useAppSelector((state) => profile ? state.actions.keys[profile] : void 0);
528
+ const actions = useActions(actionsMap || {});
526
529
  const isDisabled = !actions.isDocked(associatedKey) || actions.whichDocked(associatedKey) === "dockingTransient" /* transient */;
527
530
  const dispatch = useAppDispatch();
528
531
  const handlePress = useCallback(() => {
@@ -627,11 +630,16 @@ var useWebkitPatch = (isOpen) => {
627
630
  const scroll = useAppSelector((state) => state.settings.scroll);
628
631
  const isFXL = useAppSelector((state) => state.publication.isFXL);
629
632
  const isScroll = isWebPub || scroll && !isFXL;
630
- const {
631
- getCframes
632
- } = useNavigator().unified;
633
+ const prevIsOpen = usePrevious(isOpen);
634
+ let getCframes;
635
+ try {
636
+ const visual = useNavigator().visual;
637
+ getCframes = visual.getCframes;
638
+ } catch (e) {
639
+ getCframes = void 0;
640
+ }
633
641
  useEffect(() => {
634
- if (isScroll && !isOpen) {
642
+ if (isScroll && prevIsOpen && !isOpen && getCframes) {
635
643
  const container = document.getElementById("thorium-web-container");
636
644
  if (!container) return;
637
645
  const currentHeight = container.offsetHeight;
@@ -642,17 +650,23 @@ var useWebkitPatch = (isOpen) => {
642
650
  const frames = getCframes();
643
651
  if (!frames || !Array.isArray(frames) || frames.length === 0) return;
644
652
  const frame = frames[0];
645
- if (!frame?.window?.document?.scrollingElement) return;
646
- const currentScrollTop = frame.window.document.scrollingElement.scrollTop;
653
+ let frameWindow;
654
+ try {
655
+ frameWindow = frame?.window;
656
+ if (!frameWindow?.document?.scrollingElement) return;
657
+ } catch (e) {
658
+ return;
659
+ }
660
+ const currentScrollTop = frameWindow.document.scrollingElement.scrollTop;
647
661
  if (currentScrollTop > 1) {
648
- frame.window.document.scrollingElement.scrollTop = currentScrollTop - 1;
662
+ frameWindow.document.scrollingElement.scrollTop = currentScrollTop - 1;
649
663
  } else {
650
- frame.window.document.scrollingElement.scrollTop = currentScrollTop + 1;
664
+ frameWindow.document.scrollingElement.scrollTop = currentScrollTop + 1;
651
665
  }
652
- frame.window.document.scrollingElement.scrollTop = currentScrollTop;
666
+ frameWindow.document.scrollingElement.scrollTop = currentScrollTop;
653
667
  }, 0);
654
668
  }
655
- }, [isScroll, isOpen, getCframes]);
669
+ }, [isScroll, isOpen, prevIsOpen, getCframes]);
656
670
  };
657
671
  var StatefulPopoverSheet = ({
658
672
  id,
@@ -1366,12 +1380,12 @@ var dockingMap = null;
1366
1380
  var useDocking = (key) => {
1367
1381
  const preferences = useActionsPreferences();
1368
1382
  const breakpoint = useAppSelector((state) => state.theming.breakpoint);
1369
- const actionsMap = useAppSelector((state) => state.actions.keys);
1370
- const actionState = actionsMap[key];
1371
1383
  const profile = useAppSelector((state) => state.reader.profile);
1384
+ const actionsMap = useAppSelector((state) => profile ? state.actions.keys[profile] : void 0);
1385
+ const actionState = actionsMap?.[key];
1372
1386
  const dock = useAppSelector((state) => profile ? state.actions.dock[profile] : void 0);
1373
1387
  const dispatch = useAppDispatch();
1374
- const actions = useActions(actionsMap);
1388
+ const actions = useActions(actionsMap || {});
1375
1389
  const startActionKey = dock?.["dockingStart" /* start */]?.actionKey;
1376
1390
  const endActionKey = dock?.["dockingEnd" /* end */]?.actionKey;
1377
1391
  const startStatus = useActionComponentStatus({ actionKey: startActionKey || "" });
@@ -1501,13 +1515,16 @@ var useDocking = (key) => {
1501
1515
  if (actionState?.docking === "dockingTransient" /* transient */) return;
1502
1516
  if (sheetType !== "docked start" /* dockedStart */ && sheetType !== "docked end" /* dockedEnd */) {
1503
1517
  if (previousSheetType === "docked start" /* dockedStart */ || previousSheetType === "docked end" /* dockedEnd */) {
1504
- dispatch(setActionOpen({
1505
- key,
1506
- isOpen: false
1507
- }));
1518
+ if (profile) {
1519
+ dispatch(setActionOpen({
1520
+ key,
1521
+ isOpen: false,
1522
+ profile
1523
+ }));
1524
+ }
1508
1525
  }
1509
1526
  }
1510
- }, [dispatch, key, sheetType, previousSheetType, actionState?.docking]);
1527
+ }, [dispatch, key, sheetType, previousSheetType, actionState?.docking, profile]);
1511
1528
  useEffect(() => {
1512
1529
  if (actionState?.isOpen == null && profile) {
1513
1530
  if (sheetType === "docked start" /* dockedStart */) {
@@ -1518,7 +1535,8 @@ var useDocking = (key) => {
1518
1535
  }));
1519
1536
  dispatch(setActionOpen({
1520
1537
  key,
1521
- isOpen: true
1538
+ isOpen: true,
1539
+ profile
1522
1540
  }));
1523
1541
  } else if (sheetType === "docked end" /* dockedEnd */) {
1524
1542
  dispatch(dockAction({
@@ -1528,7 +1546,8 @@ var useDocking = (key) => {
1528
1546
  }));
1529
1547
  dispatch(setActionOpen({
1530
1548
  key,
1531
- isOpen: true
1549
+ isOpen: true,
1550
+ profile
1532
1551
  }));
1533
1552
  }
1534
1553
  }
@@ -1569,7 +1588,8 @@ var useDocking = (key) => {
1569
1588
  if (actionState?.isOpen === false) {
1570
1589
  dispatch(setActionOpen({
1571
1590
  key,
1572
- isOpen: true
1591
+ isOpen: true,
1592
+ profile
1573
1593
  }));
1574
1594
  }
1575
1595
  } else if (isDockedInEnd && actionState?.docking !== "dockingEnd" /* end */) {
@@ -1581,7 +1601,8 @@ var useDocking = (key) => {
1581
1601
  if (actionState?.isOpen === false) {
1582
1602
  dispatch(setActionOpen({
1583
1603
  key,
1584
- isOpen: true
1604
+ isOpen: true,
1605
+ profile
1585
1606
  }));
1586
1607
  }
1587
1608
  }
@@ -1628,7 +1649,8 @@ var StatefulJumpToPositionContainer = ({
1628
1649
  triggerRef
1629
1650
  }) => {
1630
1651
  const { t } = useI18n();
1631
- const actionState = useAppSelector((state) => state.actions.keys["jumpToPosition" /* jumpToPosition */]);
1652
+ const profile = useAppSelector((state) => state.reader.profile);
1653
+ const actionState = useAppSelector((state) => profile ? state.actions.keys[profile]["jumpToPosition" /* jumpToPosition */] : void 0);
1632
1654
  const positionsList = useAppSelector((state) => state.publication.positionsList);
1633
1655
  const positionNumbers = useAppSelector((state) => state.publication.unstableTimeline?.progression?.currentPositions);
1634
1656
  const reducedMotion = useAppSelector((state) => state.theming.prefersReducedMotion);
@@ -1644,11 +1666,14 @@ var StatefulJumpToPositionContainer = ({
1644
1666
  }, [position, positionNumbers]);
1645
1667
  const label = t("reader.jumpToPosition.label", { positionStart: 1, positionEnd: positionsList.length });
1646
1668
  const setOpen = useCallback((value) => {
1647
- dispatch(setActionOpen({
1648
- key: "jumpToPosition" /* jumpToPosition */,
1649
- isOpen: value
1650
- }));
1651
- }, [dispatch]);
1669
+ if (profile) {
1670
+ dispatch(setActionOpen({
1671
+ key: "jumpToPosition" /* jumpToPosition */,
1672
+ isOpen: value,
1673
+ profile
1674
+ }));
1675
+ }
1676
+ }, [dispatch, profile]);
1652
1677
  const handleInput = useCallback((e) => {
1653
1678
  const target = e.target;
1654
1679
  setPosition(parseInt(target.value));
@@ -1737,14 +1762,18 @@ var pin_drop_default = SvgPinDrop;
1737
1762
  var StatefulJumpToPositionTrigger = ({ variant }) => {
1738
1763
  const preferences = useActionsPreferences();
1739
1764
  const { t } = useI18n();
1740
- const actionState = useAppSelector((state) => state.actions.keys["jumpToPosition" /* jumpToPosition */]);
1765
+ const profile = useAppSelector((state) => state.reader.profile);
1766
+ const actionState = useAppSelector((state) => profile ? state.actions.keys[profile]["jumpToPosition" /* jumpToPosition */] : void 0);
1741
1767
  const positionsList = useAppSelector((state) => state.publication.positionsList);
1742
1768
  const dispatch = useAppDispatch();
1743
1769
  const setOpen = (value) => {
1744
- dispatch(setActionOpen({
1745
- key: "jumpToPosition" /* jumpToPosition */,
1746
- isOpen: value
1747
- }));
1770
+ if (profile) {
1771
+ dispatch(setActionOpen({
1772
+ key: "jumpToPosition" /* jumpToPosition */,
1773
+ isOpen: value,
1774
+ profile
1775
+ }));
1776
+ }
1748
1777
  };
1749
1778
  if (!isPositionsListValid(positionsList)) return null;
1750
1779
  return /* @__PURE__ */ jsx(Fragment, { children: variant && variant === "menuItem" /* menu */ ? /* @__PURE__ */ jsx(
@@ -1815,14 +1844,18 @@ var StatefulSettingsWrapper = ({
1815
1844
  onReset,
1816
1845
  children
1817
1846
  }) => {
1818
- const actionState = useAppSelector((state) => state.actions.keys["settings" /* settings */]);
1847
+ const profile = useAppSelector((state) => state.reader.profile);
1848
+ const actionState = useAppSelector((state) => profile ? state.actions.keys[profile]["settings" /* settings */] : void 0);
1819
1849
  const dispatch = useAppDispatch();
1820
1850
  const docking = useDocking("settings" /* settings */);
1821
1851
  const setOpen = (value) => {
1822
- dispatch(setActionOpen({
1823
- key: "settings" /* settings */,
1824
- isOpen: value
1825
- }));
1852
+ if (profile) {
1853
+ dispatch(setActionOpen({
1854
+ key: "settings" /* settings */,
1855
+ isOpen: value,
1856
+ profile
1857
+ }));
1858
+ }
1826
1859
  if (!value) dispatch(setHovering(false));
1827
1860
  };
1828
1861
  useEffect(() => {
@@ -1859,10 +1892,13 @@ var StatefulAudioSettingsContainer = ({
1859
1892
  const { settingsComponentsMap } = usePlugins();
1860
1893
  const { t } = useI18n();
1861
1894
  const dispatch = useAppDispatch();
1895
+ const profile = useAppSelector((state) => state.reader.profile);
1862
1896
  const close = useCallback(() => {
1863
- dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false }));
1897
+ if (profile) {
1898
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
1899
+ }
1864
1900
  dispatch(setHovering(false));
1865
- }, [dispatch]);
1901
+ }, [dispatch, profile]);
1866
1902
  return /* @__PURE__ */ jsx(
1867
1903
  StatefulSettingsWrapper,
1868
1904
  {
@@ -2035,9 +2071,11 @@ var StatefulVisualSettingsContainer = ({
2035
2071
  dispatch(setSettingsContainer("initial" /* initial */));
2036
2072
  }, [dispatch]);
2037
2073
  const close = useCallback(() => {
2038
- dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false }));
2074
+ if (profile) {
2075
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
2076
+ }
2039
2077
  dispatch(setHovering(false));
2040
- }, [dispatch]);
2078
+ }, [dispatch, profile]);
2041
2079
  const isTextNested = useCallback((key) => {
2042
2080
  const textSettings = [
2043
2081
  mainTextSettingsKeys || defaultTextSettingsMain,
@@ -2144,15 +2182,18 @@ var instant_mix_default = SvgInstantMix;
2144
2182
  var StatefulSettingsTrigger = ({ variant }) => {
2145
2183
  const preferences = useActionsPreferences();
2146
2184
  const { t } = useI18n();
2147
- const actionState = useAppSelector((state) => state.actions.keys["settings" /* settings */]);
2148
2185
  const profile = useAppSelector((state) => state.reader.profile);
2186
+ const actionState = useAppSelector((state) => profile ? state.actions.keys[profile]["settings" /* settings */] : void 0);
2149
2187
  const isAudio = profile === "audio";
2150
2188
  const dispatch = useAppDispatch();
2151
2189
  const setOpen = (value) => {
2152
- dispatch(setActionOpen({
2153
- key: "settings" /* settings */,
2154
- isOpen: value
2155
- }));
2190
+ if (profile) {
2191
+ dispatch(setActionOpen({
2192
+ key: "settings" /* settings */,
2193
+ isOpen: value,
2194
+ profile
2195
+ }));
2196
+ }
2156
2197
  if (!value) dispatch(setHovering(false));
2157
2198
  };
2158
2199
  return /* @__PURE__ */ jsx(Fragment, { children: variant && variant === "menuItem" /* menu */ ? /* @__PURE__ */ jsx(
@@ -2343,14 +2384,17 @@ var StatefulTocContainer = ({ triggerRef }) => {
2343
2384
  const tocTree = unstableTimeline?.toc?.tree;
2344
2385
  const direction = useAppSelector((state) => state.reader.direction);
2345
2386
  const isRTL = direction === "rtl" /* rtl */;
2346
- const actionState = useAppSelector((state) => state.actions.keys["toc" /* toc */]);
2387
+ const profile = useAppSelector((state) => state.reader.profile);
2388
+ const actionState = useAppSelector((state) => profile ? state.actions.keys[profile]["toc" /* toc */] : void 0);
2347
2389
  const dispatch = useAppDispatch();
2348
2390
  const { goLink } = useNavigator().unified;
2349
2391
  const docking = useDocking("toc" /* toc */);
2350
2392
  const sheetType = docking.sheetType;
2351
2393
  const setOpen = useCallback((value) => {
2352
- dispatch(setActionOpen({ key: "toc" /* toc */, isOpen: value }));
2353
- }, [dispatch]);
2394
+ if (profile) {
2395
+ dispatch(setActionOpen({ key: "toc" /* toc */, isOpen: value, profile }));
2396
+ }
2397
+ }, [dispatch, profile]);
2354
2398
  const { expandedKeys, setExpandedKeys, filterValue, setFilterValue, displayedTocTree, treeRef, searchInputRef } = useTocContent({ isOpen: actionState?.isOpen ?? false, tocTree, tocEntry: tocEntryId });
2355
2399
  const handleAction = (keys) => {
2356
2400
  if (keys === "all" || !keys || keys.size === 0) return;
@@ -2426,13 +2470,17 @@ var toc_default = SvgToc;
2426
2470
  var StatefulTocTrigger = ({ variant }) => {
2427
2471
  const preferences = useActionsPreferences();
2428
2472
  const { t } = useI18n();
2429
- const actionState = useAppSelector((state) => state.actions.keys["toc" /* toc */]);
2473
+ const profile = useAppSelector((state) => state.reader.profile);
2474
+ const actionState = useAppSelector((state) => profile ? state.actions.keys[profile]["toc" /* toc */] : void 0);
2430
2475
  const dispatch = useAppDispatch();
2431
2476
  const setOpen = (value) => {
2432
- dispatch(setActionOpen({
2433
- key: "toc" /* toc */,
2434
- isOpen: value
2435
- }));
2477
+ if (profile) {
2478
+ dispatch(setActionOpen({
2479
+ key: "toc" /* toc */,
2480
+ isOpen: value,
2481
+ profile
2482
+ }));
2483
+ }
2436
2484
  };
2437
2485
  return /* @__PURE__ */ jsx(Fragment, { children: variant && variant === "menuItem" /* menu */ ? /* @__PURE__ */ jsx(
2438
2486
  StatefulOverflowMenuItem,
@@ -2550,6 +2598,7 @@ var StatefulRadioGroup = ({
2550
2598
  }) => {
2551
2599
  const itemsRef = useRef(items || []);
2552
2600
  const wrapperRef = useRef(null);
2601
+ const profile = useAppSelector((state) => state.reader.profile);
2553
2602
  const direction = useAppSelector((state) => state.reader.direction);
2554
2603
  const isRTL = direction === "rtl" /* rtl */;
2555
2604
  const settingsContainer = useAppSelector((state) => state.reader.settingsContainer);
@@ -2558,12 +2607,15 @@ var StatefulRadioGroup = ({
2558
2607
  if (settingsContainer !== "initial" /* initial */) {
2559
2608
  dispatch(setSettingsContainer("initial" /* initial */));
2560
2609
  } else {
2561
- dispatch(setActionOpen({
2562
- key: "settings" /* settings */,
2563
- isOpen: false
2564
- }));
2610
+ if (profile) {
2611
+ dispatch(setActionOpen({
2612
+ key: "settings" /* settings */,
2613
+ isOpen: false,
2614
+ profile
2615
+ }));
2616
+ }
2565
2617
  }
2566
- }, [dispatch, settingsContainer]);
2618
+ }, [dispatch, settingsContainer, profile]);
2567
2619
  const onFocusCallback = useCallback((value2) => {
2568
2620
  const element = wrapperRef.current?.querySelector(`[value="${value2}"]`);
2569
2621
  if (element) element.focus();
@@ -3979,7 +4031,7 @@ var StatefulTheme = () => {
3979
4031
  const isRTL = direction === "rtl" /* rtl */;
3980
4032
  const themeArray = profile === "audio" ? audioThemeOrder ?? [] : isFXL ? fxlThemeOrder ?? [] : reflowThemeOrder ?? [];
3981
4033
  const themeObject = useAppSelector((state) => state.theming.theme);
3982
- const theme = profile === "audio" ? themeObject.audio : isFXL ? themeObject.fxl : themeObject.reflow;
4034
+ const theme = profile === "audio" ? themeObject.audio ?? "auto" : isFXL ? themeObject.fxl ?? "auto" : themeObject.reflow ?? "auto";
3983
4035
  const colorScheme = useAppSelector((state) => state.theming.colorScheme);
3984
4036
  const coverTheme = useAppSelector((state) => state.theming.coverTheme);
3985
4037
  const themeItems = useRef(
@@ -3997,10 +4049,15 @@ var StatefulTheme = () => {
3997
4049
  currentValue: theme,
3998
4050
  onChange: async (val) => await updatePreference(val),
3999
4051
  isRTL,
4000
- onEscape: () => dispatch(setActionOpen({
4001
- key: "settings" /* settings */,
4002
- isOpen: false
4003
- })),
4052
+ onEscape: () => {
4053
+ if (profile) {
4054
+ dispatch(setActionOpen({
4055
+ key: "settings" /* settings */,
4056
+ isOpen: false,
4057
+ profile
4058
+ }));
4059
+ }
4060
+ },
4004
4061
  onFocus: (id) => {
4005
4062
  const element = radioGroupWrapperRef.current?.querySelector(`[id="${id}"]`);
4006
4063
  if (element) element.focus();
@@ -4234,7 +4291,7 @@ var createDefaultPlugin = () => {
4234
4291
  id: "core",
4235
4292
  name: "Core Components",
4236
4293
  description: "Default components for Thorium Web Epub StatefulReader",
4237
- version: "1.3.0",
4294
+ version: "1.3.1",
4238
4295
  components: {
4239
4296
  actions: {
4240
4297
  ["fullscreen" /* fullscreen */]: {
@@ -4474,6 +4531,7 @@ var StatefulAudioSkipBackwardInterval = ({
4474
4531
  }) => {
4475
4532
  const { t } = useI18n();
4476
4533
  const { preferences } = useAudioPreferences();
4534
+ const profile = useAppSelector((state) => state.reader.profile);
4477
4535
  const skipBackwardInterval = useAppSelector((state) => state.audioSettings.skipBackwardInterval);
4478
4536
  const dispatch = useAppDispatch();
4479
4537
  const { submitPreferences, getSetting, preferencesEditor } = useNavigator().media;
@@ -4523,7 +4581,11 @@ var StatefulAudioSkipBackwardInterval = ({
4523
4581
  label: t("reader.playback.preferences.audio.skipBackwardInterval"),
4524
4582
  presets: presets || [],
4525
4583
  formatOptions: { style: "unit", unit: "second" },
4526
- onEscape: () => dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false })),
4584
+ onEscape: () => {
4585
+ if (profile) {
4586
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
4587
+ }
4588
+ },
4527
4589
  value: skipBackwardInterval ?? void 0,
4528
4590
  onChange: (v) => updatePreference(v)
4529
4591
  }
@@ -4538,7 +4600,11 @@ var StatefulAudioSkipBackwardInterval = ({
4538
4600
  placeholder: placeholderText,
4539
4601
  presets: presets || [],
4540
4602
  formatOptions: { style: "unit", unit: "second" },
4541
- onEscape: () => dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false })),
4603
+ onEscape: () => {
4604
+ if (profile) {
4605
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
4606
+ }
4607
+ },
4542
4608
  value: skipBackwardInterval ?? void 0,
4543
4609
  onChange: updatePreference,
4544
4610
  range: skipBackwardIntervalRangeConfig.range,
@@ -4567,6 +4633,7 @@ var StatefulAudioSkipForwardInterval = ({
4567
4633
  }) => {
4568
4634
  const { t } = useI18n();
4569
4635
  const { preferences } = useAudioPreferences();
4636
+ const profile = useAppSelector((state) => state.reader.profile);
4570
4637
  const skipForwardInterval = useAppSelector((state) => state.audioSettings.skipForwardInterval);
4571
4638
  const dispatch = useAppDispatch();
4572
4639
  const { submitPreferences, getSetting, preferencesEditor } = useNavigator().media;
@@ -4616,7 +4683,11 @@ var StatefulAudioSkipForwardInterval = ({
4616
4683
  label: t("reader.playback.preferences.audio.skipForwardInterval"),
4617
4684
  presets: presets || [],
4618
4685
  formatOptions: { style: "unit", unit: "second" },
4619
- onEscape: () => dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false })),
4686
+ onEscape: () => {
4687
+ if (profile) {
4688
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
4689
+ }
4690
+ },
4620
4691
  value: skipForwardInterval,
4621
4692
  onChange: (v) => updatePreference(v)
4622
4693
  }
@@ -4631,7 +4702,11 @@ var StatefulAudioSkipForwardInterval = ({
4631
4702
  placeholder: placeholderText,
4632
4703
  presets: presets || [],
4633
4704
  formatOptions: { style: "unit", unit: "second" },
4634
- onEscape: () => dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false })),
4705
+ onEscape: () => {
4706
+ if (profile) {
4707
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
4708
+ }
4709
+ },
4635
4710
  value: skipForwardInterval,
4636
4711
  onChange: updatePreference,
4637
4712
  range: skipForwardIntervalRangeConfig.range,
@@ -4659,6 +4734,7 @@ var StatefulAudioSkipInterval = ({
4659
4734
  }) => {
4660
4735
  const { t } = useI18n();
4661
4736
  const { preferences } = useAudioPreferences();
4737
+ const profile = useAppSelector((state) => state.reader.profile);
4662
4738
  const skipInterval = useAppSelector((state) => state.audioSettings.skipInterval);
4663
4739
  const dispatch = useAppDispatch();
4664
4740
  const { submitPreferences, getSetting, preferencesEditor } = useNavigator().media;
@@ -4710,7 +4786,11 @@ var StatefulAudioSkipInterval = ({
4710
4786
  label: t("reader.playback.preferences.audio.skipInterval"),
4711
4787
  presets: presets || [],
4712
4788
  formatOptions: { style: "unit", unit: "second" },
4713
- onEscape: () => dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false })),
4789
+ onEscape: () => {
4790
+ if (profile) {
4791
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
4792
+ }
4793
+ },
4714
4794
  value: skipInterval,
4715
4795
  onChange: (v) => updatePreference(v)
4716
4796
  }
@@ -4725,7 +4805,11 @@ var StatefulAudioSkipInterval = ({
4725
4805
  placeholder: placeholderText,
4726
4806
  presets: presets || [],
4727
4807
  formatOptions: { style: "unit", unit: "second" },
4728
- onEscape: () => dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false })),
4808
+ onEscape: () => {
4809
+ if (profile) {
4810
+ dispatch(setActionOpen({ key: "settings" /* settings */, isOpen: false, profile }));
4811
+ }
4812
+ },
4729
4813
  value: skipInterval,
4730
4814
  onChange: updatePreference,
4731
4815
  range: skipIntervalRangeConfig.range,
@@ -4790,6 +4874,7 @@ var thorium_web_volume_default = {
4790
4874
  };
4791
4875
  var StatefulAudioVolumeTrigger = ({ ref }) => {
4792
4876
  const { t } = useI18n();
4877
+ const profile = useAppSelector((state) => state.reader.profile);
4793
4878
  const { preferences } = useAudioPreferences();
4794
4879
  const { preferencesEditor } = useNavigator().media;
4795
4880
  const volume = useAppSelector((state) => state.audioSettings.volume);
@@ -4812,7 +4897,11 @@ var StatefulAudioVolumeTrigger = ({ ref }) => {
4812
4897
  ref,
4813
4898
  tooltipLabel: t("reader.playback.preferences.audio.volume"),
4814
4899
  placement: "top",
4815
- onPress: () => dispatch(toggleActionOpen({ key: "audio.volume" /* volume */ })),
4900
+ onPress: () => {
4901
+ if (profile) {
4902
+ dispatch(toggleActionOpen({ key: "audio.volume" /* volume */, profile }));
4903
+ }
4904
+ },
4816
4905
  isDisabled,
4817
4906
  className: thorium_web_volume_default.button,
4818
4907
  children: /* @__PURE__ */ jsx(VolumeIcon, { "aria-hidden": "true", focusable: "false" })
@@ -4821,7 +4910,8 @@ var StatefulAudioVolumeTrigger = ({ ref }) => {
4821
4910
  };
4822
4911
  var StatefulAudioVolumeContainer = ({ triggerRef, placement = "top" }) => {
4823
4912
  const volume = useAppSelector((state) => state.audioSettings.volume);
4824
- const isOpen = useAppSelector((state) => state.actions.keys["audio.volume" /* volume */]?.isOpen ?? false);
4913
+ const profile = useAppSelector((state) => state.reader.profile);
4914
+ const isOpen = useAppSelector((state) => profile ? state.actions.keys[profile]["audio.volume" /* volume */]?.isOpen ?? false : false);
4825
4915
  const { t } = useI18n();
4826
4916
  const { preferences } = useAudioPreferences();
4827
4917
  const dispatch = useAppDispatch();
@@ -4837,8 +4927,10 @@ var StatefulAudioVolumeContainer = ({ triggerRef, placement = "top" }) => {
4837
4927
  const docking = useDocking("audio.volume" /* volume */);
4838
4928
  const sliderOrientation = docking.sheetType === "popover" /* popover */ || docking.sheetType === "compactPopover" /* compactPopover */ ? "vertical" : "horizontal";
4839
4929
  const setOpen = useCallback((open) => {
4840
- dispatch(setActionOpen({ key: "audio.volume" /* volume */, isOpen: open }));
4841
- }, [dispatch]);
4930
+ if (profile) {
4931
+ dispatch(setActionOpen({ key: "audio.volume" /* volume */, isOpen: open, profile }));
4932
+ }
4933
+ }, [dispatch, profile]);
4842
4934
  return /* @__PURE__ */ jsx(
4843
4935
  StatefulSheetWrapper,
4844
4936
  {
@@ -4885,6 +4977,7 @@ var thorium_web_playbackRate_default = {
4885
4977
  slider: "thorium_web_playbackRate_slider"};
4886
4978
  var StatefulAudioPlaybackRateTrigger = ({ ref }) => {
4887
4979
  const { t } = useI18n();
4980
+ const profile = useAppSelector((state) => state.reader.profile);
4888
4981
  const playbackRate = useAppSelector((state) => state.audioSettings.playbackRate);
4889
4982
  const isTrackReady = useAppSelector((state) => state.player.isTrackReady);
4890
4983
  const isStalled = useAppSelector((state) => state.player.isStalled);
@@ -4896,7 +4989,11 @@ var StatefulAudioPlaybackRateTrigger = ({ ref }) => {
4896
4989
  ref,
4897
4990
  tooltipLabel: t("reader.playback.preferences.playbackRate.descriptive"),
4898
4991
  placement: "top",
4899
- onPress: () => dispatch(toggleActionOpen({ key: "audio.playbackRate" /* playbackRate */ })),
4992
+ onPress: () => {
4993
+ if (profile) {
4994
+ dispatch(toggleActionOpen({ key: "audio.playbackRate" /* playbackRate */, profile }));
4995
+ }
4996
+ },
4900
4997
  isDisabled,
4901
4998
  className: thorium_web_playbackRate_default.button,
4902
4999
  children: [
@@ -4910,7 +5007,8 @@ var StatefulAudioPlaybackRateTrigger = ({ ref }) => {
4910
5007
  );
4911
5008
  };
4912
5009
  var StatefulAudioPlaybackRateContainer = ({ triggerRef, placement = "top" }) => {
4913
- const isOpen = useAppSelector((state) => state.actions.keys["audio.playbackRate" /* playbackRate */]?.isOpen ?? false);
5010
+ const profile = useAppSelector((state) => state.reader.profile);
5011
+ const isOpen = useAppSelector((state) => profile ? state.actions.keys[profile]["audio.playbackRate" /* playbackRate */]?.isOpen ?? false : false);
4914
5012
  const { t } = useI18n();
4915
5013
  const { preferences } = useAudioPreferences();
4916
5014
  const playbackRate = useAppSelector((state) => state.audioSettings.playbackRate);
@@ -4924,8 +5022,10 @@ var StatefulAudioPlaybackRateContainer = ({ triggerRef, placement = "top" }) =>
4924
5022
  }, [submitPreferences, getSetting, dispatch]);
4925
5023
  const docking = useDocking("audio.playbackRate" /* playbackRate */);
4926
5024
  const setOpen = useCallback((open) => {
4927
- dispatch(setActionOpen({ key: "audio.playbackRate" /* playbackRate */, isOpen: open }));
4928
- }, [dispatch]);
5025
+ if (profile) {
5026
+ dispatch(setActionOpen({ key: "audio.playbackRate" /* playbackRate */, isOpen: open, profile }));
5027
+ }
5028
+ }, [dispatch, profile]);
4929
5029
  const renderContent = () => {
4930
5030
  if (config.variant === "slider" /* slider */) {
4931
5031
  return /* @__PURE__ */ jsx("div", { className: thorium_web_playbackRate_default.slider, children: /* @__PURE__ */ jsx(
@@ -4992,6 +5092,7 @@ var thorium_web_audioToc_default = {
4992
5092
  };
4993
5093
  var StatefulAudioTocTrigger = ({ ref }) => {
4994
5094
  const { t } = useI18n();
5095
+ const profile = useAppSelector((state) => state.reader.profile);
4995
5096
  const isTrackReady = useAppSelector((state) => state.player.isTrackReady);
4996
5097
  const isStalled = useAppSelector((state) => state.player.isStalled);
4997
5098
  const isDisabled = !isTrackReady || isStalled;
@@ -5002,7 +5103,11 @@ var StatefulAudioTocTrigger = ({ ref }) => {
5002
5103
  ref,
5003
5104
  tooltipLabel: t("reader.tableOfContents.title"),
5004
5105
  placement: "top",
5005
- onPress: () => dispatch(toggleActionOpen({ key: "audio.toc" /* toc */ })),
5106
+ onPress: () => {
5107
+ if (profile) {
5108
+ dispatch(toggleActionOpen({ key: "audio.toc" /* toc */, profile }));
5109
+ }
5110
+ },
5006
5111
  isDisabled,
5007
5112
  className: thorium_web_audioToc_default.button,
5008
5113
  children: /* @__PURE__ */ jsx(toc_default, { "aria-hidden": "true", focusable: "false" })
@@ -5011,9 +5116,10 @@ var StatefulAudioTocTrigger = ({ ref }) => {
5011
5116
  };
5012
5117
  var StatefulAudioTocContainer = ({ triggerRef }) => {
5013
5118
  const { t } = useI18n();
5119
+ const profile = useAppSelector((state) => state.reader.profile);
5014
5120
  const { goLink } = useNavigator().unified;
5015
5121
  const dispatch = useAppDispatch();
5016
- const isOpen = useAppSelector((state) => state.actions.keys["audio.toc" /* toc */]?.isOpen ?? false);
5122
+ const isOpen = useAppSelector((state) => profile ? state.actions.keys[profile]["audio.toc" /* toc */]?.isOpen ?? false : false);
5017
5123
  const unstableTimeline = useAppSelector((state) => state.publication.unstableTimeline);
5018
5124
  const tocEntry = unstableTimeline?.toc?.currentEntry ?? void 0;
5019
5125
  const tocEntryId = tocEntry?.id;
@@ -5023,8 +5129,10 @@ var StatefulAudioTocContainer = ({ triggerRef }) => {
5023
5129
  const docking = useDocking("audio.toc" /* toc */);
5024
5130
  const sheetType = docking.sheetType;
5025
5131
  const setOpen = useCallback((value) => {
5026
- dispatch(setActionOpen({ key: "audio.toc" /* toc */, isOpen: value }));
5027
- }, [dispatch]);
5132
+ if (profile) {
5133
+ dispatch(setActionOpen({ key: "audio.toc" /* toc */, isOpen: value, profile }));
5134
+ }
5135
+ }, [dispatch, profile]);
5028
5136
  const { expandedKeys, setExpandedKeys, filterValue, setFilterValue, displayedTocTree, treeRef, searchInputRef } = useTocContent({ isOpen, tocTree, tocEntry: tocEntryId });
5029
5137
  useEffect(() => {
5030
5138
  if (isOpen) {
@@ -5113,6 +5221,7 @@ var thorium_web_sleepTimer_default = {
5113
5221
  };
5114
5222
  var StatefulAudioSleepTimerTrigger = ({ ref }) => {
5115
5223
  const { t } = useI18n();
5224
+ const profile = useAppSelector((state) => state.reader.profile);
5116
5225
  const remainingSeconds = useAppSelector((state) => state.player.sleepTimer.remainingSeconds);
5117
5226
  const onTrackEnd = useAppSelector((state) => state.player.sleepTimer.onTrackEnd);
5118
5227
  const onFragmentEnd = useAppSelector((state) => state.player.sleepTimer.onFragmentEnd);
@@ -5136,7 +5245,11 @@ var StatefulAudioSleepTimerTrigger = ({ ref }) => {
5136
5245
  ref,
5137
5246
  tooltipLabel: t("reader.playback.preferences.sleepTimer.descriptive"),
5138
5247
  placement: "top",
5139
- onPress: () => dispatch(toggleActionOpen({ key: "audio.sleepTimer" /* sleepTimer */ })),
5248
+ onPress: () => {
5249
+ if (profile) {
5250
+ dispatch(toggleActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, profile }));
5251
+ }
5252
+ },
5140
5253
  isDisabled,
5141
5254
  className: thorium_web_sleepTimer_default.button,
5142
5255
  children: [
@@ -5149,7 +5262,11 @@ var StatefulAudioSleepTimerTrigger = ({ ref }) => {
5149
5262
  var StatefulAudioSleepTimerContainer = ({ triggerRef, placement = "top" }) => {
5150
5263
  const [hours, setHours] = useState(0);
5151
5264
  const [minutes, setMinutes] = useState(0);
5152
- const isOpen = useAppSelector((state) => state.actions.keys["audio.sleepTimer" /* sleepTimer */]?.isOpen ?? false);
5265
+ const profile = useAppSelector((state) => state.reader.profile);
5266
+ const isOpen = useAppSelector((state) => {
5267
+ if (!profile || !state.actions.keys[profile]) return false;
5268
+ return state.actions.keys[profile]["audio.sleepTimer" /* sleepTimer */]?.isOpen ?? false;
5269
+ });
5153
5270
  const remainingSeconds = useAppSelector((state) => state.player.sleepTimer.remainingSeconds);
5154
5271
  const onTrackEnd = useAppSelector((state) => state.player.sleepTimer.onTrackEnd);
5155
5272
  const onFragmentEnd = useAppSelector((state) => state.player.sleepTimer.onFragmentEnd);
@@ -5188,14 +5305,18 @@ var StatefulAudioSleepTimerContainer = ({ triggerRef, placement = "top" }) => {
5188
5305
  dispatch(setSleepTimerRemainingSeconds(null));
5189
5306
  dispatch(setSleepTimerOnTrackEnd(false));
5190
5307
  dispatch(setSleepTimerOnFragmentEnd(false));
5191
- dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: false }));
5192
- }, [dispatch]);
5308
+ if (profile) {
5309
+ dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: false, profile }));
5310
+ }
5311
+ }, [dispatch, profile]);
5193
5312
  const handleStart = useCallback(() => {
5194
5313
  const totalSeconds = hours * 3600 + minutes * 60;
5195
5314
  if (totalSeconds <= 0) return;
5196
5315
  dispatch(setSleepTimerRemainingSeconds(totalSeconds));
5197
- dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: false }));
5198
- }, [hours, minutes, dispatch]);
5316
+ if (profile) {
5317
+ dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: false, profile }));
5318
+ }
5319
+ }, [hours, minutes, dispatch, profile]);
5199
5320
  const handlePresetSelect = useCallback((value) => {
5200
5321
  if (value === "endOfResource") {
5201
5322
  dispatch(setSleepTimerOnTrackEnd(true));
@@ -5210,12 +5331,16 @@ var StatefulAudioSleepTimerContainer = ({ triggerRef, placement = "top" }) => {
5210
5331
  dispatch(setSleepTimerOnFragmentEnd(false));
5211
5332
  dispatch(setSleepTimerRemainingSeconds(Number(value) * 60));
5212
5333
  }
5213
- dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: false }));
5214
- }, [dispatch]);
5334
+ if (profile) {
5335
+ dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: false, profile }));
5336
+ }
5337
+ }, [dispatch, profile]);
5215
5338
  const docking = useDocking("audio.sleepTimer" /* sleepTimer */);
5216
5339
  const setOpen = useCallback((open) => {
5217
- dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: open }));
5218
- }, [dispatch]);
5340
+ if (profile) {
5341
+ dispatch(setActionOpen({ key: "audio.sleepTimer" /* sleepTimer */, isOpen: open, profile }));
5342
+ }
5343
+ }, [dispatch, profile]);
5219
5344
  const isActive = remainingSeconds !== null || onTrackEnd || onFragmentEnd;
5220
5345
  const maxHours = (config.variant === "durationField" /* durationField */ ? config.maxHours : void 0) ?? 23;
5221
5346
  const renderContent = () => {
@@ -5420,7 +5545,7 @@ var createAudioDefaultPlugin = () => {
5420
5545
  id: "audio-core",
5421
5546
  name: "Audio Core Components",
5422
5547
  description: "Default components for Thorium Web Audio StatefulReader",
5423
- version: "1.3.0",
5548
+ version: "1.3.1",
5424
5549
  components: {
5425
5550
  actions: {
5426
5551
  ["settings" /* settings */]: {
@@ -5720,36 +5845,31 @@ var thorium_web_reader_app_default = {
5720
5845
  srOnly: "thorium_web_reader_app_srOnly"
5721
5846
  };
5722
5847
  var useResizablePanel = (panel) => {
5723
- const defaultPanel = {
5724
- actionKey: null,
5725
- active: false,
5726
- collapsed: false
5727
- };
5728
- const safePanel = panel || defaultPanel;
5729
5848
  const preferences = useActionsPreferences();
5730
5849
  const { theming } = useSharedPreferences();
5731
5850
  const defaultWidth = theming.layout.defaults.dockingWidth;
5732
5851
  const [pref, setPref] = useState(
5733
- safePanel.actionKey ? preferences.actionsKeys[safePanel.actionKey]?.docked || null : null
5852
+ panel?.actionKey ? preferences.actionsKeys[panel.actionKey]?.docked || null : null
5734
5853
  );
5735
- const actionsMap = useAppSelector((state) => state.actions.keys);
5736
- const actions = useActions(actionsMap);
5737
- const previouslyCollapsed = usePrevious(safePanel.collapsed);
5738
- const previousWidth = actions.getDockedWidth(safePanel.actionKey) || null;
5854
+ const profile = useAppSelector((state) => state.reader.profile);
5855
+ const actionsMap = useAppSelector((state) => profile ? state.actions.keys[profile] : void 0);
5856
+ const actions = useActions(actionsMap || {});
5857
+ const previouslyCollapsed = usePrevious(panel?.collapsed);
5858
+ const previousWidth = actions.getDockedWidth(panel?.actionKey) || null;
5739
5859
  const width = pref?.width || defaultWidth;
5740
5860
  const minWidth = pref?.minWidth && pref.minWidth < width ? pref.minWidth : defaultWidth < width ? defaultWidth : width;
5741
5861
  const maxWidth = pref?.maxWidth && pref.maxWidth > width ? pref.maxWidth : defaultWidth > width ? defaultWidth : width;
5742
5862
  const isPopulated = () => {
5743
- return safePanel.active && actions.isOpen(safePanel.actionKey);
5863
+ return !!(panel?.active && actions.isOpen(panel?.actionKey));
5744
5864
  };
5745
5865
  const isCollapsed = () => {
5746
- return safePanel.collapsed;
5866
+ return !!panel?.collapsed;
5747
5867
  };
5748
5868
  const forceExpand = () => {
5749
- return !!(isPopulated() && previouslyCollapsed && !safePanel.collapsed);
5869
+ return !!(isPopulated() && previouslyCollapsed && !panel?.collapsed);
5750
5870
  };
5751
5871
  const currentKey = () => {
5752
- return safePanel.actionKey;
5872
+ return panel?.actionKey ?? null;
5753
5873
  };
5754
5874
  const isResizable = () => {
5755
5875
  return isPopulated() ? Math.round(width) > Math.round(minWidth) && Math.round(width) < Math.round(maxWidth) : false;
@@ -5777,8 +5897,8 @@ var useResizablePanel = (panel) => {
5777
5897
  return current;
5778
5898
  }, [minWidth, maxWidth]);
5779
5899
  useEffect(() => {
5780
- setPref(safePanel.actionKey ? preferences.actionsKeys[safePanel.actionKey]?.docked || null : null);
5781
- }, [safePanel.actionKey, preferences]);
5900
+ setPref(panel?.actionKey ? preferences.actionsKeys[panel.actionKey]?.docked || null : null);
5901
+ }, [panel?.actionKey, preferences]);
5782
5902
  return {
5783
5903
  currentKey,
5784
5904
  isPopulated,
@@ -6122,14 +6242,17 @@ var useReaderHeaderBase = (actionKeys) => {
6122
6242
  const headerRef = useRef(null);
6123
6243
  const { t } = useI18n();
6124
6244
  const { actionsComponentsMap } = usePlugins();
6125
- const actionsMap = useAppSelector((state) => state.actions.keys);
6245
+ useAppSelector((state) => state.actions.keys);
6126
6246
  const overflowMap = useAppSelector((state) => state.actions.overflow);
6127
6247
  const isScroll = useAppSelector((state) => state.settings.scroll);
6128
6248
  const isImmersive = useAppSelector((state) => state.reader.isImmersive);
6129
6249
  const isHovering = useAppSelector((state) => state.reader.isHovering);
6130
6250
  const hasScrollAffordance = useAppSelector((state) => state.reader.hasScrollAffordance);
6131
6251
  const positionsList = useAppSelector((state) => state.publication.positionsList);
6132
- const actions = useActions({ ...actionsMap, ...overflowMap });
6252
+ const profile = useAppSelector((state) => state.reader.profile);
6253
+ const profileActionsMap = useAppSelector((state) => profile ? state.actions.keys[profile] : void 0);
6254
+ const mergedActionsMap = useMemo(() => ({ ...profileActionsMap, ...overflowMap }), [profileActionsMap, overflowMap]);
6255
+ const actions = useActions(mergedActionsMap);
6133
6256
  const dispatch = useAppDispatch();
6134
6257
  const { focusWithinProps } = useFocusWithin({
6135
6258
  onFocusWithin() {
@@ -6198,5 +6321,5 @@ var useReaderHeaderBase = (actionKeys) => {
6198
6321
  };
6199
6322
 
6200
6323
  export { NavigatorProvider, StatefulActionIcon, StatefulAudioAutoPlay, StatefulAudioPlaybackRateContainer, StatefulAudioPlaybackRateTrigger, StatefulAudioRemotePlaybackTrigger, StatefulAudioSettingsContainer, StatefulAudioSkipBackwardInterval, StatefulAudioSkipForwardInterval, StatefulAudioSkipInterval, StatefulAudioSleepTimerContainer, StatefulAudioSleepTimerTrigger, StatefulAudioTocContainer, StatefulAudioTocTrigger, StatefulAudioVolumeContainer, StatefulAudioVolumeTrigger, StatefulBackLink, StatefulBottomSheet, StatefulCollapsibleActionsBar, StatefulColumns, StatefulCompactPopoverSheet, StatefulDockedSheet, StatefulDockingWrapper, StatefulDropdown, StatefulFontFamily, StatefulFullScreenSheet, StatefulFullscreenTrigger, StatefulGroupWrapper, StatefulHyphens, StatefulJumpToPositionContainer, StatefulJumpToPositionTrigger, StatefulLayout, StatefulLetterSpacing, StatefulLineHeight, StatefulModalBase, StatefulModalSheet, StatefulNumberField, StatefulOverflowMenu, StatefulOverflowMenuItem, StatefulParagraphIndent, StatefulParagraphSpacing, StatefulPopoverSheet, StatefulPreferencesProvider, StatefulPublisherStyles, StatefulRadioGroup, StatefulSettingsTrigger, StatefulSettingsWrapper, StatefulSheetWrapper, StatefulSlider, StatefulSliderWithPresets, StatefulSpacingGroup, StatefulSpacingGroupContainer, StatefulSpacingPresets, StatefulSwitch, StatefulTextAlign, StatefulTextGroup, StatefulTextGroupContainer, StatefulTextNormalize, StatefulTheme, StatefulTocContainer, StatefulTocTrigger, StatefulVisualSettingsContainer, StatefulWordSpacing, StatefulZoom, UnstableStatefulFontWeight, createAudioDefaultPlugin, createDefaultPlugin, thorium_web_button_default, thorium_web_overflow_default, thorium_web_reader_app_default, thorium_web_reader_header_default, useDocking, useEffectiveRange, useGridNavigation, useGridTemplate, useLineHeight, useNavigator, usePositionStorage, usePublication, useReaderHeaderBase, useReaderTransitions, useSettingsComponentStatus, useSpacingPresets };
6201
- //# sourceMappingURL=chunk-D7MFLHXV.mjs.map
6202
- //# sourceMappingURL=chunk-D7MFLHXV.mjs.map
6324
+ //# sourceMappingURL=chunk-LP3JFZ4A.mjs.map
6325
+ //# sourceMappingURL=chunk-LP3JFZ4A.mjs.map