@toneflix/studio 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/history.js DELETED
@@ -1,75 +0,0 @@
1
- import { Emitter } from './emitter.js';
2
- /**
3
- * The editor's single undo history. The timeline pushes its edits here, and the
4
- * host app can push its own steps (mixer, effects, tempo) into the same list.
5
- */
6
- export class History extends Emitter {
7
- done = [];
8
- undone = [];
9
- busy = false;
10
- limit;
11
- constructor(limit = 200) {
12
- super();
13
- this.limit = limit;
14
- }
15
- /** Record a step that has already been applied. */
16
- push(entry) {
17
- if (this.busy)
18
- return;
19
- this.done.push(entry);
20
- if (this.done.length > this.limit)
21
- this.done.shift();
22
- this.undone = [];
23
- this.changed();
24
- }
25
- undo() {
26
- const entry = this.done.pop();
27
- if (!entry)
28
- return false;
29
- this.run(() => entry.undo());
30
- this.undone.push(entry);
31
- this.changed();
32
- return true;
33
- }
34
- redo() {
35
- const entry = this.undone.pop();
36
- if (!entry)
37
- return false;
38
- this.run(() => entry.redo());
39
- this.done.push(entry);
40
- this.changed();
41
- return true;
42
- }
43
- clear() {
44
- this.done = [];
45
- this.undone = [];
46
- this.changed();
47
- }
48
- get info() {
49
- return {
50
- canUndo: this.done.length > 0,
51
- canRedo: this.undone.length > 0,
52
- undoLabel: this.done.at(-1)?.label,
53
- redoLabel: this.undone.at(-1)?.label,
54
- };
55
- }
56
- get canUndo() {
57
- return this.done.length > 0;
58
- }
59
- get canRedo() {
60
- return this.undone.length > 0;
61
- }
62
- /** Steps that undo and redo run don't record new entries. */
63
- run(fn) {
64
- this.busy = true;
65
- try {
66
- fn();
67
- }
68
- finally {
69
- this.busy = false;
70
- }
71
- }
72
- changed() {
73
- this.emit('change', this.info);
74
- }
75
- }
package/dist/model.d.ts DELETED
@@ -1,43 +0,0 @@
1
- import { Emitter } from './emitter.ts';
2
- import { History } from './history.ts';
3
- import type { Peaks } from './peaks.ts';
4
- import type { Source, TimelineState } from './types.ts';
5
- export interface ModelEvents extends Record<string, unknown> {
6
- /** The tracks or clips changed. `final` is false while a drag is still going. */
7
- change: {
8
- state: TimelineState;
9
- label: string;
10
- final: boolean;
11
- };
12
- /** A source's length or peaks arrived */
13
- source: {
14
- id: string;
15
- };
16
- }
17
- /**
18
- * The timeline's tracks and clips, with every finished edit recorded in the
19
- * shared undo history. State objects are never changed in place.
20
- */
21
- export declare class TimelineModel extends Emitter<ModelEvents> {
22
- private current;
23
- private draftFrom;
24
- readonly sources: Map<string, Source>;
25
- readonly peaks: Map<string, Peaks>;
26
- readonly history: History;
27
- constructor(state?: TimelineState, history?: History);
28
- get state(): TimelineState;
29
- /** Apply an edit as one undo step. */
30
- apply(label: string, edit: (state: TimelineState) => TimelineState): void;
31
- /** Show an edit in progress, like a drag, without an undo step yet. */
32
- draft(label: string, edit: (state: TimelineState) => TimelineState): void;
33
- /** Finish a draft as one undo step, or drop it when nothing changed. */
34
- commit(label: string): void;
35
- /** Throw a draft away. */
36
- cancel(): void;
37
- get drafting(): boolean;
38
- /** Replace everything without an undo step, as when a project loads. */
39
- load(state: TimelineState): void;
40
- setSource(source: Source, peaks?: Peaks): void;
41
- private set;
42
- private record;
43
- }
package/dist/model.js DELETED
@@ -1,80 +0,0 @@
1
- import { Emitter } from './emitter.js';
2
- import { History } from './history.js';
3
- /**
4
- * The timeline's tracks and clips, with every finished edit recorded in the
5
- * shared undo history. State objects are never changed in place.
6
- */
7
- export class TimelineModel extends Emitter {
8
- current;
9
- draftFrom = null;
10
- sources = new Map();
11
- peaks = new Map();
12
- history;
13
- constructor(state = { tracks: [], clips: [] }, history = new History()) {
14
- super();
15
- this.current = state;
16
- this.history = history;
17
- }
18
- get state() {
19
- return this.current;
20
- }
21
- /** Apply an edit as one undo step. */
22
- apply(label, edit) {
23
- const before = this.draftFrom ?? this.current;
24
- const after = edit(this.current);
25
- this.draftFrom = null;
26
- if (after === before)
27
- return;
28
- this.set(after, label, true);
29
- this.record(label, before, after);
30
- }
31
- /** Show an edit in progress, like a drag, without an undo step yet. */
32
- draft(label, edit) {
33
- this.draftFrom ??= this.current;
34
- this.set(edit(this.draftFrom), label, false);
35
- }
36
- /** Finish a draft as one undo step, or drop it when nothing changed. */
37
- commit(label) {
38
- const before = this.draftFrom;
39
- if (!before)
40
- return;
41
- this.draftFrom = null;
42
- if (before === this.current)
43
- return;
44
- this.set(this.current, label, true);
45
- this.record(label, before, this.current);
46
- }
47
- /** Throw a draft away. */
48
- cancel() {
49
- if (!this.draftFrom)
50
- return;
51
- const before = this.draftFrom;
52
- this.draftFrom = null;
53
- this.set(before, 'Cancel', true);
54
- }
55
- get drafting() {
56
- return this.draftFrom !== null;
57
- }
58
- /** Replace everything without an undo step, as when a project loads. */
59
- load(state) {
60
- this.draftFrom = null;
61
- this.set(state, 'Load', true);
62
- }
63
- setSource(source, peaks) {
64
- this.sources.set(source.id, { ...this.sources.get(source.id), ...source });
65
- if (peaks)
66
- this.peaks.set(source.id, peaks);
67
- this.emit('source', { id: source.id });
68
- }
69
- set(state, label, final) {
70
- this.current = state;
71
- this.emit('change', { state, label, final });
72
- }
73
- record(label, before, after) {
74
- this.history.push({
75
- label,
76
- undo: () => this.set(before, `Undo ${label}`, true),
77
- redo: () => this.set(after, `Redo ${label}`, true),
78
- });
79
- }
80
- }
package/dist/overlap.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { type Clip } from './types.ts';
2
- export interface AudibleRange {
3
- clip: Clip;
4
- /** Timeline start of the part that is heard */
5
- start: number;
6
- end: number;
7
- }
8
- /**
9
- * Stacking order of a track's clips, bottom first. The clip that starts later
10
- * sits on top; clips that start together keep their order in the list.
11
- */
12
- export declare const stackOrder: (clips: readonly Clip[]) => Clip[];
13
- /**
14
- * The parts of each clip on one track that are heard: a clip is covered
15
- * wherever a clip above it in the stack plays.
16
- */
17
- export declare const audibleRanges: (clips: readonly Clip[]) => AudibleRange[];
package/dist/overlap.js DELETED
@@ -1,37 +0,0 @@
1
- import { clipEnd } from './types.js';
2
- /**
3
- * Stacking order of a track's clips, bottom first. The clip that starts later
4
- * sits on top; clips that start together keep their order in the list.
5
- */
6
- export const stackOrder = (clips) => clips
7
- .map((clip, index) => ({ clip, index }))
8
- .sort((a, b) => a.clip.start - b.clip.start || a.index - b.index)
9
- .map(({ clip }) => clip);
10
- /**
11
- * The parts of each clip on one track that are heard: a clip is covered
12
- * wherever a clip above it in the stack plays.
13
- */
14
- export const audibleRanges = (clips) => {
15
- const stack = stackOrder(clips);
16
- const covered = [];
17
- const ranges = [];
18
- for (let i = stack.length - 1; i >= 0; i--) {
19
- const clip = stack[i];
20
- let parts = [[clip.start, clipEnd(clip)]];
21
- for (const [from, to] of covered) {
22
- parts = parts.flatMap(([a, b]) => {
23
- if (to <= a || from >= b)
24
- return [[a, b]];
25
- const left = from > a ? [[a, from]] : [];
26
- const right = to < b ? [[to, b]] : [];
27
- return [...left, ...right];
28
- });
29
- }
30
- for (const [start, end] of parts) {
31
- if (end - start > 1e-6)
32
- ranges.push({ clip, start, end });
33
- }
34
- covered.push([clip.start, clipEnd(clip)]);
35
- }
36
- return ranges.sort((a, b) => a.start - b.start);
37
- };
@@ -1,23 +0,0 @@
1
- import { type Peaks } from './peaks.ts';
2
- /** Where peaks are kept between visits. Keys should change when the audio changes. */
3
- export interface PeaksStore {
4
- get(key: string): Promise<Peaks | null>;
5
- put(key: string, peaks: Peaks): Promise<void>;
6
- clear(): Promise<void>;
7
- }
8
- /**
9
- * Peaks kept in memory and in Cache Storage on the device. Without Cache
10
- * Storage (private windows, tests) it keeps them in memory only.
11
- */
12
- export declare class PeaksCache implements PeaksStore {
13
- private memory;
14
- readonly name: string;
15
- readonly maxInMemory: number;
16
- constructor(name?: string, maxInMemory?: number);
17
- get(key: string): Promise<Peaks | null>;
18
- put(key: string, peaks: Peaks): Promise<void>;
19
- clear(): Promise<void>;
20
- private remember;
21
- private open;
22
- private url;
23
- }
@@ -1,51 +0,0 @@
1
- import { decodePeaks, encodePeaks } from './peaks.js';
2
- /**
3
- * Peaks kept in memory and in Cache Storage on the device. Without Cache
4
- * Storage (private windows, tests) it keeps them in memory only.
5
- */
6
- export class PeaksCache {
7
- memory = new Map();
8
- name;
9
- maxInMemory;
10
- constructor(name = 'toneflix-studio-peaks', maxInMemory = 64) {
11
- this.name = name;
12
- this.maxInMemory = maxInMemory;
13
- }
14
- async get(key) {
15
- const kept = this.memory.get(key);
16
- if (kept) {
17
- this.remember(key, kept);
18
- return kept;
19
- }
20
- const cache = await this.open();
21
- const response = await cache?.match(this.url(key)).catch(() => undefined);
22
- const peaks = response ? decodePeaks(await response.arrayBuffer()) : null;
23
- if (peaks)
24
- this.remember(key, peaks);
25
- return peaks;
26
- }
27
- async put(key, peaks) {
28
- this.remember(key, peaks);
29
- const cache = await this.open();
30
- await cache?.put(this.url(key), new Response(encodePeaks(peaks))).catch(() => undefined);
31
- }
32
- async clear() {
33
- this.memory.clear();
34
- if (typeof caches !== 'undefined')
35
- await caches.delete(this.name).catch(() => false);
36
- }
37
- remember(key, peaks) {
38
- this.memory.delete(key);
39
- this.memory.set(key, peaks);
40
- while (this.memory.size > this.maxInMemory)
41
- this.memory.delete(this.memory.keys().next().value);
42
- }
43
- async open() {
44
- if (typeof caches === 'undefined')
45
- return null;
46
- return caches.open(this.name).catch(() => null);
47
- }
48
- url(key) {
49
- return `https://peaks.studio.local/${encodeURIComponent(key)}`;
50
- }
51
- }
@@ -1,22 +0,0 @@
1
- import { type Peaks } from './peaks.ts';
2
- interface AudioLike {
3
- sampleRate: number;
4
- numberOfChannels: number;
5
- getChannelData(channel: number): Float32Array;
6
- }
7
- /**
8
- * Works out waveform peaks off the main thread. The worker is built from
9
- * `computePeakData`'s own source, so no bundler setup is needed.
10
- */
11
- export declare class PeaksWorker {
12
- private worker?;
13
- private jobs;
14
- private next;
15
- readonly samplesPerPeak: number;
16
- constructor(samplesPerPeak?: number);
17
- /** Peaks of decoded audio. The channel data is copied, so the buffer stays usable. */
18
- compute(audio: AudioLike): Promise<Peaks>;
19
- terminate(): void;
20
- private start;
21
- }
22
- export {};
@@ -1,68 +0,0 @@
1
- import { computePeakData, makePeaks, peaksOf } from './peaks.js';
2
- /**
3
- * Works out waveform peaks off the main thread. The worker is built from
4
- * `computePeakData`'s own source, so no bundler setup is needed.
5
- */
6
- export class PeaksWorker {
7
- worker;
8
- jobs = new Map();
9
- next = 0;
10
- samplesPerPeak;
11
- constructor(samplesPerPeak = 64) {
12
- this.samplesPerPeak = samplesPerPeak;
13
- }
14
- /** Peaks of decoded audio. The channel data is copied, so the buffer stays usable. */
15
- async compute(audio) {
16
- const channels = Array.from({ length: audio.numberOfChannels }, (_, c) => audio.getChannelData(c).slice());
17
- const length = channels.reduce((n, channel) => Math.max(n, channel.length), 0);
18
- const worker = this.start();
19
- if (!worker)
20
- return peaksOf(channels, audio.sampleRate, this.samplesPerPeak);
21
- const id = this.next++;
22
- const data = await new Promise((resolve, reject) => {
23
- this.jobs.set(id, { resolve, reject });
24
- worker.postMessage({ id, channels, samplesPerPeak: this.samplesPerPeak }, channels.map((channel) => channel.buffer));
25
- });
26
- return makePeaks(data, this.samplesPerPeak, audio.sampleRate, length);
27
- }
28
- terminate() {
29
- this.worker?.terminate();
30
- this.worker = undefined;
31
- for (const job of this.jobs.values())
32
- job.reject(new Error('Peaks worker stopped'));
33
- this.jobs.clear();
34
- }
35
- start() {
36
- if (this.worker)
37
- return this.worker;
38
- if (typeof Worker === 'undefined' || typeof Blob === 'undefined' || typeof URL.createObjectURL !== 'function')
39
- return null;
40
- const source = `const computePeakData = ${computePeakData.toString()};
41
- self.onmessage = (event) => {
42
- const { id, channels, samplesPerPeak } = event.data;
43
- try {
44
- const data = computePeakData(channels, samplesPerPeak);
45
- self.postMessage({ id, data }, [data.buffer]);
46
- } catch (error) {
47
- self.postMessage({ id, error: String(error) });
48
- }
49
- };`;
50
- try {
51
- const url = URL.createObjectURL(new Blob([source], { type: 'text/javascript' }));
52
- this.worker = new Worker(url);
53
- URL.revokeObjectURL(url);
54
- }
55
- catch {
56
- return null;
57
- }
58
- this.worker.onmessage = (event) => {
59
- const job = this.jobs.get(event.data.id);
60
- this.jobs.delete(event.data.id);
61
- if (event.data.data)
62
- job?.resolve(event.data.data);
63
- else
64
- job?.reject(new Error(event.data.error));
65
- };
66
- return this.worker;
67
- }
68
- }
package/dist/peaks.d.ts DELETED
@@ -1,31 +0,0 @@
1
- /** Min/max pairs of an audio file at one resolution, scaled to 16-bit. */
2
- export interface PeakLevel {
3
- samplesPerPeak: number;
4
- /** min, max, min, max… */
5
- data: Int16Array;
6
- }
7
- /** A waveform overview of audio at several resolutions, finest first. */
8
- export interface Peaks {
9
- sampleRate: number;
10
- /** Audio length in samples */
11
- length: number;
12
- levels: PeakLevel[];
13
- }
14
- /**
15
- * Min/max peaks of the channels mixed down, `samplesPerPeak` samples per pair.
16
- * It uses nothing outside itself, so it can run as the peaks worker's source.
17
- */
18
- export declare function computePeakData(channels: Float32Array[], samplesPerPeak: number): Int16Array;
19
- /** Coarser levels made from the finest one, each four times coarser. */
20
- export declare const buildLevels: (base: PeakLevel, minPeaks?: number) => PeakLevel[];
21
- export declare const makePeaks: (data: Int16Array, samplesPerPeak: number, sampleRate: number, length: number) => Peaks;
22
- /** Peaks worked out on this thread, for tests and places without workers. */
23
- export declare const peaksOf: (channels: Float32Array[], sampleRate: number, samplesPerPeak?: number) => Peaks;
24
- /**
25
- * Min and max (-1 to 1) of the audio between two times in seconds, read from
26
- * the coarsest level that still has detail at that span.
27
- */
28
- export declare const peakAt: (peaks: Peaks, from: number, to: number) => [number, number];
29
- /** Peaks as bytes for a device cache: a small header and the finest level. */
30
- export declare const encodePeaks: (peaks: Peaks) => ArrayBuffer;
31
- export declare const decodePeaks: (buffer: ArrayBuffer) => Peaks | null;
package/dist/peaks.js DELETED
@@ -1,101 +0,0 @@
1
- /**
2
- * Min/max peaks of the channels mixed down, `samplesPerPeak` samples per pair.
3
- * It uses nothing outside itself, so it can run as the peaks worker's source.
4
- */
5
- export function computePeakData(channels, samplesPerPeak) {
6
- const length = channels.reduce((n, channel) => Math.max(n, channel.length), 0);
7
- const count = Math.ceil(length / samplesPerPeak);
8
- const out = new Int16Array(count * 2);
9
- for (let p = 0; p < count; p++) {
10
- const from = p * samplesPerPeak;
11
- const to = Math.min(length, from + samplesPerPeak);
12
- let min = 0;
13
- let max = 0;
14
- for (let c = 0; c < channels.length; c++) {
15
- const channel = channels[c];
16
- const end = Math.min(to, channel.length);
17
- for (let i = from; i < end; i++) {
18
- const v = channel[i];
19
- if (v < min)
20
- min = v;
21
- if (v > max)
22
- max = v;
23
- }
24
- }
25
- out[p * 2] = Math.max(-32768, Math.round(min * 32767));
26
- out[p * 2 + 1] = Math.min(32767, Math.round(max * 32767));
27
- }
28
- return out;
29
- }
30
- /** Coarser levels made from the finest one, each four times coarser. */
31
- export const buildLevels = (base, minPeaks = 512) => {
32
- const levels = [base];
33
- let level = base;
34
- while (level.data.length / 2 > minPeaks * 4) {
35
- const count = Math.ceil(level.data.length / 8);
36
- const data = new Int16Array(count * 2);
37
- for (let p = 0; p < count; p++) {
38
- let min = 0;
39
- let max = 0;
40
- for (let i = p * 4; i < Math.min(p * 4 + 4, level.data.length / 2); i++) {
41
- min = Math.min(min, level.data[i * 2]);
42
- max = Math.max(max, level.data[i * 2 + 1]);
43
- }
44
- data[p * 2] = min;
45
- data[p * 2 + 1] = max;
46
- }
47
- level = { samplesPerPeak: level.samplesPerPeak * 4, data };
48
- levels.push(level);
49
- }
50
- return levels;
51
- };
52
- export const makePeaks = (data, samplesPerPeak, sampleRate, length) => ({
53
- sampleRate,
54
- length,
55
- levels: buildLevels({ samplesPerPeak, data }),
56
- });
57
- /** Peaks worked out on this thread, for tests and places without workers. */
58
- export const peaksOf = (channels, sampleRate, samplesPerPeak = 64) => {
59
- const length = channels.reduce((n, channel) => Math.max(n, channel.length), 0);
60
- return makePeaks(computePeakData(channels, samplesPerPeak), samplesPerPeak, sampleRate, length);
61
- };
62
- /**
63
- * Min and max (-1 to 1) of the audio between two times in seconds, read from
64
- * the coarsest level that still has detail at that span.
65
- */
66
- export const peakAt = (peaks, from, to) => {
67
- const span = (to - from) * peaks.sampleRate;
68
- let level = peaks.levels[0];
69
- for (const candidate of peaks.levels) {
70
- if (candidate.samplesPerPeak * 2 <= span)
71
- level = candidate;
72
- }
73
- const count = level.data.length / 2;
74
- const a = Math.max(0, Math.floor((from * peaks.sampleRate) / level.samplesPerPeak));
75
- const b = Math.min(count, Math.max(a + 1, Math.ceil((to * peaks.sampleRate) / level.samplesPerPeak)));
76
- let min = 0;
77
- let max = 0;
78
- for (let i = a; i < b; i++) {
79
- min = Math.min(min, level.data[i * 2]);
80
- max = Math.max(max, level.data[i * 2 + 1]);
81
- }
82
- return [min / 32768, max / 32767];
83
- };
84
- const MAGIC = 0x50544653; // "STFP"
85
- /** Peaks as bytes for a device cache: a small header and the finest level. */
86
- export const encodePeaks = (peaks) => {
87
- const base = peaks.levels[0];
88
- const buffer = new ArrayBuffer(16 + base.data.byteLength);
89
- const header = new Uint32Array(buffer, 0, 4);
90
- header.set([MAGIC, peaks.sampleRate, peaks.length, base.samplesPerPeak]);
91
- new Int16Array(buffer, 16).set(base.data);
92
- return buffer;
93
- };
94
- export const decodePeaks = (buffer) => {
95
- if (buffer.byteLength < 16)
96
- return null;
97
- const [magic, sampleRate, length, samplesPerPeak] = new Uint32Array(buffer, 0, 4);
98
- if (magic !== MAGIC || !sampleRate || !samplesPerPeak)
99
- return null;
100
- return makePeaks(new Int16Array(buffer.slice(16)), samplesPerPeak, sampleRate, length);
101
- };
package/dist/types.d.ts DELETED
@@ -1,47 +0,0 @@
1
- /** A piece of audio on the timeline, in seconds. */
2
- export interface Clip {
3
- id: string;
4
- /** The track (lane) the clip sits on */
5
- track: string;
6
- /** The audio the clip plays, by source id */
7
- source: string;
8
- /** Where the clip starts on the timeline */
9
- start: number;
10
- /** How far into the source the clip starts */
11
- offset: number;
12
- /** How long the clip plays */
13
- duration: number;
14
- /** Linear gain, 1 is unchanged */
15
- gain: number;
16
- fadeIn: number;
17
- fadeOut: number;
18
- name?: string;
19
- color?: string;
20
- }
21
- /** A lane of clips, like a stem. */
22
- export interface Track {
23
- id: string;
24
- name: string;
25
- color?: string;
26
- /** Anything the host app keeps with the track */
27
- data?: unknown;
28
- }
29
- /** What the timeline knows about a clip's audio. */
30
- export interface Source {
31
- id: string;
32
- /** Length of the audio in seconds; unknown while it loads */
33
- duration?: number;
34
- }
35
- /** Everything that undo and redo restore. */
36
- export interface TimelineState {
37
- tracks: readonly Track[];
38
- clips: readonly Clip[];
39
- }
40
- /** A time range picked on the timeline, with the tracks it covers. */
41
- export interface TimeRange {
42
- start: number;
43
- end: number;
44
- tracks: string[];
45
- }
46
- export type ClipInput = Omit<Clip, 'id' | 'gain' | 'fadeIn' | 'fadeOut'> & Partial<Pick<Clip, 'id' | 'gain' | 'fadeIn' | 'fadeOut'>>;
47
- export declare const clipEnd: (clip: Pick<Clip, 'start' | 'duration'>) => number;
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export const clipEnd = (clip) => clip.start + clip.duration;
@@ -1,26 +0,0 @@
1
- import type { Peaks } from '../peaks.ts';
2
- import type { Clip } from '../types.ts';
3
- /** Width of one waveform canvas in CSS pixels. Long clips use several. */
4
- export declare const TILE = 1024;
5
- /**
6
- * One clip on a lane: its box, trim and fade handles, and waveform canvases
7
- * drawn only for the part that is on screen.
8
- */
9
- export declare class ClipView {
10
- readonly el: HTMLDivElement;
11
- private head;
12
- private wave;
13
- private fadeIn;
14
- private fadeOut;
15
- private tiles;
16
- private drawn;
17
- private colour;
18
- clip: Clip;
19
- constructor(clip: Clip, doc: Document);
20
- /** Place the box and its handles. */
21
- layout(clip: Clip, pxPerSecond: number, z: number, selected: boolean, color: string): void;
22
- /** Draw the waveform canvases that cover `[from, to)` CSS pixels of the clip. */
23
- paint(from: number, to: number, pxPerSecond: number, peaks: Peaks | undefined, pixelRatio: number): void;
24
- /** Redraw everything on the next paint. */
25
- invalidate(): void;
26
- }