@amazon/vinyl-mpd-parser 1.0.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 (138) hide show
  1. package/dist/dashTestAssets/index.js +1559 -0
  2. package/dist/dashTestAssets/index.js.map +7 -0
  3. package/dist/dashTestAssets/types/current/dash_personalizedResponse.d.ts +6 -0
  4. package/dist/dashTestAssets/types/current/dash_personalizedResponse.d.ts.map +1 -0
  5. package/dist/dashTestAssets/types/current/dash_personalizedResponse.js +831 -0
  6. package/dist/dashTestAssets/types/current/dash_segmentBase.d.ts +5 -0
  7. package/dist/dashTestAssets/types/current/dash_segmentBase.d.ts.map +1 -0
  8. package/dist/dashTestAssets/types/current/dash_segmentBase.js +144 -0
  9. package/dist/dashTestAssets/types/current/dash_segmentList.d.ts +6 -0
  10. package/dist/dashTestAssets/types/current/dash_segmentList.d.ts.map +1 -0
  11. package/dist/dashTestAssets/types/current/dash_segmentList.js +107 -0
  12. package/dist/dashTestAssets/types/current/dash_segmentListMediaRange.d.ts +8 -0
  13. package/dist/dashTestAssets/types/current/dash_segmentListMediaRange.d.ts.map +1 -0
  14. package/dist/dashTestAssets/types/current/dash_segmentListMediaRange.js +472 -0
  15. package/dist/dashTestAssets/types/current/dash_segmentTemplate.d.ts +5 -0
  16. package/dist/dashTestAssets/types/current/dash_segmentTemplate.d.ts.map +1 -0
  17. package/dist/dashTestAssets/types/current/dash_segmentTemplate.js +34 -0
  18. package/dist/dashTestAssets/types/current/index.d.ts +7 -0
  19. package/dist/dashTestAssets/types/current/index.d.ts.map +1 -0
  20. package/dist/dashTestAssets/types/current/index.js +6 -0
  21. package/dist/dashTestAssets/types/current/tsconfig.tsbuildinfo +1 -0
  22. package/dist/dashTestAssets/types/ts3.7/dash_personalizedResponse.d.ts +6 -0
  23. package/dist/dashTestAssets/types/ts3.7/dash_segmentBase.d.ts +5 -0
  24. package/dist/dashTestAssets/types/ts3.7/dash_segmentList.d.ts +6 -0
  25. package/dist/dashTestAssets/types/ts3.7/dash_segmentListMediaRange.d.ts +8 -0
  26. package/dist/dashTestAssets/types/ts3.7/dash_segmentTemplate.d.ts +5 -0
  27. package/dist/dashTestAssets/types/ts3.7/index.d.ts +7 -0
  28. package/dist/dashTestAssets/types/ts4.1/dash_personalizedResponse.d.ts +6 -0
  29. package/dist/dashTestAssets/types/ts4.1/dash_segmentBase.d.ts +5 -0
  30. package/dist/dashTestAssets/types/ts4.1/dash_segmentList.d.ts +6 -0
  31. package/dist/dashTestAssets/types/ts4.1/dash_segmentListMediaRange.d.ts +8 -0
  32. package/dist/dashTestAssets/types/ts4.1/dash_segmentTemplate.d.ts +5 -0
  33. package/dist/dashTestAssets/types/ts4.1/index.d.ts +7 -0
  34. package/dist/dashTestAssets/types/ts4.7/dash_personalizedResponse.d.ts +6 -0
  35. package/dist/dashTestAssets/types/ts4.7/dash_segmentBase.d.ts +5 -0
  36. package/dist/dashTestAssets/types/ts4.7/dash_segmentList.d.ts +6 -0
  37. package/dist/dashTestAssets/types/ts4.7/dash_segmentListMediaRange.d.ts +8 -0
  38. package/dist/dashTestAssets/types/ts4.7/dash_segmentTemplate.d.ts +5 -0
  39. package/dist/dashTestAssets/types/ts4.7/index.d.ts +7 -0
  40. package/dist/index.cjs +583 -0
  41. package/dist/index.cjs.map +7 -0
  42. package/dist/index.js +584 -0
  43. package/dist/index.js.map +7 -0
  44. package/dist/test/benchmark.es5.js +566 -0
  45. package/dist/test/benchmark.js +4497 -0
  46. package/dist/test/benchmark.js.map +7 -0
  47. package/dist/types/current/duration/duration.d.ts +34 -0
  48. package/dist/types/current/duration/duration.d.ts.map +1 -0
  49. package/dist/types/current/duration/duration.js +83 -0
  50. package/dist/types/current/error/parsingError.d.ts +2 -0
  51. package/dist/types/current/error/parsingError.d.ts.map +1 -0
  52. package/dist/types/current/error/parsingError.js +8 -0
  53. package/dist/types/current/index.d.ts +16 -0
  54. package/dist/types/current/index.d.ts.map +1 -0
  55. package/dist/types/current/index.js +15 -0
  56. package/dist/types/current/manifest/dashManifestXmlRules.d.ts +65 -0
  57. package/dist/types/current/manifest/dashManifestXmlRules.d.ts.map +1 -0
  58. package/dist/types/current/manifest/dashManifestXmlRules.js +360 -0
  59. package/dist/types/current/manifest/dashParser.d.ts +23 -0
  60. package/dist/types/current/manifest/dashParser.d.ts.map +1 -0
  61. package/dist/types/current/manifest/dashParser.js +28 -0
  62. package/dist/types/current/manifest/ext/drm/ContentProtectionScheme.d.ts +31 -0
  63. package/dist/types/current/manifest/ext/drm/ContentProtectionScheme.d.ts.map +1 -0
  64. package/dist/types/current/manifest/ext/drm/ContentProtectionScheme.js +34 -0
  65. package/dist/types/current/manifest/ext/drm/cencXmlRules.d.ts +8 -0
  66. package/dist/types/current/manifest/ext/drm/cencXmlRules.d.ts.map +1 -0
  67. package/dist/types/current/manifest/ext/drm/cencXmlRules.js +21 -0
  68. package/dist/types/current/manifest/ext/drm/contentProtection.d.ts +32 -0
  69. package/dist/types/current/manifest/ext/drm/contentProtection.d.ts.map +1 -0
  70. package/dist/types/current/manifest/ext/drm/contentProtection.js +32 -0
  71. package/dist/types/current/manifest/ext/drm/playreadyXmlRules.d.ts +4 -0
  72. package/dist/types/current/manifest/ext/drm/playreadyXmlRules.d.ts.map +1 -0
  73. package/dist/types/current/manifest/ext/drm/playreadyXmlRules.js +13 -0
  74. package/dist/types/current/media/byteRange.d.ts +12 -0
  75. package/dist/types/current/media/byteRange.d.ts.map +1 -0
  76. package/dist/types/current/media/byteRange.js +30 -0
  77. package/dist/types/current/media/frameRate.d.ts +14 -0
  78. package/dist/types/current/media/frameRate.d.ts.map +1 -0
  79. package/dist/types/current/media/frameRate.js +25 -0
  80. package/dist/types/current/media/ratio.d.ts +24 -0
  81. package/dist/types/current/media/ratio.d.ts.map +1 -0
  82. package/dist/types/current/media/ratio.js +36 -0
  83. package/dist/types/current/tsconfig.tsbuildinfo +1 -0
  84. package/dist/types/current/xmlns/microsoft/playready.d.ts +12 -0
  85. package/dist/types/current/xmlns/microsoft/playready.d.ts.map +1 -0
  86. package/dist/types/current/xmlns/microsoft/playready.js +11 -0
  87. package/dist/types/current/xmlns/mpeg/cenc/2013.d.ts +19 -0
  88. package/dist/types/current/xmlns/mpeg/cenc/2013.d.ts.map +1 -0
  89. package/dist/types/current/xmlns/mpeg/cenc/2013.js +11 -0
  90. package/dist/types/current/xmlns/mpeg/dash/schema/mpd/2011.d.ts +918 -0
  91. package/dist/types/current/xmlns/mpeg/dash/schema/mpd/2011.d.ts.map +1 -0
  92. package/dist/types/current/xmlns/mpeg/dash/schema/mpd/2011.js +5 -0
  93. package/dist/types/ts3.7/duration/duration.d.ts +34 -0
  94. package/dist/types/ts3.7/error/parsingError.d.ts +2 -0
  95. package/dist/types/ts3.7/index.d.ts +16 -0
  96. package/dist/types/ts3.7/manifest/dashManifestXmlRules.d.ts +65 -0
  97. package/dist/types/ts3.7/manifest/dashParser.d.ts +23 -0
  98. package/dist/types/ts3.7/manifest/ext/drm/ContentProtectionScheme.d.ts +31 -0
  99. package/dist/types/ts3.7/manifest/ext/drm/cencXmlRules.d.ts +8 -0
  100. package/dist/types/ts3.7/manifest/ext/drm/contentProtection.d.ts +32 -0
  101. package/dist/types/ts3.7/manifest/ext/drm/playreadyXmlRules.d.ts +4 -0
  102. package/dist/types/ts3.7/media/byteRange.d.ts +15 -0
  103. package/dist/types/ts3.7/media/frameRate.d.ts +17 -0
  104. package/dist/types/ts3.7/media/ratio.d.ts +27 -0
  105. package/dist/types/ts3.7/xmlns/microsoft/playready.d.ts +12 -0
  106. package/dist/types/ts3.7/xmlns/mpeg/cenc/2013.d.ts +19 -0
  107. package/dist/types/ts3.7/xmlns/mpeg/dash/schema/mpd/2011.d.ts +918 -0
  108. package/dist/types/ts4.1/duration/duration.d.ts +34 -0
  109. package/dist/types/ts4.1/error/parsingError.d.ts +2 -0
  110. package/dist/types/ts4.1/index.d.ts +16 -0
  111. package/dist/types/ts4.1/manifest/dashManifestXmlRules.d.ts +65 -0
  112. package/dist/types/ts4.1/manifest/dashParser.d.ts +23 -0
  113. package/dist/types/ts4.1/manifest/ext/drm/ContentProtectionScheme.d.ts +31 -0
  114. package/dist/types/ts4.1/manifest/ext/drm/cencXmlRules.d.ts +8 -0
  115. package/dist/types/ts4.1/manifest/ext/drm/contentProtection.d.ts +32 -0
  116. package/dist/types/ts4.1/manifest/ext/drm/playreadyXmlRules.d.ts +4 -0
  117. package/dist/types/ts4.1/media/byteRange.d.ts +15 -0
  118. package/dist/types/ts4.1/media/frameRate.d.ts +17 -0
  119. package/dist/types/ts4.1/media/ratio.d.ts +27 -0
  120. package/dist/types/ts4.1/xmlns/microsoft/playready.d.ts +12 -0
  121. package/dist/types/ts4.1/xmlns/mpeg/cenc/2013.d.ts +19 -0
  122. package/dist/types/ts4.1/xmlns/mpeg/dash/schema/mpd/2011.d.ts +918 -0
  123. package/dist/types/ts4.7/duration/duration.d.ts +34 -0
  124. package/dist/types/ts4.7/error/parsingError.d.ts +2 -0
  125. package/dist/types/ts4.7/index.d.ts +16 -0
  126. package/dist/types/ts4.7/manifest/dashManifestXmlRules.d.ts +65 -0
  127. package/dist/types/ts4.7/manifest/dashParser.d.ts +23 -0
  128. package/dist/types/ts4.7/manifest/ext/drm/ContentProtectionScheme.d.ts +31 -0
  129. package/dist/types/ts4.7/manifest/ext/drm/cencXmlRules.d.ts +8 -0
  130. package/dist/types/ts4.7/manifest/ext/drm/contentProtection.d.ts +32 -0
  131. package/dist/types/ts4.7/manifest/ext/drm/playreadyXmlRules.d.ts +4 -0
  132. package/dist/types/ts4.7/media/byteRange.d.ts +15 -0
  133. package/dist/types/ts4.7/media/frameRate.d.ts +17 -0
  134. package/dist/types/ts4.7/media/ratio.d.ts +27 -0
  135. package/dist/types/ts4.7/xmlns/microsoft/playready.d.ts +12 -0
  136. package/dist/types/ts4.7/xmlns/mpeg/cenc/2013.d.ts +19 -0
  137. package/dist/types/ts4.7/xmlns/mpeg/dash/schema/mpd/2011.d.ts +918 -0
  138. package/package.json +101 -0
