accessibility-plugin-react 2.13.0 → 2.16.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
@@ -24,7 +24,7 @@ function styleInject(css, { insertAt } = {}) {
24
24
  }
25
25
 
26
26
  // src/styles/tailwind.css
27
- styleInject('.arap-root {\n --arap-surface: #fff;\n --arap-text: #111827;\n --arap-muted: #475569;\n --arap-border: #cbd5e1;\n --arap-divider: #e2e8f0;\n --arap-accent: #1d4ed8;\n --arap-accent-hover: #1e40af;\n --arap-selected: #eff6ff;\n --arap-control: #f8fafc;\n color-scheme: light;\n font: 15px/1.5 system-ui, sans-serif;\n color: var(--arap-text);\n text-align: left;\n letter-spacing: normal;\n}\n.arap-root *,\n.arap-root *::before,\n.arap-root *::after {\n box-sizing: border-box;\n}\n.arap-root button {\n font: inherit;\n cursor: pointer;\n color: inherit;\n text-transform: none;\n letter-spacing: normal;\n transition: background-color 0.15s, border-color 0.15s;\n}\n.arap-root button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.arap-root button:focus-visible,\n.arap-panel:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 3px;\n}\n.arap-root .arap-btn {\n position: fixed;\n z-index: 2147483001;\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n width: 56px;\n height: 56px;\n padding: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 2px solid var(--arap-surface);\n border-radius: 50%;\n background: var(--arap-accent);\n color: #fff;\n box-shadow: 0 4px 12px #0f172a26, 0 10px 24px #0f172a14;\n}\n.arap-root .arap-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-root .arap-btn[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-position=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-panel {\n position: fixed;\n z-index: 2147483000;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n right: max(16px, env(safe-area-inset-right));\n width: min(400px, calc(100vw - 32px));\n max-height: calc(100vh - 120px);\n max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 20px;\n border: 1px solid var(--arap-divider);\n border-radius: 16px;\n background: var(--arap-surface);\n box-shadow: 0 8px 16px #0f172a0d, 0 20px 48px #0f172a1a;\n}\n.arap-root .arap-panel[hidden] {\n display: none !important;\n}\n.arap-root .arap-panel[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-panel[data-position=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-heading {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 8px;\n padding-bottom: 18px;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-heading-copy {\n min-width: 0;\n}\n.arap-heading h2 {\n margin: 0;\n font: 700 22px/1.3 system-ui, sans-serif;\n letter-spacing: -0.025em;\n color: var(--arap-text);\n overflow-wrap: anywhere;\n}\n.arap-description {\n margin: 6px 0 0;\n color: var(--arap-muted);\n font: 14px/1.5 system-ui, sans-serif;\n overflow-wrap: anywhere;\n}\n.arap-heading button {\n flex: none;\n width: 44px;\n height: 44px;\n margin-top: -6px;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--arap-muted);\n font-size: 28px;\n line-height: 1;\n}\n.arap-heading button:hover {\n background: var(--arap-control);\n border-color: var(--arap-border);\n}\n.arap-feature {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 10px 12px;\n padding: 18px 0;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-feature:last-child {\n border: 0;\n padding-bottom: 0;\n}\n.arap-label {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: 500;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.arap-icon {\n flex: none;\n width: 22px;\n height: 22px;\n display: inline-block;\n vertical-align: middle;\n}\n.arap-controls {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--arap-border);\n border-radius: 9px;\n overflow: hidden;\n background: var(--arap-control);\n}\n.arap-root .arap-btn-sm {\n flex: none;\n width: 44px;\n height: 44px;\n border: 0;\n border-radius: 0;\n background: transparent;\n font-size: 22px;\n}\n.arap-root .arap-btn-sm:hover:not(:disabled) {\n background: var(--arap-selected);\n color: var(--arap-accent);\n}\n.arap-root .arap-controls button:focus-visible {\n outline-offset: -4px;\n}\n.arap-value {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 56px;\n padding: 0 6px;\n text-align: center;\n font-weight: 600;\n border-inline: 1px solid var(--arap-divider);\n background: var(--arap-surface);\n}\n.arap-segmented {\n grid-column: 1 / -1;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.arap-root .arap-segment {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-muted);\n overflow-wrap: anywhere;\n}\n.arap-root .arap-segment:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-root .arap-segment-active {\n background: var(--arap-accent);\n color: #fff;\n border-color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-segment-active:hover {\n background: var(--arap-accent-hover);\n color: #fff;\n}\n.arap-check {\n flex: none;\n font-size: 15px;\n line-height: 1;\n}\n.arap-root .arap-toggle {\n position: relative;\n width: 56px;\n height: 44px;\n padding: 0;\n border: 0;\n border-radius: 10px;\n background: transparent;\n}\n.arap-toggle::before {\n content: "";\n position: absolute;\n inset: 6px 0;\n border: 2px solid #64748b;\n border-radius: 20px;\n background: #e2e8f0;\n}\n.arap-toggle-knob {\n position: absolute;\n top: 10px;\n left: 4px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background: #475569;\n pointer-events: none;\n transition: transform 0.15s;\n}\n.arap-toggle-active::before {\n background: var(--arap-accent);\n border-color: var(--arap-accent);\n}\n.arap-toggle-active .arap-toggle-knob {\n transform: translateX(24px);\n background: #fff;\n}\n.arap-toggle-active .arap-toggle-knob::after {\n content: "\\2713";\n display: block;\n color: var(--arap-accent);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n text-align: center;\n}\n.arap-root .arap-toggle:hover::before {\n border-color: var(--arap-accent);\n}\n.arap-feature-reset {\n display: block;\n}\n.arap-root .arap-reset-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n min-height: 48px;\n padding: 10px;\n border: 1px solid var(--arap-border);\n border-radius: 10px;\n background: var(--arap-control);\n color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-reset-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n@media (max-width: 380px) {\n .arap-root .arap-panel {\n padding: 16px;\n }\n .arap-heading h2 {\n font-size: 20px;\n }\n .arap-feature-stepper {\n grid-template-columns: minmax(0, 1fr);\n }\n .arap-controls {\n width: 100%;\n }\n .arap-value {\n flex: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-root *,\n .arap-root *::before,\n .arap-root *::after {\n transition: none !important;\n animation: none !important;\n }\n}\n@media (forced-colors: active) {\n .arap-root {\n --arap-surface: Canvas;\n --arap-text: CanvasText;\n --arap-muted: CanvasText;\n --arap-border: ButtonText;\n --arap-divider: ButtonText;\n --arap-accent: Highlight;\n --arap-control: Canvas;\n --arap-selected: Canvas;\n }\n .arap-root button[aria-pressed=true] {\n outline: 2px solid Highlight;\n outline-offset: -4px;\n }\n .arap-root .arap-segment-active {\n color: HighlightText;\n background: Highlight;\n }\n .arap-toggle::before {\n border-color: ButtonText;\n background: Canvas;\n }\n .arap-toggle-knob {\n background: ButtonText;\n }\n .arap-toggle-active .arap-toggle-knob {\n background: Highlight;\n }\n .arap-toggle-active .arap-toggle-knob::after {\n color: HighlightText;\n }\n}\n.arap-root .arap-panel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n}\n.arap-heading {\n flex: none;\n}\n.arap-tools {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 0 3px;\n margin: 0 -3px;\n}\n.arap-tools:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: -3px;\n}\n.arap-quick-actions {\n position: relative;\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n padding-top: 14px;\n margin-top: 8px;\n border-top: 1px solid var(--arap-divider);\n}\n.arap-actions {\n flex: 1;\n min-width: 0;\n}\n.arap-actions:empty {\n display: none;\n}\n.arap-actions .arap-feature-reset {\n padding: 0;\n margin: 0;\n border: 0;\n}\n.arap-root .arap-position-button,\n.arap-root .arap-position-default,\n.arap-root .arap-position-arrows button {\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-accent);\n}\n.arap-root .arap-position-button:hover,\n.arap-root .arap-position-default:hover,\n.arap-root .arap-position-arrows button:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-position-popover {\n position: absolute;\n z-index: 1;\n bottom: calc(100% + 8px);\n left: 0;\n width: 100%;\n max-height: calc(100dvh - 160px);\n overflow: auto;\n padding: 14px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n box-shadow: 0 8px 24px #0f172a26;\n}\n.arap-position-popover[hidden] {\n display: none !important;\n}\n.arap-position-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.arap-position-popover select {\n width: 100%;\n min-height: 44px;\n padding: 8px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n font: inherit;\n color: var(--arap-text);\n background: var(--arap-surface);\n}\n.arap-position-popover select:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-position-arrows {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 10px;\n}\n.arap-position-default {\n width: 100%;\n margin-top: 8px;\n}\n.arap-root .arap-btn[data-draggable=true] {\n touch-action: none;\n user-select: none;\n cursor: grab;\n}\n.arap-root .arap-btn[data-dragging=true] {\n cursor: grabbing;\n}\n.arap-root .arap-btn[data-corner$=left],\n.arap-root .arap-panel[data-corner$=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-corner$=right],\n.arap-root .arap-panel[data-corner$=right] {\n left: auto;\n right: max(16px, env(safe-area-inset-right));\n}\n.arap-root .arap-btn[data-corner^=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-btn[data-corner^=bottom] {\n top: auto;\n bottom: max(16px, env(safe-area-inset-bottom));\n}\n.arap-root .arap-panel[data-corner^=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-root .arap-panel[data-corner^=bottom] {\n top: auto;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n}\n.arap-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.arap-root .arap-skip-actions {\n position: absolute;\n top: 12px;\n left: 20px;\n width: 44px;\n height: 44px;\n clip-path: inset(50%);\n overflow: hidden;\n pointer-events: none;\n}\n.arap-root .arap-skip-actions:focus-visible {\n right: 20px;\n width: auto;\n height: auto;\n min-height: 44px;\n clip-path: none;\n pointer-events: auto;\n z-index: 2;\n padding: 8px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-accent);\n}\n.arap-skip-to-main {\n position: fixed;\n top: 12px;\n left: 16px;\n z-index: 2147483647;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n pointer-events: none;\n font-family: inherit;\n font-size: 0.9375rem;\n font-weight: 600;\n text-decoration: none;\n color: var(--arap-accent, #008060);\n background: var(--arap-surface, #ffffff);\n border-radius: 8px;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.arap-skip-to-main:focus,\n.arap-skip-to-main:focus-visible {\n width: auto;\n height: auto;\n min-height: 44px;\n margin: 0;\n padding: 10px 18px;\n clip-path: none;\n overflow: visible;\n white-space: normal;\n pointer-events: auto;\n border: 2px solid var(--arap-accent, #008060);\n outline: 3px solid var(--arap-accent, #008060);\n outline-offset: 3px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n@media (forced-colors: active) {\n .arap-skip-to-main {\n background: Canvas;\n color: CanvasText;\n border-color: Highlight;\n }\n .arap-skip-to-main:focus,\n .arap-skip-to-main:focus-visible {\n outline: 3px solid Highlight;\n }\n}\n@media (max-height: 480px) {\n .arap-root .arap-panel {\n top: max(16px, env(safe-area-inset-top)) !important;\n bottom: max(16px, env(safe-area-inset-bottom)) !important;\n max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;\n padding: 8px;\n }\n .arap-heading {\n padding-bottom: 8px;\n }\n .arap-heading h2 {\n font-size: 18px;\n }\n .arap-heading button {\n margin-top: 0;\n }\n .arap-description {\n display: none;\n }\n .arap-quick-actions {\n padding-top: 8px;\n margin-top: 0;\n }\n .arap-root .arap-reset-btn {\n min-height: 44px;\n }\n .arap-root .arap-btn[data-open=true] {\n visibility: hidden;\n }\n .arap-position-popover {\n max-height: calc(100dvh - 96px);\n }\n}\n.arap-statement {\n flex: none;\n padding-top: 10px;\n text-align: center;\n}\n.arap-statement-link {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 44px;\n padding: 6px 12px;\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 4px;\n font-size: 14px;\n font-weight: 500;\n border-radius: 8px;\n}\n.arap-statement-link:hover {\n color: var(--arap-accent-hover);\n background: var(--arap-selected);\n}\n.arap-statement-link:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-credits {\n display: flex;\n flex: none;\n flex-direction: column;\n gap: 2px;\n padding-top: 8px;\n color: var(--arap-muted);\n text-align: center;\n font-size: 11px;\n line-height: 1.4;\n}\n.arap-credits a {\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.arap-credits a:hover {\n color: var(--arap-accent-hover);\n}\n.arap-credits a:focus-visible {\n outline: 2px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-root .arap-btn[data-large-controls=true] {\n width: 64px;\n height: 64px;\n min-width: 48px;\n min-height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] {\n width: min(440px, calc(100vw - 32px));\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-heading button {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 32px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-btn-sm {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 24px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-value {\n min-width: 64px;\n font-size: 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-segment {\n min-width: 48px;\n min-height: 48px;\n padding: 10px 14px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle {\n width: 64px;\n height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle::before {\n inset: 8px 0;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-knob {\n top: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-active .arap-toggle-knob {\n transform: translateX(28px);\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-reset-btn {\n min-height: 52px;\n font-size: 16px;\n padding: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-button,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-default,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-arrows button {\n min-width: 48px;\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-popover select {\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-statement-link {\n min-height: 48px;\n font-size: 15px;\n padding: 10px 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-skip-actions {\n min-width: 48px;\n min-height: 48px;\n}\n.arap-feature-card {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: 12px;\n}\n.arap-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-card-title {\n font-weight: 600;\n font-size: 15px;\n color: var(--arap-text);\n}\n.arap-card-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-status-badge {\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 11px;\n font-weight: 600;\n background: var(--arap-control);\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-card-alert {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 10px 12px;\n border-radius: 8px;\n font-size: 13px;\n line-height: 1.4;\n}\n.arap-alert-icon {\n flex: none;\n font-size: 16px;\n line-height: 1;\n}\n.arap-card-error {\n background: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n}\n.arap-card-unavailable {\n background: #f8fafc;\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n}\n.arap-card-permission {\n background: #fffbeb;\n border: 1px solid #fde68a;\n color: #92400e;\n}\n.arap-permission-content {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-permission-btn {\n align-self: flex-start;\n padding: 4px 10px;\n border: 1px solid #d97706;\n border-radius: 6px;\n background: #f59e0b;\n color: #fff;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n}\n.arap-permission-btn:hover {\n background: #d97706;\n}\n.arap-card-content {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.arap-choice-group {\n display: flex;\n flex-direction: column;\n gap: 6px;\n width: 100%;\n}\n.arap-choice-group-title {\n font-size: 12px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-choice-badge {\n font-size: 11px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--arap-divider);\n color: var(--arap-muted);\n}\n.arap-segment-active .arap-choice-badge {\n background: rgba(255, 255, 255, 0.25);\n color: #fff;\n}\n.arap-stepper-control-wrapper {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n}\n.arap-slider-container {\n display: flex;\n align-items: center;\n padding: 4px 0;\n}\n.arap-slider {\n width: 100%;\n accent-color: var(--arap-accent);\n cursor: pointer;\n}\n.arap-search-count {\n padding: 6px 0;\n font-size: 12px;\n font-weight: 500;\n color: var(--arap-muted);\n}\n.arap-empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 24px 16px;\n gap: 8px;\n}\n.arap-empty-icon {\n font-size: 32px;\n}\n.arap-empty-title {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-empty-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n}\n.arap-empty-btn,\n.arap-retry-btn {\n margin-top: 6px;\n padding: 8px 16px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n font-weight: 500;\n font-size: 13px;\n color: var(--arap-text);\n cursor: pointer;\n}\n.arap-empty-btn:hover,\n.arap-retry-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n color: var(--arap-accent);\n}\n.arap-profile-card {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n transition: border-color 0.15s, box-shadow 0.15s;\n}\n.arap-profile-card-active {\n border-color: var(--arap-accent);\n background: var(--arap-selected);\n box-shadow: 0 0 0 1px var(--arap-accent);\n}\n.arap-profile-header {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.arap-profile-title-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-profile-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-profile-active-badge {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-accent);\n background: #dbeafe;\n padding: 2px 8px;\n border-radius: 9999px;\n}\n.arap-profile-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-profile-affected {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-profile-affected-label {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-profile-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.arap-profile-chip {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 8px;\n border-radius: 6px;\n background: var(--arap-control);\n border: 1px solid var(--arap-divider);\n font-size: 12px;\n color: var(--arap-text);\n}\n.arap-profile-actions {\n display: flex;\n gap: 8px;\n margin-top: 4px;\n}\n.arap-profile-apply-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-accent);\n color: #fff;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-apply-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-profile-revert-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-muted);\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-revert-btn:hover {\n background: var(--arap-control);\n color: var(--arap-text);\n border-color: var(--arap-text);\n}\n.arap-notice {\n grid-column: 1 / -1;\n margin-top: 6px;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 12px;\n line-height: 1.45;\n background: #fefce8;\n border: 1px solid #fef08a;\n color: #854d0e;\n}\n.arap-notice-warning {\n background: #fffbeb;\n border-color: #fde68a;\n color: #92400e;\n}\n.arap-reading-mask {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-reading-guide {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-feature-expandable {\n flex-direction: column !important;\n align-items: stretch !important;\n}\n.arap-accessible-tooltip {\n position: fixed !important;\n z-index: 2147483646 !important;\n max-width: 320px !important;\n min-width: 48px !important;\n box-sizing: border-box !important;\n padding: 6px 12px !important;\n background: #0f172a !important;\n color: #ffffff !important;\n font-family:\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n sans-serif !important;\n font-size: 13px !important;\n line-height: 1.4 !important;\n font-weight: 500 !important;\n border-radius: 6px !important;\n box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.15) !important;\n pointer-events: auto !important;\n word-break: break-word !important;\n white-space: normal !important;\n opacity: 0 !important;\n visibility: hidden !important;\n transition: opacity 120ms ease, transform 120ms ease !important;\n transform: translateY(2px) !important;\n}\n.arap-accessible-tooltip[data-visible=true] {\n opacity: 1 !important;\n visibility: visible !important;\n transform: translateY(0) !important;\n}\n.arap-accessible-tooltip[data-placement=top] {\n transform: translateY(-2px) !important;\n}\n.arap-accessible-tooltip[data-placement=top][data-visible=true] {\n transform: translateY(0) !important;\n}\n@media (forced-colors: active) {\n .arap-accessible-tooltip {\n background: Canvas !important;\n color: CanvasText !important;\n border: 2px solid Highlight !important;\n box-shadow: none !important;\n }\n}\n');
27
+ styleInject('.arap-root {\n --arap-surface: #fff;\n --arap-text: #111827;\n --arap-muted: #475569;\n --arap-border: #cbd5e1;\n --arap-divider: #e2e8f0;\n --arap-accent: #1d4ed8;\n --arap-accent-hover: #1e40af;\n --arap-selected: #eff6ff;\n --arap-control: #f8fafc;\n color-scheme: light;\n font: 15px/1.5 system-ui, sans-serif;\n color: var(--arap-text);\n text-align: left;\n letter-spacing: normal;\n}\n.arap-root *,\n.arap-root *::before,\n.arap-root *::after {\n box-sizing: border-box;\n}\n.arap-root button {\n font: inherit;\n cursor: pointer;\n color: inherit;\n text-transform: none;\n letter-spacing: normal;\n transition: background-color 0.15s, border-color 0.15s;\n}\n.arap-root button:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.arap-root button:focus-visible,\n.arap-panel:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 3px;\n}\n.arap-root .arap-btn {\n position: fixed;\n z-index: 2147483001;\n bottom: max(16px, env(safe-area-inset-bottom));\n right: max(16px, env(safe-area-inset-right));\n width: 56px;\n height: 56px;\n padding: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: 2px solid var(--arap-surface);\n border-radius: 50%;\n background: var(--arap-accent);\n color: #fff;\n box-shadow: 0 4px 12px #0f172a26, 0 10px 24px #0f172a14;\n}\n.arap-root .arap-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-root .arap-btn[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-position=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-panel {\n position: fixed;\n z-index: 2147483000;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n right: max(16px, env(safe-area-inset-right));\n width: min(400px, calc(100vw - 32px));\n max-height: calc(100vh - 120px);\n max-height: calc(100dvh - 120px - env(safe-area-inset-bottom));\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 20px;\n border: 1px solid var(--arap-divider);\n border-radius: 16px;\n background: var(--arap-surface);\n box-shadow: 0 8px 16px #0f172a0d, 0 20px 48px #0f172a1a;\n}\n.arap-root .arap-panel[hidden] {\n display: none !important;\n}\n.arap-root .arap-panel[data-position=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-panel[data-position=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-heading {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 8px;\n padding-bottom: 18px;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-heading-copy {\n min-width: 0;\n}\n.arap-heading h2 {\n margin: 0;\n font: 700 22px/1.3 system-ui, sans-serif;\n letter-spacing: -0.025em;\n color: var(--arap-text);\n overflow-wrap: anywhere;\n}\n.arap-description {\n margin: 6px 0 0;\n color: var(--arap-muted);\n font: 14px/1.5 system-ui, sans-serif;\n overflow-wrap: anywhere;\n}\n.arap-heading button {\n flex: none;\n width: 44px;\n height: 44px;\n margin-top: -6px;\n border: 1px solid transparent;\n border-radius: 8px;\n background: transparent;\n color: var(--arap-muted);\n font-size: 28px;\n line-height: 1;\n}\n.arap-heading button:hover {\n background: var(--arap-control);\n border-color: var(--arap-border);\n}\n.arap-feature {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 10px 12px;\n padding: 18px 0;\n border-bottom: 1px solid var(--arap-divider);\n}\n.arap-feature:last-child {\n border: 0;\n padding-bottom: 0;\n}\n.arap-label {\n display: flex;\n align-items: center;\n gap: 10px;\n font-weight: 500;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.arap-icon {\n flex: none;\n width: 22px;\n height: 22px;\n display: inline-block;\n vertical-align: middle;\n}\n.arap-controls {\n display: flex;\n align-items: stretch;\n border: 1px solid var(--arap-border);\n border-radius: 9px;\n overflow: hidden;\n background: var(--arap-control);\n}\n.arap-root .arap-btn-sm {\n flex: none;\n width: 44px;\n height: 44px;\n border: 0;\n border-radius: 0;\n background: transparent;\n font-size: 22px;\n}\n.arap-root .arap-btn-sm:hover:not(:disabled) {\n background: var(--arap-selected);\n color: var(--arap-accent);\n}\n.arap-root .arap-controls button:focus-visible {\n outline-offset: -4px;\n}\n.arap-value {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 56px;\n padding: 0 6px;\n text-align: center;\n font-weight: 600;\n border-inline: 1px solid var(--arap-divider);\n background: var(--arap-surface);\n}\n.arap-segmented {\n grid-column: 1 / -1;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.arap-root .arap-segment {\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-muted);\n overflow-wrap: anywhere;\n}\n.arap-root .arap-segment:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-root .arap-segment-active {\n background: var(--arap-accent);\n color: #fff;\n border-color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-segment-active:hover {\n background: var(--arap-accent-hover);\n color: #fff;\n}\n.arap-check {\n flex: none;\n font-size: 15px;\n line-height: 1;\n}\n.arap-root .arap-toggle {\n position: relative;\n width: 56px;\n height: 44px;\n padding: 0;\n border: 0;\n border-radius: 10px;\n background: transparent;\n}\n.arap-toggle::before {\n content: "";\n position: absolute;\n inset: 6px 0;\n border: 2px solid #64748b;\n border-radius: 20px;\n background: #e2e8f0;\n}\n.arap-toggle-knob {\n position: absolute;\n top: 10px;\n left: 4px;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background: #475569;\n pointer-events: none;\n transition: transform 0.15s;\n}\n.arap-toggle-active::before {\n background: var(--arap-accent);\n border-color: var(--arap-accent);\n}\n.arap-toggle-active .arap-toggle-knob {\n transform: translateX(24px);\n background: #fff;\n}\n.arap-toggle-active .arap-toggle-knob::after {\n content: "\\2713";\n display: block;\n color: var(--arap-accent);\n font-size: 16px;\n font-weight: 700;\n line-height: 24px;\n text-align: center;\n}\n.arap-root .arap-toggle:hover::before {\n border-color: var(--arap-accent);\n}\n.arap-feature-reset {\n display: block;\n}\n.arap-root .arap-reset-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n min-height: 48px;\n padding: 10px;\n border: 1px solid var(--arap-border);\n border-radius: 10px;\n background: var(--arap-control);\n color: var(--arap-accent);\n font-weight: 600;\n}\n.arap-root .arap-reset-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n@media (max-width: 380px) {\n .arap-root .arap-panel {\n padding: 16px;\n }\n .arap-heading h2 {\n font-size: 20px;\n }\n .arap-feature-stepper {\n grid-template-columns: minmax(0, 1fr);\n }\n .arap-controls {\n width: 100%;\n }\n .arap-value {\n flex: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-root *,\n .arap-root *::before,\n .arap-root *::after {\n transition: none !important;\n animation: none !important;\n }\n}\n@media (forced-colors: active) {\n .arap-root {\n --arap-surface: Canvas;\n --arap-text: CanvasText;\n --arap-muted: CanvasText;\n --arap-border: ButtonText;\n --arap-divider: ButtonText;\n --arap-accent: Highlight;\n --arap-control: Canvas;\n --arap-selected: Canvas;\n }\n .arap-root button[aria-pressed=true] {\n outline: 2px solid Highlight;\n outline-offset: -4px;\n }\n .arap-root .arap-segment-active {\n color: HighlightText;\n background: Highlight;\n }\n .arap-toggle::before {\n border-color: ButtonText;\n background: Canvas;\n }\n .arap-toggle-knob {\n background: ButtonText;\n }\n .arap-toggle-active .arap-toggle-knob {\n background: Highlight;\n }\n .arap-toggle-active .arap-toggle-knob::after {\n color: HighlightText;\n }\n}\n.arap-root .arap-panel {\n display: flex;\n flex-direction: column;\n overflow: visible;\n}\n.arap-heading {\n flex: none;\n}\n.arap-tools {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n scrollbar-width: thin;\n scrollbar-color: var(--arap-border) transparent;\n padding: 0 3px;\n margin: 0 -3px;\n}\n.arap-tools:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: -3px;\n}\n.arap-quick-actions {\n position: relative;\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n padding-top: 14px;\n margin-top: 8px;\n border-top: 1px solid var(--arap-divider);\n}\n.arap-actions {\n flex: 1;\n min-width: 0;\n}\n.arap-actions:empty {\n display: none;\n}\n.arap-actions .arap-feature-reset {\n padding: 0;\n margin: 0;\n border: 0;\n}\n.arap-root .arap-position-button,\n.arap-root .arap-position-default,\n.arap-root .arap-position-arrows button {\n min-width: 44px;\n min-height: 44px;\n padding: 8px 10px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n color: var(--arap-accent);\n}\n.arap-root .arap-position-button:hover,\n.arap-root .arap-position-default:hover,\n.arap-root .arap-position-arrows button:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n}\n.arap-position-popover {\n position: absolute;\n z-index: 1;\n bottom: calc(100% + 8px);\n left: 0;\n width: 100%;\n max-height: calc(100dvh - 160px);\n overflow: auto;\n padding: 14px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n box-shadow: 0 8px 24px #0f172a26;\n}\n.arap-position-popover[hidden] {\n display: none !important;\n}\n.arap-position-label {\n display: block;\n margin-bottom: 6px;\n font-weight: 600;\n}\n.arap-position-popover select {\n width: 100%;\n min-height: 44px;\n padding: 8px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n font: inherit;\n color: var(--arap-text);\n background: var(--arap-surface);\n}\n.arap-position-popover select:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-position-arrows {\n display: flex;\n justify-content: space-between;\n gap: 6px;\n margin-top: 10px;\n}\n.arap-position-default {\n width: 100%;\n margin-top: 8px;\n}\n.arap-root .arap-btn[data-draggable=true] {\n touch-action: none;\n user-select: none;\n cursor: grab;\n}\n.arap-root .arap-btn[data-dragging=true] {\n cursor: grabbing;\n}\n.arap-root .arap-btn[data-corner$=left],\n.arap-root .arap-panel[data-corner$=left] {\n right: auto;\n left: max(16px, env(safe-area-inset-left));\n}\n.arap-root .arap-btn[data-corner$=right],\n.arap-root .arap-panel[data-corner$=right] {\n left: auto;\n right: max(16px, env(safe-area-inset-right));\n}\n.arap-root .arap-btn[data-corner^=top] {\n bottom: auto;\n top: max(16px, env(safe-area-inset-top));\n}\n.arap-root .arap-btn[data-corner^=bottom] {\n top: auto;\n bottom: max(16px, env(safe-area-inset-bottom));\n}\n.arap-root .arap-panel[data-corner^=top] {\n bottom: auto;\n top: max(88px, calc(env(safe-area-inset-top) + 72px));\n}\n.arap-root .arap-panel[data-corner^=bottom] {\n top: auto;\n bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));\n}\n.arap-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n.arap-root .arap-skip-actions {\n position: absolute;\n top: 12px;\n left: 20px;\n width: 44px;\n height: 44px;\n clip-path: inset(50%);\n overflow: hidden;\n pointer-events: none;\n}\n.arap-root .arap-skip-actions:focus-visible {\n right: 20px;\n width: auto;\n height: auto;\n min-height: 44px;\n clip-path: none;\n pointer-events: auto;\n z-index: 2;\n padding: 8px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-accent);\n}\n.arap-skip-to-main {\n position: fixed;\n top: 12px;\n left: 16px;\n z-index: 2147483647;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n pointer-events: none;\n font-family: inherit;\n font-size: 0.9375rem;\n font-weight: 600;\n text-decoration: none;\n color: var(--arap-accent, #008060);\n background: var(--arap-surface, #ffffff);\n border-radius: 8px;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.arap-skip-to-main:focus,\n.arap-skip-to-main:focus-visible {\n width: auto;\n height: auto;\n min-height: 44px;\n margin: 0;\n padding: 10px 18px;\n clip-path: none;\n overflow: visible;\n white-space: normal;\n pointer-events: auto;\n border: 2px solid var(--arap-accent, #008060);\n outline: 3px solid var(--arap-accent, #008060);\n outline-offset: 3px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n@media (forced-colors: active) {\n .arap-skip-to-main {\n background: Canvas;\n color: CanvasText;\n border-color: Highlight;\n }\n .arap-skip-to-main:focus,\n .arap-skip-to-main:focus-visible {\n outline: 3px solid Highlight;\n }\n}\n@media (max-height: 480px) {\n .arap-root .arap-panel {\n top: max(16px, env(safe-area-inset-top)) !important;\n bottom: max(16px, env(safe-area-inset-bottom)) !important;\n max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;\n padding: 8px;\n }\n .arap-heading {\n padding-bottom: 8px;\n }\n .arap-heading h2 {\n font-size: 18px;\n }\n .arap-heading button {\n margin-top: 0;\n }\n .arap-description {\n display: none;\n }\n .arap-quick-actions {\n padding-top: 8px;\n margin-top: 0;\n }\n .arap-root .arap-reset-btn {\n min-height: 44px;\n }\n .arap-root .arap-btn[data-open=true] {\n visibility: hidden;\n }\n .arap-position-popover {\n max-height: calc(100dvh - 96px);\n }\n}\n.arap-statement {\n flex: none;\n padding-top: 10px;\n text-align: center;\n}\n.arap-statement-link {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 44px;\n padding: 6px 12px;\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 4px;\n font-size: 14px;\n font-weight: 500;\n border-radius: 8px;\n}\n.arap-statement-link:hover {\n color: var(--arap-accent-hover);\n background: var(--arap-selected);\n}\n.arap-statement-link:focus-visible {\n outline: 3px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-credits {\n display: flex;\n flex: none;\n flex-direction: column;\n gap: 2px;\n padding-top: 8px;\n color: var(--arap-muted);\n text-align: center;\n font-size: 11px;\n line-height: 1.4;\n}\n.arap-credits a {\n color: var(--arap-accent);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.arap-credits a:hover {\n color: var(--arap-accent-hover);\n}\n.arap-credits a:focus-visible {\n outline: 2px solid var(--arap-accent);\n outline-offset: 2px;\n}\n.arap-root .arap-btn[data-large-controls=true] {\n width: 64px;\n height: 64px;\n min-width: 48px;\n min-height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] {\n width: min(440px, calc(100vw - 32px));\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-heading button {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 32px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-btn-sm {\n width: 48px;\n height: 48px;\n min-width: 48px;\n min-height: 48px;\n font-size: 24px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-value {\n min-width: 64px;\n font-size: 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-segment {\n min-width: 48px;\n min-height: 48px;\n padding: 10px 14px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle {\n width: 64px;\n height: 48px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle::before {\n inset: 8px 0;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-knob {\n top: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-toggle-active .arap-toggle-knob {\n transform: translateX(28px);\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-reset-btn {\n min-height: 52px;\n font-size: 16px;\n padding: 12px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-button,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-default,\n.arap-root .arap-panel[data-large-controls=true] .arap-position-arrows button {\n min-width: 48px;\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-position-popover select {\n min-height: 48px;\n font-size: 15px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-statement-link {\n min-height: 48px;\n font-size: 15px;\n padding: 10px 16px;\n}\n.arap-root .arap-panel[data-large-controls=true] .arap-skip-actions {\n min-width: 48px;\n min-height: 48px;\n}\n.arap-feature-card {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: 12px;\n}\n.arap-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-card-title {\n font-weight: 600;\n font-size: 15px;\n color: var(--arap-text);\n}\n.arap-card-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-status-badge {\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n border-radius: 9999px;\n font-size: 11px;\n font-weight: 600;\n background: var(--arap-control);\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-card-alert {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 10px 12px;\n border-radius: 8px;\n font-size: 13px;\n line-height: 1.4;\n}\n.arap-alert-icon {\n flex: none;\n font-size: 16px;\n line-height: 1;\n}\n.arap-card-error {\n background: #fef2f2;\n border: 1px solid #fecaca;\n color: #991b1b;\n}\n.arap-card-unavailable {\n background: #f8fafc;\n border: 1px solid var(--arap-border);\n color: var(--arap-muted);\n}\n.arap-card-permission {\n background: #fffbeb;\n border: 1px solid #fde68a;\n color: #92400e;\n}\n.arap-permission-content {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-permission-btn {\n align-self: flex-start;\n padding: 4px 10px;\n border: 1px solid #d97706;\n border-radius: 6px;\n background: #f59e0b;\n color: #fff;\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n}\n.arap-permission-btn:hover {\n background: #d97706;\n}\n.arap-card-content {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.arap-choice-group {\n display: flex;\n flex-direction: column;\n gap: 6px;\n width: 100%;\n}\n.arap-choice-group-title {\n font-size: 12px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-choice-badge {\n font-size: 11px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--arap-divider);\n color: var(--arap-muted);\n}\n.arap-segment-active .arap-choice-badge {\n background: rgba(255, 255, 255, 0.25);\n color: #fff;\n}\n.arap-stepper-control-wrapper {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n}\n.arap-slider-container {\n display: flex;\n align-items: center;\n padding: 4px 0;\n}\n.arap-slider {\n width: 100%;\n accent-color: var(--arap-accent);\n cursor: pointer;\n}\n.arap-search-count {\n padding: 6px 0;\n font-size: 12px;\n font-weight: 500;\n color: var(--arap-muted);\n}\n.arap-empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 24px 16px;\n gap: 8px;\n}\n.arap-empty-icon {\n font-size: 32px;\n}\n.arap-empty-title {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-empty-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n}\n.arap-empty-btn,\n.arap-retry-btn {\n margin-top: 6px;\n padding: 8px 16px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-control);\n font-weight: 500;\n font-size: 13px;\n color: var(--arap-text);\n cursor: pointer;\n}\n.arap-empty-btn:hover,\n.arap-retry-btn:hover {\n background: var(--arap-selected);\n border-color: var(--arap-accent);\n color: var(--arap-accent);\n}\n.arap-profile-card {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border: 1px solid var(--arap-border);\n border-radius: 12px;\n background: var(--arap-surface);\n transition: border-color 0.15s, box-shadow 0.15s;\n}\n.arap-profile-card-active {\n border-color: var(--arap-accent);\n background: var(--arap-selected);\n box-shadow: 0 0 0 1px var(--arap-accent);\n}\n.arap-profile-header {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.arap-profile-title-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n.arap-profile-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n color: var(--arap-text);\n}\n.arap-profile-active-badge {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-accent);\n background: #dbeafe;\n padding: 2px 8px;\n border-radius: 9999px;\n}\n.arap-profile-desc {\n margin: 0;\n font-size: 13px;\n color: var(--arap-muted);\n line-height: 1.4;\n}\n.arap-profile-affected {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.arap-profile-affected-label {\n font-size: 11px;\n font-weight: 600;\n color: var(--arap-muted);\n text-transform: uppercase;\n letter-spacing: 0.05em;\n}\n.arap-profile-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.arap-profile-chip {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 8px;\n border-radius: 6px;\n background: var(--arap-control);\n border: 1px solid var(--arap-divider);\n font-size: 12px;\n color: var(--arap-text);\n}\n.arap-profile-actions {\n display: flex;\n gap: 8px;\n margin-top: 4px;\n}\n.arap-profile-apply-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-accent);\n border-radius: 8px;\n background: var(--arap-accent);\n color: #fff;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-apply-btn:hover {\n background: var(--arap-accent-hover);\n}\n.arap-profile-revert-btn {\n flex: 1;\n padding: 8px 14px;\n border: 1px solid var(--arap-border);\n border-radius: 8px;\n background: var(--arap-surface);\n color: var(--arap-muted);\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n text-align: center;\n}\n.arap-profile-revert-btn:hover {\n background: var(--arap-control);\n color: var(--arap-text);\n border-color: var(--arap-text);\n}\n.arap-notice {\n grid-column: 1 / -1;\n margin-top: 6px;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 12px;\n line-height: 1.45;\n background: #fefce8;\n border: 1px solid #fef08a;\n color: #854d0e;\n}\n.arap-notice-warning {\n background: #fffbeb;\n border-color: #fde68a;\n color: #92400e;\n}\n.arap-reading-mask {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-reading-guide {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n pointer-events: none !important;\n user-select: none !important;\n -webkit-user-select: none !important;\n touch-action: none !important;\n z-index: 2147482999 !important;\n}\n.arap-feature-expandable {\n flex-direction: column !important;\n align-items: stretch !important;\n}\n.arap-accessible-tooltip {\n position: fixed !important;\n z-index: 2147483646 !important;\n max-width: 320px !important;\n min-width: 48px !important;\n box-sizing: border-box !important;\n padding: 6px 12px !important;\n background: #0f172a !important;\n color: #ffffff !important;\n font-family:\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n sans-serif !important;\n font-size: 13px !important;\n line-height: 1.4 !important;\n font-weight: 500 !important;\n border-radius: 6px !important;\n box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.15) !important;\n pointer-events: auto !important;\n word-break: break-word !important;\n white-space: normal !important;\n opacity: 0 !important;\n visibility: hidden !important;\n transition: opacity 120ms ease, transform 120ms ease !important;\n transform: translateY(2px) !important;\n}\n.arap-accessible-tooltip[data-visible=true] {\n opacity: 1 !important;\n visibility: visible !important;\n transform: translateY(0) !important;\n}\n.arap-accessible-tooltip[data-placement=top] {\n transform: translateY(-2px) !important;\n}\n.arap-accessible-tooltip[data-placement=top][data-visible=true] {\n transform: translateY(0) !important;\n}\n@media (forced-colors: active) {\n .arap-accessible-tooltip {\n background: Canvas !important;\n color: CanvasText !important;\n border: 2px solid Highlight !important;\n box-shadow: none !important;\n }\n}\n.arap-navigator-dialog {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n margin-top: 10px;\n padding: 10px;\n background: var(--arap-control, #f1f5f9);\n border: 1px solid var(--arap-border, #e2e8f0);\n border-radius: 8px;\n box-sizing: border-box;\n}\n.arap-navigator-tabs {\n display: flex;\n gap: 4px;\n border-bottom: 1px solid var(--arap-border, #cbd5e1);\n padding-bottom: 6px;\n}\n.arap-navigator-tab {\n flex: 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 6px 10px;\n font-size: 12px;\n font-weight: 600;\n color: var(--arap-muted, #64748b);\n background: transparent;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: all 120ms ease;\n}\n.arap-navigator-tab:hover {\n color: var(--arap-text, #0f172a);\n background: rgba(0, 0, 0, 0.04);\n}\n.arap-navigator-tab-active {\n color: var(--arap-accent, #008060) !important;\n background: var(--arap-selected, #f0fdf4) !important;\n}\n.arap-navigator-search-box {\n width: 100%;\n}\n.arap-navigator-search {\n width: 100%;\n box-sizing: border-box;\n padding: 6px 10px;\n font-size: 12px;\n border: 1px solid var(--arap-border, #cbd5e1);\n border-radius: 6px;\n background: var(--arap-surface, #ffffff);\n color: var(--arap-text, #0f172a);\n}\n.arap-navigator-search:focus {\n outline: 2px solid var(--arap-accent, #008060);\n outline-offset: 1px;\n}\n.arap-navigator-content {\n max-height: 240px;\n overflow-y: auto;\n overflow-x: hidden;\n}\n.arap-navigator-list {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.arap-navigator-item {\n margin: 0;\n padding: 0;\n}\n.arap-navigator-jump-btn {\n width: 100%;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 8px;\n font-size: 12px;\n font-weight: 500;\n text-align: left;\n background: var(--arap-surface, #ffffff);\n border: 1px solid var(--arap-border, #e2e8f0);\n border-radius: 6px;\n color: var(--arap-text, #0f172a);\n cursor: pointer;\n transition: background 100ms ease, border-color 100ms ease;\n}\n.arap-navigator-jump-btn:hover,\n.arap-navigator-jump-btn:focus-visible {\n background: var(--arap-selected, #f0fdf4);\n border-color: var(--arap-accent, #008060);\n outline: 2px solid var(--arap-accent, #008060);\n outline-offset: -1px;\n}\n.arap-navigator-badge {\n display: inline-block;\n padding: 2px 6px;\n font-size: 10px;\n font-weight: 700;\n border-radius: 4px;\n flex-shrink: 0;\n}\n.arap-navigator-badge-h {\n background: #e0f2fe;\n color: #0369a1;\n}\n.arap-navigator-badge-l {\n background: #fef3c7;\n color: #b45309;\n}\n.arap-navigator-item-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.arap-navigator-empty {\n padding: 16px;\n font-size: 12px;\n text-align: center;\n color: var(--arap-muted, #64748b);\n font-style: italic;\n}\n.arap-profile-card {\n padding: 12px;\n border: 1px solid var(--arap-border, #e2e8f0);\n border-radius: 8px;\n background: var(--arap-card-bg, #ffffff);\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.arap-profile-card:hover {\n border-color: var(--arap-primary, #2563eb);\n}\n.arap-profile-card-active {\n border-color: var(--arap-primary, #2563eb);\n background: rgba(37, 99, 235, 0.03);\n box-shadow: 0 0 0 1px var(--arap-primary, #2563eb);\n}\n.arap-profile-header {\n margin-bottom: 8px;\n}\n.arap-profile-title-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 4px;\n}\n.arap-profile-title {\n margin: 0;\n font-size: 13px;\n font-weight: 600;\n color: var(--arap-text, #1e293b);\n}\n.arap-profile-active-badge {\n display: inline-block;\n padding: 2px 8px;\n font-size: 11px;\n font-weight: 600;\n border-radius: 9999px;\n background: #dbeafe;\n color: #1d4ed8;\n}\n.arap-profile-desc {\n margin: 0;\n font-size: 11px;\n color: var(--arap-muted, #64748b);\n line-height: 1.4;\n}\n.arap-profile-affected {\n margin-top: 8px;\n margin-bottom: 10px;\n}\n.arap-profile-affected-label {\n display: block;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--arap-muted, #94a3b8);\n margin-bottom: 4px;\n}\n.arap-profile-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n}\n.arap-profile-chip {\n display: inline-block;\n padding: 2px 6px;\n font-size: 10px;\n background: var(--arap-chip-bg, #f1f5f9);\n color: var(--arap-text, #334155);\n border-radius: 4px;\n border: 1px solid var(--arap-chip-border, #e2e8f0);\n}\n.arap-profile-actions {\n display: flex;\n justify-content: flex-end;\n margin-top: 8px;\n}\n.arap-profile-apply-btn,\n.arap-profile-revert-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 36px;\n padding: 6px 14px;\n font-size: 12px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.15s ease, border-color 0.15s ease;\n}\n.arap-profile-apply-btn {\n background: var(--arap-primary, #2563eb);\n color: #ffffff;\n border: 1px solid var(--arap-primary, #2563eb);\n}\n.arap-profile-apply-btn:hover {\n background: #1d4ed8;\n}\n.arap-profile-revert-btn {\n background: #ffffff;\n color: #dc2626;\n border: 1px solid #fca5a5;\n}\n.arap-profile-revert-btn:hover {\n background: #fef2f2;\n border-color: #f87171;\n}\n.arap-large-controls .arap-profile-apply-btn,\n.arap-large-controls .arap-profile-revert-btn {\n min-height: 48px;\n padding: 10px 18px;\n font-size: 14px;\n}\n@media (prefers-reduced-motion: reduce) {\n .arap-profile-card,\n .arap-profile-apply-btn,\n .arap-profile-revert-btn,\n .arap-preset-card {\n transition: none !important;\n }\n}\n.arap-preset-card {\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.arap-preset-card:hover {\n border-color: var(--arap-border-hover, #cbd5e1);\n}\n.arap-large-controls .arap-preset-card button {\n min-height: 48px;\n padding: 10px 16px;\n font-size: 14px;\n}\n');
28
28
 
