@opendaw/lib-fusion 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import './types';
2
2
  export * from "./live-stream/LiveStreamReceiver";
3
3
  export * from "./live-stream/LiveStreamBroadcaster";
4
4
  export * from "./peaks/Peaks";
5
- export * from "./peaks/PeakWorker";
6
- export * from "./peaks/PeakProtocol";
5
+ export * from "./peaks/SamplePeakWorker";
6
+ export * from "./peaks/SamplePeakProtocol";
7
7
  export * from "./peaks/PeaksPainter";
8
8
  export * from "./opfs/OpfsWorker";
9
9
  export * from "./opfs/OpfsProtocol";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,SAAS,CAAA;AAEhB,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,SAAS,CAAA;AAEhB,cAAc,kCAAkC,CAAA;AAChD,cAAc,qCAAqC,CAAA;AACnD,cAAc,eAAe,CAAA;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA"}
package/dist/index.js CHANGED
@@ -10,8 +10,8 @@ import './types';
10
10
  export * from "./live-stream/LiveStreamReceiver";
11
11
  export * from "./live-stream/LiveStreamBroadcaster";
12
12
  export * from "./peaks/Peaks";
13
- export * from "./peaks/PeakWorker";
14
- export * from "./peaks/PeakProtocol";
13
+ export * from "./peaks/SamplePeakWorker";
14
+ export * from "./peaks/SamplePeakProtocol";
15
15
  export * from "./peaks/PeaksPainter";
16
16
  export * from "./opfs/OpfsWorker";
17
17
  export * from "./opfs/OpfsProtocol";
@@ -7,8 +7,8 @@ export declare namespace OpfsWorker {
7
7
  read(path: string): Promise<Uint8Array>;
8
8
  delete(path: string): Promise<void>;
9
9
  list(path: string): Promise<ReadonlyArray<Entry>>;
10
- "__#49@#resolveFile"(path: string, options?: FileSystemGetDirectoryOptions): Promise<FileSystemSyncAccessHandle>;
11
- "__#49@#resolveFolder"(segments: ReadonlyArray<string>, options?: FileSystemGetDirectoryOptions): Promise<FileSystemDirectoryHandle>;
10
+ #resolveFile(path: string, options?: FileSystemGetDirectoryOptions): Promise<FileSystemSyncAccessHandle>;
11
+ #resolveFolder(segments: ReadonlyArray<string>, options?: FileSystemGetDirectoryOptions): Promise<FileSystemDirectoryHandle>;
12
12
  }>;
13
13
  }
14
14
  //# sourceMappingURL=OpfsWorker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpfsWorker.d.ts","sourceRoot":"","sources":["../../src/opfs/OpfsWorker.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAW,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAC,KAAK,EAAe,MAAM,gBAAgB,CAAA;AAClD,OAAO,UAAU,CAAA;AAEjB,yBAAiB,UAAU,CAAC;IAKjB,MAAM,IAAI,GAAI,WAAW,SAAS;oBAEf,MAAM,QAAQ,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;mBAWzC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;qBAY1B,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;mBAMxB,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;mCAW9B,MAAM,YAAY,6BAA6B,GAAG,OAAO,CAAC,0BAA0B,CAAC;yCAO/E,aAAa,CAAC,MAAM,CAAC,YACrB,6BAA6B,GAAG,OAAO,CAAC,yBAAyB,CAAC;MAKnG,CAAA;CAMT"}
