@editframe/elements 0.16.8-beta.0 → 0.17.6-beta.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.
Files changed (101) hide show
  1. package/README.md +30 -0
  2. package/dist/DecoderResetFrequency.test.d.ts +1 -0
  3. package/dist/DecoderResetRecovery.test.d.ts +1 -0
  4. package/dist/DelayedLoadingState.d.ts +48 -0
  5. package/dist/DelayedLoadingState.integration.test.d.ts +1 -0
  6. package/dist/DelayedLoadingState.js +113 -0
  7. package/dist/DelayedLoadingState.test.d.ts +1 -0
  8. package/dist/EF_FRAMEGEN.d.ts +10 -1
  9. package/dist/EF_FRAMEGEN.js +199 -179
  10. package/dist/EF_INTERACTIVE.js +2 -6
  11. package/dist/EF_RENDERING.js +1 -3
  12. package/dist/JitTranscodingClient.browsertest.d.ts +1 -0
  13. package/dist/JitTranscodingClient.d.ts +167 -0
  14. package/dist/JitTranscodingClient.js +373 -0
  15. package/dist/JitTranscodingClient.test.d.ts +1 -0
  16. package/dist/LoadingDebounce.test.d.ts +1 -0
  17. package/dist/LoadingIndicator.browsertest.d.ts +0 -0
  18. package/dist/ManualScrubTest.test.d.ts +1 -0
  19. package/dist/ScrubResolvedFlashing.test.d.ts +1 -0
  20. package/dist/ScrubTrackIntegration.test.d.ts +1 -0
  21. package/dist/ScrubTrackManager.d.ts +96 -0
  22. package/dist/ScrubTrackManager.js +216 -0
  23. package/dist/ScrubTrackManager.test.d.ts +1 -0
  24. package/dist/SegmentSwitchLoading.test.d.ts +1 -0
  25. package/dist/VideoSeekFlashing.browsertest.d.ts +0 -0
  26. package/dist/VideoStuckDiagnostic.test.d.ts +1 -0
  27. package/dist/elements/CrossUpdateController.js +13 -15
  28. package/dist/elements/EFAudio.browsertest.d.ts +0 -0
  29. package/dist/elements/EFAudio.d.ts +1 -1
  30. package/dist/elements/EFAudio.js +30 -43
  31. package/dist/elements/EFCaptions.js +337 -373
  32. package/dist/elements/EFImage.js +64 -90
  33. package/dist/elements/EFMedia.d.ts +98 -33
  34. package/dist/elements/EFMedia.js +1169 -678
  35. package/dist/elements/EFSourceMixin.js +31 -48
  36. package/dist/elements/EFTemporal.d.ts +1 -0
  37. package/dist/elements/EFTemporal.js +266 -360
  38. package/dist/elements/EFTimegroup.d.ts +3 -1
  39. package/dist/elements/EFTimegroup.js +262 -323
  40. package/dist/elements/EFVideo.browsertest.d.ts +0 -0
  41. package/dist/elements/EFVideo.d.ts +90 -2
  42. package/dist/elements/EFVideo.js +408 -111
  43. package/dist/elements/EFWaveform.js +375 -411
  44. package/dist/elements/FetchMixin.js +14 -24
  45. package/dist/elements/MediaController.d.ts +30 -0
  46. package/dist/elements/TargetController.js +130 -156
  47. package/dist/elements/TimegroupController.js +17 -19
  48. package/dist/elements/durationConverter.js +15 -4
  49. package/dist/elements/parseTimeToMs.js +4 -10
  50. package/dist/elements/printTaskStatus.d.ts +2 -0
  51. package/dist/elements/printTaskStatus.js +11 -0
  52. package/dist/elements/updateAnimations.js +39 -59
  53. package/dist/getRenderInfo.js +58 -67
  54. package/dist/gui/ContextMixin.js +203 -288
  55. package/dist/gui/EFConfiguration.js +27 -43
  56. package/dist/gui/EFFilmstrip.js +440 -620
  57. package/dist/gui/EFFitScale.js +112 -135
  58. package/dist/gui/EFFocusOverlay.js +45 -61
  59. package/dist/gui/EFPreview.js +30 -49
  60. package/dist/gui/EFScrubber.js +78 -99
  61. package/dist/gui/EFTimeDisplay.js +49 -70
  62. package/dist/gui/EFToggleLoop.js +17 -34
  63. package/dist/gui/EFTogglePlay.js +37 -58
  64. package/dist/gui/EFWorkbench.js +66 -88
  65. package/dist/gui/TWMixin.js +2 -48
  66. package/dist/gui/TWMixin2.js +31 -0
  67. package/dist/gui/efContext.js +2 -6
  68. package/dist/gui/fetchContext.js +1 -3
  69. package/dist/gui/focusContext.js +1 -3
  70. package/dist/gui/focusedElementContext.js +2 -6
  71. package/dist/gui/playingContext.js +1 -4
  72. package/dist/index.js +5 -30
  73. package/dist/msToTimeCode.js +11 -13
  74. package/dist/style.css +2 -1
  75. package/package.json +3 -3
  76. package/src/elements/EFAudio.browsertest.ts +569 -0
  77. package/src/elements/EFAudio.ts +4 -6
  78. package/src/elements/EFCaptions.browsertest.ts +0 -1
  79. package/src/elements/EFImage.browsertest.ts +0 -1
  80. package/src/elements/EFMedia.browsertest.ts +147 -115
  81. package/src/elements/EFMedia.ts +1339 -307
  82. package/src/elements/EFTemporal.browsertest.ts +0 -1
  83. package/src/elements/EFTemporal.ts +11 -0
  84. package/src/elements/EFTimegroup.ts +73 -10
  85. package/src/elements/EFVideo.browsertest.ts +680 -0
  86. package/src/elements/EFVideo.ts +729 -50
  87. package/src/elements/EFWaveform.ts +4 -4
  88. package/src/elements/MediaController.ts +108 -0
  89. package/src/elements/__screenshots__/EFMedia.browsertest.ts/EFMedia-JIT-audio-playback-audioBufferTask-should-work-in-JIT-mode-without-URL-errors-1.png +0 -0
  90. package/src/elements/printTaskStatus.ts +16 -0
  91. package/src/elements/updateAnimations.ts +6 -0
  92. package/src/gui/TWMixin.ts +10 -3
  93. package/test/EFVideo.frame-tasks.browsertest.ts +524 -0
  94. package/test/EFVideo.framegen.browsertest.ts +118 -0
  95. package/test/createJitTestClips.ts +293 -0
  96. package/test/useAssetMSW.ts +49 -0
  97. package/test/useMSW.ts +31 -0
  98. package/types.json +1 -1
  99. package/dist/gui/TWMixin.css.js +0 -4
  100. /package/dist/elements/{TargetController.test.d.ts → TargetController.browsertest.d.ts} +0 -0
  101. /package/src/elements/{TargetController.test.ts → TargetController.browsertest.ts} +0 -0