@@ -0,0 +1,4497 @@
1
+ "use strict";
2
+ (() => {
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+
23
+ // ../vinyl-util/dist/browserTestUtil/index.js
24
+ var __defProp2 = Object.defineProperty;
25
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
26
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
27
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
28
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
29
+ var __spreadValues2 = (a, b) => {
30
+ for (var prop in b || (b = {}))
31
+ if (__hasOwnProp2.call(b, prop))
32
+ __defNormalProp2(a, prop, b[prop]);
33
+ if (__getOwnPropSymbols2)
34
+ for (var prop of __getOwnPropSymbols2(b)) {
35
+ if (__propIsEnum2.call(b, prop))
36
+ __defNormalProp2(a, prop, b[prop]);
37
+ }
38
+ return a;
39
+ };
40
+ var __objRest = (source, exclude) => {
41
+ var target = {};
42
+ for (var prop in source)
43
+ if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
44
+ target[prop] = source[prop];
45
+ if (source != null && __getOwnPropSymbols2)
46
+ for (var prop of __getOwnPropSymbols2(source)) {
47
+ if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
48
+ target[prop] = source[prop];
49
+ }
50
+ return target;
51
+ };
52
+ var __publicField = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
53
+ var createSpy = jasmine.createSpy;
54
+ function createSpy2(key) {
55
+ return createSpy(String(key));
56
+ }
57
+ var MockAbortSignal = class {
58
+ constructor() {
59
+ __publicField(this, "aborted", false);
60
+ __publicField(this, "onabort", null);
61
+ __publicField(this, "reason");
62
+ __publicField(this, "throwIfAborted", createSpy2("throwIfAborted"));
63
+ __publicField(this, "addEventListener", createSpy2("addEventListener"));
64
+ __publicField(this, "removeEventListener", createSpy2(
65
+ "removeEventListener"
66
+ ));
67
+ __publicField(this, "dispatchEvent", createSpy2("dispatchEvent"));
68
+ }
69
+ };
70
+ var MockMediaSource = class {
71
+ constructor() {
72
+ __publicField(this, "activeSourceBuffers");
73
+ __publicField(this, "duration", 0);
74
+ __publicField(this, "onsourceclose", null);
75
+ __publicField(this, "onsourceended", null);
76
+ __publicField(this, "onsourceopen", null);
77
+ __publicField(this, "readyState", "closed");
78
+ __publicField(this, "sourceBuffers");
79
+ __publicField(this, "addSourceBuffer", createSpy2("addSourceBuffer"));
80
+ __publicField(this, "clearLiveSeekableRange", createSpy2(
81
+ "clearLiveSeekableRange"
82
+ ));
83
+ __publicField(this, "endOfStream", createSpy2("endOfStream"));
84
+ __publicField(this, "removeSourceBuffer", createSpy2("removeSourceBuffer"));
85
+ __publicField(this, "setLiveSeekableRange", createSpy2(
86
+ "setLiveSeekableRange"
87
+ ));
88
+ __publicField(this, "addEventListener", createSpy2("addEventListener"));
89
+ __publicField(this, "removeEventListener", createSpy2(
90
+ "removeEventListener"
91
+ ));
92
+ __publicField(this, "dispatchEvent", createSpy2("dispatchEvent"));
93
+ }
94
+ };
95
+ var MockMediaSourceGlobal = class extends MockMediaSource {
96
+ };
97
+ __publicField(MockMediaSourceGlobal, "canConstructInDedicatedWorker", false);
98
+ __publicField(MockMediaSourceGlobal, "isTypeSupported", createSpy2(
99
+ "isTypeSupported"
100
+ ));
101
+ var MockAbortSignalGlobal = class extends MockAbortSignal {
102
+ };
103
+ __publicField(MockAbortSignalGlobal, "abort", createSpy2("abort"));
104
+ __publicField(MockAbortSignalGlobal, "any", createSpy2("any"));
105
+ __publicField(MockAbortSignalGlobal, "timeout", createSpy2("timeout"));
106
+ function expectNothing() {
107
+ expect(true).toBeTruthy();
108
+ }
109
+ var nextTestTimeoutOverridden = false;
110
+ function setTestTimeout(timeout) {
111
+ let originalTimeout = null;
112
+ beforeEach(() => {
113
+ originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
114
+ if (!nextTestTimeoutOverridden)
115
+ jasmine.DEFAULT_TIMEOUT_INTERVAL = timeout * 1e3;
116
+ });
117
+ afterEach(() => {
118
+ if (originalTimeout) jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
119
+ if (nextTestTimeoutOverridden) nextTestTimeoutOverridden = false;
120
+ });
121
+ }
122
+ var now;
123
+ if (typeof window !== "undefined" && typeof window.performance !== "undefined" && typeof window.performance.now !== "undefined") {
124
+ now = () => window.performance.now();
125
+ } else if (typeof self !== "undefined" && typeof self.performance !== "undefined" && typeof self.performance.now !== "undefined") {
126
+ now = () => self.performance.now();
127
+ } else {
128
+ now = () => Date.now();
129
+ }
130
+ var BenchmarkRunResults = class {
131
+ constructor(name) {
132
+ this.name = name;
133
+ __publicField(this, "cycleResults", []);
134
+ __publicField(this, "_totalSamples", 0);
135
+ }
136
+ get totalSamples() {
137
+ return this._totalSamples;
138
+ }
139
+ get cycleResultsNoOutliers() {
140
+ const sD = this.standardDeviation;
141
+ const avg = average(this.cycleResults);
142
+ return this.cycleResults.filter((e) => {
143
+ const zScore = (avg - e) / sD;
144
+ return Math.abs(zScore) < 3;
145
+ });
146
+ }
147
+ /**
148
+ * Returns the mean ops per second minus outliers of greater than 3 standard deviations.
149
+ */
150
+ get meanOpsPerSec() {
151
+ return average(this.cycleResultsNoOutliers);
152
+ }
153
+ get standardDeviation() {
154
+ return standardDeviation(this.cycleResults);
155
+ }
156
+ get variance() {
157
+ return this.standardDeviation / this.meanOpsPerSec;
158
+ }
159
+ /**
160
+ * Returns the mean ops / s ± variance % as a string.
161
+ */
162
+ get meanOpsStr() {
163
+ const mean = this.meanOpsPerSec.toLocaleString(void 0, {
164
+ maximumSignificantDigits: 4
165
+ });
166
+ const variance = this.variance.toLocaleString(void 0, {
167
+ style: "percent"
168
+ });
169
+ return `${mean} \xB1${variance}`;
170
+ }
171
+ add(cycle) {
172
+ const opsPerSecond = cycle.ops / cycle.duration;
173
+ let index = this.cycleResults.findIndex((value) => opsPerSecond < value);
174
+ if (index < 0) index = this.cycleResults.length;
175
+ this.cycleResults.splice(index, 0, opsPerSecond);
176
+ this._totalSamples += cycle.ops;
177
+ }
178
+ toString() {
179
+ if (!this.cycleResults.length) return "No results";
180
+ return `${this.name}: ${this.meanOpsStr} ops/sec`;
181
+ }
182
+ };
183
+ var RunResultsComparison = class {
184
+ constructor(name, results) {
185
+ this.name = name;
186
+ __publicField(this, "results");
187
+ this.results = results.sort((a, b) => {
188
+ return a.meanOpsPerSec - b.meanOpsPerSec;
189
+ });
190
+ }
191
+ logToTable() {
192
+ const r = this.results.map((run) => {
193
+ const variance = run.variance.toLocaleString(void 0, {
194
+ style: "percent"
195
+ });
196
+ const mean = run.meanOpsPerSec.toLocaleString(void 0, {
197
+ maximumSignificantDigits: 4
198
+ });
199
+ return {
200
+ Name: run.name,
201
+ Mean: `${mean} \xB1${variance}`,
202
+ Samples: run.totalSamples,
203
+ Compare: this.runComparisonToString(run)
204
+ };
205
+ });
206
+ const table = r.reduce((acc, _a2) => {
207
+ var _b = _a2, { Name } = _b, x = __objRest(_b, ["Name"]);
208
+ acc[Name] = x;
209
+ return acc;
210
+ }, {});
211
+ console.log("\n" + this.name);
212
+ console.table(table);
213
+ }
214
+ runComparisonToString(run) {
215
+ var _a2, _b;
216
+ const baseline = (_b = (_a2 = this.results[0]) == null ? void 0 : _a2.meanOpsPerSec) != null ? _b : 0;
217
+ const fasterPercent = run.meanOpsPerSec / baseline - 1;
218
+ return fasterPercent < 0.01 ? "-" : fasterPercent.toLocaleString(void 0, {
219
+ style: "percent"
220
+ }) + " faster";
221
+ }
222
+ };
223
+ function compareResults(name, ...results) {
224
+ return new RunResultsComparison(name, results);
225
+ }
226
+ var defaultBenchmarkOptions = {
227
+ warmupTime: 0.5,
228
+ maxCycleDuration: 0.5,
229
+ cycles: 9
230
+ };
231
+ var _Benchmark = class _Benchmark2 {
232
+ /**
233
+ * Constructs a new Benchmark.
234
+ *
235
+ * @param name The name of the benchmark, to be used when logging.
236
+ * @param executor The method to execute and measure. If this method returns a promise, the
237
+ * promise will be awaited. The executor should either always return a promise, or never.
238
+ * @param options Optional configuration for the benchmark.
239
+ */
240
+ constructor(name, executor, options) {
241
+ this.name = name;
242
+ this.executor = executor;
243
+ __publicField(this, "options");
244
+ this.options = __spreadValues2(__spreadValues2({}, defaultBenchmarkOptions), options);
245
+ }
246
+ async run() {
247
+ const opts = this.options;
248
+ await _Benchmark2.semaphore;
249
+ const warmupTimeMs = opts.warmupTime * 1e3;
250
+ const cycleStart = now();
251
+ let isAsync = false;
252
+ do {
253
+ const result = this.executor();
254
+ isAsync = isAsync || result && typeof result.then === "function";
255
+ if (isAsync) await result;
256
+ } while (now() - cycleStart < warmupTimeMs);
257
+ const resultsPromise = (async () => {
258
+ const results = new BenchmarkRunResults(this.name);
259
+ for (let i = 0; i < opts.cycles; i++) {
260
+ const cycleResults = await this.runCycle(isAsync);
261
+ results.add(cycleResults);
262
+ await nextFrame();
263
+ }
264
+ return results;
265
+ })();
266
+ _Benchmark2.semaphore = resultsPromise;
267
+ return await resultsPromise;
268
+ }
269
+ /**
270
+ * Runs one cycle. A cycle will repeat the executor approximately `options.maxCycleDuration`
271
+ * seconds.
272
+ *
273
+ * @param isAsync
274
+ * @return Returns the duration (in seconds) and number of operations the cycle repeated.
275
+ */
276
+ async runCycle(isAsync) {
277
+ const cycleMs = this.options.maxCycleDuration * 1e3;
278
+ let ops = 0;
279
+ const cycleStart = now();
280
+ do {
281
+ const result = this.executor();
282
+ if (isAsync) await result;
283
+ ops++;
284
+ } while (now() - cycleStart < cycleMs);
285
+ const duration = (now() - cycleStart) / 1e3;
286
+ return {
287
+ duration,
288
+ ops
289
+ };
290
+ }
291
+ };
292
+ __publicField(_Benchmark, "semaphore", nextFrame());
293
+ var Benchmark = _Benchmark;
294
+ function benchmark(name, executor, options) {
295
+ const benchmark2 = new Benchmark(name, executor, options);
296
+ return benchmark2.run().then((results) => {
297
+ console.log(results.toString());
298
+ return results;
299
+ });
300
+ }
301
+ function nextFrame() {
302
+ return new Promise((resolve) => {
303
+ setTimeout(resolve);
304
+ });
305
+ }
306
+ function standardDeviation(values) {
307
+ const avg = average(values);
308
+ const squareDiffs = values.map((value) => {
309
+ const diff = value - avg;
310
+ return diff * diff;
311
+ });
312
+ const avgSquareDiff = average(squareDiffs);
313
+ return Math.sqrt(avgSquareDiff);
314
+ }
315
+ function average(values) {
316
+ const sum = values.reduce((acc, value) => acc + value, 0);
317
+ return sum / values.length;
318
+ }
319
+ var createSpy3 = jasmine.createSpy;
320
+
321
+ // test/benchmark/setup.ts
322
+ function setupBenchmark() {
323
+ setTestTimeout(180);
324
+ afterEach(expectNothing);
325
+ }
326
+ var comparisons = [];
327
+ function addComparison(comparison) {
328
+ comparisons.push(comparison);
329
+ }
330
+ function addBenchmarks(name, ...results) {
331
+ const comparison = compareResults(name, ...results);
332
+ comparison.logToTable();
333
+ comparisons.push(comparison);
334
+ }
335
+ if (typeof document !== "undefined") {
336
+ jasmine.getEnv().addReporter({
337
+ jasmineDone: () => {
338
+ var _a2;
339
+ console.log("Tests complete");
340
+ const jasmineContainer = document.getElementsByClassName(
341
+ "jasmine_html-reporter"
342
+ )[0];
343
+ (_a2 = jasmineContainer.parentElement) == null ? void 0 : _a2.removeChild(jasmineContainer);
344
+ const container = createEl("div", document.body);
345
+ container.id = "benchmarkResults";
346
+ const sortedComparisons = [...comparisons].sort(
347
+ (a, b) => a.name > b.name ? 1 : -1
348
+ );
349
+ for (const comparison of sortedComparisons) {
350
+ toTableHtml(comparison, container);
351
+ }
352
+ }
353
+ });
354
+ }
355
+ function toTableHtml(comparison, parent) {
356
+ const container = createEl("div", parent);
357
+ container.className = "benchmarkComparison";
358
+ const title = createEl("h2", container);
359
+ title.innerText = comparison.name;
360
+ const table = createEl("table", container);
361
+ const head = createEl("thead", table);
362
+ const headRow = createEl("tr", head);
363
+ const name = createEl("th", headRow);
364
+ name.innerText = "Name";
365
+ const median = createEl("th", headRow);
366
+ median.innerText = "Mean ops/s";
367
+ const samples = createEl("th", headRow);
368
+ samples.innerText = "Samples";
369
+ const compare = createEl("th", headRow);
370
+ compare.innerText = "% Comparison";
371
+ const body = createEl("tbody", table);
372
+ comparison.results.forEach((result) => {
373
+ const row = createEl("tr", body);
374
+ createEl("th", row).innerText = result.name;
375
+ createEl("td", row).innerText = result.meanOpsStr;
376
+ createEl("td", row).innerText = result.totalSamples.toLocaleString();
377
+ createEl("td", row).innerText = comparison.runComparisonToString(result);
378
+ });
379
+ return container;
380
+ }
381
+ function createEl(tagName, parent, options) {
382
+ const element2 = document.createElement(tagName, options);
383
+ if (parent) parent.appendChild(element2);
384
+ return element2;
385
+ }
386
+
387
+ // src/xmlns/mpeg/cenc/2013.ts
388
+ var CENC_NAMESPACE_URI = "urn:mpeg:cenc:2013";
389
+
390
+ // src/xmlns/microsoft/playready.ts
391
+ var PLAY_READY_NAMESPACE_URI = "urn:microsoft:playready";
392
+
393
+ // ../vinyl-util/dist/index.js
394
+ var __defProp3 = Object.defineProperty;
395
+ var __defProps2 = Object.defineProperties;
396
+ var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
397
+ var __getOwnPropSymbols3 = Object.getOwnPropertySymbols;
398
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
399
+ var __propIsEnum3 = Object.prototype.propertyIsEnumerable;
400
+ var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
401
+ var __spreadValues3 = (a, b) => {
402
+ for (var prop in b || (b = {}))
403
+ if (__hasOwnProp3.call(b, prop))
404
+ __defNormalProp3(a, prop, b[prop]);
405
+ if (__getOwnPropSymbols3)
406
+ for (var prop of __getOwnPropSymbols3(b)) {
407
+ if (__propIsEnum3.call(b, prop))
408
+ __defNormalProp3(a, prop, b[prop]);
409
+ }
410
+ return a;
411
+ };
412
+ var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
413
+ var __publicField2 = (obj, key, value) => __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
414
+ function invariant() {
415
+ return void 0;
416
+ }
417
+ var ErrorOrigin = {
418
+ /**
419
+ * The error originated from Vinyl and was reported from the uncaught exception or promise
420
+ * rejection handlers.
421
+ */
422
+ UNCAUGHT: "uncaught",
423
+ /**
424
+ * The error originated from Vinyl and was caught.
425
+ */
426
+ INTERNAL: "internal",
427
+ /**
428
+ * A Vinyl interface was used incorrectly by a consumer.
429
+ */
430
+ API: "api",
431
+ /**
432
+ * The error originated from a failed service call (500 errors).
433
+ */
434
+ SERVICE_EXTERNAL: "serviceExternal",
435
+ /**
436
+ * The error originated from a failed service call (400 errors).
437
+ */
438
+ SERVICE_INTERNAL: "serviceInternal",
439
+ /**
440
+ * The error originated from a problem playing provided media.
441
+ * The reporter is from a component such as the element, source buffer, media source, etc.
442
+ */
443
+ MEDIA: "media",
444
+ /**
445
+ * The error originated from a problem parsing input data.
446
+ * Such as a malformed Dash or HLS manifest.
447
+ */
448
+ PARSING: "parsing",
449
+ /**
450
+ * The error originated from an incompatibility with browser APIs,
451
+ * such as EME.
452
+ */
453
+ COMPATIBILITY: "compatibility",
454
+ /**
455
+ * The error originated from DRM.
456
+ * This does not include internal or service errors, only errors from the creation of media keys or media key
457
+ * sessions.
458
+ */
459
+ DRM: "drm"
460
+ };
461
+ var ReportableError = class _ReportableError extends Error {
462
+ constructor(message, origin = ErrorOrigin.INTERNAL, level = "fatal") {
463
+ super(message);
464
+ this.origin = origin;
465
+ this.level = level;
466
+ Object.setPrototypeOf(this, _ReportableError.prototype);
467
+ }
468
+ get [Symbol.toStringTag]() {
469
+ return "ReportableError";
470
+ }
471
+ get name() {
472
+ return this[Symbol.toStringTag];
473
+ }
474
+ /**
475
+ * All ReportableError instances must be serializable.
476
+ */
477
+ toJSON() {
478
+ return {
479
+ level: this.level,
480
+ message: this.message,
481
+ name: this.name,
482
+ origin: this.origin,
483
+ stack: this.stack
484
+ };
485
+ }
486
+ };
487
+ var IllegalArgumentError = class _IllegalArgumentError extends ReportableError {
488
+ constructor(message, isInternal = true) {
489
+ super(message, isInternal ? ErrorOrigin.INTERNAL : ErrorOrigin.API);
490
+ this.isInternal = isInternal;
491
+ Object.setPrototypeOf(this, _IllegalArgumentError.prototype);
492
+ }
493
+ get [Symbol.toStringTag]() {
494
+ return "IllegalArgumentError";
495
+ }
496
+ };
497
+ function getOrSet(map2, key, defaultValue) {
498
+ if (map2.has(key)) {
499
+ return map2.get(key);
500
+ } else {
501
+ const value = defaultValue(key);
502
+ map2.set(key, value);
503
+ return value;
504
+ }
505
+ }
506
+ var locale = {
507
+ variableNotDefined: "Variable '{name}' is not defined"
508
+ };
509
+ var DEFAULT_SUBSTITUTE_PATTERN = /\{(\w+)}/g;
510
+ function substitute(str, variables, pattern = DEFAULT_SUBSTITUTE_PATTERN) {
511
+ return str.replace(pattern, (_, name) => {
512
+ if (!(name in variables)) {
513
+ throw new IllegalArgumentError(
514
+ locale.variableNotDefined.replace("{name}", String(name))
515
+ );
516
+ }
517
+ return String(variables[name]);
518
+ });
519
+ }
520
+ function isWhitespaceChar(charCode) {
521
+ return charCode === 32 || // ' ' (space)
522
+ charCode === 9 || // '\t' (tab)
523
+ charCode === 13 || // '\r' (carriage return)
524
+ charCode === 10;
525
+ }
526
+ var encodedEntitiesRegex = /&(#(\d+)|\w+);/gi;
527
+ var predefinedDecodeEntities = /* @__PURE__ */ new Map([
528
+ ["apos", "'"],
529
+ ["amp", "&"],
530
+ ["lt", "<"],
531
+ ["gt", ">"],
532
+ ["quot", '"']
533
+ ]);
534
+ function decodeEntities(str, namedEntities = predefinedDecodeEntities) {
535
+ if (encodedEntitiesRegex.test(str)) {
536
+ return str.replace(
537
+ encodedEntitiesRegex,
538
+ (substring, entityName, codePoint) => {
539
+ if (codePoint !== void 0)
540
+ return String.fromCharCode(parseInt(codePoint));
541
+ const entityValue = namedEntities.get(entityName.toLowerCase());
542
+ if (!entityValue) return substring;
543
+ return entityValue;
544
+ }
545
+ );
546
+ } else {
547
+ return str;
548
+ }
549
+ }
550
+ function eqStr(a, b, ignoreCase = false) {
551
+ if (a == null && b == null) return true;
552
+ if (a == null || b == null) return false;
553
+ if (a === b) return true;
554
+ if (ignoreCase)
555
+ return a.length === b.length && a.toLowerCase() === b.toLowerCase();
556
+ return false;
557
+ }
558
+ function char(str) {
559
+ return str.charCodeAt(0);
560
+ }
561
+ function truncate(str, maxLength, indicator = "\u2026") {
562
+ if (str == null) return str;
563
+ if (str.length > maxLength)
564
+ return str.substring(0, maxLength - indicator.length) + indicator;
565
+ return str;
566
+ }
567
+ function clamp(value, min2, max2) {
568
+ return Math.min(Math.max(value, min2), max2);
569
+ }
570
+ function roundToNearest(value, snap, offset = 0) {
571
+ return Math.round((value - offset) / snap) * snap + offset;
572
+ }
573
+ function printStringPosition(str, index, options) {
574
+ var _a2;
575
+ const caret = (options == null ? void 0 : options.caret) || "^";
576
+ index = clamp(index, 0, str.length);
577
+ const minIndex = str.lastIndexOf("\n", index - 1) + 1;
578
+ let maxIndex = str.indexOf("\n", index);
579
+ if (maxIndex === -1) maxIndex = str.length;
580
+ const split = (options == null ? void 0 : options.split) === void 0 ? 0.6 : options.split;
581
+ const cols = ((_a2 = options == null ? void 0 : options.maxColumns) != null ? _a2 : 60) - caret.length;
582
+ let leadingChars = cols * split;
583
+ let trailingChars = cols * (1 - split);
584
+ const maxLeadingChars = index - minIndex;
585
+ const maxTrailingChars = maxIndex - index;
586
+ if (leadingChars > maxLeadingChars) {
587
+ trailingChars += leadingChars - maxLeadingChars;
588
+ leadingChars = maxLeadingChars;
589
+ if (trailingChars > maxTrailingChars) trailingChars = maxTrailingChars;
590
+ } else if (trailingChars > maxTrailingChars) {
591
+ leadingChars += trailingChars - maxTrailingChars;
592
+ trailingChars = maxTrailingChars;
593
+ if (leadingChars > maxLeadingChars) leadingChars = maxLeadingChars;
594
+ }
595
+ let out = str.substring(index - leadingChars, index + trailingChars) + "\n";
596
+ out += " ".repeat(leadingChars) + caret;
597
+ return out;
598
+ }
599
+ var StringReader = class {
600
+ /**
601
+ * @param data The string to read.
602
+ */
603
+ constructor(data) {
604
+ this.data = data;
605
+ __publicField2(this, "position", 0);
606
+ }
607
+ /**
608
+ * Returns true if the current {@link position} is less than the source data's length.
609
+ */
610
+ hasNext() {
611
+ return this.position < this.data.length;
612
+ }
613
+ /**
614
+ * Returns the number of characters remaining to be read.
615
+ */
616
+ get remaining() {
617
+ return this.data.length - this.position;
618
+ }
619
+ /**
620
+ * Returns the length of {@link data}.
621
+ */
622
+ get length() {
623
+ return this.data.length;
624
+ }
625
+ /**
626
+ * Throws a {@link StringParseError} where the location uses {@link printStringPosition} to
627
+ * show a friendly message indicating the current position.
628
+ *
629
+ * @param message
630
+ * @param offset The offset to add to the current position.
631
+ */
632
+ err(message, offset = 0) {
633
+ throw new StringParseError(this.data, this.position + offset, message);
634
+ }
635
+ /**
636
+ * Reads and returns the character code at the current position.
637
+ * To read the next character without advancing the cursor, use {@link peek}
638
+ *
639
+ * Note:
640
+ * This method has no bounds checking; if {@link position} is greater than or equal to
641
+ * `str.length` then NaN will be returned and {@link position} will still be incremented.
642
+ *
643
+ * @see String.charCodeAt
644
+ */
645
+ next() {
646
+ return this.data.charCodeAt(this.position++);
647
+ }
648
+ /**
649
+ * Reads characters until the predicate returns false or the data length has been reached.
650
+ *
651
+ * @param predicate Given the char code at the cursor index, returns true if the character
652
+ * should be included in the substring result.
653
+ * @returns number The start position.
654
+ */
655
+ while(predicate) {
656
+ const start = this.position;
657
+ let i = start;
658
+ const n = this.data.length;
659
+ while (i < n && predicate(this.data.charCodeAt(i))) i++;
660
+ this.position = i;
661
+ return start;
662
+ }
663
+ /**
664
+ * Reads characters until the predicate returns true or the string length has been reached.
665
+ *
666
+ * @param predicate
667
+ * @returns number Returns the start index.
668
+ */
669
+ until(predicate) {
670
+ return this.while((charCode) => !predicate(charCode));
671
+ }
672
+ /**
673
+ * Reads characters until the given character has been found or the string length has been
674
+ * reached.
675
+ *
676
+ * @param charCode
677
+ * @return number Returns the start index.
678
+ */
679
+ untilChar(charCode) {
680
+ return this.until((cc) => cc === charCode);
681
+ }
682
+ /**
683
+ * Reads characters until the given string has been found or the string length has been
684
+ * reached.
685
+ *
686
+ * @param string The string to match
687
+ * @return number Returns the start index.
688
+ */
689
+ untilString(string) {
690
+ const start = this.position;
691
+ const index = this.data.indexOf(string, this.position);
692
+ this.position = index === -1 ? this.data.length : index;
693
+ return start;
694
+ }
695
+ /**
696
+ * The same as {@link while} except returns the read substring as a result.
697
+ */
698
+ substringWhile(predicate) {
699
+ return this.data.substring(this.while(predicate), this.position);
700
+ }
701
+ /**
702
+ * The same as {@link until} except returns the read substring as a result.
703
+ */
704
+ substringUntil(predicate) {
705
+ return this.substringWhile((charCode) => !predicate(charCode));
706
+ }
707
+ /**
708
+ * The same as {@link untilChar} except returns the read substring as a result.
709
+ */
710
+ substringUntilChar(charCode) {
711
+ return this.substringWhile((iCharCode) => charCode !== iCharCode);
712
+ }
713
+ /**
714
+ * Reads the substring from the current index with the given length.
715
+ *
716
+ * @param length
717
+ */
718
+ substr(length) {
719
+ const sub = this.data.substring(this.position, this.position + length);
720
+ this.position += sub.length;
721
+ return sub;
722
+ }
723
+ /**
724
+ * Reads the expected string from the current position.
725
+ * If the read string doesn't match the given string, a {@link StringParseError} is thrown.
726
+ *
727
+ * @param str The string required to match at the current position.
728
+ * @param ignoreCase If true, the comparison will be case-insensitive.
729
+ */
730
+ read(str, ignoreCase = false) {
731
+ const actual = this.substr(str.length);
732
+ if (!eqStr(actual, str, ignoreCase))
733
+ this.err(`Expected '${str}', actual: '${actual}'`);
734
+ return actual;
735
+ }
736
+ /**
737
+ * Reads the expected char code from the current position.
738
+ * If the read character doesn't match the given character, a {@link StringParseError} is
739
+ * thrown.
740
+ *
741
+ * @param charCode The character code required to match at the current position.
742
+ */
743
+ readChar(charCode) {
744
+ const actual = this.next();
745
+ if (actual !== charCode)
746
+ this.err(
747
+ `Expected '${String.fromCharCode(charCode)}', actual: '${String.fromCharCode(actual)}'`
748
+ );
749
+ return actual;
750
+ }
751
+ /**
752
+ * Returns the character at the current position without advancing the cursor.
753
+ *
754
+ * Note:
755
+ * This method has no bounds checking; if {@link position} is greater than or equal to
756
+ * `str.length` then `NaN` will be returned.
757
+ *
758
+ * @see String.charCodeAt
759
+ */
760
+ get peek() {
761
+ return this.data.charCodeAt(this.position);
762
+ }
763
+ /**
764
+ * Reads through all whitespace characters, returning the starting index.
765
+ */
766
+ white() {
767
+ return this.while(isWhitespaceChar);
768
+ }
769
+ /**
770
+ * If {@link peek} equals the given character code, returns true and advances the index by
771
+ * one.
772
+ *
773
+ * @param charCode
774
+ */
775
+ charIf(charCode) {
776
+ if (this.peek === charCode) {
777
+ this.next();
778
+ return true;
779
+ } else {
780
+ return false;
781
+ }
782
+ }
783
+ /**
784
+ * If the given string matches the substring at the current position, returns true and advances
785
+ * the index by the string's length.
786
+ */
787
+ stringIf(string, ignoreCase = false) {
788
+ if (this.remaining < string.length) return false;
789
+ const substr = this.data.substring(
790
+ this.position,
791
+ this.position + string.length
792
+ );
793
+ const match = eqStr(substr, string, ignoreCase);
794
+ if (match) this.position += string.length;
795
+ return match;
796
+ }
797
+ };
798
+ var locale2 = {
799
+ messageSeparator: ", at: \n"
800
+ };
801
+ var StringParseError = class _StringParseError extends ReportableError {
802
+ constructor(str, position, reason) {
803
+ const location2 = printStringPosition(str, position);
804
+ super(
805
+ `${reason}${locale2.messageSeparator}${location2}`,
806
+ ErrorOrigin.PARSING
807
+ );
808
+ this.position = position;
809
+ this.reason = reason;
810
+ __publicField2(this, "location");
811
+ this.location = location2;
812
+ Object.setPrototypeOf(this, _StringParseError.prototype);
813
+ }
814
+ get [Symbol.toStringTag]() {
815
+ return "StringParseError";
816
+ }
817
+ toJSON() {
818
+ return __spreadProps2(__spreadValues3({}, super.toJSON()), {
819
+ position: this.position,
820
+ location: this.location,
821
+ reason: this.reason
822
+ });
823
+ }
824
+ };
825
+ function union(a, b) {
826
+ return /* @__PURE__ */ new Set([...a, ...b]);
827
+ }
828
+ function ownKeys(obj) {
829
+ if (!obj) return /* @__PURE__ */ new Set();
830
+ if (typeof Reflect !== "undefined")
831
+ return new Set(Reflect.ownKeys(obj));
832
+ const properties = /* @__PURE__ */ new Set();
833
+ Object.getOwnPropertyNames(obj).forEach((item) => properties.add(item));
834
+ Object.getOwnPropertySymbols(obj).forEach((item) => properties.add(item));
835
+ return properties;
836
+ }
837
+ function isPlainObject(value) {
838
+ if (!value || typeof value !== "object" || Array.isArray(value))
839
+ return false;
840
+ const proto = Object.getPrototypeOf(value);
841
+ return !proto || !Object.getPrototypeOf(proto);
842
+ }
843
+ function toJson(value) {
844
+ return toJsonInternal(value, /* @__PURE__ */ new Set());
845
+ }
846
+ function toJsonInternal(value, visited) {
847
+ switch (typeof value) {
848
+ case "object":
849
+ return objectToJsonInternal(value, visited);
850
+ case "undefined":
851
+ case "boolean":
852
+ case "number":
853
+ case "string":
854
+ return value;
855
+ case "function":
856
+ return `[function ${value.name}]`;
857
+ case "symbol":
858
+ return `[symbol ${value.toString().slice(7, -1)}]`;
859
+ case "bigint":
860
+ return value.toString();
861
+ }
862
+ }
863
+ function objectToJsonInternal(value, visited) {
864
+ if (value == null) return value;
865
+ if (visited.has(value)) return `<circular reference: ${String(value)}>`;
866
+ visited.add(value);
867
+ if ("toJSON" in value && typeof value.toJSON === "function")
868
+ return value.toJSON();
869
+ if (value instanceof Set) {
870
+ return Array.from(value).map((e) => toJsonInternal(e, visited));
871
+ } else if (Array.isArray(value)) {
872
+ return value.map((e) => toJsonInternal(e, visited));
873
+ } else {
874
+ if (isPlainObject(value)) {
875
+ const o = {};
876
+ for (const key in value) {
877
+ o[key] = toJsonInternal(value[key], visited);
878
+ }
879
+ return o;
880
+ } else if (value instanceof Error) {
881
+ return {
882
+ name: value.name,
883
+ message: value.message,
884
+ stack: value.stack
885
+ };
886
+ } else {
887
+ return value.toString();
888
+ }
889
+ }
890
+ }
891
+ function stringifyForPrint(value, maxLength, indicator = "\u2026") {
892
+ let str = JSON.stringify(
893
+ toJson(value),
894
+ (_, value2) => {
895
+ const type = typeof value2;
896
+ if (["undefined"].includes(type)) {
897
+ return `{{${String(value2)}}}`;
898
+ }
899
+ if (type === "number") {
900
+ if (Number.isNaN(value2) || !Number.isFinite(value2))
901
+ return `{{${value2.toString()}}}`;
902
+ }
903
+ return value2;
904
+ },
905
+ " "
906
+ );
907
+ str = str.replace(/("\{\{.*}}")/g, (_, s) => {
908
+ return s.substring(3, s.length - 3);
909
+ });
910
+ if (maxLength) str = truncate(str, maxLength, indicator);
911
+ return str;
912
+ }
913
+ function parseBoolean(str) {
914
+ return str === "true" || str === "1";
915
+ }
916
+ function stringify(value) {
917
+ if (value === null) return "null";
918
+ if (value === void 0) return "undefined";
919
+ return value.toString();
920
+ }
921
+ function parseIntSafe(str, radix) {
922
+ if (!str) return null;
923
+ const value = parseInt(str, radix);
924
+ if (!Number.isFinite(value)) return null;
925
+ return value;
926
+ }
927
+ var LinkedList = class {
928
+ constructor() {
929
+ __publicField2(this, "_head", null);
930
+ __publicField2(this, "_tail", null);
931
+ }
932
+ /**
933
+ * Returns the current head.
934
+ */
935
+ get head() {
936
+ return this._head;
937
+ }
938
+ /**
939
+ * Returns the current tail.
940
+ */
941
+ get tail() {
942
+ return this._tail;
943
+ }
944
+ /**
945
+ * Returns true if the list is empty.
946
+ */
947
+ get empty() {
948
+ return this._head === null;
949
+ }
950
+ /**
951
+ * Creates a new node for the given value, adding it to the end of the list.
952
+ *
953
+ * @param value
954
+ * @return Returns the newly created node.
955
+ */
956
+ push(value) {
957
+ const node = {
958
+ previous: this._tail,
959
+ value,
960
+ removed: false,
961
+ next: null
962
+ };
963
+ this.pushNode(node);
964
+ return node;
965
+ }
966
+ /**
967
+ * Appends all given values to the end of this list.
968
+ *
969
+ * @param values
970
+ */
971
+ pushAll(...values) {
972
+ for (const value of values) {
973
+ this.push(value);
974
+ }
975
+ }
976
+ /**
977
+ * Appends the given node to the tail of this list.
978
+ * If the node is already at the tail, it will no-op.
979
+ * If the node is in this list, it will be removed.
980
+ *
981
+ * @param node The node to add or move to the tail of this list.
982
+ */
983
+ pushNode(node) {
984
+ if (this._tail === node) return;
985
+ this.remove(node);
986
+ node.removed = false;
987
+ node.next = null;
988
+ node.previous = this._tail;
989
+ if (this._tail) this._tail.next = node;
990
+ this._tail = node;
991
+ if (!this._head) this._head = node;
992
+ }
993
+ /**
994
+ * Removes the last node (the tail), returning it.
995
+ * If this list is empty, null is returned.
996
+ */
997
+ pop() {
998
+ const node = this._tail;
999
+ if (!node) return null;
1000
+ this.remove(node);
1001
+ return node;
1002
+ }
1003
+ /**
1004
+ * Creates a new node, adding it to the front of the list.
1005
+ *
1006
+ * @param value The value to box in a linked node.
1007
+ * @return Returns the new node.
1008
+ */
1009
+ unshift(value) {
1010
+ const node = {
1011
+ previous: null,
1012
+ value,
1013
+ removed: true,
1014
+ next: this._head
1015
+ };
1016
+ this.unshiftNode(node);
1017
+ return node;
1018
+ }
1019
+ /**
1020
+ * Prepends all the given values to the head of this list.
1021
+ * The values will maintain their order.
1022
+ *
1023
+ * E.g.
1024
+ * ```
1025
+ * list.unshiftAll(8, 9, 10) // 8, 9, 10
1026
+ * list.unshiftAll(4, 5, 6, 7) // 4, 5, 6, 7, 8, 9, 10
1027
+ * list.unshiftAll(1, 2, 3) // 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
1028
+ * ```
1029
+ *
1030
+ * @param values The values to box in linked nodes.
1031
+ */
1032
+ unshiftAll(...values) {
1033
+ for (let i = values.length - 1; i >= 0; i--) {
1034
+ this.unshift(values[i]);
1035
+ }
1036
+ }
1037
+ /**
1038
+ * Prepends the given node to the head of this list.
1039
+ * - If the node is already at the head, it will no-op.
1040
+ * - If the node is in this list, it will be removed.
1041
+ *
1042
+ * @param node The node to add or move to the head of this list.
1043
+ */
1044
+ unshiftNode(node) {
1045
+ if (this._head === node) return;
1046
+ this.remove(node);
1047
+ node.removed = false;
1048
+ node.previous = null;
1049
+ node.next = this._head;
1050
+ if (this._head) this._head.previous = node;
1051
+ this._head = node;
1052
+ if (!this._tail) this._tail = node;
1053
+ }
1054
+ /**
1055
+ * Removes the first node (the head), returning it.
1056
+ * - If this list is empty, null is returned.
1057
+ */
1058
+ shift() {
1059
+ const node = this._head;
1060
+ if (!node) return null;
1061
+ this.remove(node);
1062
+ return node;
1063
+ }
1064
+ /**
1065
+ * Removes the given linked node.
1066
+ *
1067
+ * @param node
1068
+ */
1069
+ remove(node) {
1070
+ if (node.removed) return;
1071
+ node.removed = true;
1072
+ if (node.previous) node.previous.next = node.next;
1073
+ if (node.next) node.next.previous = node.previous;
1074
+ if (this._head === node) this._head = node.next;
1075
+ if (this._tail === node) this._tail = node.previous;
1076
+ }
1077
+ /**
1078
+ * Inserts the given node before pointer node.
1079
+ *
1080
+ * @param node The node to insert before pointer. If this node is currently in this list, it
1081
+ * will first be removed.
1082
+ * @param pointer The pointer node.
1083
+ */
1084
+ insertNodeBefore(node, pointer) {
1085
+ if (!node.removed && node.next === pointer) return;
1086
+ this.remove(node);
1087
+ node.removed = false;
1088
+ if (pointer.previous) {
1089
+ pointer.previous.next = node;
1090
+ node.previous = pointer.previous;
1091
+ } else {
1092
+ this._head = node;
1093
+ node.previous = null;
1094
+ }
1095
+ node.next = pointer;
1096
+ pointer.previous = node;
1097
+ }
1098
+ /**
1099
+ * Inserts the given node after pointer node.
1100
+ *
1101
+ * @param node The node to insert after pointer. If this node is currently in this list, it
1102
+ * will first be removed.
1103
+ * @param pointer The pointer node.
1104
+ */
1105
+ insertNodeAfter(node, pointer) {
1106
+ if (!node.removed && node.previous === pointer) return;
1107
+ this.remove(node);
1108
+ node.removed = false;
1109
+ if (pointer.next) {
1110
+ pointer.next.previous = node;
1111
+ node.next = pointer.next;
1112
+ } else {
1113
+ this._tail = node;
1114
+ node.next = null;
1115
+ }
1116
+ node.previous = pointer;
1117
+ pointer.next = node;
1118
+ }
1119
+ /**
1120
+ * Iterates over every element, invoking the given callback.
1121
+ *
1122
+ * @param callback
1123
+ */
1124
+ forEach(callback) {
1125
+ let current = this._head;
1126
+ while (current) {
1127
+ if (!current.removed) callback(current.value);
1128
+ current = current.next;
1129
+ }
1130
+ }
1131
+ /**
1132
+ * Similar to `Array.prototype.some`, returns true if at least one element passes the given
1133
+ * predicate.
1134
+ *
1135
+ * @param predicate
1136
+ */
1137
+ some(predicate) {
1138
+ let current = this._head;
1139
+ while (current) {
1140
+ if (!current.removed && predicate(current.value)) return true;
1141
+ current = current.next;
1142
+ }
1143
+ return false;
1144
+ }
1145
+ /**
1146
+ * Returns the first node matching the given predicate.
1147
+ *
1148
+ * @param predicate A function where, when true is returned, returns the current node.
1149
+ */
1150
+ find(predicate) {
1151
+ let current = this._head;
1152
+ while (current) {
1153
+ if (!current.removed && predicate(current.value)) return current;
1154
+ current = current.next;
1155
+ }
1156
+ return null;
1157
+ }
1158
+ /**
1159
+ * Returns the last node matching the given predicate.
1160
+ *
1161
+ * @param predicate A function where, when true is returned, returns the current node.
1162
+ */
1163
+ findLast(predicate) {
1164
+ let current = this._tail;
1165
+ while (current) {
1166
+ if (!current.removed && predicate(current.value)) return current;
1167
+ current = current.previous;
1168
+ }
1169
+ return null;
1170
+ }
1171
+ /**
1172
+ * Clears this list.
1173
+ */
1174
+ clear() {
1175
+ let current = this._head;
1176
+ while (current != null) {
1177
+ const next = current.next;
1178
+ current.removed = true;
1179
+ current = next;
1180
+ }
1181
+ this._head = null;
1182
+ this._tail = null;
1183
+ }
1184
+ /**
1185
+ * Returns a new iterator, starting at the head.
1186
+ */
1187
+ [Symbol.iterator]() {
1188
+ return this.createIterator(this._head, null, (node) => node.next);
1189
+ }
1190
+ /**
1191
+ * Returns a new reversed iterable where the iterator starts at the tail, moving backwards
1192
+ * to the head.
1193
+ */
1194
+ reversed() {
1195
+ return this.createIterator(this._tail, null, (node) => node.previous);
1196
+ }
1197
+ /**
1198
+ * Creates an iterable iterator, starting at the specified node, getting the next node from
1199
+ * the next() function.
1200
+ *
1201
+ * Note that using iterators is not as performant as {@link some} or {@link forEach}
1202
+ *
1203
+ * @param start The starting node. (inclusive)
1204
+ * @param end The ending node (exclusive).
1205
+ * @param next A method that is given the current node, and returns the next node.
1206
+ */
1207
+ createIterator(start, end, next) {
1208
+ let current = start;
1209
+ return {
1210
+ [Symbol.iterator]() {
1211
+ return this;
1212
+ },
1213
+ next: () => {
1214
+ if (current === end || !current) {
1215
+ return {
1216
+ value: void 0,
1217
+ done: true
1218
+ };
1219
+ }
1220
+ const result = {
1221
+ value: current.value,
1222
+ done: false
1223
+ };
1224
+ current = next(current);
1225
+ while (current == null ? void 0 : current.removed) {
1226
+ current = next(current);
1227
+ }
1228
+ return result;
1229
+ }
1230
+ };
1231
+ }
1232
+ };
1233
+ function last(arrayLike) {
1234
+ if (!arrayLike) return void 0;
1235
+ return arrayLike[arrayLike.length - 1];
1236
+ }
1237
+ function cloneTypedArray(array) {
1238
+ return new array.constructor(array);
1239
+ }
1240
+ var typedArrayTypes = [
1241
+ Float32Array,
1242
+ Float64Array,
1243
+ Int16Array,
1244
+ Int32Array,
1245
+ Int8Array,
1246
+ Uint16Array,
1247
+ Uint32Array,
1248
+ Uint8Array,
1249
+ Uint8ClampedArray
1250
+ ];
1251
+ function isTypedArray(value) {
1252
+ return typedArrayTypes.some((type) => value instanceof type);
1253
+ }
1254
+ function isCloneable(value) {
1255
+ return value != null && typeof value === "object" && "clone" in value && typeof value.clone === "function" && value.clone.length === 0;
1256
+ }
1257
+ var locale3 = {
1258
+ cyclicRefError: "Cyclic reference found at: {path}",
1259
+ mergeReferenceError: `No merge rule found at {path} for "{source}" and reference copy not allowed`
1260
+ };
1261
+ function mergeDeep(sources, options) {
1262
+ if (!sources.length) return void 0;
1263
+ const finalOpts = __spreadValues3(__spreadValues3({}, defaultMergeOptions), options);
1264
+ const stack = new PropStack();
1265
+ const n = sources.length;
1266
+ if (n === 1)
1267
+ return _mergeDeep(void 0, sources[0], stack, 0, finalOpts);
1268
+ let out = _mergeDeep(sources[0], sources[1], stack, 1, finalOpts);
1269
+ for (let i = 2; i < n; i++) {
1270
+ out = _mergeDeep(out, sources[i], stack, i, finalOpts);
1271
+ }
1272
+ return out;
1273
+ }
1274
+ var PropStack = class {
1275
+ constructor() {
1276
+ __publicField2(this, "refsA", /* @__PURE__ */ new Set());
1277
+ __publicField2(this, "refsB", /* @__PURE__ */ new Set());
1278
+ __publicField2(this, "propStack", []);
1279
+ }
1280
+ /**
1281
+ * The property stack, joined by .
1282
+ */
1283
+ get currentPath() {
1284
+ return this.propStack.map((e) => e[2]).filter((e) => e != null).join(".");
1285
+ }
1286
+ push(sourceA, sourceB, prop) {
1287
+ this.propStack.push([sourceA, sourceB, prop]);
1288
+ this.addRef(this.refsA, sourceA);
1289
+ this.addRef(this.refsB, sourceB);
1290
+ }
1291
+ pop() {
1292
+ const last2 = this.propStack.pop();
1293
+ this.refsA.delete(last2[0]);
1294
+ this.refsB.delete(last2[1]);
1295
+ }
1296
+ addRef(refSet, source) {
1297
+ if (typeof source !== "object") return;
1298
+ if (refSet.has(source)) {
1299
+ throw new IllegalArgumentError(
1300
+ substitute(locale3.cyclicRefError, { path: this.currentPath })
1301
+ );
1302
+ }
1303
+ refSet.add(source);
1304
+ }
1305
+ };
1306
+ function _mergeDeep(sourceA, sourceB, propStack, prop, options) {
1307
+ if (typeof sourceB !== "object" || sourceB === null) return sourceB;
1308
+ const merge2 = (sourceA2, sourceB2, prop2) => {
1309
+ return _mergeDeep(sourceA2, sourceB2, propStack, prop2, options);
1310
+ };
1311
+ for (const rule of options.rules) {
1312
+ if (rule.matches(sourceB)) {
1313
+ propStack.push(sourceA, sourceB, prop);
1314
+ const result = rule.merge(
1315
+ rule.matches(sourceA) ? sourceA : void 0,
1316
+ sourceB,
1317
+ merge2
1318
+ );
1319
+ propStack.pop();
1320
+ return result;
1321
+ }
1322
+ }
1323
+ if (!options.allowReferenceCopy) {
1324
+ propStack.push(sourceA, sourceB, prop);
1325
+ throw new MergeReferenceError(propStack.currentPath, sourceB);
1326
+ }
1327
+ return sourceB;
1328
+ }
1329
+ var MergeReferenceError = class _MergeReferenceError extends ReportableError {
1330
+ constructor(propPath, source) {
1331
+ super(
1332
+ substitute(locale3.mergeReferenceError, {
1333
+ path: propPath,
1334
+ source
1335
+ })
1336
+ );
1337
+ Object.setPrototypeOf(this, _MergeReferenceError.prototype);
1338
+ }
1339
+ };
1340
+ var cloneableMergeRule = {
1341
+ matches(object) {
1342
+ return isCloneable(object);
1343
+ },
1344
+ merge(_1, sourceB, _2) {
1345
+ return sourceB.clone();
1346
+ }
1347
+ };
1348
+ var arrayMergeRule = {
1349
+ matches(object) {
1350
+ return Array.isArray(object);
1351
+ },
1352
+ merge(sourceA, sourceB, merge2) {
1353
+ const out = [];
1354
+ if (sourceA) {
1355
+ for (const element2 of sourceA) {
1356
+ out.push(merge2(void 0, element2, out.length));
1357
+ }
1358
+ }
1359
+ for (const element2 of sourceB) {
1360
+ out.push(merge2(void 0, element2, out.length));
1361
+ }
1362
+ return out;
1363
+ }
1364
+ };
1365
+ var plainObjectMergeRule = {
1366
+ matches(object) {
1367
+ return isPlainObject(object);
1368
+ },
1369
+ merge(sourceA, sourceB, merge2) {
1370
+ const out = {};
1371
+ for (const key of union(ownKeys(sourceA), ownKeys(sourceB))) {
1372
+ if (sourceA && key in sourceB && key in sourceA) {
1373
+ out[key] = merge2(sourceA[key], sourceB[key], key);
1374
+ } else if (sourceA && key in sourceA) {
1375
+ out[key] = merge2(void 0, sourceA[key], key);
1376
+ } else {
1377
+ out[key] = merge2(void 0, sourceB[key], key);
1378
+ }
1379
+ }
1380
+ return out;
1381
+ }
1382
+ };
1383
+ var regexpMergeRule = {
1384
+ matches(object) {
1385
+ return object instanceof RegExp;
1386
+ },
1387
+ merge(_1, sourceB, _2) {
1388
+ return new RegExp(sourceB.source, sourceB.flags);
1389
+ }
1390
+ };
1391
+ var dateMergeRule = {
1392
+ matches(object) {
1393
+ return object instanceof Date;
1394
+ },
1395
+ merge(_1, sourceB, _2) {
1396
+ return new Date(sourceB.getTime());
1397
+ }
1398
+ };
1399
+ var mapMergeRule = {
1400
+ matches(object) {
1401
+ return object instanceof Map;
1402
+ },
1403
+ merge(sourceA, sourceB, merge2) {
1404
+ var _a2;
1405
+ const out = /* @__PURE__ */ new Map();
1406
+ for (const key of /* @__PURE__ */ new Set([
1407
+ ...(_a2 = sourceA == null ? void 0 : sourceA.keys()) != null ? _a2 : [],
1408
+ ...sourceB.keys()
1409
+ ])) {
1410
+ if (sourceB.has(key) && (sourceA == null ? void 0 : sourceA.has(key))) {
1411
+ out.set(key, merge2(sourceA.get(key), sourceB.get(key), key));
1412
+ } else if (sourceA == null ? void 0 : sourceA.has(key)) {
1413
+ out.set(key, merge2(void 0, sourceA.get(key), key));
1414
+ } else {
1415
+ out.set(key, merge2(void 0, sourceB.get(key), key));
1416
+ }
1417
+ }
1418
+ return out;
1419
+ }
1420
+ };
1421
+ var setMergeRule = {
1422
+ matches(object) {
1423
+ return object instanceof Set;
1424
+ },
1425
+ merge(sourceA, sourceB, merge2) {
1426
+ var _a2;
1427
+ return new Set(
1428
+ [...(_a2 = sourceA == null ? void 0 : sourceA.values()) != null ? _a2 : [], ...sourceB.values()].map(
1429
+ (element2, index) => {
1430
+ return merge2(void 0, element2, index);
1431
+ }
1432
+ )
1433
+ );
1434
+ }
1435
+ };
1436
+ var typedArrayMergeRule = {
1437
+ matches(object) {
1438
+ return isTypedArray(object);
1439
+ },
1440
+ merge(_1, sourceB, _2) {
1441
+ return cloneTypedArray(sourceB);
1442
+ }
1443
+ };
1444
+ var urlMergeRule = {
1445
+ matches(object) {
1446
+ return object instanceof URL;
1447
+ },
1448
+ merge(_1, sourceB, _2) {
1449
+ return new URL(sourceB.toString());
1450
+ }
1451
+ };
1452
+ var defaultMergeOptions = {
1453
+ allowReferenceCopy: true,
1454
+ rules: [
1455
+ cloneableMergeRule,
1456
+ arrayMergeRule,
1457
+ plainObjectMergeRule,
1458
+ regexpMergeRule,
1459
+ dateMergeRule,
1460
+ mapMergeRule,
1461
+ setMergeRule,
1462
+ typedArrayMergeRule,
1463
+ urlMergeRule
1464
+ ]
1465
+ };
1466
+ function merge(...sources) {
1467
+ if (!sources.length) return void 0;
1468
+ if (Array.isArray(sources[0])) return Array.prototype.concat(...sources);
1469
+ return Object.assign({}, ...sources);
1470
+ }
1471
+ var IllegalStateError = class _IllegalStateError extends ReportableError {
1472
+ get [Symbol.toStringTag]() {
1473
+ return "IllegalStateError";
1474
+ }
1475
+ constructor(message) {
1476
+ super(message);
1477
+ Object.setPrototypeOf(this, _IllegalStateError.prototype);
1478
+ }
1479
+ };
1480
+ function clone(target, options) {
1481
+ var _a2, _b, _c;
1482
+ return mergeDeep([target], {
1483
+ allowReferenceCopy: (_a2 = options == null ? void 0 : options.allowReferenceCopy) != null ? _a2 : false,
1484
+ rules: (_c = (_b = options == null ? void 0 : options.rules) == null ? void 0 : _b.map(toMergeRule)) != null ? _c : defaultMergeOptions.rules
1485
+ });
1486
+ }
1487
+ function toMergeRule(cloneRule) {
1488
+ return {
1489
+ matches: cloneRule.matches,
1490
+ merge(_sourceA, sourceB, merge2) {
1491
+ return cloneRule.clone(
1492
+ sourceB,
1493
+ (source, prop) => {
1494
+ return merge2(void 0, source, prop);
1495
+ }
1496
+ );
1497
+ }
1498
+ };
1499
+ }
1500
+ var ValidationError = class _ValidationError extends ReportableError {
1501
+ /**
1502
+ * @param message The validation error message.
1503
+ * @param origin The error origin, typically API (default) or SERVICE_EXTERNAL
1504
+ * @param path The property path to the invalid field.
1505
+ */
1506
+ constructor(message, origin = ErrorOrigin.API, path = []) {
1507
+ super(message, origin);
1508
+ this.path = path;
1509
+ Object.setPrototypeOf(this, _ValidationError.prototype);
1510
+ }
1511
+ get [Symbol.toStringTag]() {
1512
+ return "ValidationError";
1513
+ }
1514
+ toJSON() {
1515
+ return __spreadProps2(__spreadValues3({}, super.toJSON()), {
1516
+ origin: this.origin,
1517
+ path: this.path
1518
+ });
1519
+ }
1520
+ };
1521
+ function mapIter(iterable, transform) {
1522
+ const it2 = iterable[Symbol.iterator]();
1523
+ return {
1524
+ [Symbol.iterator]() {
1525
+ return mapIter(iterable, transform);
1526
+ },
1527
+ next: () => {
1528
+ const result = it2.next();
1529
+ if (result.done) return result;
1530
+ return {
1531
+ value: transform(result.value),
1532
+ done: false
1533
+ };
1534
+ }
1535
+ };
1536
+ }
1537
+ var LruCache = class {
1538
+ constructor(initialCapacity) {
1539
+ __publicField2(this, "cache", /* @__PURE__ */ new Map());
1540
+ __publicField2(this, "list", /* @__PURE__ */ new LinkedList());
1541
+ __publicField2(this, "onEvicting", null);
1542
+ __publicField2(this, "onEvict", null);
1543
+ __publicField2(this, "_capacity", 0);
1544
+ this._capacity = initialCapacity;
1545
+ }
1546
+ get capacity() {
1547
+ return this._capacity;
1548
+ }
1549
+ set capacity(value) {
1550
+ this._capacity = value;
1551
+ while (this.cache.size > this.capacity) {
1552
+ this.evictLeastRecentlyUsed();
1553
+ }
1554
+ }
1555
+ /**
1556
+ * @returns the number of elements in the Map.
1557
+ */
1558
+ get size() {
1559
+ return this.cache.size;
1560
+ }
1561
+ /**
1562
+ * @returns boolean indicating whether an element with the specified key exists or not.
1563
+ */
1564
+ has(key) {
1565
+ return this.cache.has(key);
1566
+ }
1567
+ /**
1568
+ * Returns the mapped value for the given key, and moves the element to the most recently
1569
+ * used position.
1570
+ *
1571
+ * @returns Returns the element associated with the given key, or undefined if no such
1572
+ * element exists.
1573
+ */
1574
+ get(key) {
1575
+ const node = this.cache.get(key);
1576
+ if (!node) return void 0;
1577
+ this.list.pushNode(node);
1578
+ return node.value[1];
1579
+ }
1580
+ /**
1581
+ * Adds a new element with a specified key and value to the Map. If an element with the
1582
+ * same key already exists, the element will be updated and position moved to most recently
1583
+ * used.
1584
+ */
1585
+ set(key, value) {
1586
+ if (this.has(key)) {
1587
+ const node = this.cache.get(key);
1588
+ node.value[1] = value;
1589
+ this.list.pushNode(node);
1590
+ } else {
1591
+ const node = this.list.push([key, value]);
1592
+ this.cache.set(key, node);
1593
+ if (this.cache.size > this.capacity) {
1594
+ this.evictLeastRecentlyUsed();
1595
+ }
1596
+ }
1597
+ return this;
1598
+ }
1599
+ evictLeastRecentlyUsed() {
1600
+ var _a2, _b, _c;
1601
+ let node = this.list.head;
1602
+ while (node) {
1603
+ const [key2, value2] = node.value;
1604
+ const allowed = (_b = (_a2 = this.onEvicting) == null ? void 0 : _a2.call(null, value2, key2, this)) != null ? _b : true;
1605
+ if (allowed) break;
1606
+ node = node.next;
1607
+ }
1608
+ if (!node)
1609
+ throw new IllegalStateError(
1610
+ "onEvicting returned false for all elements"
1611
+ );
1612
+ const [key, value] = node.value;
1613
+ this.list.remove(node);
1614
+ this.cache.delete(node.value[0]);
1615
+ (_c = this.onEvict) == null ? void 0 : _c.call(null, value, key, this);
1616
+ }
1617
+ /**
1618
+ * Clears all elements from the cache.
1619
+ */
1620
+ clear() {
1621
+ this.list.clear();
1622
+ this.cache.clear();
1623
+ }
1624
+ /**
1625
+ * @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
1626
+ */
1627
+ delete(key) {
1628
+ if (!this.has(key)) return false;
1629
+ const node = this.cache.get(key);
1630
+ this.cache.delete(key);
1631
+ this.list.remove(node);
1632
+ return true;
1633
+ }
1634
+ /**
1635
+ * Executes a provided function once per each key/value pair in the Map, in insertion order.
1636
+ *
1637
+ * @param callback A callback to invoke for every element in the cache.
1638
+ * @param thisArg Value to use as this when executing callback
1639
+ */
1640
+ forEach(callback, thisArg) {
1641
+ return this.list.forEach((entry) => {
1642
+ callback.call(thisArg, entry[1], entry[0], this);
1643
+ });
1644
+ }
1645
+ /**
1646
+ * Returns an iterable of key, value pairs for every entry in the map.
1647
+ */
1648
+ entries() {
1649
+ return this[Symbol.iterator]();
1650
+ }
1651
+ /**
1652
+ * Returns an iterable of keys in the map. This will be ordered from least recently used to
1653
+ * most.
1654
+ */
1655
+ keys() {
1656
+ return mapIter(this.list, ([key]) => key);
1657
+ }
1658
+ /**
1659
+ * Returns an iterable of values in the map. This will be ordered from least recently used to
1660
+ * most.
1661
+ */
1662
+ values() {
1663
+ return mapIter(this.list, ([, value]) => value);
1664
+ }
1665
+ [Symbol.iterator]() {
1666
+ return this.list[Symbol.iterator]();
1667
+ }
1668
+ get [Symbol.toStringTag]() {
1669
+ return "LruCache";
1670
+ }
1671
+ };
1672
+ function memoize(inner, keyProvider, capacity = 500) {
1673
+ if (!keyProvider) {
1674
+ let cached = false;
1675
+ let value = void 0;
1676
+ const memoized = () => {
1677
+ if (!cached) {
1678
+ cached = true;
1679
+ value = inner();
1680
+ }
1681
+ return value;
1682
+ };
1683
+ return Object.assign(
1684
+ memoized,
1685
+ {
1686
+ clear: () => {
1687
+ cached = false;
1688
+ value = void 0;
1689
+ }
1690
+ }
1691
+ );
1692
+ } else if (capacity === 0) {
1693
+ const memoized = (...args) => inner(...args);
1694
+ return Object.assign(
1695
+ memoized,
1696
+ {
1697
+ clear: () => {
1698
+ }
1699
+ }
1700
+ );
1701
+ } else if (capacity === 1) {
1702
+ let hasValue = false;
1703
+ let cachedKey;
1704
+ let cachedValue;
1705
+ const memoized = (...args) => {
1706
+ const key = keyProvider(...args);
1707
+ if (!hasValue || cachedKey !== key) {
1708
+ hasValue = true;
1709
+ cachedKey = key;
1710
+ cachedValue = inner(...args);
1711
+ }
1712
+ return cachedValue;
1713
+ };
1714
+ return Object.assign(
1715
+ memoized,
1716
+ {
1717
+ clear: () => {
1718
+ hasValue = false;
1719
+ }
1720
+ }
1721
+ );
1722
+ } else {
1723
+ const cache = new LruCache(capacity);
1724
+ const memoized = (...args) => {
1725
+ const key = keyProvider(...args);
1726
+ return getOrSet(cache, key, () => inner(...args));
1727
+ };
1728
+ return Object.assign(
1729
+ memoized,
1730
+ {
1731
+ clear: () => {
1732
+ cache.clear();
1733
+ }
1734
+ }
1735
+ );
1736
+ }
1737
+ }
1738
+ var locale4 = {
1739
+ invalidDateError: `"{value}" is an invalid date`
1740
+ };
1741
+ function parseTimestamp(str) {
1742
+ const timestamp = Date.parse(str);
1743
+ if (Number.isNaN(timestamp))
1744
+ throw new ValidationError(
1745
+ substitute(locale4.invalidDateError, { value: str }),
1746
+ ErrorOrigin.PARSING
1747
+ );
1748
+ return timestamp;
1749
+ }
1750
+ function parseDate(str) {
1751
+ return new Date(parseTimestamp(str));
1752
+ }
1753
+ function stringifyDate(value) {
1754
+ return value.toISOString();
1755
+ }
1756
+
1757
+ // src/error/parsingError.ts
1758
+ function throwParsingError(message) {
1759
+ throw new ValidationError(message, ErrorOrigin.PARSING);
1760
+ }
1761
+
1762
+ // src/media/ratio.ts
1763
+ var ratioRegExp = /^([0-9]*):([0-9]*)$/;
1764
+ function parseRatio(str) {
1765
+ const match = str ? ratioRegExp.exec(str) : null;
1766
+ if (!match) throwParsingError(`invalid ratio format: ${str}`);
1767
+ return [parseInt(match[1] || "1"), parseInt(match[2] || "1")];
1768
+ }
1769
+ function stringifyRatio(value) {
1770
+ return `${value[0]}:${value[1]}`;
1771
+ }
1772
+
1773
+ // src/media/frameRate.ts
1774
+ var framerateRegexp = /^(\d+)(?:\/(\d+))?$/;
1775
+ function parseFrameRate(str) {
1776
+ const match = str ? framerateRegexp.exec(str) : null;
1777
+ if (!match) throwParsingError(`invalid frame rate: '${str}'`);
1778
+ return [parseInt(match[1]), parseInt(match[2] || "1")];
1779
+ }
1780
+ function stringifyFrameRate(value) {
1781
+ return value[1] === 1 ? value[0].toString() : `${value[0]}/${value[1]}`;
1782
+ }
1783
+
1784
+ // src/media/byteRange.ts
1785
+ var byteRangeExp = /^(-?[0-9]+)-(-?[0-9]*)$/;
1786
+ function parseByteRange(str) {
1787
+ const match = str ? byteRangeExp.exec(str) : null;
1788
+ if (!match) throwParsingError(`invalid byte range: '${str}'`);
1789
+ let start = parseInt(match[1]);
1790
+ if (start < 0) start >>>= 0;
1791
+ let end = parseIntSafe(match[2]);
1792
+ if (end != null && end < 0) end = end >>> 0;
1793
+ return [start, end];
1794
+ }
1795
+ function stringifyByteRange(value) {
1796
+ const end = value[1];
1797
+ return `${value[0]}-${end == null ? "" : end}`;
1798
+ }
1799
+
1800
+ // ../vinyl-validation/dist/index.js
1801
+ var __defProp4 = Object.defineProperty;
1802
+ var __defProps3 = Object.defineProperties;
1803
+ var __getOwnPropDescs3 = Object.getOwnPropertyDescriptors;
1804
+ var __getOwnPropSymbols4 = Object.getOwnPropertySymbols;
1805
+ var __hasOwnProp4 = Object.prototype.hasOwnProperty;
1806
+ var __propIsEnum4 = Object.prototype.propertyIsEnumerable;
1807
+ var __defNormalProp4 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1808
+ var __spreadValues4 = (a, b) => {
1809
+ for (var prop in b || (b = {}))
1810
+ if (__hasOwnProp4.call(b, prop))
1811
+ __defNormalProp4(a, prop, b[prop]);
1812
+ if (__getOwnPropSymbols4)
1813
+ for (var prop of __getOwnPropSymbols4(b)) {
1814
+ if (__propIsEnum4.call(b, prop))
1815
+ __defNormalProp4(a, prop, b[prop]);
1816
+ }
1817
+ return a;
1818
+ };
1819
+ var __spreadProps3 = (a, b) => __defProps3(a, __getOwnPropDescs3(b));
1820
+ var __publicField3 = (obj, key, value) => __defNormalProp4(obj, typeof key !== "symbol" ? key + "" : key, value);
1821
+ var validatorLocale = {
1822
+ /**
1823
+ * The expectation template string with the following replacement tokens:
1824
+ *
1825
+ * `{expected}` - The expected description.
1826
+ * `{actual}` - The actual value.
1827
+ * `{path}` - The path, dot separated.
1828
+ */
1829
+ template: "Expected: {expected}, but was: {actual}. At: {path}"
1830
+ };
1831
+ function createValidationExpectationMessage(expectationMessage, input, path, inputStringify = (input2) => stringifyForPrint(input2, 500)) {
1832
+ return substitute(validatorLocale.template, {
1833
+ expected: expectationMessage,
1834
+ actual: inputStringify(input),
1835
+ path: path.join(".")
1836
+ });
1837
+ }
1838
+ function createValidator(expectationMessage, isValid, inputStringify = (input) => stringifyForPrint(input, 500)) {
1839
+ return {
1840
+ description: expectationMessage,
1841
+ isValid(input) {
1842
+ return isValid(input);
1843
+ },
1844
+ validate(input, _, path = []) {
1845
+ if (!isValid(input)) {
1846
+ return [
1847
+ {
1848
+ message: createValidationExpectationMessage(
1849
+ expectationMessage,
1850
+ input,
1851
+ path,
1852
+ inputStringify
1853
+ ),
1854
+ path
1855
+ }
1856
+ ];
1857
+ }
1858
+ return [];
1859
+ },
1860
+ assert: (input, origin, path = []) => {
1861
+ if (!isValid(input)) {
1862
+ throw new ValidationError(
1863
+ createValidationExpectationMessage(
1864
+ expectationMessage,
1865
+ input,
1866
+ path,
1867
+ inputStringify
1868
+ ),
1869
+ origin,
1870
+ path
1871
+ );
1872
+ }
1873
+ }
1874
+ };
1875
+ }
1876
+ function createDeepValidator(description, validate) {
1877
+ return {
1878
+ description,
1879
+ isValid(input) {
1880
+ return validate(input, { all: false }, []).length === 0;
1881
+ },
1882
+ validate(input, options, path = []) {
1883
+ return validate(input, options != null ? options : { all: false }, path);
1884
+ },
1885
+ assert: (input, origin, path = []) => {
1886
+ const errors = validate(input, { all: false }, path);
1887
+ if (errors.length) {
1888
+ const error = errors[0];
1889
+ throw new ValidationError(error.message, origin, error.path);
1890
+ }
1891
+ }
1892
+ };
1893
+ }
1894
+ var locale5 = {
1895
+ /**
1896
+ * {value} The child validators' descriptions, joined with `separator`.
1897
+ *
1898
+ * groupings of and validators is unimportant,
1899
+ * and(and(a, b), c) is the same as and(a, and(b, c)), so `a & b & c` is an accurate
1900
+ * representation for either.
1901
+ */
1902
+ template: "{value}",
1903
+ /**
1904
+ * The separator with which to join child validator descriptions.
1905
+ */
1906
+ separator: " & "
1907
+ };
1908
+ function andValidators(...validators) {
1909
+ return createDeepValidator(
1910
+ substitute(locale5.template, {
1911
+ value: validators.map((v) => v.description).join(locale5.separator)
1912
+ }),
1913
+ (input, options, path) => {
1914
+ for (const validator of validators) {
1915
+ const errors = validator.validate(input, options, path);
1916
+ if (errors.length) return errors;
1917
+ }
1918
+ return [];
1919
+ }
1920
+ );
1921
+ }
1922
+ var locale22 = {
1923
+ /**
1924
+ * {value} - The child validators' descriptions, joined with `separator`.
1925
+ */
1926
+ template: "({value})",
1927
+ /**
1928
+ * The separator with which to join child validator descriptions.
1929
+ */
1930
+ separator: " | "
1931
+ };
1932
+ function orValidators(...validators) {
1933
+ const description = substitute(locale22.template, {
1934
+ value: validators.map((v) => v.description).join(locale22.separator)
1935
+ });
1936
+ return createDeepValidator(description, (input, options, path) => {
1937
+ let longestErrors = [];
1938
+ let longestPath = 0;
1939
+ for (const validator of validators) {
1940
+ const errors = validator.validate(input, options, path);
1941
+ if (!errors.length) return errors;
1942
+ const pathLength = errors.reduce(
1943
+ (max, m) => Math.max(m.path.length, max),
1944
+ 0
1945
+ );
1946
+ if (pathLength >= longestPath) {
1947
+ longestErrors = errors;
1948
+ longestPath = pathLength;
1949
+ }
1950
+ }
1951
+ return longestPath > path.length ? longestErrors : [
1952
+ {
1953
+ message: createValidationExpectationMessage(
1954
+ description,
1955
+ input,
1956
+ path
1957
+ ),
1958
+ path
1959
+ }
1960
+ ];
1961
+ });
1962
+ }
1963
+ var requiredValidationOptions = {
1964
+ optional: false
1965
+ };
1966
+ var SchemaBase = class {
1967
+ constructor(currentValidator, previousSchema, operation) {
1968
+ this.currentValidator = currentValidator;
1969
+ this.previousSchema = previousSchema;
1970
+ this.operation = operation;
1971
+ __publicField3(this, "__type", /* @__PURE__ */ invariant());
1972
+ __publicField3(this, "validator");
1973
+ __publicField3(this, "_options", requiredValidationOptions);
1974
+ __publicField3(this, "assert", (input, origin, path) => {
1975
+ this.validator.assert(input, origin, path);
1976
+ });
1977
+ __publicField3(this, "isValid", (input) => this.validator.isValid(input));
1978
+ __publicField3(this, "validate", (input, options, path) => this.validator.validate(input, options, path));
1979
+ this.validator = operation == null ? currentValidator : operation(previousSchema, currentValidator);
1980
+ }
1981
+ get options() {
1982
+ return this._options;
1983
+ }
1984
+ get description() {
1985
+ return this.validator.description;
1986
+ }
1987
+ /**
1988
+ * Clones this schema, transforming all validators with the given mutator.
1989
+ *
1990
+ * @param transform A transformer which takes an existing validator in the chain and returns
1991
+ * a new one. Validators should be considered to be immutable; transform should not change the
1992
+ * input but instead return a new validator.
1993
+ */
1994
+ clone(transform = (v) => v) {
1995
+ const cloned = this.operation ? this.self(
1996
+ transform(this.currentValidator),
1997
+ this.previousSchema.clone(transform),
1998
+ this.operation
1999
+ ) : this.self(transform(this.currentValidator));
2000
+ cloned._options = this._options;
2001
+ return cloned;
2002
+ }
2003
+ self(current, previous, operation) {
2004
+ if (this.constructor.length > 3) {
2005
+ throw new IllegalArgumentError(
2006
+ "constructor should have at most three required arguments"
2007
+ );
2008
+ }
2009
+ return new this.constructor(current, previous, operation);
2010
+ }
2011
+ /**
2012
+ * Constructs a new schema with a validator chaining the current validator with the
2013
+ * provided next in an AND operation.
2014
+ *
2015
+ * @param nextValidator The validator to run after the current.
2016
+ * @return Returns a new Schema instance the same class with a new validator chaining the
2017
+ * current validator with the given next in an AND operation.
2018
+ */
2019
+ chain(nextValidator) {
2020
+ return this.self(nextValidator, this, andValidators);
2021
+ }
2022
+ optional() {
2023
+ const cloned = this.clone();
2024
+ cloned._options = __spreadProps3(__spreadValues4({}, cloned.options), {
2025
+ optional: true
2026
+ });
2027
+ return cloned;
2028
+ }
2029
+ required() {
2030
+ const cloned = this.clone();
2031
+ cloned._options = __spreadProps3(__spreadValues4({}, cloned.options), {
2032
+ optional: false
2033
+ });
2034
+ return cloned;
2035
+ }
2036
+ };
2037
+ var locale32 = {
2038
+ null: "null",
2039
+ nullish: "nullish",
2040
+ undefined: "undefined"
2041
+ };
2042
+ var valueValidators = {
2043
+ any() {
2044
+ return createValidator("", () => true);
2045
+ },
2046
+ /**
2047
+ * Creates a validator that asserts that the input is nullish.
2048
+ */
2049
+ nullish() {
2050
+ return createValidator(locale32.nullish, (input) => input == null);
2051
+ },
2052
+ /**
2053
+ * Creates a validator that asserts that the input is strictly null.
2054
+ */
2055
+ null() {
2056
+ return createValidator(locale32.null, (input) => input === null);
2057
+ },
2058
+ /**
2059
+ * Creates a validator that asserts that the input is strictly undefined.
2060
+ */
2061
+ undefined() {
2062
+ return createValidator(locale32.undefined, (input) => input === void 0);
2063
+ }
2064
+ };
2065
+ var ValueSchema = class _ValueSchema extends SchemaBase {
2066
+ /**
2067
+ * Prepends this validator allowing for null or undefined.
2068
+ */
2069
+ maybe() {
2070
+ return this.or(valueValidators.nullish());
2071
+ }
2072
+ /**
2073
+ * Prepends this validator allowing for null.
2074
+ */
2075
+ orNull() {
2076
+ return this.or(valueValidators.null());
2077
+ }
2078
+ /**
2079
+ * Prepends this validator allowing for undefined.
2080
+ */
2081
+ orUndefined() {
2082
+ return this.or(valueValidators.undefined());
2083
+ }
2084
+ /**
2085
+ * Returns a validator that asserts if this validator and the next passes.
2086
+ *
2087
+ * @see andValidators
2088
+ *
2089
+ * @param nextValidator The validator to run after the current.
2090
+ * @return Returns a new ValueSchema intersecting this validator and the next.
2091
+ */
2092
+ and(nextValidator) {
2093
+ return new _ValueSchema(nextValidator, this, andValidators);
2094
+ }
2095
+ /**
2096
+ * Returns a validator that asserts if this validator or the next passes.
2097
+ *
2098
+ * Implementation note:
2099
+ * subclasses should not change the schema instance returned unless all chainable validators
2100
+ * accept input type 'unknown'.
2101
+ *
2102
+ * @param nextValidator The validator to run after the current.
2103
+ * @return Returns a new ValueSchema providing the union of this validator and the next.
2104
+ */
2105
+ or(nextValidator) {
2106
+ return new _ValueSchema(nextValidator, this, orValidators);
2107
+ }
2108
+ };
2109
+ var locale42 = {
2110
+ array: "array",
2111
+ minLength: "at least {value} elements",
2112
+ maxLength: "at most {value} elements",
2113
+ exactlyLength: "exactly {value} elements",
2114
+ actualLength: "length {value}",
2115
+ withElements: "({value})[]",
2116
+ tuple: "[{value}]"
2117
+ };
2118
+ var arrayValidators = {
2119
+ /**
2120
+ * Creates a validator that asserts that the input is an array.
2121
+ *
2122
+ * Note: arrays can only be readonly by type system, there is no native readonly
2123
+ * js array. This validator assumes mutability, use the ArraySchema readonly() method
2124
+ * to cast to a readonly array.
2125
+ */
2126
+ isArray() {
2127
+ return createValidator(
2128
+ locale42.array,
2129
+ (input) => Array.isArray(input)
2130
+ );
2131
+ },
2132
+ /**
2133
+ * Creates a validator that asserts that every element passes the given validator.
2134
+ *
2135
+ * @param elementValidator
2136
+ */
2137
+ withElements(elementValidator) {
2138
+ return createDeepValidator(
2139
+ substitute(locale42.withElements, {
2140
+ value: elementValidator.description
2141
+ }),
2142
+ (input, options, path) => {
2143
+ const errors = [];
2144
+ for (let i = 0; i < input.length; i++) {
2145
+ const element2 = input[i];
2146
+ errors.push(
2147
+ ...elementValidator.validate(
2148
+ element2,
2149
+ options,
2150
+ path.concat(i.toString())
2151
+ )
2152
+ );
2153
+ if (!options.all && errors.length) return errors;
2154
+ }
2155
+ return errors;
2156
+ }
2157
+ );
2158
+ },
2159
+ /**
2160
+ * Creates a validator that asserts that the input array is a tuple whose elements match
2161
+ * the given validators.
2162
+ *
2163
+ * @param validators
2164
+ */
2165
+ tuple(...validators) {
2166
+ const lengthValidator = createValidator(
2167
+ substitute(locale42.exactlyLength, {
2168
+ value: validators.length
2169
+ }),
2170
+ (length) => length === validators.length
2171
+ );
2172
+ return createDeepValidator(
2173
+ substitute(locale42.tuple, { value: validators.join(", ") }),
2174
+ (input, options, path) => {
2175
+ const errors = [];
2176
+ errors.push(
2177
+ ...lengthValidator.validate(input.length, options, path)
2178
+ );
2179
+ if (!options.all && errors.length) return errors;
2180
+ const n = Math.min(validators.length, input.length);
2181
+ for (let i = 0; i < n; i++) {
2182
+ const element2 = input[i];
2183
+ const validator = validators[i];
2184
+ errors.push(
2185
+ ...validator.validate(
2186
+ element2,
2187
+ options,
2188
+ path.concat(i.toString())
2189
+ )
2190
+ );
2191
+ if (!options.all && errors.length) return errors;
2192
+ }
2193
+ return errors;
2194
+ }
2195
+ );
2196
+ },
2197
+ /**
2198
+ * Creates a validator that validates the input array has the given minimum length.
2199
+ * @param min The minimum number of elements (inclusive)
2200
+ */
2201
+ minLength(min) {
2202
+ return createValidator(
2203
+ substitute(locale42.minLength, { value: min }),
2204
+ (input) => input.length >= min,
2205
+ (input) => substitute(locale42.actualLength, { value: input.length })
2206
+ );
2207
+ },
2208
+ /**
2209
+ *
2210
+ * Creates a validator that validates the input array has the given maximum length.
2211
+ * @param max The maximum number of elements (inclusive)
2212
+ */
2213
+ maxLength(max) {
2214
+ return createValidator(
2215
+ substitute(locale42.maxLength, { value: max }),
2216
+ (input) => input.length <= max,
2217
+ (input) => substitute(locale42.actualLength, { value: input.length })
2218
+ );
2219
+ }
2220
+ };
2221
+ var _ArraySchema = class _ArraySchema2 extends ValueSchema {
2222
+ /**
2223
+ * The base ArraySchema instance validating that the input is an Array.
2224
+ */
2225
+ static get base() {
2226
+ if (this._base == null)
2227
+ this._base = new _ArraySchema2(arrayValidators.isArray());
2228
+ return this._base;
2229
+ }
2230
+ /**
2231
+ * Creates a validator that asserts that every element passes the given validator.
2232
+ *
2233
+ * @param elementValidator
2234
+ */
2235
+ withElements(elementValidator) {
2236
+ return this.chain(arrayValidators.withElements(elementValidator));
2237
+ }
2238
+ /**
2239
+ * Creates a validator that asserts that the input array is a tuple whose elements match
2240
+ * the given validators.
2241
+ *
2242
+ * @param validators
2243
+ */
2244
+ tuple(...validators) {
2245
+ return this.chain(arrayValidators.tuple(...validators));
2246
+ }
2247
+ /**
2248
+ * Creates a validator that validates the input array has the given minimum length.
2249
+ * @param min The minimum number of elements (inclusive)
2250
+ */
2251
+ minLength(min) {
2252
+ return this.chain(arrayValidators.minLength(min));
2253
+ }
2254
+ /**
2255
+ *
2256
+ * Creates a validator that validates the input array has the given maximum length.
2257
+ * @param max The maximum number of elements (inclusive)
2258
+ */
2259
+ maxLength(max) {
2260
+ return this.chain(arrayValidators.maxLength(max));
2261
+ }
2262
+ /**
2263
+ * Casts to a readonly array.
2264
+ * This is a shallow cast, elements of the array will not be changed.
2265
+ */
2266
+ readonly() {
2267
+ return this;
2268
+ }
2269
+ /**
2270
+ * Casts the type parameter.
2271
+ */
2272
+ cast() {
2273
+ return this;
2274
+ }
2275
+ };
2276
+ __publicField3(_ArraySchema, "_base", null);
2277
+ var locale52 = {
2278
+ template: "type {value}"
2279
+ };
2280
+ function typeOfValidator(expected) {
2281
+ return createValidator(
2282
+ substitute(locale52.template, { value: expected }),
2283
+ (input) => {
2284
+ return input != null && typeof input === expected;
2285
+ }
2286
+ );
2287
+ }
2288
+ var typeOfValidatorCache = {};
2289
+ function cachedTypeOfValidator(type) {
2290
+ if (!(type in typeOfValidatorCache)) {
2291
+ typeOfValidatorCache[type] = typeOfValidator(type);
2292
+ }
2293
+ return typeOfValidatorCache[type];
2294
+ }
2295
+ var typeOfValidators = {
2296
+ get boolean() {
2297
+ return cachedTypeOfValidator("boolean");
2298
+ },
2299
+ get func() {
2300
+ return cachedTypeOfValidator("function");
2301
+ },
2302
+ get number() {
2303
+ return cachedTypeOfValidator("number");
2304
+ },
2305
+ get object() {
2306
+ return cachedTypeOfValidator("object");
2307
+ },
2308
+ get string() {
2309
+ return cachedTypeOfValidator("string");
2310
+ },
2311
+ get symbol() {
2312
+ return cachedTypeOfValidator("symbol");
2313
+ }
2314
+ };
2315
+ var locale6 = {
2316
+ length: "at most {value} arguments",
2317
+ actualLength: "{value} arguments"
2318
+ };
2319
+ var functionValidators = {
2320
+ length(max) {
2321
+ return createValidator(
2322
+ substitute(locale6.length, { value: max }),
2323
+ (input) => input.length <= max,
2324
+ (input) => substitute(locale6.actualLength, { value: input.length })
2325
+ );
2326
+ }
2327
+ };
2328
+ var _FunctionSchema = class _FunctionSchema2 extends ValueSchema {
2329
+ /**
2330
+ * The base Function validator validating that the input is a function.
2331
+ */
2332
+ static get base() {
2333
+ if (this._base == null)
2334
+ this._base = new _FunctionSchema2(typeOfValidators.func);
2335
+ return this._base;
2336
+ }
2337
+ length(max) {
2338
+ return this.chain(functionValidators.length(max));
2339
+ }
2340
+ /**
2341
+ * Casts the function signature.
2342
+ * Function signatures, except for their required number of parameters, cannot be
2343
+ * meaningfully validated.
2344
+ */
2345
+ cast() {
2346
+ return this;
2347
+ }
2348
+ };
2349
+ __publicField3(_FunctionSchema, "_base", null);
2350
+ var locale7 = {
2351
+ set: "Set",
2352
+ withElements: "Set<{value}>"
2353
+ };
2354
+ var setValidators = {
2355
+ /**
2356
+ * Creates a validator that asserts that the input is a set.
2357
+ */
2358
+ isSet() {
2359
+ return createValidator(
2360
+ locale7.set,
2361
+ (input) => input instanceof Set
2362
+ );
2363
+ },
2364
+ /**
2365
+ * Creates a validator that asserts that every element passes the given validator.
2366
+ *
2367
+ * @param elementValidator
2368
+ */
2369
+ withElements(elementValidator) {
2370
+ return createDeepValidator(
2371
+ substitute(locale7.withElements, {
2372
+ value: elementValidator.description
2373
+ }),
2374
+ (input, options, path) => {
2375
+ const errors = [];
2376
+ let i = 0;
2377
+ for (const element2 of input) {
2378
+ errors.push(
2379
+ ...elementValidator.validate(
2380
+ element2,
2381
+ options,
2382
+ path.concat(i.toString())
2383
+ )
2384
+ );
2385
+ if (!options.all && errors.length) return errors;
2386
+ i++;
2387
+ }
2388
+ return errors;
2389
+ }
2390
+ );
2391
+ }
2392
+ };
2393
+ var _SetSchema = class _SetSchema2 extends ValueSchema {
2394
+ /**
2395
+ * The base SetSchema instance validating that the input is a Set.
2396
+ */
2397
+ static get base() {
2398
+ if (this._base == null)
2399
+ this._base = new _SetSchema2(setValidators.isSet());
2400
+ return this._base;
2401
+ }
2402
+ /**
2403
+ * Creates a validator that asserts that every element passes the given validator.
2404
+ *
2405
+ * @param elementValidator
2406
+ */
2407
+ withElements(elementValidator) {
2408
+ return this.chain(setValidators.withElements(elementValidator));
2409
+ }
2410
+ /**
2411
+ * Casts to a readonly set.
2412
+ * This is a shallow cast, elements of the array will not be changed.
2413
+ */
2414
+ readonly() {
2415
+ return this;
2416
+ }
2417
+ /**
2418
+ * Casts the parameter type.
2419
+ */
2420
+ cast() {
2421
+ return this;
2422
+ }
2423
+ };
2424
+ __publicField3(_SetSchema, "_base", null);
2425
+ var locale8 = {
2426
+ gte: "at least {value}",
2427
+ gt: "greater than {value}",
2428
+ lte: "at most {value}",
2429
+ lt: "less than {value}",
2430
+ within: "within {min} and {max}",
2431
+ safeInteger: "safe integer",
2432
+ finite: "finite"
2433
+ };
2434
+ var numberValidators = {
2435
+ /**
2436
+ * Creates a validator that asserts that the input number is at least the provided minimum
2437
+ * value.
2438
+ *
2439
+ * @param min The minimum (inclusive) the value may be.
2440
+ */
2441
+ gte(min) {
2442
+ return createValidator(
2443
+ substitute(locale8.gte, { value: min }),
2444
+ (input) => input >= min
2445
+ );
2446
+ },
2447
+ /**
2448
+ * Creates a validator that asserts that the input number is greater than the provided minimum
2449
+ * value.
2450
+ *
2451
+ * @param min The minimum (exclusive) the value may be.
2452
+ */
2453
+ gt(min) {
2454
+ return createValidator(
2455
+ substitute(locale8.gt, { value: min }),
2456
+ (input) => input > min
2457
+ );
2458
+ },
2459
+ /**
2460
+ * Creates a validator that asserts that the input number is at most the provided maximum
2461
+ * value.
2462
+ *
2463
+ * @param max The maximum (inclusive) the value may be.
2464
+ */
2465
+ lte(max) {
2466
+ return createValidator(
2467
+ substitute(locale8.lte, { value: max }),
2468
+ (input) => input <= max
2469
+ );
2470
+ },
2471
+ /**
2472
+ * Creates a validator that asserts that the input number is less than the provided maximum
2473
+ * value.
2474
+ *
2475
+ * @param max The maximum (exclusive) the value may be.
2476
+ */
2477
+ lt(max) {
2478
+ return createValidator(
2479
+ substitute(locale8.lt, { value: max }),
2480
+ (input) => input < max
2481
+ );
2482
+ },
2483
+ /**
2484
+ * Creates a validator that asserts that the input number is at least the provided minimum
2485
+ * and at most the provided maximum values.
2486
+ *
2487
+ * @param min The minimum (inclusive) value the input may be.
2488
+ * @param max The maximum (inclusive) value the input may be.
2489
+ */
2490
+ within(min, max) {
2491
+ return createValidator(
2492
+ substitute(locale8.within, { min, max }),
2493
+ (input) => input >= min && input <= max
2494
+ );
2495
+ },
2496
+ /**
2497
+ * Creates a validator that asserts that the input number is finite.
2498
+ */
2499
+ finite() {
2500
+ return createValidator(locale8.finite, (input) => Number.isFinite(input));
2501
+ },
2502
+ /**
2503
+ * Creates a validator that asserts that the input number is a safe integer.
2504
+ */
2505
+ safeInteger() {
2506
+ return createValidator(
2507
+ locale8.safeInteger,
2508
+ (input) => Number.isSafeInteger(input)
2509
+ );
2510
+ }
2511
+ };
2512
+ var _NumberSchema = class _NumberSchema2 extends ValueSchema {
2513
+ /**
2514
+ * The base Object validator validating that the input is an object.
2515
+ */
2516
+ static get base() {
2517
+ if (this._base == null)
2518
+ this._base = new _NumberSchema2(typeOfValidators.number);
2519
+ return this._base;
2520
+ }
2521
+ /**
2522
+ * Creates a validator that asserts that the input number is at least the provided minimum
2523
+ * value.
2524
+ *
2525
+ * @param min The minimum (inclusive) the value may be.
2526
+ */
2527
+ gte(min) {
2528
+ return this.chain(numberValidators.gte(min));
2529
+ }
2530
+ /**
2531
+ * Creates a validator that asserts that the input number is greater than the provided minimum
2532
+ * value.
2533
+ *
2534
+ * @param min The minimum (exclusive) the value may be.
2535
+ */
2536
+ gt(min) {
2537
+ return this.chain(numberValidators.gt(min));
2538
+ }
2539
+ /**
2540
+ * Creates a validator that asserts that the input number is at most the provided maximum
2541
+ * value.
2542
+ *
2543
+ * @param max The maximum (inclusive) the value may be.
2544
+ */
2545
+ lte(max) {
2546
+ return this.chain(numberValidators.lte(max));
2547
+ }
2548
+ /**
2549
+ * Creates a validator that asserts that the input number is less than the provided maximum
2550
+ * value.
2551
+ *
2552
+ * @param max The maximum (exclusive) the value may be.
2553
+ */
2554
+ lt(max) {
2555
+ return this.chain(numberValidators.lt(max));
2556
+ }
2557
+ /**
2558
+ * Creates a validator that asserts that the input number is at least the provided minimum
2559
+ * and at most the provided maximum values.
2560
+ *
2561
+ * @param min The minimum (inclusive) value the input may be.
2562
+ * @param max The maximum (inclusive) value the input may be.
2563
+ */
2564
+ within(min, max) {
2565
+ return this.chain(numberValidators.within(min, max));
2566
+ }
2567
+ /**
2568
+ * Creates a validator that asserts that the input number is finite.
2569
+ */
2570
+ finite() {
2571
+ return this.chain(numberValidators.finite());
2572
+ }
2573
+ /**
2574
+ * Creates a validator that asserts that the input number is a safe integer.
2575
+ */
2576
+ safeInteger() {
2577
+ return this.chain(numberValidators.safeInteger());
2578
+ }
2579
+ };
2580
+ __publicField3(_NumberSchema, "_base", null);
2581
+ var NumberSchema = _NumberSchema;
2582
+ function isValidatorWithPartial(validator) {
2583
+ return "partial" in validator && "partialDeep" in validator;
2584
+ }
2585
+ function maybeToDeepPartial(validator) {
2586
+ return isValidatorWithPartial(validator) ? validator.partialDeep() : validator;
2587
+ }
2588
+ function maybeToPartial(validator) {
2589
+ return isValidatorWithPartial(validator) ? validator.partial() : validator;
2590
+ }
2591
+ var locale9 = {
2592
+ extend: "{\n{body}\n}",
2593
+ prop: "{key}: {value}",
2594
+ propSeparator: ",\n",
2595
+ indent: " ",
2596
+ required: `property '{key}' is required`
2597
+ };
2598
+ var objectValidators = {
2599
+ /**
2600
+ * Creates a validator that validates the input has properties that pass their respective
2601
+ * validators.
2602
+ *
2603
+ * @param propertyValidators
2604
+ */
2605
+ properties(propertyValidators) {
2606
+ const propertiesDescriptions = [];
2607
+ const keys = ownKeys(propertyValidators);
2608
+ for (const key of keys) {
2609
+ const validator2 = propertyValidators[key];
2610
+ propertiesDescriptions.push(
2611
+ substitute(locale9.prop, {
2612
+ key: String(key) + (validator2.options.optional ? "?" : ""),
2613
+ value: validator2.description
2614
+ })
2615
+ );
2616
+ }
2617
+ const description = substitute(locale9.extend, {
2618
+ body: propertiesDescriptions.join(locale9.propSeparator).split("\n").map((line) => locale9.indent + line).join("\n")
2619
+ });
2620
+ const validator = createDeepValidator(
2621
+ description,
2622
+ (input, options, path) => {
2623
+ const errors = [];
2624
+ for (const key of keys) {
2625
+ const validator2 = propertyValidators[key];
2626
+ if (key in input) {
2627
+ const value = input[key];
2628
+ errors.push(
2629
+ ...validator2.validate(
2630
+ value,
2631
+ options,
2632
+ path.concat(String(key))
2633
+ )
2634
+ );
2635
+ } else {
2636
+ if (!validator2.options.optional) {
2637
+ errors.push({
2638
+ message: substitute(locale9.required, { key }),
2639
+ path: path.concat(String(key))
2640
+ });
2641
+ }
2642
+ }
2643
+ if (!options.all && errors.length) return errors;
2644
+ }
2645
+ return errors;
2646
+ }
2647
+ );
2648
+ return merge(validator, {
2649
+ partial() {
2650
+ const optionalPropertyValidators = {};
2651
+ for (const key of keys) {
2652
+ optionalPropertyValidators[key] = propertyValidators[key].optional();
2653
+ }
2654
+ return objectValidators.properties(
2655
+ optionalPropertyValidators
2656
+ );
2657
+ },
2658
+ partialDeep() {
2659
+ const optionalPropertyValidators = {};
2660
+ for (const key of keys) {
2661
+ optionalPropertyValidators[key] = maybeToDeepPartial(
2662
+ propertyValidators[key].optional()
2663
+ );
2664
+ }
2665
+ return objectValidators.properties(
2666
+ optionalPropertyValidators
2667
+ );
2668
+ }
2669
+ });
2670
+ }
2671
+ };
2672
+ var _ObjectSchema = class _ObjectSchema2 extends ValueSchema {
2673
+ /**
2674
+ * The base Object validator validating that the input is an object.
2675
+ */
2676
+ static get base() {
2677
+ if (this._base == null)
2678
+ this._base = new _ObjectSchema2(typeOfValidators.object);
2679
+ return this._base;
2680
+ }
2681
+ /**
2682
+ * Creates a validator that validates the input has properties that pass their respective
2683
+ * validators.
2684
+ *
2685
+ * @param propertyValidators
2686
+ */
2687
+ extend(propertyValidators) {
2688
+ return this.chain(objectValidators.properties(propertyValidators));
2689
+ }
2690
+ /**
2691
+ * Allows all properties to be undefined.
2692
+ */
2693
+ partial() {
2694
+ return this.clone(maybeToPartial);
2695
+ }
2696
+ /**
2697
+ * Allows all recursive properties to be undefined.
2698
+ */
2699
+ partialDeep() {
2700
+ return this.clone(maybeToDeepPartial);
2701
+ }
2702
+ /**
2703
+ * Casts the type parameter.
2704
+ */
2705
+ cast() {
2706
+ return this;
2707
+ }
2708
+ };
2709
+ __publicField3(_ObjectSchema, "_base", null);
2710
+ var locale10 = {
2711
+ notEmpty: "not empty",
2712
+ minLength: "at least {value} characters",
2713
+ maxLength: "at most {value} characters",
2714
+ noWhitespace: "no whitespace characters",
2715
+ matches: "matches {value}"
2716
+ };
2717
+ var stringValidators = {
2718
+ /**
2719
+ * Creates a validator that asserts that the input is not empty.
2720
+ */
2721
+ notEmpty() {
2722
+ return createValidator(locale10.notEmpty, (input) => input !== "");
2723
+ },
2724
+ /**
2725
+ * Creates a validator that asserts that the input string has at least the given minimum
2726
+ * length.
2727
+ *
2728
+ * @param min The string must be at least this length.
2729
+ */
2730
+ minLength(min) {
2731
+ return createValidator(
2732
+ substitute(locale10.minLength, { value: min }),
2733
+ (input) => input.length >= min
2734
+ );
2735
+ },
2736
+ /**
2737
+ * Creates a validator that asserts that the input string has at most the given maximum
2738
+ * length.
2739
+ *
2740
+ * @param max The string must be at most this length.
2741
+ */
2742
+ maxLength(max) {
2743
+ return createValidator(
2744
+ substitute(locale10.maxLength, { value: max }),
2745
+ (input) => input.length <= max
2746
+ );
2747
+ },
2748
+ /**
2749
+ * Creates a validator that asserts that the input string has no whitespace characters.
2750
+ * Whitespace characters include space, new line, carriage return, and tab.
2751
+ */
2752
+ noWhitespace() {
2753
+ return createValidator(
2754
+ locale10.noWhitespace,
2755
+ (input) => input.search(/\s/g) === -1
2756
+ );
2757
+ },
2758
+ /**
2759
+ * Creates a validator that asserts that the input string matches the given regex.
2760
+ * @param regex
2761
+ */
2762
+ matches(regex) {
2763
+ return createValidator(
2764
+ substitute(locale10.matches, { value: regex.toString() }),
2765
+ (input) => {
2766
+ return regex.test(input);
2767
+ }
2768
+ );
2769
+ }
2770
+ };
2771
+ var _StringSchema = class _StringSchema2 extends ValueSchema {
2772
+ /**
2773
+ * The base SetSchema instance validating that the input is a Set.
2774
+ */
2775
+ static get base() {
2776
+ if (this._base == null)
2777
+ this._base = new _StringSchema2(typeOfValidators.string);
2778
+ return this._base;
2779
+ }
2780
+ /**
2781
+ * Creates a validator that asserts that the input is not empty.
2782
+ */
2783
+ notEmpty() {
2784
+ return this.chain(stringValidators.notEmpty());
2785
+ }
2786
+ /**
2787
+ * Creates a validator that asserts that the input string has at least the given minimum
2788
+ * length.
2789
+ *
2790
+ * @param min The string must be at least this length.
2791
+ */
2792
+ minLength(min) {
2793
+ return this.chain(stringValidators.minLength(min));
2794
+ }
2795
+ /**
2796
+ * Creates a validator that asserts that the input string has at most the given maximum
2797
+ * length.
2798
+ *
2799
+ * @param max The string must be at most this length.
2800
+ */
2801
+ maxLength(max) {
2802
+ return this.chain(stringValidators.maxLength(max));
2803
+ }
2804
+ /**
2805
+ * Creates a validator that asserts that the input string has no whitespace characters.
2806
+ * Whitespace characters include space, new line, carriage return, and tab.
2807
+ */
2808
+ noWhitespace() {
2809
+ return this.chain(stringValidators.noWhitespace());
2810
+ }
2811
+ /**
2812
+ * Creates a validator that asserts that the input string matches the given regex.
2813
+ * @param regex
2814
+ */
2815
+ matches(regex) {
2816
+ return this.chain(stringValidators.matches(regex));
2817
+ }
2818
+ };
2819
+ __publicField3(_StringSchema, "_base", null);
2820
+ var StringSchema = _StringSchema;
2821
+ var locale11 = {
2822
+ record: "{ [key: {key}]: {value} }"
2823
+ };
2824
+ var recordValidators = {
2825
+ /**
2826
+ * Returns a validator that asserts that the object's own enumerable properties has keys and
2827
+ * values that match their respective validators.
2828
+ *
2829
+ * Prototype members are not included.
2830
+ * Numeric keys are validated as strings. For example the object `{ [0]: 1 }` will be passed
2831
+ * to the key validator as '0'.
2832
+ *
2833
+ * @param keyValidator Validates each key.
2834
+ * @param valueValidator Validates each value.
2835
+ */
2836
+ record(keyValidator, valueValidator) {
2837
+ return createDeepValidator(
2838
+ substitute(locale11.record, {
2839
+ key: keyValidator.description,
2840
+ value: valueValidator.description
2841
+ }),
2842
+ (input, options, path) => {
2843
+ const errors = [];
2844
+ for (const key of ownKeys(input)) {
2845
+ const keyStr = String(key);
2846
+ errors.push(
2847
+ ...keyValidator.validate(
2848
+ key,
2849
+ options,
2850
+ path.concat(`[${keyStr}]`)
2851
+ )
2852
+ );
2853
+ if (!options.all && errors.length) return errors;
2854
+ const value = input[key];
2855
+ errors.push(
2856
+ ...valueValidator.validate(
2857
+ value,
2858
+ options,
2859
+ path.concat(keyStr)
2860
+ )
2861
+ );
2862
+ if (!options.all && errors.length) return errors;
2863
+ }
2864
+ return errors;
2865
+ }
2866
+ );
2867
+ }
2868
+ };
2869
+ var _RecordSchema = class _RecordSchema2 extends ValueSchema {
2870
+ /**
2871
+ * The base Object validator validating that the input is an object.
2872
+ */
2873
+ static get base() {
2874
+ if (this._base == null)
2875
+ this._base = new _RecordSchema2(typeOfValidators.object);
2876
+ return this._base;
2877
+ }
2878
+ static get defaultKeyValidator() {
2879
+ return StringSchema.base;
2880
+ }
2881
+ /**
2882
+ * Returns a validator that asserts that the object's own enumerable properties has keys and
2883
+ * values that match their respective validators.
2884
+ *
2885
+ * Prototype members are not included.
2886
+ * Numeric keys are validated as strings. For example the object `{ [0]: 1 }` will be passed
2887
+ * to the key validator as '0'.
2888
+ *
2889
+ * @param keyValidator Validates each key.
2890
+ * @param valueValidator Validates each value.
2891
+ */
2892
+ record(keyValidator, valueValidator) {
2893
+ return this.chain(recordValidators.record(keyValidator, valueValidator));
2894
+ }
2895
+ /**
2896
+ * Returns a validator that asserts that the object's own enumerable properties has
2897
+ * string keys and values that match the given validator.
2898
+ *
2899
+ * Prototype members are not included.
2900
+ *
2901
+ * @param valueValidator Validates each value.
2902
+ */
2903
+ recordValues(valueValidator) {
2904
+ return this.record(_RecordSchema2.defaultKeyValidator, valueValidator);
2905
+ }
2906
+ /**
2907
+ * Casts to a ReadonlyRecord
2908
+ */
2909
+ readonly() {
2910
+ return this;
2911
+ }
2912
+ /**
2913
+ * Casts the type parameter.
2914
+ */
2915
+ cast() {
2916
+ return this;
2917
+ }
2918
+ };
2919
+ __publicField3(_RecordSchema, "_base", null);
2920
+ var locale12 = {
2921
+ isOneOf: "one of: {value}",
2922
+ instanceOf: "instance of {value}",
2923
+ oneOfSeparator: " | "
2924
+ };
2925
+ function isOneOf(...possibleValues) {
2926
+ return new ValueSchema(
2927
+ createValidator(
2928
+ substitute(locale12.isOneOf, {
2929
+ value: possibleValues.join(locale12.oneOfSeparator)
2930
+ }),
2931
+ (input) => possibleValues.includes(input)
2932
+ )
2933
+ );
2934
+ }
2935
+ function number() {
2936
+ return NumberSchema.base;
2937
+ }
2938
+
2939
+ // ../vinyl-xml/dist/index.js
2940
+ var __defProp5 = Object.defineProperty;
2941
+ var __defProps4 = Object.defineProperties;
2942
+ var __getOwnPropDescs4 = Object.getOwnPropertyDescriptors;
2943
+ var __getOwnPropSymbols5 = Object.getOwnPropertySymbols;
2944
+ var __hasOwnProp5 = Object.prototype.hasOwnProperty;
2945
+ var __propIsEnum5 = Object.prototype.propertyIsEnumerable;
2946
+ var __defNormalProp5 = (obj, key, value) => key in obj ? __defProp5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2947
+ var __spreadValues5 = (a, b) => {
2948
+ for (var prop in b || (b = {}))
2949
+ if (__hasOwnProp5.call(b, prop))
2950
+ __defNormalProp5(a, prop, b[prop]);
2951
+ if (__getOwnPropSymbols5)
2952
+ for (var prop of __getOwnPropSymbols5(b)) {
2953
+ if (__propIsEnum5.call(b, prop))
2954
+ __defNormalProp5(a, prop, b[prop]);
2955
+ }
2956
+ return a;
2957
+ };
2958
+ var __spreadProps4 = (a, b) => __defProps4(a, __getOwnPropDescs4(b));
2959
+ var __publicField4 = (obj, key, value) => __defNormalProp5(obj, typeof key !== "symbol" ? key + "" : key, value);
2960
+ function element(rules, options) {
2961
+ return __spreadProps4(__spreadValues5({
2962
+ type: "element",
2963
+ localPart: void 0,
2964
+ namespaceUri: void 0,
2965
+ required: false
2966
+ }, options), {
2967
+ rules
2968
+ });
2969
+ }
2970
+ function elements(rules, options) {
2971
+ return __spreadProps4(__spreadValues5({
2972
+ type: "elements",
2973
+ localPart: void 0,
2974
+ namespaceUri: void 0,
2975
+ minOccurs: 0,
2976
+ maxOccurs: null,
2977
+ useEmptyArrays: false
2978
+ }, options), {
2979
+ rules
2980
+ });
2981
+ }
2982
+ function characters(parse, stringify2) {
2983
+ return { type: "characters", parse, stringify: stringify2 };
2984
+ }
2985
+ var charactersString = /* @__PURE__ */ characters((i) => i, stringify);
2986
+ function attr(parse, stringify2, options) {
2987
+ return __spreadProps4(__spreadValues5({
2988
+ type: "attribute",
2989
+ localPart: void 0,
2990
+ namespaceUri: null,
2991
+ required: false,
2992
+ default: void 0
2993
+ }, options), {
2994
+ parse,
2995
+ stringify: stringify2
2996
+ });
2997
+ }
2998
+ function attrString(options) {
2999
+ return attr((i) => i, stringify, options);
3000
+ }
3001
+ function attrInt(options) {
3002
+ return attr(parseInt, stringify, options);
3003
+ }
3004
+ function attrFloat(options) {
3005
+ return attr(parseFloat, stringify, options);
3006
+ }
3007
+ function attrBoolean(options) {
3008
+ return attr(parseBoolean, stringify, options);
3009
+ }
3010
+ function attrDateTime(options) {
3011
+ return attr(parseDate, stringifyDate, options);
3012
+ }
3013
+ var xmlSchemaErrorLocale = {
3014
+ atLeastElements: "Expected at least {expected} occurrences of {property} but was {actual}",
3015
+ atMostElements: "Expected at most {expected} occurrences of {property} but was {actual}",
3016
+ cyclicReferences: "Cyclic reference detected",
3017
+ requiredAttribute: `Attribute '{property}' is required`
3018
+ };
3019
+ var XmlSchemaError = class _XmlSchemaError extends ReportableError {
3020
+ get [Symbol.toStringTag]() {
3021
+ return "XmlSchemaError";
3022
+ }
3023
+ constructor(message) {
3024
+ super(message, ErrorOrigin.PARSING);
3025
+ Object.setPrototypeOf(this, _XmlSchemaError.prototype);
3026
+ }
3027
+ };
3028
+ var XMLNS = "http://www.w3.org/2000/xmlns/";
3029
+ var LT = /* @__PURE__ */ char("<");
3030
+ var GT = /* @__PURE__ */ char(">");
3031
+ var EQ = /* @__PURE__ */ char("=");
3032
+ var SLASH = /* @__PURE__ */ char("/");
3033
+ var COLON = /* @__PURE__ */ char(":");
3034
+ var QMARK = /* @__PURE__ */ char("?");
3035
+ var EXCL = /* @__PURE__ */ char("!");
3036
+ var APOS = /* @__PURE__ */ char("'");
3037
+ var QUOT = /* @__PURE__ */ char('"');
3038
+ var QUOTES = /* @__PURE__ */ new Set([APOS, QUOT]);
3039
+ function parseXml(str, handler) {
3040
+ const c = new StringReader(str);
3041
+ let current = {
3042
+ qName: "#document",
3043
+ namespaceMap: /* @__PURE__ */ new Map(),
3044
+ defaultNamespaceUri: null
3045
+ };
3046
+ const stack = [current];
3047
+ const namespaceLookup = (prefix) => {
3048
+ if (!prefix) return current.defaultNamespaceUri;
3049
+ for (let i = stack.length - 1; i >= 0; i--) {
3050
+ const map = stack[i].namespaceMap;
3051
+ if (map.has(prefix)) return stack[i].namespaceMap.get(prefix);
3052
+ }
3053
+ return null;
3054
+ };
3055
+ try {
3056
+ handler.startDocument();
3057
+ } catch (e) {
3058
+ c.err(e.message);
3059
+ }
3060
+ while (c.hasNext()) {
3061
+ const charsStart = c.untilChar(LT);
3062
+ if (charsStart < c.position) {
3063
+ const chars = str.substring(charsStart, c.position);
3064
+ try {
3065
+ handler.textNode(chars);
3066
+ } catch (e) {
3067
+ c.err(e.message);
3068
+ }
3069
+ }
3070
+ if (!c.hasNext()) break;
3071
+ c.next();
3072
+ if (c.charIf(SLASH)) {
3073
+ c.white();
3074
+ const name = readQName(c);
3075
+ if (name.qName !== current.qName)
3076
+ c.err(`Expected </${current.qName}> but was </${name.qName}>`);
3077
+ stack.pop();
3078
+ current = last(stack);
3079
+ c.white();
3080
+ c.readChar(GT);
3081
+ try {
3082
+ handler.endElement();
3083
+ } catch (e) {
3084
+ c.err(e.message);
3085
+ }
3086
+ } else if (c.charIf(QMARK)) {
3087
+ untilTagClose(c);
3088
+ } else if (c.charIf(EXCL)) {
3089
+ if (c.charIf(
3090
+ 45
3091
+ /* - */
3092
+ )) {
3093
+ c.readChar(45);
3094
+ c.untilString("-->");
3095
+ c.read("-->");
3096
+ } else if (c.stringIf("[CDATA[")) {
3097
+ const charsStart2 = c.untilString("]]>");
3098
+ try {
3099
+ handler.cDataNode(str.substring(charsStart2, c.position));
3100
+ } catch (e) {
3101
+ c.err(e.message);
3102
+ }
3103
+ c.read("]]>");
3104
+ } else {
3105
+ untilTagClose(c);
3106
+ }
3107
+ } else {
3108
+ const name = readQName(c);
3109
+ current = {
3110
+ qName: name.qName,
3111
+ namespaceMap: /* @__PURE__ */ new Map(),
3112
+ defaultNamespaceUri: current.defaultNamespaceUri
3113
+ };
3114
+ stack.push(current);
3115
+ const attributes = xmlAttributes(c, current);
3116
+ name.namespaceUri = namespaceLookup(name.prefix);
3117
+ for (const attributesKey in attributes) {
3118
+ const value = attributes[attributesKey];
3119
+ const name2 = value.name;
3120
+ if (name2.prefix && !name2.namespaceUri) {
3121
+ name2.namespaceUri = namespaceLookup(name2.prefix);
3122
+ }
3123
+ }
3124
+ try {
3125
+ handler.startElement(name, attributes);
3126
+ } catch (e) {
3127
+ c.err(e.message);
3128
+ }
3129
+ if (c.charIf(SLASH)) {
3130
+ c.readChar(GT);
3131
+ stack.pop();
3132
+ current = last(stack);
3133
+ try {
3134
+ handler.endElement();
3135
+ } catch (e) {
3136
+ c.err(e.message);
3137
+ }
3138
+ } else {
3139
+ c.readChar(GT);
3140
+ }
3141
+ }
3142
+ }
3143
+ try {
3144
+ return handler.endDocument();
3145
+ } catch (e) {
3146
+ return c.err(e.message);
3147
+ }
3148
+ }
3149
+ function readAttributeValue(c) {
3150
+ const quote = c.next();
3151
+ if (!QUOTES.has(quote)) c.err(`Expected ' or "`);
3152
+ const value = c.substringUntil((charCode) => charCode === quote);
3153
+ c.readChar(quote);
3154
+ return decodeEntities(value);
3155
+ }
3156
+ function untilTagClose(c) {
3157
+ while (true) {
3158
+ c.until((c2) => c2 === APOS || c2 === QUOT || c2 === GT);
3159
+ const char2 = c.next();
3160
+ if (QUOTES.has(char2)) {
3161
+ c.untilChar(char2);
3162
+ c.next();
3163
+ } else {
3164
+ break;
3165
+ }
3166
+ }
3167
+ }
3168
+ function isNameChar(charCode) {
3169
+ if (charCode >= 97) {
3170
+ if (charCode >= 183) {
3171
+ if (charCode >= 768) {
3172
+ if (charCode >= 8255) {
3173
+ return charCode <= 8256;
3174
+ } else {
3175
+ return charCode <= 879;
3176
+ }
3177
+ } else {
3178
+ return charCode === 183;
3179
+ }
3180
+ } else {
3181
+ return charCode <= 122;
3182
+ }
3183
+ } else {
3184
+ if (charCode >= 95) {
3185
+ return charCode === 95;
3186
+ } else {
3187
+ if (charCode >= 65) {
3188
+ return charCode <= 90;
3189
+ } else {
3190
+ if (charCode >= 45) {
3191
+ if (charCode >= 48) {
3192
+ return charCode <= 57;
3193
+ } else {
3194
+ return charCode <= 46;
3195
+ }
3196
+ } else {
3197
+ return false;
3198
+ }
3199
+ }
3200
+ }
3201
+ }
3202
+ }
3203
+ function readQName(reader) {
3204
+ const prefixOrLocalName = reader.substringWhile(isNameChar);
3205
+ let prefix, localPart, name;
3206
+ if (reader.charIf(COLON)) {
3207
+ prefix = prefixOrLocalName;
3208
+ localPart = reader.substringWhile(isNameChar);
3209
+ name = `${prefix}:${localPart}`;
3210
+ } else {
3211
+ prefix = null;
3212
+ localPart = prefixOrLocalName;
3213
+ name = localPart;
3214
+ }
3215
+ return { prefix, localPart, qName: name, namespaceUri: null };
3216
+ }
3217
+ function xmlAttributes(reader, stackElement) {
3218
+ const attributes = {};
3219
+ while (true) {
3220
+ reader.white();
3221
+ if (!isNameChar(reader.peek)) break;
3222
+ const name = readQName(reader);
3223
+ reader.white();
3224
+ let value = "";
3225
+ if (reader.charIf(EQ)) {
3226
+ reader.white();
3227
+ value = readAttributeValue(reader);
3228
+ } else {
3229
+ }
3230
+ if (name.prefix === "xmlns") {
3231
+ name.namespaceUri = XMLNS;
3232
+ stackElement.namespaceMap.set(
3233
+ name.localPart,
3234
+ value === "" ? null : value
3235
+ );
3236
+ } else if (!name.prefix && name.localPart === "xmlns") {
3237
+ name.namespaceUri = XMLNS;
3238
+ stackElement.defaultNamespaceUri = !value ? null : value;
3239
+ }
3240
+ if (attributes[name.qName] != null)
3241
+ reader.err(`Attribute '${name.qName}' is already specified.`);
3242
+ attributes[name.qName] = { name, value };
3243
+ }
3244
+ return attributes;
3245
+ }
3246
+ var locale23 = {
3247
+ illegalRuleOverrideTypeError: "Cannot override the rule {property} of type {sourceType} with a rule of type {overrideType}",
3248
+ illegalQNameOverrideError: "Cannot override the rule {property} with a different localPart or namespace"
3249
+ };
3250
+ function mergeXmlRules(...rules) {
3251
+ let finalRule = rules[0];
3252
+ for (let i = 1; i < rules.length; i++) {
3253
+ finalRule = plainObjectMergeRule.merge(
3254
+ finalRule,
3255
+ rules[i],
3256
+ mergeXmlRule
3257
+ );
3258
+ }
3259
+ return finalRule;
3260
+ }
3261
+ function mergeXmlRule(sourceA, sourceB, prop) {
3262
+ var _a2, _b, _c, _d;
3263
+ if (sourceA == null) return sourceB;
3264
+ const sourceAIsLazy = typeof sourceA === "function";
3265
+ const sourceBIsLazy = typeof sourceB === "function";
3266
+ if (sourceAIsLazy || sourceBIsLazy) {
3267
+ return () => {
3268
+ const a = sourceAIsLazy ? sourceA() : sourceA;
3269
+ const b = sourceBIsLazy ? sourceB() : sourceB;
3270
+ return mergeXmlRule(a, b, prop);
3271
+ };
3272
+ }
3273
+ if (sourceA.type !== sourceB.type) {
3274
+ throw new ValidationError(
3275
+ substitute(locale23.illegalRuleOverrideTypeError, {
3276
+ property: prop,
3277
+ sourceType: sourceA.type,
3278
+ overrideType: sourceB.type
3279
+ })
3280
+ );
3281
+ }
3282
+ switch (sourceA.type) {
3283
+ case "attribute":
3284
+ case "element":
3285
+ case "elements": {
3286
+ const b = sourceB;
3287
+ if (sourceA.namespaceUri !== b.namespaceUri || ((_a2 = sourceA.localPart) != null ? _a2 : prop) !== ((_b = b.localPart) != null ? _b : prop)) {
3288
+ throw new ValidationError(
3289
+ substitute(locale23.illegalQNameOverrideError, {
3290
+ property: prop
3291
+ })
3292
+ );
3293
+ }
3294
+ break;
3295
+ }
3296
+ }
3297
+ switch (sourceA.type) {
3298
+ case "attribute": {
3299
+ const b = sourceB;
3300
+ return __spreadProps4(__spreadValues5({}, b), {
3301
+ default: (_c = b.default) != null ? _c : sourceA.default
3302
+ });
3303
+ }
3304
+ case "characters":
3305
+ return sourceB;
3306
+ case "element": {
3307
+ const b = sourceB;
3308
+ return __spreadProps4(__spreadValues5({}, b), {
3309
+ required: sourceA.required || b.required,
3310
+ rules: mergeXmlRules(sourceA.rules, b.rules)
3311
+ });
3312
+ }
3313
+ case "elements": {
3314
+ const b = sourceB;
3315
+ const maxOccurs = sourceA.maxOccurs != null && b.maxOccurs != null ? Math.min(sourceA.maxOccurs, b.maxOccurs) : (_d = sourceA.maxOccurs) != null ? _d : b.maxOccurs;
3316
+ return __spreadProps4(__spreadValues5({}, b), {
3317
+ minOccurs: Math.max(sourceA.minOccurs, b.minOccurs),
3318
+ maxOccurs,
3319
+ useEmptyArrays: sourceA.useEmptyArrays || b.useEmptyArrays,
3320
+ rules: mergeXmlRules(sourceA.rules, b.rules)
3321
+ });
3322
+ }
3323
+ }
3324
+ }
3325
+ var EmptyRules = {
3326
+ __type: /* @__PURE__ */ invariant(),
3327
+ attributes: /* @__PURE__ */ new Map(),
3328
+ elements: /* @__PURE__ */ new Map(),
3329
+ characters: void 0
3330
+ };
3331
+ function mapXmlRules(rules, parentNamespaceUri = null) {
3332
+ var _a2, _b, _c;
3333
+ const attributeRules = /* @__PURE__ */ new Map();
3334
+ const elementRules = /* @__PURE__ */ new Map();
3335
+ let charactersRule = void 0;
3336
+ for (const property in rules) {
3337
+ const handlerOrFunction = rules[property];
3338
+ let handler;
3339
+ if (typeof handlerOrFunction === "function") {
3340
+ handler = handlerOrFunction();
3341
+ } else {
3342
+ handler = handlerOrFunction;
3343
+ }
3344
+ let key;
3345
+ switch (handler.type) {
3346
+ case "characters":
3347
+ if (charactersRule !== void 0)
3348
+ throw new IllegalArgumentError(
3349
+ "characters handler already defined"
3350
+ );
3351
+ charactersRule = {
3352
+ property,
3353
+ parse: handler.parse,
3354
+ stringify: handler.stringify
3355
+ };
3356
+ break;
3357
+ case "element":
3358
+ case "elements": {
3359
+ const localPart = (_a2 = handler.localPart) != null ? _a2 : property;
3360
+ const namespaceUri = handler.namespaceUri === void 0 ? parentNamespaceUri : handler.namespaceUri;
3361
+ key = xmlRuleKey(localPart, namespaceUri);
3362
+ if (elementRules.has(key)) {
3363
+ throw new IllegalArgumentError(
3364
+ `Multiple element rules for ${key}`
3365
+ );
3366
+ }
3367
+ if (handler.type === "element") {
3368
+ const rules2 = handler.rules;
3369
+ elementRules.set(key, {
3370
+ array: false,
3371
+ property,
3372
+ minOccurs: handler.required ? 1 : 0,
3373
+ maxOccurs: 1,
3374
+ rules: memoize(() => mapXmlRules(rules2, namespaceUri)),
3375
+ useEmptyArrays: false,
3376
+ localPart,
3377
+ namespaceUri
3378
+ });
3379
+ } else {
3380
+ const rules2 = handler.rules;
3381
+ elementRules.set(key, {
3382
+ array: true,
3383
+ property,
3384
+ maxOccurs: handler.maxOccurs,
3385
+ minOccurs: handler.minOccurs,
3386
+ rules: memoize(() => mapXmlRules(rules2, namespaceUri)),
3387
+ useEmptyArrays: handler.useEmptyArrays,
3388
+ localPart,
3389
+ namespaceUri
3390
+ });
3391
+ }
3392
+ break;
3393
+ }
3394
+ case "attribute": {
3395
+ const namespaceUri = handler.namespaceUri;
3396
+ const localPart = (_b = handler.localPart) != null ? _b : property;
3397
+ key = xmlRuleKey(localPart, namespaceUri);
3398
+ if (attributeRules.has(key)) {
3399
+ throw new IllegalArgumentError(
3400
+ `Multiple attribute rules for ${key}`
3401
+ );
3402
+ }
3403
+ attributeRules.set(key, {
3404
+ property,
3405
+ default: handler.default,
3406
+ parse: handler.parse,
3407
+ stringify: handler.stringify,
3408
+ required: handler.required,
3409
+ localPart,
3410
+ namespaceUri: (_c = handler.namespaceUri) != null ? _c : null
3411
+ });
3412
+ break;
3413
+ }
3414
+ }
3415
+ }
3416
+ return {
3417
+ __type: invariant(),
3418
+ attributes: attributeRules,
3419
+ elements: elementRules,
3420
+ characters: charactersRule
3421
+ };
3422
+ }
3423
+ function xmlRuleKey(localPart, namespaceUri = null) {
3424
+ return `${namespaceUri != null ? namespaceUri : ""}:${localPart}`;
3425
+ }
3426
+ function getRule(name, rules) {
3427
+ return rules.get(xmlRuleKey(name.localPart, name.namespaceUri));
3428
+ }
3429
+ var ParseXmlHandlerImpl = class {
3430
+ constructor(rules, options) {
3431
+ this.rules = rules;
3432
+ __publicField4(this, "stack", []);
3433
+ __publicField4(this, "options");
3434
+ __publicField4(this, "busy", false);
3435
+ this.options = __spreadValues5({ validateRules: true }, options);
3436
+ }
3437
+ startDocument() {
3438
+ if (this.busy)
3439
+ throw new IllegalStateError("XML content handler is busy");
3440
+ this.busy = true;
3441
+ const rules = this.rules;
3442
+ this.stack.push({
3443
+ element: new XmlElementImpl(),
3444
+ rules,
3445
+ characters: ""
3446
+ });
3447
+ }
3448
+ startElement(name, attributes) {
3449
+ var _a2;
3450
+ const parent = last(this.stack);
3451
+ let element2 = null;
3452
+ const elementRule = getRule(name, parent.rules.elements);
3453
+ const rules = (_a2 = elementRule == null ? void 0 : elementRule.rules()) != null ? _a2 : EmptyRules;
3454
+ if (elementRule) {
3455
+ const prop = elementRule.property;
3456
+ element2 = new XmlElementImpl(parent.element);
3457
+ if (elementRule.array) {
3458
+ const arr = parent.element[prop];
3459
+ if (Array.isArray(arr)) {
3460
+ arr.push(element2);
3461
+ } else {
3462
+ parent.element[prop] = [element2];
3463
+ }
3464
+ } else {
3465
+ if (parent.element[prop]) {
3466
+ throw new XmlSchemaError(
3467
+ `Expected single element with name ${name.qName}`
3468
+ );
3469
+ } else {
3470
+ parent.element[prop] = element2;
3471
+ }
3472
+ }
3473
+ const attributeRules = rules.attributes;
3474
+ for (const k in attributes) {
3475
+ const attribute = attributes[k];
3476
+ const name2 = attribute.name;
3477
+ const attributeRule = getRule(name2, attributeRules);
3478
+ if (attributeRule) {
3479
+ element2[attributeRule.property] = attributeRule.parse(
3480
+ attribute.value
3481
+ );
3482
+ }
3483
+ }
3484
+ attributeRules.forEach((_value, key) => {
3485
+ const rule = attributeRules.get(key);
3486
+ if (!(rule.property in element2)) {
3487
+ if (rule.default != null) {
3488
+ element2[rule.property] = rule.default;
3489
+ } else if (this.options.validateRules && rule.required) {
3490
+ throw new XmlSchemaError(
3491
+ substitute(xmlSchemaErrorLocale.requiredAttribute, {
3492
+ property: rule.property
3493
+ })
3494
+ );
3495
+ }
3496
+ }
3497
+ });
3498
+ }
3499
+ this.stack.push({
3500
+ element: element2,
3501
+ rules,
3502
+ characters: ""
3503
+ });
3504
+ }
3505
+ textNode(str) {
3506
+ const current = last(this.stack);
3507
+ if (!current.rules.characters) return;
3508
+ current.characters += decodeEntities(str.trim());
3509
+ }
3510
+ cDataNode(str) {
3511
+ const current = last(this.stack);
3512
+ if (!current.rules.characters) return;
3513
+ current.characters += str;
3514
+ }
3515
+ endElement() {
3516
+ const lastEl = this.stack.pop();
3517
+ const charactersRule = lastEl.rules.characters;
3518
+ if (charactersRule)
3519
+ lastEl.element[charactersRule.property] = charactersRule.parse(
3520
+ lastEl.characters
3521
+ );
3522
+ lastEl.rules.elements.forEach((rule) => {
3523
+ if (rule.array && !(rule.property in lastEl.element)) {
3524
+ if (rule.useEmptyArrays) {
3525
+ lastEl.element[rule.property] = [];
3526
+ }
3527
+ }
3528
+ });
3529
+ this.validate(lastEl);
3530
+ }
3531
+ endDocument() {
3532
+ this.busy = false;
3533
+ const last3 = this.stack.pop();
3534
+ this.validate(last3);
3535
+ return last3.element;
3536
+ }
3537
+ validate(current) {
3538
+ if (!this.options.validateRules) return;
3539
+ current.rules.elements.forEach((rule) => {
3540
+ var _a2, _b;
3541
+ const length = rule.array ? (_b = (_a2 = current.element[rule.property]) == null ? void 0 : _a2.length) != null ? _b : 0 : current.element[rule.property] ? 1 : 0;
3542
+ if (length < rule.minOccurs) {
3543
+ throw new XmlSchemaError(
3544
+ substitute(xmlSchemaErrorLocale.atLeastElements, {
3545
+ property: rule.property,
3546
+ expected: rule.minOccurs,
3547
+ actual: length
3548
+ })
3549
+ );
3550
+ }
3551
+ if (rule.maxOccurs != null && length > rule.maxOccurs) {
3552
+ throw new XmlSchemaError(
3553
+ substitute(xmlSchemaErrorLocale.atMostElements, {
3554
+ property: rule.property,
3555
+ expected: rule.maxOccurs,
3556
+ actual: length
3557
+ })
3558
+ );
3559
+ }
3560
+ });
3561
+ }
3562
+ };
3563
+ var parentSymbol = /* @__PURE__ */ Symbol("parent");
3564
+ var _a;
3565
+ _a = parentSymbol;
3566
+ var _XmlElementImpl = class _XmlElementImpl2 {
3567
+ constructor(parent = null) {
3568
+ __publicField4(this, _a);
3569
+ this[parentSymbol] = parent;
3570
+ }
3571
+ get parent() {
3572
+ return this[parentSymbol];
3573
+ }
3574
+ set parent(value) {
3575
+ this[parentSymbol] = value;
3576
+ }
3577
+ clone() {
3578
+ const out = new _XmlElementImpl2(this.parent);
3579
+ for (const key in this) {
3580
+ const child = clone(this[key]);
3581
+ if (Array.isArray(child)) {
3582
+ for (const e of child) {
3583
+ if (typeof e === "object" && "parent" in e) e.parent = out;
3584
+ }
3585
+ } else if (typeof child === "object" && "parent" in child) {
3586
+ child.parent = out;
3587
+ }
3588
+ out[key] = child;
3589
+ }
3590
+ return out;
3591
+ }
3592
+ toJSON() {
3593
+ const out = {};
3594
+ for (const key in this) {
3595
+ out[key] = toJson(this[key]);
3596
+ }
3597
+ return out;
3598
+ }
3599
+ };
3600
+ var XmlElementImpl = _XmlElementImpl;
3601
+ var actuateValidator = /* @__PURE__ */ isOneOf("onLoad", "onRequest");
3602
+ function assertActuateEnum(str) {
3603
+ actuateValidator.assert(str, ErrorOrigin.PARSING);
3604
+ return str;
3605
+ }
3606
+
3607
+ // src/duration/duration.ts
3608
+ var I = 60;
3609
+ var H = 3600;
3610
+ var D = 86400;
3611
+ var M = 2592e3;
3612
+ var Y = 31536e3;
3613
+ var iso8601Duration = /^(-?)P?(\d+(?:\.\d*)?Y)?(\d+(?:\.\d*)?M)?(\d+(?:\.\d*)?D)?T?(\d+(?:\.\d*)?H)?(\d+(?:\.\d*)?M)?(\d+(?:\.\d*)?S?)?$/i;
3614
+ function parseDuration(value) {
3615
+ const match = iso8601Duration.exec(value);
3616
+ if (match == null)
3617
+ throw new ValidationError(
3618
+ `Unexpected duration: '${value}', should be in iso 8601 format`,
3619
+ ErrorOrigin.PARSING
3620
+ );
3621
+ const sign = match[1] === "-" ? -1 : 1;
3622
+ return sign * (parseFloat(match[2] || "0") * Y + parseFloat(match[3] || "0") * M + parseFloat(match[4] || "0") * D + parseFloat(match[5] || "0") * H + parseFloat(match[6] || "0") * I + parseFloat(match[7] || "0"));
3623
+ }
3624
+ function stringifyDuration(value) {
3625
+ const sign = value < 0 ? "-" : "";
3626
+ let abs = Math.abs(value);
3627
+ const years = Math.floor(abs / Y);
3628
+ abs -= years * Y;
3629
+ const months = Math.floor(abs % Y / M);
3630
+ const days = Math.floor(abs % M / D);
3631
+ const hours = Math.floor(abs % D / H);
3632
+ const minutes = Math.floor(abs % H / I);
3633
+ const seconds = abs % I;
3634
+ let isoString = `${sign}P`;
3635
+ if (years > 0) isoString += `${years}Y`;
3636
+ if (months > 0) isoString += `${months}M`;
3637
+ if (days > 0) isoString += `${days}D`;
3638
+ isoString += "T";
3639
+ if (hours > 0) isoString += `${hours}H`;
3640
+ if (minutes > 0) isoString += `${minutes}M`;
3641
+ if (seconds > 0 || !value) isoString += `${roundToNearest(seconds, 1e-3)}S`;
3642
+ return isoString;
3643
+ }
3644
+
3645
+ // src/manifest/dashManifestXmlRules.ts
3646
+ var dashNamespaceUri = "urn:mpeg:dash:schema:mpd:2011";
3647
+ function dashManifestXmlRules() {
3648
+ const attrActuateType = attr(assertActuateEnum, stringify, {
3649
+ default: "onRequest"
3650
+ });
3651
+ const descriptorType = {
3652
+ id: attrString,
3653
+ schemeIdUri: attrString({ required: true }),
3654
+ value: attrString
3655
+ };
3656
+ const baseURLType = {
3657
+ availabilityTimeComplete: attrBoolean,
3658
+ availabilityTimeOffset: attrFloat,
3659
+ byteRange: attrString,
3660
+ serviceLocation: attrString,
3661
+ _content: charactersString
3662
+ };
3663
+ const contentComponentType = {
3664
+ contentType: attrString,
3665
+ id: attrInt,
3666
+ lang: attrString,
3667
+ par: attr(parseRatio, stringifyRatio),
3668
+ Accessibility: elements(descriptorType),
3669
+ Rating: elements(descriptorType),
3670
+ Role: elements(descriptorType),
3671
+ Viewpoint: elements(descriptorType)
3672
+ };
3673
+ const urlType = {
3674
+ range: attr(parseByteRange, stringifyByteRange),
3675
+ sourceURL: attrString
3676
+ };
3677
+ const uriType = { _content: charactersString };
3678
+ const segmentBaseType = {
3679
+ Initialization: element(urlType),
3680
+ RepresentationIndex: element(urlType),
3681
+ availabilityTimeComplete: attrBoolean,
3682
+ availabilityTimeOffset: attrInt,
3683
+ indexRange: attr(parseByteRange, stringifyByteRange),
3684
+ indexRangeExact: attrBoolean({ default: false }),
3685
+ presentationTimeOffset: attrFloat,
3686
+ timescale: attrInt
3687
+ };
3688
+ const segmentTimelineTypeSType = {
3689
+ d: attrInt({ required: true }),
3690
+ n: attrInt,
3691
+ r: attrInt({ default: 0 }),
3692
+ t: attrInt
3693
+ };
3694
+ const segmentTimelineType = {
3695
+ S: elements(segmentTimelineTypeSType)
3696
+ };
3697
+ const multipleSegmentBaseType = __spreadProps(__spreadValues({}, segmentBaseType), {
3698
+ SegmentTimeline: element(segmentTimelineType),
3699
+ BitstreamSwitching: element(urlType),
3700
+ duration: attrInt,
3701
+ startNumber: attrInt
3702
+ });
3703
+ const segmentURLType = {
3704
+ index: attrString,
3705
+ indexRange: attr(parseByteRange, stringifyByteRange),
3706
+ media: attrString,
3707
+ mediaRange: attr(parseByteRange, stringifyByteRange)
3708
+ };
3709
+ const segmentListType = __spreadProps(__spreadValues({}, multipleSegmentBaseType), {
3710
+ actuate: attrActuateType,
3711
+ href: attrString,
3712
+ SegmentURL: elements(segmentURLType)
3713
+ });
3714
+ const segmentTemplateType = __spreadProps(__spreadValues({}, multipleSegmentBaseType), {
3715
+ bitstreamSwitching: attrString,
3716
+ index: attrString,
3717
+ initialization: attrString,
3718
+ media: attrString
3719
+ });
3720
+ const subsetType = {
3721
+ contains: attr(parseIntVector, stringifyIntVector, { required: true }),
3722
+ id: attrString
3723
+ };
3724
+ const eventType = {
3725
+ duration: attrInt,
3726
+ id: attrInt,
3727
+ messageData: attrString,
3728
+ presentationTime: attrInt({ default: 0 })
3729
+ };
3730
+ const eventStreamType = {
3731
+ Event: elements(eventType),
3732
+ actuate: attrActuateType,
3733
+ href: attrString,
3734
+ messageData: attrString,
3735
+ schemeIdUri: attrString({ required: true }),
3736
+ timescale: attrInt,
3737
+ value: attrString
3738
+ };
3739
+ const switchingType = {
3740
+ interval: attrInt({ required: true }),
3741
+ type: attr(parseSwitchingTypeType, stringify)
3742
+ };
3743
+ const representationBaseType = {
3744
+ FramePacking: elements(descriptorType),
3745
+ AudioChannelConfiguration: elements(descriptorType),
3746
+ ContentProtection: elements(descriptorType),
3747
+ EssentialProperty: elements(descriptorType),
3748
+ SupplementalProperty: elements(descriptorType),
3749
+ InbandEventStream: elements(eventStreamType),
3750
+ Switching: elements(switchingType),
3751
+ audioSamplingRate: attr(parseIntVector, stringifyIntVector),
3752
+ codecs: attrString,
3753
+ codingDependency: attrBoolean,
3754
+ frameRate: attr(parseFrameRate, stringifyFrameRate),
3755
+ height: attrInt,
3756
+ maximumSAPPeriod: attrInt,
3757
+ maxPlayoutRate: attrInt,
3758
+ mimeType: attrString,
3759
+ profiles: attr(parseProfiles, stringifyProfiles),
3760
+ sar: attr(parseRatio, stringifyRatio),
3761
+ scanType: attr(parseVideoScan, stringify),
3762
+ segmentProfiles: attrString,
3763
+ startWithSAP: attr(parseSap, stringify),
3764
+ width: attrInt
3765
+ };
3766
+ const subRepresentationType = __spreadProps(__spreadValues({}, representationBaseType), {
3767
+ bandwidth: attrInt,
3768
+ contentComponent: attr(parseStringVector, stringifyStringVector),
3769
+ dependencyLevel: attr(parseIntVector, stringifyIntVector),
3770
+ level: attrInt
3771
+ });
3772
+ const representationType = __spreadProps(__spreadValues({}, representationBaseType), {
3773
+ bandwidth: attrInt({ required: true }),
3774
+ bitrate: attrInt,
3775
+ dependencyId: attr(parseStringVector, stringifyStringVector),
3776
+ id: attrString({ required: true }),
3777
+ mediaStreamStructureId: attr(parseStringVector, stringifyStringVector),
3778
+ qualityRanking: attrInt,
3779
+ BaseURL: elements(baseURLType),
3780
+ SegmentBase: element(segmentBaseType),
3781
+ SegmentList: element(segmentListType),
3782
+ SegmentTemplate: element(segmentTemplateType),
3783
+ SubRepresentation: elements(subRepresentationType)
3784
+ });
3785
+ const adaptationSetType = __spreadProps(__spreadValues({}, representationBaseType), {
3786
+ Accessibility: elements(descriptorType),
3787
+ Role: elements(descriptorType),
3788
+ Rating: elements(descriptorType),
3789
+ Viewpoint: elements(descriptorType),
3790
+ ContentComponent: elements(contentComponentType),
3791
+ BaseURL: elements(baseURLType),
3792
+ SegmentBase: element(segmentBaseType),
3793
+ SegmentList: element(segmentListType),
3794
+ SegmentTemplate: element(segmentTemplateType),
3795
+ Representation: elements(representationType),
3796
+ actuate: attrActuateType,
3797
+ bitstreamSwitching: attrBoolean,
3798
+ contentType: attrString,
3799
+ group: attrInt,
3800
+ href: attrString,
3801
+ id: attrInt,
3802
+ lang: attrString,
3803
+ maxBandwidth: attrInt,
3804
+ maxFrameRate: attr(parseFrameRate, stringifyFrameRate),
3805
+ maxHeight: attrInt,
3806
+ maxWidth: attrInt,
3807
+ minBandwidth: attrInt,
3808
+ minFrameRate: attr(parseFrameRate, stringifyFrameRate),
3809
+ minHeight: attrInt,
3810
+ minWidth: attrInt,
3811
+ par: attr(parseRatio, stringifyRatio),
3812
+ segmentAlignment: attr(parseConditionalUint, stringify, {
3813
+ default: false
3814
+ }),
3815
+ selectionPriority: attrInt({
3816
+ default: 1
3817
+ }),
3818
+ subsegmentAlignment: attr(parseConditionalUint, stringify, {
3819
+ default: false
3820
+ }),
3821
+ subsegmentStartsWithSAP: attr(parseSap, stringify, { default: 0 })
3822
+ });
3823
+ const rangeType = {
3824
+ duration: attr(parseDuration, stringifyDuration),
3825
+ starttime: attr(parseDuration, stringifyDuration)
3826
+ };
3827
+ const metricsType = {
3828
+ metrics: attrString({ required: true }),
3829
+ Range: elements(rangeType),
3830
+ Reporting: elements(descriptorType, { minOccurs: 1 })
3831
+ };
3832
+ const periodType = {
3833
+ BaseURL: elements(baseURLType),
3834
+ SegmentBase: element(segmentBaseType),
3835
+ SegmentList: element(segmentListType),
3836
+ SegmentTemplate: element(segmentTemplateType),
3837
+ AssetIdentifier: element(descriptorType),
3838
+ EventStream: elements(eventStreamType),
3839
+ AdaptationSet: elements(adaptationSetType),
3840
+ Subset: elements(subsetType),
3841
+ SupplementalProperty: elements(descriptorType),
3842
+ actuate: attrActuateType,
3843
+ bitstreamSwitching: attrBoolean({ default: false }),
3844
+ duration: attr(parseDuration, stringifyDuration),
3845
+ href: attrString,
3846
+ id: attrString,
3847
+ start: attr(parseDuration, stringifyDuration)
3848
+ };
3849
+ const programInformationType = {
3850
+ lang: attrString,
3851
+ moreInformationURL: attrString,
3852
+ Copyright: attrString,
3853
+ Source: attrString,
3854
+ Title: attrString
3855
+ };
3856
+ const mpdType = {
3857
+ ProgramInformation: elements(programInformationType),
3858
+ BaseURL: elements(baseURLType),
3859
+ Location: elements(uriType),
3860
+ Period: elements(periodType, { minOccurs: 1 }),
3861
+ Metrics: elements(metricsType),
3862
+ EssentialProperty: elements(descriptorType),
3863
+ SupplementalProperty: elements(descriptorType),
3864
+ UTCTiming: elements(descriptorType),
3865
+ availabilityEndTime: attrDateTime,
3866
+ availabilityStartTime: attrDateTime,
3867
+ id: attrString,
3868
+ maxSegmentDuration: attr(parseDuration, stringifyDuration),
3869
+ maxSubsegmentDuration: attr(parseDuration, stringifyDuration),
3870
+ mediaPresentationDuration: attr(parseDuration, stringifyDuration),
3871
+ minBufferTime: attr(parseDuration, stringifyDuration, {
3872
+ required: true
3873
+ }),
3874
+ minimumUpdatePeriod: attr(parseDuration, stringifyDuration),
3875
+ profiles: attr(parseProfiles, stringifyProfiles, { required: true }),
3876
+ publishTime: attrDateTime,
3877
+ suggestedPresentationDelay: attr(parseDuration, stringifyDuration),
3878
+ timeShiftBufferDepth: attr(parseDuration, stringifyDuration),
3879
+ type: attr(parsePresentationTypeType, stringify, {
3880
+ default: "static"
3881
+ })
3882
+ };
3883
+ return {
3884
+ MPD: element(mpdType, {
3885
+ required: true,
3886
+ namespaceUri: dashNamespaceUri
3887
+ })
3888
+ };
3889
+ }
3890
+ function parseProfiles(str) {
3891
+ return str.split(",");
3892
+ }
3893
+ function stringifyProfiles(value) {
3894
+ return value.join(",");
3895
+ }
3896
+ var videoScanTypeValidator = isOneOf(
3897
+ "progressive",
3898
+ "interlaced",
3899
+ "unknown"
3900
+ );
3901
+ function parseVideoScan(str) {
3902
+ videoScanTypeValidator.assert(str, ErrorOrigin.PARSING);
3903
+ return str;
3904
+ }
3905
+ var switchingTypeTypeValidator = isOneOf(
3906
+ "media",
3907
+ "bitstream"
3908
+ );
3909
+ function parseSwitchingTypeType(str) {
3910
+ switchingTypeTypeValidator.assert(str, ErrorOrigin.PARSING);
3911
+ return str;
3912
+ }
3913
+ var validateSap = number().within(0, 6);
3914
+ function parseSap(str) {
3915
+ const number2 = parseInt(str);
3916
+ validateSap.assert(number2, ErrorOrigin.PARSING);
3917
+ return number2;
3918
+ }
3919
+ function parseStringVector(str) {
3920
+ return str.split(/\s+/);
3921
+ }
3922
+ function stringifyStringVector(value) {
3923
+ return value.join(" ");
3924
+ }
3925
+ function parseIntVector(str) {
3926
+ return str.split(/\s+/).map((subStr) => parseInt(subStr));
3927
+ }
3928
+ function stringifyIntVector(value) {
3929
+ return value.join(" ");
3930
+ }
3931
+ var presentationTypeValidator = isOneOf(
3932
+ "static",
3933
+ "dynamic"
3934
+ );
3935
+ function parsePresentationTypeType(str) {
3936
+ presentationTypeValidator.assert(str, ErrorOrigin.PARSING);
3937
+ return str;
3938
+ }
3939
+ function parseConditionalUint(str) {
3940
+ const lower = str.toLowerCase();
3941
+ switch (lower) {
3942
+ case "true":
3943
+ return true;
3944
+ case "false":
3945
+ return false;
3946
+ default:
3947
+ return parseInt(str);
3948
+ }
3949
+ }
3950
+
3951
+ // src/manifest/ext/drm/cencXmlRules.ts
3952
+ var cencXmlRules = {
3953
+ default_KID: attr(parseStringVector, stringifyStringVector, {
3954
+ namespaceUri: CENC_NAMESPACE_URI
3955
+ }),
3956
+ pssh: element(
3957
+ {
3958
+ _content: charactersString
3959
+ },
3960
+ {
3961
+ namespaceUri: CENC_NAMESPACE_URI
3962
+ }
3963
+ )
3964
+ };
3965
+
3966
+ // src/manifest/ext/drm/contentProtection.ts
3967
+ function createDashProtectionXmlRules(contentProtectionRules) {
3968
+ const withProtections = {
3969
+ ContentProtection: elements(contentProtectionRules)
3970
+ };
3971
+ return {
3972
+ MPD: element(
3973
+ {
3974
+ Period: elements(
3975
+ {
3976
+ AdaptationSet: elements(__spreadProps(__spreadValues({}, withProtections), {
3977
+ Representation: elements(__spreadProps(__spreadValues({}, withProtections), {
3978
+ SubRepresentation: elements(
3979
+ withProtections
3980
+ )
3981
+ }))
3982
+ }))
3983
+ },
3984
+ {
3985
+ minOccurs: 1
3986
+ }
3987
+ )
3988
+ },
3989
+ { required: true, namespaceUri: dashNamespaceUri }
3990
+ )
3991
+ };
3992
+ }
3993
+
3994
+ // src/manifest/ext/drm/playreadyXmlRules.ts
3995
+ var playreadyXmlRules = {
3996
+ pro: element(
3997
+ {
3998
+ _content: charactersString
3999
+ },
4000
+ {
4001
+ namespaceUri: PLAY_READY_NAMESPACE_URI
4002
+ }
4003
+ )
4004
+ };
4005
+
4006
+ // src/manifest/dashParser.ts
4007
+ var dashDrmRules = mergeXmlRules(
4008
+ dashManifestXmlRules(),
4009
+ createDashProtectionXmlRules(cencXmlRules),
4010
+ createDashProtectionXmlRules(playreadyXmlRules)
4011
+ );
4012
+ var dashDrmRulesMapped = mapXmlRules(dashDrmRules);
4013
+ function dashManifestHandler() {
4014
+ return new ParseXmlHandlerImpl(dashDrmRulesMapped);
4015
+ }
4016
+ function parseDashManifest(manifest) {
4017
+ return parseXml(manifest, dashManifestHandler());
4018
+ }
4019
+
4020
+ // test/dashTestAssets/dash_segmentListMediaRange.ts
4021
+ var dash_segmentListMediaRange = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
4022
+ <MPD minBufferTime="PT2S" type="static" mediaPresentationDuration="PT400.0133056640625S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:amz-music="urn:amazon:music:drm:2019" xmlns:cenc="urn:mpeg:cenc:2013" xmlns:mspr="urn:microsoft:playready">
4023
+ <Period id="0">
4024
+ <AdaptationSet id="1" contentType="audio" selectionPriority="2000">
4025
+ <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" cenc:default_KID="53443d2c-a548-037d-dfca-b6873a3b16a7" value="cenc"/>
4026
+ <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
4027
+ <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEFNEPSylSAN938q2hzo7FqcaC0FtYXpvbk11c2ljIhxjaWQ6VTBROUxLVklBMzNmeXJhSE9qc1dwdz09</cenc:pssh>
4028
+ </ContentProtection>
4029
+ <SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:ProgramLoudness" value="-13.5 LUFS"/>
4030
+ <SupplementalProperty schemeIdUri="amz-music:trackType" value="HD"/>
4031
+ <SupplementalProperty schemeIdUri="urn:mpeg:dash:adaptation-set-switching:2016" value="2"/>
4032
+ <SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:AnchorLoudness" value="-11.7 LUFS"/>
4033
+ <Representation id="1" qualityRanking="4" codecs="flac" audioSamplingRate="44100" bandwidth="1021104" mimeType="audio/mp4">
4034
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4035
+ <SupplementalProperty schemeIdUri="amz-music:bitDepth" value="16"/>
4036
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/a3ce7553-e9a3-3ca6-8fda-8f354b8cee0f.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=HD_44&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4037
+ <SegmentList timescale="44100" duration="441000">
4038
+ <Initialization range="0-1067"/>
4039
+ <SegmentURL mediaRange="1580-1124387"/>
4040
+ <SegmentURL mediaRange="1124388-2301681"/>
4041
+ <SegmentURL mediaRange="2301682-3413884"/>
4042
+ <SegmentURL mediaRange="3413885-4563668"/>
4043
+ <SegmentURL mediaRange="4563669-5789595"/>
4044
+ <SegmentURL mediaRange="5789596-7027203"/>
4045
+ <SegmentURL mediaRange="7027204-8258589"/>
4046
+ <SegmentURL mediaRange="8258590-9476689"/>
4047
+ <SegmentURL mediaRange="9476690-10663879"/>
4048
+ <SegmentURL mediaRange="10663880-11801656"/>
4049
+ <SegmentURL mediaRange="11801657-13028295"/>
4050
+ <SegmentURL mediaRange="13028296-14259035"/>
4051
+ <SegmentURL mediaRange="14259036-15501034"/>
4052
+ <SegmentURL mediaRange="15501035-16715074"/>
4053
+ <SegmentURL mediaRange="16715075-17945696"/>
4054
+ <SegmentURL mediaRange="17945697-19181760"/>
4055
+ <SegmentURL mediaRange="19181761-20430664"/>
4056
+ <SegmentURL mediaRange="20430665-21668186"/>
4057
+ <SegmentURL mediaRange="21668187-22889588"/>
4058
+ <SegmentURL mediaRange="22889589-24105876"/>
4059
+ <SegmentURL mediaRange="24105877-25286931"/>
4060
+ <SegmentURL mediaRange="25286932-26474293"/>
4061
+ <SegmentURL mediaRange="26474294-27717336"/>
4062
+ <SegmentURL mediaRange="27717337-28944000"/>
4063
+ <SegmentURL mediaRange="28944001-30217943"/>
4064
+ <SegmentURL mediaRange="30217944-31494322"/>
4065
+ <SegmentURL mediaRange="31494323-32753722"/>
4066
+ <SegmentURL mediaRange="32753723-33819438"/>
4067
+ <SegmentURL mediaRange="33819439-34871800"/>
4068
+ <SegmentURL mediaRange="34871801-35987451"/>
4069
+ <SegmentURL mediaRange="35987452-37198633"/>
4070
+ <SegmentURL mediaRange="37198634-38400513"/>
4071
+ <SegmentURL mediaRange="38400514-39590378"/>
4072
+ <SegmentURL mediaRange="39590379-40775418"/>
4073
+ <SegmentURL mediaRange="40775419-42023162"/>
4074
+ <SegmentURL mediaRange="42023163-43262782"/>
4075
+ <SegmentURL mediaRange="43262783-44466388"/>
4076
+ <SegmentURL mediaRange="44466389-45664349"/>
4077
+ <SegmentURL mediaRange="45664350-46838625"/>
4078
+ <SegmentURL mediaRange="46838626-47421889"/>
4079
+ </SegmentList>
4080
+ </Representation>
4081
+ <Representation id="2" qualityRanking="3" codecs="flac" audioSamplingRate="48000" bandwidth="1855801" mimeType="audio/mp4">
4082
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4083
+ <SupplementalProperty schemeIdUri="amz-music:bitDepth" value="24"/>
4084
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/f5b706c9-5892-3a17-9d01-4da362cfad35.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=UHD_48&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4085
+ <SegmentList timescale="48000" duration="480000">
4086
+ <Initialization range="0-1067"/>
4087
+ <SegmentURL mediaRange="1580-2140301"/>
4088
+ <SegmentURL mediaRange="2140302-4352961"/>
4089
+ <SegmentURL mediaRange="4352962-6499834"/>
4090
+ <SegmentURL mediaRange="6499835-8687556"/>
4091
+ <SegmentURL mediaRange="8687557-10955471"/>
4092
+ <SegmentURL mediaRange="10955472-13235819"/>
4093
+ <SegmentURL mediaRange="13235820-15509496"/>
4094
+ <SegmentURL mediaRange="15509497-17768731"/>
4095
+ <SegmentURL mediaRange="17768732-19993372"/>
4096
+ <SegmentURL mediaRange="19993373-22167125"/>
4097
+ <SegmentURL mediaRange="22167126-24434254"/>
4098
+ <SegmentURL mediaRange="24434255-26706557"/>
4099
+ <SegmentURL mediaRange="26706558-28990196"/>
4100
+ <SegmentURL mediaRange="28990197-31245239"/>
4101
+ <SegmentURL mediaRange="31245240-33516976"/>
4102
+ <SegmentURL mediaRange="33516977-35793411"/>
4103
+ <SegmentURL mediaRange="35793412-38083225"/>
4104
+ <SegmentURL mediaRange="38083226-40361780"/>
4105
+ <SegmentURL mediaRange="40361781-42623154"/>
4106
+ <SegmentURL mediaRange="42623155-44879987"/>
4107
+ <SegmentURL mediaRange="44879988-47098315"/>
4108
+ <SegmentURL mediaRange="47098316-49322904"/>
4109
+ <SegmentURL mediaRange="49322905-51607367"/>
4110
+ <SegmentURL mediaRange="51607368-53874862"/>
4111
+ <SegmentURL mediaRange="53874863-56192866"/>
4112
+ <SegmentURL mediaRange="56192867-58512617"/>
4113
+ <SegmentURL mediaRange="58512618-60815181"/>
4114
+ <SegmentURL mediaRange="60815182-62914181"/>
4115
+ <SegmentURL mediaRange="62914182-65000611"/>
4116
+ <SegmentURL mediaRange="65000612-67150839"/>
4117
+ <SegmentURL mediaRange="67150840-69402495"/>
4118
+ <SegmentURL mediaRange="69402496-71643660"/>
4119
+ <SegmentURL mediaRange="71643661-73870974"/>
4120
+ <SegmentURL mediaRange="73870975-76093618"/>
4121
+ <SegmentURL mediaRange="76093619-78383457"/>
4122
+ <SegmentURL mediaRange="78383458-80665083"/>
4123
+ <SegmentURL mediaRange="80665084-82909593"/>
4124
+ <SegmentURL mediaRange="82909594-85145972"/>
4125
+ <SegmentURL mediaRange="85145973-87356513"/>
4126
+ <SegmentURL mediaRange="87356514-88804457"/>
4127
+ </SegmentList>
4128
+ </Representation>
4129
+ <Representation id="3" qualityRanking="2" codecs="flac" audioSamplingRate="96000" bandwidth="3278164" mimeType="audio/mp4">
4130
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4131
+ <SupplementalProperty schemeIdUri="amz-music:bitDepth" value="24"/>
4132
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/02b134c4-8144-3ab1-b125-5af2d0133d5b.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=UHD_96&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4133
+ <SegmentList timescale="96000" duration="960000">
4134
+ <Initialization range="0-1067"/>
4135
+ <SegmentURL mediaRange="1580-3813567"/>
4136
+ <SegmentURL mediaRange="3813568-7746339"/>
4137
+ <SegmentURL mediaRange="7746340-11599579"/>
4138
+ <SegmentURL mediaRange="11599580-15505023"/>
4139
+ <SegmentURL mediaRange="15505024-19519493"/>
4140
+ <SegmentURL mediaRange="19519494-23556777"/>
4141
+ <SegmentURL mediaRange="23556778-27581158"/>
4142
+ <SegmentURL mediaRange="27581159-31586807"/>
4143
+ <SegmentURL mediaRange="31586808-35549718"/>
4144
+ <SegmentURL mediaRange="35549719-39435585"/>
4145
+ <SegmentURL mediaRange="39435586-43443650"/>
4146
+ <SegmentURL mediaRange="43443651-47467685"/>
4147
+ <SegmentURL mediaRange="47467686-51498910"/>
4148
+ <SegmentURL mediaRange="51498911-55496614"/>
4149
+ <SegmentURL mediaRange="55496615-59513566"/>
4150
+ <SegmentURL mediaRange="59513567-63538385"/>
4151
+ <SegmentURL mediaRange="63538386-67582593"/>
4152
+ <SegmentURL mediaRange="67582594-71608871"/>
4153
+ <SegmentURL mediaRange="71608872-75612860"/>
4154
+ <SegmentURL mediaRange="75612861-79601033"/>
4155
+ <SegmentURL mediaRange="79601034-83549776"/>
4156
+ <SegmentURL mediaRange="83549777-87488907"/>
4157
+ <SegmentURL mediaRange="87488908-91534801"/>
4158
+ <SegmentURL mediaRange="91534802-95552040"/>
4159
+ <SegmentURL mediaRange="95552041-99649744"/>
4160
+ <SegmentURL mediaRange="99649745-103743373"/>
4161
+ <SegmentURL mediaRange="103743374-107815594"/>
4162
+ <SegmentURL mediaRange="107815595-111613915"/>
4163
+ <SegmentURL mediaRange="111613916-115390443"/>
4164
+ <SegmentURL mediaRange="115390444-119249732"/>
4165
+ <SegmentURL mediaRange="119249733-123233807"/>
4166
+ <SegmentURL mediaRange="123233808-127209398"/>
4167
+ <SegmentURL mediaRange="127209399-131167116"/>
4168
+ <SegmentURL mediaRange="131167117-135119879"/>
4169
+ <SegmentURL mediaRange="135119880-139163685"/>
4170
+ <SegmentURL mediaRange="139163686-143201079"/>
4171
+ <SegmentURL mediaRange="143201080-147195194"/>
4172
+ <SegmentURL mediaRange="147195195-151164220"/>
4173
+ <SegmentURL mediaRange="151164221-155096800"/>
4174
+ <SegmentURL mediaRange="155096801-157757393"/>
4175
+ </SegmentList>
4176
+ </Representation>
4177
+ <Representation id="4" qualityRanking="1" codecs="flac" audioSamplingRate="192000" bandwidth="5666448" mimeType="audio/mp4">
4178
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4179
+ <SupplementalProperty schemeIdUri="amz-music:bitDepth" value="24"/>
4180
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/edf9f9cb-46ce-33bd-96e1-8456547fbef4.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=UHD_192&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4181
+ <SegmentList timescale="192000" duration="1920000">
4182
+ <Initialization range="0-1067"/>
4183
+ <SegmentURL mediaRange="1580-6720450"/>
4184
+ <SegmentURL mediaRange="6720451-13610816"/>
4185
+ <SegmentURL mediaRange="13610817-20415282"/>
4186
+ <SegmentURL mediaRange="20415283-27272412"/>
4187
+ <SegmentURL mediaRange="27272413-34250251"/>
4188
+ <SegmentURL mediaRange="34250252-41260291"/>
4189
+ <SegmentURL mediaRange="41260292-48255248"/>
4190
+ <SegmentURL mediaRange="48255249-55224355"/>
4191
+ <SegmentURL mediaRange="55224356-62157463"/>
4192
+ <SegmentURL mediaRange="62157464-68996670"/>
4193
+ <SegmentURL mediaRange="68996671-75970335"/>
4194
+ <SegmentURL mediaRange="75970336-82964531"/>
4195
+ <SegmentURL mediaRange="82964532-89965755"/>
4196
+ <SegmentURL mediaRange="89965756-96928368"/>
4197
+ <SegmentURL mediaRange="96928369-103911265"/>
4198
+ <SegmentURL mediaRange="103911266-110903999"/>
4199
+ <SegmentURL mediaRange="110904000-117921608"/>
4200
+ <SegmentURL mediaRange="117921609-124920837"/>
4201
+ <SegmentURL mediaRange="124920838-131897214"/>
4202
+ <SegmentURL mediaRange="131897215-138848614"/>
4203
+ <SegmentURL mediaRange="138848615-145764349"/>
4204
+ <SegmentURL mediaRange="145764350-152655256"/>
4205
+ <SegmentURL mediaRange="152655257-159680382"/>
4206
+ <SegmentURL mediaRange="159680383-166667521"/>
4207
+ <SegmentURL mediaRange="166667522-173750581"/>
4208
+ <SegmentURL mediaRange="173750582-180827932"/>
4209
+ <SegmentURL mediaRange="180827933-187877145"/>
4210
+ <SegmentURL mediaRange="187877146-194626820"/>
4211
+ <SegmentURL mediaRange="194626821-201345524"/>
4212
+ <SegmentURL mediaRange="201345525-208145573"/>
4213
+ <SegmentURL mediaRange="208145574-215088653"/>
4214
+ <SegmentURL mediaRange="215088654-222022478"/>
4215
+ <SegmentURL mediaRange="222022479-228934595"/>
4216
+ <SegmentURL mediaRange="228934596-235844464"/>
4217
+ <SegmentURL mediaRange="235844465-242852767"/>
4218
+ <SegmentURL mediaRange="242852768-249863893"/>
4219
+ <SegmentURL mediaRange="249863894-256824103"/>
4220
+ <SegmentURL mediaRange="256824104-263749124"/>
4221
+ <SegmentURL mediaRange="263749125-270634182"/>
4222
+ <SegmentURL mediaRange="270634183-275673081"/>
4223
+ </SegmentList>
4224
+ </Representation>
4225
+ </AdaptationSet>
4226
+ <AdaptationSet id="2" contentType="audio" selectionPriority="1000">
4227
+ <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" cenc:default_KID="f65d52c1-4de5-e5b6-7296-2f48eddf7378" value="cenc"/>
4228
+ <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
4229
+ <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEPZdUsFN5eW2cpYvSO3fc3gaC0FtYXpvbk11c2ljIhxjaWQ6OWwxU3dVM2w1Ylp5bGk5STdkOXplQT09</cenc:pssh>
4230
+ </ContentProtection>
4231
+ <SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:ProgramLoudness" value="-13.5 LUFS"/>
4232
+ <SupplementalProperty schemeIdUri="amz-music:trackType" value="SD"/>
4233
+ <SupplementalProperty schemeIdUri="urn:mpeg:dash:adaptation-set-switching:2016" value="1"/>
4234
+ <SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:AnchorLoudness" value="-11.7 LUFS"/>
4235
+ <Representation id="5" qualityRanking="3" codecs="opus" audioSamplingRate="48000" bandwidth="52950" mimeType="audio/mp4">
4236
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4237
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/7e2d628d-7666-3ad5-a9df-8ba4e1c6391c.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=SD_LOW&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4238
+ <SegmentList timescale="48000" duration="480000">
4239
+ <Initialization range="0-1031"/>
4240
+ <SegmentURL mediaRange="1544-61799"/>
4241
+ <SegmentURL mediaRange="61800-121935"/>
4242
+ <SegmentURL mediaRange="121936-182071"/>
4243
+ <SegmentURL mediaRange="182072-246260"/>
4244
+ <SegmentURL mediaRange="246261-310449"/>
4245
+ <SegmentURL mediaRange="310450-374638"/>
4246
+ <SegmentURL mediaRange="374639-438827"/>
4247
+ <SegmentURL mediaRange="438828-503016"/>
4248
+ <SegmentURL mediaRange="503017-567205"/>
4249
+ <SegmentURL mediaRange="567206-631394"/>
4250
+ <SegmentURL mediaRange="631395-695583"/>
4251
+ <SegmentURL mediaRange="695584-759772"/>
4252
+ <SegmentURL mediaRange="759773-823961"/>
4253
+ <SegmentURL mediaRange="823962-888150"/>
4254
+ <SegmentURL mediaRange="888151-952339"/>
4255
+ <SegmentURL mediaRange="952340-1016528"/>
4256
+ <SegmentURL mediaRange="1016529-1080717"/>
4257
+ <SegmentURL mediaRange="1080718-1144906"/>
4258
+ <SegmentURL mediaRange="1144907-1209095"/>
4259
+ <SegmentURL mediaRange="1209096-1273284"/>
4260
+ <SegmentURL mediaRange="1273285-1337473"/>
4261
+ <SegmentURL mediaRange="1337474-1401662"/>
4262
+ <SegmentURL mediaRange="1401663-1465851"/>
4263
+ <SegmentURL mediaRange="1465852-1530040"/>
4264
+ <SegmentURL mediaRange="1530041-1594229"/>
4265
+ <SegmentURL mediaRange="1594230-1658418"/>
4266
+ <SegmentURL mediaRange="1658419-1722607"/>
4267
+ <SegmentURL mediaRange="1722608-1786796"/>
4268
+ <SegmentURL mediaRange="1786797-1850985"/>
4269
+ <SegmentURL mediaRange="1850986-1915174"/>
4270
+ <SegmentURL mediaRange="1915175-1979363"/>
4271
+ <SegmentURL mediaRange="1979364-2043552"/>
4272
+ <SegmentURL mediaRange="2043553-2107741"/>
4273
+ <SegmentURL mediaRange="2107742-2171930"/>
4274
+ <SegmentURL mediaRange="2171931-2236119"/>
4275
+ <SegmentURL mediaRange="2236120-2300308"/>
4276
+ <SegmentURL mediaRange="2300309-2364497"/>
4277
+ <SegmentURL mediaRange="2364498-2428686"/>
4278
+ <SegmentURL mediaRange="2428687-2492875"/>
4279
+ <SegmentURL mediaRange="2492876-2559060"/>
4280
+ </SegmentList>
4281
+ </Representation>
4282
+ <Representation id="6" qualityRanking="2" codecs="opus" audioSamplingRate="48000" bandwidth="196953" mimeType="audio/mp4">
4283
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4284
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/8e453bd1-9428-30fa-940f-fa85911368c2.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=SD_MEDIUM&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4285
+ <SegmentList timescale="48000" duration="480000">
4286
+ <Initialization range="0-1031"/>
4287
+ <SegmentURL mediaRange="1544-242159"/>
4288
+ <SegmentURL mediaRange="242160-482295"/>
4289
+ <SegmentURL mediaRange="482296-722431"/>
4290
+ <SegmentURL mediaRange="722432-966620"/>
4291
+ <SegmentURL mediaRange="966621-1210809"/>
4292
+ <SegmentURL mediaRange="1210810-1454998"/>
4293
+ <SegmentURL mediaRange="1454999-1699187"/>
4294
+ <SegmentURL mediaRange="1699188-1943376"/>
4295
+ <SegmentURL mediaRange="1943377-2187565"/>
4296
+ <SegmentURL mediaRange="2187566-2431754"/>
4297
+ <SegmentURL mediaRange="2431755-2675943"/>
4298
+ <SegmentURL mediaRange="2675944-2920132"/>
4299
+ <SegmentURL mediaRange="2920133-3164321"/>
4300
+ <SegmentURL mediaRange="3164322-3408510"/>
4301
+ <SegmentURL mediaRange="3408511-3652699"/>
4302
+ <SegmentURL mediaRange="3652700-3896888"/>
4303
+ <SegmentURL mediaRange="3896889-4141077"/>
4304
+ <SegmentURL mediaRange="4141078-4385266"/>
4305
+ <SegmentURL mediaRange="4385267-4629455"/>
4306
+ <SegmentURL mediaRange="4629456-4873644"/>
4307
+ <SegmentURL mediaRange="4873645-5117833"/>
4308
+ <SegmentURL mediaRange="5117834-5362022"/>
4309
+ <SegmentURL mediaRange="5362023-5606211"/>
4310
+ <SegmentURL mediaRange="5606212-5850400"/>
4311
+ <SegmentURL mediaRange="5850401-6094589"/>
4312
+ <SegmentURL mediaRange="6094590-6338778"/>
4313
+ <SegmentURL mediaRange="6338779-6582967"/>
4314
+ <SegmentURL mediaRange="6582968-6827156"/>
4315
+ <SegmentURL mediaRange="6827157-7071345"/>
4316
+ <SegmentURL mediaRange="7071346-7315534"/>
4317
+ <SegmentURL mediaRange="7315535-7559723"/>
4318
+ <SegmentURL mediaRange="7559724-7803912"/>
4319
+ <SegmentURL mediaRange="7803913-8048101"/>
4320
+ <SegmentURL mediaRange="8048102-8292290"/>
4321
+ <SegmentURL mediaRange="8292291-8536479"/>
4322
+ <SegmentURL mediaRange="8536480-8780668"/>
4323
+ <SegmentURL mediaRange="8780669-9024857"/>
4324
+ <SegmentURL mediaRange="9024858-9269046"/>
4325
+ <SegmentURL mediaRange="9269047-9513235"/>
4326
+ <SegmentURL mediaRange="9513236-9759420"/>
4327
+ </SegmentList>
4328
+ </Representation>
4329
+ <Representation id="7" qualityRanking="1" codecs="opus" audioSamplingRate="48000" bandwidth="324955" mimeType="audio/mp4">
4330
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4331
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/40ba3a06-d285-3130-838f-0c1508c1d18b.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=SD_HIGH&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4332
+ <SegmentList timescale="48000" duration="480000">
4333
+ <Initialization range="0-1031"/>
4334
+ <SegmentURL mediaRange="1544-402479"/>
4335
+ <SegmentURL mediaRange="402480-802615"/>
4336
+ <SegmentURL mediaRange="802616-1202751"/>
4337
+ <SegmentURL mediaRange="1202752-1606940"/>
4338
+ <SegmentURL mediaRange="1606941-2011129"/>
4339
+ <SegmentURL mediaRange="2011130-2415318"/>
4340
+ <SegmentURL mediaRange="2415319-2819507"/>
4341
+ <SegmentURL mediaRange="2819508-3223696"/>
4342
+ <SegmentURL mediaRange="3223697-3627885"/>
4343
+ <SegmentURL mediaRange="3627886-4032074"/>
4344
+ <SegmentURL mediaRange="4032075-4436263"/>
4345
+ <SegmentURL mediaRange="4436264-4840452"/>
4346
+ <SegmentURL mediaRange="4840453-5244641"/>
4347
+ <SegmentURL mediaRange="5244642-5648830"/>
4348
+ <SegmentURL mediaRange="5648831-6053019"/>
4349
+ <SegmentURL mediaRange="6053020-6457208"/>
4350
+ <SegmentURL mediaRange="6457209-6861397"/>
4351
+ <SegmentURL mediaRange="6861398-7265586"/>
4352
+ <SegmentURL mediaRange="7265587-7669775"/>
4353
+ <SegmentURL mediaRange="7669776-8073964"/>
4354
+ <SegmentURL mediaRange="8073965-8478153"/>
4355
+ <SegmentURL mediaRange="8478154-8882342"/>
4356
+ <SegmentURL mediaRange="8882343-9286531"/>
4357
+ <SegmentURL mediaRange="9286532-9690720"/>
4358
+ <SegmentURL mediaRange="9690721-10094909"/>
4359
+ <SegmentURL mediaRange="10094910-10499098"/>
4360
+ <SegmentURL mediaRange="10499099-10903287"/>
4361
+ <SegmentURL mediaRange="10903288-11307476"/>
4362
+ <SegmentURL mediaRange="11307477-11711665"/>
4363
+ <SegmentURL mediaRange="11711666-12115854"/>
4364
+ <SegmentURL mediaRange="12115855-12520043"/>
4365
+ <SegmentURL mediaRange="12520044-12924232"/>
4366
+ <SegmentURL mediaRange="12924233-13328421"/>
4367
+ <SegmentURL mediaRange="13328422-13732610"/>
4368
+ <SegmentURL mediaRange="13732611-14136799"/>
4369
+ <SegmentURL mediaRange="14136800-14540988"/>
4370
+ <SegmentURL mediaRange="14540989-14945177"/>
4371
+ <SegmentURL mediaRange="14945178-15349366"/>
4372
+ <SegmentURL mediaRange="15349367-15753555"/>
4373
+ <SegmentURL mediaRange="15753556-16159740"/>
4374
+ </SegmentList>
4375
+ </Representation>
4376
+ </AdaptationSet>
4377
+ <AdaptationSet id="3" contentType="audio" selectionPriority="500">
4378
+ <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" cenc:default_KID="4e4c6e3a-d760-ffd5-78b0-3824890da09d" value="cenc"/>
4379
+ <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
4380
+ <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0SEE5MbjrXYP/VeLA4JIkNoJ0aC0FtYXpvbk11c2ljIhxjaWQ6VGt4dU90ZGcvOVY0c0Rna2lRMmduUT09</cenc:pssh>
4381
+ </ContentProtection>
4382
+ <SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:ProgramLoudness" value="-13.5 LUFS"/>
4383
+ <SupplementalProperty schemeIdUri="amz-music:trackType" value="LD"/>
4384
+ <SupplementalProperty schemeIdUri="urn:mpeg:mpegB:cicp:AnchorLoudness" value="-11.7 LUFS"/>
4385
+ <Representation id="8" qualityRanking="2000" codecs="opus" audioSamplingRate="48000" bandwidth="52950" mimeType="audio/mp4">
4386
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4387
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/748096ab-6991-368b-b9ca-5477bf90ba5a.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=LD_LOW&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4388
+ <SegmentList timescale="48000" duration="480000">
4389
+ <Initialization range="0-1031"/>
4390
+ <SegmentURL mediaRange="1544-61799"/>
4391
+ <SegmentURL mediaRange="61800-121935"/>
4392
+ <SegmentURL mediaRange="121936-182071"/>
4393
+ <SegmentURL mediaRange="182072-246260"/>
4394
+ <SegmentURL mediaRange="246261-310449"/>
4395
+ <SegmentURL mediaRange="310450-374638"/>
4396
+ <SegmentURL mediaRange="374639-438827"/>
4397
+ <SegmentURL mediaRange="438828-503016"/>
4398
+ <SegmentURL mediaRange="503017-567205"/>
4399
+ <SegmentURL mediaRange="567206-631394"/>
4400
+ <SegmentURL mediaRange="631395-695583"/>
4401
+ <SegmentURL mediaRange="695584-759772"/>
4402
+ <SegmentURL mediaRange="759773-823961"/>
4403
+ <SegmentURL mediaRange="823962-888150"/>
4404
+ <SegmentURL mediaRange="888151-952339"/>
4405
+ <SegmentURL mediaRange="952340-1016528"/>
4406
+ <SegmentURL mediaRange="1016529-1080717"/>
4407
+ <SegmentURL mediaRange="1080718-1144906"/>
4408
+ <SegmentURL mediaRange="1144907-1209095"/>
4409
+ <SegmentURL mediaRange="1209096-1273284"/>
4410
+ <SegmentURL mediaRange="1273285-1337473"/>
4411
+ <SegmentURL mediaRange="1337474-1401662"/>
4412
+ <SegmentURL mediaRange="1401663-1465851"/>
4413
+ <SegmentURL mediaRange="1465852-1530040"/>
4414
+ <SegmentURL mediaRange="1530041-1594229"/>
4415
+ <SegmentURL mediaRange="1594230-1658418"/>
4416
+ <SegmentURL mediaRange="1658419-1722607"/>
4417
+ <SegmentURL mediaRange="1722608-1786796"/>
4418
+ <SegmentURL mediaRange="1786797-1850985"/>
4419
+ <SegmentURL mediaRange="1850986-1915174"/>
4420
+ <SegmentURL mediaRange="1915175-1979363"/>
4421
+ <SegmentURL mediaRange="1979364-2043552"/>
4422
+ <SegmentURL mediaRange="2043553-2107741"/>
4423
+ <SegmentURL mediaRange="2107742-2171930"/>
4424
+ <SegmentURL mediaRange="2171931-2236119"/>
4425
+ <SegmentURL mediaRange="2236120-2300308"/>
4426
+ <SegmentURL mediaRange="2300309-2364497"/>
4427
+ <SegmentURL mediaRange="2364498-2428686"/>
4428
+ <SegmentURL mediaRange="2428687-2492875"/>
4429
+ <SegmentURL mediaRange="2492876-2559060"/>
4430
+ </SegmentList>
4431
+ </Representation>
4432
+ <Representation id="9" qualityRanking="1000" codecs="opus" audioSamplingRate="48000" bandwidth="164952" mimeType="audio/mp4">
4433
+ <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
4434
+ <BaseURL>https://d17vo8z6jop21h.cloudfront.net/94bd1ece-d200000391583662/8be307d6-71ea-3111-a869-40720e08a6f9.mp4?r=2e86bfd7-93aa-48a0-9d32-7bee6d2897a4&amp;rs=NA&amp;mt=US&amp;ql=LD_MEDIUM&amp;dtype=A16ZV8BU3SN1N3</BaseURL>
4435
+ <SegmentList timescale="48000" duration="480000">
4436
+ <Initialization range="0-1031"/>
4437
+ <SegmentURL mediaRange="1544-202079"/>
4438
+ <SegmentURL mediaRange="202080-402215"/>
4439
+ <SegmentURL mediaRange="402216-602351"/>
4440
+ <SegmentURL mediaRange="602352-806540"/>
4441
+ <SegmentURL mediaRange="806541-1010729"/>
4442
+ <SegmentURL mediaRange="1010730-1214918"/>
4443
+ <SegmentURL mediaRange="1214919-1419107"/>
4444
+ <SegmentURL mediaRange="1419108-1623296"/>
4445
+ <SegmentURL mediaRange="1623297-1827485"/>
4446
+ <SegmentURL mediaRange="1827486-2031674"/>
4447
+ <SegmentURL mediaRange="2031675-2235863"/>
4448
+ <SegmentURL mediaRange="2235864-2440052"/>
4449
+ <SegmentURL mediaRange="2440053-2644241"/>
4450
+ <SegmentURL mediaRange="2644242-2848430"/>
4451
+ <SegmentURL mediaRange="2848431-3052619"/>
4452
+ <SegmentURL mediaRange="3052620-3256808"/>
4453
+ <SegmentURL mediaRange="3256809-3460997"/>
4454
+ <SegmentURL mediaRange="3460998-3665186"/>
4455
+ <SegmentURL mediaRange="3665187-3869375"/>
4456
+ <SegmentURL mediaRange="3869376-4073564"/>
4457
+ <SegmentURL mediaRange="4073565-4277753"/>
4458
+ <SegmentURL mediaRange="4277754-4481942"/>
4459
+ <SegmentURL mediaRange="4481943-4686131"/>
4460
+ <SegmentURL mediaRange="4686132-4890320"/>
4461
+ <SegmentURL mediaRange="4890321-5094509"/>
4462
+ <SegmentURL mediaRange="5094510-5298698"/>
4463
+ <SegmentURL mediaRange="5298699-5502887"/>
4464
+ <SegmentURL mediaRange="5502888-5707076"/>
4465
+ <SegmentURL mediaRange="5707077-5911265"/>
4466
+ <SegmentURL mediaRange="5911266-6115454"/>
4467
+ <SegmentURL mediaRange="6115455-6319643"/>
4468
+ <SegmentURL mediaRange="6319644-6523832"/>
4469
+ <SegmentURL mediaRange="6523833-6728021"/>
4470
+ <SegmentURL mediaRange="6728022-6932210"/>
4471
+ <SegmentURL mediaRange="6932211-7136399"/>
4472
+ <SegmentURL mediaRange="7136400-7340588"/>
4473
+ <SegmentURL mediaRange="7340589-7544777"/>
4474
+ <SegmentURL mediaRange="7544778-7748966"/>
4475
+ <SegmentURL mediaRange="7748967-7953155"/>
4476
+ <SegmentURL mediaRange="7953156-8159340"/>
4477
+ </SegmentList>
4478
+ </Representation>
4479
+ </AdaptationSet>
4480
+ </Period>
4481
+ </MPD>`;
4482
+
4483
+ // test/benchmark/manifest/dash/parseDashManifest.bench.ts
4484
+ describe("parseDashManifest", () => {
4485
+ setupBenchmark();
4486
+ it("Parse Dash", async () => {
4487
+ addBenchmarks(
4488
+ "Parse Dash - isoff on demand",
4489
+ await benchmark(
4490
+ "SAX",
4491
+ () => parseDashManifest(dash_segmentListMediaRange)
4492
+ )
4493
+ );
4494
+ });
4495
+ });
4496
+ })();
4497
+ //# sourceMappingURL=benchmark.js.map