1
+ {"version":3,"file":"OpfsWorker.d.ts","sourceRoot":"","sources":["../../src/opfs/OpfsWorker.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAW,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAC,KAAK,EAAe,MAAM,gBAAgB,CAAA;AAClD,OAAO,UAAU,CAAA;AAEjB,yBAAiB,UAAU,CAAC;IAKjB,MAAM,IAAI,GAAI,WAAW,SAAS;oBAEf,MAAM,QAAQ,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;mBAWzC,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;qBAY1B,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;mBAMxB,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;2BAW9B,MAAM,YAAY,6BAA6B,GAAG,OAAO,CAAC,0BAA0B,CAAC;iCAO/E,aAAa,CAAC,MAAM,CAAC,YACrB,6BAA6B,GAAG,OAAO,CAAC,yBAAyB,CAAC;MAKnG,CAAA;CAMT"}
@@ -14,7 +14,7 @@ export var OpfsWorker;
14
14
  return writeLimiter.add(() => this.#resolveFile(path, { create: true })
15
15
  .then(handle => {
16
16
  handle.truncate(data.length);
17
- handle.write(data, { at: 0 });
17
+ handle.write(data.buffer, { at: 0 });
18
18
  handle.flush();
19
19
  handle.close();
20
20
  }));
@@ -1,26 +1,32 @@
1
- import { ByteArrayInput, float, int } from "@opendaw/lib-std";
2
- export declare class Peaks {
1
+ import { ByteArrayInput, float, int, Nullable } from "@opendaw/lib-std";
2
+ export interface Peaks {
3
3
  readonly stages: ReadonlyArray<Peaks.Stage>;
4
4
  readonly data: ReadonlyArray<Int32Array>;
5
5
  readonly numFrames: int;
6
6
  readonly numChannels: int;
7
- static from(input: ByteArrayInput): Peaks;
8
- static readonly None: Peaks;
9
- constructor(stages: ReadonlyArray<Peaks.Stage>, data: ReadonlyArray<Int32Array>, numFrames: int, numChannels: int);
10
- nearest(unitsPerPixel: number): Peaks.Stage | null;
11
- toArrayBuffer(): ArrayBufferLike;
12
- toString(): string;
7
+ nearest(unitsPerPixel: number): Nullable<Peaks.Stage>;
13
8
  }
14
9
  export declare namespace Peaks {
15
- const findBestFit: (numFrames: int, width?: int) => Uint8Array;
16
10
  class Stage {
17
- readonly mask: int;
18
11
  readonly shift: int;
19
12
  readonly numPeaks: int;
20
13
  readonly dataOffset: int;
21
- constructor(mask: int, shift: int, numPeaks: int, dataOffset: int);
14
+ constructor(shift: int, numPeaks: int, dataOffset: int);
22
15
  unitsEachPeak(): int;
23
16
  }
24
17
  const unpack: (bits: int, index: 0 | 1) => float;
25
18
  }
19
+ export declare class SamplePeaks implements Peaks {
20
+ readonly stages: ReadonlyArray<Peaks.Stage>;
21
+ readonly data: ReadonlyArray<Int32Array>;
22
+ readonly numFrames: int;
23
+ readonly numChannels: int;
24
+ static from(input: ByteArrayInput): Peaks;
25
+ static readonly None: SamplePeaks;
26
+ static readonly findBestFit: (numFrames: int, width?: int) => Uint8Array;
27
+ constructor(stages: ReadonlyArray<Peaks.Stage>, data: ReadonlyArray<Int32Array>, numFrames: int, numChannels: int);
28
+ nearest(unitsPerPixel: number): Nullable<Peaks.Stage>;
29
+ toArrayBuffer(): ArrayBufferLike;
30
+ toString(): string;
31
+ }
26
32
  //# sourceMappingURL=Peaks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Peaks.d.ts","sourceRoot":"","sources":["../../src/peaks/Peaks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAmB,KAAK,EAAW,GAAG,EAAY,MAAM,kBAAkB,CAAA;AAEhH,qBAAa,KAAK;IA0BF,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC;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AC;IAYrD,aAAa,IAAI,eAAe;IAsBhC,QAAQ,IAAI,MAAM;CACrB"}
@@ -1,5 +1,30 @@
1
1
  import { Arrays, assert, ByteArrayOutput, Float16, Unhandled } from "@opendaw/lib-std";
2
- export class Peaks {
2
+ export var Peaks;
3
+ (function (Peaks) {
4
+ class Stage {
5
+ shift;
6
+ numPeaks;
7
+ dataOffset;
8
+ constructor(shift, numPeaks, dataOffset) {
9
+ this.shift = shift;
10
+ this.numPeaks = numPeaks;
11
+ this.dataOffset = dataOffset;
12
+ }
13
+ unitsEachPeak() { return 1 << this.shift; }
14
+ }
15
+ Peaks.Stage = Stage;
16
+ Peaks.unpack = (bits, index) => {
17
+ switch (index) {
18
+ case 0:
19
+ return Float16.intBitsToFloat(bits);
20
+ case 1:
21
+ return Float16.intBitsToFloat(bits >> 16);
22
+ default:
23
+ return Unhandled(index);
24
+ }
25
+ };
26
+ })(Peaks || (Peaks = {}));
27
+ export class SamplePeaks {
3
28
  stages;
4
29
  data;
5
30
  numFrames;
@@ -12,8 +37,8 @@ export class Peaks {
12
37
  const dataOffset = input.readInt();
13
38
  const numPeaks = input.readInt();
14
39
  const shift = input.readInt();
15
- const mask = input.readInt();
16
- stages[i] = new Peaks.Stage(mask, shift, numPeaks, dataOffset);
40
+ input.readInt(); // TODO deprecate (was mask)
41
+ stages[i] = new Peaks.Stage(shift, numPeaks, dataOffset);
17
42
  }
18
43
  const numData = input.readInt();
19
44
  const data = [];
@@ -24,9 +49,19 @@ export class Peaks {
24
49
  }
25
50
  const numFrames = input.readInt();
26
51
  const numChannels = input.readInt();
27
- return new Peaks(stages, data, numFrames, numChannels);
52
+ return new SamplePeaks(stages, data, numFrames, numChannels);
28
53
  }
29
- static None = new Peaks([], [], 0, 0);
54
+ static None = new SamplePeaks([], [], 0, 0);
55
+ static findBestFit = (numFrames, width = 1200) => {
56
+ const ratio = numFrames / width;
57
+ if (ratio <= 1.0) {
58
+ return new Uint8Array(0);
59
+ }
60
+ const ShiftPadding = 3;
61
+ const maxShift = Math.floor(Math.log(ratio) / Math.LN2);
62
+ const numStages = Math.max(1, Math.floor(maxShift / ShiftPadding));
63
+ return new Uint8Array(Arrays.create(index => ShiftPadding * (index + 1), numStages));
64
+ };
30
65
  constructor(stages, data, numFrames, numChannels) {
31
66
  this.stages = stages;
32
67
  this.data = data;
@@ -51,11 +86,11 @@ export class Peaks {
51
86
  output.writeString("PEAKS");
52
87
  output.writeInt(this.stages.length);
53
88
  for (let i = 0; i < this.stages.length; i++) {
54
- const { dataOffset, numPeaks, shift, mask } = this.stages[i];
89
+ const { dataOffset, numPeaks, shift } = this.stages[i];
55
90
  output.writeInt(dataOffset);
56
91
  output.writeInt(numPeaks);
57
92
  output.writeInt(shift);
58
- output.writeInt(mask);
93
+ output.writeInt((1 << shift) - 1); // TODO deprecate (was mask)
59
94
  }
60
95
  output.writeInt(this.data.length);
61
96
  for (let i = 0; i < this.data.length; i++) {
@@ -67,41 +102,5 @@ export class Peaks {
67
102
  output.writeInt(this.numChannels);
68
103
  return output.toArrayBuffer();
69
104
  }
70
- toString() { return `{Peaks num-stages: ${this.stages.length}}`; }
105
+ toString() { return `{SamplePeaks num-stages: ${this.stages.length}}`; }
71
106
  }
72
- (function (Peaks) {
73
- Peaks.findBestFit = (numFrames, width = 1200) => {
74
- const ratio = numFrames / width;
75
- if (ratio <= 1.0) {
76
- return new Uint8Array(0);
77
- }
78
- const ShiftPadding = 3;
79
- const maxShift = Math.floor(Math.log(ratio) / Math.LN2);
80
- const numStages = Math.max(1, Math.floor(maxShift / ShiftPadding));
81
- return new Uint8Array(Arrays.create(index => ShiftPadding * (index + 1), numStages));
82
- };
83
- class Stage {
84
- mask;
85
- shift;
86
- numPeaks;
87
- dataOffset;
88
- constructor(mask, shift, numPeaks, dataOffset) {
89
- this.mask = mask;
90
- this.shift = shift;
91
- this.numPeaks = numPeaks;
92
- this.dataOffset = dataOffset;
93
- }
94
- unitsEachPeak() { return 1 << this.shift; }
95
- }
96
- Peaks.Stage = Stage;
97
- Peaks.unpack = (bits, index) => {
98
- switch (index) {
99
- case 0:
100
- return Float16.intBitsToFloat(bits);
101
- case 1:
102
- return Float16.intBitsToFloat(bits >> 16);
103
- default:
104
- return Unhandled(index);
105
- }
106
- };
107
- })(Peaks || (Peaks = {}));
@@ -1,5 +1,5 @@
1
1
  import { FloatArray, int, Procedure } from "@opendaw/lib-std";
2
- export interface PeakProtocol {
2
+ export interface SamplePeakProtocol {
3
3
  generateAsync(progress: Procedure<number>, shifts: Uint8Array, frames: ReadonlyArray<FloatArray>, numFrames: int, numChannels: int): Promise<ArrayBufferLike>;
4
4
  }
5
- //# sourceMappingURL=PeakProtocol.d.ts.map
5
+ //# sourceMappingURL=SamplePeakProtocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SamplePeakProtocol.d.ts","sourceRoot":"","sources":["../../src/peaks/SamplePeakProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAE3D,MAAM,WAAW,kBAAkB;IAC/B,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,EAC3B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EACjC,SAAS,EAAE,GAAG,EACd,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5D"}
@@ -1,8 +1,9 @@
1
- import { FloatArray, int, Procedure } from "@opendaw/lib-std";
1
+ import { float, FloatArray, int, Procedure } from "@opendaw/lib-std";
2
2
  import { Communicator, Messenger } from "@opendaw/lib-runtime";
3
- export declare namespace PeakWorker {
3
+ export declare namespace SamplePeakWorker {
4
4
  const install: (messenger: Messenger) => Communicator.Executor<{
5
5
  generateAsync(progress: Procedure<number>, shifts: Uint8Array, frames: FloatArray[], numFrames: int, numChannels: int): Promise<ArrayBufferLike>;
6
6
  }>;
7
+ const pack: (f0: float, f1: float) => int;
7
8
  }
8
- //# sourceMappingURL=PeakWorker.d.ts.map
9
+ //# sourceMappingURL=SamplePeakWorker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SamplePeakWorker.d.ts","sourceRoot":"","sources":["../../src/peaks/SamplePeakWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAW,UAAU,EAAE,GAAG,EAAS,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAC1F,OAAO,EAAC,YAAY,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAA;AAIvE,yBAAiB,gBAAgB,CAAC;IACvB,MAAM,OAAO,GAAI,WAAW,SAAS;gCAEN,SAAS,CAAC,MAAM,CAAC,UACnB,UAAU,UACV,UAAU,EAAE,aACT,GAAG,eACD,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC;MAGjE,CAAA;IAwEC,MAAM,IAAI,GAAI,IAAI,KAAK,EAAE,IAAI,KAAK,KAAG,GAI3C,CAAA;CACJ"}
@@ -1,9 +1,9 @@
1
1
  import { Arrays, Float16, panic } from "@opendaw/lib-std";
2
2
  import { Communicator, stopwatch } from "@opendaw/lib-runtime";
3
- import { Peaks } from "./Peaks";
4
- export var PeakWorker;
5
- (function (PeakWorker) {
6
- PeakWorker.install = (messenger) => Communicator.executor(messenger.channel("peaks"), new class {
3
+ import { Peaks, SamplePeaks } from "./Peaks";
4
+ export var SamplePeakWorker;
5
+ (function (SamplePeakWorker) {
6
+ SamplePeakWorker.install = (messenger) => Communicator.executor(messenger.channel("peaks"), new class {
7
7
  async generateAsync(progress, shifts, frames, numFrames, numChannels) {
8
8
  return generatePeaks(progress, shifts, frames, numFrames, numChannels).toArrayBuffer();
9
9
  }
@@ -21,7 +21,7 @@ export var PeakWorker;
21
21
  const numShifts = shifts.length;
22
22
  const [stages, dataOffset] = initStages(shifts, numFrames);
23
23
  const data = Arrays.create(() => new Int32Array(dataOffset), numChannels);
24
- const minMask = stages[0].mask;
24
+ const minMask = (1 << stages[0].shift) - 1;
25
25
  const total = numChannels * numFrames;
26
26
  let count = 0;
27
27
  for (let channel = 0; channel < numChannels; ++channel) {
@@ -41,8 +41,8 @@ export var PeakWorker;
41
41
  const state = states[j];
42
42
  state.min = Math.min(state.min, min);
43
43
  state.max = Math.max(state.max, max);
44
- if ((stage.mask & position) === 0) {
45
- channelData[stage.dataOffset + state.index++] = pack(state.min, state.max);
44
+ if ((((1 << stage.shift) - 1) & position) === 0) {
45
+ channelData[stage.dataOffset + state.index++] = SamplePeakWorker.pack(state.min, state.max);
46
46
  state.min = Number.POSITIVE_INFINITY;
47
47
  state.max = Number.NEGATIVE_INFINITY;
48
48
  }
@@ -56,23 +56,23 @@ export var PeakWorker;
56
56
  }
57
57
  }
58
58
  progress(1.0);
59
- time.lab(`Peak-Gen '${self.constructor.name}'`);
60
- return new Peaks(stages, data, numFrames, numChannels);
59
+ time.lab(`SamplePeaks '${self.constructor.name}'`);
60
+ return new SamplePeaks(stages, data, numFrames, numChannels);
61
61
  };
62
62
  const initStages = (shifts, numFrames) => {
63
63
  let dataOffset = 0;
64
64
  const stages = Arrays.create((index) => {
65
65
  const shift = shifts[index];
66
66
  const numPeaks = Math.ceil(numFrames / (1 << shift));
67
- const stage = new Peaks.Stage((1 << shift) - 1, shift, numPeaks, dataOffset);
67
+ const stage = new Peaks.Stage(shift, numPeaks, dataOffset);
68
68
  dataOffset += numPeaks;
69
69
  return stage;
70
70
  }, shifts.length);
71
71
  return [stages, dataOffset];
72
72
  };
73
- const pack = (f0, f1) => {
73
+ SamplePeakWorker.pack = (f0, f1) => {
74
74
  const bits0 = Float16.floatToIntBits(f0);
75
75
  const bits1 = Float16.floatToIntBits(f1);
76
76
  return bits0 | (bits1 << 16);
77
77
  };
78
- })(PeakWorker || (PeakWorker = {}));
78
+ })(SamplePeakWorker || (SamplePeakWorker = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendaw/lib-fusion",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "LGPL-3.0-or-later",
@@ -22,13 +22,13 @@
22
22
  "test": "echo \"No tests to run\""
23
23
  },
24
24
  "dependencies": {
25
- "@opendaw/lib-box": "^0.0.19",
26
- "@opendaw/lib-runtime": "^0.0.19",
27
- "@opendaw/lib-std": "^0.0.19"
25
+ "@opendaw/lib-box": "^0.0.20",
26
+ "@opendaw/lib-runtime": "^0.0.20",
27
+ "@opendaw/lib-std": "^0.0.20"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@opendaw/eslint-config": "^0.0.18",
31
31
  "@opendaw/typescript-config": "^0.0.19"
32
32
  },
33
- "gitHead": "8d9e873aad633820cd26f76dc447674728401495"
33
+ "gitHead": "de891be4fc9e418776b3a6c433748e287abab912"
34
34
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"PeakProtocol.d.ts","sourceRoot":"","sources":["../../src/peaks/PeakProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAE3D,MAAM,WAAW,YAAY;IACzB,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,EAC3B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EACjC,SAAS,EAAE,GAAG,EACd,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PeakWorker.d.ts","sourceRoot":"","sources":["../../src/peaks/PeakWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,UAAU,EAAE,GAAG,EAAS,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAC1F,OAAO,EAAC,YAAY,EAAE,SAAS,EAAY,MAAM,sBAAsB,CAAA;AAIvE,yBAAiB,UAAU,CAAC;IACjB,MAAM,OAAO,GAAI,WAAW,SAAS;gCAEN,SAAS,CAAC,MAAM,CAAC,UACnB,UAAU,UACV,UAAU,EAAE,aACT,GAAG,eACD,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC;MAGjE,CAAA;CA6ET"}