@@ -1,378 +1,284 @@
1
- import { createContext, consume } from "@lit/context";
2
- import { property, state } from "lit/decorators.js";
3
- import { Task } from "@lit/task";
4
1
  import { EF_INTERACTIVE } from "../EF_INTERACTIVE.js";
5
2
  import { durationConverter } from "./durationConverter.js";
6
- var __defProp = Object.defineProperty;
7
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
- var __decorateClass = (decorators, target, key, kind) => {
9
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
10
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
- if (decorator = decorators[i])
12
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13
- if (kind && result) __defProp(target, key, result);
14
- return result;
15
- };
16
- const timegroupContext = createContext(
17
- Symbol("timeGroupContext")
18
- );
3
+ import { consume, createContext } from "@lit/context";
4
+ import { Task } from "@lit/task";
5
+ import { property, state } from "lit/decorators.js";
6
+ import _decorate from "@oxc-project/runtime/helpers/decorate";
7
+ const timegroupContext = createContext(Symbol("timeGroupContext"));
19
8
  const isEFTemporal = (obj) => obj[EF_TEMPORAL];
20
9
  const EF_TEMPORAL = Symbol("EF_TEMPORAL");
21
10
  const deepGetElementsWithFrameTasks = (element, elements = []) => {
22
- for (const child of element.children) {
23
- if ("frameTask" in child && child.frameTask instanceof Task) {
24
- elements.push(child);
25
- }
26
- deepGetElementsWithFrameTasks(child, elements);
27
- }
28
- return elements;
11
+ for (const child of element.children) {
12
+ if ("frameTask" in child && child.frameTask instanceof Task) elements.push(child);
13
+ deepGetElementsWithFrameTasks(child, elements);
14
+ }
15
+ return elements;
29
16
  };
