@cngx/common 0.1.0-rc.7 → 0.1.0-rc.8
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/card/README.md +2 -1
- package/data/README.md +10 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +125 -111
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +47 -5
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +300 -46
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +1176 -453
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +37 -10
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +1318 -469
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +151 -14
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +340 -73
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1744 -952
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +841 -114
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +350 -60
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +727 -317
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1601 -1243
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +137 -53
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +3 -3
- package/popover/README.md +18 -2
- package/stepper/README.md +6 -4
- package/theming/components/cngx-accordion.css +1 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-button-toggle.css +29 -3
- package/theming/components/cngx-data-grid.css +168 -1
- package/theming/components/cngx-dialog.css +13 -0
- package/theming/components/cngx-listbox.css +21 -12
- package/theming/components/cngx-menu.css +56 -16
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +1 -1
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +12 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +42 -18
- package/types/cngx-common-card.d.ts +201 -17
- package/types/cngx-common-chart.d.ts +343 -47
- package/types/cngx-common-command.d.ts +31 -8
- package/types/cngx-common-data.d.ts +581 -68
- package/types/cngx-common-dialog.d.ts +158 -3
- package/types/cngx-common-display.d.ts +356 -142
- package/types/cngx-common-interactive.d.ts +859 -210
- package/types/cngx-common-layout.d.ts +567 -28
- package/types/cngx-common-popover.d.ts +262 -39
- package/types/cngx-common-stepper.d.ts +366 -116
- package/types/cngx-common-tabs.d.ts +214 -50
- package/types/cngx-common-timeline.d.ts +82 -16
|
@@ -371,6 +371,30 @@ const CNGX_AUDIO_TONE_GENERATOR_FACTORY = new InjectionToken('CngxAudioToneGener
|
|
|
371
371
|
function clampVolume(v) {
|
|
372
372
|
return Math.max(0, Math.min(1, v));
|
|
373
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Map a raw `AudioContext.state` onto {@link AudioStatus}. Safari reports a
|
|
376
|
+
* non-standard `'interrupted'` (phone call, Siri, audio-route change) that the
|
|
377
|
+
* spec union does not carry; it resumes on the next gesture exactly like a
|
|
378
|
+
* suspended context, so it folds to `'suspended'` rather than being cast into
|
|
379
|
+
* the union. Any unknown value degrades to `'suspended'`, the safe resting
|
|
380
|
+
* state a subsequent `resume()` can lift.
|
|
381
|
+
*/
|
|
382
|
+
function mapAudioStatus(state) {
|
|
383
|
+
switch (state) {
|
|
384
|
+
case 'running':
|
|
385
|
+
return 'running';
|
|
386
|
+
case 'closed':
|
|
387
|
+
return 'closed';
|
|
388
|
+
case 'suspended':
|
|
389
|
+
case 'interrupted':
|
|
390
|
+
default:
|
|
391
|
+
return 'suspended';
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/** A context that a `resume()` can lift - suspended, or Safari's interrupted. */
|
|
395
|
+
function isSuspendedLike(state) {
|
|
396
|
+
return state === 'suspended' || state === 'interrupted';
|
|
397
|
+
}
|
|
374
398
|
/**
|
|
375
399
|
* Apply a per-call `[0, 1]` scale to a tone's peak gain. Centralised here so
|
|
376
400
|
* every play path (`play` / `tone` / `sequence`) scales identically and an
|
|
@@ -417,6 +441,9 @@ const createAudioEngine = (options) => {
|
|
|
417
441
|
const gate = createAutoplayGate({ target: doc, destroyRef });
|
|
418
442
|
const debouncer = createDebouncer({ windowMs: config.debounceMs });
|
|
419
443
|
const earcons = new Map(Object.entries({ ...CNGX_AUDIO_DEFAULT_EARCONS, ...config.earcons }));
|
|
444
|
+
// Dev-only: an unknown earcon name is a fixed authoring mistake, so warn once
|
|
445
|
+
// per name rather than on every (debounced) play attempt.
|
|
446
|
+
const warnedUnknownEarcons = new Set();
|
|
420
447
|
let context = null;
|
|
421
448
|
let masterGain = null;
|
|
422
449
|
const contextFactory = options?.contextFactory ??
|
|
@@ -429,9 +456,19 @@ const createAudioEngine = (options) => {
|
|
|
429
456
|
context: () => context,
|
|
430
457
|
destination: () => masterGain,
|
|
431
458
|
});
|
|
459
|
+
// Single source of truth for `status`: the context's own statechange event.
|
|
460
|
+
// Browser-initiated transitions the page never requested (Safari interrupt,
|
|
461
|
+
// OS suspend) flow through here too, and because resume()/suspend() land
|
|
462
|
+
// their result via this listener there is no manual status write left to
|
|
463
|
+
// race - a stale resume resolution cannot clobber a later suspend.
|
|
464
|
+
const onStateChange = () => {
|
|
465
|
+
if (context) {
|
|
466
|
+
status.set(mapAudioStatus(context.state));
|
|
467
|
+
}
|
|
468
|
+
};
|
|
432
469
|
function resumeIfArmed() {
|
|
433
|
-
if (context && gate.armed() && context.state
|
|
434
|
-
void context.resume().
|
|
470
|
+
if (context && gate.armed() && isSuspendedLike(context.state)) {
|
|
471
|
+
void context.resume().catch(() => undefined);
|
|
435
472
|
}
|
|
436
473
|
}
|
|
437
474
|
function ensureContext() {
|
|
@@ -447,7 +484,10 @@ const createAudioEngine = (options) => {
|
|
|
447
484
|
masterGain = created.createGain();
|
|
448
485
|
masterGain.gain.value = volume();
|
|
449
486
|
masterGain.connect(created.destination);
|
|
450
|
-
|
|
487
|
+
// Born in its current state - no statechange fires for the initial value,
|
|
488
|
+
// so seed it directly; every later transition arrives via onStateChange.
|
|
489
|
+
status.set(mapAudioStatus(created.state));
|
|
490
|
+
created.addEventListener('statechange', onStateChange);
|
|
451
491
|
resumeIfArmed();
|
|
452
492
|
return context;
|
|
453
493
|
}
|
|
@@ -470,7 +510,7 @@ const createAudioEngine = (options) => {
|
|
|
470
510
|
}
|
|
471
511
|
if (doc.hidden) {
|
|
472
512
|
if (context.state === 'running') {
|
|
473
|
-
void context.suspend().
|
|
513
|
+
void context.suspend().catch(() => undefined);
|
|
474
514
|
}
|
|
475
515
|
}
|
|
476
516
|
else {
|
|
@@ -480,6 +520,7 @@ const createAudioEngine = (options) => {
|
|
|
480
520
|
doc.addEventListener('visibilitychange', onVisibility);
|
|
481
521
|
destroyRef.onDestroy(() => {
|
|
482
522
|
doc.removeEventListener('visibilitychange', onVisibility);
|
|
523
|
+
context?.removeEventListener('statechange', onStateChange);
|
|
483
524
|
// close() rejects on an already-closed context; swallow it so a double
|
|
484
525
|
// destroy does not surface an unhandled rejection.
|
|
485
526
|
const closing = context?.close?.();
|
|
@@ -499,7 +540,8 @@ const createAudioEngine = (options) => {
|
|
|
499
540
|
}
|
|
500
541
|
const earcon = earcons.get(name);
|
|
501
542
|
if (!earcon) {
|
|
502
|
-
if (isDevMode()) {
|
|
543
|
+
if (isDevMode() && !warnedUnknownEarcons.has(name)) {
|
|
544
|
+
warnedUnknownEarcons.add(name);
|
|
503
545
|
console.warn(`[cngxAudio] Unknown earcon "${name}". Register it via withEarcons({...}) or engine.register(name, config).`);
|
|
504
546
|
}
|
|
505
547
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-common-audio.mjs","sources":["../../../projects/common/audio/config/audio-config.ts","../../../projects/common/audio/autoplay-gate/autoplay-gate.ts","../../../projects/common/audio/debouncer/debouncer.ts","../../../projects/common/audio/earcons/default-earcons.ts","../../../projects/common/audio/tone-generator/tone-generator.ts","../../../projects/common/audio/engine/audio-engine.ts","../../../projects/common/audio/inject-audio.ts","../../../projects/common/audio/internal/same-string-map.ts","../../../projects/common/audio/event-mode/parse-bindings.ts","../../../projects/common/audio/event-mode/audio.directive.ts","../../../projects/common/audio/status-mode/parse-status-bindings.ts","../../../projects/common/audio/status-mode/audio-status.directive.ts","../../../projects/common/audio/zone-mode/audio-zone.directive.ts","../../../projects/common/audio/pitch-mode/audio-pitch.directive.ts","../../../projects/common/audio/public-api.ts","../../../projects/common/audio/cngx-common-audio.ts"],"sourcesContent":["import {\n type EnvironmentProviders,\n InjectionToken,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport type { EarconConfig } from '../earcons/default-earcons';\n\n/**\n * Global configuration for the audio system. Provided via `provideCngxAudio()`\n * with `with*` features (see the provider section below). Consumers never\n * construct this object directly.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport interface CngxAudioConfig {\n /** Start muted. Default `false`. */\n readonly muted: boolean;\n /** Master volume in `[0, 1]`. Default `1`. */\n readonly volume: number;\n /** Mute audio when `prefers-reduced-motion: reduce` is set. Default `true`. */\n readonly respectReducedMotion: boolean;\n /** Same-name suppression window in ms. Default `100`. */\n readonly debounceMs: number;\n /** Extra or overriding earcons, merged over the six built-ins. Default `{}`. */\n readonly earcons: Readonly<Record<string, EarconConfig>>;\n}\n\n/**\n * Library defaults - English, browser-native.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_DEFAULTS: CngxAudioConfig = {\n muted: false,\n volume: 1,\n respectReducedMotion: true,\n debounceMs: 100,\n earcons: {},\n};\n\n/**\n * Injection token carrying the partial audio config contributed by\n * `provideCngxAudio(...)`. Read the resolved, defaults-merged config with\n * {@link injectAudioConfig}.\n *\n * @category common/audio\n * @relatedTo provideCngxAudio, injectAudioConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_CONFIG = new InjectionToken<Partial<CngxAudioConfig>>('CngxAudioConfig', {\n providedIn: 'root',\n factory: () => ({}),\n});\n\n/**\n * Resolve the effective audio config: library defaults merged with whatever\n * `provideCngxAudio(...)` contributed. Runs in an injection context.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function injectAudioConfig(): CngxAudioConfig {\n return { ...CNGX_AUDIO_DEFAULTS, ...inject(CNGX_AUDIO_CONFIG, { optional: true }) };\n}\n\n/**\n * A feature returned by a `with*` helper, folded into the config by {@link provideCngxAudio}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport interface CngxAudioFeature {\n /** @internal */\n readonly _apply: (config: Partial<CngxAudioConfig>) => Partial<CngxAudioConfig>;\n}\n\n/**\n * Fold a `with*` feature list into a single partial config.\n *\n * @internal - shared by {@link provideCngxAudio} and `provideCngxAudioAt`;\n * not exported from `public-api.ts`.\n */\nexport function foldAudioFeatures(features: readonly CngxAudioFeature[]): Partial<CngxAudioConfig> {\n let config: Partial<CngxAudioConfig> = {};\n for (const feature of features) {\n config = feature._apply(config);\n }\n return config;\n}\n\n/**\n * Register global audio defaults. Mirrors `provideFeedback` - a single small\n * config object folded through `with*` features.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideCngxAudio(\n * withVolume(0.6),\n * withEarcons({ send: { sequence: [{ freq: 880, duration: 60 }] } }),\n * ),\n * ],\n * });\n * ```\n *\n * Register this at **application bootstrap**. The shared engine is\n * `providedIn: 'root'` and reads its configuration once, when it is first built,\n * so config registered in a lazy route's `providers` never reaches it. To\n * configure a subtree, use `provideCngxAudioAt(...)` in `viewProviders` - it\n * layers over this one and re-provides the engine so the scope actually applies.\n *\n * @category common/audio\n * @relatedTo provideCngxAudioAt, injectAudioConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function provideCngxAudio(...features: CngxAudioFeature[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: CNGX_AUDIO_CONFIG, useValue: foldAudioFeatures(features) },\n ]);\n}\n\n/**\n * Register or override earcons globally. Merged over the six built-ins and over\n * any earlier `withEarcons` in the same `provideCngxAudio` call.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withEarcons(earcons: Record<string, EarconConfig>): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, earcons: { ...c.earcons, ...earcons } }) };\n}\n\n/**\n * Set the master volume in `[0, 1]`.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withVolume(volume: number): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, volume }) };\n}\n\n/**\n * Start muted (or explicitly unmuted with `withMuted(false)`).\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withMuted(muted = true): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, muted }) };\n}\n\n/**\n * Toggle the `prefers-reduced-motion` mute gate. `true` by default in the\n * library; pass `false` to keep audio playing under reduced-motion.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withRespectReducedMotion(respect: boolean): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, respectReducedMotion: respect }) };\n}\n\n/**\n * Set the same-name suppression window in milliseconds.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withDebounceMs(ms: number): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, debounceMs: ms }) };\n}\n","import { type DestroyRef, type Signal, signal } from '@angular/core';\n\n/** The user-gesture events that satisfy the browser autoplay policy. */\nconst GESTURE_EVENTS = ['pointerdown', 'keydown', 'touchstart'] as const;\n\n/**\n * A minimal `EventTarget` surface - only what the gate installs. Accepting\n * this narrow shape (rather than a concrete `Document`) keeps the factory\n * inject-free and trivially fakeable in a spec.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/autoplay-gate/autoplay-gate.ts\n * @since 0.1.0\n */\nexport type GestureEventTarget = Pick<EventTarget, 'addEventListener' | 'removeEventListener'>;\n\n/**\n * Public handle returned by {@link createAutoplayGate}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/autoplay-gate/autoplay-gate.ts\n * @since 0.1.0\n */\nexport interface CngxAutoplayGate {\n /**\n * `true` once a user gesture (or an explicit {@link arm}) has satisfied the\n * browser autoplay policy. Derived from a single gesture event - never\n * synced from multiple handlers.\n */\n readonly armed: Signal<boolean>;\n\n /** Arm the gate programmatically (e.g. after an existing trusted gesture). */\n arm(): void;\n}\n\n/**\n * Create the autoplay gate: a one-shot latch that flips `armed` to `true` on\n * the first `pointerdown` / `keydown` / `touchstart` and then removes its own\n * listeners. The engine consults `armed()` before resuming the shared\n * `AudioContext`, honouring the browser autoplay policy without a permission\n * prompt.\n *\n * Pure factory - takes its `target` and `destroyRef` as arguments rather than\n * calling `inject()`, so it composes inside the engine's injection context yet\n * stays testable with a fake target. No DI token: the gate has no independent\n * swap consumer (severity ladder `concern: over-abstraction`), so it ships\n * token-less and the engine owns it.\n *\n * @param deps.target The event target to listen on (typically the `Document`).\n * @param deps.destroyRef Cleanup owner - removes any surviving listeners on destroy.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/autoplay-gate/autoplay-gate.ts\n * @since 0.1.0\n */\nexport function createAutoplayGate(deps: {\n readonly target: GestureEventTarget;\n readonly destroyRef: Pick<DestroyRef, 'onDestroy'>;\n}): CngxAutoplayGate {\n const { target, destroyRef } = deps;\n const armed = signal(false);\n\n function removeListeners(): void {\n for (const type of GESTURE_EVENTS) {\n target.removeEventListener(type, handleGesture);\n }\n }\n\n function arm(): void {\n if (armed()) {\n return;\n }\n armed.set(true);\n removeListeners();\n }\n\n function handleGesture(): void {\n arm();\n }\n\n for (const type of GESTURE_EVENTS) {\n target.addEventListener(type, handleGesture, { passive: true });\n }\n destroyRef.onDestroy(removeListeners);\n\n return {\n armed: armed.asReadonly(),\n arm,\n };\n}\n","/** Default suppression window in milliseconds. */\nconst DEFAULT_WINDOW_MS = 100;\n\n/**\n * Public handle returned by {@link createDebouncer}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/debouncer/debouncer.ts\n * @since 0.1.0\n */\nexport interface CngxDebouncer {\n /**\n * Returns `true` if `name` may fire now, `false` if an identical name fired\n * within the window. A `true` result records the fire time; a `false` result\n * leaves it untouched (so a burst is suppressed against its first fire).\n */\n shouldFire(name: string): boolean;\n /** Clear the recorded fire time for `name`, or all names when omitted. */\n reset(name?: string): void;\n}\n\n/**\n * Per-name time-window debouncer: suppresses repeated fires of the same earcon\n * within `windowMs`. A separate composed factory rather than logic buried in\n * the engine (Pillar 3). Plain factory, no DI token - `withDebounceMs` covers\n * configuration and there is no independent swap consumer.\n *\n * `windowMs` accepts a getter so a caller whose window is a reactive input can\n * hold ONE debouncer instance for its lifetime and still track changes: the\n * window is resolved per `shouldFire` call, not captured at construction. That\n * keeps the (stateful) debouncer out of the signal graph - minting one inside a\n * `computed` would return a fresh object per evaluation and break the equality\n * rule. `CngxAudioPitch` is the getter consumer; the engine passes a number.\n *\n * The clock is injectable (`now`) purely so specs are deterministic; production\n * defaults to `Date.now`.\n *\n * @param options.windowMs Suppression window, or a getter for it. `<= 0` disables debouncing. Default `100`.\n * @param options.now Clock source in ms. Default `Date.now`.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/debouncer/debouncer.ts\n * @since 0.1.0\n */\nexport function createDebouncer(options?: {\n readonly windowMs?: number | (() => number);\n readonly now?: () => number;\n}): CngxDebouncer {\n const windowOption = options?.windowMs ?? DEFAULT_WINDOW_MS;\n const resolveWindow =\n typeof windowOption === 'function' ? windowOption : (): number => windowOption;\n const now = options?.now ?? (() => Date.now());\n const lastFiredAt = new Map<string, number>();\n\n return {\n shouldFire(name) {\n const at = now();\n const last = lastFiredAt.get(name);\n if (last !== undefined && at - last < resolveWindow()) {\n return false;\n }\n lastFiredAt.set(name, at);\n return true;\n },\n reset(name) {\n if (name === undefined) {\n lastFiredAt.clear();\n } else {\n lastFiredAt.delete(name);\n }\n },\n };\n}\n","import type { ToneStep } from '../tone-generator/tone-generator';\n\n/**\n * A named earcon - an ordered sequence of tone steps.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/earcons/default-earcons.ts\n * @since 0.1.0\n */\nexport interface EarconConfig {\n /** The tones that make up the earcon, played back-to-back. */\n readonly sequence: readonly ToneStep[];\n}\n\n/**\n * The six built-in earcons, synthesised entirely from `OscillatorNode` - zero\n * audio assets. Plain `as const` (mirrors `CNGX_SELECT_GLYPHS`): tree-shakeable,\n * compile-time exhaustive keys, and NOT exported from `public-api.ts`. The\n * consumer override surface is `withEarcons({...})` and the engine's runtime\n * `register()`, never this const.\n *\n * @internal\n */\nexport const CNGX_AUDIO_DEFAULT_EARCONS = {\n /** Neutral tick for taps, toggles, and generic acknowledgements. */\n tap: { sequence: [{ freq: 660, duration: 30 }] },\n /** Rising two-note chime for a completed positive action. */\n success: {\n sequence: [\n { freq: 660, duration: 80 },\n { freq: 880, duration: 120 },\n ],\n },\n /** Falling sawtooth pair for a failure - deliberately harsher. */\n error: {\n sequence: [\n { freq: 400, duration: 100, type: 'sawtooth', gain: 0.15 },\n { freq: 300, duration: 160, type: 'sawtooth', gain: 0.15 },\n ],\n },\n /** Two soft triangle pulses for a caution state. */\n warning: {\n sequence: [\n { freq: 520, duration: 90, type: 'triangle' },\n { freq: 520, duration: 90, type: 'triangle', delay: 60 },\n ],\n },\n /** Gentle upward two-note for an incoming notification. */\n notification: {\n sequence: [\n { freq: 780, duration: 70 },\n { freq: 990, duration: 90, delay: 20 },\n ],\n },\n /** Three-note upward arpeggio for a finished multi-step flow. */\n complete: {\n sequence: [\n { freq: 523, duration: 90 },\n { freq: 659, duration: 90 },\n { freq: 784, duration: 140 },\n ],\n },\n} as const satisfies Record<string, EarconConfig>;\n\n/** Union of the built-in earcon names. @internal */\nexport type CngxDefaultEarconName = keyof typeof CNGX_AUDIO_DEFAULT_EARCONS;\n","import { InjectionToken } from '@angular/core';\n\n/** Attack ramp, seconds - lifts gain from 0 so the oscillator start is click-free. */\nconst ATTACK_SEC = 0.005;\n/** Release ramp, seconds - drops gain to 0 before stop so the end is click-free. */\nconst RELEASE_SEC = 0.03;\n/** A tone shorter than attack+release cannot host both ramps; clamp up to this floor. */\nconst MIN_DURATION_SEC = ATTACK_SEC + RELEASE_SEC;\n/**\n * Default peak gain for a single tone (before the engine's master volume).\n * Exported so a per-element volume multiplier can scale against the same\n * baseline the generator uses.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport const DEFAULT_TONE_GAIN = 0.2;\n\n/**\n * Per-tone synthesis options.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface ToneOptions {\n /** Oscillator waveform. Default `'sine'`. */\n readonly type?: OscillatorType;\n /** Peak gain in `[0, 1]` before the master volume. Default `0.2`. */\n readonly gain?: number;\n /** Schedule offset in seconds from `currentTime`. Default `0`. */\n readonly when?: number;\n}\n\n/**\n * One step of an earcon sequence.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface ToneStep {\n /** Frequency in Hz. */\n readonly freq: number;\n /** Duration in milliseconds. */\n readonly duration: number;\n /** Oscillator waveform for this step. Default `'sine'`. */\n readonly type?: OscillatorType;\n /** Peak gain for this step in `[0, 1]`. Default `0.2`. */\n readonly gain?: number;\n /** Silent gap in milliseconds before this step starts. Default `0`. */\n readonly delay?: number;\n}\n\n/**\n * Public handle returned by {@link createToneGenerator}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface CngxToneGenerator {\n /** Play a single tone of `durationMs` at `freq`. */\n tone(freq: number, durationMs: number, opts?: ToneOptions): void;\n /** Play a sequence of steps back-to-back, each scheduled after the previous. */\n sequence(steps: readonly ToneStep[]): void;\n}\n\n/**\n * Dependencies handed to the tone-generator factory by the engine.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface ToneGeneratorDeps {\n /** Lazy getter for the shared context - called per tone so the engine controls resume. */\n readonly context: () => BaseAudioContext;\n /** Node to connect each tone into (typically the engine's master-volume gain). */\n readonly destination: () => AudioNode;\n}\n\n/**\n * Signature of the tone-generator factory - the shape an override must match.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport type CngxAudioToneGeneratorFactory = (deps: ToneGeneratorDeps) => CngxToneGenerator;\n\n/**\n * Pure `OscillatorNode` synthesis - no audio assets. Each tone is an\n * oscillator through a per-note gain envelope (5 ms attack, 30 ms release)\n * into the engine's master-volume node. The envelope is not decoration: a\n * bare `start()`/`stop()` on a full-amplitude oscillator produces an audible\n * click at both ends; ramping in and out removes it.\n *\n * `create*` pure factory (no `inject()`), so it composes inside the engine and\n * runs against the shared `createAudioContextMock` in specs.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport const createToneGenerator: CngxAudioToneGeneratorFactory = (deps) => {\n function schedule(\n freq: number,\n durationMs: number,\n opts: ToneOptions | undefined,\n whenSec: number,\n ): void {\n const ctx = deps.context();\n const dest = deps.destination();\n const start = ctx.currentTime + whenSec + (opts?.when ?? 0);\n const durSec = Math.max(durationMs / 1000, MIN_DURATION_SEC);\n const peak = opts?.gain ?? DEFAULT_TONE_GAIN;\n\n const osc = ctx.createOscillator();\n osc.type = opts?.type ?? 'sine';\n osc.frequency.setValueAtTime(freq, start);\n\n const env = ctx.createGain();\n const holdStart = start + ATTACK_SEC;\n const releaseStart = start + durSec - RELEASE_SEC;\n env.gain.setValueAtTime(0, start);\n env.gain.linearRampToValueAtTime(peak, holdStart);\n env.gain.setValueAtTime(peak, releaseStart);\n env.gain.linearRampToValueAtTime(0, start + durSec);\n\n osc.connect(env);\n env.connect(dest);\n osc.start(start);\n osc.stop(start + durSec);\n osc.onended = () => {\n osc.disconnect();\n env.disconnect();\n };\n }\n\n return {\n tone(freq, durationMs, opts) {\n schedule(freq, durationMs, opts, 0);\n },\n sequence(steps) {\n let offsetSec = 0;\n for (const step of steps) {\n offsetSec += (step.delay ?? 0) / 1000;\n schedule(step.freq, step.duration, { type: step.type, gain: step.gain }, offsetSec);\n offsetSec += Math.max(step.duration / 1000, MIN_DURATION_SEC);\n }\n },\n };\n};\n\n/**\n * Swappable tone-generator factory. Defaults to {@link createToneGenerator}\n * (oscillator synthesis). Override to swap in sample-based playback without\n * forking the engine - the documented second consumer of this boundary token.\n *\n * @relatedTo createToneGenerator, CNGX_AUDIO_ENGINE_FACTORY\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_TONE_GENERATOR_FACTORY = new InjectionToken<CngxAudioToneGeneratorFactory>(\n 'CngxAudioToneGeneratorFactory',\n { providedIn: 'root', factory: () => createToneGenerator },\n);\n","import { DOCUMENT } from '@angular/common';\nimport {\n DestroyRef,\n InjectionToken,\n type Signal,\n effect,\n inject,\n isDevMode,\n signal,\n} from '@angular/core';\nimport { injectMediaQuery } from '@cngx/common/layout';\n\nimport { createAutoplayGate } from '../autoplay-gate/autoplay-gate';\nimport { createDebouncer } from '../debouncer/debouncer';\nimport { CNGX_AUDIO_DEFAULT_EARCONS, type EarconConfig } from '../earcons/default-earcons';\nimport {\n CNGX_AUDIO_TONE_GENERATOR_FACTORY,\n DEFAULT_TONE_GAIN,\n type ToneOptions,\n type ToneStep,\n} from '../tone-generator/tone-generator';\nimport { injectAudioConfig } from '../config/audio-config';\n\n/**\n * Lifecycle state of the shared `AudioContext`, surfaced for debug panels and\n * headless e2e. Mute is a separate `muted` signal - this tracks the context,\n * not the play gate.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport type AudioStatus = 'idle' | 'suspended' | 'running' | 'closed' | 'unsupported';\n\n/**\n * Advanced/testing seam for {@link createAudioEngine}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport interface AudioEngineOptions {\n /**\n * Override `AudioContext` construction. Defaults to the host window's\n * `AudioContext` / `webkitAudioContext`, or `null` when neither exists (SSR,\n * unsupported browser). Specs pass `createAudioContextMock`.\n */\n readonly contextFactory?: () => BaseAudioContext | null;\n}\n\n/**\n * The audio engine surface. A single write path for `muted` / `volume`\n * (no `mute()`/`unmute()` pair); every state change is a reactive `Signal`.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport interface CngxAudioEngine {\n /**\n * Play a registered earcon by name. Gated + debounced centrally here.\n * `scale` (a `[0, 1]` multiplier over the per-tone default) scales just this\n * play - used by the directives' per-element `audioVolume` without touching\n * the shared master volume.\n */\n play(name: string, scale?: number): void;\n /**\n * Play a single ad-hoc tone. Gated, not debounced, no `lastPlayed` update.\n * `scale` is the same `[0, 1]` multiplier `play()` takes and is applied over\n * `opts.gain` (or the per-tone default) by the engine.\n */\n tone(freq: number, durationMs: number, opts?: ToneOptions, scale?: number): void;\n /** Play an ad-hoc tone sequence. Gated, not debounced. `scale` as in {@link tone}. */\n sequence(steps: readonly ToneStep[], scale?: number): void;\n /** Register or override an earcon at runtime. */\n register(name: string, config: EarconConfig): void;\n /** Arm the autoplay gate programmatically and resume the context if possible. */\n armAutoplay(): void;\n /** Set the global mute state. */\n setMuted(muted: boolean): void;\n /** Set master volume, clamped to `[0, 1]`. */\n setVolume(volume: number): void;\n /** `true` when globally muted. */\n readonly muted: Signal<boolean>;\n /** Master volume in `[0, 1]`. */\n readonly volume: Signal<number>;\n /** Shared-context lifecycle state. */\n readonly status: Signal<AudioStatus>;\n /** Name of the last earcon actually played, or `null`. Powers e2e + debug. */\n readonly lastPlayed: Signal<string | null>;\n}\n\n/**\n * Signature of the engine factory - the shape a telemetry/audit override matches.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport type CngxAudioEngineFactory = (options?: AudioEngineOptions) => CngxAudioEngine;\n\nfunction clampVolume(v: number): number {\n return Math.max(0, Math.min(1, v));\n}\n\n/**\n * Apply a per-call `[0, 1]` scale to a tone's peak gain. Centralised here so\n * every play path (`play` / `tone` / `sequence`) scales identically and an\n * engine override sees per-element volume uniformly, rather than each caller\n * pre-baking its own gain.\n */\nfunction scaleGain(gain: number | undefined, scale: number): number {\n return (gain ?? DEFAULT_TONE_GAIN) * clampVolume(scale);\n}\n\nfunction scaleSteps(steps: readonly ToneStep[], scale: number | undefined): readonly ToneStep[] {\n if (scale === undefined) {\n return steps;\n }\n return steps.map((step) => ({ ...step, gain: scaleGain(step.gain, scale) }));\n}\n\n/**\n * Create the audio engine: composes the autoplay gate, tone generator, and\n * debouncer over one lazily-created shared `AudioContext`. Reduced-motion muting\n * reuses the existing `injectMediaQuery('(prefers-reduced-motion: reduce)')`\n * primitive rather than adding another `matchMedia` reader.\n *\n * The four mute conditions are enforced centrally in `play()`/`tone()`/\n * `sequence()`: global mute, reduced-motion, and autoplay-not-armed here;\n * per-element `[audioDisabled]` in the directives.\n *\n * Runs in an injection context (calls `inject()` for DOCUMENT, DestroyRef, the\n * tone-generator factory, and the reduced-motion query). The engine instance is\n * resolved through {@link CNGX_AUDIO_ENGINE_FACTORY}; scope it to a subtree with\n * `provideCngxAudioAt(...)` rather than calling this directly.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport const createAudioEngine: CngxAudioEngineFactory = (options) => {\n const doc = inject(DOCUMENT);\n const destroyRef = inject(DestroyRef);\n const toneGeneratorFactory = inject(CNGX_AUDIO_TONE_GENERATOR_FACTORY);\n const config = injectAudioConfig();\n const reducedMotion = injectMediaQuery('(prefers-reduced-motion: reduce)');\n\n const muted = signal(config.muted);\n const volume = signal(clampVolume(config.volume));\n const status = signal<AudioStatus>('idle');\n const lastPlayed = signal<string | null>(null);\n\n const gate = createAutoplayGate({ target: doc, destroyRef });\n const debouncer = createDebouncer({ windowMs: config.debounceMs });\n const earcons = new Map<string, EarconConfig>(\n Object.entries({ ...CNGX_AUDIO_DEFAULT_EARCONS, ...config.earcons }),\n );\n\n let context: BaseAudioContext | null = null;\n let masterGain: GainNode | null = null;\n\n const contextFactory =\n options?.contextFactory ??\n ((): BaseAudioContext | null => {\n const view = doc.defaultView as\n | (Window & {\n AudioContext?: typeof AudioContext;\n webkitAudioContext?: typeof AudioContext;\n })\n | null;\n const Ctor = view?.AudioContext ?? view?.webkitAudioContext;\n return Ctor ? new Ctor() : null;\n });\n\n const toneGenerator = toneGeneratorFactory({\n context: () => context!,\n destination: () => masterGain!,\n });\n\n function resumeIfArmed(): void {\n if (context && gate.armed() && context.state === 'suspended') {\n void (context as AudioContext).resume().then(\n () => status.set('running'),\n () => undefined,\n );\n }\n }\n\n function ensureContext(): BaseAudioContext | null {\n if (context) {\n return context;\n }\n const created = contextFactory();\n if (!created) {\n status.set('unsupported');\n return null;\n }\n context = created;\n masterGain = created.createGain();\n masterGain.gain.value = volume();\n masterGain.connect(created.destination);\n status.set(created.state as AudioStatus);\n resumeIfArmed();\n return context;\n }\n\n function blocked(): boolean {\n return muted() || (config.respectReducedMotion && reducedMotion()) || !gate.armed();\n }\n\n // Volume is communicated to the master node reactively - the single writer is\n // setVolume(), but binding through an effect keeps the node in sync from any\n // future volume source too.\n effect(() => {\n const v = volume();\n if (masterGain) {\n masterGain.gain.value = v;\n }\n });\n\n // Suspend on tab hide (frees the audio hardware); resume on return if armed.\n const onVisibility = (): void => {\n if (!context) {\n return;\n }\n if (doc.hidden) {\n if (context.state === 'running') {\n void (context as AudioContext).suspend().then(\n () => status.set('suspended'),\n () => undefined,\n );\n }\n } else {\n resumeIfArmed();\n }\n };\n doc.addEventListener('visibilitychange', onVisibility);\n destroyRef.onDestroy(() => {\n doc.removeEventListener('visibilitychange', onVisibility);\n // close() rejects on an already-closed context; swallow it so a double\n // destroy does not surface an unhandled rejection.\n const closing = (context as AudioContext | null)?.close?.();\n void closing?.then(\n () => undefined,\n () => undefined,\n );\n });\n\n return {\n play(name, scale) {\n if (blocked()) {\n return;\n }\n if (!ensureContext()) {\n return;\n }\n resumeIfArmed();\n if (!debouncer.shouldFire(name)) {\n return;\n }\n const earcon = earcons.get(name);\n if (!earcon) {\n if (isDevMode()) {\n console.warn(\n `[cngxAudio] Unknown earcon \"${name}\". Register it via withEarcons({...}) or engine.register(name, config).`,\n );\n }\n return;\n }\n toneGenerator.sequence(scaleSteps(earcon.sequence, scale));\n lastPlayed.set(name);\n },\n tone(freq, durationMs, opts, scale) {\n if (blocked() || !ensureContext()) {\n return;\n }\n resumeIfArmed();\n toneGenerator.tone(\n freq,\n durationMs,\n scale === undefined ? opts : { ...opts, gain: scaleGain(opts?.gain, scale) },\n );\n },\n sequence(steps, scale) {\n if (blocked() || !ensureContext()) {\n return;\n }\n resumeIfArmed();\n toneGenerator.sequence(scaleSteps(steps, scale));\n },\n register(name, earconConfig) {\n earcons.set(name, earconConfig);\n },\n armAutoplay() {\n gate.arm();\n resumeIfArmed();\n },\n setMuted(next) {\n muted.set(next);\n },\n setVolume(next) {\n volume.set(clampVolume(next));\n },\n muted: muted.asReadonly(),\n volume: volume.asReadonly(),\n status: status.asReadonly(),\n lastPlayed: lastPlayed.asReadonly(),\n };\n};\n\n/**\n * Swappable engine factory. Defaults to {@link createAudioEngine}. Override to\n * wrap the engine with telemetry/audit logging - the documented second consumer\n * of this boundary token.\n *\n * Register the override at **application bootstrap**. The shared engine instance\n * is itself `providedIn: 'root'` and is built on first use, so a factory override\n * registered in a lazy route's `providers` is never consulted. For a subtree that\n * needs its own engine, use `provideCngxAudioAt(...)` in `viewProviders`.\n *\n * An override that needs the resolved configuration reads it with\n * {@link injectAudioConfig} (defaults merged); {@link CNGX_AUDIO_DEFAULTS} holds\n * the library baseline. Both are exported from `@cngx/common/audio`.\n *\n * @relatedTo createAudioEngine, injectCngxAudio, injectAudioConfig\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_ENGINE_FACTORY = new InjectionToken<CngxAudioEngineFactory>(\n 'CngxAudioEngineFactory',\n { providedIn: 'root', factory: () => createAudioEngine },\n);\n","import { InjectionToken, Optional, type Provider, SkipSelf, inject } from '@angular/core';\n\nimport {\n CNGX_AUDIO_CONFIG,\n type CngxAudioConfig,\n type CngxAudioFeature,\n foldAudioFeatures,\n} from './config/audio-config';\nimport { CNGX_AUDIO_ENGINE_FACTORY, type CngxAudioEngine } from './engine/audio-engine';\n\n/**\n * The public audio handle - what {@link injectCngxAudio} returns.\n *\n * An alias for {@link CngxAudioEngine} rather than a second interface: the two\n * contracts were member-for-member identical, so a separate declaration was\n * duplication, not indirection. The name is kept because it reads better at\n * call sites (`const audio: CngxAudioHandle = injectCngxAudio()`), and because\n * the engine contract is the one an override implements.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts\n * @since 0.1.0\n */\nexport type CngxAudioHandle = CngxAudioEngine;\n\n/**\n * The shared engine instance. Lazily built from `CNGX_AUDIO_ENGINE_FACTORY` and\n * memoised per injector so every directive shares one `AudioContext`, mute\n * state, and volume. `@internal` - the public entry point is {@link injectCngxAudio};\n * consumers override the swappable factory, not this instance anchor. To scope\n * audio to a subtree, use {@link provideCngxAudioAt} - it re-provides this token\n * for you alongside the scoped config.\n *\n * @internal\n */\nexport const CNGX_AUDIO_ENGINE = new InjectionToken<CngxAudioHandle>('CngxAudioEngineInstance', {\n providedIn: 'root',\n factory: () => inject(CNGX_AUDIO_ENGINE_FACTORY)(),\n});\n\n/**\n * Resolve the shared audio handle. Must run in an injection context (field\n * initialiser or constructor).\n *\n * ```typescript\n * export class MyToggle {\n * private readonly audio = injectCngxAudio();\n * protected readonly muted = this.audio.muted;\n * protected toggle(): void {\n * this.audio.setMuted(!this.muted());\n * }\n * }\n * ```\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts\n * @since 0.1.0\n */\nexport function injectCngxAudio(): CngxAudioHandle {\n return inject(CNGX_AUDIO_ENGINE);\n}\n\n/**\n * Component-scope audio config - place in a component's `viewProviders` so a\n * subtree runs its own muted / volume / earcon set, independent of the app-wide\n * `provideCngxAudio(...)`.\n *\n * ```typescript\n * @Component({\n * selector: 'app-mixer',\n * viewProviders: [provideCngxAudioAt(withVolume(0.3), withEarcons({ ... }))],\n * })\n * export class Mixer {}\n * ```\n *\n * Returns `Provider[]` (not `EnvironmentProviders`) so it can sit in\n * `viewProviders`. The root `provideCngxAudio` must be registered at\n * **application bootstrap**: {@link CNGX_AUDIO_ENGINE} is `providedIn: 'root'`,\n * so its factory resolves the config from the root injector and a provider\n * registered on a lazy route never reaches it.\n *\n * Features **layer over** the ancestor config (root, or an enclosing scope)\n * rather than replacing it - the `provideMenuConfigAt` pattern. Scalar fields\n * (`muted`, `volume`, `debounceMs`, `respectReducedMotion`) override; `earcons`\n * merge, so a subtree adds or overrides individual earcons without dropping the\n * app-wide registry.\n *\n * The default shared engine is a single, process-global `AudioContext`; this\n * deliberately re-provides {@link CNGX_AUDIO_ENGINE} so the subtree gets an\n * **isolated engine** reading the scoped {@link CNGX_AUDIO_CONFIG} - a\n * config-only override would be inert against the already-built root engine.\n * That engine owns a **second `AudioContext`**, created lazily on its first play\n * and closed with the component's `DestroyRef`. Browsers cap the number of live\n * `AudioContext`s, so reach for this only when a subtree genuinely needs an\n * independent audio scope - per-element `[audioVolume]` / `[audioDisabled]`\n * cover the common case without a second context.\n *\n * @category common/audio\n * @relatedTo provideCngxAudio, injectCngxAudio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts\n * @since 0.1.0\n */\nexport function provideCngxAudioAt(...features: CngxAudioFeature[]): Provider[] {\n return [\n {\n provide: CNGX_AUDIO_CONFIG,\n useFactory: (parent: Partial<CngxAudioConfig> | null): Partial<CngxAudioConfig> => {\n const base = parent ?? {};\n const scoped = foldAudioFeatures(features);\n return { ...base, ...scoped, earcons: { ...base.earcons, ...scoped.earcons } };\n },\n deps: [[new SkipSelf(), new Optional(), CNGX_AUDIO_CONFIG]],\n },\n { provide: CNGX_AUDIO_ENGINE, useFactory: () => inject(CNGX_AUDIO_ENGINE_FACTORY)() },\n ];\n}\n","/**\n * Structural equality for the `key -> earcon` maps the directive binding\n * computeds return. Both `[cngxAudio]` and `[cngxAudioStatus]` derive a fresh\n * `Map` from their spec string on every recompute; without an `equal` fn the\n * `computed` would hand a new reference to any reactive consumer even when the\n * parsed bindings are identical (the signal-hygiene Equality Rule). Same size,\n * same value per key.\n *\n * @internal - not exported from `public-api.ts`.\n */\nexport function sameStringMap<K>(a: ReadonlyMap<K, string>, b: ReadonlyMap<K, string>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const [key, value] of a) {\n if (b.get(key) !== value) {\n return false;\n }\n }\n return true;\n}\n","/** DOM events `[cngxAudio]` may bind an earcon to. */\nexport const CNGX_AUDIO_DOM_EVENTS = [\n 'click',\n 'focus',\n 'blur',\n 'pointerenter',\n 'pointerleave',\n 'submit',\n 'change',\n 'input',\n] as const;\n\n/** Lifecycle keys that belong to `[cngxAudioStatus]`, rejected here. */\nconst LIFECYCLE_KEYS = [\n 'pending',\n 'succeeded',\n 'failed',\n 'loading',\n 'refreshing',\n 'success',\n 'error',\n 'idle',\n] as const;\n\n/** A `[cngxAudio]` DOM event name. */\nexport type CngxAudioDomEvent = (typeof CNGX_AUDIO_DOM_EVENTS)[number];\n\n/** Result of parsing an `event:earcon` binding string. */\nexport interface ParsedEventBindings {\n /** Valid `domEvent -> earcon` pairs. */\n readonly bindings: ReadonlyMap<CngxAudioDomEvent, string>;\n /** Keys that are neither DOM events nor lifecycle keys. */\n readonly unknownKeys: readonly string[];\n /** Lifecycle keys - the grammar of `[cngxAudioStatus]`, not `[cngxAudio]`. */\n readonly lifecycleKeys: readonly string[];\n}\n\nconst DOM_EVENT_SET = new Set<string>(CNGX_AUDIO_DOM_EVENTS);\nconst LIFECYCLE_SET = new Set<string>(LIFECYCLE_KEYS);\n\n/**\n * Parse the `event:earcon` grammar (`'click:tap, focus:notification'`) into a\n * DOM-event map. Pure - no DOM, no `inject()`. Keys are categorised so the\n * directive can dev-warn on unknown earcon keys and, separately, on lifecycle\n * keys that should have used `[cngxAudioStatus]`.\n */\nexport function parseEventBindings(spec: string): ParsedEventBindings {\n const bindings = new Map<CngxAudioDomEvent, string>();\n const unknownKeys: string[] = [];\n const lifecycleKeys: string[] = [];\n\n for (const pair of spec.split(',')) {\n const trimmed = pair.trim();\n if (!trimmed) {\n continue;\n }\n const colon = trimmed.indexOf(':');\n if (colon === -1) {\n unknownKeys.push(trimmed);\n continue;\n }\n const key = trimmed.slice(0, colon).trim();\n const earcon = trimmed.slice(colon + 1).trim();\n if (DOM_EVENT_SET.has(key)) {\n if (earcon) {\n bindings.set(key as CngxAudioDomEvent, earcon);\n }\n } else if (LIFECYCLE_SET.has(key)) {\n lifecycleKeys.push(key);\n } else {\n unknownKeys.push(key);\n }\n }\n\n return { bindings, unknownKeys, lifecycleKeys };\n}\n","import {\n DestroyRef,\n Directive,\n ElementRef,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n untracked,\n} from '@angular/core';\n\nimport { injectCngxAudio } from '../inject-audio';\nimport { sameStringMap } from '../internal/same-string-map';\nimport { type CngxAudioDomEvent, parseEventBindings } from './parse-bindings';\n\n/**\n * Event-mode audio binder. Maps DOM events on the host to earcons via the\n * `event:earcon` grammar - a pure DOM-event-to-sound directive with no state\n * coupling (that is `[cngxAudioStatus]`'s job).\n *\n * ```html\n * <button [cngxAudio]=\"'click:tap'\">Save</button>\n * <a [cngxAudio]=\"'pointerenter:notification, click:complete'\">Open</a>\n * ```\n *\n * Playback is skipped when the element is disabled (`[audioDisabled]`), when\n * the engine is muted / reduced-motion-gated / autoplay-not-armed, or when the\n * same earcon is still within the debounce window. `[audioVolume]` scales just\n * this element's plays.\n *\n * The listener set is derived from the grammar, not fixed: `'click:tap'`\n * registers one DOM listener, and rebinding `[cngxAudio]` at runtime adds the\n * newly named events and removes the dropped ones. Binding happens on the first\n * change detection after the input settles rather than at construction, so an\n * event dispatched programmatically before the host's first tick is missed.\n *\n * Listeners are registered outside Angular's event dispatch. In a zoneless app\n * that means they schedule no change detection; under zone.js the patched\n * `addEventListener` still triggers a tick, so there the saving is registration\n * cost alone. Either way the engine's `lastPlayed` and `status` are signals, so\n * anything a template binds to them stays current.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/event-mode/audio.directive.ts\n * @since 0.1.0\n * @relatedTo injectCngxAudio, provideCngxAudio, CngxAudioStatus\n * <example-url>http://localhost:4200/#/common/audio/event-mode/basic</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/custom-earcons</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/earcon-palette</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/form-feedback</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/hover-and-focus</example-url>\n */\n@Directive({\n selector: '[cngxAudio]',\n exportAs: 'cngxAudio',\n})\nexport class CngxAudio {\n private readonly audio = injectCngxAudio();\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n\n /** The listeners currently registered on the host, keyed by event type. */\n private readonly bound = new Map<CngxAudioDomEvent, EventListener>();\n\n /** The `event:earcon` grammar, e.g. `'click:tap, focus:notification'`. */\n readonly spec = input<string>('', { alias: 'cngxAudio' });\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the engine volume. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n private readonly bindings = computed(() => parseEventBindings(this.spec()).bindings, {\n equal: sameStringMap,\n });\n\n constructor() {\n effect(() => {\n const wanted = this.bindings();\n untracked(() => this.syncListeners(wanted));\n });\n\n this.destroyRef.onDestroy(() => this.unbindAll());\n\n if (isDevMode()) {\n // One-shot post-binding check, not a reactive node.\n afterNextRender(() => {\n const parsed = parseEventBindings(this.spec());\n if (parsed.lifecycleKeys.length > 0) {\n console.error(\n `[cngxAudio] Lifecycle keys \"${parsed.lifecycleKeys.join(', ')}\" are not DOM events. ` +\n 'Use [cngxAudioStatus] for lifecycle bindings.',\n );\n }\n if (parsed.unknownKeys.length > 0) {\n console.warn(\n `[cngxAudio] Unrecognised event keys \"${parsed.unknownKeys.join(', ')}\". ` +\n 'Expected one of: click, focus, blur, pointerenter, pointerleave, submit, change, input.',\n );\n }\n });\n }\n }\n\n /**\n * Diff the bound listener set against the parsed spec: drop event types the\n * grammar no longer names, add the ones it newly names, leave the rest alone.\n * A rebuild would churn a listener that is still wanted.\n */\n private syncListeners(wanted: ReadonlyMap<CngxAudioDomEvent, string>): void {\n const el = this.host.nativeElement;\n\n for (const [type, listener] of this.bound) {\n if (!wanted.has(type)) {\n el.removeEventListener(type, listener);\n this.bound.delete(type);\n }\n }\n\n for (const type of wanted.keys()) {\n if (this.bound.has(type)) {\n continue;\n }\n // Captures the type only - the earcon is read fresh at fire time, so\n // renaming it in the grammar needs no rebind.\n const listener: EventListener = () => this.handleEvent(type);\n // Not passive: none of the bindable types are scroll-blocking, so the\n // flag buys nothing and would foreclose preventDefault on submit/click.\n el.addEventListener(type, listener);\n this.bound.set(type, listener);\n }\n }\n\n private unbindAll(): void {\n const el = this.host.nativeElement;\n for (const [type, listener] of this.bound) {\n el.removeEventListener(type, listener);\n }\n this.bound.clear();\n }\n\n private handleEvent(event: CngxAudioDomEvent): void {\n if (this.audioDisabled()) {\n return;\n }\n const earcon = this.bindings().get(event);\n if (!earcon) {\n return;\n }\n this.audio.play(earcon, this.audioVolume());\n }\n}\n","import type { AsyncStatus } from '@cngx/core/utils';\n\n/**\n * Lifecycle keys `[cngxAudioStatus]` accepts, mapped to the canonical\n * `AsyncStatus` the transition tracker emits. Two friendly aliases are folded\n * in: `succeeded -> success` and `failed -> error`, so both the raw status and\n * the past-tense reading parse to the same earcon.\n */\nconst STATUS_ALIASES: Readonly<Record<string, AsyncStatus>> = {\n idle: 'idle',\n loading: 'loading',\n pending: 'pending',\n refreshing: 'refreshing',\n success: 'success',\n succeeded: 'success',\n error: 'error',\n failed: 'error',\n};\n\n/** DOM-event keys that belong to `[cngxAudio]`, rejected here. */\nexport const CNGX_AUDIO_STATUS_DOM_EVENTS = [\n 'click',\n 'focus',\n 'blur',\n 'pointerenter',\n 'pointerleave',\n 'submit',\n 'change',\n 'input',\n] as const;\n\n/** Result of parsing a `status:earcon` binding string. */\nexport interface ParsedStatusBindings {\n /** Valid `status -> earcon` pairs, keyed by canonical `AsyncStatus`. */\n readonly bindings: ReadonlyMap<AsyncStatus, string>;\n /** DOM-event keys - the grammar of `[cngxAudio]`, not `[cngxAudioStatus]`. */\n readonly domEventKeys: readonly string[];\n /** Keys that are neither lifecycle statuses nor DOM events. */\n readonly unknownKeys: readonly string[];\n}\n\nconst DOM_EVENT_SET = new Set<string>(CNGX_AUDIO_STATUS_DOM_EVENTS);\n\n/**\n * Parse the `status:earcon` grammar (`'pending:tap, succeeded:success'`) into a\n * status map. Pure - no DOM, no `inject()`. Keys are categorised so the\n * directive can dev-error on DOM-event keys that should have used `[cngxAudio]`\n * and dev-warn on unknown keys. `succeeded`/`failed` normalise to\n * `success`/`error` so a lookup by the tracker's raw `AsyncStatus` hits.\n */\nexport function parseStatusBindings(spec: string): ParsedStatusBindings {\n const bindings = new Map<AsyncStatus, string>();\n const domEventKeys: string[] = [];\n const unknownKeys: string[] = [];\n\n for (const pair of spec.split(',')) {\n const trimmed = pair.trim();\n if (!trimmed) {\n continue;\n }\n const colon = trimmed.indexOf(':');\n if (colon === -1) {\n unknownKeys.push(trimmed);\n continue;\n }\n const key = trimmed.slice(0, colon).trim();\n const earcon = trimmed.slice(colon + 1).trim();\n const status = STATUS_ALIASES[key];\n if (status) {\n if (earcon) {\n bindings.set(status, earcon);\n }\n } else if (DOM_EVENT_SET.has(key)) {\n domEventKeys.push(key);\n } else {\n unknownKeys.push(key);\n }\n }\n\n return { bindings, domEventKeys, unknownKeys };\n}\n","import {\n Directive,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n untracked,\n} from '@angular/core';\nimport { CNGX_STATEFUL, type CngxAsyncState, createTransitionTracker } from '@cngx/core/utils';\n\nimport { injectCngxAudio } from '../inject-audio';\nimport { sameStringMap } from '../internal/same-string-map';\nimport { parseStatusBindings } from './parse-status-bindings';\n\n/**\n * Status-mode audio bridge. Maps `CngxAsyncState` lifecycle transitions to\n * earcons via the `status:earcon` grammar - the audition counterpart of\n * `CngxToastOn`. Fires only on a real status transition, never on the initial\n * `idle`, and at most once per transition.\n *\n * ```html\n * <button [cngxAsyncClick]=\"upload\"\n * #upload=\"cngxAsyncClick\"\n * [state]=\"upload.state\"\n * [cngxAudioStatus]=\"'pending:tap, succeeded:success, failed:error'\">\n * Upload\n * </button>\n * ```\n *\n * The state source resolves the same way the feedback bridges do: an explicit\n * `[state]` input wins, otherwise it falls back to an ancestor's\n * `CNGX_STATEFUL`. The grammar keys are lifecycle statuses only - DOM-event\n * keys (`click`, `focus`, …) belong to `[cngxAudio]` and are rejected with a\n * dev-error. `succeeded`/`failed` are accepted as aliases for `success`/`error`.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/status-mode/audio-status.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAudio, injectCngxAudio, CngxAsyncClick\n * <example-url>http://localhost:4200/#/common/audio/status-bridge/async-click</example-url>\n */\n@Directive({\n selector: '[cngxAudioStatus]',\n exportAs: 'cngxAudioStatus',\n})\nexport class CngxAudioStatus {\n private readonly audio = injectCngxAudio();\n private readonly statefulFallback = inject(CNGX_STATEFUL, { optional: true });\n\n /** The `status:earcon` grammar, e.g. `'pending:tap, succeeded:success'`. */\n readonly spec = input<string>('', { alias: 'cngxAudioStatus' });\n\n /**\n * The async state to watch. Optional - when omitted, the bridge falls back to\n * an ancestor `CNGX_STATEFUL`. A bare `[state]` attribute (empty string) is\n * treated as \"no input bound\" so the fallback kicks in.\n */\n readonly state = input<\n CngxAsyncState<unknown> | undefined,\n CngxAsyncState<unknown> | '' | undefined\n >(undefined, {\n transform: (v) => (typeof v === 'string' ? undefined : v),\n });\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the engine volume. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n /** Effective state - explicit input wins over ancestor `CNGX_STATEFUL`. */\n private readonly effectiveState = computed<CngxAsyncState<unknown> | undefined>(\n () => this.state() ?? this.statefulFallback?.state,\n );\n\n private readonly bindings = computed(() => parseStatusBindings(this.spec()).bindings, {\n equal: sameStringMap,\n });\n\n constructor() {\n if (isDevMode()) {\n // One-shot post-binding check, not a reactive node.\n afterNextRender(() => {\n const parsed = parseStatusBindings(this.spec());\n if (parsed.domEventKeys.length > 0) {\n console.error(\n `[cngxAudioStatus] DOM-event keys \"${parsed.domEventKeys.join(', ')}\" are not lifecycle ` +\n 'statuses. Use [cngxAudio] for DOM-event bindings.',\n );\n }\n if (this.state() === undefined && !this.statefulFallback) {\n console.error(\n '[cngxAudioStatus] No state source. Bind [state]=\"state\" explicitly or place inside a ' +\n 'component that provides CNGX_STATEFUL.',\n );\n }\n });\n }\n\n const tracker = createTransitionTracker(() => this.effectiveState()?.status() ?? 'idle');\n effect(() => {\n const status = tracker.current();\n const previous = tracker.previous();\n if (status === previous) {\n return;\n }\n untracked(() => {\n if (this.audioDisabled()) {\n return;\n }\n const earcon = this.bindings().get(status);\n if (earcon) {\n this.audio.play(earcon, this.audioVolume());\n }\n });\n });\n }\n}\n","import { Directive, ElementRef, booleanAttribute, inject, input } from '@angular/core';\n\nimport { injectCngxAudio } from '../inject-audio';\n\n/** Earcon names played as the pointer or focus enters and leaves a zone. */\nexport interface CngxAudioZoneBinding {\n /** Played on `pointerenter`. */\n readonly enter?: string | null;\n /** Played on `pointerleave`. */\n readonly leave?: string | null;\n /** Played on `focusin`. */\n readonly focus?: string | null;\n /** Played on `focusout`. */\n readonly blur?: string | null;\n}\n\n/**\n * Zone-mode audio binder. Plays earcons as the pointer or keyboard focus enters\n * and leaves the host - a spatial complement to `[cngxAudio]`. The record input\n * makes the four zone transitions explicit rather than encoding them in the\n * `event:earcon` string grammar, because the listener set (pointer/focus zone)\n * and the shape (record vs string) are semantically distinct from event-mode.\n *\n * ```html\n * <div [cngxAudioZone]=\"{ enter: 'notification', leave: 'tap' }\">Hover me</div>\n * <button [cngxAudioZone]=\"{ focus: 'tap', blur: 'tap' }\">Focus me</button>\n * ```\n *\n * Playback obeys the same gates as the rest of the family: skipped when\n * `[audioDisabled]`, muted, reduced-motion-gated, autoplay-not-armed, or still\n * within the debounce window. `[audioVolume]` scales just this element's plays.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/zone-mode/audio-zone.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAudio, injectCngxAudio\n * <example-url>http://localhost:4200/#/common/audio/zone/enter-leave</example-url>\n */\n@Directive({\n selector: '[cngxAudioZone]',\n exportAs: 'cngxAudioZone',\n host: {\n '(pointerenter)': 'handleZone(\"enter\")',\n '(pointerleave)': 'handleZone(\"leave\")',\n '(focusin)': 'handleFocusCross(\"focus\", $event)',\n '(focusout)': 'handleFocusCross(\"blur\", $event)',\n },\n})\nexport class CngxAudioZone {\n private readonly audio = injectCngxAudio();\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Earcon per zone transition. Any omitted key plays nothing. */\n readonly zone = input<CngxAudioZoneBinding>({}, { alias: 'cngxAudioZone' });\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the engine volume. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * `focusin`/`focusout` bubble, so a zone wrapping focusable children would\n * otherwise fire on every internal tab move. Only a crossing of the zone\n * boundary counts - the focus counterpart of pointerenter/pointerleave.\n */\n protected handleFocusCross(kind: 'focus' | 'blur', event: FocusEvent): void {\n if (this.host.nativeElement.contains(event.relatedTarget as Node | null)) {\n return;\n }\n this.handleZone(kind);\n }\n\n protected handleZone(kind: keyof CngxAudioZoneBinding): void {\n if (this.audioDisabled()) {\n return;\n }\n const earcon = this.zone()[kind];\n if (earcon) {\n this.audio.play(earcon, this.audioVolume());\n }\n }\n}\n","import { Directive, booleanAttribute, effect, input, linkedSignal, untracked } from '@angular/core';\n\nimport { createDebouncer } from '../debouncer/debouncer';\nimport { injectCngxAudio } from '../inject-audio';\n\n/** Throttle key - the pitch directive plays a single ad-hoc voice. */\nconst PITCH_VOICE = 'pitch';\n\n/**\n * Pitch-mode audio binder. Sonifies a continuous numeric value: each change of\n * `[cngxAudioPitch]` clamps against a fixed domain, linear-scales into an output\n * frequency range, and plays a short tone. Useful for sliders, gauges, and live\n * metrics - the ear tracks a value without looking.\n *\n * ```html\n * <input type=\"range\" min=\"0\" max=\"100\"\n * [cngxAudioPitch]=\"volume()\"\n * [pitchDomain]=\"[0, 100]\"\n * [pitchRange]=\"[220, 880]\" />\n * ```\n *\n * The inputs are discrete rather than an options record so `[cngxAudioPitch]`\n * stays a native reactive input - passing `[cngxAudioPitch]=\"volume()\"` binds a\n * signal value directly, never a `Signal` smuggled inside a config object. The\n * domain is caller-supplied and fixed; it is never accumulated from observed\n * values, so the directive holds no hidden state. Value-to-frequency is a pure\n * derivation; rapid sweeps are throttled through the shared `createDebouncer`.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/pitch-mode/audio-pitch.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAudio, injectCngxAudio\n * <example-url>http://localhost:4200/#/common/audio/pitch/slider</example-url>\n */\n@Directive({\n selector: '[cngxAudioPitch]',\n exportAs: 'cngxAudioPitch',\n})\nexport class CngxAudioPitch {\n private readonly audio = injectCngxAudio();\n\n /** The tracked value to sonify. */\n readonly value = input.required<number>({ alias: 'cngxAudioPitch' });\n\n /** Output frequency range `[lo, hi]` in Hz. Default `[220, 880]`. */\n readonly pitchRange = input<[number, number]>([220, 880]);\n\n /** Fixed input domain `[min, max]` the value is clamped against. */\n readonly pitchDomain = input.required<[number, number]>();\n\n /** Tone duration in ms. Default `120`. */\n readonly pitchDurationMs = input<number>(120);\n\n /** Minimum ms between tones during a sweep. Default `50`. */\n readonly pitchThrottleMs = input<number>(50);\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the tone default. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n // One instance for the directive's lifetime, deliberately outside the signal\n // graph: a debouncer carries mutable throttle state, and minting one inside a\n // computed would hand out a fresh object per evaluation. The window is a\n // getter, so a changed [pitchThrottleMs] applies on the next fire.\n private readonly debouncer = createDebouncer({ windowMs: () => this.pitchThrottleMs() });\n\n // Fires on change, never on mount: sonifying the initial value would emit a\n // tone the user never asked for, and would burn the throttle window before\n // their first move. Same current/previous shape as createTransitionTracker.\n private readonly transition = linkedSignal<number, { current: number; previous: number | null }>({\n source: () => this.value(),\n computation: (current, prev) => ({ current, previous: prev?.value.current ?? null }),\n equal: (a, b) => a.current === b.current && a.previous === b.previous,\n });\n\n constructor() {\n effect(() => {\n const { current, previous } = this.transition();\n if (previous === null || current === previous) {\n return;\n }\n untracked(() => {\n if (this.audioDisabled()) {\n return;\n }\n if (!this.debouncer.shouldFire(PITCH_VOICE)) {\n return;\n }\n this.audio.tone(this.scale(current), this.pitchDurationMs(), undefined, this.audioVolume());\n });\n });\n }\n\n /** Clamp to the domain, then linear-scale into the frequency range. */\n private scale(value: number): number {\n const [domainLo, domainHi] = this.pitchDomain();\n const [rangeLo, rangeHi] = this.pitchRange();\n const clamped = Math.max(domainLo, Math.min(domainHi, value));\n if (domainHi === domainLo) {\n return rangeLo;\n }\n const t = (clamped - domainLo) / (domainHi - domainLo);\n return rangeLo + t * (rangeHi - rangeLo);\n }\n}\n","/**\n * @module @cngx/common/audio\n *\n * Signal-first audio-feedback system. A thin directive layer over a small\n * Web Audio adapter: zero asset weight (earcons synthesised from\n * `OscillatorNode`), a single shared `AudioContext` behind the engine, and\n * the `provideCngxAudio(...)` aggregator. Mirrors the shape of the sibling\n * feedback primitives (`CngxRipple`, `CngxPressable`, `CngxSpeak`) - the\n * fourth sense, audition, as composable atoms.\n */\n\n// Handle + component-scope provider\nexport { injectCngxAudio, provideCngxAudioAt, type CngxAudioHandle } from './inject-audio';\n\n// Config + provider\nexport {\n CNGX_AUDIO_CONFIG,\n CNGX_AUDIO_DEFAULTS,\n injectAudioConfig,\n provideCngxAudio,\n withEarcons,\n withVolume,\n withMuted,\n withRespectReducedMotion,\n withDebounceMs,\n type CngxAudioConfig,\n type CngxAudioFeature,\n} from './config/audio-config';\n\n// Engine - boundary DI token + factory + alias\nexport {\n createAudioEngine,\n CNGX_AUDIO_ENGINE_FACTORY,\n type CngxAudioEngine,\n type CngxAudioEngineFactory,\n type AudioEngineOptions,\n type AudioStatus,\n} from './engine/audio-engine';\n\n// Tone generator - boundary DI token + factory + alias\nexport {\n createToneGenerator,\n CNGX_AUDIO_TONE_GENERATOR_FACTORY,\n type CngxToneGenerator,\n type CngxAudioToneGeneratorFactory,\n type ToneGeneratorDeps,\n type ToneOptions,\n type ToneStep,\n} from './tone-generator/tone-generator';\n\n// Token-less composed factories\nexport {\n createAutoplayGate,\n type CngxAutoplayGate,\n type GestureEventTarget,\n} from './autoplay-gate/autoplay-gate';\nexport { createDebouncer, type CngxDebouncer } from './debouncer/debouncer';\n\n// Earcon value type (the CNGX_AUDIO_DEFAULT_EARCONS const stays internal)\nexport type { EarconConfig } from './earcons/default-earcons';\n\n// Event-mode directive\nexport { CngxAudio } from './event-mode/audio.directive';\n\n// Status-, zone-, and pitch-mode directives (Phase 2)\nexport { CngxAudioStatus } from './status-mode/audio-status.directive';\nexport { CngxAudioZone, type CngxAudioZoneBinding } from './zone-mode/audio-zone.directive';\nexport { CngxAudioPitch } from './pitch-mode/audio-pitch.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["DOM_EVENT_SET"],"mappings":";;;;;;AA+BA;;;;;AAKG;AACI,MAAM,mBAAmB,GAAoB;AAClD,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,oBAAoB,EAAE,IAAI;AAC1B,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,OAAO,EAAE,EAAE;;AAGb;;;;;;;;;AASG;MACU,iBAAiB,GAAG,IAAI,cAAc,CAA2B,iBAAiB,EAAE;AAC/F,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAA;AAED;;;;;;;AAOG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;AACrF;AAaA;;;;;AAKG;AACG,SAAU,iBAAiB,CAAC,QAAqC,EAAA;IACrE,IAAI,MAAM,GAA6B,EAAE;AACzC,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;AAC9B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;IACjC;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,SAAU,gBAAgB,CAAC,GAAG,QAA4B,EAAA;AAC9D,IAAA,OAAO,wBAAwB,CAAC;QAC9B,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,CAAC,EAAE;AACtE,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B;AAC3B,iBAAA;;;ACvCD;;;;;;;;;AASG;AAEH;;ACXA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cngx-common-audio.mjs","sources":["../../../projects/common/audio/config/audio-config.ts","../../../projects/common/audio/autoplay-gate/autoplay-gate.ts","../../../projects/common/audio/debouncer/debouncer.ts","../../../projects/common/audio/earcons/default-earcons.ts","../../../projects/common/audio/tone-generator/tone-generator.ts","../../../projects/common/audio/engine/audio-engine.ts","../../../projects/common/audio/inject-audio.ts","../../../projects/common/audio/internal/same-string-map.ts","../../../projects/common/audio/event-mode/parse-bindings.ts","../../../projects/common/audio/event-mode/audio.directive.ts","../../../projects/common/audio/status-mode/parse-status-bindings.ts","../../../projects/common/audio/status-mode/audio-status.directive.ts","../../../projects/common/audio/zone-mode/audio-zone.directive.ts","../../../projects/common/audio/pitch-mode/audio-pitch.directive.ts","../../../projects/common/audio/public-api.ts","../../../projects/common/audio/cngx-common-audio.ts"],"sourcesContent":["import {\n type EnvironmentProviders,\n InjectionToken,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport type { EarconConfig } from '../earcons/default-earcons';\n\n/**\n * Global configuration for the audio system. Provided via `provideCngxAudio()`\n * with `with*` features (see the provider section below). Consumers never\n * construct this object directly.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport interface CngxAudioConfig {\n /** Start muted. Default `false`. */\n readonly muted: boolean;\n /** Master volume in `[0, 1]`. Default `1`. */\n readonly volume: number;\n /** Mute audio when `prefers-reduced-motion: reduce` is set. Default `true`. */\n readonly respectReducedMotion: boolean;\n /** Same-name suppression window in ms. Default `100`. */\n readonly debounceMs: number;\n /** Extra or overriding earcons, merged over the six built-ins. Default `{}`. */\n readonly earcons: Readonly<Record<string, EarconConfig>>;\n}\n\n/**\n * Library defaults - English, browser-native.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_DEFAULTS: CngxAudioConfig = {\n muted: false,\n volume: 1,\n respectReducedMotion: true,\n debounceMs: 100,\n earcons: {},\n};\n\n/**\n * Injection token carrying the partial audio config contributed by\n * `provideCngxAudio(...)`. Read the resolved, defaults-merged config with\n * {@link injectAudioConfig}.\n *\n * @category common/audio\n * @relatedTo provideCngxAudio, injectAudioConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_CONFIG = new InjectionToken<Partial<CngxAudioConfig>>('CngxAudioConfig', {\n providedIn: 'root',\n factory: () => ({}),\n});\n\n/**\n * Resolve the effective audio config: library defaults merged with whatever\n * `provideCngxAudio(...)` contributed. Runs in an injection context.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function injectAudioConfig(): CngxAudioConfig {\n return { ...CNGX_AUDIO_DEFAULTS, ...inject(CNGX_AUDIO_CONFIG, { optional: true }) };\n}\n\n/**\n * A feature returned by a `with*` helper, folded into the config by {@link provideCngxAudio}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport interface CngxAudioFeature {\n /** @internal */\n readonly _apply: (config: Partial<CngxAudioConfig>) => Partial<CngxAudioConfig>;\n}\n\n/**\n * Fold a `with*` feature list into a single partial config.\n *\n * @internal - shared by {@link provideCngxAudio} and `provideCngxAudioAt`;\n * not exported from `public-api.ts`.\n */\nexport function foldAudioFeatures(features: readonly CngxAudioFeature[]): Partial<CngxAudioConfig> {\n let config: Partial<CngxAudioConfig> = {};\n for (const feature of features) {\n config = feature._apply(config);\n }\n return config;\n}\n\n/**\n * Register global audio defaults. Mirrors `provideFeedback` - a single small\n * config object folded through `with*` features.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideCngxAudio(\n * withVolume(0.6),\n * withEarcons({ send: { sequence: [{ freq: 880, duration: 60 }] } }),\n * ),\n * ],\n * });\n * ```\n *\n * Register this at **application bootstrap**. The shared engine is\n * `providedIn: 'root'` and reads its configuration once, when it is first built,\n * so config registered in a lazy route's `providers` never reaches it. To\n * configure a subtree, use `provideCngxAudioAt(...)` in `viewProviders` - it\n * layers over this one and re-provides the engine so the scope actually applies.\n *\n * @category common/audio\n * @relatedTo provideCngxAudioAt, injectAudioConfig\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function provideCngxAudio(...features: CngxAudioFeature[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: CNGX_AUDIO_CONFIG, useValue: foldAudioFeatures(features) },\n ]);\n}\n\n/**\n * Register or override earcons globally. Merged over the six built-ins and over\n * any earlier `withEarcons` in the same `provideCngxAudio` call.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withEarcons(earcons: Record<string, EarconConfig>): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, earcons: { ...c.earcons, ...earcons } }) };\n}\n\n/**\n * Set the master volume in `[0, 1]`.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withVolume(volume: number): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, volume }) };\n}\n\n/**\n * Start muted (or explicitly unmuted with `withMuted(false)`).\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withMuted(muted = true): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, muted }) };\n}\n\n/**\n * Toggle the `prefers-reduced-motion` mute gate. `true` by default in the\n * library; pass `false` to keep audio playing under reduced-motion.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withRespectReducedMotion(respect: boolean): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, respectReducedMotion: respect }) };\n}\n\n/**\n * Set the same-name suppression window in milliseconds.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/config/audio-config.ts\n * @since 0.1.0\n */\nexport function withDebounceMs(ms: number): CngxAudioFeature {\n return { _apply: (c) => ({ ...c, debounceMs: ms }) };\n}\n","import { type DestroyRef, type Signal, signal } from '@angular/core';\n\n/** The user-gesture events that satisfy the browser autoplay policy. */\nconst GESTURE_EVENTS = ['pointerdown', 'keydown', 'touchstart'] as const;\n\n/**\n * A minimal `EventTarget` surface - only what the gate installs. Accepting\n * this narrow shape (rather than a concrete `Document`) keeps the factory\n * inject-free and trivially fakeable in a spec.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/autoplay-gate/autoplay-gate.ts\n * @since 0.1.0\n */\nexport type GestureEventTarget = Pick<EventTarget, 'addEventListener' | 'removeEventListener'>;\n\n/**\n * Public handle returned by {@link createAutoplayGate}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/autoplay-gate/autoplay-gate.ts\n * @since 0.1.0\n */\nexport interface CngxAutoplayGate {\n /**\n * `true` once a user gesture (or an explicit {@link arm}) has satisfied the\n * browser autoplay policy. Derived from a single gesture event - never\n * synced from multiple handlers.\n */\n readonly armed: Signal<boolean>;\n\n /** Arm the gate programmatically (e.g. after an existing trusted gesture). */\n arm(): void;\n}\n\n/**\n * Create the autoplay gate: a one-shot latch that flips `armed` to `true` on\n * the first `pointerdown` / `keydown` / `touchstart` and then removes its own\n * listeners. The engine consults `armed()` before resuming the shared\n * `AudioContext`, honouring the browser autoplay policy without a permission\n * prompt.\n *\n * Pure factory - takes its `target` and `destroyRef` as arguments rather than\n * calling `inject()`, so it composes inside the engine's injection context yet\n * stays testable with a fake target. No DI token: the gate has no independent\n * swap consumer (severity ladder `concern: over-abstraction`), so it ships\n * token-less and the engine owns it.\n *\n * @param deps.target The event target to listen on (typically the `Document`).\n * @param deps.destroyRef Cleanup owner - removes any surviving listeners on destroy.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/autoplay-gate/autoplay-gate.ts\n * @since 0.1.0\n */\nexport function createAutoplayGate(deps: {\n readonly target: GestureEventTarget;\n readonly destroyRef: Pick<DestroyRef, 'onDestroy'>;\n}): CngxAutoplayGate {\n const { target, destroyRef } = deps;\n const armed = signal(false);\n\n function removeListeners(): void {\n for (const type of GESTURE_EVENTS) {\n target.removeEventListener(type, handleGesture);\n }\n }\n\n function arm(): void {\n if (armed()) {\n return;\n }\n armed.set(true);\n removeListeners();\n }\n\n function handleGesture(): void {\n arm();\n }\n\n for (const type of GESTURE_EVENTS) {\n target.addEventListener(type, handleGesture, { passive: true });\n }\n destroyRef.onDestroy(removeListeners);\n\n return {\n armed: armed.asReadonly(),\n arm,\n };\n}\n","/** Default suppression window in milliseconds. */\nconst DEFAULT_WINDOW_MS = 100;\n\n/**\n * Public handle returned by {@link createDebouncer}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/debouncer/debouncer.ts\n * @since 0.1.0\n */\nexport interface CngxDebouncer {\n /**\n * Returns `true` if `name` may fire now, `false` if an identical name fired\n * within the window. A `true` result records the fire time; a `false` result\n * leaves it untouched (so a burst is suppressed against its first fire).\n */\n shouldFire(name: string): boolean;\n /** Clear the recorded fire time for `name`, or all names when omitted. */\n reset(name?: string): void;\n}\n\n/**\n * Per-name time-window debouncer: suppresses repeated fires of the same earcon\n * within `windowMs`. A separate composed factory rather than logic buried in\n * the engine (Pillar 3). Plain factory, no DI token - `withDebounceMs` covers\n * configuration and there is no independent swap consumer.\n *\n * `windowMs` accepts a getter so a caller whose window is a reactive input can\n * hold ONE debouncer instance for its lifetime and still track changes: the\n * window is resolved per `shouldFire` call, not captured at construction. That\n * keeps the (stateful) debouncer out of the signal graph - minting one inside a\n * `computed` would return a fresh object per evaluation and break the equality\n * rule. `CngxAudioPitch` is the getter consumer; the engine passes a number.\n *\n * The clock is injectable (`now`) purely so specs are deterministic; production\n * defaults to `Date.now`.\n *\n * @param options.windowMs Suppression window, or a getter for it. `<= 0` disables debouncing. Default `100`.\n * @param options.now Clock source in ms. Default `Date.now`.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/debouncer/debouncer.ts\n * @since 0.1.0\n */\nexport function createDebouncer(options?: {\n readonly windowMs?: number | (() => number);\n readonly now?: () => number;\n}): CngxDebouncer {\n const windowOption = options?.windowMs ?? DEFAULT_WINDOW_MS;\n const resolveWindow =\n typeof windowOption === 'function' ? windowOption : (): number => windowOption;\n const now = options?.now ?? (() => Date.now());\n const lastFiredAt = new Map<string, number>();\n\n return {\n shouldFire(name) {\n const at = now();\n const last = lastFiredAt.get(name);\n if (last !== undefined && at - last < resolveWindow()) {\n return false;\n }\n lastFiredAt.set(name, at);\n return true;\n },\n reset(name) {\n if (name === undefined) {\n lastFiredAt.clear();\n } else {\n lastFiredAt.delete(name);\n }\n },\n };\n}\n","import type { ToneStep } from '../tone-generator/tone-generator';\n\n/**\n * A named earcon - an ordered sequence of tone steps.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/earcons/default-earcons.ts\n * @since 0.1.0\n */\nexport interface EarconConfig {\n /** The tones that make up the earcon, played back-to-back. */\n readonly sequence: readonly ToneStep[];\n}\n\n/**\n * The six built-in earcons, synthesised entirely from `OscillatorNode` - zero\n * audio assets. Plain `as const` (mirrors `CNGX_SELECT_GLYPHS`): tree-shakeable,\n * compile-time exhaustive keys, and NOT exported from `public-api.ts`. The\n * consumer override surface is `withEarcons({...})` and the engine's runtime\n * `register()`, never this const.\n *\n * @internal\n */\nexport const CNGX_AUDIO_DEFAULT_EARCONS = {\n /** Neutral tick for taps, toggles, and generic acknowledgements. */\n tap: { sequence: [{ freq: 660, duration: 30 }] },\n /** Rising two-note chime for a completed positive action. */\n success: {\n sequence: [\n { freq: 660, duration: 80 },\n { freq: 880, duration: 120 },\n ],\n },\n /** Falling sawtooth pair for a failure - deliberately harsher. */\n error: {\n sequence: [\n { freq: 400, duration: 100, type: 'sawtooth', gain: 0.15 },\n { freq: 300, duration: 160, type: 'sawtooth', gain: 0.15 },\n ],\n },\n /** Two soft triangle pulses for a caution state. */\n warning: {\n sequence: [\n { freq: 520, duration: 90, type: 'triangle' },\n { freq: 520, duration: 90, type: 'triangle', delay: 60 },\n ],\n },\n /** Gentle upward two-note for an incoming notification. */\n notification: {\n sequence: [\n { freq: 780, duration: 70 },\n { freq: 990, duration: 90, delay: 20 },\n ],\n },\n /** Three-note upward arpeggio for a finished multi-step flow. */\n complete: {\n sequence: [\n { freq: 523, duration: 90 },\n { freq: 659, duration: 90 },\n { freq: 784, duration: 140 },\n ],\n },\n} as const satisfies Record<string, EarconConfig>;\n\n/** Union of the built-in earcon names. @internal */\nexport type CngxDefaultEarconName = keyof typeof CNGX_AUDIO_DEFAULT_EARCONS;\n","import { InjectionToken } from '@angular/core';\n\n/** Attack ramp, seconds - lifts gain from 0 so the oscillator start is click-free. */\nconst ATTACK_SEC = 0.005;\n/** Release ramp, seconds - drops gain to 0 before stop so the end is click-free. */\nconst RELEASE_SEC = 0.03;\n/** A tone shorter than attack+release cannot host both ramps; clamp up to this floor. */\nconst MIN_DURATION_SEC = ATTACK_SEC + RELEASE_SEC;\n/**\n * Default peak gain for a single tone (before the engine's master volume).\n * Exported so a per-element volume multiplier can scale against the same\n * baseline the generator uses.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport const DEFAULT_TONE_GAIN = 0.2;\n\n/**\n * Per-tone synthesis options.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface ToneOptions {\n /** Oscillator waveform. Default `'sine'`. */\n readonly type?: OscillatorType;\n /** Peak gain in `[0, 1]` before the master volume. Default `0.2`. */\n readonly gain?: number;\n /** Schedule offset in seconds from `currentTime`. Default `0`. */\n readonly when?: number;\n}\n\n/**\n * One step of an earcon sequence.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface ToneStep {\n /** Frequency in Hz. */\n readonly freq: number;\n /** Duration in milliseconds. */\n readonly duration: number;\n /** Oscillator waveform for this step. Default `'sine'`. */\n readonly type?: OscillatorType;\n /** Peak gain for this step in `[0, 1]`. Default `0.2`. */\n readonly gain?: number;\n /** Silent gap in milliseconds before this step starts. Default `0`. */\n readonly delay?: number;\n}\n\n/**\n * Public handle returned by {@link createToneGenerator}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface CngxToneGenerator {\n /** Play a single tone of `durationMs` at `freq`. */\n tone(freq: number, durationMs: number, opts?: ToneOptions): void;\n /** Play a sequence of steps back-to-back, each scheduled after the previous. */\n sequence(steps: readonly ToneStep[]): void;\n}\n\n/**\n * Dependencies handed to the tone-generator factory by the engine.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport interface ToneGeneratorDeps {\n /** Lazy getter for the shared context - called per tone so the engine controls resume. */\n readonly context: () => BaseAudioContext;\n /** Node to connect each tone into (typically the engine's master-volume gain). */\n readonly destination: () => AudioNode;\n}\n\n/**\n * Signature of the tone-generator factory - the shape an override must match.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport type CngxAudioToneGeneratorFactory = (deps: ToneGeneratorDeps) => CngxToneGenerator;\n\n/**\n * Pure `OscillatorNode` synthesis - no audio assets. Each tone is an\n * oscillator through a per-note gain envelope (5 ms attack, 30 ms release)\n * into the engine's master-volume node. The envelope is not decoration: a\n * bare `start()`/`stop()` on a full-amplitude oscillator produces an audible\n * click at both ends; ramping in and out removes it.\n *\n * `create*` pure factory (no `inject()`), so it composes inside the engine and\n * runs against the shared `createAudioContextMock` in specs.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport const createToneGenerator: CngxAudioToneGeneratorFactory = (deps) => {\n function schedule(\n freq: number,\n durationMs: number,\n opts: ToneOptions | undefined,\n whenSec: number,\n ): void {\n const ctx = deps.context();\n const dest = deps.destination();\n const start = ctx.currentTime + whenSec + (opts?.when ?? 0);\n const durSec = Math.max(durationMs / 1000, MIN_DURATION_SEC);\n const peak = opts?.gain ?? DEFAULT_TONE_GAIN;\n\n const osc = ctx.createOscillator();\n osc.type = opts?.type ?? 'sine';\n osc.frequency.setValueAtTime(freq, start);\n\n const env = ctx.createGain();\n const holdStart = start + ATTACK_SEC;\n const releaseStart = start + durSec - RELEASE_SEC;\n env.gain.setValueAtTime(0, start);\n env.gain.linearRampToValueAtTime(peak, holdStart);\n env.gain.setValueAtTime(peak, releaseStart);\n env.gain.linearRampToValueAtTime(0, start + durSec);\n\n osc.connect(env);\n env.connect(dest);\n osc.start(start);\n osc.stop(start + durSec);\n osc.onended = () => {\n osc.disconnect();\n env.disconnect();\n };\n }\n\n return {\n tone(freq, durationMs, opts) {\n schedule(freq, durationMs, opts, 0);\n },\n sequence(steps) {\n let offsetSec = 0;\n for (const step of steps) {\n offsetSec += (step.delay ?? 0) / 1000;\n schedule(step.freq, step.duration, { type: step.type, gain: step.gain }, offsetSec);\n offsetSec += Math.max(step.duration / 1000, MIN_DURATION_SEC);\n }\n },\n };\n};\n\n/**\n * Swappable tone-generator factory. Defaults to {@link createToneGenerator}\n * (oscillator synthesis). Override to swap in sample-based playback without\n * forking the engine - the documented second consumer of this boundary token.\n *\n * @relatedTo createToneGenerator, CNGX_AUDIO_ENGINE_FACTORY\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/tone-generator/tone-generator.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_TONE_GENERATOR_FACTORY = new InjectionToken<CngxAudioToneGeneratorFactory>(\n 'CngxAudioToneGeneratorFactory',\n { providedIn: 'root', factory: () => createToneGenerator },\n);\n","import { DOCUMENT } from '@angular/common';\nimport {\n DestroyRef,\n InjectionToken,\n type Signal,\n effect,\n inject,\n isDevMode,\n signal,\n} from '@angular/core';\nimport { injectMediaQuery } from '@cngx/common/layout';\n\nimport { createAutoplayGate } from '../autoplay-gate/autoplay-gate';\nimport { createDebouncer } from '../debouncer/debouncer';\nimport { CNGX_AUDIO_DEFAULT_EARCONS, type EarconConfig } from '../earcons/default-earcons';\nimport {\n CNGX_AUDIO_TONE_GENERATOR_FACTORY,\n DEFAULT_TONE_GAIN,\n type ToneOptions,\n type ToneStep,\n} from '../tone-generator/tone-generator';\nimport { injectAudioConfig } from '../config/audio-config';\n\n/**\n * Lifecycle state of the shared `AudioContext`, surfaced for debug panels and\n * headless e2e. Mute is a separate `muted` signal - this tracks the context,\n * not the play gate.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport type AudioStatus = 'idle' | 'suspended' | 'running' | 'closed' | 'unsupported';\n\n/**\n * Advanced/testing seam for {@link createAudioEngine}.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport interface AudioEngineOptions {\n /**\n * Override `AudioContext` construction. Defaults to the host window's\n * `AudioContext` / `webkitAudioContext`, or `null` when neither exists (SSR,\n * unsupported browser). Specs pass `createAudioContextMock`.\n */\n readonly contextFactory?: () => BaseAudioContext | null;\n}\n\n/**\n * The audio engine surface. A single write path for `muted` / `volume`\n * (no `mute()`/`unmute()` pair); every state change is a reactive `Signal`.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport interface CngxAudioEngine {\n /**\n * Play a registered earcon by name. Gated + debounced centrally here.\n * `scale` (a `[0, 1]` multiplier over the per-tone default) scales just this\n * play - used by the directives' per-element `audioVolume` without touching\n * the shared master volume.\n */\n play(name: string, scale?: number): void;\n /**\n * Play a single ad-hoc tone. Gated, not debounced, no `lastPlayed` update.\n * `scale` is the same `[0, 1]` multiplier `play()` takes and is applied over\n * `opts.gain` (or the per-tone default) by the engine.\n */\n tone(freq: number, durationMs: number, opts?: ToneOptions, scale?: number): void;\n /** Play an ad-hoc tone sequence. Gated, not debounced. `scale` as in {@link tone}. */\n sequence(steps: readonly ToneStep[], scale?: number): void;\n /** Register or override an earcon at runtime. */\n register(name: string, config: EarconConfig): void;\n /** Arm the autoplay gate programmatically and resume the context if possible. */\n armAutoplay(): void;\n /** Set the global mute state. */\n setMuted(muted: boolean): void;\n /** Set master volume, clamped to `[0, 1]`. */\n setVolume(volume: number): void;\n /** `true` when globally muted. */\n readonly muted: Signal<boolean>;\n /** Master volume in `[0, 1]`. */\n readonly volume: Signal<number>;\n /** Shared-context lifecycle state. */\n readonly status: Signal<AudioStatus>;\n /** Name of the last earcon actually played, or `null`. Powers e2e + debug. */\n readonly lastPlayed: Signal<string | null>;\n}\n\n/**\n * Signature of the engine factory - the shape a telemetry/audit override matches.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport type CngxAudioEngineFactory = (options?: AudioEngineOptions) => CngxAudioEngine;\n\nfunction clampVolume(v: number): number {\n return Math.max(0, Math.min(1, v));\n}\n\n/**\n * Map a raw `AudioContext.state` onto {@link AudioStatus}. Safari reports a\n * non-standard `'interrupted'` (phone call, Siri, audio-route change) that the\n * spec union does not carry; it resumes on the next gesture exactly like a\n * suspended context, so it folds to `'suspended'` rather than being cast into\n * the union. Any unknown value degrades to `'suspended'`, the safe resting\n * state a subsequent `resume()` can lift.\n */\nfunction mapAudioStatus(state: string): AudioStatus {\n switch (state) {\n case 'running':\n return 'running';\n case 'closed':\n return 'closed';\n case 'suspended':\n case 'interrupted':\n default:\n return 'suspended';\n }\n}\n\n/** A context that a `resume()` can lift - suspended, or Safari's interrupted. */\nfunction isSuspendedLike(state: string): boolean {\n return state === 'suspended' || state === 'interrupted';\n}\n\n/**\n * Apply a per-call `[0, 1]` scale to a tone's peak gain. Centralised here so\n * every play path (`play` / `tone` / `sequence`) scales identically and an\n * engine override sees per-element volume uniformly, rather than each caller\n * pre-baking its own gain.\n */\nfunction scaleGain(gain: number | undefined, scale: number): number {\n return (gain ?? DEFAULT_TONE_GAIN) * clampVolume(scale);\n}\n\nfunction scaleSteps(steps: readonly ToneStep[], scale: number | undefined): readonly ToneStep[] {\n if (scale === undefined) {\n return steps;\n }\n return steps.map((step) => ({ ...step, gain: scaleGain(step.gain, scale) }));\n}\n\n/**\n * Create the audio engine: composes the autoplay gate, tone generator, and\n * debouncer over one lazily-created shared `AudioContext`. Reduced-motion muting\n * reuses the existing `injectMediaQuery('(prefers-reduced-motion: reduce)')`\n * primitive rather than adding another `matchMedia` reader.\n *\n * The four mute conditions are enforced centrally in `play()`/`tone()`/\n * `sequence()`: global mute, reduced-motion, and autoplay-not-armed here;\n * per-element `[audioDisabled]` in the directives.\n *\n * Runs in an injection context (calls `inject()` for DOCUMENT, DestroyRef, the\n * tone-generator factory, and the reduced-motion query). The engine instance is\n * resolved through {@link CNGX_AUDIO_ENGINE_FACTORY}; scope it to a subtree with\n * `provideCngxAudioAt(...)` rather than calling this directly.\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport const createAudioEngine: CngxAudioEngineFactory = (options) => {\n const doc = inject(DOCUMENT);\n const destroyRef = inject(DestroyRef);\n const toneGeneratorFactory = inject(CNGX_AUDIO_TONE_GENERATOR_FACTORY);\n const config = injectAudioConfig();\n const reducedMotion = injectMediaQuery('(prefers-reduced-motion: reduce)');\n\n const muted = signal(config.muted);\n const volume = signal(clampVolume(config.volume));\n const status = signal<AudioStatus>('idle');\n const lastPlayed = signal<string | null>(null);\n\n const gate = createAutoplayGate({ target: doc, destroyRef });\n const debouncer = createDebouncer({ windowMs: config.debounceMs });\n const earcons = new Map<string, EarconConfig>(\n Object.entries({ ...CNGX_AUDIO_DEFAULT_EARCONS, ...config.earcons }),\n );\n // Dev-only: an unknown earcon name is a fixed authoring mistake, so warn once\n // per name rather than on every (debounced) play attempt.\n const warnedUnknownEarcons = new Set<string>();\n\n let context: BaseAudioContext | null = null;\n let masterGain: GainNode | null = null;\n\n const contextFactory =\n options?.contextFactory ??\n ((): BaseAudioContext | null => {\n const view = doc.defaultView as\n | (Window & {\n AudioContext?: typeof AudioContext;\n webkitAudioContext?: typeof AudioContext;\n })\n | null;\n const Ctor = view?.AudioContext ?? view?.webkitAudioContext;\n return Ctor ? new Ctor() : null;\n });\n\n const toneGenerator = toneGeneratorFactory({\n context: () => context!,\n destination: () => masterGain!,\n });\n\n // Single source of truth for `status`: the context's own statechange event.\n // Browser-initiated transitions the page never requested (Safari interrupt,\n // OS suspend) flow through here too, and because resume()/suspend() land\n // their result via this listener there is no manual status write left to\n // race - a stale resume resolution cannot clobber a later suspend.\n const onStateChange = (): void => {\n if (context) {\n status.set(mapAudioStatus(context.state));\n }\n };\n\n function resumeIfArmed(): void {\n if (context && gate.armed() && isSuspendedLike(context.state)) {\n void (context as AudioContext).resume().catch(() => undefined);\n }\n }\n\n function ensureContext(): BaseAudioContext | null {\n if (context) {\n return context;\n }\n const created = contextFactory();\n if (!created) {\n status.set('unsupported');\n return null;\n }\n context = created;\n masterGain = created.createGain();\n masterGain.gain.value = volume();\n masterGain.connect(created.destination);\n // Born in its current state - no statechange fires for the initial value,\n // so seed it directly; every later transition arrives via onStateChange.\n status.set(mapAudioStatus(created.state));\n created.addEventListener('statechange', onStateChange);\n resumeIfArmed();\n return context;\n }\n\n function blocked(): boolean {\n return muted() || (config.respectReducedMotion && reducedMotion()) || !gate.armed();\n }\n\n // Volume is communicated to the master node reactively - the single writer is\n // setVolume(), but binding through an effect keeps the node in sync from any\n // future volume source too.\n effect(() => {\n const v = volume();\n if (masterGain) {\n masterGain.gain.value = v;\n }\n });\n\n // Suspend on tab hide (frees the audio hardware); resume on return if armed.\n const onVisibility = (): void => {\n if (!context) {\n return;\n }\n if (doc.hidden) {\n if (context.state === 'running') {\n void (context as AudioContext).suspend().catch(() => undefined);\n }\n } else {\n resumeIfArmed();\n }\n };\n doc.addEventListener('visibilitychange', onVisibility);\n destroyRef.onDestroy(() => {\n doc.removeEventListener('visibilitychange', onVisibility);\n context?.removeEventListener('statechange', onStateChange);\n // close() rejects on an already-closed context; swallow it so a double\n // destroy does not surface an unhandled rejection.\n const closing = (context as AudioContext | null)?.close?.();\n void closing?.then(\n () => undefined,\n () => undefined,\n );\n });\n\n return {\n play(name, scale) {\n if (blocked()) {\n return;\n }\n if (!ensureContext()) {\n return;\n }\n resumeIfArmed();\n if (!debouncer.shouldFire(name)) {\n return;\n }\n const earcon = earcons.get(name);\n if (!earcon) {\n if (isDevMode() && !warnedUnknownEarcons.has(name)) {\n warnedUnknownEarcons.add(name);\n console.warn(\n `[cngxAudio] Unknown earcon \"${name}\". Register it via withEarcons({...}) or engine.register(name, config).`,\n );\n }\n return;\n }\n toneGenerator.sequence(scaleSteps(earcon.sequence, scale));\n lastPlayed.set(name);\n },\n tone(freq, durationMs, opts, scale) {\n if (blocked() || !ensureContext()) {\n return;\n }\n resumeIfArmed();\n toneGenerator.tone(\n freq,\n durationMs,\n scale === undefined ? opts : { ...opts, gain: scaleGain(opts?.gain, scale) },\n );\n },\n sequence(steps, scale) {\n if (blocked() || !ensureContext()) {\n return;\n }\n resumeIfArmed();\n toneGenerator.sequence(scaleSteps(steps, scale));\n },\n register(name, earconConfig) {\n earcons.set(name, earconConfig);\n },\n armAutoplay() {\n gate.arm();\n resumeIfArmed();\n },\n setMuted(next) {\n muted.set(next);\n },\n setVolume(next) {\n volume.set(clampVolume(next));\n },\n muted: muted.asReadonly(),\n volume: volume.asReadonly(),\n status: status.asReadonly(),\n lastPlayed: lastPlayed.asReadonly(),\n };\n};\n\n/**\n * Swappable engine factory. Defaults to {@link createAudioEngine}. Override to\n * wrap the engine with telemetry/audit logging - the documented second consumer\n * of this boundary token.\n *\n * Register the override at **application bootstrap**. The shared engine instance\n * is itself `providedIn: 'root'` and is built on first use, so a factory override\n * registered in a lazy route's `providers` is never consulted. For a subtree that\n * needs its own engine, use `provideCngxAudioAt(...)` in `viewProviders`.\n *\n * An override that needs the resolved configuration reads it with\n * {@link injectAudioConfig} (defaults merged); {@link CNGX_AUDIO_DEFAULTS} holds\n * the library baseline. Both are exported from `@cngx/common/audio`.\n *\n * @relatedTo createAudioEngine, injectCngxAudio, injectAudioConfig\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/engine/audio-engine.ts\n * @since 0.1.0\n */\nexport const CNGX_AUDIO_ENGINE_FACTORY = new InjectionToken<CngxAudioEngineFactory>(\n 'CngxAudioEngineFactory',\n { providedIn: 'root', factory: () => createAudioEngine },\n);\n","import { InjectionToken, Optional, type Provider, SkipSelf, inject } from '@angular/core';\n\nimport {\n CNGX_AUDIO_CONFIG,\n type CngxAudioConfig,\n type CngxAudioFeature,\n foldAudioFeatures,\n} from './config/audio-config';\nimport { CNGX_AUDIO_ENGINE_FACTORY, type CngxAudioEngine } from './engine/audio-engine';\n\n/**\n * The public audio handle - what {@link injectCngxAudio} returns.\n *\n * An alias for {@link CngxAudioEngine} rather than a second interface: the two\n * contracts were member-for-member identical, so a separate declaration was\n * duplication, not indirection. The name is kept because it reads better at\n * call sites (`const audio: CngxAudioHandle = injectCngxAudio()`), and because\n * the engine contract is the one an override implements.\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts\n * @since 0.1.0\n */\nexport type CngxAudioHandle = CngxAudioEngine;\n\n/**\n * The shared engine instance. Lazily built from `CNGX_AUDIO_ENGINE_FACTORY` and\n * memoised per injector so every directive shares one `AudioContext`, mute\n * state, and volume. `@internal` - the public entry point is {@link injectCngxAudio};\n * consumers override the swappable factory, not this instance anchor. To scope\n * audio to a subtree, use {@link provideCngxAudioAt} - it re-provides this token\n * for you alongside the scoped config.\n *\n * @internal\n */\nexport const CNGX_AUDIO_ENGINE = new InjectionToken<CngxAudioHandle>('CngxAudioEngineInstance', {\n providedIn: 'root',\n factory: () => inject(CNGX_AUDIO_ENGINE_FACTORY)(),\n});\n\n/**\n * Resolve the shared audio handle. Must run in an injection context (field\n * initialiser or constructor).\n *\n * ```typescript\n * export class MyToggle {\n * private readonly audio = injectCngxAudio();\n * protected readonly muted = this.audio.muted;\n * protected toggle(): void {\n * this.audio.setMuted(!this.muted());\n * }\n * }\n * ```\n *\n * @category common/audio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts\n * @since 0.1.0\n */\nexport function injectCngxAudio(): CngxAudioHandle {\n return inject(CNGX_AUDIO_ENGINE);\n}\n\n/**\n * Component-scope audio config - place in a component's `viewProviders` so a\n * subtree runs its own muted / volume / earcon set, independent of the app-wide\n * `provideCngxAudio(...)`.\n *\n * ```typescript\n * @Component({\n * selector: 'app-mixer',\n * viewProviders: [provideCngxAudioAt(withVolume(0.3), withEarcons({ ... }))],\n * })\n * export class Mixer {}\n * ```\n *\n * Returns `Provider[]` (not `EnvironmentProviders`) so it can sit in\n * `viewProviders`. The root `provideCngxAudio` must be registered at\n * **application bootstrap**: {@link CNGX_AUDIO_ENGINE} is `providedIn: 'root'`,\n * so its factory resolves the config from the root injector and a provider\n * registered on a lazy route never reaches it.\n *\n * Features **layer over** the ancestor config (root, or an enclosing scope)\n * rather than replacing it - the `provideMenuConfigAt` pattern. Scalar fields\n * (`muted`, `volume`, `debounceMs`, `respectReducedMotion`) override; `earcons`\n * merge, so a subtree adds or overrides individual earcons without dropping the\n * app-wide registry.\n *\n * The default shared engine is a single, process-global `AudioContext`; this\n * deliberately re-provides {@link CNGX_AUDIO_ENGINE} so the subtree gets an\n * **isolated engine** reading the scoped {@link CNGX_AUDIO_CONFIG} - a\n * config-only override would be inert against the already-built root engine.\n * That engine owns a **second `AudioContext`**, created lazily on its first play\n * and closed with the component's `DestroyRef`. Browsers cap the number of live\n * `AudioContext`s, so reach for this only when a subtree genuinely needs an\n * independent audio scope - per-element `[audioVolume]` / `[audioDisabled]`\n * cover the common case without a second context.\n *\n * @category common/audio\n * @relatedTo provideCngxAudio, injectCngxAudio\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/inject-audio.ts\n * @since 0.1.0\n */\nexport function provideCngxAudioAt(...features: CngxAudioFeature[]): Provider[] {\n return [\n {\n provide: CNGX_AUDIO_CONFIG,\n useFactory: (parent: Partial<CngxAudioConfig> | null): Partial<CngxAudioConfig> => {\n const base = parent ?? {};\n const scoped = foldAudioFeatures(features);\n return { ...base, ...scoped, earcons: { ...base.earcons, ...scoped.earcons } };\n },\n deps: [[new SkipSelf(), new Optional(), CNGX_AUDIO_CONFIG]],\n },\n { provide: CNGX_AUDIO_ENGINE, useFactory: () => inject(CNGX_AUDIO_ENGINE_FACTORY)() },\n ];\n}\n","/**\n * Structural equality for the `key -> earcon` maps the directive binding\n * computeds return. Both `[cngxAudio]` and `[cngxAudioStatus]` derive a fresh\n * `Map` from their spec string on every recompute; without an `equal` fn the\n * `computed` would hand a new reference to any reactive consumer even when the\n * parsed bindings are identical (the signal-hygiene Equality Rule). Same size,\n * same value per key.\n *\n * @internal - not exported from `public-api.ts`.\n */\nexport function sameStringMap<K>(a: ReadonlyMap<K, string>, b: ReadonlyMap<K, string>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const [key, value] of a) {\n if (b.get(key) !== value) {\n return false;\n }\n }\n return true;\n}\n","/** DOM events `[cngxAudio]` may bind an earcon to. */\nexport const CNGX_AUDIO_DOM_EVENTS = [\n 'click',\n 'focus',\n 'blur',\n 'pointerenter',\n 'pointerleave',\n 'submit',\n 'change',\n 'input',\n] as const;\n\n/** Lifecycle keys that belong to `[cngxAudioStatus]`, rejected here. */\nconst LIFECYCLE_KEYS = [\n 'pending',\n 'succeeded',\n 'failed',\n 'loading',\n 'refreshing',\n 'success',\n 'error',\n 'idle',\n] as const;\n\n/** A `[cngxAudio]` DOM event name. */\nexport type CngxAudioDomEvent = (typeof CNGX_AUDIO_DOM_EVENTS)[number];\n\n/** Result of parsing an `event:earcon` binding string. */\nexport interface ParsedEventBindings {\n /** Valid `domEvent -> earcon` pairs. */\n readonly bindings: ReadonlyMap<CngxAudioDomEvent, string>;\n /** Keys that are neither DOM events nor lifecycle keys. */\n readonly unknownKeys: readonly string[];\n /** Lifecycle keys - the grammar of `[cngxAudioStatus]`, not `[cngxAudio]`. */\n readonly lifecycleKeys: readonly string[];\n}\n\nconst DOM_EVENT_SET = new Set<string>(CNGX_AUDIO_DOM_EVENTS);\nconst LIFECYCLE_SET = new Set<string>(LIFECYCLE_KEYS);\n\n/**\n * Parse the `event:earcon` grammar (`'click:tap, focus:notification'`) into a\n * DOM-event map. Pure - no DOM, no `inject()`. Keys are categorised so the\n * directive can dev-warn on unknown earcon keys and, separately, on lifecycle\n * keys that should have used `[cngxAudioStatus]`.\n */\nexport function parseEventBindings(spec: string): ParsedEventBindings {\n const bindings = new Map<CngxAudioDomEvent, string>();\n const unknownKeys: string[] = [];\n const lifecycleKeys: string[] = [];\n\n for (const pair of spec.split(',')) {\n const trimmed = pair.trim();\n if (!trimmed) {\n continue;\n }\n const colon = trimmed.indexOf(':');\n if (colon === -1) {\n unknownKeys.push(trimmed);\n continue;\n }\n const key = trimmed.slice(0, colon).trim();\n const earcon = trimmed.slice(colon + 1).trim();\n if (DOM_EVENT_SET.has(key)) {\n if (earcon) {\n bindings.set(key as CngxAudioDomEvent, earcon);\n }\n } else if (LIFECYCLE_SET.has(key)) {\n lifecycleKeys.push(key);\n } else {\n unknownKeys.push(key);\n }\n }\n\n return { bindings, unknownKeys, lifecycleKeys };\n}\n","import {\n DestroyRef,\n Directive,\n ElementRef,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n untracked,\n} from '@angular/core';\n\nimport { injectCngxAudio } from '../inject-audio';\nimport { sameStringMap } from '../internal/same-string-map';\nimport { type CngxAudioDomEvent, parseEventBindings } from './parse-bindings';\n\n/**\n * Event-mode audio binder. Maps DOM events on the host to earcons via the\n * `event:earcon` grammar - a pure DOM-event-to-sound directive with no state\n * coupling (that is `[cngxAudioStatus]`'s job).\n *\n * ```html\n * <button [cngxAudio]=\"'click:tap'\">Save</button>\n * <a [cngxAudio]=\"'pointerenter:notification, click:complete'\">Open</a>\n * ```\n *\n * Playback is skipped when the element is disabled (`[audioDisabled]`), when\n * the engine is muted / reduced-motion-gated / autoplay-not-armed, or when the\n * same earcon is still within the debounce window. `[audioVolume]` scales just\n * this element's plays.\n *\n * The listener set is derived from the grammar, not fixed: `'click:tap'`\n * registers one DOM listener, and rebinding `[cngxAudio]` at runtime adds the\n * newly named events and removes the dropped ones. Binding happens on the first\n * change detection after the input settles rather than at construction, so an\n * event dispatched programmatically before the host's first tick is missed.\n *\n * Listeners are registered outside Angular's event dispatch. In a zoneless app\n * that means they schedule no change detection; under zone.js the patched\n * `addEventListener` still triggers a tick, so there the saving is registration\n * cost alone. Either way the engine's `lastPlayed` and `status` are signals, so\n * anything a template binds to them stays current.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/event-mode/audio.directive.ts\n * @since 0.1.0\n * @relatedTo injectCngxAudio, provideCngxAudio, CngxAudioStatus\n * <example-url>http://localhost:4200/#/common/audio/event-mode/basic</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/custom-earcons</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/earcon-palette</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/form-feedback</example-url>\n * <example-url>http://localhost:4200/#/common/audio/event-mode/hover-and-focus</example-url>\n */\n@Directive({\n selector: '[cngxAudio]',\n exportAs: 'cngxAudio',\n})\nexport class CngxAudio {\n private readonly audio = injectCngxAudio();\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n\n /** The listeners currently registered on the host, keyed by event type. */\n private readonly bound = new Map<CngxAudioDomEvent, EventListener>();\n\n /** The `event:earcon` grammar, e.g. `'click:tap, focus:notification'`. */\n readonly spec = input<string>('', { alias: 'cngxAudio' });\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the engine volume. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n private readonly bindings = computed(() => parseEventBindings(this.spec()).bindings, {\n equal: sameStringMap,\n });\n\n constructor() {\n effect(() => {\n const wanted = this.bindings();\n untracked(() => this.syncListeners(wanted));\n });\n\n this.destroyRef.onDestroy(() => this.unbindAll());\n\n if (isDevMode()) {\n // One-shot post-binding check, not a reactive node.\n afterNextRender(() => {\n const parsed = parseEventBindings(this.spec());\n if (parsed.lifecycleKeys.length > 0) {\n console.error(\n `[cngxAudio] Lifecycle keys \"${parsed.lifecycleKeys.join(', ')}\" are not DOM events. ` +\n 'Use [cngxAudioStatus] for lifecycle bindings.',\n );\n }\n if (parsed.unknownKeys.length > 0) {\n console.warn(\n `[cngxAudio] Unrecognised event keys \"${parsed.unknownKeys.join(', ')}\". ` +\n 'Expected one of: click, focus, blur, pointerenter, pointerleave, submit, change, input.',\n );\n }\n });\n }\n }\n\n /**\n * Diff the bound listener set against the parsed spec: drop event types the\n * grammar no longer names, add the ones it newly names, leave the rest alone.\n * A rebuild would churn a listener that is still wanted.\n */\n private syncListeners(wanted: ReadonlyMap<CngxAudioDomEvent, string>): void {\n const el = this.host.nativeElement;\n\n for (const [type, listener] of this.bound) {\n if (!wanted.has(type)) {\n el.removeEventListener(type, listener);\n this.bound.delete(type);\n }\n }\n\n for (const type of wanted.keys()) {\n if (this.bound.has(type)) {\n continue;\n }\n // Captures the type only - the earcon is read fresh at fire time, so\n // renaming it in the grammar needs no rebind.\n const listener: EventListener = () => this.handleEvent(type);\n // Not passive: none of the bindable types are scroll-blocking, so the\n // flag buys nothing and would foreclose preventDefault on submit/click.\n el.addEventListener(type, listener);\n this.bound.set(type, listener);\n }\n }\n\n private unbindAll(): void {\n const el = this.host.nativeElement;\n for (const [type, listener] of this.bound) {\n el.removeEventListener(type, listener);\n }\n this.bound.clear();\n }\n\n private handleEvent(event: CngxAudioDomEvent): void {\n if (this.audioDisabled()) {\n return;\n }\n const earcon = this.bindings().get(event);\n if (!earcon) {\n return;\n }\n this.audio.play(earcon, this.audioVolume());\n }\n}\n","import type { AsyncStatus } from '@cngx/core/utils';\n\n/**\n * Lifecycle keys `[cngxAudioStatus]` accepts, mapped to the canonical\n * `AsyncStatus` the transition tracker emits. Two friendly aliases are folded\n * in: `succeeded -> success` and `failed -> error`, so both the raw status and\n * the past-tense reading parse to the same earcon.\n */\nconst STATUS_ALIASES: Readonly<Record<string, AsyncStatus>> = {\n idle: 'idle',\n loading: 'loading',\n pending: 'pending',\n refreshing: 'refreshing',\n success: 'success',\n succeeded: 'success',\n error: 'error',\n failed: 'error',\n};\n\n/** DOM-event keys that belong to `[cngxAudio]`, rejected here. */\nexport const CNGX_AUDIO_STATUS_DOM_EVENTS = [\n 'click',\n 'focus',\n 'blur',\n 'pointerenter',\n 'pointerleave',\n 'submit',\n 'change',\n 'input',\n] as const;\n\n/** Result of parsing a `status:earcon` binding string. */\nexport interface ParsedStatusBindings {\n /** Valid `status -> earcon` pairs, keyed by canonical `AsyncStatus`. */\n readonly bindings: ReadonlyMap<AsyncStatus, string>;\n /** DOM-event keys - the grammar of `[cngxAudio]`, not `[cngxAudioStatus]`. */\n readonly domEventKeys: readonly string[];\n /** Keys that are neither lifecycle statuses nor DOM events. */\n readonly unknownKeys: readonly string[];\n}\n\nconst DOM_EVENT_SET = new Set<string>(CNGX_AUDIO_STATUS_DOM_EVENTS);\n\n/**\n * Parse the `status:earcon` grammar (`'pending:tap, succeeded:success'`) into a\n * status map. Pure - no DOM, no `inject()`. Keys are categorised so the\n * directive can dev-error on DOM-event keys that should have used `[cngxAudio]`\n * and dev-warn on unknown keys. `succeeded`/`failed` normalise to\n * `success`/`error` so a lookup by the tracker's raw `AsyncStatus` hits.\n */\nexport function parseStatusBindings(spec: string): ParsedStatusBindings {\n const bindings = new Map<AsyncStatus, string>();\n const domEventKeys: string[] = [];\n const unknownKeys: string[] = [];\n\n for (const pair of spec.split(',')) {\n const trimmed = pair.trim();\n if (!trimmed) {\n continue;\n }\n const colon = trimmed.indexOf(':');\n if (colon === -1) {\n unknownKeys.push(trimmed);\n continue;\n }\n const key = trimmed.slice(0, colon).trim();\n const earcon = trimmed.slice(colon + 1).trim();\n const status = STATUS_ALIASES[key];\n if (status) {\n if (earcon) {\n bindings.set(status, earcon);\n }\n } else if (DOM_EVENT_SET.has(key)) {\n domEventKeys.push(key);\n } else {\n unknownKeys.push(key);\n }\n }\n\n return { bindings, domEventKeys, unknownKeys };\n}\n","import {\n Directive,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n untracked,\n} from '@angular/core';\nimport { CNGX_STATEFUL, type CngxAsyncState, createTransitionTracker } from '@cngx/core/utils';\n\nimport { injectCngxAudio } from '../inject-audio';\nimport { sameStringMap } from '../internal/same-string-map';\nimport { parseStatusBindings } from './parse-status-bindings';\n\n/**\n * Status-mode audio bridge. Maps `CngxAsyncState` lifecycle transitions to\n * earcons via the `status:earcon` grammar - the audition counterpart of\n * `CngxToastOn`. Fires only on a real status transition, never on the initial\n * `idle`, and at most once per transition.\n *\n * ```html\n * <button [cngxAsyncClick]=\"upload\"\n * #upload=\"cngxAsyncClick\"\n * [state]=\"upload.state\"\n * [cngxAudioStatus]=\"'pending:tap, succeeded:success, failed:error'\">\n * Upload\n * </button>\n * ```\n *\n * The state source resolves the same way the feedback bridges do: an explicit\n * `[state]` input wins, otherwise it falls back to an ancestor's\n * `CNGX_STATEFUL`. The grammar keys are lifecycle statuses only - DOM-event\n * keys (`click`, `focus`, …) belong to `[cngxAudio]` and are rejected with a\n * dev-error. `succeeded`/`failed` are accepted as aliases for `success`/`error`.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/status-mode/audio-status.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAudio, injectCngxAudio, CngxAsyncClick\n * <example-url>http://localhost:4200/#/common/audio/status-bridge/async-click</example-url>\n */\n@Directive({\n selector: '[cngxAudioStatus]',\n exportAs: 'cngxAudioStatus',\n})\nexport class CngxAudioStatus {\n private readonly audio = injectCngxAudio();\n private readonly statefulFallback = inject(CNGX_STATEFUL, { optional: true });\n\n /** The `status:earcon` grammar, e.g. `'pending:tap, succeeded:success'`. */\n readonly spec = input<string>('', { alias: 'cngxAudioStatus' });\n\n /**\n * The async state to watch. Optional - when omitted, the bridge falls back to\n * an ancestor `CNGX_STATEFUL`. A bare `[state]` attribute (empty string) is\n * treated as \"no input bound\" so the fallback kicks in.\n */\n readonly state = input<\n CngxAsyncState<unknown> | undefined,\n CngxAsyncState<unknown> | '' | undefined\n >(undefined, {\n transform: (v) => (typeof v === 'string' ? undefined : v),\n });\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the engine volume. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n /** Effective state - explicit input wins over ancestor `CNGX_STATEFUL`. */\n private readonly effectiveState = computed<CngxAsyncState<unknown> | undefined>(\n () => this.state() ?? this.statefulFallback?.state,\n );\n\n private readonly bindings = computed(() => parseStatusBindings(this.spec()).bindings, {\n equal: sameStringMap,\n });\n\n constructor() {\n if (isDevMode()) {\n // One-shot post-binding check, not a reactive node.\n afterNextRender(() => {\n const parsed = parseStatusBindings(this.spec());\n if (parsed.domEventKeys.length > 0) {\n console.error(\n `[cngxAudioStatus] DOM-event keys \"${parsed.domEventKeys.join(', ')}\" are not lifecycle ` +\n 'statuses. Use [cngxAudio] for DOM-event bindings.',\n );\n }\n if (this.state() === undefined && !this.statefulFallback) {\n console.error(\n '[cngxAudioStatus] No state source. Bind [state]=\"state\" explicitly or place inside a ' +\n 'component that provides CNGX_STATEFUL.',\n );\n }\n });\n }\n\n const tracker = createTransitionTracker(() => this.effectiveState()?.status() ?? 'idle');\n effect(() => {\n const status = tracker.current();\n const previous = tracker.previous();\n if (status === previous) {\n return;\n }\n untracked(() => {\n if (this.audioDisabled()) {\n return;\n }\n const earcon = this.bindings().get(status);\n if (earcon) {\n this.audio.play(earcon, this.audioVolume());\n }\n });\n });\n }\n}\n","import { Directive, ElementRef, booleanAttribute, inject, input } from '@angular/core';\n\nimport { injectCngxAudio } from '../inject-audio';\n\n/** Earcon names played as the pointer or focus enters and leaves a zone. */\nexport interface CngxAudioZoneBinding {\n /** Played on `pointerenter`. */\n readonly enter?: string | null;\n /** Played on `pointerleave`. */\n readonly leave?: string | null;\n /** Played on `focusin`. */\n readonly focus?: string | null;\n /** Played on `focusout`. */\n readonly blur?: string | null;\n}\n\n/**\n * Zone-mode audio binder. Plays earcons as the pointer or keyboard focus enters\n * and leaves the host - a spatial complement to `[cngxAudio]`. The record input\n * makes the four zone transitions explicit rather than encoding them in the\n * `event:earcon` string grammar, because the listener set (pointer/focus zone)\n * and the shape (record vs string) are semantically distinct from event-mode.\n *\n * ```html\n * <div [cngxAudioZone]=\"{ enter: 'notification', leave: 'tap' }\">Hover me</div>\n * <button [cngxAudioZone]=\"{ focus: 'tap', blur: 'tap' }\">Focus me</button>\n * ```\n *\n * Playback obeys the same gates as the rest of the family: skipped when\n * `[audioDisabled]`, muted, reduced-motion-gated, autoplay-not-armed, or still\n * within the debounce window. `[audioVolume]` scales just this element's plays.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/zone-mode/audio-zone.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAudio, injectCngxAudio\n * <example-url>http://localhost:4200/#/common/audio/zone/enter-leave</example-url>\n */\n@Directive({\n selector: '[cngxAudioZone]',\n exportAs: 'cngxAudioZone',\n host: {\n '(pointerenter)': 'handleZone(\"enter\")',\n '(pointerleave)': 'handleZone(\"leave\")',\n '(focusin)': 'handleFocusCross(\"focus\", $event)',\n '(focusout)': 'handleFocusCross(\"blur\", $event)',\n },\n})\nexport class CngxAudioZone {\n private readonly audio = injectCngxAudio();\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Earcon per zone transition. Any omitted key plays nothing. */\n readonly zone = input<CngxAudioZoneBinding>({}, { alias: 'cngxAudioZone' });\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the engine volume. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * `focusin`/`focusout` bubble, so a zone wrapping focusable children would\n * otherwise fire on every internal tab move. Only a crossing of the zone\n * boundary counts - the focus counterpart of pointerenter/pointerleave.\n */\n protected handleFocusCross(kind: 'focus' | 'blur', event: FocusEvent): void {\n if (this.host.nativeElement.contains(event.relatedTarget as Node | null)) {\n return;\n }\n this.handleZone(kind);\n }\n\n protected handleZone(kind: keyof CngxAudioZoneBinding): void {\n if (this.audioDisabled()) {\n return;\n }\n const earcon = this.zone()[kind];\n if (earcon) {\n this.audio.play(earcon, this.audioVolume());\n }\n }\n}\n","import { Directive, booleanAttribute, effect, input, linkedSignal, untracked } from '@angular/core';\n\nimport { createDebouncer } from '../debouncer/debouncer';\nimport { injectCngxAudio } from '../inject-audio';\n\n/** Throttle key - the pitch directive plays a single ad-hoc voice. */\nconst PITCH_VOICE = 'pitch';\n\n/**\n * Pitch-mode audio binder. Sonifies a continuous numeric value: each change of\n * `[cngxAudioPitch]` clamps against a fixed domain, linear-scales into an output\n * frequency range, and plays a short tone. Useful for sliders, gauges, and live\n * metrics - the ear tracks a value without looking.\n *\n * ```html\n * <input type=\"range\" min=\"0\" max=\"100\"\n * [cngxAudioPitch]=\"volume()\"\n * [pitchDomain]=\"[0, 100]\"\n * [pitchRange]=\"[220, 880]\" />\n * ```\n *\n * The inputs are discrete rather than an options record so `[cngxAudioPitch]`\n * stays a native reactive input - passing `[cngxAudioPitch]=\"volume()\"` binds a\n * signal value directly, never a `Signal` smuggled inside a config object. The\n * domain is caller-supplied and fixed; it is never accumulated from observed\n * values, so the directive holds no hidden state. Value-to-frequency is a pure\n * derivation; rapid sweeps are throttled through the shared `createDebouncer`.\n *\n * @category common/audio\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/audio/pitch-mode/audio-pitch.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAudio, injectCngxAudio\n * <example-url>http://localhost:4200/#/common/audio/pitch/slider</example-url>\n */\n@Directive({\n selector: '[cngxAudioPitch]',\n exportAs: 'cngxAudioPitch',\n})\nexport class CngxAudioPitch {\n private readonly audio = injectCngxAudio();\n\n /** The tracked value to sonify. */\n readonly value = input.required<number>({ alias: 'cngxAudioPitch' });\n\n /** Output frequency range `[lo, hi]` in Hz. Default `[220, 880]`. */\n readonly pitchRange = input<[number, number]>([220, 880]);\n\n /** Fixed input domain `[min, max]` the value is clamped against. */\n readonly pitchDomain = input.required<[number, number]>();\n\n /** Tone duration in ms. Default `120`. */\n readonly pitchDurationMs = input<number>(120);\n\n /** Minimum ms between tones during a sweep. Default `50`. */\n readonly pitchThrottleMs = input<number>(50);\n\n /** Per-element volume multiplier in `[0, 1]`; unset uses the tone default. */\n readonly audioVolume = input<number | undefined>(undefined);\n\n /** Suppress this element's audio without unbinding. */\n readonly audioDisabled = input(false, { transform: booleanAttribute });\n\n // One instance for the directive's lifetime, deliberately outside the signal\n // graph: a debouncer carries mutable throttle state, and minting one inside a\n // computed would hand out a fresh object per evaluation. The window is a\n // getter, so a changed [pitchThrottleMs] applies on the next fire.\n private readonly debouncer = createDebouncer({ windowMs: () => this.pitchThrottleMs() });\n\n // Fires on change, never on mount: sonifying the initial value would emit a\n // tone the user never asked for, and would burn the throttle window before\n // their first move. Same current/previous shape as createTransitionTracker.\n private readonly transition = linkedSignal<number, { current: number; previous: number | null }>({\n source: () => this.value(),\n computation: (current, prev) => ({ current, previous: prev?.value.current ?? null }),\n equal: (a, b) => a.current === b.current && a.previous === b.previous,\n });\n\n constructor() {\n effect(() => {\n const { current, previous } = this.transition();\n if (previous === null || current === previous) {\n return;\n }\n untracked(() => {\n if (this.audioDisabled()) {\n return;\n }\n if (!this.debouncer.shouldFire(PITCH_VOICE)) {\n return;\n }\n this.audio.tone(this.scale(current), this.pitchDurationMs(), undefined, this.audioVolume());\n });\n });\n }\n\n /** Clamp to the domain, then linear-scale into the frequency range. */\n private scale(value: number): number {\n const [domainLo, domainHi] = this.pitchDomain();\n const [rangeLo, rangeHi] = this.pitchRange();\n const clamped = Math.max(domainLo, Math.min(domainHi, value));\n if (domainHi === domainLo) {\n return rangeLo;\n }\n const t = (clamped - domainLo) / (domainHi - domainLo);\n return rangeLo + t * (rangeHi - rangeLo);\n }\n}\n","/**\n * @module @cngx/common/audio\n *\n * Signal-first audio-feedback system. A thin directive layer over a small\n * Web Audio adapter: zero asset weight (earcons synthesised from\n * `OscillatorNode`), a single shared `AudioContext` behind the engine, and\n * the `provideCngxAudio(...)` aggregator. Mirrors the shape of the sibling\n * feedback primitives (`CngxRipple`, `CngxPressable`, `CngxSpeak`) - the\n * fourth sense, audition, as composable atoms.\n */\n\n// Handle + component-scope provider\nexport { injectCngxAudio, provideCngxAudioAt, type CngxAudioHandle } from './inject-audio';\n\n// Config + provider\nexport {\n CNGX_AUDIO_CONFIG,\n CNGX_AUDIO_DEFAULTS,\n injectAudioConfig,\n provideCngxAudio,\n withEarcons,\n withVolume,\n withMuted,\n withRespectReducedMotion,\n withDebounceMs,\n type CngxAudioConfig,\n type CngxAudioFeature,\n} from './config/audio-config';\n\n// Engine - boundary DI token + factory + alias\nexport {\n createAudioEngine,\n CNGX_AUDIO_ENGINE_FACTORY,\n type CngxAudioEngine,\n type CngxAudioEngineFactory,\n type AudioEngineOptions,\n type AudioStatus,\n} from './engine/audio-engine';\n\n// Tone generator - boundary DI token + factory + alias\nexport {\n createToneGenerator,\n CNGX_AUDIO_TONE_GENERATOR_FACTORY,\n type CngxToneGenerator,\n type CngxAudioToneGeneratorFactory,\n type ToneGeneratorDeps,\n type ToneOptions,\n type ToneStep,\n} from './tone-generator/tone-generator';\n\n// Token-less composed factories\nexport {\n createAutoplayGate,\n type CngxAutoplayGate,\n type GestureEventTarget,\n} from './autoplay-gate/autoplay-gate';\nexport { createDebouncer, type CngxDebouncer } from './debouncer/debouncer';\n\n// Earcon value type (the CNGX_AUDIO_DEFAULT_EARCONS const stays internal)\nexport type { EarconConfig } from './earcons/default-earcons';\n\n// Event-mode directive\nexport { CngxAudio } from './event-mode/audio.directive';\n\n// Status-, zone-, and pitch-mode directives (Phase 2)\nexport { CngxAudioStatus } from './status-mode/audio-status.directive';\nexport { CngxAudioZone, type CngxAudioZoneBinding } from './zone-mode/audio-zone.directive';\nexport { CngxAudioPitch } from './pitch-mode/audio-pitch.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["DOM_EVENT_SET"],"mappings":";;;;;;AA+BA;;;;;AAKG;AACI,MAAM,mBAAmB,GAAoB;AAClD,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,oBAAoB,EAAE,IAAI;AAC1B,IAAA,UAAU,EAAE,GAAG;AACf,IAAA,OAAO,EAAE,EAAE;;AAGb;;;;;;;;;AASG;MACU,iBAAiB,GAAG,IAAI,cAAc,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