29
29
  // src/core/AccessibilityPlugin.tsx
30
30
  import {
@@ -361,6 +361,16 @@ builtins.readingMaskHeight = {
361
361
  defaultValue: DEFAULT_READING_MASK_HEIGHT,
362
362
  validate: (v) => typeof v === "number" && v >= MIN_READING_MASK_HEIGHT && v <= MAX_READING_MASK_HEIGHT
363
363
  };
364
+ builtins.activeProfile = {
365
+ defaultValue: null,
366
+ validate: (v) => v === null || typeof v === "object" && v !== null && "profileId" in v && typeof v.profileId === "string"
367
+ };
368
+ builtins.customPresets = {
369
+ defaultValue: [],
370
+ validate: (v) => Array.isArray(v) && v.every(
371
+ (item) => typeof item === "object" && item !== null && typeof item.id === "string" && typeof item.name === "string" && typeof item.createdAt === "string" && typeof item.settings === "object" && item.settings !== null
372
+ )
373
+ };
364
374
  function validValue(key, value, fallback, validate) {
365
375
  if (builtins[key]) return builtins[key].validate(value);
366
376
  if (validate) {
@@ -1863,15 +1873,39 @@ function AccessibilityPlugin({
1863
1873
  const definition = registrations.current.get(key);
1864
1874
  if (!validKey(key) || !definition || !validValue(key, value2, definition.defaultValue, definition.validate))
1865
1875
  throw new Error(`Invalid value or unregistered feature: ${key}`);
1866
- setFeatures((previous) => ({ ...previous, [key]: value2 }));
1876
+ setFeatures((previous) => {
1877
+ const copy = { ...previous, [key]: value2 };
1878
+ if (key !== "activeProfile" && key !== PLACEMENT_KEY && previous.activeProfile && typeof previous.activeProfile === "object") {
1879
+ const profileState = previous.activeProfile;
1880
+ const targetKey = key === "fontSize" || key === "textScale" ? "fontScale" : key === "focusHighlight" ? "highlightFocus" : key === "linkHighlight" ? "highlightLinks" : key === "bigCursor" ? "cursorSize" : key === "readingGuide" || key === "readingMask" ? "readerMode" : key;
1881
+ if (profileState.baseSnapshot && (targetKey in profileState.baseSnapshot || key in profileState.baseSnapshot)) {
1882
+ copy.activeProfile = {
1883
+ ...profileState,
1884
+ overrides: {
1885
+ ...profileState.overrides,
1886
+ [targetKey]: value2,
1887
+ [key]: value2
1888
+ }
1889
+ };
1890
+ }
1891
+ }
1892
+ return copy;
1893
+ });
1867
1894
  },
1868
1895
  [setFeatures]
1869
1896
  );
1870
1897
  const resetAll = useCallback2(() => {
1871
1898
  resetFns.current.forEach((fn) => fn());
1872
- setFeatures(
1873
- (previous) => validPlacement(previous[PLACEMENT_KEY]) ? { [PLACEMENT_KEY]: previous[PLACEMENT_KEY] } : {}
1874
- );
1899
+ setFeatures((previous) => {
1900
+ const preserved = {};
1901
+ if (validPlacement(previous[PLACEMENT_KEY])) {
1902
+ preserved[PLACEMENT_KEY] = previous[PLACEMENT_KEY];
1903
+ }
1904
+ if (Array.isArray(previous.customPresets)) {
1905
+ preserved.customPresets = previous.customPresets;
1906
+ }
1907
+ return preserved;
1908
+ });
1875
1909
  }, [setFeatures]);
1876
1910
  const registerReset = useCallback2((key, fn) => {
1877
1911
  resetFns.current.set(key, fn);
@@ -2646,6 +2680,16 @@ var DEFAULT_PREFERENCES = Object.freeze({
2646
2680
  saturation: "original",
2647
2681
  tooltips: false
2648
2682
  });
2683
+ var ALL_PROFILE_IDS = [
2684
+ "motor",
2685
+ "blind",
2686
+ "color-blind",
2687
+ "dyslexia",
2688
+ "low-vision",
2689
+ "cognitive",
2690
+ "seizure",
2691
+ "adhd"
2692
+ ];
2649
2693
  var PROFILE_DEFINITIONS = {
2650
2694
  motor: {
2651
2695
  id: "motor",
@@ -2925,6 +2969,249 @@ function preferencesReducer(state, action) {
2925
2969
  }
2926
2970
  }
2927
2971
 
2972
+ // src/core/profiles.ts
2973
+ function getProfileDefinition(id) {
2974
+ return PROFILE_DEFINITIONS[id];
2975
+ }
2976
+ function mapProfileSettingsToFeatures(settings) {
2977
+ const features = {};
2978
+ if (settings.fontScale !== void 0) {
2979
+ features.fontScale = settings.fontScale;
2980
+ features.textScale = settings.fontScale;
2981
+ features.fontSize = Math.round(settings.fontScale * 100);
2982
+ }
2983
+ if (settings.lineHeight !== void 0) {
2984
+ features.lineHeight = settings.lineHeight !== null ? Math.round(settings.lineHeight * 100) : 100;
2985
+ }
2986
+ if (settings.letterSpacingEm !== void 0) {
2987
+ features.letterSpacingEm = settings.letterSpacingEm;
2988
+ }
2989
+ if (settings.wordSpacingEm !== void 0) {
2990
+ features.wordSpacingEm = settings.wordSpacingEm;
2991
+ }
2992
+ if (settings.paragraphSpacingEm !== void 0) {
2993
+ features.paragraphSpacingEm = settings.paragraphSpacingEm;
2994
+ }
2995
+ if (settings.textAlign !== void 0) {
2996
+ features.textAlign = settings.textAlign === "original" ? "default" : settings.textAlign;
2997
+ }
2998
+ if (settings.contrastMode !== void 0) {
2999
+ features.contrastMode = settings.contrastMode;
3000
+ features.contrast = settings.contrastMode;
3001
+ }
3002
+ if (settings.highlightLinks !== void 0) {
3003
+ features.linkHighlight = settings.highlightLinks;
3004
+ }
3005
+ if (settings.highlightFocus !== void 0) {
3006
+ features.highlightFocus = settings.highlightFocus;
3007
+ features.focusHighlight = settings.highlightFocus;
3008
+ }
3009
+ if (settings.reduceMotion !== void 0) {
3010
+ features.reduceMotion = settings.reduceMotion;
3011
+ }
3012
+ if (settings.hideDecorativeImages !== void 0) {
3013
+ features.hideImages = settings.hideDecorativeImages;
3014
+ }
3015
+ if (settings.fontFamily !== void 0) {
3016
+ features.fontFamily = settings.fontFamily === "original" ? "default" : settings.fontFamily;
3017
+ }
3018
+ if (settings.cursorSize !== void 0) {
3019
+ features.bigCursor = settings.cursorSize === "large";
3020
+ }
3021
+ if (settings.readerMode !== void 0) {
3022
+ if (settings.readerMode === "guide") {
3023
+ features.readingGuide = true;
3024
+ features.readingMask = false;
3025
+ } else if (settings.readerMode === "mask") {
3026
+ features.readingMask = true;
3027
+ features.readingGuide = false;
3028
+ } else {
3029
+ features.readingGuide = false;
3030
+ features.readingMask = false;
3031
+ }
3032
+ }
3033
+ if (settings.saturation !== void 0) {
3034
+ features.saturation = settings.saturation === "low" ? 1 : settings.saturation === "high" ? 2 : 0;
3035
+ }
3036
+ if (settings.tooltips !== void 0) {
3037
+ features.tooltips = settings.tooltips;
3038
+ features.accessibleTooltips = settings.tooltips;
3039
+ }
3040
+ return features;
3041
+ }
3042
+ function mapFeaturesToProfileSettings(features) {
3043
+ const result = {
3044
+ ...DEFAULT_PREFERENCES
3045
+ };
3046
+ if (typeof features.fontScale === "number") {
3047
+ result.fontScale = features.fontScale;
3048
+ } else if (typeof features.textScale === "number") {
3049
+ result.fontScale = features.textScale;
3050
+ } else if (typeof features.fontSize === "number") {
3051
+ result.fontScale = features.fontSize / 100;
3052
+ }
3053
+ if (features.lineHeight !== void 0) {
3054
+ result.lineHeight = typeof features.lineHeight === "number" ? features.lineHeight / 100 : null;
3055
+ }
3056
+ if (typeof features.contrastMode === "string") {
3057
+ result.contrastMode = features.contrastMode === "original" ? "off" : features.contrastMode;
3058
+ }
3059
+ if (features.linkHighlight !== void 0) {
3060
+ result.highlightLinks = Boolean(features.linkHighlight);
3061
+ }
3062
+ if (features.highlightFocus !== void 0 || features.focusHighlight !== void 0) {
3063
+ result.highlightFocus = Boolean(
3064
+ features.highlightFocus ?? features.focusHighlight
3065
+ );
3066
+ }
3067
+ if (features.reduceMotion !== void 0) {
3068
+ result.reduceMotion = Boolean(features.reduceMotion);
3069
+ }
3070
+ if (features.hideImages !== void 0) {
3071
+ result.hideDecorativeImages = Boolean(features.hideImages);
3072
+ }
3073
+ if (typeof features.fontFamily === "string") {
3074
+ result.fontFamily = features.fontFamily === "default" ? "original" : features.fontFamily;
3075
+ }
3076
+ if (features.bigCursor !== void 0) {
3077
+ result.cursorSize = features.bigCursor ? "large" : "original";
3078
+ }
3079
+ if (features.readingMask) {
3080
+ result.readerMode = "mask";
3081
+ } else if (features.readingGuide) {
3082
+ result.readerMode = "guide";
3083
+ } else if (features.readingMask === false || features.readingGuide === false) {
3084
+ result.readerMode = "off";
3085
+ }
3086
+ if (features.tooltips !== void 0 || features.accessibleTooltips !== void 0) {
3087
+ result.tooltips = Boolean(features.tooltips ?? features.accessibleTooltips);
3088
+ }
3089
+ return result;
3090
+ }
3091
+ function applyProfileToStore(profileId, currentFeatures, setFeatureState, existingActiveState) {
3092
+ const profile = PROFILE_DEFINITIONS[profileId];
3093
+ if (!profile) {
3094
+ throw new Error(`Unknown profile identifier: ${profileId}`);
3095
+ }
3096
+ const currentSettings = mapFeaturesToProfileSettings(currentFeatures);
3097
+ const targetSettings = profile.settings;
3098
+ const baseSnapshot = {
3099
+ ...existingActiveState?.baseSnapshot ?? {}
3100
+ };
3101
+ for (const k of Object.keys(targetSettings)) {
3102
+ if (!(k in baseSnapshot)) {
3103
+ baseSnapshot[k] = currentSettings[k];
3104
+ }
3105
+ }
3106
+ const activeProfileState = {
3107
+ profileId,
3108
+ baseSnapshot,
3109
+ overrides: {}
3110
+ };
3111
+ const targetFeatures = mapProfileSettingsToFeatures(targetSettings);
3112
+ for (const [key, val] of Object.entries(targetFeatures)) {
3113
+ try {
3114
+ setFeatureState(key, val);
3115
+ } catch {
3116
+ }
3117
+ }
3118
+ try {
3119
+ setFeatureState("activeProfile", activeProfileState);
3120
+ } catch {
3121
+ }
3122
+ return activeProfileState;
3123
+ }
3124
+ function revertProfileFromStore(activeProfileState, setFeatureState) {
3125
+ const { baseSnapshot, overrides } = activeProfileState;
3126
+ const restoredSettings = {};
3127
+ for (const [k, baseVal] of Object.entries(baseSnapshot)) {
3128
+ const key = k;
3129
+ if (key in overrides) {
3130
+ restoredSettings[key] = overrides[key];
3131
+ } else {
3132
+ restoredSettings[key] = baseVal;
3133
+ }
3134
+ }
3135
+ const restoredFeatures = mapProfileSettingsToFeatures(restoredSettings);
3136
+ for (const [key, val] of Object.entries(restoredFeatures)) {
3137
+ try {
3138
+ setFeatureState(key, val);
3139
+ } catch {
3140
+ }
3141
+ }
3142
+ try {
3143
+ setFeatureState("activeProfile", null);
3144
+ } catch {
3145
+ }
3146
+ }
3147
+ function recordProfileOverride(key, value, activeProfileState, setFeatureState) {
3148
+ if (!activeProfileState) return null;
3149
+ const nextOverrides = {
3150
+ ...activeProfileState.overrides,
3151
+ [key]: value
3152
+ };
3153
+ const nextState = {
3154
+ ...activeProfileState,
3155
+ overrides: nextOverrides
3156
+ };
3157
+ try {
3158
+ setFeatureState("activeProfile", nextState);
3159
+ } catch {
3160
+ }
3161
+ return nextState;
3162
+ }
3163
+
3164
+ // src/core/useProfiles.ts
3165
+ import { useCallback as useCallback4, useContext as useContext6 } from "react";
3166
+ function useProfiles() {
3167
+ const ctx = useContext6(AccessibilityContext);
3168
+ if (!ctx) {
3169
+ throw new Error(
3170
+ "useProfiles must be used within an <AccessibilityPlugin> provider."
3171
+ );
3172
+ }
3173
+ const { value: activeProfileState, setValue: setActiveProfileState } = useAccessibility("activeProfile", null);
3174
+ const applyProfile = useCallback4(
3175
+ (profileId) => {
3176
+ const nextState = applyProfileToStore(
3177
+ profileId,
3178
+ ctx.state.features,
3179
+ ctx.setFeatureState,
3180
+ activeProfileState
3181
+ );
3182
+ setActiveProfileState(nextState);
3183
+ },
3184
+ [
3185
+ ctx.state.features,
3186
+ ctx.setFeatureState,
3187
+ activeProfileState,
3188
+ setActiveProfileState
3189
+ ]
3190
+ );
3191
+ const revertProfile = useCallback4(() => {
3192
+ if (activeProfileState) {
3193
+ revertProfileFromStore(activeProfileState, ctx.setFeatureState);
3194
+ setActiveProfileState(null);
3195
+ }
3196
+ }, [activeProfileState, ctx.setFeatureState, setActiveProfileState]);
3197
+ const activeProfileId = activeProfileState?.profileId ?? null;
3198
+ const activeProfile = activeProfileId ? getProfileDefinition(activeProfileId) ?? null : null;
3199
+ const isProfileActive = useCallback4(
3200
+ (id) => activeProfileId === id,
3201
+ [activeProfileId]
3202
+ );
3203
+ const allProfiles = ALL_PROFILE_IDS.map((id) => PROFILE_DEFINITIONS[id]);
3204
+ return {
3205
+ profiles: allProfiles,
3206
+ activeProfileId,
3207
+ activeProfile,
3208
+ activeProfileState,
3209
+ applyProfile,
3210
+ revertProfile,
3211
+ isProfileActive
3212
+ };
3213
+ }
3214
+
2928
3215
  // src/core/FeatureIcon.tsx
2929
3216
  import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
2930
3217
  var drawings = {
@@ -2997,6 +3284,19 @@ var drawings = {
2997
3284
  /* @__PURE__ */ jsx7("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }),
2998
3285
  /* @__PURE__ */ jsx7("path", { d: "M8 9h8M8 13h5" })
2999
3286
  ] }),
3287
+ pageNavigator: /* @__PURE__ */ jsxs5(Fragment, { children: [
3288
+ /* @__PURE__ */ jsx7("circle", { cx: "12", cy: "12", r: "9" }),
3289
+ /* @__PURE__ */ jsx7("polygon", { points: "12 3 15.5 10.5 12 9 8.5 10.5 12 3", fill: "currentColor" }),
3290
+ /* @__PURE__ */ jsx7("polygon", { points: "12 21 8.5 13.5 12 15 15.5 13.5 12 21" })
3291
+ ] }),
3292
+ headings: /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M4 6v12M14 6v12M4 12h10M18 10h3M18 14h3M18 18h3" }) }),
3293
+ landmarks: /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1zM4 22v-7" }) }),
3294
+ profiles: /* @__PURE__ */ jsxs5(Fragment, { children: [
3295
+ /* @__PURE__ */ jsx7("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
3296
+ /* @__PURE__ */ jsx7("circle", { cx: "9", cy: "7", r: "4" }),
3297
+ /* @__PURE__ */ jsx7("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75" })
3298
+ ] }),
3299
+ presets: /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z" }) }),
3000
3300
  reset: /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M3 10a9 9 0 1 1 1 7M3 4v6h6" }) })
3001
3301
  };
3002
3302
  function FeatureIcon({ name }) {
@@ -4383,143 +4683,1900 @@ function TooltipsController({
4383
4683
  }
4384
4684
  var AccessibleTooltipsController = TooltipsController;
4385
4685
 
4386
- // src/features/ResetController.tsx
4387
- import { createPortal as createPortal2 } from "react-dom";
4388
- import { useContext as useContext6 } from "react";
4389
- import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
4390
- function ResetController() {
4391
- const ctx = useContext6(AccessibilityContext);
4392
- if (!ctx) {
4393
- throw new Error(
4394
- "ResetController must be used within an <AccessibilityPlugin> provider."
4395
- );
4686
+ // src/features/PageNavigatorController.tsx
4687
+ import { useState as useState7, useEffect as useEffect7, useRef as useRef5, useCallback as useCallback5 } from "react";
4688
+
4689
+ // src/core/pageNavigator.ts
4690
+ var EXCLUDED_TAGS = /* @__PURE__ */ new Set([
4691
+ "SCRIPT",
4692
+ "STYLE",
4693
+ "LINK",
4694
+ "META",
4695
+ "NOSCRIPT",
4696
+ "TEMPLATE"
4697
+ ]);
4698
+ function isElementVisible(el) {
4699
+ if (el.getAttribute("aria-hidden") === "true") return false;
4700
+ if (el.getAttribute("hidden") !== null) return false;
4701
+ if (el.closest("[aria-hidden='true']")) return false;
4702
+ if (el.style.display === "none" || el.style.visibility === "hidden") {
4703
+ return false;
4396
4704
  }
4397
- const actionHost = useContext6(PanelActionsContext);
4398
- const { resetAll } = ctx;
4399
- const strings = resolveLocaleStrings(ctx.locale);
4400
- const button = /* @__PURE__ */ jsx30("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ jsxs28("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
4401
- /* @__PURE__ */ jsx30(FeatureIcon, { name: "reset" }),
4402
- strings.resetAll
4403
- ] }) });
4404
- return actionHost ? createPortal2(button, actionHost) : button;
4705
+ return true;
4405
4706
  }
4406
-
4407
- // src/core/controls/ToggleControl.tsx
4408
- import { jsx as jsx31 } from "react/jsx-runtime";
4409
- function ToggleControl({
4410
- id,
4411
- label,
4412
- checked,
4413
- onChange,
4414
- disabled = false,
4415
- unavailable = false,
4416
- unavailableReason,
4417
- name,
4418
- description,
4419
- largeControls = false,
4420
- className = "",
4421
- style
4422
- }) {
4423
- const isInteractive = !disabled && !unavailable;
4424
- const toggleLabel = typeof label === "string" ? label : void 0;
4425
- const handleClick = () => {
4426
- if (isInteractive) {
4427
- onChange(!checked);
4428
- }
4429
- };
4430
- return /* @__PURE__ */ jsx31(
4431
- "div",
4432
- {
4433
- className: `arap-toggle-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
4434
- style,
4435
- children: /* @__PURE__ */ jsx31(
4436
- "button",
4437
- {
4438
- id,
4439
- name,
4440
- type: "button",
4441
- className: `arap-toggle ${checked ? "arap-toggle-active" : ""}`,
4442
- role: "switch",
4443
- "aria-checked": checked,
4444
- "aria-label": toggleLabel,
4445
- "aria-disabled": !isInteractive,
4446
- disabled: !isInteractive,
4447
- onClick: handleClick,
4448
- title: unavailableReason || description || toggleLabel,
4449
- children: /* @__PURE__ */ jsx31(
4450
- "span",
4451
- {
4452
- className: "arap-toggle-knob",
4453
- style: {
4454
- transform: checked ? largeControls ? "translateX(28px)" : "translateX(24px)" : "translateX(0)"
4455
- }
4456
- }
4457
- )
4458
- }
4459
- )
4707
+ function scanHeadings(root) {
4708
+ const doc = root || (typeof document !== "undefined" ? document : null);
4709
+ if (!doc) return [];
4710
+ const candidates = doc.querySelectorAll(
4711
+ "h1, h2, h3, h4, h5, h6, [role='heading']"
4712
+ );
4713
+ const items = [];
4714
+ let index = 0;
4715
+ candidates.forEach((node) => {
4716
+ if (!(node instanceof HTMLElement)) return;
4717
+ if (EXCLUDED_TAGS.has(node.tagName)) return;
4718
+ if (node.closest("[data-arap-ui]")) return;
4719
+ if (!isElementVisible(node)) return;
4720
+ let level = 2;
4721
+ const match = node.tagName.match(/^H([1-6])$/i);
4722
+ if (match) {
4723
+ level = parseInt(match[1], 10);
4724
+ } else if (node.getAttribute("role") === "heading") {
4725
+ const ariaLevel = parseInt(node.getAttribute("aria-level") || "2", 10);
4726
+ level = Math.max(1, Math.min(6, isNaN(ariaLevel) ? 2 : ariaLevel));
4460
4727
  }
4728
+ const text = node.getAttribute("aria-label")?.trim() || node.textContent?.trim() || "";
4729
+ if (!text) return;
4730
+ items.push({
4731
+ id: node.id || `arap-heading-${++index}`,
4732
+ level,
4733
+ text,
4734
+ element: node
4735
+ });
4736
+ });
4737
+ return items;
4738
+ }
4739
+ var LANDMARK_TAGS = {
4740
+ HEADER: "banner",
4741
+ NAV: "navigation",
4742
+ MAIN: "main",
4743
+ ASIDE: "complementary",
4744
+ FOOTER: "contentinfo",
4745
+ FORM: "form",
4746
+ SECTION: "region"
4747
+ };
4748
+ var LANDMARK_TITLES = {
4749
+ banner: "Header (Banner)",
4750
+ navigation: "Navigation",
4751
+ main: "Main Content",
4752
+ complementary: "Sidebar (Complementary)",
4753
+ contentinfo: "Footer (Content Info)",
4754
+ search: "Search",
4755
+ region: "Region",
4756
+ form: "Form"
4757
+ };
4758
+ function isScopedHeaderOrFooter(el) {
4759
+ const parentSection = el.parentElement?.closest(
4760
+ "article, aside, main, nav, section"
4761
+ );
4762
+ return Boolean(parentSection && !parentSection.closest("[data-arap-ui]"));
4763
+ }
4764
+ function scanLandmarks(root) {
4765
+ const doc = root || (typeof document !== "undefined" ? document : null);
4766
+ if (!doc) return [];
4767
+ const candidates = doc.querySelectorAll(
4768
+ "header, nav, main, aside, footer, form[role='search'], [role='banner'], [role='navigation'], [role='main'], [role='complementary'], [role='contentinfo'], [role='search'], [role='region'][aria-label], [role='region'][aria-labelledby], section[aria-label], section[aria-labelledby], a[id]:not([href]), a[name]"
4461
4769
  );
4770
+ const items = [];
4771
+ let index = 0;
4772
+ candidates.forEach((node) => {
4773
+ if (!(node instanceof HTMLElement)) return;
4774
+ if (EXCLUDED_TAGS.has(node.tagName)) return;
4775
+ if (node.closest("[data-arap-ui]")) return;
4776
+ if (!isElementVisible(node)) return;
4777
+ let type = "";
4778
+ const explicitRole = node.getAttribute("role");
4779
+ if (explicitRole && [
4780
+ "banner",
4781
+ "navigation",
4782
+ "main",
4783
+ "complementary",
4784
+ "contentinfo",
4785
+ "search",
4786
+ "region",
4787
+ "form"
4788
+ ].includes(explicitRole)) {
4789
+ type = explicitRole;
4790
+ } else if (node.tagName in LANDMARK_TAGS) {
4791
+ if ((node.tagName === "HEADER" || node.tagName === "FOOTER") && isScopedHeaderOrFooter(node)) {
4792
+ return;
4793
+ }
4794
+ type = LANDMARK_TAGS[node.tagName];
4795
+ } else if (node.tagName === "A" && (node.id || node.getAttribute("name"))) {
4796
+ type = "anchor";
4797
+ }
4798
+ if (!type) return;
4799
+ let label = node.getAttribute("aria-label")?.trim() || "";
4800
+ if (!label && node.getAttribute("aria-labelledby")) {
4801
+ const labelId = node.getAttribute("aria-labelledby").trim();
4802
+ const labelEl = document.getElementById(labelId);
4803
+ if (labelEl) {
4804
+ label = labelEl.textContent?.trim() || "";
4805
+ }
4806
+ }
4807
+ if (!label) {
4808
+ if (type === "anchor") {
4809
+ label = node.textContent?.trim() || node.id || node.getAttribute("name") || "Named Anchor";
4810
+ } else {
4811
+ label = LANDMARK_TITLES[type] || type.charAt(0).toUpperCase() + type.slice(1);
4812
+ }
4813
+ }
4814
+ items.push({
4815
+ id: node.id || `arap-landmark-${++index}`,
4816
+ type,
4817
+ label,
4818
+ element: node
4819
+ });
4820
+ });
4821
+ return items;
4822
+ }
4823
+ function navigateToElement(element, options = {}) {
4824
+ if (!element || !element.isConnected) return;
4825
+ const isNaturallyFocusable = element instanceof HTMLAnchorElement || element instanceof HTMLButtonElement || element instanceof HTMLInputElement || element instanceof HTMLSelectElement || element instanceof HTMLTextAreaElement || element.hasAttribute("tabindex");
4826
+ const hadTabIndex = element.hasAttribute("tabindex");
4827
+ const previousTabIndex = element.getAttribute("tabindex");
4828
+ if (!isNaturallyFocusable) {
4829
+ element.setAttribute("tabindex", "-1");
4830
+ }
4831
+ const isReduced = typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
4832
+ const behavior = options.behavior ?? (isReduced ? "auto" : "smooth");
4833
+ element.scrollIntoView({ behavior, block: "start" });
4834
+ element.focus();
4835
+ if (!isNaturallyFocusable) {
4836
+ const handleBlur = () => {
4837
+ if (hadTabIndex && previousTabIndex !== null) {
4838
+ element.setAttribute("tabindex", previousTabIndex);
4839
+ } else {
4840
+ element.removeAttribute("tabindex");
4841
+ }
4842
+ element.removeEventListener("blur", handleBlur);
4843
+ };
4844
+ element.addEventListener("blur", handleBlur, { once: true });
4845
+ }
4846
+ options.onComplete?.();
4847
+ }
4848
+ function subscribePageStructure(callback) {
4849
+ if (typeof MutationObserver === "undefined" || typeof document === "undefined" || !document.body) {
4850
+ return () => {
4851
+ };
4852
+ }
4853
+ let timer = null;
4854
+ const observer = new MutationObserver((mutations) => {
4855
+ const isExternal = mutations.some((m) => {
4856
+ const target = m.target;
4857
+ if (target instanceof Element && target.closest("[data-arap-ui]")) {
4858
+ return false;
4859
+ }
4860
+ return [...m.addedNodes, ...m.removedNodes].some((node) => {
4861
+ return !(node instanceof Element && node.closest("[data-arap-ui]"));
4862
+ });
4863
+ });
4864
+ if (!isExternal) return;
4865
+ if (timer) clearTimeout(timer);
4866
+ timer = setTimeout(() => {
4867
+ callback();
4868
+ }, 100);
4869
+ });
4870
+ observer.observe(document.body, { childList: true, subtree: true });
4871
+ return () => {
4872
+ if (timer) clearTimeout(timer);
4873
+ observer.disconnect();
4874
+ };
4462
4875
  }
4463
4876
 
4464
- // src/core/controls/ChoiceControl.tsx
4465
- import { useCallback as useCallback4, useMemo as useMemo2, useRef as useRef5 } from "react";
4466
- import { jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
4467
- function ChoiceControl({
4468
- id,
4469
- label,
4470
- value,
4471
- options,
4472
- groups,
4473
- onChange,
4474
- disabled = false,
4475
- largeControls = false,
4877
+ // src/features/PageNavigatorController.tsx
4878
+ import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
4879
+ function PageNavigatorController({
4476
4880
  className = "",
4477
- style,
4478
- orientation = "horizontal"
4881
+ label = "Page Navigator",
4882
+ description = "Explore headings and landmarks",
4883
+ closeOnNavigate = false
4479
4884
  }) {
4480
- const containerRef = useRef5(null);
4481
- const allOptions = useMemo2(
4482
- () => groups ? groups.flatMap((g) => g.options) : options || [],
4483
- [groups, options]
4885
+ const [isOpen, setIsOpen] = useState7(false);
4886
+ const [activeTab, setActiveTab] = useState7(
4887
+ "headings"
4484
4888
  );
4485
- const handleKeyDown = useCallback4(
4486
- (e) => {
4487
- if (disabled || allOptions.length === 0) return;
4488
- const enabledOptions = allOptions.filter((opt) => !opt.disabled);
4489
- const currentIndex = enabledOptions.findIndex(
4490
- (opt) => opt.value === value
4491
- );
4492
- let nextIndex = -1;
4493
- if (e.key === "ArrowRight" || e.key === "ArrowDown") {
4494
- e.preventDefault();
4495
- nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % enabledOptions.length;
4496
- } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
4497
- e.preventDefault();
4498
- nextIndex = currentIndex === -1 ? enabledOptions.length - 1 : (currentIndex - 1 + enabledOptions.length) % enabledOptions.length;
4499
- } else if (e.key === "Home") {
4500
- e.preventDefault();
4501
- nextIndex = 0;
4502
- } else if (e.key === "End") {
4503
- e.preventDefault();
4504
- nextIndex = enabledOptions.length - 1;
4505
- }
4506
- if (nextIndex !== -1 && enabledOptions[nextIndex]) {
4507
- onChange(enabledOptions[nextIndex].value);
4508
- const buttons = containerRef.current?.querySelectorAll(
4509
- "button[data-choice-value]"
4510
- );
4511
- const targetBtn = Array.from(buttons || []).find(
4512
- (b) => b.getAttribute("data-choice-value") === String(enabledOptions[nextIndex].value)
4513
- );
4514
- targetBtn?.focus();
4889
+ const [headings, setHeadings] = useState7([]);
4890
+ const [landmarks, setLandmarks] = useState7([]);
4891
+ const [search, setSearch] = useState7("");
4892
+ const triggerRef = useRef5(null);
4893
+ const dialogRef = useRef5(null);
4894
+ const refreshStructure = useCallback5(() => {
4895
+ setHeadings(scanHeadings());
4896
+ setLandmarks(scanLandmarks());
4897
+ }, []);
4898
+ const handleOpen = () => {
4899
+ refreshStructure();
4900
+ setIsOpen(true);
4901
+ };
4902
+ const handleClose = () => {
4903
+ setIsOpen(false);
4904
+ triggerRef.current?.focus();
4905
+ };
4906
+ useEffect7(() => {
4907
+ if (!isOpen) return;
4908
+ return subscribePageStructure(refreshStructure);
4909
+ }, [isOpen, refreshStructure]);
4910
+ useEffect7(() => {
4911
+ if (isOpen) {
4912
+ dialogRef.current?.focus();
4913
+ }
4914
+ }, [isOpen]);
4915
+ const handleNavigate = (element) => {
4916
+ navigateToElement(element, {
4917
+ onComplete: () => {
4918
+ if (closeOnNavigate) {
4919
+ setIsOpen(false);
4920
+ }
4515
4921
  }
4516
- },
4517
- [allOptions, disabled, onChange, value]
4518
- );
4519
- const renderOptionButton = (opt) => {
4520
- const isSelected = value === opt.value;
4521
- const isOptionDisabled = disabled || Boolean(opt.disabled);
4522
- return /* @__PURE__ */ jsxs29(
4922
+ });
4923
+ };
4924
+ const filteredHeadings = search.trim() ? headings.filter(
4925
+ (h) => h.text.toLowerCase().includes(search.toLowerCase())
4926
+ ) : headings;
4927
+ const filteredLandmarks = search.trim() ? landmarks.filter(
4928
+ (l) => l.label.toLowerCase().includes(search.toLowerCase())
4929
+ ) : landmarks;
4930
+ return /* @__PURE__ */ jsxs28(
4931
+ "div",
4932
+ {
4933
+ className: `arap-feature arap-feature-expandable ${className}`,
4934
+ role: "group",
4935
+ "aria-label": label,
4936
+ children: [
4937
+ /* @__PURE__ */ jsxs28(
4938
+ "div",
4939
+ {
4940
+ style: {
4941
+ display: "flex",
4942
+ alignItems: "center",
4943
+ justifyContent: "space-between",
4944
+ width: "100%"
4945
+ },
4946
+ children: [
4947
+ /* @__PURE__ */ jsxs28("span", { className: "arap-label", children: [
4948
+ /* @__PURE__ */ jsx30(FeatureIcon, { name: "pageNavigator" }),
4949
+ /* @__PURE__ */ jsxs28("span", { children: [
4950
+ /* @__PURE__ */ jsx30("span", { style: { display: "block" }, children: label }),
4951
+ description && /* @__PURE__ */ jsx30(
4952
+ "span",
4953
+ {
4954
+ style: {
4955
+ display: "block",
4956
+ fontSize: "11px",
4957
+ fontWeight: 400,
4958
+ color: "var(--arap-muted, #64748b)",
4959
+ marginTop: "1px"
4960
+ },
4961
+ children: description
4962
+ }
4963
+ )
4964
+ ] })
4965
+ ] }),
4966
+ /* @__PURE__ */ jsx30(
4967
+ "button",
4968
+ {
4969
+ ref: triggerRef,
4970
+ className: "arap-btn-sm",
4971
+ type: "button",
4972
+ "aria-expanded": isOpen,
4973
+ "aria-controls": "arap-page-navigator-dialog",
4974
+ onClick: () => {
4975
+ if (isOpen) {
4976
+ handleClose();
4977
+ } else {
4978
+ handleOpen();
4979
+ }
4980
+ },
4981
+ children: isOpen ? "Close" : "Explore"
4982
+ }
4983
+ )
4984
+ ]
4985
+ }
4986
+ ),
4987
+ isOpen && /* @__PURE__ */ jsxs28(
4988
+ "div",
4989
+ {
4990
+ ref: dialogRef,
4991
+ id: "arap-page-navigator-dialog",
4992
+ className: "arap-navigator-dialog",
4993
+ role: "region",
4994
+ "aria-label": "Page Structure Explorer",
4995
+ tabIndex: -1,
4996
+ onKeyDown: (event) => {
4997
+ if (event.key === "Escape") {
4998
+ event.stopPropagation();
4999
+ handleClose();
5000
+ }
5001
+ },
5002
+ children: [
5003
+ /* @__PURE__ */ jsxs28(
5004
+ "div",
5005
+ {
5006
+ className: "arap-navigator-tabs",
5007
+ role: "tablist",
5008
+ "aria-label": "Structure views",
5009
+ children: [
5010
+ /* @__PURE__ */ jsxs28(
5011
+ "button",
5012
+ {
5013
+ id: "arap-tab-headings",
5014
+ className: `arap-navigator-tab ${activeTab === "headings" ? "arap-navigator-tab-active" : ""}`,
5015
+ role: "tab",
5016
+ "aria-selected": activeTab === "headings",
5017
+ "aria-controls": "arap-panel-headings",
5018
+ type: "button",
5019
+ onClick: () => setActiveTab("headings"),
5020
+ onKeyDown: (e) => {
5021
+ if (e.key === "ArrowRight") {
5022
+ document.getElementById("arap-tab-landmarks")?.focus();
5023
+ setActiveTab("landmarks");
5024
+ }
5025
+ },
5026
+ children: [
5027
+ /* @__PURE__ */ jsx30(FeatureIcon, { name: "headings" }),
5028
+ /* @__PURE__ */ jsxs28("span", { children: [
5029
+ "Headings (",
5030
+ headings.length,
5031
+ ")"
5032
+ ] })
5033
+ ]
5034
+ }
5035
+ ),
5036
+ /* @__PURE__ */ jsxs28(
5037
+ "button",
5038
+ {
5039
+ id: "arap-tab-landmarks",
5040
+ className: `arap-navigator-tab ${activeTab === "landmarks" ? "arap-navigator-tab-active" : ""}`,
5041
+ role: "tab",
5042
+ "aria-selected": activeTab === "landmarks",
5043
+ "aria-controls": "arap-panel-landmarks",
5044
+ type: "button",
5045
+ onClick: () => setActiveTab("landmarks"),
5046
+ onKeyDown: (e) => {
5047
+ if (e.key === "ArrowLeft") {
5048
+ document.getElementById("arap-tab-headings")?.focus();
5049
+ setActiveTab("headings");
5050
+ }
5051
+ },
5052
+ children: [
5053
+ /* @__PURE__ */ jsx30(FeatureIcon, { name: "landmarks" }),
5054
+ /* @__PURE__ */ jsxs28("span", { children: [
5055
+ "Landmarks (",
5056
+ landmarks.length,
5057
+ ")"
5058
+ ] })
5059
+ ]
5060
+ }
5061
+ )
5062
+ ]
5063
+ }
5064
+ ),
5065
+ /* @__PURE__ */ jsx30("div", { className: "arap-navigator-search-box", children: /* @__PURE__ */ jsx30(
5066
+ "input",
5067
+ {
5068
+ type: "search",
5069
+ className: "arap-navigator-search",
5070
+ placeholder: `Filter ${activeTab}...`,
5071
+ value: search,
5072
+ onChange: (e) => setSearch(e.target.value),
5073
+ "aria-label": `Filter ${activeTab}`
5074
+ }
5075
+ ) }),
5076
+ /* @__PURE__ */ jsxs28("div", { className: "arap-navigator-content", children: [
5077
+ activeTab === "headings" && /* @__PURE__ */ jsx30(
5078
+ "div",
5079
+ {
5080
+ id: "arap-panel-headings",
5081
+ role: "tabpanel",
5082
+ "aria-labelledby": "arap-tab-headings",
5083
+ children: filteredHeadings.length === 0 ? /* @__PURE__ */ jsx30("div", { className: "arap-navigator-empty", role: "status", children: headings.length === 0 ? "No headings found on this page." : "No matching headings." }) : /* @__PURE__ */ jsx30("ul", { className: "arap-navigator-list", role: "list", children: filteredHeadings.map((h, i) => /* @__PURE__ */ jsx30("li", { className: "arap-navigator-item", children: /* @__PURE__ */ jsxs28(
5084
+ "button",
5085
+ {
5086
+ type: "button",
5087
+ className: "arap-navigator-jump-btn",
5088
+ style: {
5089
+ paddingLeft: `${Math.max(8, (h.level - 1) * 12 + 8)}px`
5090
+ },
5091
+ onClick: () => handleNavigate(h.element),
5092
+ children: [
5093
+ /* @__PURE__ */ jsxs28(
5094
+ "span",
5095
+ {
5096
+ className: "arap-navigator-badge arap-navigator-badge-h",
5097
+ "aria-hidden": "true",
5098
+ children: [
5099
+ "H",
5100
+ h.level
5101
+ ]
5102
+ }
5103
+ ),
5104
+ /* @__PURE__ */ jsx30("span", { className: "arap-navigator-item-text", children: h.text })
5105
+ ]
5106
+ }
5107
+ ) }, `${h.id}-${i}`)) })
5108
+ }
5109
+ ),
5110
+ activeTab === "landmarks" && /* @__PURE__ */ jsx30(
5111
+ "div",
5112
+ {
5113
+ id: "arap-panel-landmarks",
5114
+ role: "tabpanel",
5115
+ "aria-labelledby": "arap-tab-landmarks",
5116
+ children: filteredLandmarks.length === 0 ? /* @__PURE__ */ jsx30("div", { className: "arap-navigator-empty", role: "status", children: landmarks.length === 0 ? "No landmarks found on this page." : "No matching landmarks." }) : /* @__PURE__ */ jsx30("ul", { className: "arap-navigator-list", role: "list", children: filteredLandmarks.map((l, i) => /* @__PURE__ */ jsx30("li", { className: "arap-navigator-item", children: /* @__PURE__ */ jsxs28(
5117
+ "button",
5118
+ {
5119
+ type: "button",
5120
+ className: "arap-navigator-jump-btn",
5121
+ onClick: () => handleNavigate(l.element),
5122
+ children: [
5123
+ /* @__PURE__ */ jsx30(
5124
+ "span",
5125
+ {
5126
+ className: "arap-navigator-badge arap-navigator-badge-l",
5127
+ "aria-hidden": "true",
5128
+ children: l.type.toUpperCase()
5129
+ }
5130
+ ),
5131
+ /* @__PURE__ */ jsx30("span", { className: "arap-navigator-item-text", children: l.label })
5132
+ ]
5133
+ }
5134
+ ) }, `${l.id}-${i}`)) })
5135
+ }
5136
+ )
5137
+ ] })
5138
+ ]
5139
+ }
5140
+ )
5141
+ ]
5142
+ }
5143
+ );
5144
+ }
5145
+ var HeadingsNavigatorController = PageNavigatorController;
5146
+ var PageStructureController = PageNavigatorController;
5147
+
5148
+ // src/features/ProfilesController.tsx
5149
+ import { useId as useId2, useMemo as useMemo2, useRef as useRef6, useState as useState8 } from "react";
5150
+
5151
+ // src/core/controls/ProfilePreviewCard.tsx
5152
+ import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
5153
+ function ProfilePreviewCard({
5154
+ profile,
5155
+ isActive,
5156
+ onApply,
5157
+ onRevert,
5158
+ largeControls = false,
5159
+ className = "",
5160
+ style
5161
+ }) {
5162
+ const affectedKeys = Object.keys(
5163
+ profile.settings
5164
+ );
5165
+ const formatKeyName = (key) => {
5166
+ switch (key) {
5167
+ case "fontScale":
5168
+ return "Font Size";
5169
+ case "lineHeight":
5170
+ return "Line Height";
5171
+ case "contrastMode":
5172
+ return "Contrast";
5173
+ case "reduceMotion":
5174
+ return "Reduce Motion";
5175
+ case "textAlign":
5176
+ return "Text Align";
5177
+ case "highlightLinks":
5178
+ return "Highlight Links";
5179
+ case "highlightFocus":
5180
+ return "Highlight Focus";
5181
+ case "cursorSize":
5182
+ return "Cursor Size";
5183
+ case "readerMode":
5184
+ return "Reading Mode";
5185
+ case "saturation":
5186
+ return "Saturation";
5187
+ case "hideDecorativeImages":
5188
+ return "Hide Images";
5189
+ default:
5190
+ return key.replace(/([A-Z])/g, " $1").trim();
5191
+ }
5192
+ };
5193
+ const formatSettingValue = (key, val) => {
5194
+ if (typeof val === "boolean") return val ? "On" : "Off";
5195
+ if (key === "fontScale" && typeof val === "number")
5196
+ return `${Math.round(val * 100)}%`;
5197
+ if (key === "lineHeight" && typeof val === "number")
5198
+ return `${Math.round(val * 100)}%`;
5199
+ if (val === null || val === void 0) return "Original";
5200
+ return String(val);
5201
+ };
5202
+ return /* @__PURE__ */ jsxs29(
5203
+ "div",
5204
+ {
5205
+ role: "group",
5206
+ "aria-label": `${profile.label} profile`,
5207
+ className: `arap-profile-card ${isActive ? "arap-profile-card-active" : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
5208
+ style,
5209
+ children: [
5210
+ /* @__PURE__ */ jsxs29("div", { className: "arap-profile-header", children: [
5211
+ /* @__PURE__ */ jsxs29("div", { className: "arap-profile-title-row", children: [
5212
+ /* @__PURE__ */ jsx31("h4", { className: "arap-profile-title", children: profile.label }),
5213
+ isActive && /* @__PURE__ */ jsx31(
5214
+ "span",
5215
+ {
5216
+ className: "arap-profile-active-badge",
5217
+ "aria-label": "Active profile",
5218
+ children: "\u2713 Active"
5219
+ }
5220
+ )
5221
+ ] }),
5222
+ /* @__PURE__ */ jsx31("p", { className: "arap-profile-desc", children: profile.description })
5223
+ ] }),
5224
+ /* @__PURE__ */ jsxs29("div", { className: "arap-profile-affected", children: [
5225
+ /* @__PURE__ */ jsx31("span", { className: "arap-profile-affected-label", children: "Affected settings:" }),
5226
+ /* @__PURE__ */ jsx31("div", { className: "arap-profile-chips", children: affectedKeys.map((key) => {
5227
+ const val = profile.settings[key];
5228
+ return /* @__PURE__ */ jsxs29("span", { className: "arap-profile-chip", children: [
5229
+ /* @__PURE__ */ jsxs29("strong", { children: [
5230
+ formatKeyName(key),
5231
+ ":"
5232
+ ] }),
5233
+ " ",
5234
+ formatSettingValue(key, val)
5235
+ ] }, key);
5236
+ }) })
5237
+ ] }),
5238
+ /* @__PURE__ */ jsx31("div", { className: "arap-profile-actions", children: isActive ? /* @__PURE__ */ jsx31(
5239
+ "button",
5240
+ {
5241
+ type: "button",
5242
+ className: "arap-profile-revert-btn",
5243
+ onClick: onRevert,
5244
+ "aria-label": `Revert ${profile.label} profile`,
5245
+ children: "Revert to custom settings"
5246
+ }
5247
+ ) : /* @__PURE__ */ jsx31(
5248
+ "button",
5249
+ {
5250
+ type: "button",
5251
+ className: "arap-profile-apply-btn",
5252
+ onClick: () => onApply(profile),
5253
+ "aria-label": `Apply ${profile.label} profile`,
5254
+ children: "Apply Profile"
5255
+ }
5256
+ ) })
5257
+ ]
5258
+ }
5259
+ );
5260
+ }
5261
+
5262
+ // src/core/controls/FeatureStatusState.tsx
5263
+ import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
5264
+ function SearchCount({
5265
+ totalCount,
5266
+ matchedCount,
5267
+ query,
5268
+ className = "",
5269
+ style
5270
+ }) {
5271
+ const text = query ? `Showing ${matchedCount} of ${totalCount} tools matching "${query}"` : `Showing all ${totalCount} tools`;
5272
+ return /* @__PURE__ */ jsx32(
5273
+ "div",
5274
+ {
5275
+ role: "status",
5276
+ "aria-live": "polite",
5277
+ className: `arap-search-count ${className}`,
5278
+ style,
5279
+ children: text
5280
+ }
5281
+ );
5282
+ }
5283
+ function EmptyState({
5284
+ title = "No matching tools found",
5285
+ description = "Try adjusting your search query or reset filters.",
5286
+ actionLabel = "Clear search",
5287
+ onAction,
5288
+ icon,
5289
+ className = "",
5290
+ style
5291
+ }) {
5292
+ return /* @__PURE__ */ jsxs30(
5293
+ "div",
5294
+ {
5295
+ role: "status",
5296
+ className: `arap-empty-state ${className}`,
5297
+ style,
5298
+ children: [
5299
+ /* @__PURE__ */ jsx32("div", { className: "arap-empty-icon", "aria-hidden": "true", children: icon ?? "\u{1F50D}" }),
5300
+ /* @__PURE__ */ jsx32("h3", { className: "arap-empty-title", children: title }),
5301
+ /* @__PURE__ */ jsx32("p", { className: "arap-empty-desc", children: description }),
5302
+ onAction && /* @__PURE__ */ jsx32("button", { type: "button", className: "arap-empty-btn", onClick: onAction, children: actionLabel })
5303
+ ]
5304
+ }
5305
+ );
5306
+ }
5307
+ function ErrorState({
5308
+ title = "Something went wrong",
5309
+ message,
5310
+ onRetry,
5311
+ retryLabel = "Try again",
5312
+ className = "",
5313
+ style
5314
+ }) {
5315
+ return /* @__PURE__ */ jsxs30(
5316
+ "div",
5317
+ {
5318
+ role: "alert",
5319
+ className: `arap-error-state arap-card-alert arap-card-error ${className}`,
5320
+ style,
5321
+ children: [
5322
+ /* @__PURE__ */ jsx32("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
5323
+ /* @__PURE__ */ jsxs30("div", { className: "arap-error-content", children: [
5324
+ title && /* @__PURE__ */ jsx32("h4", { className: "arap-error-title", children: title }),
5325
+ /* @__PURE__ */ jsx32("p", { className: "arap-error-message", children: message }),
5326
+ onRetry && /* @__PURE__ */ jsx32("button", { type: "button", className: "arap-retry-btn", onClick: onRetry, children: retryLabel })
5327
+ ] })
5328
+ ]
5329
+ }
5330
+ );
5331
+ }
5332
+
5333
+ // src/features/ProfilesController.tsx
5334
+ import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
5335
+ function ProfilesController({
5336
+ className = "",
5337
+ label = "Accessibility Profiles",
5338
+ description = "Explore suggested preference combinations",
5339
+ largeControls = false,
5340
+ onProfileChange
5341
+ }) {
5342
+ const [isOpen, setIsOpen] = useState8(false);
5343
+ const [search, setSearch] = useState8("");
5344
+ const dialogId = "arap-profiles-dialog";
5345
+ const searchInputId = useId2();
5346
+ const triggerRef = useRef6(null);
5347
+ const {
5348
+ profiles,
5349
+ activeProfile,
5350
+ activeProfileState,
5351
+ applyProfile,
5352
+ revertProfile,
5353
+ isProfileActive
5354
+ } = useProfiles();
5355
+ const handleApply = (profileId) => {
5356
+ applyProfile(profileId);
5357
+ onProfileChange?.(profileId);
5358
+ };
5359
+ const handleRevert = () => {
5360
+ revertProfile();
5361
+ onProfileChange?.(null);
5362
+ };
5363
+ const filteredProfiles = useMemo2(() => {
5364
+ const q = search.trim().toLowerCase();
5365
+ if (!q) return profiles;
5366
+ return profiles.filter((p) => {
5367
+ const nameMatch = p.label.toLowerCase().includes(q);
5368
+ const descMatch = p.description.toLowerCase().includes(q);
5369
+ const settingMatch = Object.keys(p.settings).some(
5370
+ (k) => k.toLowerCase().includes(q)
5371
+ );
5372
+ return nameMatch || descMatch || settingMatch;
5373
+ });
5374
+ }, [profiles, search]);
5375
+ const hasOverrides = Boolean(activeProfileState?.overrides) && Object.keys(activeProfileState?.overrides ?? {}).length > 0;
5376
+ return /* @__PURE__ */ jsxs31(
5377
+ "div",
5378
+ {
5379
+ className: `arap-feature arap-feature-expandable ${largeControls ? "arap-large-controls" : ""} ${className}`,
5380
+ role: "group",
5381
+ "aria-label": label,
5382
+ children: [
5383
+ /* @__PURE__ */ jsxs31(
5384
+ "div",
5385
+ {
5386
+ style: {
5387
+ display: "flex",
5388
+ alignItems: "center",
5389
+ justifyContent: "space-between",
5390
+ width: "100%"
5391
+ },
5392
+ children: [
5393
+ /* @__PURE__ */ jsxs31("span", { className: "arap-label", children: [
5394
+ /* @__PURE__ */ jsx33(FeatureIcon, { name: "profiles" }),
5395
+ /* @__PURE__ */ jsxs31("span", { children: [
5396
+ /* @__PURE__ */ jsx33("span", { style: { display: "block" }, children: label }),
5397
+ description && /* @__PURE__ */ jsx33(
5398
+ "span",
5399
+ {
5400
+ style: {
5401
+ display: "block",
5402
+ fontSize: "11px",
5403
+ fontWeight: 400,
5404
+ color: "var(--arap-muted, #64748b)",
5405
+ marginTop: "1px"
5406
+ },
5407
+ children: activeProfile ? /* @__PURE__ */ jsxs31(
5408
+ "span",
5409
+ {
5410
+ style: {
5411
+ color: "var(--arap-primary, #2563eb)",
5412
+ fontWeight: 500
5413
+ },
5414
+ children: [
5415
+ "Active: ",
5416
+ activeProfile.label,
5417
+ hasOverrides && " (Customized)"
5418
+ ]
5419
+ }
5420
+ ) : description
5421
+ }
5422
+ )
5423
+ ] })
5424
+ ] }),
5425
+ /* @__PURE__ */ jsxs31("div", { style: { display: "flex", gap: "6px", alignItems: "center" }, children: [
5426
+ activeProfile && /* @__PURE__ */ jsx33(
5427
+ "button",
5428
+ {
5429
+ type: "button",
5430
+ className: "arap-btn-sm",
5431
+ onClick: handleRevert,
5432
+ "aria-label": "Revert active profile to custom settings",
5433
+ title: "Revert to custom settings",
5434
+ children: "Revert"
5435
+ }
5436
+ ),
5437
+ /* @__PURE__ */ jsx33(
5438
+ "button",
5439
+ {
5440
+ ref: triggerRef,
5441
+ className: "arap-btn-sm",
5442
+ type: "button",
5443
+ "aria-expanded": isOpen,
5444
+ "aria-controls": dialogId,
5445
+ onClick: () => setIsOpen(!isOpen),
5446
+ children: isOpen ? "Close" : "Browse"
5447
+ }
5448
+ )
5449
+ ] })
5450
+ ]
5451
+ }
5452
+ ),
5453
+ isOpen && /* @__PURE__ */ jsxs31(
5454
+ "div",
5455
+ {
5456
+ id: dialogId,
5457
+ className: "arap-profiles-panel",
5458
+ style: {
5459
+ marginTop: "12px",
5460
+ paddingTop: "12px",
5461
+ borderTop: "1px solid var(--arap-divider, #e2e8f0)"
5462
+ },
5463
+ children: [
5464
+ activeProfile && /* @__PURE__ */ jsxs31(
5465
+ "div",
5466
+ {
5467
+ className: "arap-profile-active-banner",
5468
+ style: {
5469
+ display: "flex",
5470
+ alignItems: "center",
5471
+ justifyContent: "space-between",
5472
+ padding: "8px 12px",
5473
+ marginBottom: "12px",
5474
+ background: "rgba(37, 99, 235, 0.08)",
5475
+ border: "1px solid rgba(37, 99, 235, 0.2)",
5476
+ borderRadius: "6px"
5477
+ },
5478
+ children: [
5479
+ /* @__PURE__ */ jsxs31("div", { children: [
5480
+ /* @__PURE__ */ jsxs31(
5481
+ "span",
5482
+ {
5483
+ style: {
5484
+ display: "block",
5485
+ fontWeight: 600,
5486
+ fontSize: "13px",
5487
+ color: "var(--arap-primary, #2563eb)"
5488
+ },
5489
+ children: [
5490
+ "\u2713 Current Profile: ",
5491
+ activeProfile.label
5492
+ ]
5493
+ }
5494
+ ),
5495
+ /* @__PURE__ */ jsx33(
5496
+ "span",
5497
+ {
5498
+ style: {
5499
+ display: "block",
5500
+ fontSize: "11px",
5501
+ color: "var(--arap-muted, #64748b)"
5502
+ },
5503
+ children: hasOverrides ? "Your custom adjustments survive alongside this profile." : "Neutral suggestion applied. Adjust any setting freely."
5504
+ }
5505
+ )
5506
+ ] }),
5507
+ /* @__PURE__ */ jsx33(
5508
+ "button",
5509
+ {
5510
+ type: "button",
5511
+ className: "arap-btn-sm",
5512
+ onClick: handleRevert,
5513
+ "aria-label": "Revert active profile",
5514
+ children: "Revert to Custom"
5515
+ }
5516
+ )
5517
+ ]
5518
+ }
5519
+ ),
5520
+ /* @__PURE__ */ jsxs31(
5521
+ "div",
5522
+ {
5523
+ className: "arap-navigator-search",
5524
+ style: { marginBottom: "10px" },
5525
+ children: [
5526
+ /* @__PURE__ */ jsx33("label", { htmlFor: searchInputId, className: "arap-sr-only", children: "Filter profiles" }),
5527
+ /* @__PURE__ */ jsx33(
5528
+ "input",
5529
+ {
5530
+ id: searchInputId,
5531
+ type: "search",
5532
+ className: "arap-search-input",
5533
+ value: search,
5534
+ onChange: (e) => setSearch(e.target.value),
5535
+ placeholder: "Search 8 accessibility profiles...",
5536
+ "aria-label": "Filter profiles"
5537
+ }
5538
+ ),
5539
+ search && /* @__PURE__ */ jsx33(
5540
+ "button",
5541
+ {
5542
+ type: "button",
5543
+ className: "arap-search-clear",
5544
+ onClick: () => setSearch(""),
5545
+ "aria-label": "Clear profile filter",
5546
+ children: "\xD7"
5547
+ }
5548
+ )
5549
+ ]
5550
+ }
5551
+ ),
5552
+ /* @__PURE__ */ jsx33(
5553
+ SearchCount,
5554
+ {
5555
+ totalCount: profiles.length,
5556
+ matchedCount: filteredProfiles.length,
5557
+ query: search
5558
+ }
5559
+ ),
5560
+ /* @__PURE__ */ jsx33(
5561
+ "div",
5562
+ {
5563
+ className: "arap-profiles-list",
5564
+ style: {
5565
+ display: "flex",
5566
+ flexDirection: "column",
5567
+ gap: "10px",
5568
+ marginTop: "8px"
5569
+ },
5570
+ children: filteredProfiles.length === 0 ? /* @__PURE__ */ jsx33(
5571
+ EmptyState,
5572
+ {
5573
+ title: "No profiles found",
5574
+ description: `No accessibility profiles match "${search}".`,
5575
+ actionLabel: "Clear filter",
5576
+ onAction: () => setSearch("")
5577
+ }
5578
+ ) : filteredProfiles.map((p) => /* @__PURE__ */ jsx33(
5579
+ ProfilePreviewCard,
5580
+ {
5581
+ profile: p,
5582
+ isActive: isProfileActive(p.id),
5583
+ onApply: () => handleApply(p.id),
5584
+ onRevert: handleRevert,
5585
+ largeControls
5586
+ },
5587
+ p.id
5588
+ ))
5589
+ }
5590
+ )
5591
+ ]
5592
+ }
5593
+ )
5594
+ ]
5595
+ }
5596
+ );
5597
+ }
5598
+ var ProfileController = ProfilesController;
5599
+ var AccessibilityProfilesController = ProfilesController;
5600
+
5601
+ // src/features/ResetController.tsx
5602
+ import { createPortal as createPortal2 } from "react-dom";
5603
+ import { useContext as useContext7 } from "react";
5604
+ import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
5605
+ function ResetController() {
5606
+ const ctx = useContext7(AccessibilityContext);
5607
+ if (!ctx) {
5608
+ throw new Error(
5609
+ "ResetController must be used within an <AccessibilityPlugin> provider."
5610
+ );
5611
+ }
5612
+ const actionHost = useContext7(PanelActionsContext);
5613
+ const { resetAll } = ctx;
5614
+ const strings = resolveLocaleStrings(ctx.locale);
5615
+ const button = /* @__PURE__ */ jsx34("div", { className: "arap-feature arap-feature-reset", children: /* @__PURE__ */ jsxs32("button", { className: "arap-reset-btn", onClick: resetAll, type: "button", children: [
5616
+ /* @__PURE__ */ jsx34(FeatureIcon, { name: "reset" }),
5617
+ strings.resetAll
5618
+ ] }) });
5619
+ return actionHost ? createPortal2(button, actionHost) : button;
5620
+ }
5621
+
5622
+ // src/features/PresetsController.tsx
5623
+ import { useId as useId3, useRef as useRef7, useState as useState9 } from "react";
5624
+
5625
+ // src/core/usePresets.ts
5626
+ import { useCallback as useCallback6, useContext as useContext8, useMemo as useMemo3 } from "react";
5627
+
5628
+ // src/core/presets.ts
5629
+ var ALLOWED_PREFERENCE_KEYS = Object.freeze([
5630
+ "fontScale",
5631
+ "lineHeight",
5632
+ "letterSpacingEm",
5633
+ "wordSpacingEm",
5634
+ "paragraphSpacingEm",
5635
+ "textAlign",
5636
+ "contrastMode",
5637
+ "highlightLinks",
5638
+ "highlightFocus",
5639
+ "reduceMotion",
5640
+ "hideDecorativeImages",
5641
+ "fontFamily",
5642
+ "cursorSize",
5643
+ "readerMode",
5644
+ "saturation",
5645
+ "tooltips"
5646
+ ]);
5647
+ var FORBIDDEN_KEYS = /* @__PURE__ */ new Set([
5648
+ "__proto__",
5649
+ "constructor",
5650
+ "prototype",
5651
+ "token",
5652
+ "auth",
5653
+ "password",
5654
+ "email",
5655
+ "user",
5656
+ "userId",
5657
+ "session",
5658
+ "cookie",
5659
+ "transcript",
5660
+ "recording",
5661
+ "pageContent",
5662
+ "notes",
5663
+ "input"
5664
+ ]);
5665
+ function sanitizePreferences(raw) {
5666
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
5667
+ return {};
5668
+ }
5669
+ const record = raw;
5670
+ const clean = {};
5671
+ for (const key of ALLOWED_PREFERENCE_KEYS) {
5672
+ if (key in record && record[key] !== void 0 && !FORBIDDEN_KEYS.has(key)) {
5673
+ clean[key] = normalizePreferenceValue(
5674
+ key,
5675
+ record[key]
5676
+ );
5677
+ }
5678
+ }
5679
+ return clean;
5680
+ }
5681
+ function generatePresetId() {
5682
+ const timestamp = Date.now();
5683
+ const randomPart = Math.random().toString(36).substring(2, 9);
5684
+ return `preset_${timestamp}_${randomPart}`;
5685
+ }
5686
+ function createCustomPreset(name, settings) {
5687
+ const trimmedName = (name || "").trim() || `Preset ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`;
5688
+ const sanitizedSettings = sanitizePreferences(settings);
5689
+ return {
5690
+ id: generatePresetId(),
5691
+ name: trimmedName.slice(0, 60),
5692
+ // clamp name length
5693
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5694
+ settings: sanitizedSettings
5695
+ };
5696
+ }
5697
+ function isValidCustomPreset(item) {
5698
+ if (!item || typeof item !== "object" || Array.isArray(item)) {
5699
+ return false;
5700
+ }
5701
+ const candidate = item;
5702
+ return typeof candidate.id === "string" && candidate.id.length > 0 && typeof candidate.name === "string" && candidate.name.length > 0 && typeof candidate.createdAt === "string" && typeof candidate.settings === "object" && candidate.settings !== null && !Array.isArray(candidate.settings);
5703
+ }
5704
+ function exportPresetsToJson(options) {
5705
+ const envelope = {
5706
+ $schema: "https://accessibility-plugin.org/schemas/presets-v1.json",
5707
+ version: 1,
5708
+ app: "accessibility-plugin-react",
5709
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
5710
+ presets: options.presets.map((p) => ({
5711
+ id: p.id,
5712
+ name: p.name,
5713
+ createdAt: p.createdAt,
5714
+ updatedAt: p.updatedAt,
5715
+ settings: sanitizePreferences(p.settings)
5716
+ }))
5717
+ };
5718
+ if (options.currentSettings) {
5719
+ envelope.currentSettings = sanitizePreferences(options.currentSettings);
5720
+ }
5721
+ return JSON.stringify(envelope, null, 2);
5722
+ }
5723
+ function downloadJsonFile(filename, jsonContent) {
5724
+ if (typeof window === "undefined" || typeof document === "undefined") return;
5725
+ const blob = new Blob([jsonContent], {
5726
+ type: "application/json;charset=utf-8"
5727
+ });
5728
+ const url = URL.createObjectURL(blob);
5729
+ const anchor = document.createElement("a");
5730
+ anchor.href = url;
5731
+ anchor.download = filename.endsWith(".json") ? filename : `${filename}.json`;
5732
+ anchor.style.display = "none";
5733
+ document.body.appendChild(anchor);
5734
+ anchor.click();
5735
+ document.body.removeChild(anchor);
5736
+ URL.revokeObjectURL(url);
5737
+ }
5738
+ function validateAndParseImport(jsonString) {
5739
+ if (!jsonString || typeof jsonString !== "string" || !jsonString.trim()) {
5740
+ return {
5741
+ success: false,
5742
+ error: "Import file is empty."
5743
+ };
5744
+ }
5745
+ let raw;
5746
+ try {
5747
+ raw = JSON.parse(jsonString);
5748
+ } catch {
5749
+ return {
5750
+ success: false,
5751
+ error: "Invalid JSON format: syntax error in file."
5752
+ };
5753
+ }
5754
+ if (!raw || typeof raw !== "object") {
5755
+ return {
5756
+ success: false,
5757
+ error: "Malformed import: file root must be an object or array."
5758
+ };
5759
+ }
5760
+ if (Array.isArray(raw)) {
5761
+ const validPresets = [];
5762
+ for (const item of raw) {
5763
+ if (typeof item === "object" && item !== null && !Array.isArray(item)) {
5764
+ const p = item;
5765
+ const name = typeof p.name === "string" ? p.name : "Imported Preset";
5766
+ const id = typeof p.id === "string" && p.id ? p.id : generatePresetId();
5767
+ const createdAt = typeof p.createdAt === "string" ? p.createdAt : (/* @__PURE__ */ new Date()).toISOString();
5768
+ const settings = sanitizePreferences(p.settings || p);
5769
+ if (Object.keys(settings).length > 0) {
5770
+ validPresets.push({ id, name, createdAt, settings });
5771
+ }
5772
+ }
5773
+ }
5774
+ if (validPresets.length === 0) {
5775
+ return {
5776
+ success: false,
5777
+ error: "Array did not contain any valid accessibility presets."
5778
+ };
5779
+ }
5780
+ return {
5781
+ success: true,
5782
+ presets: validPresets,
5783
+ message: `Successfully imported ${validPresets.length} preset(s).`
5784
+ };
5785
+ }
5786
+ const obj = raw;
5787
+ if ("version" in obj && typeof obj.version === "number") {
5788
+ if (obj.version > 1) {
5789
+ return {
5790
+ success: false,
5791
+ error: `Unsupported schema version: version ${obj.version} is newer than supported version 1.`
5792
+ };
5793
+ }
5794
+ if (obj.version < 1) {
5795
+ return {
5796
+ success: false,
5797
+ error: `Unsupported schema version: version ${obj.version} is not recognized.`
5798
+ };
5799
+ }
5800
+ }
5801
+ const importedPresets = [];
5802
+ if (Array.isArray(obj.presets)) {
5803
+ for (const item of obj.presets) {
5804
+ if (isValidCustomPreset(item)) {
5805
+ importedPresets.push({
5806
+ id: item.id,
5807
+ name: item.name,
5808
+ createdAt: item.createdAt,
5809
+ updatedAt: item.updatedAt,
5810
+ settings: sanitizePreferences(item.settings)
5811
+ });
5812
+ } else if (typeof item === "object" && item !== null) {
5813
+ const record = item;
5814
+ const name = typeof record.name === "string" ? record.name : "Imported Preset";
5815
+ const id = typeof record.id === "string" && record.id ? record.id : generatePresetId();
5816
+ const createdAt = typeof record.createdAt === "string" ? record.createdAt : (/* @__PURE__ */ new Date()).toISOString();
5817
+ const settings = sanitizePreferences(record.settings || record);
5818
+ if (Object.keys(settings).length > 0) {
5819
+ importedPresets.push({ id, name, createdAt, settings });
5820
+ }
5821
+ }
5822
+ }
5823
+ }
5824
+ let currentSettings;
5825
+ if ("currentSettings" in obj && typeof obj.currentSettings === "object") {
5826
+ currentSettings = sanitizePreferences(obj.currentSettings);
5827
+ } else if (!("presets" in obj) && !("version" in obj)) {
5828
+ const flat = sanitizePreferences(obj);
5829
+ if (Object.keys(flat).length > 0) {
5830
+ currentSettings = flat;
5831
+ }
5832
+ }
5833
+ if (importedPresets.length === 0 && (!currentSettings || Object.keys(currentSettings).length === 0)) {
5834
+ return {
5835
+ success: false,
5836
+ error: "No valid presets or accessibility settings found in the file."
5837
+ };
5838
+ }
5839
+ const parts = [];
5840
+ if (importedPresets.length > 0)
5841
+ parts.push(`${importedPresets.length} preset(s)`);
5842
+ if (currentSettings && Object.keys(currentSettings).length > 0)
5843
+ parts.push("current settings");
5844
+ return {
5845
+ success: true,
5846
+ presets: importedPresets,
5847
+ currentSettings,
5848
+ message: `Successfully imported ${parts.join(" and ")}.`
5849
+ };
5850
+ }
5851
+ function applyCustomPresetToStore(preset, setFeatureState) {
5852
+ const mapped = mapProfileSettingsToFeatures(preset.settings);
5853
+ for (const [key, value] of Object.entries(mapped)) {
5854
+ try {
5855
+ setFeatureState(key, value);
5856
+ } catch {
5857
+ }
5858
+ }
5859
+ }
5860
+
5861
+ // src/core/usePresets.ts
5862
+ function usePresets() {
5863
+ const ctx = useContext8(AccessibilityContext);
5864
+ if (!ctx) {
5865
+ throw new Error(
5866
+ "usePresets must be used within an <AccessibilityPlugin> provider."
5867
+ );
5868
+ }
5869
+ const { value: rawPresets, setValue: setPresets } = useAccessibility("customPresets", []);
5870
+ const presets = useMemo3(
5871
+ () => Array.isArray(rawPresets) ? rawPresets : [],
5872
+ [rawPresets]
5873
+ );
5874
+ const currentSettings = useMemo3(
5875
+ () => mapFeaturesToProfileSettings(ctx.state.features),
5876
+ [ctx.state.features]
5877
+ );
5878
+ const saveCurrentAsPreset = useCallback6(
5879
+ (name) => {
5880
+ const newPreset = createCustomPreset(name, currentSettings);
5881
+ setPresets([...presets, newPreset]);
5882
+ return newPreset;
5883
+ },
5884
+ [currentSettings, presets, setPresets]
5885
+ );
5886
+ const applyPreset = useCallback6(
5887
+ (presetId) => {
5888
+ const found = presets.find((p) => p.id === presetId);
5889
+ if (!found) return false;
5890
+ applyCustomPresetToStore(found, ctx.setFeatureState);
5891
+ return true;
5892
+ },
5893
+ [ctx.setFeatureState, presets]
5894
+ );
5895
+ const deletePreset = useCallback6(
5896
+ (presetId) => {
5897
+ const next = presets.filter((p) => p.id !== presetId);
5898
+ if (next.length === presets.length) return false;
5899
+ setPresets(next);
5900
+ return true;
5901
+ },
5902
+ [presets, setPresets]
5903
+ );
5904
+ const exportPresets = useCallback6(() => {
5905
+ return exportPresetsToJson({ presets, currentSettings });
5906
+ }, [currentSettings, presets]);
5907
+ const downloadExport = useCallback6(
5908
+ (filename) => {
5909
+ const json = exportPresetsToJson({ presets, currentSettings });
5910
+ const dateStr = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
5911
+ const targetName = filename || `accessibility-preferences-${dateStr}.json`;
5912
+ downloadJsonFile(targetName, json);
5913
+ },
5914
+ [currentSettings, presets]
5915
+ );
5916
+ const importFromJson = useCallback6(
5917
+ (jsonStr) => {
5918
+ const result = validateAndParseImport(jsonStr);
5919
+ if (!result.success) {
5920
+ return result;
5921
+ }
5922
+ if (result.presets.length > 0) {
5923
+ const existingMap = new Map(presets.map((p) => [p.id, p]));
5924
+ for (const p of result.presets) {
5925
+ existingMap.set(p.id, p);
5926
+ }
5927
+ setPresets(Array.from(existingMap.values()));
5928
+ }
5929
+ if (result.currentSettings && Object.keys(result.currentSettings).length > 0) {
5930
+ applyCustomPresetToStore(
5931
+ {
5932
+ id: "temp_import",
5933
+ name: "Imported Settings",
5934
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5935
+ settings: result.currentSettings
5936
+ },
5937
+ ctx.setFeatureState
5938
+ );
5939
+ }
5940
+ return result;
5941
+ },
5942
+ [ctx.setFeatureState, presets, setPresets]
5943
+ );
5944
+ const importFromFile = useCallback6(
5945
+ async (file) => {
5946
+ try {
5947
+ const text = await file.text();
5948
+ return importFromJson(text);
5949
+ } catch (err) {
5950
+ return {
5951
+ success: false,
5952
+ error: `Failed to read file: ${err instanceof Error ? err.message : String(err)}`
5953
+ };
5954
+ }
5955
+ },
5956
+ [importFromJson]
5957
+ );
5958
+ return {
5959
+ presets,
5960
+ currentSettings,
5961
+ saveCurrentAsPreset,
5962
+ applyPreset,
5963
+ deletePreset,
5964
+ exportPresets,
5965
+ downloadExport,
5966
+ importFromJson,
5967
+ importFromFile
5968
+ };
5969
+ }
5970
+
5971
+ // src/features/PresetsController.tsx
5972
+ import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
5973
+ function PresetsController({
5974
+ className = "",
5975
+ label = "Custom Presets",
5976
+ description = "Save, restore, and transfer your settings",
5977
+ largeControls = false
5978
+ }) {
5979
+ const [isOpen, setIsOpen] = useState9(false);
5980
+ const [presetName, setPresetName] = useState9("");
5981
+ const [statusMessage, setStatusMessage] = useState9("");
5982
+ const [errorMessage, setErrorMessage] = useState9("");
5983
+ const dialogId = "arap-presets-dialog";
5984
+ const nameInputId = useId3();
5985
+ const fileInputRef = useRef7(null);
5986
+ const triggerRef = useRef7(null);
5987
+ const {
5988
+ presets,
5989
+ saveCurrentAsPreset,
5990
+ applyPreset,
5991
+ deletePreset,
5992
+ downloadExport,
5993
+ importFromFile
5994
+ } = usePresets();
5995
+ const handleSave = () => {
5996
+ const trimmed = presetName.trim();
5997
+ if (!trimmed) {
5998
+ setErrorMessage("Please enter a name for your preset.");
5999
+ setStatusMessage("");
6000
+ return;
6001
+ }
6002
+ const created = saveCurrentAsPreset(trimmed);
6003
+ setPresetName("");
6004
+ setErrorMessage("");
6005
+ setStatusMessage(`Preset "${created.name}" saved successfully.`);
6006
+ };
6007
+ const handleApply = (preset) => {
6008
+ const success = applyPreset(preset.id);
6009
+ if (success) {
6010
+ setErrorMessage("");
6011
+ setStatusMessage(`Preset "${preset.name}" applied.`);
6012
+ }
6013
+ };
6014
+ const handleDelete = (preset) => {
6015
+ const success = deletePreset(preset.id);
6016
+ if (success) {
6017
+ setErrorMessage("");
6018
+ setStatusMessage(`Preset "${preset.name}" deleted.`);
6019
+ }
6020
+ };
6021
+ const handleExport = () => {
6022
+ downloadExport();
6023
+ setErrorMessage("");
6024
+ setStatusMessage("Settings and presets exported to JSON file.");
6025
+ };
6026
+ const handleFileInputChange = async (e) => {
6027
+ const file = e.target.files?.[0];
6028
+ if (!file) return;
6029
+ const result = await importFromFile(file);
6030
+ if (result.success) {
6031
+ setErrorMessage("");
6032
+ setStatusMessage(result.message);
6033
+ } else {
6034
+ setStatusMessage("");
6035
+ setErrorMessage(result.error);
6036
+ }
6037
+ if (fileInputRef.current) {
6038
+ fileInputRef.current.value = "";
6039
+ }
6040
+ };
6041
+ const formatKeyName = (key) => {
6042
+ switch (key) {
6043
+ case "fontScale":
6044
+ return "Font Size";
6045
+ case "lineHeight":
6046
+ return "Line Height";
6047
+ case "contrastMode":
6048
+ return "Contrast";
6049
+ case "reduceMotion":
6050
+ return "Reduce Motion";
6051
+ case "textAlign":
6052
+ return "Text Align";
6053
+ case "highlightLinks":
6054
+ return "Highlight Links";
6055
+ case "highlightFocus":
6056
+ return "Highlight Focus";
6057
+ case "cursorSize":
6058
+ return "Cursor Size";
6059
+ case "readerMode":
6060
+ return "Reading Mode";
6061
+ case "saturation":
6062
+ return "Saturation";
6063
+ case "hideDecorativeImages":
6064
+ return "Hide Images";
6065
+ default:
6066
+ return key.replace(/([A-Z])/g, " $1").trim();
6067
+ }
6068
+ };
6069
+ const formatSettingValue = (key, val) => {
6070
+ if (typeof val === "boolean") return val ? "On" : "Off";
6071
+ if (key === "fontScale" && typeof val === "number")
6072
+ return `${Math.round(val * 100)}%`;
6073
+ if (key === "lineHeight" && typeof val === "number")
6074
+ return `${Math.round(val * 100)}%`;
6075
+ if (val === null || val === void 0) return "Original";
6076
+ return String(val);
6077
+ };
6078
+ return /* @__PURE__ */ jsxs33(
6079
+ "div",
6080
+ {
6081
+ className: `arap-feature arap-feature-expandable ${largeControls ? "arap-large-controls" : ""} ${className}`,
6082
+ role: "group",
6083
+ "aria-label": label,
6084
+ children: [
6085
+ /* @__PURE__ */ jsxs33(
6086
+ "div",
6087
+ {
6088
+ style: {
6089
+ display: "flex",
6090
+ alignItems: "center",
6091
+ justifyContent: "space-between",
6092
+ width: "100%"
6093
+ },
6094
+ children: [
6095
+ /* @__PURE__ */ jsxs33("span", { className: "arap-label", children: [
6096
+ /* @__PURE__ */ jsx35(FeatureIcon, { name: "presets" }),
6097
+ /* @__PURE__ */ jsxs33("span", { children: [
6098
+ /* @__PURE__ */ jsx35("span", { style: { display: "block" }, children: label }),
6099
+ description && /* @__PURE__ */ jsx35(
6100
+ "span",
6101
+ {
6102
+ style: {
6103
+ display: "block",
6104
+ fontSize: "11px",
6105
+ fontWeight: 400,
6106
+ color: "var(--arap-muted, #64748b)",
6107
+ marginTop: "1px"
6108
+ },
6109
+ children: presets.length > 0 ? `${presets.length} custom preset${presets.length === 1 ? "" : "s"} saved` : description
6110
+ }
6111
+ )
6112
+ ] })
6113
+ ] }),
6114
+ /* @__PURE__ */ jsx35(
6115
+ "button",
6116
+ {
6117
+ ref: triggerRef,
6118
+ className: "arap-btn-sm",
6119
+ type: "button",
6120
+ "aria-expanded": isOpen,
6121
+ "aria-controls": dialogId,
6122
+ onClick: () => setIsOpen(!isOpen),
6123
+ children: isOpen ? "Close" : "Presets"
6124
+ }
6125
+ )
6126
+ ]
6127
+ }
6128
+ ),
6129
+ isOpen && /* @__PURE__ */ jsxs33(
6130
+ "div",
6131
+ {
6132
+ id: dialogId,
6133
+ role: "region",
6134
+ "aria-label": "Custom Presets and Settings",
6135
+ tabIndex: -1,
6136
+ style: {
6137
+ marginTop: "12px",
6138
+ padding: "12px",
6139
+ borderRadius: "6px",
6140
+ backgroundColor: "var(--arap-card-bg, #f8fafc)",
6141
+ border: "1px solid var(--arap-border, #e2e8f0)"
6142
+ },
6143
+ onKeyDown: (e) => {
6144
+ if (e.key === "Escape") {
6145
+ e.stopPropagation();
6146
+ setIsOpen(false);
6147
+ triggerRef.current?.focus();
6148
+ }
6149
+ },
6150
+ children: [
6151
+ /* @__PURE__ */ jsxs33(
6152
+ "div",
6153
+ {
6154
+ role: "status",
6155
+ "aria-live": "polite",
6156
+ className: "arap-presets-status",
6157
+ style: {
6158
+ minHeight: statusMessage || errorMessage ? "24px" : "0",
6159
+ marginBottom: statusMessage || errorMessage ? "8px" : "0"
6160
+ },
6161
+ children: [
6162
+ statusMessage && /* @__PURE__ */ jsxs33(
6163
+ "div",
6164
+ {
6165
+ style: {
6166
+ fontSize: "12px",
6167
+ fontWeight: 500,
6168
+ color: "var(--arap-success, #16a34a)",
6169
+ padding: "4px 8px",
6170
+ backgroundColor: "rgba(22, 163, 74, 0.1)",
6171
+ borderRadius: "4px"
6172
+ },
6173
+ children: [
6174
+ "\u2713 ",
6175
+ statusMessage
6176
+ ]
6177
+ }
6178
+ ),
6179
+ errorMessage && /* @__PURE__ */ jsxs33(
6180
+ "div",
6181
+ {
6182
+ role: "alert",
6183
+ style: {
6184
+ fontSize: "12px",
6185
+ fontWeight: 500,
6186
+ color: "var(--arap-error, #dc2626)",
6187
+ padding: "4px 8px",
6188
+ backgroundColor: "rgba(220, 38, 38, 0.1)",
6189
+ borderRadius: "4px"
6190
+ },
6191
+ children: [
6192
+ "\u26A0 ",
6193
+ errorMessage
6194
+ ]
6195
+ }
6196
+ )
6197
+ ]
6198
+ }
6199
+ ),
6200
+ /* @__PURE__ */ jsxs33(
6201
+ "div",
6202
+ {
6203
+ className: "arap-presets-save-section",
6204
+ style: { marginBottom: "14px" },
6205
+ children: [
6206
+ /* @__PURE__ */ jsx35(
6207
+ "label",
6208
+ {
6209
+ htmlFor: nameInputId,
6210
+ style: {
6211
+ display: "block",
6212
+ fontSize: "12px",
6213
+ fontWeight: 600,
6214
+ marginBottom: "4px",
6215
+ color: "var(--arap-text, #1e293b)"
6216
+ },
6217
+ children: "Save current settings as preset:"
6218
+ }
6219
+ ),
6220
+ /* @__PURE__ */ jsxs33("div", { style: { display: "flex", gap: "6px" }, children: [
6221
+ /* @__PURE__ */ jsx35(
6222
+ "input",
6223
+ {
6224
+ id: nameInputId,
6225
+ type: "text",
6226
+ className: "arap-search-input",
6227
+ style: { flex: 1, padding: "6px 10px", fontSize: "13px" },
6228
+ value: presetName,
6229
+ onChange: (e) => {
6230
+ setPresetName(e.target.value);
6231
+ if (errorMessage) setErrorMessage("");
6232
+ },
6233
+ onKeyDown: (e) => {
6234
+ if (e.key === "Enter") {
6235
+ e.preventDefault();
6236
+ handleSave();
6237
+ }
6238
+ },
6239
+ placeholder: "Preset name (e.g. My Reading Setup)",
6240
+ "aria-label": "Preset name"
6241
+ }
6242
+ ),
6243
+ /* @__PURE__ */ jsx35(
6244
+ "button",
6245
+ {
6246
+ type: "button",
6247
+ className: "arap-btn-sm",
6248
+ onClick: handleSave,
6249
+ "aria-label": "Save current preset",
6250
+ children: "Save"
6251
+ }
6252
+ )
6253
+ ] })
6254
+ ]
6255
+ }
6256
+ ),
6257
+ /* @__PURE__ */ jsxs33(
6258
+ "div",
6259
+ {
6260
+ className: "arap-presets-transfer-section",
6261
+ style: {
6262
+ display: "flex",
6263
+ gap: "8px",
6264
+ marginBottom: "14px",
6265
+ paddingBottom: "12px",
6266
+ borderBottom: "1px solid var(--arap-border, #e2e8f0)"
6267
+ },
6268
+ children: [
6269
+ /* @__PURE__ */ jsx35(
6270
+ "button",
6271
+ {
6272
+ type: "button",
6273
+ className: "arap-btn-sm",
6274
+ style: { flex: 1 },
6275
+ onClick: handleExport,
6276
+ "aria-label": "Export settings and presets to JSON file",
6277
+ children: "Export JSON"
6278
+ }
6279
+ ),
6280
+ /* @__PURE__ */ jsx35(
6281
+ "button",
6282
+ {
6283
+ type: "button",
6284
+ className: "arap-btn-sm",
6285
+ style: { flex: 1 },
6286
+ onClick: () => fileInputRef.current?.click(),
6287
+ "aria-label": "Import settings and presets from JSON file",
6288
+ children: "Import JSON"
6289
+ }
6290
+ ),
6291
+ /* @__PURE__ */ jsx35(
6292
+ "input",
6293
+ {
6294
+ ref: fileInputRef,
6295
+ type: "file",
6296
+ accept: ".json,application/json",
6297
+ style: { display: "none" },
6298
+ "aria-label": "Upload JSON settings file",
6299
+ onChange: handleFileInputChange
6300
+ }
6301
+ )
6302
+ ]
6303
+ }
6304
+ ),
6305
+ /* @__PURE__ */ jsxs33("div", { className: "arap-presets-list-section", children: [
6306
+ /* @__PURE__ */ jsxs33(
6307
+ "h4",
6308
+ {
6309
+ style: {
6310
+ fontSize: "12px",
6311
+ fontWeight: 600,
6312
+ marginBottom: "6px",
6313
+ color: "var(--arap-text, #1e293b)"
6314
+ },
6315
+ children: [
6316
+ "Saved Presets (",
6317
+ presets.length,
6318
+ "):"
6319
+ ]
6320
+ }
6321
+ ),
6322
+ presets.length === 0 ? /* @__PURE__ */ jsx35(
6323
+ EmptyState,
6324
+ {
6325
+ title: "No saved presets yet",
6326
+ description: "Configure your preferences and save them above for quick 1-click access."
6327
+ }
6328
+ ) : /* @__PURE__ */ jsx35(
6329
+ "div",
6330
+ {
6331
+ style: {
6332
+ display: "flex",
6333
+ flexDirection: "column",
6334
+ gap: "8px"
6335
+ },
6336
+ children: presets.map((p) => {
6337
+ const affectedKeys = Object.keys(
6338
+ p.settings
6339
+ );
6340
+ return /* @__PURE__ */ jsxs33(
6341
+ "div",
6342
+ {
6343
+ className: "arap-preset-card",
6344
+ role: "group",
6345
+ "aria-label": `${p.name} preset`,
6346
+ style: {
6347
+ padding: "8px 10px",
6348
+ borderRadius: "6px",
6349
+ backgroundColor: "var(--arap-bg, #ffffff)",
6350
+ border: "1px solid var(--arap-border, #e2e8f0)"
6351
+ },
6352
+ children: [
6353
+ /* @__PURE__ */ jsxs33(
6354
+ "div",
6355
+ {
6356
+ style: {
6357
+ display: "flex",
6358
+ alignItems: "center",
6359
+ justifyContent: "space-between",
6360
+ marginBottom: "4px"
6361
+ },
6362
+ children: [
6363
+ /* @__PURE__ */ jsxs33("div", { children: [
6364
+ /* @__PURE__ */ jsx35(
6365
+ "strong",
6366
+ {
6367
+ style: {
6368
+ fontSize: "13px",
6369
+ color: "var(--arap-text, #1e293b)"
6370
+ },
6371
+ children: p.name
6372
+ }
6373
+ ),
6374
+ /* @__PURE__ */ jsxs33(
6375
+ "span",
6376
+ {
6377
+ style: {
6378
+ display: "block",
6379
+ fontSize: "10px",
6380
+ color: "var(--arap-muted, #64748b)"
6381
+ },
6382
+ children: [
6383
+ "Saved ",
6384
+ new Date(p.createdAt).toLocaleDateString()
6385
+ ]
6386
+ }
6387
+ )
6388
+ ] }),
6389
+ /* @__PURE__ */ jsxs33(
6390
+ "div",
6391
+ {
6392
+ style: {
6393
+ display: "flex",
6394
+ gap: "6px",
6395
+ alignItems: "center"
6396
+ },
6397
+ children: [
6398
+ /* @__PURE__ */ jsx35(
6399
+ "button",
6400
+ {
6401
+ type: "button",
6402
+ className: "arap-btn-sm",
6403
+ onClick: () => handleApply(p),
6404
+ "aria-label": `Apply preset ${p.name}`,
6405
+ children: "Apply"
6406
+ }
6407
+ ),
6408
+ /* @__PURE__ */ jsx35(
6409
+ "button",
6410
+ {
6411
+ type: "button",
6412
+ className: "arap-btn-sm",
6413
+ onClick: () => handleDelete(p),
6414
+ "aria-label": `Delete preset ${p.name}`,
6415
+ style: {
6416
+ color: "var(--arap-error, #dc2626)"
6417
+ },
6418
+ children: "Delete"
6419
+ }
6420
+ )
6421
+ ]
6422
+ }
6423
+ )
6424
+ ]
6425
+ }
6426
+ ),
6427
+ affectedKeys.length > 0 && /* @__PURE__ */ jsx35(
6428
+ "div",
6429
+ {
6430
+ className: "arap-profile-chips",
6431
+ style: { marginTop: "4px" },
6432
+ children: affectedKeys.map((key) => {
6433
+ const val = p.settings[key];
6434
+ return /* @__PURE__ */ jsxs33("span", { className: "arap-profile-chip", children: [
6435
+ /* @__PURE__ */ jsxs33("strong", { children: [
6436
+ formatKeyName(key),
6437
+ ":"
6438
+ ] }),
6439
+ " ",
6440
+ formatSettingValue(key, val)
6441
+ ] }, key);
6442
+ })
6443
+ }
6444
+ )
6445
+ ]
6446
+ },
6447
+ p.id
6448
+ );
6449
+ })
6450
+ }
6451
+ )
6452
+ ] })
6453
+ ]
6454
+ }
6455
+ )
6456
+ ]
6457
+ }
6458
+ );
6459
+ }
6460
+ var CustomPresetsController = PresetsController;
6461
+ var SettingsImportExportController = PresetsController;
6462
+ var PresetsBackupController = PresetsController;
6463
+
6464
+ // src/core/controls/ToggleControl.tsx
6465
+ import { jsx as jsx36 } from "react/jsx-runtime";
6466
+ function ToggleControl({
6467
+ id,
6468
+ label,
6469
+ checked,
6470
+ onChange,
6471
+ disabled = false,
6472
+ unavailable = false,
6473
+ unavailableReason,
6474
+ name,
6475
+ description,
6476
+ largeControls = false,
6477
+ className = "",
6478
+ style
6479
+ }) {
6480
+ const isInteractive = !disabled && !unavailable;
6481
+ const toggleLabel = typeof label === "string" ? label : void 0;
6482
+ const handleClick = () => {
6483
+ if (isInteractive) {
6484
+ onChange(!checked);
6485
+ }
6486
+ };
6487
+ return /* @__PURE__ */ jsx36(
6488
+ "div",
6489
+ {
6490
+ className: `arap-toggle-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
6491
+ style,
6492
+ children: /* @__PURE__ */ jsx36(
6493
+ "button",
6494
+ {
6495
+ id,
6496
+ name,
6497
+ type: "button",
6498
+ className: `arap-toggle ${checked ? "arap-toggle-active" : ""}`,
6499
+ role: "switch",
6500
+ "aria-checked": checked,
6501
+ "aria-label": toggleLabel,
6502
+ "aria-disabled": !isInteractive,
6503
+ disabled: !isInteractive,
6504
+ onClick: handleClick,
6505
+ title: unavailableReason || description || toggleLabel,
6506
+ children: /* @__PURE__ */ jsx36(
6507
+ "span",
6508
+ {
6509
+ className: "arap-toggle-knob",
6510
+ style: {
6511
+ transform: checked ? largeControls ? "translateX(28px)" : "translateX(24px)" : "translateX(0)"
6512
+ }
6513
+ }
6514
+ )
6515
+ }
6516
+ )
6517
+ }
6518
+ );
6519
+ }
6520
+
6521
+ // src/core/controls/ChoiceControl.tsx
6522
+ import { useCallback as useCallback7, useMemo as useMemo4, useRef as useRef8 } from "react";
6523
+ import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
6524
+ function ChoiceControl({
6525
+ id,
6526
+ label,
6527
+ value,
6528
+ options,
6529
+ groups,
6530
+ onChange,
6531
+ disabled = false,
6532
+ largeControls = false,
6533
+ className = "",
6534
+ style,
6535
+ orientation = "horizontal"
6536
+ }) {
6537
+ const containerRef = useRef8(null);
6538
+ const allOptions = useMemo4(
6539
+ () => groups ? groups.flatMap((g) => g.options) : options || [],
6540
+ [groups, options]
6541
+ );
6542
+ const handleKeyDown = useCallback7(
6543
+ (e) => {
6544
+ if (disabled || allOptions.length === 0) return;
6545
+ const enabledOptions = allOptions.filter((opt) => !opt.disabled);
6546
+ const currentIndex = enabledOptions.findIndex(
6547
+ (opt) => opt.value === value
6548
+ );
6549
+ let nextIndex = -1;
6550
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") {
6551
+ e.preventDefault();
6552
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % enabledOptions.length;
6553
+ } else if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
6554
+ e.preventDefault();
6555
+ nextIndex = currentIndex === -1 ? enabledOptions.length - 1 : (currentIndex - 1 + enabledOptions.length) % enabledOptions.length;
6556
+ } else if (e.key === "Home") {
6557
+ e.preventDefault();
6558
+ nextIndex = 0;
6559
+ } else if (e.key === "End") {
6560
+ e.preventDefault();
6561
+ nextIndex = enabledOptions.length - 1;
6562
+ }
6563
+ if (nextIndex !== -1 && enabledOptions[nextIndex]) {
6564
+ onChange(enabledOptions[nextIndex].value);
6565
+ const buttons = containerRef.current?.querySelectorAll(
6566
+ "button[data-choice-value]"
6567
+ );
6568
+ const targetBtn = Array.from(buttons || []).find(
6569
+ (b) => b.getAttribute("data-choice-value") === String(enabledOptions[nextIndex].value)
6570
+ );
6571
+ targetBtn?.focus();
6572
+ }
6573
+ },
6574
+ [allOptions, disabled, onChange, value]
6575
+ );
6576
+ const renderOptionButton = (opt) => {
6577
+ const isSelected = value === opt.value;
6578
+ const isOptionDisabled = disabled || Boolean(opt.disabled);
6579
+ return /* @__PURE__ */ jsxs34(
4523
6580
  "button",
4524
6581
  {
4525
6582
  type: "button",
@@ -4533,15 +6590,15 @@ function ChoiceControl({
4533
6590
  onClick: () => !isOptionDisabled && onChange(opt.value),
4534
6591
  title: opt.description,
4535
6592
  children: [
4536
- isSelected && /* @__PURE__ */ jsx32("span", { className: "arap-check", "aria-hidden": "true", children: "\u2713" }),
4537
- /* @__PURE__ */ jsx32("span", { children: opt.label }),
4538
- opt.badge && /* @__PURE__ */ jsx32("span", { className: "arap-choice-badge", "aria-hidden": "true", children: opt.badge })
6593
+ isSelected && /* @__PURE__ */ jsx37("span", { className: "arap-check", "aria-hidden": "true", children: "\u2713" }),
6594
+ /* @__PURE__ */ jsx37("span", { children: opt.label }),
6595
+ opt.badge && /* @__PURE__ */ jsx37("span", { className: "arap-choice-badge", "aria-hidden": "true", children: opt.badge })
4539
6596
  ]
4540
6597
  },
4541
6598
  String(opt.value)
4542
6599
  );
4543
6600
  };
4544
- return /* @__PURE__ */ jsx32(
6601
+ return /* @__PURE__ */ jsx37(
4545
6602
  "div",
4546
6603
  {
4547
6604
  ref: containerRef,
@@ -4552,15 +6609,15 @@ function ChoiceControl({
4552
6609
  className: `arap-choice-control arap-segmented ${largeControls ? "arap-large-controls" : ""} ${className}`,
4553
6610
  style,
4554
6611
  onKeyDown: handleKeyDown,
4555
- children: groups ? groups.map((group) => /* @__PURE__ */ jsxs29(
6612
+ children: groups ? groups.map((group) => /* @__PURE__ */ jsxs34(
4556
6613
  "div",
4557
6614
  {
4558
6615
  className: "arap-choice-group",
4559
6616
  role: "group",
4560
6617
  "aria-label": group.label,
4561
6618
  children: [
4562
- /* @__PURE__ */ jsx32("span", { className: "arap-choice-group-title", children: group.label }),
4563
- /* @__PURE__ */ jsx32("div", { className: "arap-segmented", children: group.options.map(renderOptionButton) })
6619
+ /* @__PURE__ */ jsx37("span", { className: "arap-choice-group-title", children: group.label }),
6620
+ /* @__PURE__ */ jsx37("div", { className: "arap-segmented", children: group.options.map(renderOptionButton) })
4564
6621
  ]
4565
6622
  },
4566
6623
  group.label
@@ -4570,7 +6627,7 @@ function ChoiceControl({
4570
6627
  }
4571
6628
 
4572
6629
  // src/core/controls/StepperControl.tsx
4573
- import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
6630
+ import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
4574
6631
  function StepperControl({
4575
6632
  id,
4576
6633
  label,
@@ -4600,15 +6657,15 @@ function StepperControl({
4600
6657
  onChange(Math.min(max, Number((value + step).toFixed(2))));
4601
6658
  }
4602
6659
  };
4603
- return /* @__PURE__ */ jsxs30(
6660
+ return /* @__PURE__ */ jsxs35(
4604
6661
  "div",
4605
6662
  {
4606
6663
  id,
4607
6664
  className: `arap-stepper-control-wrapper ${largeControls ? "arap-large-controls" : ""} ${className}`,
4608
6665
  style,
4609
6666
  children: [
4610
- /* @__PURE__ */ jsxs30("div", { className: "arap-controls", children: [
4611
- /* @__PURE__ */ jsx33(
6667
+ /* @__PURE__ */ jsxs35("div", { className: "arap-controls", children: [
6668
+ /* @__PURE__ */ jsx38(
4612
6669
  "button",
4613
6670
  {
4614
6671
  type: "button",
@@ -4619,8 +6676,8 @@ function StepperControl({
4619
6676
  children: "\u2212"
4620
6677
  }
4621
6678
  ),
4622
- /* @__PURE__ */ jsx33("output", { className: "arap-value", "aria-live": "polite", children: displayValue }),
4623
- /* @__PURE__ */ jsx33(
6679
+ /* @__PURE__ */ jsx38("output", { className: "arap-value", "aria-live": "polite", children: displayValue }),
6680
+ /* @__PURE__ */ jsx38(
4624
6681
  "button",
4625
6682
  {
4626
6683
  type: "button",
@@ -4632,7 +6689,7 @@ function StepperControl({
4632
6689
  }
4633
6690
  )
4634
6691
  ] }),
4635
- showSlider && /* @__PURE__ */ jsx33("div", { className: "arap-slider-container", children: /* @__PURE__ */ jsx33(
6692
+ showSlider && /* @__PURE__ */ jsx38("div", { className: "arap-slider-container", children: /* @__PURE__ */ jsx38(
4636
6693
  "input",
4637
6694
  {
4638
6695
  type: "range",
@@ -4656,7 +6713,7 @@ function StepperControl({
4656
6713
  }
4657
6714
 
4658
6715
  // src/core/controls/FeatureCard.tsx
4659
- import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
6716
+ import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
4660
6717
  function FeatureCard({
4661
6718
  id,
4662
6719
  featureKey,
@@ -4675,7 +6732,7 @@ function FeatureCard({
4675
6732
  largeControls = false
4676
6733
  }) {
4677
6734
  const cardTitle = typeof title === "string" ? title : void 0;
4678
- return /* @__PURE__ */ jsxs31(
6735
+ return /* @__PURE__ */ jsxs36(
4679
6736
  "div",
4680
6737
  {
4681
6738
  id,
@@ -4684,27 +6741,27 @@ function FeatureCard({
4684
6741
  className: `arap-feature arap-feature-card ${status !== "idle" ? `arap-feature-${status}` : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
4685
6742
  style,
4686
6743
  children: [
4687
- /* @__PURE__ */ jsxs31("div", { className: "arap-card-header", children: [
4688
- /* @__PURE__ */ jsxs31("span", { className: "arap-label", children: [
4689
- icon ?? (featureKey ? /* @__PURE__ */ jsx34(FeatureIcon, { name: featureKey }) : null),
4690
- /* @__PURE__ */ jsx34("span", { className: "arap-card-title", children: title })
6744
+ /* @__PURE__ */ jsxs36("div", { className: "arap-card-header", children: [
6745
+ /* @__PURE__ */ jsxs36("span", { className: "arap-label", children: [
6746
+ icon ?? (featureKey ? /* @__PURE__ */ jsx39(FeatureIcon, { name: featureKey }) : null),
6747
+ /* @__PURE__ */ jsx39("span", { className: "arap-card-title", children: title })
4691
6748
  ] }),
4692
- statusBadge && /* @__PURE__ */ jsx34("span", { className: "arap-status-badge", "aria-hidden": "true", children: statusBadge })
6749
+ statusBadge && /* @__PURE__ */ jsx39("span", { className: "arap-status-badge", "aria-hidden": "true", children: statusBadge })
4693
6750
  ] }),
4694
- description && /* @__PURE__ */ jsx34("p", { className: "arap-card-desc", children: description }),
4695
- status === "error" && errorMessage && /* @__PURE__ */ jsxs31("div", { className: "arap-card-alert arap-card-error", role: "alert", children: [
4696
- /* @__PURE__ */ jsx34("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
4697
- /* @__PURE__ */ jsx34("span", { children: errorMessage })
6751
+ description && /* @__PURE__ */ jsx39("p", { className: "arap-card-desc", children: description }),
6752
+ status === "error" && errorMessage && /* @__PURE__ */ jsxs36("div", { className: "arap-card-alert arap-card-error", role: "alert", children: [
6753
+ /* @__PURE__ */ jsx39("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
6754
+ /* @__PURE__ */ jsx39("span", { children: errorMessage })
4698
6755
  ] }),
4699
- status === "unavailable" && unavailableMessage && /* @__PURE__ */ jsxs31("div", { className: "arap-card-alert arap-card-unavailable", role: "status", children: [
4700
- /* @__PURE__ */ jsx34("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u2139\uFE0F" }),
4701
- /* @__PURE__ */ jsx34("span", { children: unavailableMessage })
6756
+ status === "unavailable" && unavailableMessage && /* @__PURE__ */ jsxs36("div", { className: "arap-card-alert arap-card-unavailable", role: "status", children: [
6757
+ /* @__PURE__ */ jsx39("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u2139\uFE0F" }),
6758
+ /* @__PURE__ */ jsx39("span", { children: unavailableMessage })
4702
6759
  ] }),
4703
- status === "permission-required" && permissionMessage && /* @__PURE__ */ jsxs31("div", { className: "arap-card-alert arap-card-permission", role: "status", children: [
4704
- /* @__PURE__ */ jsx34("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u{1F512}" }),
4705
- /* @__PURE__ */ jsxs31("div", { className: "arap-permission-content", children: [
4706
- /* @__PURE__ */ jsx34("span", { children: permissionMessage }),
4707
- onRequestPermission && /* @__PURE__ */ jsx34(
6760
+ status === "permission-required" && permissionMessage && /* @__PURE__ */ jsxs36("div", { className: "arap-card-alert arap-card-permission", role: "status", children: [
6761
+ /* @__PURE__ */ jsx39("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u{1F512}" }),
6762
+ /* @__PURE__ */ jsxs36("div", { className: "arap-permission-content", children: [
6763
+ /* @__PURE__ */ jsx39("span", { children: permissionMessage }),
6764
+ onRequestPermission && /* @__PURE__ */ jsx39(
4708
6765
  "button",
4709
6766
  {
4710
6767
  type: "button",
@@ -4715,198 +6772,19 @@ function FeatureCard({
4715
6772
  )
4716
6773
  ] })
4717
6774
  ] }),
4718
- /* @__PURE__ */ jsx34("div", { className: "arap-card-content", children })
4719
- ]
4720
- }
4721
- );
4722
- }
4723
-
4724
- // src/core/controls/FeatureStatusState.tsx
4725
- import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
4726
- function SearchCount({
4727
- totalCount,
4728
- matchedCount,
4729
- query,
4730
- className = "",
4731
- style
4732
- }) {
4733
- const text = query ? `Showing ${matchedCount} of ${totalCount} tools matching "${query}"` : `Showing all ${totalCount} tools`;
4734
- return /* @__PURE__ */ jsx35(
4735
- "div",
4736
- {
4737
- role: "status",
4738
- "aria-live": "polite",
4739
- className: `arap-search-count ${className}`,
4740
- style,
4741
- children: text
4742
- }
4743
- );
4744
- }
4745
- function EmptyState({
4746
- title = "No matching tools found",
4747
- description = "Try adjusting your search query or reset filters.",
4748
- actionLabel = "Clear search",
4749
- onAction,
4750
- icon,
4751
- className = "",
4752
- style
4753
- }) {
4754
- return /* @__PURE__ */ jsxs32(
4755
- "div",
4756
- {
4757
- role: "status",
4758
- className: `arap-empty-state ${className}`,
4759
- style,
4760
- children: [
4761
- /* @__PURE__ */ jsx35("div", { className: "arap-empty-icon", "aria-hidden": "true", children: icon ?? "\u{1F50D}" }),
4762
- /* @__PURE__ */ jsx35("h3", { className: "arap-empty-title", children: title }),
4763
- /* @__PURE__ */ jsx35("p", { className: "arap-empty-desc", children: description }),
4764
- onAction && /* @__PURE__ */ jsx35("button", { type: "button", className: "arap-empty-btn", onClick: onAction, children: actionLabel })
4765
- ]
4766
- }
4767
- );
4768
- }
4769
- function ErrorState({
4770
- title = "Something went wrong",
4771
- message,
4772
- onRetry,
4773
- retryLabel = "Try again",
4774
- className = "",
4775
- style
4776
- }) {
4777
- return /* @__PURE__ */ jsxs32(
4778
- "div",
4779
- {
4780
- role: "alert",
4781
- className: `arap-error-state arap-card-alert arap-card-error ${className}`,
4782
- style,
4783
- children: [
4784
- /* @__PURE__ */ jsx35("span", { className: "arap-alert-icon", "aria-hidden": "true", children: "\u26A0\uFE0F" }),
4785
- /* @__PURE__ */ jsxs32("div", { className: "arap-error-content", children: [
4786
- title && /* @__PURE__ */ jsx35("h4", { className: "arap-error-title", children: title }),
4787
- /* @__PURE__ */ jsx35("p", { className: "arap-error-message", children: message }),
4788
- onRetry && /* @__PURE__ */ jsx35("button", { type: "button", className: "arap-retry-btn", onClick: onRetry, children: retryLabel })
4789
- ] })
4790
- ]
4791
- }
4792
- );
4793
- }
4794
-
4795
- // src/core/controls/ProfilePreviewCard.tsx
4796
- import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
4797
- function ProfilePreviewCard({
4798
- profile,
4799
- isActive,
4800
- onApply,
4801
- onRevert,
4802
- largeControls = false,
4803
- className = "",
4804
- style
4805
- }) {
4806
- const affectedKeys = Object.keys(
4807
- profile.settings
4808
- );
4809
- const formatKeyName = (key) => {
4810
- switch (key) {
4811
- case "fontScale":
4812
- return "Font Size";
4813
- case "lineHeight":
4814
- return "Line Height";
4815
- case "contrastMode":
4816
- return "Contrast";
4817
- case "reduceMotion":
4818
- return "Reduce Motion";
4819
- case "textAlign":
4820
- return "Text Align";
4821
- case "highlightLinks":
4822
- return "Highlight Links";
4823
- case "highlightFocus":
4824
- return "Highlight Focus";
4825
- case "cursorSize":
4826
- return "Cursor Size";
4827
- case "readerMode":
4828
- return "Reading Mode";
4829
- case "saturation":
4830
- return "Saturation";
4831
- case "hideDecorativeImages":
4832
- return "Hide Images";
4833
- default:
4834
- return key.replace(/([A-Z])/g, " $1").trim();
4835
- }
4836
- };
4837
- const formatSettingValue = (key, val) => {
4838
- if (typeof val === "boolean") return val ? "On" : "Off";
4839
- if (key === "fontScale" && typeof val === "number")
4840
- return `${Math.round(val * 100)}%`;
4841
- if (key === "lineHeight" && typeof val === "number")
4842
- return `${Math.round(val * 100)}%`;
4843
- if (val === null || val === void 0) return "Original";
4844
- return String(val);
4845
- };
4846
- return /* @__PURE__ */ jsxs33(
4847
- "div",
4848
- {
4849
- role: "group",
4850
- "aria-label": `${profile.label} profile`,
4851
- className: `arap-profile-card ${isActive ? "arap-profile-card-active" : ""} ${largeControls ? "arap-large-controls" : ""} ${className}`,
4852
- style,
4853
- children: [
4854
- /* @__PURE__ */ jsxs33("div", { className: "arap-profile-header", children: [
4855
- /* @__PURE__ */ jsxs33("div", { className: "arap-profile-title-row", children: [
4856
- /* @__PURE__ */ jsx36("h4", { className: "arap-profile-title", children: profile.label }),
4857
- isActive && /* @__PURE__ */ jsx36(
4858
- "span",
4859
- {
4860
- className: "arap-profile-active-badge",
4861
- "aria-label": "Active profile",
4862
- children: "\u2713 Active"
4863
- }
4864
- )
4865
- ] }),
4866
- /* @__PURE__ */ jsx36("p", { className: "arap-profile-desc", children: profile.description })
4867
- ] }),
4868
- /* @__PURE__ */ jsxs33("div", { className: "arap-profile-affected", children: [
4869
- /* @__PURE__ */ jsx36("span", { className: "arap-profile-affected-label", children: "Affected settings:" }),
4870
- /* @__PURE__ */ jsx36("div", { className: "arap-profile-chips", children: affectedKeys.map((key) => {
4871
- const val = profile.settings[key];
4872
- return /* @__PURE__ */ jsxs33("span", { className: "arap-profile-chip", children: [
4873
- /* @__PURE__ */ jsxs33("strong", { children: [
4874
- formatKeyName(key),
4875
- ":"
4876
- ] }),
4877
- " ",
4878
- formatSettingValue(key, val)
4879
- ] }, key);
4880
- }) })
4881
- ] }),
4882
- /* @__PURE__ */ jsx36("div", { className: "arap-profile-actions", children: isActive ? /* @__PURE__ */ jsx36(
4883
- "button",
4884
- {
4885
- type: "button",
4886
- className: "arap-profile-revert-btn",
4887
- onClick: onRevert,
4888
- "aria-label": `Revert ${profile.label} profile`,
4889
- children: "Revert to custom settings"
4890
- }
4891
- ) : /* @__PURE__ */ jsx36(
4892
- "button",
4893
- {
4894
- type: "button",
4895
- className: "arap-profile-apply-btn",
4896
- onClick: () => onApply(profile),
4897
- "aria-label": `Apply ${profile.label} profile`,
4898
- children: "Apply Profile"
4899
- }
4900
- ) })
6775
+ /* @__PURE__ */ jsx39("div", { className: "arap-card-content", children })
4901
6776
  ]
4902
6777
  }
4903
6778
  );
4904
6779
  }
4905
6780
  export {
6781
+ ALLOWED_PREFERENCE_KEYS,
6782
+ ALL_PROFILE_IDS,
4906
6783
  AccessibilityButton,
4907
6784
  AccessibilityContext,
4908
6785
  AccessibilityList,
4909
6786
  AccessibilityPlugin,
6787
+ AccessibilityProfilesController,
4910
6788
  AccessibleTooltipsController,
4911
6789
  BigCursorController,
4912
6790
  CONTRAST_MODES,
@@ -4915,6 +6793,7 @@ export {
4915
6793
  ChoiceControl,
4916
6794
  ContrastController,
4917
6795
  ContrastModeController,
6796
+ CustomPresetsController,
4918
6797
  DEFAULT_PREFERENCES,
4919
6798
  DEFAULT_READING_MASK_HEIGHT,
4920
6799
  DYSLEXIA_FONT_STACK,
@@ -4927,6 +6806,7 @@ export {
4927
6806
  FontFamilyController,
4928
6807
  FontSizeController,
4929
6808
  GrayscaleController,
6809
+ HeadingsNavigatorController,
4930
6810
  HideDecorativeImagesController,
4931
6811
  HideImagesController,
4932
6812
  HideVideosController,
@@ -4941,8 +6821,14 @@ export {
4941
6821
  MAX_READING_MASK_HEIGHT,
4942
6822
  MIN_READING_MASK_HEIGHT,
4943
6823
  PROFILE_DEFINITIONS,
6824
+ PageNavigatorController,
6825
+ PageStructureController,
4944
6826
  ParagraphSpacingController,
6827
+ PresetsBackupController,
6828
+ PresetsController,
6829
+ ProfileController,
4945
6830
  ProfilePreviewCard,
6831
+ ProfilesController,
4946
6832
  READING_MASK_HEIGHT_PRESETS,
4947
6833
  ReadingGuideController,
4948
6834
  ReadingMaskController,
@@ -4950,6 +6836,7 @@ export {
4950
6836
  ResetController,
4951
6837
  SaturationController,
4952
6838
  SearchCount,
6839
+ SettingsImportExportController,
4953
6840
  SkipToMainLink,
4954
6841
  StepperControl,
4955
6842
  TEXT_ALIGN_BLOCK_SELECTOR,
@@ -4961,11 +6848,17 @@ export {
4961
6848
  ToggleControl,
4962
6849
  TooltipsController,
4963
6850
  WordSpacingController,
6851
+ applyCustomPresetToStore,
6852
+ applyProfileToStore,
6853
+ createCustomPreset,
4964
6854
  createInitialPreferencesState,
6855
+ downloadJsonFile,
4965
6856
  enLocale,
4966
6857
  enableAccessibleTooltips,
6858
+ exportPresetsToJson,
4967
6859
  findMainLandmark,
4968
6860
  getAuthoredDescription,
6861
+ getProfileDefinition,
4969
6862
  getScriptSpacingConstraints,
4970
6863
  hasFinePointer,
4971
6864
  isEligibleDecorativeImage,
@@ -4978,17 +6871,30 @@ export {
4978
6871
  isProtectedFromTextSpacing,
4979
6872
  isReducedMotionActive,
4980
6873
  isRtlLocale,
6874
+ isValidCustomPreset,
6875
+ mapFeaturesToProfileSettings,
6876
+ mapProfileSettingsToFeatures,
6877
+ navigateToElement,
4981
6878
  normalizePreferenceValue,
4982
6879
  normalizePreferences,
4983
6880
  nudgeReadingAid,
4984
6881
  positionTooltip,
4985
6882
  preferencesReducer,
6883
+ recordProfileOverride,
4986
6884
  registerLocale,
4987
6885
  resolveEffectivePreferences,
4988
6886
  resolveLocaleStrings,
6887
+ revertProfileFromStore,
6888
+ sanitizePreferences,
6889
+ scanHeadings,
6890
+ scanLandmarks,
4989
6891
  subscribeFinePointer,
4990
6892
  subscribeForcedColors,
6893
+ subscribePageStructure,
4991
6894
  subscribeReducedMotion,
4992
- useAccessibility
6895
+ useAccessibility,
6896
+ usePresets,
6897
+ useProfiles,
6898
+ validateAndParseImport
4993
6899
  };
4994
6900
  //# sourceMappingURL=index.mjs.map