30
17
  let temporalCache;
31
18
  const resetTemporalCache = () => {
32
- temporalCache = /* @__PURE__ */ new Map();
33
- if (typeof requestAnimationFrame !== "undefined") {
34
- requestAnimationFrame(resetTemporalCache);
35
- }
19
+ temporalCache = /* @__PURE__ */ new Map();
20
+ if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(resetTemporalCache);
36
21
  };
37
22
  resetTemporalCache();
38
23
  const shallowGetTemporalElements = (element, temporals = []) => {
39
- const cachedResult = temporalCache.get(element);
40
- if (cachedResult) {
41
- return cachedResult;
42
- }
43
- for (const child of element.children) {
44
- if (isEFTemporal(child)) {
45
- temporals.push(child);
46
- } else {
47
- shallowGetTemporalElements(child, temporals);
48
- }
49
- }
50
- temporalCache.set(element, temporals);
51
- return temporals;
24
+ const cachedResult = temporalCache.get(element);
25
+ if (cachedResult) return cachedResult;
26
+ for (const child of element.children) if (isEFTemporal(child)) temporals.push(child);
27
+ else shallowGetTemporalElements(child, temporals);
28
+ temporalCache.set(element, temporals);
29
+ return temporals;
30
+ };
31
+ var OwnCurrentTimeController = class {
32
+ constructor(host, temporal) {
33
+ this.host = host;
34
+ this.temporal = temporal;
35
+ host.addController(this);
36
+ }
37
+ hostUpdated() {
38
+ this.temporal.requestUpdate("ownCurrentTimeMs");
39
+ }
40
+ remove() {
41
+ this.host.removeController(this);
42
+ }
52
43
  };
53
- class OwnCurrentTimeController {
54
- constructor(host, temporal) {
55
- this.host = host;
56
- this.temporal = temporal;
57
- host.addController(this);
58
- }
59
- hostUpdated() {
60
- this.temporal.requestUpdate("ownCurrentTimeMs");
61
- }
62
- remove() {
63
- this.host.removeController(this);
64
- }
65
- }
66
44
  let startTimeMsCache = /* @__PURE__ */ new WeakMap();
67
45
  const resetStartTimeMsCache = () => {
68
- startTimeMsCache = /* @__PURE__ */ new WeakMap();
69
- if (typeof requestAnimationFrame !== "undefined") {
70
- requestAnimationFrame(resetStartTimeMsCache);
71
- }
46
+ startTimeMsCache = /* @__PURE__ */ new WeakMap();
47
+ if (typeof requestAnimationFrame !== "undefined") requestAnimationFrame(resetStartTimeMsCache);
72
48
  };
73
49
  resetStartTimeMsCache();
74
- const EFTemporal = (superClass) => {
75
- class TemporalMixinClass extends superClass {
76
- constructor() {
77
- super(...arguments);
78
- this._offsetMs = 0;
79
- this._trimStartMs = void 0;
80
- this._trimEndMs = void 0;
81
- this._sourceInMs = void 0;
82
- this._sourceOutMs = void 0;
83
- this._startOffsetMs = 0;
84
- this.rootTimegroup = this.getRootTimegroup();
85
- this.frameTask = new Task(this, {
86
- autoRun: EF_INTERACTIVE,
87
- args: () => [this.ownCurrentTimeMs],
88
- task: async ([], { signal: _signal }) => {
89
- let fullyUpdated = await this.updateComplete;
90
- while (!fullyUpdated) {
91
- fullyUpdated = await this.updateComplete;
92
- }
93
- }
94
- });
95
- }
96
- #parentTimegroup;
97
- set parentTimegroup(value) {
98
- this.#parentTimegroup = value;
99
- this.ownCurrentTimeController?.remove();
100
- this.rootTimegroup = this.getRootTimegroup();
101
- if (this.rootTimegroup) {
102
- this.ownCurrentTimeController = new OwnCurrentTimeController(
103
- this.rootTimegroup,
104
- this
105
- );
106
- }
107
- }
108
- disconnectedCallback() {
109
- super.disconnectedCallback();
110
- this.ownCurrentTimeController?.remove();
111
- }
112
- get parentTimegroup() {
113
- return this.#parentTimegroup;
114
- }
115
- set duration(value) {
116
- if (value !== void 0) {
117
- this.setAttribute("duration", value);
118
- } else {
119
- this.removeAttribute("duration");
120
- }
121
- }
122
- get trimStartMs() {
123
- if (this._trimStartMs === void 0) {
124
- return void 0;
125
- }
126
- return Math.min(
127
- Math.max(this._trimStartMs, 0),
128
- this.intrinsicDurationMs ?? 0
129
- );
130
- }
131
- set trimStartMs(value) {
132
- this._trimStartMs = value;
133
- }
134
- get trimEndMs() {
135
- if (this._trimEndMs === void 0) {
136
- return void 0;
137
- }
138
- return Math.min(this._trimEndMs, this.intrinsicDurationMs ?? 0);
139
- }
140
- set trimEndMs(value) {
141
- this._trimEndMs = value;
142
- }
143
- get sourceInMs() {
144
- if (this._sourceInMs === void 0) {
145
- return void 0;
146
- }
147
- return Math.max(this._sourceInMs, 0);
148
- }
149
- set sourceInMs(value) {
150
- this._sourceInMs = value;
151
- }
152
- get sourceOutMs() {
153
- if (this._sourceOutMs === void 0) {
154
- return void 0;
155
- }
156
- if (this.intrinsicDurationMs && this._sourceOutMs > this.intrinsicDurationMs) {
157
- return this.intrinsicDurationMs;
158
- }
159
- return Math.max(this._sourceOutMs, 0);
160
- }
161
- set sourceOutMs(value) {
162
- this._sourceOutMs = value;
163
- }
164
- get startOffsetMs() {
165
- return this._startOffsetMs;
166
- }
167
- getRootTimegroup() {
168
- let parent = this.tagName === "EF-TIMEGROUP" ? this : this.parentTimegroup;
169
- while (parent?.parentTimegroup) {
170
- parent = parent.parentTimegroup;
171
- }
172
- return parent;
173
- }
174
- get hasExplicitDuration() {
175
- return this._durationMs !== void 0;
176
- }
177
- get explicitDurationMs() {
178
- if (this.hasExplicitDuration) {
179
- return this._durationMs;
180
- }
181
- return void 0;
182
- }
183
- get hasOwnDuration() {
184
- return false;
185
- }
186
- get intrinsicDurationMs() {
187
- return void 0;
188
- }
189
- get durationMs() {
190
- if (this.intrinsicDurationMs === void 0) {
191
- return this._durationMs || this.parentTimegroup?.durationMs || 0;
192
- }
193
- if (this.trimStartMs || this.trimEndMs) {
194
- const trimmedDurationMs = this.intrinsicDurationMs - (this.trimStartMs ?? 0) - (this.trimEndMs ?? 0);
195
- if (trimmedDurationMs < 0) {
196
- return 0;
197
- }
198
- return trimmedDurationMs;
199
- }
200
- if (this.sourceInMs || this.sourceOutMs) {
201
- const sourceInMs = this.sourceInMs ?? 0;
202
- const sourceOutMs = this.sourceOutMs ?? this.intrinsicDurationMs;
203
- if (sourceInMs >= sourceOutMs) {
204
- return 0;
205
- }
206
- return sourceOutMs - sourceInMs;
207
- }
208
- return this.intrinsicDurationMs;
209
- }
210
- get sourceStartMs() {
211
- return this.trimStartMs ?? this.sourceInMs ?? 0;
212
- }
213
- get offsetMs() {
214
- return this._offsetMs || 0;
215
- }
216
- get parentTemporal() {
217
- let parent = this.parentElement;
218
- while (parent && !isEFTemporal(parent)) {
219
- parent = parent.parentElement;
220
- }
221
- return parent;
222
- }
223
- /**
224
- * The start time of the element within its parent timegroup.
225
- */
226
- get startTimeWithinParentMs() {
227
- if (!this.parentTemporal) {
228
- return 0;
229
- }
230
- return this.startTimeMs - this.parentTemporal.startTimeMs;
231
- }
232
- get startTimeMs() {
233
- const cachedStartTime = startTimeMsCache.get(this);
234
- if (cachedStartTime !== void 0) {
235
- return cachedStartTime;
236
- }
237
- const parentTimegroup = this.parentTimegroup;
238
- if (!parentTimegroup) {
239
- startTimeMsCache.set(this, 0);
240
- return 0;
241
- }
242
- switch (parentTimegroup.mode) {
243
- case "sequence": {
244
- const siblingTemorals = shallowGetTemporalElements(parentTimegroup);
245
- const ownIndex = siblingTemorals?.indexOf(
246
- this
247
- );
248
- if (ownIndex === 0) {
249
- startTimeMsCache.set(this, parentTimegroup.startTimeMs);
250
- return parentTimegroup.startTimeMs;
251
- }
252
- const previous = siblingTemorals?.[(ownIndex ?? 0) - 1];
253
- if (!previous) {
254
- throw new Error("Previous temporal element not found");
255
- }
256
- startTimeMsCache.set(
257
- this,
258
- previous.startTimeMs + previous.durationMs - parentTimegroup.overlapMs
259
- );
260
- return previous.startTimeMs + previous.durationMs - parentTimegroup.overlapMs;
261
- }
262
- case "fit":
263
- case "contain":
264
- case "fixed":
265
- startTimeMsCache.set(
266
- this,
267
- parentTimegroup.startTimeMs + this.offsetMs
268
- );
269
- return parentTimegroup.startTimeMs + this.offsetMs;
270
- default:
271
- throw new Error(`Invalid time mode: ${parentTimegroup.mode}`);
272
- }
273
- }
274
- get endTimeMs() {
275
- return this.startTimeMs + this.durationMs;
276
- }
277
- /**
278
- * The current time of the element within itself.
279
- * Compare with `currentTimeMs` to see the current time with respect to the root timegroup
280
- */
281
- get ownCurrentTimeMs() {
282
- if (this.rootTimegroup) {
283
- return Math.min(
284
- Math.max(0, this.rootTimegroup.currentTimeMs - this.startTimeMs),
285
- this.durationMs
286
- );
287
- }
288
- return 0;
289
- }
290
- /**
291
- * Used to calculate the internal currentTimeMs of the element. This is useful
292
- * for mapping to internal media time codes for audio/video elements.
293
- */
294
- get currentSourceTimeMs() {
295
- const leadingTrimMs = this.sourceInMs || this.trimStartMs || 0;
296
- return this.ownCurrentTimeMs + leadingTrimMs;
297
- }
298
- updated(changedProperties) {
299
- super.updated(changedProperties);
300
- if (changedProperties.has("currentTime") || changedProperties.has("ownCurrentTimeMs")) {
301
- const timelineTimeMs = (this.rootTimegroup ?? this).ownCurrentTimeMs;
302
- if (this.startTimeMs > timelineTimeMs || this.endTimeMs < timelineTimeMs) {
303
- this.style.display = "none";
304
- return;
305
- }
306
- this.style.display = "";
307
- }
308
- }
309
- }
310
- __decorateClass([
311
- consume({ context: timegroupContext, subscribe: true }),
312
- property({ attribute: false })
313
- ], TemporalMixinClass.prototype, "parentTimegroup", 1);
314
- __decorateClass([
315
- property({
316
- type: String,
317
- attribute: "offset",
318
- converter: durationConverter
319
- })
320
- ], TemporalMixinClass.prototype, "_offsetMs", 2);
321
- __decorateClass([
322
- property({
323
- type: Number,
324
- attribute: "duration",
325
- converter: durationConverter
326
- })
327
- ], TemporalMixinClass.prototype, "_durationMs", 2);
328
- __decorateClass([
329
- property({
330
- type: Number,
331
- attribute: "trimstart",
332
- converter: durationConverter
333
- })
334
- ], TemporalMixinClass.prototype, "_trimStartMs", 2);
335
- __decorateClass([
336
- property({
337
- type: Number,
338
- attribute: "trimend",
339
- converter: durationConverter
340
- })
341
- ], TemporalMixinClass.prototype, "_trimEndMs", 2);
342
- __decorateClass([
343
- property({
344
- type: Number,
345
- attribute: "sourcein",
346
- converter: durationConverter
347
- })
348
- ], TemporalMixinClass.prototype, "_sourceInMs", 2);
349
- __decorateClass([
350
- property({
351
- type: Number,
352
- attribute: "sourceout",
353
- converter: durationConverter
354
- })
355
- ], TemporalMixinClass.prototype, "_sourceOutMs", 2);
356
- __decorateClass([
357
- property({
358
- type: Number,
359
- attribute: "startoffset",
360
- converter: durationConverter
361
- })
362
- ], TemporalMixinClass.prototype, "_startOffsetMs", 2);
363
- __decorateClass([
364
- state()
365
- ], TemporalMixinClass.prototype, "rootTimegroup", 2);
366
- Object.defineProperty(TemporalMixinClass.prototype, EF_TEMPORAL, {
367
- value: true
368
- });
369
- return TemporalMixinClass;
50
+ const flushStartTimeMsCache = () => {
51
+ startTimeMsCache = /* @__PURE__ */ new WeakMap();
370
52
  };
371
- export {
372
- EFTemporal,
373
- OwnCurrentTimeController,
374
- deepGetElementsWithFrameTasks,
375
- isEFTemporal,
376
- shallowGetTemporalElements,
377
- timegroupContext
53
+ const EFTemporal = (superClass) => {
54
+ class TemporalMixinClass extends superClass {
55
+ constructor(..._args) {
56
+ super(..._args);
57
+ this._offsetMs = 0;
58
+ this._trimStartMs = void 0;
59
+ this._trimEndMs = void 0;
60
+ this._sourceInMs = void 0;
61
+ this._sourceOutMs = void 0;
62
+ this._startOffsetMs = 0;
63
+ this.rootTimegroup = this.getRootTimegroup();
64
+ this.frameTask = new Task(this, {
65
+ autoRun: EF_INTERACTIVE,
66
+ args: () => [this.ownCurrentTimeMs],
67
+ task: async ([], { signal: _signal }) => {
68
+ let fullyUpdated = await this.updateComplete;
69
+ while (!fullyUpdated) fullyUpdated = await this.updateComplete;
70
+ }
71
+ });
72
+ }
73
+ #parentTimegroup;
74
+ set parentTimegroup(value) {
75
+ this.#parentTimegroup = value;
76
+ this.ownCurrentTimeController?.remove();
77
+ this.rootTimegroup = this.getRootTimegroup();
78
+ if (this.rootTimegroup) this.ownCurrentTimeController = new OwnCurrentTimeController(this.rootTimegroup, this);
79
+ }
80
+ disconnectedCallback() {
81
+ super.disconnectedCallback();
82
+ this.ownCurrentTimeController?.remove();
83
+ }
84
+ get parentTimegroup() {
85
+ return this.#parentTimegroup;
86
+ }
87
+ set duration(value) {
88
+ if (value !== void 0) this.setAttribute("duration", value);
89
+ else this.removeAttribute("duration");
90
+ }
91
+ get trimStartMs() {
92
+ if (this._trimStartMs === void 0) return void 0;
93
+ return Math.min(Math.max(this._trimStartMs, 0), this.intrinsicDurationMs ?? 0);
94
+ }
95
+ set trimStartMs(value) {
96
+ this._trimStartMs = value;
97
+ }
98
+ get trimEndMs() {
99
+ if (this._trimEndMs === void 0) return void 0;
100
+ return Math.min(this._trimEndMs, this.intrinsicDurationMs ?? 0);
101
+ }
102
+ set trimEndMs(value) {
103
+ this._trimEndMs = value;
104
+ }
105
+ get sourceInMs() {
106
+ if (this._sourceInMs === void 0) return void 0;
107
+ return Math.max(this._sourceInMs, 0);
108
+ }
109
+ set sourceInMs(value) {
110
+ this._sourceInMs = value;
111
+ }
112
+ get sourceOutMs() {
113
+ if (this._sourceOutMs === void 0) return void 0;
114
+ if (this.intrinsicDurationMs && this._sourceOutMs > this.intrinsicDurationMs) return this.intrinsicDurationMs;
115
+ return Math.max(this._sourceOutMs, 0);
116
+ }
117
+ set sourceOutMs(value) {
118
+ this._sourceOutMs = value;
119
+ }
120
+ get startOffsetMs() {
121
+ return this._startOffsetMs;
122
+ }
123
+ getRootTimegroup() {
124
+ let parent = this.tagName === "EF-TIMEGROUP" ? this : this.parentTimegroup;
125
+ while (parent?.parentTimegroup) parent = parent.parentTimegroup;
126
+ return parent;
127
+ }
128
+ get hasExplicitDuration() {
129
+ return this._durationMs !== void 0;
130
+ }
131
+ get explicitDurationMs() {
132
+ if (this.hasExplicitDuration) return this._durationMs;
133
+ return void 0;
134
+ }
135
+ get hasOwnDuration() {
136
+ return false;
137
+ }
138
+ get intrinsicDurationMs() {
139
+ return void 0;
140
+ }
141
+ get durationMs() {
142
+ if (this.intrinsicDurationMs === void 0) return this._durationMs || this.parentTimegroup?.durationMs || 0;
143
+ if (this.trimStartMs || this.trimEndMs) {
144
+ const trimmedDurationMs = this.intrinsicDurationMs - (this.trimStartMs ?? 0) - (this.trimEndMs ?? 0);
145
+ if (trimmedDurationMs < 0) return 0;
146
+ return trimmedDurationMs;
147
+ }
148
+ if (this.sourceInMs || this.sourceOutMs) {
149
+ const sourceInMs = this.sourceInMs ?? 0;
150
+ const sourceOutMs = this.sourceOutMs ?? this.intrinsicDurationMs;
151
+ if (sourceInMs >= sourceOutMs) return 0;
152
+ return sourceOutMs - sourceInMs;
153
+ }
154
+ return this.intrinsicDurationMs;
155
+ }
156
+ get sourceStartMs() {
157
+ return this.trimStartMs ?? this.sourceInMs ?? 0;
158
+ }
159
+ get offsetMs() {
160
+ return this._offsetMs || 0;
161
+ }
162
+ get parentTemporal() {
163
+ let parent = this.parentElement;
164
+ while (parent && !isEFTemporal(parent)) parent = parent.parentElement;
165
+ return parent;
166
+ }
167
+ /**
168
+ * The start time of the element within its parent timegroup.
169
+ */
170
+ get startTimeWithinParentMs() {
171
+ if (!this.parentTemporal) return 0;
172
+ return this.startTimeMs - this.parentTemporal.startTimeMs;
173
+ }
174
+ get startTimeMs() {
175
+ const cachedStartTime = startTimeMsCache.get(this);
176
+ if (cachedStartTime !== void 0) return cachedStartTime;
177
+ const parentTimegroup = this.parentTimegroup;
178
+ if (!parentTimegroup) {
179
+ startTimeMsCache.set(this, 0);
180
+ return 0;
181
+ }
182
+ switch (parentTimegroup.mode) {
183
+ case "sequence": {
184
+ const siblingTemorals = shallowGetTemporalElements(parentTimegroup);
185
+ const ownIndex = siblingTemorals?.indexOf(this);
186
+ if (ownIndex === -1) return 0;
187
+ if (ownIndex === 0) {
188
+ startTimeMsCache.set(this, parentTimegroup.startTimeMs);
189
+ return parentTimegroup.startTimeMs;
190
+ }
191
+ const previous = siblingTemorals?.[(ownIndex ?? 0) - 1];
192
+ if (!previous) {
193
+ console.log("Previous temporal element not found", {
194
+ ownIndex,
195
+ siblingTemorals
196
+ });
197
+ throw new Error("Previous temporal element not found");
198
+ }
199
+ startTimeMsCache.set(this, previous.startTimeMs + previous.durationMs - parentTimegroup.overlapMs);
200
+ return previous.startTimeMs + previous.durationMs - parentTimegroup.overlapMs;
201
+ }
202
+ case "fit":
203
+ case "contain":
204
+ case "fixed":
205
+ startTimeMsCache.set(this, parentTimegroup.startTimeMs + this.offsetMs);
206
+ return parentTimegroup.startTimeMs + this.offsetMs;
207
+ default: throw new Error(`Invalid time mode: ${parentTimegroup.mode}`);
208
+ }
209
+ }
210
+ get endTimeMs() {
211
+ return this.startTimeMs + this.durationMs;
212
+ }
213
+ /**
214
+ * The current time of the element within itself.
215
+ * Compare with `currentTimeMs` to see the current time with respect to the root timegroup
216
+ */
217
+ get ownCurrentTimeMs() {
218
+ if (this.rootTimegroup) return Math.min(Math.max(0, this.rootTimegroup.currentTimeMs - this.startTimeMs), this.durationMs);
219
+ return 0;
220
+ }
221
+ /**
222
+ * Used to calculate the internal currentTimeMs of the element. This is useful
223
+ * for mapping to internal media time codes for audio/video elements.
224
+ */
225
+ get currentSourceTimeMs() {
226
+ const leadingTrimMs = this.sourceInMs || this.trimStartMs || 0;
227
+ return this.ownCurrentTimeMs + leadingTrimMs;
228
+ }
229
+ updated(changedProperties) {
230
+ super.updated(changedProperties);
231
+ if (changedProperties.has("currentTime") || changedProperties.has("ownCurrentTimeMs")) {
232
+ const timelineTimeMs = (this.rootTimegroup ?? this).ownCurrentTimeMs;
233
+ if (this.startTimeMs > timelineTimeMs || this.endTimeMs < timelineTimeMs) {
234
+ this.style.display = "none";
235
+ return;
236
+ }
237
+ this.style.display = "";
238
+ }
239
+ }
240
+ }
241
+ _decorate([consume({
242
+ context: timegroupContext,
243
+ subscribe: true
244
+ }), property({ attribute: false })], TemporalMixinClass.prototype, "parentTimegroup", null);
245
+ _decorate([property({
246
+ type: String,
247
+ attribute: "offset",
248
+ converter: durationConverter
249
+ })], TemporalMixinClass.prototype, "_offsetMs", void 0);
250
+ _decorate([property({
251
+ type: Number,
252
+ attribute: "duration",
253
+ converter: durationConverter
254
+ })], TemporalMixinClass.prototype, "_durationMs", void 0);
255
+ _decorate([property({
256
+ type: Number,
257
+ attribute: "trimstart",
258
+ converter: durationConverter
259
+ })], TemporalMixinClass.prototype, "_trimStartMs", void 0);
260
+ _decorate([property({
261
+ type: Number,
262
+ attribute: "trimend",
263
+ converter: durationConverter
264
+ })], TemporalMixinClass.prototype, "_trimEndMs", void 0);
265
+ _decorate([property({
266
+ type: Number,
267
+ attribute: "sourcein",
268
+ converter: durationConverter
269
+ })], TemporalMixinClass.prototype, "_sourceInMs", void 0);
270
+ _decorate([property({
271
+ type: Number,
272
+ attribute: "sourceout",
273
+ converter: durationConverter
274
+ })], TemporalMixinClass.prototype, "_sourceOutMs", void 0);
275
+ _decorate([property({
276
+ type: Number,
277
+ attribute: "startoffset",
278
+ converter: durationConverter
279
+ })], TemporalMixinClass.prototype, "_startOffsetMs", void 0);
280
+ _decorate([state()], TemporalMixinClass.prototype, "rootTimegroup", void 0);
281
+ Object.defineProperty(TemporalMixinClass.prototype, EF_TEMPORAL, { value: true });
282
+ return TemporalMixinClass;
378
283
  };
284
+ export { EFTemporal, deepGetElementsWithFrameTasks, flushStartTimeMsCache, isEFTemporal, shallowGetTemporalElements, timegroupContext };
@@ -21,13 +21,15 @@ export declare class EFTimegroup extends EFTimegroup_base {
21
21
  get intrinsicDurationMs(): number | undefined;
22
22
  get hasOwnDuration(): boolean;
23
23
  get durationMs(): number;
24
+ getPendingFrameTasks(): Promise<Task<readonly unknown[], unknown>[]>;
25
+ waitForFrameTasks(): Promise<void>;
24
26
  /**
25
27
  * Wait for all media elements to load their initial segments.
26
28
  * Ideally we would only need the extracted index json data, but
27
29
  * that caused issues with constructing audio data. We had negative durations
28
30
  * in calculations and it was not clear why.
29
31
  */
30
- waitForMediaDurations(): Promise<(Record<number, import('../../../assets/src/index.ts').TrackFragmentIndex> | undefined)[]>;
32
+ waitForMediaDurations(): Promise<void>;
31
33
  get childTemporals(): import('./EFTemporal.js').TemporalMixinInterface[];
32
34
  protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
33
35
  private updateAnimations;