@amazon/vinyl-mpd-parser 3.2.2 → 3.2.3-next.20261001224604
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -10
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +12 -10
- package/dist/index.js.map +2 -2
- package/dist/test/benchmark.es5.js +6 -5
- package/dist/test/benchmark.js +34 -29
- package/dist/test/benchmark.js.map +3 -3
- package/dist/types/current/duration/duration.d.ts.map +1 -1
- package/dist/types/current/duration/duration.js +16 -11
- package/dist/types/current/manifest/dashParser.d.ts +3128 -0
- package/dist/types/current/manifest/dashParser.d.ts.map +1 -1
- package/dist/types/current/manifest/dashParser.js +1 -1
- package/dist/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ts3.7/manifest/dashParser.d.ts +3716 -0
- package/dist/types/ts4.1/manifest/dashParser.d.ts +3716 -0
- package/dist/types/ts4.7/manifest/dashParser.d.ts +3716 -0
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
PLAY_READY_NAMESPACE_URI: () => PLAY_READY_NAMESPACE_URI,
|
|
43
43
|
cencXmlRules: () => cencXmlRules,
|
|
44
44
|
createDashProtectionXmlRules: () => createDashProtectionXmlRules,
|
|
45
|
+
dashDrmRules: () => dashDrmRules,
|
|
45
46
|
dashManifestXmlRules: () => dashManifestXmlRules,
|
|
46
47
|
dashNamespaceUri: () => dashNamespaceUri,
|
|
47
48
|
parseByteRange: () => parseByteRange,
|
|
@@ -93,20 +94,21 @@ function stringifyDuration(value) {
|
|
|
93
94
|
let abs = Math.abs(value);
|
|
94
95
|
const years = Math.floor(abs / Y);
|
|
95
96
|
abs -= years * Y;
|
|
96
|
-
const months = Math.floor(abs
|
|
97
|
+
const months = Math.floor(abs / M);
|
|
97
98
|
const days = Math.floor(abs % M / D);
|
|
98
99
|
const hours = Math.floor(abs % D / H);
|
|
99
100
|
const minutes = Math.floor(abs % H / I);
|
|
100
101
|
const seconds = abs % I;
|
|
101
|
-
let
|
|
102
|
-
if (years > 0)
|
|
103
|
-
if (months > 0)
|
|
104
|
-
if (days > 0)
|
|
105
|
-
|
|
106
|
-
if (hours > 0)
|
|
107
|
-
if (minutes > 0)
|
|
108
|
-
if (seconds > 0
|
|
109
|
-
|
|
102
|
+
let date = "";
|
|
103
|
+
if (years > 0) date += `${years}Y`;
|
|
104
|
+
if (months > 0) date += `${months}M`;
|
|
105
|
+
if (days > 0) date += `${days}D`;
|
|
106
|
+
let time = "";
|
|
107
|
+
if (hours > 0) time += `${hours}H`;
|
|
108
|
+
if (minutes > 0) time += `${minutes}M`;
|
|
109
|
+
if (seconds > 0) time += `${(0, import_vinyl_util.roundToNearest)(seconds, 1e-3)}S`;
|
|
110
|
+
if (!date && !time) time = "0S";
|
|
111
|
+
return `${sign}P${date}${time && `T${time}`}`;
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
// src/error/parsingError.ts
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/duration/duration.ts", "../src/error/parsingError.ts", "../src/manifest/dashManifestXmlRules.ts", "../src/media/byteRange.ts", "../src/media/ratio.ts", "../src/media/frameRate.ts", "../src/manifest/dashParser.ts", "../src/manifest/ext/drm/cencXmlRules.ts", "../src/xmlns/mpeg/cenc/2013.ts", "../src/manifest/ext/drm/contentProtection.ts", "../src/manifest/ext/drm/playreadyXmlRules.ts", "../src/xmlns/microsoft/playready.ts", "../src/manifest/ext/drm/ContentProtectionScheme.ts"],
|
|
4
|
-
"sourcesContent": ["/** Auto-generated from build scripts */\nexport * from './duration/duration'\nexport * from './error/parsingError'\nexport * from './manifest/dashManifestXmlRules'\nexport * from './manifest/dashParser'\nexport * from './manifest/ext/drm/cencXmlRules'\nexport * from './manifest/ext/drm/contentProtection'\nexport * from './manifest/ext/drm/ContentProtectionScheme'\nexport * from './manifest/ext/drm/playreadyXmlRules'\nexport * from './media/byteRange'\nexport * from './media/frameRate'\nexport * from './media/ratio'\nexport * from './xmlns/microsoft/playready'\nexport * from './xmlns/mpeg/cenc/2013'\nexport * from './xmlns/mpeg/dash/schema/mpd/2011'\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n ErrorOrigin,\n roundToNearest,\n ValidationError,\n} from '@amazon/vinyl-util'\n\n// ESBuild (https://github.com/evanw/esbuild/issues/3988) considers multiplication and division\n// to have a side effect and will inhibit tree shaking.\n// E.g. H = 60 * 60 will not be removed when not referenced.\nconst I = 60\nconst H = 3600\nconst D = 86400\nconst M = 2592000\nconst Y = 31536000\n\n/**\n * A duration, in seconds. (This may be negative)\n */\nexport type Duration = number\n\n/**\n * https://www.w3.org/TR/xmlschema-2/#duration\n */\nconst iso8601Duration =\n /^(-?)P?(\\d+(?:\\.\\d*)?Y)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?D)?T?(\\d+(?:\\.\\d*)?H)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?S?)?$/i\n\n/**\n * Parses an ISO 8601 duration into seconds.\n * The accepted format is P(n)Y(n)M(n)DT(n)H(n)M(n)S\n *\n * All units shall have a fixed size.\n *\n * P - Period designator, precedes all durations.\n * 1Y (Year) = 365 * 24 * 60 * 60 Seconds\n * 1M (Month) = 30 * 24 * 60 * 60 Seconds\n * 1D (Day) = 24 * 60 * 60 Seconds\n *\n * T - Time designator, precedes all time components.\n * 1H (Hour) = 60 * 60 Seconds\n * 1M (Minute) = 60 Seconds\n * 1S (Second)\n *\n *\n * @param value\n * @return Returns the duration in seconds or throws an {@link ValidationError}\n * if not properly formatted.\n * @see https://www.w3.org/TR/xmlschema-2/#duration\n */\nexport function parseDuration(value: string): Duration {\n const match = iso8601Duration.exec(value)\n if (match == null)\n throw new ValidationError(\n `Unexpected duration: '${value}', should be in iso 8601 format`,\n ErrorOrigin.PARSING\n )\n\n const sign = match[1] === '-' ? -1 : 1\n return (\n sign *\n (parseFloat(match[2] || '0') * Y +\n parseFloat(match[3] || '0') * M +\n parseFloat(match[4] || '0') * D +\n parseFloat(match[5] || '0') * H +\n parseFloat(match[6] || '0') * I +\n parseFloat(match[7] || '0'))\n )\n}\n\n/**\n * Returns the iso 8601 string representation of a duration value.\n *\n * @param value A duration value, in seconds.\n */\nexport function stringifyDuration(value: Duration): string {\n const sign = value < 0 ? '-' : ''\n let abs = Math.abs(value)\n\n const years = Math.floor(abs / Y)\n abs -= years * Y\n const months = Math.floor((abs % Y) / M)\n const days = Math.floor((abs % M) / D)\n const hours = Math.floor((abs % D) / H)\n const minutes = Math.floor((abs % H) / I)\n const seconds = abs % I\n let isoString = `${sign}P`\n if (years > 0) isoString += `${years}Y`\n if (months > 0) isoString += `${months}M`\n if (days > 0) isoString += `${days}D`\n isoString += 'T'\n if (hours > 0) isoString += `${hours}H`\n if (minutes > 0) isoString += `${minutes}M`\n if (seconds > 0 || !value) isoString += `${roundToNearest(seconds, 0.001)}S`\n return isoString\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ValidationError } from '@amazon/vinyl-util'\n\nexport function throwParsingError(message: string): never {\n throw new ValidationError(message, ErrorOrigin.PARSING)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Parser definitions for a dash manifest.\n * Attribute order does not matter, element order matters for writing.\n *\n * @module\n */\n\nimport type { actuateType, UriType } from '@amazon/vinyl-xml'\nimport {\n assertActuateEnum,\n attr,\n attrBoolean,\n attrDateTime,\n attrFloat,\n attrInt,\n attrString,\n charactersString,\n element,\n elements,\n type XmlRules,\n} from '@amazon/vinyl-xml'\nimport { ErrorOrigin, stringify } from '@amazon/vinyl-util'\nimport { isOneOf, number, type Validator } from '@amazon/vinyl-validation'\nimport { parseDuration, stringifyDuration } from '../duration/duration'\nimport { parseByteRange, stringifyByteRange } from '../media/byteRange'\nimport { parseRatio, stringifyRatio } from '../media/ratio'\nimport { parseFrameRate, stringifyFrameRate } from '../media/frameRate'\nimport type {\n AdaptationSetType,\n BaseURLType,\n ConditionalUintType,\n ContentComponentType,\n DashManifest,\n DescriptorType,\n EventStreamType,\n EventType,\n MetricsType,\n MPDtype,\n MultipleSegmentBaseType,\n PeriodType,\n PresentationType,\n ProgramInformationType,\n RangeType,\n RepresentationBaseType,\n RepresentationType,\n SegmentBaseType,\n SegmentListType,\n SegmentTemplateType,\n SegmentTimelineType,\n SegmentTimelineTypeSType,\n SegmentURLType,\n SubRepresentationType,\n SubsetType,\n SwitchingType,\n SwitchingTypeType,\n URLType,\n VideoScanType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\n\nexport const dashNamespaceUri = 'urn:mpeg:dash:schema:mpd:2011'\n\nexport function dashManifestXmlRules(): XmlRules<DashManifest> {\n const attrActuateType = attr<actuateType>(assertActuateEnum, stringify, {\n default: 'onRequest',\n } as const)\n\n const descriptorType: XmlRules<DescriptorType> = {\n id: attrString,\n schemeIdUri: attrString({ required: true }),\n value: attrString,\n } as const\n\n const baseURLType: XmlRules<BaseURLType> = {\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrFloat,\n byteRange: attrString,\n serviceLocation: attrString,\n _content: charactersString,\n } as const\n\n const contentComponentType: XmlRules<ContentComponentType> = {\n contentType: attrString,\n id: attrInt,\n lang: attrString,\n par: attr(parseRatio, stringifyRatio),\n Accessibility: elements(descriptorType),\n Rating: elements(descriptorType),\n Role: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n } as const\n\n const urlType: XmlRules<URLType> = {\n range: attr(parseByteRange, stringifyByteRange),\n sourceURL: attrString,\n } as const\n\n const uriType: XmlRules<UriType> = { _content: charactersString } as const\n\n const segmentBaseType: XmlRules<SegmentBaseType> = {\n Initialization: element(urlType),\n RepresentationIndex: element(urlType),\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrInt,\n indexRange: attr(parseByteRange, stringifyByteRange),\n indexRangeExact: attrBoolean({ default: false }),\n presentationTimeOffset: attrFloat,\n timescale: attrInt,\n } as const\n\n const segmentTimelineTypeSType: XmlRules<SegmentTimelineTypeSType> = {\n d: attrInt({ required: true }),\n n: attrInt,\n r: attrInt({ default: 0 }),\n t: attrInt,\n } as const\n\n const segmentTimelineType: XmlRules<SegmentTimelineType> = {\n S: elements(segmentTimelineTypeSType),\n } as const\n\n const multipleSegmentBaseType: XmlRules<MultipleSegmentBaseType> = {\n ...segmentBaseType,\n SegmentTimeline: element(segmentTimelineType),\n BitstreamSwitching: element(urlType),\n duration: attrInt,\n startNumber: attrInt,\n } as const\n\n const segmentURLType: XmlRules<SegmentURLType> = {\n index: attrString,\n indexRange: attr(parseByteRange, stringifyByteRange),\n media: attrString,\n mediaRange: attr(parseByteRange, stringifyByteRange),\n } as const\n\n const segmentListType: XmlRules<SegmentListType> = {\n ...multipleSegmentBaseType,\n actuate: attrActuateType,\n href: attrString,\n SegmentURL: elements(segmentURLType),\n } as const\n\n const segmentTemplateType: XmlRules<SegmentTemplateType> = {\n ...multipleSegmentBaseType,\n bitstreamSwitching: attrString,\n index: attrString,\n initialization: attrString,\n media: attrString,\n } as const\n\n const subsetType: XmlRules<SubsetType> = {\n contains: attr(parseIntVector, stringifyIntVector, { required: true }),\n id: attrString,\n } as const\n\n const eventType: XmlRules<EventType> = {\n duration: attrInt,\n id: attrInt,\n messageData: attrString,\n presentationTime: attrInt({ default: 0 }),\n } as const\n\n const eventStreamType: XmlRules<EventStreamType> = {\n Event: elements(eventType),\n actuate: attrActuateType,\n href: attrString,\n messageData: attrString,\n schemeIdUri: attrString({ required: true }),\n timescale: attrInt,\n value: attrString,\n } as const\n\n const switchingType: XmlRules<SwitchingType> = {\n interval: attrInt({ required: true }),\n type: attr(parseSwitchingTypeType, stringify),\n } as const\n\n const representationBaseType: XmlRules<RepresentationBaseType> = {\n FramePacking: elements(descriptorType),\n AudioChannelConfiguration: elements(descriptorType),\n ContentProtection: elements(descriptorType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n InbandEventStream: elements(eventStreamType),\n Switching: elements(switchingType),\n audioSamplingRate: attr(parseIntVector, stringifyIntVector),\n codecs: attrString,\n codingDependency: attrBoolean,\n frameRate: attr(parseFrameRate, stringifyFrameRate),\n height: attrInt,\n maximumSAPPeriod: attrInt,\n maxPlayoutRate: attrInt,\n mimeType: attrString,\n profiles: attr(parseProfiles, stringifyProfiles),\n sar: attr(parseRatio, stringifyRatio),\n scanType: attr(parseVideoScan, stringify),\n segmentProfiles: attrString,\n startWithSAP: attr(parseSap, stringify),\n width: attrInt,\n } as const\n\n const subRepresentationType: XmlRules<SubRepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt,\n contentComponent: attr(parseStringVector, stringifyStringVector),\n dependencyLevel: attr(parseIntVector, stringifyIntVector),\n level: attrInt,\n } as const\n\n const representationType: XmlRules<RepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt({ required: true }),\n bitrate: attrInt,\n dependencyId: attr(parseStringVector, stringifyStringVector),\n id: attrString({ required: true }),\n mediaStreamStructureId: attr(parseStringVector, stringifyStringVector),\n qualityRanking: attrInt,\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n SubRepresentation: elements(subRepresentationType),\n } as const\n\n const adaptationSetType: XmlRules<AdaptationSetType> = {\n ...representationBaseType,\n Accessibility: elements(descriptorType),\n Role: elements(descriptorType),\n Rating: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n ContentComponent: elements(contentComponentType),\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n Representation: elements(representationType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean,\n contentType: attrString,\n group: attrInt,\n href: attrString,\n id: attrInt,\n lang: attrString,\n maxBandwidth: attrInt,\n maxFrameRate: attr(parseFrameRate, stringifyFrameRate),\n maxHeight: attrInt,\n maxWidth: attrInt,\n minBandwidth: attrInt,\n minFrameRate: attr(parseFrameRate, stringifyFrameRate),\n minHeight: attrInt,\n minWidth: attrInt,\n par: attr(parseRatio, stringifyRatio),\n segmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n selectionPriority: attrInt({\n default: 1,\n }),\n subsegmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n subsegmentStartsWithSAP: attr(parseSap, stringify, { default: 0 }),\n } as const\n\n const rangeType: XmlRules<RangeType> = {\n duration: attr(parseDuration, stringifyDuration),\n starttime: attr(parseDuration, stringifyDuration),\n } as const\n\n const metricsType: XmlRules<MetricsType> = {\n metrics: attrString({ required: true }),\n Range: elements(rangeType),\n Reporting: elements(descriptorType, { minOccurs: 1 }),\n } as const\n\n const periodType: XmlRules<PeriodType> = {\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n AssetIdentifier: element(descriptorType),\n EventStream: elements(eventStreamType),\n AdaptationSet: elements(adaptationSetType),\n Subset: elements(subsetType),\n SupplementalProperty: elements(descriptorType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean({ default: false }),\n duration: attr(parseDuration, stringifyDuration),\n href: attrString,\n id: attrString,\n start: attr(parseDuration, stringifyDuration),\n } as const\n\n const programInformationType: XmlRules<ProgramInformationType> = {\n lang: attrString,\n moreInformationURL: attrString,\n Copyright: attrString,\n Source: attrString,\n Title: attrString,\n } as const\n\n const mpdType: XmlRules<MPDtype> = {\n ProgramInformation: elements(programInformationType),\n BaseURL: elements(baseURLType),\n Location: elements(uriType),\n Period: elements(periodType, { minOccurs: 1 }),\n Metrics: elements(metricsType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n UTCTiming: elements(descriptorType),\n availabilityEndTime: attrDateTime,\n availabilityStartTime: attrDateTime,\n id: attrString,\n maxSegmentDuration: attr(parseDuration, stringifyDuration),\n maxSubsegmentDuration: attr(parseDuration, stringifyDuration),\n mediaPresentationDuration: attr(parseDuration, stringifyDuration),\n minBufferTime: attr(parseDuration, stringifyDuration, {\n required: true,\n }),\n minimumUpdatePeriod: attr(parseDuration, stringifyDuration),\n profiles: attr(parseProfiles, stringifyProfiles, { required: true }),\n publishTime: attrDateTime,\n suggestedPresentationDelay: attr(parseDuration, stringifyDuration),\n timeShiftBufferDepth: attr(parseDuration, stringifyDuration),\n type: attr(parsePresentationTypeType, stringify, {\n default: 'static',\n } as const),\n } as const\n\n return {\n MPD: element(mpdType, {\n required: true,\n namespaceUri: dashNamespaceUri,\n }),\n } as const\n}\n\n/**\n * Parses a comma delimited list of profiles.\n * Profile values are not whitespace trimmed.\n *\n * @param str\n */\nexport function parseProfiles(str: string): readonly string[] {\n return str.split(',')\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyProfiles(value: readonly string[]): string {\n return value.join(',')\n}\n\nconst videoScanTypeValidator: Validator<VideoScanType> = /* @__PURE__ */ isOneOf(\n 'progressive',\n 'interlaced',\n 'unknown'\n)\n\n/**\n * @private\n */\nexport function parseVideoScan(str: string): VideoScanType {\n videoScanTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst switchingTypeTypeValidator: Validator<SwitchingTypeType> = /* @__PURE__ */ isOneOf(\n 'media',\n 'bitstream'\n)\n\n/**\n * @private\n */\nexport function parseSwitchingTypeType(str: string): SwitchingTypeType {\n switchingTypeTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst validateSap: Validator<number> = /* @__PURE__ */ /* @__PURE__ */ number().within(0, 6)\n\n/**\n * @private\n */\nexport function parseSap(str: string): number {\n const number = parseInt(str)\n validateSap.assert(number, ErrorOrigin.PARSING)\n return number\n}\n\n/**\n * Splits a string by whitespace.\n *\n * @private\n */\nexport function parseStringVector(str: string): readonly string[] {\n return str.split(/\\s+/)\n}\n\n/**\n * Returns the string representation of a string vector value.\n *\n * @param value\n */\nexport function stringifyStringVector(value: readonly string[]): string {\n return value.join(' ')\n}\n\n/**\n * Splits a string by whitespace and parses as int.\n *\n * @private\n */\nexport function parseIntVector(str: string): readonly number[] {\n return str.split(/\\s+/).map((subStr) => parseInt(subStr))\n}\n\n/**\n * Returns the string representation of an int vector value.\n *\n * @param value\n */\nexport function stringifyIntVector(value: readonly number[]): string {\n return value.join(' ')\n}\n\nconst presentationTypeValidator: Validator<PresentationType> = /* @__PURE__ */ isOneOf(\n 'static',\n 'dynamic'\n)\n\n/**\n * Asserts that the given string is one of the {@link PresentationType} enumerated values.\n * @param str\n */\nexport function parsePresentationTypeType(str: string): PresentationType {\n presentationTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\n/**\n * Parses a string into true, false, or a number.\n *\n * @private\n */\nexport function parseConditionalUint(str: string): ConditionalUintType {\n const lower = str.toLowerCase()\n switch (lower) {\n case 'true':\n return true\n case 'false':\n return false\n default:\n return parseInt(str)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseIntSafe } from '@amazon/vinyl-util'\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A range of bytes, [from, to (optional, inclusive)].\n */\nexport type ByteRange = readonly [number, number | null]\n\nconst byteRangeExp = /^(-?[0-9]+)-(-?[0-9]*)$/\n\nexport function parseByteRange(str: string): ByteRange {\n const match = str ? byteRangeExp.exec(str) : null\n if (!match) throwParsingError(`invalid byte range: '${str}'`)\n let start = parseInt(match[1])\n // Convert possibly-negative Int32 overflow value to its Uint32 equivalent\n // (reinterpret 32-bit signed integer bits as unsigned)\n if (start < 0) start >>>= 0\n let end = parseIntSafe(match[2])\n if (end != null && end < 0) end = end >>> 0\n return [start, end]\n}\n\n/**\n * Returns the string representation of a {@link ByteRange} value.\n *\n * @param value\n */\nexport function stringifyByteRange(value: ByteRange): string {\n const end = value[1]\n return `${value[0]}-${end == null ? '' : end}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A numerator and denominator.\n */\nexport type Ratio = readonly [number, number]\n\n/**\n * The XSD specifies `[0-9]*`, and not `[0-9]+`, which would match `'23:'`\n * For missing dimensions, default to 1.\n */\nconst ratioRegExp = /^([0-9]*):([0-9]*)$/\n\n/**\n * Parses a string representing a ratio into [number, number].\n * The string must satisfy the pattern: `/^([0-9]*):([0-9]*)$/`\n * Examples:\n * ```\n * parseRatio('4:3') // [4, 3]\n * parseRatio('16:9') // [16, 9]\n * parseRatio('2:') // [2, 1]\n * ```\n *\n * @private\n */\nexport function parseRatio(str: string): Ratio {\n const match = str ? ratioRegExp.exec(str) : null\n if (!match) throwParsingError(`invalid ratio format: ${str}`)\n return [parseInt(match[1] || '1'), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link Ratio} value.\n *\n * @param value\n */\nexport function stringifyRatio(value: Ratio): string {\n return `${value[0]}:${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\nexport type FrameRate = readonly [number, number]\n\nconst framerateRegexp = /^(\\d+)(?:\\/(\\d+))?$/\n\n/**\n * Parses a string into a {@link FrameRate}\n *\n * @private\n */\nexport function parseFrameRate(str: string): FrameRate {\n const match = str ? framerateRegexp.exec(str) : null\n if (!match) throwParsingError(`invalid frame rate: '${str}'`)\n return [parseInt(match[1]), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyFrameRate(value: FrameRate): string {\n return value[1] === 1 ? value[0].toString() : `${value[0]}/${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReservedXmlRuleKeys } from '@amazon/vinyl-xml'\nimport {\n mapXmlRules,\n type Merged,\n mergeXmlRules,\n parseXml,\n ParseXmlHandlerImpl,\n stringifyXml,\n} from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../xmlns/microsoft/playready'\nimport type { CencContentProtection } from '../xmlns/mpeg/cenc/2013'\nimport type {\n DashManifest,\n DescriptorType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\nimport { dashManifestXmlRules } from './dashManifestXmlRules'\nimport { cencXmlRules } from './ext/drm/cencXmlRules'\nimport type { DashProtections } from './ext/drm/contentProtection'\nimport { createDashProtectionXmlRules } from './ext/drm/contentProtection'\nimport { playreadyXmlRules } from './ext/drm/playreadyXmlRules'\nimport type { OptionalDeep } from '@amazon/vinyl-util'\n\n/**\n * Creates a Dash Manifest parser with supported extensions.\n *\n * @module\n */\n\nexport type DashDrmManifest = Merged<\n DashManifest & DashProtections<ContentProtection>\n>\n\nexport interface ContentProtection\n extends DescriptorType, CencContentProtection, PlayreadyContentProtection {}\n\nconst dashDrmRules = /* @__PURE__ */ mergeXmlRules(\n /* @__PURE__ */ dashManifestXmlRules(),\n /* @__PURE__ */ createDashProtectionXmlRules(cencXmlRules),\n /* @__PURE__ */ createDashProtectionXmlRules(playreadyXmlRules)\n)\n\nconst dashDrmRulesMapped = /* @__PURE__ */ mapXmlRules(dashDrmRules)\n\n/**\n * A Content handler for a dash manifest.\n */\nfunction dashManifestHandler() {\n return new ParseXmlHandlerImpl(dashDrmRulesMapped)\n}\n\n/**\n * Parses a Dash Manifest, according to the mpd:2011 schema.\n * @see https://raw.githubusercontent.com/Dash-Industry-Forum/MPEG-Conformance-and-reference-source/master/conformance/MPDValidator/schemas/DASH-MPD.xsd\n * @param manifest\n */\nexport function parseDashManifest(manifest: string): DashDrmManifest {\n return parseXml(manifest, dashManifestHandler())\n}\n\nexport function stringifyDashManifest(\n manifest: OptionalDeep<DashDrmManifest, ReservedXmlRuleKeys>\n): string {\n return stringifyXml(manifest, dashDrmRulesMapped)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n parseStringVector,\n stringifyStringVector,\n} from '../../dashManifestXmlRules'\nimport type { XmlRules } from '@amazon/vinyl-xml'\nimport { attr, charactersString, element } from '@amazon/vinyl-xml'\nimport type { CencContentProtection } from '../../../xmlns/mpeg/cenc/2013'\nimport { CENC_NAMESPACE_URI } from '../../../xmlns/mpeg/cenc/2013'\n\n/**\n * A parser for ContentProtection elements using the cenc namespace.\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n */\nexport const cencXmlRules: XmlRules<CencContentProtection> = {\n default_KID: /* @__PURE__ */ attr(parseStringVector, stringifyStringVector, {\n namespaceUri: CENC_NAMESPACE_URI,\n }),\n pssh: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: CENC_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection xml types.\n *\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n * @module\n */\n\nexport const CENC_NAMESPACE_URI = 'urn:mpeg:cenc:2013'\n\n/**\n * A 128-bit integer written in canonical UUID notation.\n * Must be in the form:\n * `[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}`\n */\nexport type KeyIdType = string\n\nexport interface CencContentProtection {\n readonly default_KID?: readonly KeyIdType[]\n readonly pssh?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { element, elements, type XmlRules } from '@amazon/vinyl-xml'\nimport { dashNamespaceUri } from '../../dashManifestXmlRules'\n\n/**\n * ContentProtection extension point for Dash manifests.\n *\n * @module\n */\n\nexport interface WithProtections<T> {\n readonly ContentProtection?: readonly T[]\n}\n\nexport interface RepresentationTypeProtections<T> extends WithProtections<T> {\n readonly SubRepresentation?: readonly WithProtections<T>[]\n}\n\nexport interface AdaptationSetProtections<T> extends WithProtections<T> {\n readonly Representation?: readonly RepresentationTypeProtections<T>[]\n}\n\nexport interface PeriodProtections<T> {\n readonly AdaptationSet?: readonly AdaptationSetProtections<T>[]\n}\n\nexport interface MPDProtections<T> {\n readonly Period: readonly PeriodProtections<T>[]\n}\n\nexport interface DashProtections<T> {\n readonly MPD: MPDProtections<T>\n}\n\n/**\n * Creates a dash extension for content protection parsing rules.\n *\n * @param contentProtectionRules Rules to be used when processing `ContentProtection` elements.\n * @return Returns a rules map that should be merged with the dash manifest rules.\n */\nexport function createDashProtectionXmlRules<T extends object>(\n contentProtectionRules: XmlRules<T>\n): XmlRules<DashProtections<T>> {\n const withProtections: XmlRules<WithProtections<T>> = {\n ContentProtection: elements(contentProtectionRules),\n } as const\n\n return {\n MPD: element<MPDProtections<T>>(\n {\n Period: elements<PeriodProtections<T>>(\n {\n AdaptationSet: elements<AdaptationSetProtections<T>>({\n ...withProtections,\n Representation: elements<\n RepresentationTypeProtections<T>\n >({\n ...withProtections,\n SubRepresentation:\n elements<WithProtections<T>>(\n withProtections\n ),\n }),\n }),\n },\n {\n minOccurs: 1,\n }\n ),\n },\n { required: true, namespaceUri: dashNamespaceUri } as const\n ),\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { charactersString, element, type XmlRules } from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../../../xmlns/microsoft/playready'\nimport { PLAY_READY_NAMESPACE_URI } from '../../../xmlns/microsoft/playready'\n\nexport const playreadyXmlRules: XmlRules<PlayreadyContentProtection> = {\n pro: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: PLAY_READY_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection playready.\n *\n * @see https://learn.microsoft.com/en-us/playready/specifications/mpeg-dash-playready#21-dash-contentprotection-descriptor-elements\n * @module\n */\n\nexport const PLAY_READY_NAMESPACE_URI = 'urn:microsoft:playready'\n\nexport interface PlayreadyContentProtection {\n readonly pro?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const ContentProtectionScheme = {\n /**\n * CENC protection scheme. (Should not be used to create a key session)\n */\n CENC: 'urn:mpeg:dash:mp4protection:2011',\n\n /**\n * A simple, unencrypted content protection scheme. Not a full DRM solution.\n */\n CLEAR_KEY: 'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e',\n\n /**\n * Apple's FairPlay.\n */\n FAIR_PLAY: 'urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2',\n\n /**\n * Open-standards community initiative by Marlin Developer Community.\n */\n MARLIN: 'urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4',\n\n /**\n * Microsoft's PlayReady.\n */\n PLAY_READY: 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95',\n\n /**\n * An old, unused PlayReady scheme id.\n */\n PLAY_READY_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A;AAAA;AAAA,EAInC,MAAM;AAAA;AAAA;AAAA;AAAA,EAKN,WAAW;AAAA;AAAA;AAAA;AAAA,EAKX,WAAW;AAAA;AAAA;AAAA;AAAA,EAKX,QAAQ;AAAA;AAAA;AAAA;AAAA,EAKR,YAAY;AAAA;AAAA;AAAA;AAAA,EAKZ,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAKvB,UAAU;AACd;",
|
|
4
|
+
"sourcesContent": ["/** Auto-generated from build scripts */\nexport * from './duration/duration'\nexport * from './error/parsingError'\nexport * from './manifest/dashManifestXmlRules'\nexport * from './manifest/dashParser'\nexport * from './manifest/ext/drm/cencXmlRules'\nexport * from './manifest/ext/drm/contentProtection'\nexport * from './manifest/ext/drm/ContentProtectionScheme'\nexport * from './manifest/ext/drm/playreadyXmlRules'\nexport * from './media/byteRange'\nexport * from './media/frameRate'\nexport * from './media/ratio'\nexport * from './xmlns/microsoft/playready'\nexport * from './xmlns/mpeg/cenc/2013'\nexport * from './xmlns/mpeg/dash/schema/mpd/2011'\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n ErrorOrigin,\n roundToNearest,\n ValidationError,\n} from '@amazon/vinyl-util'\n\n// ESBuild (https://github.com/evanw/esbuild/issues/3988) considers multiplication and division\n// to have a side effect and will inhibit tree shaking.\n// E.g. H = 60 * 60 will not be removed when not referenced.\nconst I = 60\nconst H = 3600\nconst D = 86400\nconst M = 2592000\nconst Y = 31536000\n\n/**\n * A duration, in seconds. (This may be negative)\n */\nexport type Duration = number\n\n/**\n * https://www.w3.org/TR/xmlschema-2/#duration\n */\nconst iso8601Duration =\n /^(-?)P?(\\d+(?:\\.\\d*)?Y)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?D)?T?(\\d+(?:\\.\\d*)?H)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?S?)?$/i\n\n/**\n * Parses an ISO 8601 duration into seconds.\n * The accepted format is P(n)Y(n)M(n)DT(n)H(n)M(n)S\n *\n * All units shall have a fixed size.\n *\n * P - Period designator, precedes all durations.\n * 1Y (Year) = 365 * 24 * 60 * 60 Seconds\n * 1M (Month) = 30 * 24 * 60 * 60 Seconds\n * 1D (Day) = 24 * 60 * 60 Seconds\n *\n * T - Time designator, precedes all time components.\n * 1H (Hour) = 60 * 60 Seconds\n * 1M (Minute) = 60 Seconds\n * 1S (Second)\n *\n *\n * @param value\n * @return Returns the duration in seconds or throws an {@link ValidationError}\n * if not properly formatted.\n * @see https://www.w3.org/TR/xmlschema-2/#duration\n */\nexport function parseDuration(value: string): Duration {\n const match = iso8601Duration.exec(value)\n if (match == null)\n throw new ValidationError(\n `Unexpected duration: '${value}', should be in iso 8601 format`,\n ErrorOrigin.PARSING\n )\n\n const sign = match[1] === '-' ? -1 : 1\n return (\n sign *\n (parseFloat(match[2] || '0') * Y +\n parseFloat(match[3] || '0') * M +\n parseFloat(match[4] || '0') * D +\n parseFloat(match[5] || '0') * H +\n parseFloat(match[6] || '0') * I +\n parseFloat(match[7] || '0'))\n )\n}\n\n/**\n * Returns the iso 8601 string representation of a duration value.\n *\n * @param value A duration value, in seconds.\n */\nexport function stringifyDuration(value: Duration): string {\n const sign = value < 0 ? '-' : ''\n let abs = Math.abs(value)\n\n const years = Math.floor(abs / Y)\n abs -= years * Y\n const months = Math.floor(abs / M)\n const days = Math.floor((abs % M) / D)\n const hours = Math.floor((abs % D) / H)\n const minutes = Math.floor((abs % H) / I)\n const seconds = abs % I\n\n let date = ''\n if (years > 0) date += `${years}Y`\n if (months > 0) date += `${months}M`\n if (days > 0) date += `${days}D`\n let time = ''\n if (hours > 0) time += `${hours}H`\n if (minutes > 0) time += `${minutes}M`\n if (seconds > 0) time += `${roundToNearest(seconds, 0.001)}S`\n // A duration must carry at least one component, so a zero duration is\n // written as `PT0S`. The time designator is only written when a time\n // component follows it; a trailing `T` is not a valid duration.\n if (!date && !time) time = '0S'\n return `${sign}P${date}${time && `T${time}`}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ValidationError } from '@amazon/vinyl-util'\n\nexport function throwParsingError(message: string): never {\n throw new ValidationError(message, ErrorOrigin.PARSING)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Parser definitions for a dash manifest.\n * Attribute order does not matter, element order matters for writing.\n *\n * @module\n */\n\nimport type { actuateType, UriType } from '@amazon/vinyl-xml'\nimport {\n assertActuateEnum,\n attr,\n attrBoolean,\n attrDateTime,\n attrFloat,\n attrInt,\n attrString,\n charactersString,\n element,\n elements,\n type XmlRules,\n} from '@amazon/vinyl-xml'\nimport { ErrorOrigin, stringify } from '@amazon/vinyl-util'\nimport { isOneOf, number, type Validator } from '@amazon/vinyl-validation'\nimport { parseDuration, stringifyDuration } from '../duration/duration'\nimport { parseByteRange, stringifyByteRange } from '../media/byteRange'\nimport { parseRatio, stringifyRatio } from '../media/ratio'\nimport { parseFrameRate, stringifyFrameRate } from '../media/frameRate'\nimport type {\n AdaptationSetType,\n BaseURLType,\n ConditionalUintType,\n ContentComponentType,\n DashManifest,\n DescriptorType,\n EventStreamType,\n EventType,\n MetricsType,\n MPDtype,\n MultipleSegmentBaseType,\n PeriodType,\n PresentationType,\n ProgramInformationType,\n RangeType,\n RepresentationBaseType,\n RepresentationType,\n SegmentBaseType,\n SegmentListType,\n SegmentTemplateType,\n SegmentTimelineType,\n SegmentTimelineTypeSType,\n SegmentURLType,\n SubRepresentationType,\n SubsetType,\n SwitchingType,\n SwitchingTypeType,\n URLType,\n VideoScanType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\n\nexport const dashNamespaceUri = 'urn:mpeg:dash:schema:mpd:2011'\n\nexport function dashManifestXmlRules(): XmlRules<DashManifest> {\n const attrActuateType = attr<actuateType>(assertActuateEnum, stringify, {\n default: 'onRequest',\n } as const)\n\n const descriptorType: XmlRules<DescriptorType> = {\n id: attrString,\n schemeIdUri: attrString({ required: true }),\n value: attrString,\n } as const\n\n const baseURLType: XmlRules<BaseURLType> = {\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrFloat,\n byteRange: attrString,\n serviceLocation: attrString,\n _content: charactersString,\n } as const\n\n const contentComponentType: XmlRules<ContentComponentType> = {\n contentType: attrString,\n id: attrInt,\n lang: attrString,\n par: attr(parseRatio, stringifyRatio),\n Accessibility: elements(descriptorType),\n Rating: elements(descriptorType),\n Role: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n } as const\n\n const urlType: XmlRules<URLType> = {\n range: attr(parseByteRange, stringifyByteRange),\n sourceURL: attrString,\n } as const\n\n const uriType: XmlRules<UriType> = { _content: charactersString } as const\n\n const segmentBaseType: XmlRules<SegmentBaseType> = {\n Initialization: element(urlType),\n RepresentationIndex: element(urlType),\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrInt,\n indexRange: attr(parseByteRange, stringifyByteRange),\n indexRangeExact: attrBoolean({ default: false }),\n presentationTimeOffset: attrFloat,\n timescale: attrInt,\n } as const\n\n const segmentTimelineTypeSType: XmlRules<SegmentTimelineTypeSType> = {\n d: attrInt({ required: true }),\n n: attrInt,\n r: attrInt({ default: 0 }),\n t: attrInt,\n } as const\n\n const segmentTimelineType: XmlRules<SegmentTimelineType> = {\n S: elements(segmentTimelineTypeSType),\n } as const\n\n const multipleSegmentBaseType: XmlRules<MultipleSegmentBaseType> = {\n ...segmentBaseType,\n SegmentTimeline: element(segmentTimelineType),\n BitstreamSwitching: element(urlType),\n duration: attrInt,\n startNumber: attrInt,\n } as const\n\n const segmentURLType: XmlRules<SegmentURLType> = {\n index: attrString,\n indexRange: attr(parseByteRange, stringifyByteRange),\n media: attrString,\n mediaRange: attr(parseByteRange, stringifyByteRange),\n } as const\n\n const segmentListType: XmlRules<SegmentListType> = {\n ...multipleSegmentBaseType,\n actuate: attrActuateType,\n href: attrString,\n SegmentURL: elements(segmentURLType),\n } as const\n\n const segmentTemplateType: XmlRules<SegmentTemplateType> = {\n ...multipleSegmentBaseType,\n bitstreamSwitching: attrString,\n index: attrString,\n initialization: attrString,\n media: attrString,\n } as const\n\n const subsetType: XmlRules<SubsetType> = {\n contains: attr(parseIntVector, stringifyIntVector, { required: true }),\n id: attrString,\n } as const\n\n const eventType: XmlRules<EventType> = {\n duration: attrInt,\n id: attrInt,\n messageData: attrString,\n presentationTime: attrInt({ default: 0 }),\n } as const\n\n const eventStreamType: XmlRules<EventStreamType> = {\n Event: elements(eventType),\n actuate: attrActuateType,\n href: attrString,\n messageData: attrString,\n schemeIdUri: attrString({ required: true }),\n timescale: attrInt,\n value: attrString,\n } as const\n\n const switchingType: XmlRules<SwitchingType> = {\n interval: attrInt({ required: true }),\n type: attr(parseSwitchingTypeType, stringify),\n } as const\n\n const representationBaseType: XmlRules<RepresentationBaseType> = {\n FramePacking: elements(descriptorType),\n AudioChannelConfiguration: elements(descriptorType),\n ContentProtection: elements(descriptorType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n InbandEventStream: elements(eventStreamType),\n Switching: elements(switchingType),\n audioSamplingRate: attr(parseIntVector, stringifyIntVector),\n codecs: attrString,\n codingDependency: attrBoolean,\n frameRate: attr(parseFrameRate, stringifyFrameRate),\n height: attrInt,\n maximumSAPPeriod: attrInt,\n maxPlayoutRate: attrInt,\n mimeType: attrString,\n profiles: attr(parseProfiles, stringifyProfiles),\n sar: attr(parseRatio, stringifyRatio),\n scanType: attr(parseVideoScan, stringify),\n segmentProfiles: attrString,\n startWithSAP: attr(parseSap, stringify),\n width: attrInt,\n } as const\n\n const subRepresentationType: XmlRules<SubRepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt,\n contentComponent: attr(parseStringVector, stringifyStringVector),\n dependencyLevel: attr(parseIntVector, stringifyIntVector),\n level: attrInt,\n } as const\n\n const representationType: XmlRules<RepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt({ required: true }),\n bitrate: attrInt,\n dependencyId: attr(parseStringVector, stringifyStringVector),\n id: attrString({ required: true }),\n mediaStreamStructureId: attr(parseStringVector, stringifyStringVector),\n qualityRanking: attrInt,\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n SubRepresentation: elements(subRepresentationType),\n } as const\n\n const adaptationSetType: XmlRules<AdaptationSetType> = {\n ...representationBaseType,\n Accessibility: elements(descriptorType),\n Role: elements(descriptorType),\n Rating: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n ContentComponent: elements(contentComponentType),\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n Representation: elements(representationType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean,\n contentType: attrString,\n group: attrInt,\n href: attrString,\n id: attrInt,\n lang: attrString,\n maxBandwidth: attrInt,\n maxFrameRate: attr(parseFrameRate, stringifyFrameRate),\n maxHeight: attrInt,\n maxWidth: attrInt,\n minBandwidth: attrInt,\n minFrameRate: attr(parseFrameRate, stringifyFrameRate),\n minHeight: attrInt,\n minWidth: attrInt,\n par: attr(parseRatio, stringifyRatio),\n segmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n selectionPriority: attrInt({\n default: 1,\n }),\n subsegmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n subsegmentStartsWithSAP: attr(parseSap, stringify, { default: 0 }),\n } as const\n\n const rangeType: XmlRules<RangeType> = {\n duration: attr(parseDuration, stringifyDuration),\n starttime: attr(parseDuration, stringifyDuration),\n } as const\n\n const metricsType: XmlRules<MetricsType> = {\n metrics: attrString({ required: true }),\n Range: elements(rangeType),\n Reporting: elements(descriptorType, { minOccurs: 1 }),\n } as const\n\n const periodType: XmlRules<PeriodType> = {\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n AssetIdentifier: element(descriptorType),\n EventStream: elements(eventStreamType),\n AdaptationSet: elements(adaptationSetType),\n Subset: elements(subsetType),\n SupplementalProperty: elements(descriptorType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean({ default: false }),\n duration: attr(parseDuration, stringifyDuration),\n href: attrString,\n id: attrString,\n start: attr(parseDuration, stringifyDuration),\n } as const\n\n const programInformationType: XmlRules<ProgramInformationType> = {\n lang: attrString,\n moreInformationURL: attrString,\n Copyright: attrString,\n Source: attrString,\n Title: attrString,\n } as const\n\n const mpdType: XmlRules<MPDtype> = {\n ProgramInformation: elements(programInformationType),\n BaseURL: elements(baseURLType),\n Location: elements(uriType),\n Period: elements(periodType, { minOccurs: 1 }),\n Metrics: elements(metricsType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n UTCTiming: elements(descriptorType),\n availabilityEndTime: attrDateTime,\n availabilityStartTime: attrDateTime,\n id: attrString,\n maxSegmentDuration: attr(parseDuration, stringifyDuration),\n maxSubsegmentDuration: attr(parseDuration, stringifyDuration),\n mediaPresentationDuration: attr(parseDuration, stringifyDuration),\n minBufferTime: attr(parseDuration, stringifyDuration, {\n required: true,\n }),\n minimumUpdatePeriod: attr(parseDuration, stringifyDuration),\n profiles: attr(parseProfiles, stringifyProfiles, { required: true }),\n publishTime: attrDateTime,\n suggestedPresentationDelay: attr(parseDuration, stringifyDuration),\n timeShiftBufferDepth: attr(parseDuration, stringifyDuration),\n type: attr(parsePresentationTypeType, stringify, {\n default: 'static',\n } as const),\n } as const\n\n return {\n MPD: element(mpdType, {\n required: true,\n namespaceUri: dashNamespaceUri,\n }),\n } as const\n}\n\n/**\n * Parses a comma delimited list of profiles.\n * Profile values are not whitespace trimmed.\n *\n * @param str\n */\nexport function parseProfiles(str: string): readonly string[] {\n return str.split(',')\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyProfiles(value: readonly string[]): string {\n return value.join(',')\n}\n\nconst videoScanTypeValidator: Validator<VideoScanType> = /* @__PURE__ */ isOneOf(\n 'progressive',\n 'interlaced',\n 'unknown'\n)\n\n/**\n * @private\n */\nexport function parseVideoScan(str: string): VideoScanType {\n videoScanTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst switchingTypeTypeValidator: Validator<SwitchingTypeType> = /* @__PURE__ */ isOneOf(\n 'media',\n 'bitstream'\n)\n\n/**\n * @private\n */\nexport function parseSwitchingTypeType(str: string): SwitchingTypeType {\n switchingTypeTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst validateSap: Validator<number> = /* @__PURE__ */ /* @__PURE__ */ number().within(0, 6)\n\n/**\n * @private\n */\nexport function parseSap(str: string): number {\n const number = parseInt(str)\n validateSap.assert(number, ErrorOrigin.PARSING)\n return number\n}\n\n/**\n * Splits a string by whitespace.\n *\n * @private\n */\nexport function parseStringVector(str: string): readonly string[] {\n return str.split(/\\s+/)\n}\n\n/**\n * Returns the string representation of a string vector value.\n *\n * @param value\n */\nexport function stringifyStringVector(value: readonly string[]): string {\n return value.join(' ')\n}\n\n/**\n * Splits a string by whitespace and parses as int.\n *\n * @private\n */\nexport function parseIntVector(str: string): readonly number[] {\n return str.split(/\\s+/).map((subStr) => parseInt(subStr))\n}\n\n/**\n * Returns the string representation of an int vector value.\n *\n * @param value\n */\nexport function stringifyIntVector(value: readonly number[]): string {\n return value.join(' ')\n}\n\nconst presentationTypeValidator: Validator<PresentationType> = /* @__PURE__ */ isOneOf(\n 'static',\n 'dynamic'\n)\n\n/**\n * Asserts that the given string is one of the {@link PresentationType} enumerated values.\n * @param str\n */\nexport function parsePresentationTypeType(str: string): PresentationType {\n presentationTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\n/**\n * Parses a string into true, false, or a number.\n *\n * @private\n */\nexport function parseConditionalUint(str: string): ConditionalUintType {\n const lower = str.toLowerCase()\n switch (lower) {\n case 'true':\n return true\n case 'false':\n return false\n default:\n return parseInt(str)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseIntSafe } from '@amazon/vinyl-util'\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A range of bytes, [from, to (optional, inclusive)].\n */\nexport type ByteRange = readonly [number, number | null]\n\nconst byteRangeExp = /^(-?[0-9]+)-(-?[0-9]*)$/\n\nexport function parseByteRange(str: string): ByteRange {\n const match = str ? byteRangeExp.exec(str) : null\n if (!match) throwParsingError(`invalid byte range: '${str}'`)\n let start = parseInt(match[1])\n // Convert possibly-negative Int32 overflow value to its Uint32 equivalent\n // (reinterpret 32-bit signed integer bits as unsigned)\n if (start < 0) start >>>= 0\n let end = parseIntSafe(match[2])\n if (end != null && end < 0) end = end >>> 0\n return [start, end]\n}\n\n/**\n * Returns the string representation of a {@link ByteRange} value.\n *\n * @param value\n */\nexport function stringifyByteRange(value: ByteRange): string {\n const end = value[1]\n return `${value[0]}-${end == null ? '' : end}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A numerator and denominator.\n */\nexport type Ratio = readonly [number, number]\n\n/**\n * The XSD specifies `[0-9]*`, and not `[0-9]+`, which would match `'23:'`\n * For missing dimensions, default to 1.\n */\nconst ratioRegExp = /^([0-9]*):([0-9]*)$/\n\n/**\n * Parses a string representing a ratio into [number, number].\n * The string must satisfy the pattern: `/^([0-9]*):([0-9]*)$/`\n * Examples:\n * ```\n * parseRatio('4:3') // [4, 3]\n * parseRatio('16:9') // [16, 9]\n * parseRatio('2:') // [2, 1]\n * ```\n *\n * @private\n */\nexport function parseRatio(str: string): Ratio {\n const match = str ? ratioRegExp.exec(str) : null\n if (!match) throwParsingError(`invalid ratio format: ${str}`)\n return [parseInt(match[1] || '1'), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link Ratio} value.\n *\n * @param value\n */\nexport function stringifyRatio(value: Ratio): string {\n return `${value[0]}:${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\nexport type FrameRate = readonly [number, number]\n\nconst framerateRegexp = /^(\\d+)(?:\\/(\\d+))?$/\n\n/**\n * Parses a string into a {@link FrameRate}\n *\n * @private\n */\nexport function parseFrameRate(str: string): FrameRate {\n const match = str ? framerateRegexp.exec(str) : null\n if (!match) throwParsingError(`invalid frame rate: '${str}'`)\n return [parseInt(match[1]), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyFrameRate(value: FrameRate): string {\n return value[1] === 1 ? value[0].toString() : `${value[0]}/${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReservedXmlRuleKeys } from '@amazon/vinyl-xml'\nimport {\n mapXmlRules,\n type Merged,\n mergeXmlRules,\n parseXml,\n ParseXmlHandlerImpl,\n stringifyXml,\n} from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../xmlns/microsoft/playready'\nimport type { CencContentProtection } from '../xmlns/mpeg/cenc/2013'\nimport type {\n DashManifest,\n DescriptorType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\nimport { dashManifestXmlRules } from './dashManifestXmlRules'\nimport { cencXmlRules } from './ext/drm/cencXmlRules'\nimport type { DashProtections } from './ext/drm/contentProtection'\nimport { createDashProtectionXmlRules } from './ext/drm/contentProtection'\nimport { playreadyXmlRules } from './ext/drm/playreadyXmlRules'\nimport type { OptionalDeep } from '@amazon/vinyl-util'\n\n/**\n * Creates a Dash Manifest parser with supported extensions.\n *\n * @module\n */\n\nexport type DashDrmManifest = Merged<\n DashManifest & DashProtections<ContentProtection>\n>\n\nexport interface ContentProtection\n extends DescriptorType, CencContentProtection, PlayreadyContentProtection {}\n\nexport const dashDrmRules = /* @__PURE__ */ mergeXmlRules(\n /* @__PURE__ */ dashManifestXmlRules(),\n /* @__PURE__ */ createDashProtectionXmlRules(cencXmlRules),\n /* @__PURE__ */ createDashProtectionXmlRules(playreadyXmlRules)\n)\n\nconst dashDrmRulesMapped = /* @__PURE__ */ mapXmlRules(dashDrmRules)\n\n/**\n * A Content handler for a dash manifest.\n */\nfunction dashManifestHandler() {\n return new ParseXmlHandlerImpl(dashDrmRulesMapped)\n}\n\n/**\n * Parses a Dash Manifest, according to the mpd:2011 schema.\n * @see https://raw.githubusercontent.com/Dash-Industry-Forum/MPEG-Conformance-and-reference-source/master/conformance/MPDValidator/schemas/DASH-MPD.xsd\n * @param manifest\n */\nexport function parseDashManifest(manifest: string): DashDrmManifest {\n return parseXml(manifest, dashManifestHandler())\n}\n\nexport function stringifyDashManifest(\n manifest: OptionalDeep<DashDrmManifest, ReservedXmlRuleKeys>\n): string {\n return stringifyXml(manifest, dashDrmRulesMapped)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n parseStringVector,\n stringifyStringVector,\n} from '../../dashManifestXmlRules'\nimport type { XmlRules } from '@amazon/vinyl-xml'\nimport { attr, charactersString, element } from '@amazon/vinyl-xml'\nimport type { CencContentProtection } from '../../../xmlns/mpeg/cenc/2013'\nimport { CENC_NAMESPACE_URI } from '../../../xmlns/mpeg/cenc/2013'\n\n/**\n * A parser for ContentProtection elements using the cenc namespace.\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n */\nexport const cencXmlRules: XmlRules<CencContentProtection> = {\n default_KID: /* @__PURE__ */ attr(parseStringVector, stringifyStringVector, {\n namespaceUri: CENC_NAMESPACE_URI,\n }),\n pssh: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: CENC_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection xml types.\n *\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n * @module\n */\n\nexport const CENC_NAMESPACE_URI = 'urn:mpeg:cenc:2013'\n\n/**\n * A 128-bit integer written in canonical UUID notation.\n * Must be in the form:\n * `[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}`\n */\nexport type KeyIdType = string\n\nexport interface CencContentProtection {\n readonly default_KID?: readonly KeyIdType[]\n readonly pssh?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { element, elements, type XmlRules } from '@amazon/vinyl-xml'\nimport { dashNamespaceUri } from '../../dashManifestXmlRules'\n\n/**\n * ContentProtection extension point for Dash manifests.\n *\n * @module\n */\n\nexport interface WithProtections<T> {\n readonly ContentProtection?: readonly T[]\n}\n\nexport interface RepresentationTypeProtections<T> extends WithProtections<T> {\n readonly SubRepresentation?: readonly WithProtections<T>[]\n}\n\nexport interface AdaptationSetProtections<T> extends WithProtections<T> {\n readonly Representation?: readonly RepresentationTypeProtections<T>[]\n}\n\nexport interface PeriodProtections<T> {\n readonly AdaptationSet?: readonly AdaptationSetProtections<T>[]\n}\n\nexport interface MPDProtections<T> {\n readonly Period: readonly PeriodProtections<T>[]\n}\n\nexport interface DashProtections<T> {\n readonly MPD: MPDProtections<T>\n}\n\n/**\n * Creates a dash extension for content protection parsing rules.\n *\n * @param contentProtectionRules Rules to be used when processing `ContentProtection` elements.\n * @return Returns a rules map that should be merged with the dash manifest rules.\n */\nexport function createDashProtectionXmlRules<T extends object>(\n contentProtectionRules: XmlRules<T>\n): XmlRules<DashProtections<T>> {\n const withProtections: XmlRules<WithProtections<T>> = {\n ContentProtection: elements(contentProtectionRules),\n } as const\n\n return {\n MPD: element<MPDProtections<T>>(\n {\n Period: elements<PeriodProtections<T>>(\n {\n AdaptationSet: elements<AdaptationSetProtections<T>>({\n ...withProtections,\n Representation: elements<\n RepresentationTypeProtections<T>\n >({\n ...withProtections,\n SubRepresentation:\n elements<WithProtections<T>>(\n withProtections\n ),\n }),\n }),\n },\n {\n minOccurs: 1,\n }\n ),\n },\n { required: true, namespaceUri: dashNamespaceUri } as const\n ),\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { charactersString, element, type XmlRules } from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../../../xmlns/microsoft/playready'\nimport { PLAY_READY_NAMESPACE_URI } from '../../../xmlns/microsoft/playready'\n\nexport const playreadyXmlRules: XmlRules<PlayreadyContentProtection> = {\n pro: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: PLAY_READY_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection playready.\n *\n * @see https://learn.microsoft.com/en-us/playready/specifications/mpeg-dash-playready#21-dash-contentprotection-descriptor-elements\n * @module\n */\n\nexport const PLAY_READY_NAMESPACE_URI = 'urn:microsoft:playready'\n\nexport interface PlayreadyContentProtection {\n readonly pro?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const ContentProtectionScheme = {\n /**\n * CENC protection scheme. (Should not be used to create a key session)\n */\n CENC: 'urn:mpeg:dash:mp4protection:2011',\n\n /**\n * A simple, unencrypted content protection scheme. Not a full DRM solution.\n */\n CLEAR_KEY: 'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e',\n\n /**\n * Apple's FairPlay.\n */\n FAIR_PLAY: 'urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2',\n\n /**\n * Open-standards community initiative by Marlin Developer Community.\n */\n MARLIN: 'urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4',\n\n /**\n * Microsoft's PlayReady.\n */\n PLAY_READY: 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95',\n\n /**\n * An old, unused PlayReady scheme id.\n */\n PLAY_READY_DEPRECATED: 'urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95',\n\n /**\n * Google's Widevine.\n */\n WIDEVINE: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed',\n} as const\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,wBAIO;AAKP,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AAUV,IAAM,kBACF;AAwBG,SAAS,cAAc,OAAyB;AACnD,QAAM,QAAQ,gBAAgB,KAAK,KAAK;AACxC,MAAI,SAAS;AACT,UAAM,IAAI;AAAA,MACN,yBAAyB,KAAK;AAAA,MAC9B,8BAAY;AAAA,IAChB;AAEJ,QAAM,OAAO,MAAM,CAAC,MAAM,MAAM,KAAK;A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AAAA,EACJ;AACJ;;;ACxEA,IAAAC,oBAAyD;;;ACSlD,IAAM,2BAA2B;;;ADLjC,IAAM,oBAA0D;AAAA,EACnE,KAAqB;AAAA,IACjB;AAAA,MACI,UAAU;AAAA,IACd;AAAA,IACA;AAAA,MACI,cAAc;AAAA,IAClB;AAAA,EACJ;AACJ;;;AJsBO,IAAM,eAA+B;AAAA,EACxB,qCAAqB;AAAA,EACrB,6CAA6B,YAAY;AAAA,EACzC,6CAA6B,iBAAiB;AAClE;AAEA,IAAM,qBAAqC,mDAAY,YAAY;AAKnE,SAAS,sBAAsB;AAC3B,SAAO,IAAI,sCAAoB,kBAAkB;AACrD;AAOO,SAAS,kBAAkB,UAAmC;AACjE,aAAO,4BAAS,UAAU,oBAAoB,CAAC;AACnD;AAEO,SAAS,sBACZ,UACM;AACN,aAAO,gCAAa,UAAU,kBAAkB;AACpD;;;AM/DO,IAAM,0BAA0B;AAAA;AAAA;AAAA;AAAA,EAInC,MAAM;AAAA;AAAA;AAAA;AAAA,EAKN,WAAW;AAAA;AAAA;AAAA;AAAA,EAKX,WAAW;AAAA;AAAA;AAAA;AAAA,EAKX,QAAQ;AAAA;AAAA;AAAA;AAAA,EAKR,YAAY;AAAA;AAAA;AAAA;AAAA,EAKZ,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAKvB,UAAU;AACd;",
|
|
6
6
|
"names": ["import_vinyl_util", "import_vinyl_util", "import_vinyl_util", "number", "import_vinyl_xml", "import_vinyl_xml", "import_vinyl_xml", "import_vinyl_xml"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -45,20 +45,21 @@ function stringifyDuration(value) {
|
|
|
45
45
|
let abs = Math.abs(value);
|
|
46
46
|
const years = Math.floor(abs / Y);
|
|
47
47
|
abs -= years * Y;
|
|
48
|
-
const months = Math.floor(abs
|
|
48
|
+
const months = Math.floor(abs / M);
|
|
49
49
|
const days = Math.floor(abs % M / D);
|
|
50
50
|
const hours = Math.floor(abs % D / H);
|
|
51
51
|
const minutes = Math.floor(abs % H / I);
|
|
52
52
|
const seconds = abs % I;
|
|
53
|
-
let
|
|
54
|
-
if (years > 0)
|
|
55
|
-
if (months > 0)
|
|
56
|
-
if (days > 0)
|
|
57
|
-
|
|
58
|
-
if (hours > 0)
|
|
59
|
-
if (minutes > 0)
|
|
60
|
-
if (seconds > 0
|
|
61
|
-
|
|
53
|
+
let date = "";
|
|
54
|
+
if (years > 0) date += `${years}Y`;
|
|
55
|
+
if (months > 0) date += `${months}M`;
|
|
56
|
+
if (days > 0) date += `${days}D`;
|
|
57
|
+
let time = "";
|
|
58
|
+
if (hours > 0) time += `${hours}H`;
|
|
59
|
+
if (minutes > 0) time += `${minutes}M`;
|
|
60
|
+
if (seconds > 0) time += `${roundToNearest(seconds, 1e-3)}S`;
|
|
61
|
+
if (!date && !time) time = "0S";
|
|
62
|
+
return `${sign}P${date}${time && `T${time}`}`;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
// src/error/parsingError.ts
|
|
@@ -559,6 +560,7 @@ export {
|
|
|
559
560
|
PLAY_READY_NAMESPACE_URI,
|
|
560
561
|
cencXmlRules,
|
|
561
562
|
createDashProtectionXmlRules,
|
|
563
|
+
dashDrmRules,
|
|
562
564
|
dashManifestXmlRules,
|
|
563
565
|
dashNamespaceUri,
|
|
564
566
|
parseByteRange,
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/duration/duration.ts", "../src/error/parsingError.ts", "../src/manifest/dashManifestXmlRules.ts", "../src/media/byteRange.ts", "../src/media/ratio.ts", "../src/media/frameRate.ts", "../src/manifest/dashParser.ts", "../src/manifest/ext/drm/cencXmlRules.ts", "../src/xmlns/mpeg/cenc/2013.ts", "../src/manifest/ext/drm/contentProtection.ts", "../src/manifest/ext/drm/playreadyXmlRules.ts", "../src/xmlns/microsoft/playready.ts", "../src/manifest/ext/drm/ContentProtectionScheme.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n ErrorOrigin,\n roundToNearest,\n ValidationError,\n} from '@amazon/vinyl-util'\n\n// ESBuild (https://github.com/evanw/esbuild/issues/3988) considers multiplication and division\n// to have a side effect and will inhibit tree shaking.\n// E.g. H = 60 * 60 will not be removed when not referenced.\nconst I = 60\nconst H = 3600\nconst D = 86400\nconst M = 2592000\nconst Y = 31536000\n\n/**\n * A duration, in seconds. (This may be negative)\n */\nexport type Duration = number\n\n/**\n * https://www.w3.org/TR/xmlschema-2/#duration\n */\nconst iso8601Duration =\n /^(-?)P?(\\d+(?:\\.\\d*)?Y)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?D)?T?(\\d+(?:\\.\\d*)?H)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?S?)?$/i\n\n/**\n * Parses an ISO 8601 duration into seconds.\n * The accepted format is P(n)Y(n)M(n)DT(n)H(n)M(n)S\n *\n * All units shall have a fixed size.\n *\n * P - Period designator, precedes all durations.\n * 1Y (Year) = 365 * 24 * 60 * 60 Seconds\n * 1M (Month) = 30 * 24 * 60 * 60 Seconds\n * 1D (Day) = 24 * 60 * 60 Seconds\n *\n * T - Time designator, precedes all time components.\n * 1H (Hour) = 60 * 60 Seconds\n * 1M (Minute) = 60 Seconds\n * 1S (Second)\n *\n *\n * @param value\n * @return Returns the duration in seconds or throws an {@link ValidationError}\n * if not properly formatted.\n * @see https://www.w3.org/TR/xmlschema-2/#duration\n */\nexport function parseDuration(value: string): Duration {\n const match = iso8601Duration.exec(value)\n if (match == null)\n throw new ValidationError(\n `Unexpected duration: '${value}', should be in iso 8601 format`,\n ErrorOrigin.PARSING\n )\n\n const sign = match[1] === '-' ? -1 : 1\n return (\n sign *\n (parseFloat(match[2] || '0') * Y +\n parseFloat(match[3] || '0') * M +\n parseFloat(match[4] || '0') * D +\n parseFloat(match[5] || '0') * H +\n parseFloat(match[6] || '0') * I +\n parseFloat(match[7] || '0'))\n )\n}\n\n/**\n * Returns the iso 8601 string representation of a duration value.\n *\n * @param value A duration value, in seconds.\n */\nexport function stringifyDuration(value: Duration): string {\n const sign = value < 0 ? '-' : ''\n let abs = Math.abs(value)\n\n const years = Math.floor(abs / Y)\n abs -= years * Y\n const months = Math.floor((abs % Y) / M)\n const days = Math.floor((abs % M) / D)\n const hours = Math.floor((abs % D) / H)\n const minutes = Math.floor((abs % H) / I)\n const seconds = abs % I\n let isoString = `${sign}P`\n if (years > 0) isoString += `${years}Y`\n if (months > 0) isoString += `${months}M`\n if (days > 0) isoString += `${days}D`\n isoString += 'T'\n if (hours > 0) isoString += `${hours}H`\n if (minutes > 0) isoString += `${minutes}M`\n if (seconds > 0 || !value) isoString += `${roundToNearest(seconds, 0.001)}S`\n return isoString\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ValidationError } from '@amazon/vinyl-util'\n\nexport function throwParsingError(message: string): never {\n throw new ValidationError(message, ErrorOrigin.PARSING)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Parser definitions for a dash manifest.\n * Attribute order does not matter, element order matters for writing.\n *\n * @module\n */\n\nimport type { actuateType, UriType } from '@amazon/vinyl-xml'\nimport {\n assertActuateEnum,\n attr,\n attrBoolean,\n attrDateTime,\n attrFloat,\n attrInt,\n attrString,\n charactersString,\n element,\n elements,\n type XmlRules,\n} from '@amazon/vinyl-xml'\nimport { ErrorOrigin, stringify } from '@amazon/vinyl-util'\nimport { isOneOf, number, type Validator } from '@amazon/vinyl-validation'\nimport { parseDuration, stringifyDuration } from '../duration/duration'\nimport { parseByteRange, stringifyByteRange } from '../media/byteRange'\nimport { parseRatio, stringifyRatio } from '../media/ratio'\nimport { parseFrameRate, stringifyFrameRate } from '../media/frameRate'\nimport type {\n AdaptationSetType,\n BaseURLType,\n ConditionalUintType,\n ContentComponentType,\n DashManifest,\n DescriptorType,\n EventStreamType,\n EventType,\n MetricsType,\n MPDtype,\n MultipleSegmentBaseType,\n PeriodType,\n PresentationType,\n ProgramInformationType,\n RangeType,\n RepresentationBaseType,\n RepresentationType,\n SegmentBaseType,\n SegmentListType,\n SegmentTemplateType,\n SegmentTimelineType,\n SegmentTimelineTypeSType,\n SegmentURLType,\n SubRepresentationType,\n SubsetType,\n SwitchingType,\n SwitchingTypeType,\n URLType,\n VideoScanType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\n\nexport const dashNamespaceUri = 'urn:mpeg:dash:schema:mpd:2011'\n\nexport function dashManifestXmlRules(): XmlRules<DashManifest> {\n const attrActuateType = attr<actuateType>(assertActuateEnum, stringify, {\n default: 'onRequest',\n } as const)\n\n const descriptorType: XmlRules<DescriptorType> = {\n id: attrString,\n schemeIdUri: attrString({ required: true }),\n value: attrString,\n } as const\n\n const baseURLType: XmlRules<BaseURLType> = {\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrFloat,\n byteRange: attrString,\n serviceLocation: attrString,\n _content: charactersString,\n } as const\n\n const contentComponentType: XmlRules<ContentComponentType> = {\n contentType: attrString,\n id: attrInt,\n lang: attrString,\n par: attr(parseRatio, stringifyRatio),\n Accessibility: elements(descriptorType),\n Rating: elements(descriptorType),\n Role: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n } as const\n\n const urlType: XmlRules<URLType> = {\n range: attr(parseByteRange, stringifyByteRange),\n sourceURL: attrString,\n } as const\n\n const uriType: XmlRules<UriType> = { _content: charactersString } as const\n\n const segmentBaseType: XmlRules<SegmentBaseType> = {\n Initialization: element(urlType),\n RepresentationIndex: element(urlType),\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrInt,\n indexRange: attr(parseByteRange, stringifyByteRange),\n indexRangeExact: attrBoolean({ default: false }),\n presentationTimeOffset: attrFloat,\n timescale: attrInt,\n } as const\n\n const segmentTimelineTypeSType: XmlRules<SegmentTimelineTypeSType> = {\n d: attrInt({ required: true }),\n n: attrInt,\n r: attrInt({ default: 0 }),\n t: attrInt,\n } as const\n\n const segmentTimelineType: XmlRules<SegmentTimelineType> = {\n S: elements(segmentTimelineTypeSType),\n } as const\n\n const multipleSegmentBaseType: XmlRules<MultipleSegmentBaseType> = {\n ...segmentBaseType,\n SegmentTimeline: element(segmentTimelineType),\n BitstreamSwitching: element(urlType),\n duration: attrInt,\n startNumber: attrInt,\n } as const\n\n const segmentURLType: XmlRules<SegmentURLType> = {\n index: attrString,\n indexRange: attr(parseByteRange, stringifyByteRange),\n media: attrString,\n mediaRange: attr(parseByteRange, stringifyByteRange),\n } as const\n\n const segmentListType: XmlRules<SegmentListType> = {\n ...multipleSegmentBaseType,\n actuate: attrActuateType,\n href: attrString,\n SegmentURL: elements(segmentURLType),\n } as const\n\n const segmentTemplateType: XmlRules<SegmentTemplateType> = {\n ...multipleSegmentBaseType,\n bitstreamSwitching: attrString,\n index: attrString,\n initialization: attrString,\n media: attrString,\n } as const\n\n const subsetType: XmlRules<SubsetType> = {\n contains: attr(parseIntVector, stringifyIntVector, { required: true }),\n id: attrString,\n } as const\n\n const eventType: XmlRules<EventType> = {\n duration: attrInt,\n id: attrInt,\n messageData: attrString,\n presentationTime: attrInt({ default: 0 }),\n } as const\n\n const eventStreamType: XmlRules<EventStreamType> = {\n Event: elements(eventType),\n actuate: attrActuateType,\n href: attrString,\n messageData: attrString,\n schemeIdUri: attrString({ required: true }),\n timescale: attrInt,\n value: attrString,\n } as const\n\n const switchingType: XmlRules<SwitchingType> = {\n interval: attrInt({ required: true }),\n type: attr(parseSwitchingTypeType, stringify),\n } as const\n\n const representationBaseType: XmlRules<RepresentationBaseType> = {\n FramePacking: elements(descriptorType),\n AudioChannelConfiguration: elements(descriptorType),\n ContentProtection: elements(descriptorType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n InbandEventStream: elements(eventStreamType),\n Switching: elements(switchingType),\n audioSamplingRate: attr(parseIntVector, stringifyIntVector),\n codecs: attrString,\n codingDependency: attrBoolean,\n frameRate: attr(parseFrameRate, stringifyFrameRate),\n height: attrInt,\n maximumSAPPeriod: attrInt,\n maxPlayoutRate: attrInt,\n mimeType: attrString,\n profiles: attr(parseProfiles, stringifyProfiles),\n sar: attr(parseRatio, stringifyRatio),\n scanType: attr(parseVideoScan, stringify),\n segmentProfiles: attrString,\n startWithSAP: attr(parseSap, stringify),\n width: attrInt,\n } as const\n\n const subRepresentationType: XmlRules<SubRepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt,\n contentComponent: attr(parseStringVector, stringifyStringVector),\n dependencyLevel: attr(parseIntVector, stringifyIntVector),\n level: attrInt,\n } as const\n\n const representationType: XmlRules<RepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt({ required: true }),\n bitrate: attrInt,\n dependencyId: attr(parseStringVector, stringifyStringVector),\n id: attrString({ required: true }),\n mediaStreamStructureId: attr(parseStringVector, stringifyStringVector),\n qualityRanking: attrInt,\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n SubRepresentation: elements(subRepresentationType),\n } as const\n\n const adaptationSetType: XmlRules<AdaptationSetType> = {\n ...representationBaseType,\n Accessibility: elements(descriptorType),\n Role: elements(descriptorType),\n Rating: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n ContentComponent: elements(contentComponentType),\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n Representation: elements(representationType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean,\n contentType: attrString,\n group: attrInt,\n href: attrString,\n id: attrInt,\n lang: attrString,\n maxBandwidth: attrInt,\n maxFrameRate: attr(parseFrameRate, stringifyFrameRate),\n maxHeight: attrInt,\n maxWidth: attrInt,\n minBandwidth: attrInt,\n minFrameRate: attr(parseFrameRate, stringifyFrameRate),\n minHeight: attrInt,\n minWidth: attrInt,\n par: attr(parseRatio, stringifyRatio),\n segmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n selectionPriority: attrInt({\n default: 1,\n }),\n subsegmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n subsegmentStartsWithSAP: attr(parseSap, stringify, { default: 0 }),\n } as const\n\n const rangeType: XmlRules<RangeType> = {\n duration: attr(parseDuration, stringifyDuration),\n starttime: attr(parseDuration, stringifyDuration),\n } as const\n\n const metricsType: XmlRules<MetricsType> = {\n metrics: attrString({ required: true }),\n Range: elements(rangeType),\n Reporting: elements(descriptorType, { minOccurs: 1 }),\n } as const\n\n const periodType: XmlRules<PeriodType> = {\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n AssetIdentifier: element(descriptorType),\n EventStream: elements(eventStreamType),\n AdaptationSet: elements(adaptationSetType),\n Subset: elements(subsetType),\n SupplementalProperty: elements(descriptorType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean({ default: false }),\n duration: attr(parseDuration, stringifyDuration),\n href: attrString,\n id: attrString,\n start: attr(parseDuration, stringifyDuration),\n } as const\n\n const programInformationType: XmlRules<ProgramInformationType> = {\n lang: attrString,\n moreInformationURL: attrString,\n Copyright: attrString,\n Source: attrString,\n Title: attrString,\n } as const\n\n const mpdType: XmlRules<MPDtype> = {\n ProgramInformation: elements(programInformationType),\n BaseURL: elements(baseURLType),\n Location: elements(uriType),\n Period: elements(periodType, { minOccurs: 1 }),\n Metrics: elements(metricsType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n UTCTiming: elements(descriptorType),\n availabilityEndTime: attrDateTime,\n availabilityStartTime: attrDateTime,\n id: attrString,\n maxSegmentDuration: attr(parseDuration, stringifyDuration),\n maxSubsegmentDuration: attr(parseDuration, stringifyDuration),\n mediaPresentationDuration: attr(parseDuration, stringifyDuration),\n minBufferTime: attr(parseDuration, stringifyDuration, {\n required: true,\n }),\n minimumUpdatePeriod: attr(parseDuration, stringifyDuration),\n profiles: attr(parseProfiles, stringifyProfiles, { required: true }),\n publishTime: attrDateTime,\n suggestedPresentationDelay: attr(parseDuration, stringifyDuration),\n timeShiftBufferDepth: attr(parseDuration, stringifyDuration),\n type: attr(parsePresentationTypeType, stringify, {\n default: 'static',\n } as const),\n } as const\n\n return {\n MPD: element(mpdType, {\n required: true,\n namespaceUri: dashNamespaceUri,\n }),\n } as const\n}\n\n/**\n * Parses a comma delimited list of profiles.\n * Profile values are not whitespace trimmed.\n *\n * @param str\n */\nexport function parseProfiles(str: string): readonly string[] {\n return str.split(',')\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyProfiles(value: readonly string[]): string {\n return value.join(',')\n}\n\nconst videoScanTypeValidator: Validator<VideoScanType> = /* @__PURE__ */ isOneOf(\n 'progressive',\n 'interlaced',\n 'unknown'\n)\n\n/**\n * @private\n */\nexport function parseVideoScan(str: string): VideoScanType {\n videoScanTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst switchingTypeTypeValidator: Validator<SwitchingTypeType> = /* @__PURE__ */ isOneOf(\n 'media',\n 'bitstream'\n)\n\n/**\n * @private\n */\nexport function parseSwitchingTypeType(str: string): SwitchingTypeType {\n switchingTypeTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst validateSap: Validator<number> = /* @__PURE__ */ /* @__PURE__ */ number().within(0, 6)\n\n/**\n * @private\n */\nexport function parseSap(str: string): number {\n const number = parseInt(str)\n validateSap.assert(number, ErrorOrigin.PARSING)\n return number\n}\n\n/**\n * Splits a string by whitespace.\n *\n * @private\n */\nexport function parseStringVector(str: string): readonly string[] {\n return str.split(/\\s+/)\n}\n\n/**\n * Returns the string representation of a string vector value.\n *\n * @param value\n */\nexport function stringifyStringVector(value: readonly string[]): string {\n return value.join(' ')\n}\n\n/**\n * Splits a string by whitespace and parses as int.\n *\n * @private\n */\nexport function parseIntVector(str: string): readonly number[] {\n return str.split(/\\s+/).map((subStr) => parseInt(subStr))\n}\n\n/**\n * Returns the string representation of an int vector value.\n *\n * @param value\n */\nexport function stringifyIntVector(value: readonly number[]): string {\n return value.join(' ')\n}\n\nconst presentationTypeValidator: Validator<PresentationType> = /* @__PURE__ */ isOneOf(\n 'static',\n 'dynamic'\n)\n\n/**\n * Asserts that the given string is one of the {@link PresentationType} enumerated values.\n * @param str\n */\nexport function parsePresentationTypeType(str: string): PresentationType {\n presentationTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\n/**\n * Parses a string into true, false, or a number.\n *\n * @private\n */\nexport function parseConditionalUint(str: string): ConditionalUintType {\n const lower = str.toLowerCase()\n switch (lower) {\n case 'true':\n return true\n case 'false':\n return false\n default:\n return parseInt(str)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseIntSafe } from '@amazon/vinyl-util'\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A range of bytes, [from, to (optional, inclusive)].\n */\nexport type ByteRange = readonly [number, number | null]\n\nconst byteRangeExp = /^(-?[0-9]+)-(-?[0-9]*)$/\n\nexport function parseByteRange(str: string): ByteRange {\n const match = str ? byteRangeExp.exec(str) : null\n if (!match) throwParsingError(`invalid byte range: '${str}'`)\n let start = parseInt(match[1])\n // Convert possibly-negative Int32 overflow value to its Uint32 equivalent\n // (reinterpret 32-bit signed integer bits as unsigned)\n if (start < 0) start >>>= 0\n let end = parseIntSafe(match[2])\n if (end != null && end < 0) end = end >>> 0\n return [start, end]\n}\n\n/**\n * Returns the string representation of a {@link ByteRange} value.\n *\n * @param value\n */\nexport function stringifyByteRange(value: ByteRange): string {\n const end = value[1]\n return `${value[0]}-${end == null ? '' : end}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A numerator and denominator.\n */\nexport type Ratio = readonly [number, number]\n\n/**\n * The XSD specifies `[0-9]*`, and not `[0-9]+`, which would match `'23:'`\n * For missing dimensions, default to 1.\n */\nconst ratioRegExp = /^([0-9]*):([0-9]*)$/\n\n/**\n * Parses a string representing a ratio into [number, number].\n * The string must satisfy the pattern: `/^([0-9]*):([0-9]*)$/`\n * Examples:\n * ```\n * parseRatio('4:3') // [4, 3]\n * parseRatio('16:9') // [16, 9]\n * parseRatio('2:') // [2, 1]\n * ```\n *\n * @private\n */\nexport function parseRatio(str: string): Ratio {\n const match = str ? ratioRegExp.exec(str) : null\n if (!match) throwParsingError(`invalid ratio format: ${str}`)\n return [parseInt(match[1] || '1'), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link Ratio} value.\n *\n * @param value\n */\nexport function stringifyRatio(value: Ratio): string {\n return `${value[0]}:${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\nexport type FrameRate = readonly [number, number]\n\nconst framerateRegexp = /^(\\d+)(?:\\/(\\d+))?$/\n\n/**\n * Parses a string into a {@link FrameRate}\n *\n * @private\n */\nexport function parseFrameRate(str: string): FrameRate {\n const match = str ? framerateRegexp.exec(str) : null\n if (!match) throwParsingError(`invalid frame rate: '${str}'`)\n return [parseInt(match[1]), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyFrameRate(value: FrameRate): string {\n return value[1] === 1 ? value[0].toString() : `${value[0]}/${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReservedXmlRuleKeys } from '@amazon/vinyl-xml'\nimport {\n mapXmlRules,\n type Merged,\n mergeXmlRules,\n parseXml,\n ParseXmlHandlerImpl,\n stringifyXml,\n} from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../xmlns/microsoft/playready'\nimport type { CencContentProtection } from '../xmlns/mpeg/cenc/2013'\nimport type {\n DashManifest,\n DescriptorType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\nimport { dashManifestXmlRules } from './dashManifestXmlRules'\nimport { cencXmlRules } from './ext/drm/cencXmlRules'\nimport type { DashProtections } from './ext/drm/contentProtection'\nimport { createDashProtectionXmlRules } from './ext/drm/contentProtection'\nimport { playreadyXmlRules } from './ext/drm/playreadyXmlRules'\nimport type { OptionalDeep } from '@amazon/vinyl-util'\n\n/**\n * Creates a Dash Manifest parser with supported extensions.\n *\n * @module\n */\n\nexport type DashDrmManifest = Merged<\n DashManifest & DashProtections<ContentProtection>\n>\n\nexport interface ContentProtection\n extends DescriptorType, CencContentProtection, PlayreadyContentProtection {}\n\nconst dashDrmRules = /* @__PURE__ */ mergeXmlRules(\n /* @__PURE__ */ dashManifestXmlRules(),\n /* @__PURE__ */ createDashProtectionXmlRules(cencXmlRules),\n /* @__PURE__ */ createDashProtectionXmlRules(playreadyXmlRules)\n)\n\nconst dashDrmRulesMapped = /* @__PURE__ */ mapXmlRules(dashDrmRules)\n\n/**\n * A Content handler for a dash manifest.\n */\nfunction dashManifestHandler() {\n return new ParseXmlHandlerImpl(dashDrmRulesMapped)\n}\n\n/**\n * Parses a Dash Manifest, according to the mpd:2011 schema.\n * @see https://raw.githubusercontent.com/Dash-Industry-Forum/MPEG-Conformance-and-reference-source/master/conformance/MPDValidator/schemas/DASH-MPD.xsd\n * @param manifest\n */\nexport function parseDashManifest(manifest: string): DashDrmManifest {\n return parseXml(manifest, dashManifestHandler())\n}\n\nexport function stringifyDashManifest(\n manifest: OptionalDeep<DashDrmManifest, ReservedXmlRuleKeys>\n): string {\n return stringifyXml(manifest, dashDrmRulesMapped)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n parseStringVector,\n stringifyStringVector,\n} from '../../dashManifestXmlRules'\nimport type { XmlRules } from '@amazon/vinyl-xml'\nimport { attr, charactersString, element } from '@amazon/vinyl-xml'\nimport type { CencContentProtection } from '../../../xmlns/mpeg/cenc/2013'\nimport { CENC_NAMESPACE_URI } from '../../../xmlns/mpeg/cenc/2013'\n\n/**\n * A parser for ContentProtection elements using the cenc namespace.\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n */\nexport const cencXmlRules: XmlRules<CencContentProtection> = {\n default_KID: /* @__PURE__ */ attr(parseStringVector, stringifyStringVector, {\n namespaceUri: CENC_NAMESPACE_URI,\n }),\n pssh: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: CENC_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection xml types.\n *\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n * @module\n */\n\nexport const CENC_NAMESPACE_URI = 'urn:mpeg:cenc:2013'\n\n/**\n * A 128-bit integer written in canonical UUID notation.\n * Must be in the form:\n * `[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}`\n */\nexport type KeyIdType = string\n\nexport interface CencContentProtection {\n readonly default_KID?: readonly KeyIdType[]\n readonly pssh?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { element, elements, type XmlRules } from '@amazon/vinyl-xml'\nimport { dashNamespaceUri } from '../../dashManifestXmlRules'\n\n/**\n * ContentProtection extension point for Dash manifests.\n *\n * @module\n */\n\nexport interface WithProtections<T> {\n readonly ContentProtection?: readonly T[]\n}\n\nexport interface RepresentationTypeProtections<T> extends WithProtections<T> {\n readonly SubRepresentation?: readonly WithProtections<T>[]\n}\n\nexport interface AdaptationSetProtections<T> extends WithProtections<T> {\n readonly Representation?: readonly RepresentationTypeProtections<T>[]\n}\n\nexport interface PeriodProtections<T> {\n readonly AdaptationSet?: readonly AdaptationSetProtections<T>[]\n}\n\nexport interface MPDProtections<T> {\n readonly Period: readonly PeriodProtections<T>[]\n}\n\nexport interface DashProtections<T> {\n readonly MPD: MPDProtections<T>\n}\n\n/**\n * Creates a dash extension for content protection parsing rules.\n *\n * @param contentProtectionRules Rules to be used when processing `ContentProtection` elements.\n * @return Returns a rules map that should be merged with the dash manifest rules.\n */\nexport function createDashProtectionXmlRules<T extends object>(\n contentProtectionRules: XmlRules<T>\n): XmlRules<DashProtections<T>> {\n const withProtections: XmlRules<WithProtections<T>> = {\n ContentProtection: elements(contentProtectionRules),\n } as const\n\n return {\n MPD: element<MPDProtections<T>>(\n {\n Period: elements<PeriodProtections<T>>(\n {\n AdaptationSet: elements<AdaptationSetProtections<T>>({\n ...withProtections,\n Representation: elements<\n RepresentationTypeProtections<T>\n >({\n ...withProtections,\n SubRepresentation:\n elements<WithProtections<T>>(\n withProtections\n ),\n }),\n }),\n },\n {\n minOccurs: 1,\n }\n ),\n },\n { required: true, namespaceUri: dashNamespaceUri } as const\n ),\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { charactersString, element, type XmlRules } from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../../../xmlns/microsoft/playready'\nimport { PLAY_READY_NAMESPACE_URI } from '../../../xmlns/microsoft/playready'\n\nexport const playreadyXmlRules: XmlRules<PlayreadyContentProtection> = {\n pro: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: PLAY_READY_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection playready.\n *\n * @see https://learn.microsoft.com/en-us/playready/specifications/mpeg-dash-playready#21-dash-contentprotection-descriptor-elements\n * @module\n */\n\nexport const PLAY_READY_NAMESPACE_URI = 'urn:microsoft:playready'\n\nexport interface PlayreadyContentProtection {\n readonly pro?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const ContentProtectionScheme = {\n /**\n * CENC protection scheme. (Should not be used to create a key session)\n */\n CENC: 'urn:mpeg:dash:mp4protection:2011',\n\n /**\n * A simple, unencrypted content protection scheme. Not a full DRM solution.\n */\n CLEAR_KEY: 'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e',\n\n /**\n * Apple's FairPlay.\n */\n FAIR_PLAY: 'urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2',\n\n /**\n * Open-standards community initiative by Marlin Developer Community.\n */\n MARLIN: 'urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4',\n\n /**\n * Microsoft's PlayReady.\n */\n PLAY_READY: 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95',\n\n /**\n * An old, unused PlayReady scheme id.\n */\n PLAY_READY_DEPRECATED: 'urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95',\n\n /**\n * Google's Widevine.\n */\n WIDEVINE: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed',\n} as const\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAKA;AAAA,EACI;AAAA,EAC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|
4
|
+
"sourcesContent": ["/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n ErrorOrigin,\n roundToNearest,\n ValidationError,\n} from '@amazon/vinyl-util'\n\n// ESBuild (https://github.com/evanw/esbuild/issues/3988) considers multiplication and division\n// to have a side effect and will inhibit tree shaking.\n// E.g. H = 60 * 60 will not be removed when not referenced.\nconst I = 60\nconst H = 3600\nconst D = 86400\nconst M = 2592000\nconst Y = 31536000\n\n/**\n * A duration, in seconds. (This may be negative)\n */\nexport type Duration = number\n\n/**\n * https://www.w3.org/TR/xmlschema-2/#duration\n */\nconst iso8601Duration =\n /^(-?)P?(\\d+(?:\\.\\d*)?Y)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?D)?T?(\\d+(?:\\.\\d*)?H)?(\\d+(?:\\.\\d*)?M)?(\\d+(?:\\.\\d*)?S?)?$/i\n\n/**\n * Parses an ISO 8601 duration into seconds.\n * The accepted format is P(n)Y(n)M(n)DT(n)H(n)M(n)S\n *\n * All units shall have a fixed size.\n *\n * P - Period designator, precedes all durations.\n * 1Y (Year) = 365 * 24 * 60 * 60 Seconds\n * 1M (Month) = 30 * 24 * 60 * 60 Seconds\n * 1D (Day) = 24 * 60 * 60 Seconds\n *\n * T - Time designator, precedes all time components.\n * 1H (Hour) = 60 * 60 Seconds\n * 1M (Minute) = 60 Seconds\n * 1S (Second)\n *\n *\n * @param value\n * @return Returns the duration in seconds or throws an {@link ValidationError}\n * if not properly formatted.\n * @see https://www.w3.org/TR/xmlschema-2/#duration\n */\nexport function parseDuration(value: string): Duration {\n const match = iso8601Duration.exec(value)\n if (match == null)\n throw new ValidationError(\n `Unexpected duration: '${value}', should be in iso 8601 format`,\n ErrorOrigin.PARSING\n )\n\n const sign = match[1] === '-' ? -1 : 1\n return (\n sign *\n (parseFloat(match[2] || '0') * Y +\n parseFloat(match[3] || '0') * M +\n parseFloat(match[4] || '0') * D +\n parseFloat(match[5] || '0') * H +\n parseFloat(match[6] || '0') * I +\n parseFloat(match[7] || '0'))\n )\n}\n\n/**\n * Returns the iso 8601 string representation of a duration value.\n *\n * @param value A duration value, in seconds.\n */\nexport function stringifyDuration(value: Duration): string {\n const sign = value < 0 ? '-' : ''\n let abs = Math.abs(value)\n\n const years = Math.floor(abs / Y)\n abs -= years * Y\n const months = Math.floor(abs / M)\n const days = Math.floor((abs % M) / D)\n const hours = Math.floor((abs % D) / H)\n const minutes = Math.floor((abs % H) / I)\n const seconds = abs % I\n\n let date = ''\n if (years > 0) date += `${years}Y`\n if (months > 0) date += `${months}M`\n if (days > 0) date += `${days}D`\n let time = ''\n if (hours > 0) time += `${hours}H`\n if (minutes > 0) time += `${minutes}M`\n if (seconds > 0) time += `${roundToNearest(seconds, 0.001)}S`\n // A duration must carry at least one component, so a zero duration is\n // written as `PT0S`. The time designator is only written when a time\n // component follows it; a trailing `T` is not a valid duration.\n if (!date && !time) time = '0S'\n return `${sign}P${date}${time && `T${time}`}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ErrorOrigin, ValidationError } from '@amazon/vinyl-util'\n\nexport function throwParsingError(message: string): never {\n throw new ValidationError(message, ErrorOrigin.PARSING)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Parser definitions for a dash manifest.\n * Attribute order does not matter, element order matters for writing.\n *\n * @module\n */\n\nimport type { actuateType, UriType } from '@amazon/vinyl-xml'\nimport {\n assertActuateEnum,\n attr,\n attrBoolean,\n attrDateTime,\n attrFloat,\n attrInt,\n attrString,\n charactersString,\n element,\n elements,\n type XmlRules,\n} from '@amazon/vinyl-xml'\nimport { ErrorOrigin, stringify } from '@amazon/vinyl-util'\nimport { isOneOf, number, type Validator } from '@amazon/vinyl-validation'\nimport { parseDuration, stringifyDuration } from '../duration/duration'\nimport { parseByteRange, stringifyByteRange } from '../media/byteRange'\nimport { parseRatio, stringifyRatio } from '../media/ratio'\nimport { parseFrameRate, stringifyFrameRate } from '../media/frameRate'\nimport type {\n AdaptationSetType,\n BaseURLType,\n ConditionalUintType,\n ContentComponentType,\n DashManifest,\n DescriptorType,\n EventStreamType,\n EventType,\n MetricsType,\n MPDtype,\n MultipleSegmentBaseType,\n PeriodType,\n PresentationType,\n ProgramInformationType,\n RangeType,\n RepresentationBaseType,\n RepresentationType,\n SegmentBaseType,\n SegmentListType,\n SegmentTemplateType,\n SegmentTimelineType,\n SegmentTimelineTypeSType,\n SegmentURLType,\n SubRepresentationType,\n SubsetType,\n SwitchingType,\n SwitchingTypeType,\n URLType,\n VideoScanType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\n\nexport const dashNamespaceUri = 'urn:mpeg:dash:schema:mpd:2011'\n\nexport function dashManifestXmlRules(): XmlRules<DashManifest> {\n const attrActuateType = attr<actuateType>(assertActuateEnum, stringify, {\n default: 'onRequest',\n } as const)\n\n const descriptorType: XmlRules<DescriptorType> = {\n id: attrString,\n schemeIdUri: attrString({ required: true }),\n value: attrString,\n } as const\n\n const baseURLType: XmlRules<BaseURLType> = {\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrFloat,\n byteRange: attrString,\n serviceLocation: attrString,\n _content: charactersString,\n } as const\n\n const contentComponentType: XmlRules<ContentComponentType> = {\n contentType: attrString,\n id: attrInt,\n lang: attrString,\n par: attr(parseRatio, stringifyRatio),\n Accessibility: elements(descriptorType),\n Rating: elements(descriptorType),\n Role: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n } as const\n\n const urlType: XmlRules<URLType> = {\n range: attr(parseByteRange, stringifyByteRange),\n sourceURL: attrString,\n } as const\n\n const uriType: XmlRules<UriType> = { _content: charactersString } as const\n\n const segmentBaseType: XmlRules<SegmentBaseType> = {\n Initialization: element(urlType),\n RepresentationIndex: element(urlType),\n availabilityTimeComplete: attrBoolean,\n availabilityTimeOffset: attrInt,\n indexRange: attr(parseByteRange, stringifyByteRange),\n indexRangeExact: attrBoolean({ default: false }),\n presentationTimeOffset: attrFloat,\n timescale: attrInt,\n } as const\n\n const segmentTimelineTypeSType: XmlRules<SegmentTimelineTypeSType> = {\n d: attrInt({ required: true }),\n n: attrInt,\n r: attrInt({ default: 0 }),\n t: attrInt,\n } as const\n\n const segmentTimelineType: XmlRules<SegmentTimelineType> = {\n S: elements(segmentTimelineTypeSType),\n } as const\n\n const multipleSegmentBaseType: XmlRules<MultipleSegmentBaseType> = {\n ...segmentBaseType,\n SegmentTimeline: element(segmentTimelineType),\n BitstreamSwitching: element(urlType),\n duration: attrInt,\n startNumber: attrInt,\n } as const\n\n const segmentURLType: XmlRules<SegmentURLType> = {\n index: attrString,\n indexRange: attr(parseByteRange, stringifyByteRange),\n media: attrString,\n mediaRange: attr(parseByteRange, stringifyByteRange),\n } as const\n\n const segmentListType: XmlRules<SegmentListType> = {\n ...multipleSegmentBaseType,\n actuate: attrActuateType,\n href: attrString,\n SegmentURL: elements(segmentURLType),\n } as const\n\n const segmentTemplateType: XmlRules<SegmentTemplateType> = {\n ...multipleSegmentBaseType,\n bitstreamSwitching: attrString,\n index: attrString,\n initialization: attrString,\n media: attrString,\n } as const\n\n const subsetType: XmlRules<SubsetType> = {\n contains: attr(parseIntVector, stringifyIntVector, { required: true }),\n id: attrString,\n } as const\n\n const eventType: XmlRules<EventType> = {\n duration: attrInt,\n id: attrInt,\n messageData: attrString,\n presentationTime: attrInt({ default: 0 }),\n } as const\n\n const eventStreamType: XmlRules<EventStreamType> = {\n Event: elements(eventType),\n actuate: attrActuateType,\n href: attrString,\n messageData: attrString,\n schemeIdUri: attrString({ required: true }),\n timescale: attrInt,\n value: attrString,\n } as const\n\n const switchingType: XmlRules<SwitchingType> = {\n interval: attrInt({ required: true }),\n type: attr(parseSwitchingTypeType, stringify),\n } as const\n\n const representationBaseType: XmlRules<RepresentationBaseType> = {\n FramePacking: elements(descriptorType),\n AudioChannelConfiguration: elements(descriptorType),\n ContentProtection: elements(descriptorType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n InbandEventStream: elements(eventStreamType),\n Switching: elements(switchingType),\n audioSamplingRate: attr(parseIntVector, stringifyIntVector),\n codecs: attrString,\n codingDependency: attrBoolean,\n frameRate: attr(parseFrameRate, stringifyFrameRate),\n height: attrInt,\n maximumSAPPeriod: attrInt,\n maxPlayoutRate: attrInt,\n mimeType: attrString,\n profiles: attr(parseProfiles, stringifyProfiles),\n sar: attr(parseRatio, stringifyRatio),\n scanType: attr(parseVideoScan, stringify),\n segmentProfiles: attrString,\n startWithSAP: attr(parseSap, stringify),\n width: attrInt,\n } as const\n\n const subRepresentationType: XmlRules<SubRepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt,\n contentComponent: attr(parseStringVector, stringifyStringVector),\n dependencyLevel: attr(parseIntVector, stringifyIntVector),\n level: attrInt,\n } as const\n\n const representationType: XmlRules<RepresentationType> = {\n ...representationBaseType,\n bandwidth: attrInt({ required: true }),\n bitrate: attrInt,\n dependencyId: attr(parseStringVector, stringifyStringVector),\n id: attrString({ required: true }),\n mediaStreamStructureId: attr(parseStringVector, stringifyStringVector),\n qualityRanking: attrInt,\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n SubRepresentation: elements(subRepresentationType),\n } as const\n\n const adaptationSetType: XmlRules<AdaptationSetType> = {\n ...representationBaseType,\n Accessibility: elements(descriptorType),\n Role: elements(descriptorType),\n Rating: elements(descriptorType),\n Viewpoint: elements(descriptorType),\n ContentComponent: elements(contentComponentType),\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n Representation: elements(representationType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean,\n contentType: attrString,\n group: attrInt,\n href: attrString,\n id: attrInt,\n lang: attrString,\n maxBandwidth: attrInt,\n maxFrameRate: attr(parseFrameRate, stringifyFrameRate),\n maxHeight: attrInt,\n maxWidth: attrInt,\n minBandwidth: attrInt,\n minFrameRate: attr(parseFrameRate, stringifyFrameRate),\n minHeight: attrInt,\n minWidth: attrInt,\n par: attr(parseRatio, stringifyRatio),\n segmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n selectionPriority: attrInt({\n default: 1,\n }),\n subsegmentAlignment: attr(parseConditionalUint, stringify, {\n default: false,\n }),\n subsegmentStartsWithSAP: attr(parseSap, stringify, { default: 0 }),\n } as const\n\n const rangeType: XmlRules<RangeType> = {\n duration: attr(parseDuration, stringifyDuration),\n starttime: attr(parseDuration, stringifyDuration),\n } as const\n\n const metricsType: XmlRules<MetricsType> = {\n metrics: attrString({ required: true }),\n Range: elements(rangeType),\n Reporting: elements(descriptorType, { minOccurs: 1 }),\n } as const\n\n const periodType: XmlRules<PeriodType> = {\n BaseURL: elements(baseURLType),\n SegmentBase: element(segmentBaseType),\n SegmentList: element(segmentListType),\n SegmentTemplate: element(segmentTemplateType),\n AssetIdentifier: element(descriptorType),\n EventStream: elements(eventStreamType),\n AdaptationSet: elements(adaptationSetType),\n Subset: elements(subsetType),\n SupplementalProperty: elements(descriptorType),\n actuate: attrActuateType,\n bitstreamSwitching: attrBoolean({ default: false }),\n duration: attr(parseDuration, stringifyDuration),\n href: attrString,\n id: attrString,\n start: attr(parseDuration, stringifyDuration),\n } as const\n\n const programInformationType: XmlRules<ProgramInformationType> = {\n lang: attrString,\n moreInformationURL: attrString,\n Copyright: attrString,\n Source: attrString,\n Title: attrString,\n } as const\n\n const mpdType: XmlRules<MPDtype> = {\n ProgramInformation: elements(programInformationType),\n BaseURL: elements(baseURLType),\n Location: elements(uriType),\n Period: elements(periodType, { minOccurs: 1 }),\n Metrics: elements(metricsType),\n EssentialProperty: elements(descriptorType),\n SupplementalProperty: elements(descriptorType),\n UTCTiming: elements(descriptorType),\n availabilityEndTime: attrDateTime,\n availabilityStartTime: attrDateTime,\n id: attrString,\n maxSegmentDuration: attr(parseDuration, stringifyDuration),\n maxSubsegmentDuration: attr(parseDuration, stringifyDuration),\n mediaPresentationDuration: attr(parseDuration, stringifyDuration),\n minBufferTime: attr(parseDuration, stringifyDuration, {\n required: true,\n }),\n minimumUpdatePeriod: attr(parseDuration, stringifyDuration),\n profiles: attr(parseProfiles, stringifyProfiles, { required: true }),\n publishTime: attrDateTime,\n suggestedPresentationDelay: attr(parseDuration, stringifyDuration),\n timeShiftBufferDepth: attr(parseDuration, stringifyDuration),\n type: attr(parsePresentationTypeType, stringify, {\n default: 'static',\n } as const),\n } as const\n\n return {\n MPD: element(mpdType, {\n required: true,\n namespaceUri: dashNamespaceUri,\n }),\n } as const\n}\n\n/**\n * Parses a comma delimited list of profiles.\n * Profile values are not whitespace trimmed.\n *\n * @param str\n */\nexport function parseProfiles(str: string): readonly string[] {\n return str.split(',')\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyProfiles(value: readonly string[]): string {\n return value.join(',')\n}\n\nconst videoScanTypeValidator: Validator<VideoScanType> = /* @__PURE__ */ isOneOf(\n 'progressive',\n 'interlaced',\n 'unknown'\n)\n\n/**\n * @private\n */\nexport function parseVideoScan(str: string): VideoScanType {\n videoScanTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst switchingTypeTypeValidator: Validator<SwitchingTypeType> = /* @__PURE__ */ isOneOf(\n 'media',\n 'bitstream'\n)\n\n/**\n * @private\n */\nexport function parseSwitchingTypeType(str: string): SwitchingTypeType {\n switchingTypeTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\nconst validateSap: Validator<number> = /* @__PURE__ */ /* @__PURE__ */ number().within(0, 6)\n\n/**\n * @private\n */\nexport function parseSap(str: string): number {\n const number = parseInt(str)\n validateSap.assert(number, ErrorOrigin.PARSING)\n return number\n}\n\n/**\n * Splits a string by whitespace.\n *\n * @private\n */\nexport function parseStringVector(str: string): readonly string[] {\n return str.split(/\\s+/)\n}\n\n/**\n * Returns the string representation of a string vector value.\n *\n * @param value\n */\nexport function stringifyStringVector(value: readonly string[]): string {\n return value.join(' ')\n}\n\n/**\n * Splits a string by whitespace and parses as int.\n *\n * @private\n */\nexport function parseIntVector(str: string): readonly number[] {\n return str.split(/\\s+/).map((subStr) => parseInt(subStr))\n}\n\n/**\n * Returns the string representation of an int vector value.\n *\n * @param value\n */\nexport function stringifyIntVector(value: readonly number[]): string {\n return value.join(' ')\n}\n\nconst presentationTypeValidator: Validator<PresentationType> = /* @__PURE__ */ isOneOf(\n 'static',\n 'dynamic'\n)\n\n/**\n * Asserts that the given string is one of the {@link PresentationType} enumerated values.\n * @param str\n */\nexport function parsePresentationTypeType(str: string): PresentationType {\n presentationTypeValidator.assert(str, ErrorOrigin.PARSING)\n return str\n}\n\n/**\n * Parses a string into true, false, or a number.\n *\n * @private\n */\nexport function parseConditionalUint(str: string): ConditionalUintType {\n const lower = str.toLowerCase()\n switch (lower) {\n case 'true':\n return true\n case 'false':\n return false\n default:\n return parseInt(str)\n }\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { parseIntSafe } from '@amazon/vinyl-util'\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A range of bytes, [from, to (optional, inclusive)].\n */\nexport type ByteRange = readonly [number, number | null]\n\nconst byteRangeExp = /^(-?[0-9]+)-(-?[0-9]*)$/\n\nexport function parseByteRange(str: string): ByteRange {\n const match = str ? byteRangeExp.exec(str) : null\n if (!match) throwParsingError(`invalid byte range: '${str}'`)\n let start = parseInt(match[1])\n // Convert possibly-negative Int32 overflow value to its Uint32 equivalent\n // (reinterpret 32-bit signed integer bits as unsigned)\n if (start < 0) start >>>= 0\n let end = parseIntSafe(match[2])\n if (end != null && end < 0) end = end >>> 0\n return [start, end]\n}\n\n/**\n * Returns the string representation of a {@link ByteRange} value.\n *\n * @param value\n */\nexport function stringifyByteRange(value: ByteRange): string {\n const end = value[1]\n return `${value[0]}-${end == null ? '' : end}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\n/**\n * A numerator and denominator.\n */\nexport type Ratio = readonly [number, number]\n\n/**\n * The XSD specifies `[0-9]*`, and not `[0-9]+`, which would match `'23:'`\n * For missing dimensions, default to 1.\n */\nconst ratioRegExp = /^([0-9]*):([0-9]*)$/\n\n/**\n * Parses a string representing a ratio into [number, number].\n * The string must satisfy the pattern: `/^([0-9]*):([0-9]*)$/`\n * Examples:\n * ```\n * parseRatio('4:3') // [4, 3]\n * parseRatio('16:9') // [16, 9]\n * parseRatio('2:') // [2, 1]\n * ```\n *\n * @private\n */\nexport function parseRatio(str: string): Ratio {\n const match = str ? ratioRegExp.exec(str) : null\n if (!match) throwParsingError(`invalid ratio format: ${str}`)\n return [parseInt(match[1] || '1'), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link Ratio} value.\n *\n * @param value\n */\nexport function stringifyRatio(value: Ratio): string {\n return `${value[0]}:${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { throwParsingError } from '../error/parsingError'\n\nexport type FrameRate = readonly [number, number]\n\nconst framerateRegexp = /^(\\d+)(?:\\/(\\d+))?$/\n\n/**\n * Parses a string into a {@link FrameRate}\n *\n * @private\n */\nexport function parseFrameRate(str: string): FrameRate {\n const match = str ? framerateRegexp.exec(str) : null\n if (!match) throwParsingError(`invalid frame rate: '${str}'`)\n return [parseInt(match[1]), parseInt(match[2] || '1')]\n}\n\n/**\n * Returns the string representation of a {@link FrameRate} value.\n *\n * @param value\n */\nexport function stringifyFrameRate(value: FrameRate): string {\n return value[1] === 1 ? value[0].toString() : `${value[0]}/${value[1]}`\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { ReservedXmlRuleKeys } from '@amazon/vinyl-xml'\nimport {\n mapXmlRules,\n type Merged,\n mergeXmlRules,\n parseXml,\n ParseXmlHandlerImpl,\n stringifyXml,\n} from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../xmlns/microsoft/playready'\nimport type { CencContentProtection } from '../xmlns/mpeg/cenc/2013'\nimport type {\n DashManifest,\n DescriptorType,\n} from '../xmlns/mpeg/dash/schema/mpd/2011'\nimport { dashManifestXmlRules } from './dashManifestXmlRules'\nimport { cencXmlRules } from './ext/drm/cencXmlRules'\nimport type { DashProtections } from './ext/drm/contentProtection'\nimport { createDashProtectionXmlRules } from './ext/drm/contentProtection'\nimport { playreadyXmlRules } from './ext/drm/playreadyXmlRules'\nimport type { OptionalDeep } from '@amazon/vinyl-util'\n\n/**\n * Creates a Dash Manifest parser with supported extensions.\n *\n * @module\n */\n\nexport type DashDrmManifest = Merged<\n DashManifest & DashProtections<ContentProtection>\n>\n\nexport interface ContentProtection\n extends DescriptorType, CencContentProtection, PlayreadyContentProtection {}\n\nexport const dashDrmRules = /* @__PURE__ */ mergeXmlRules(\n /* @__PURE__ */ dashManifestXmlRules(),\n /* @__PURE__ */ createDashProtectionXmlRules(cencXmlRules),\n /* @__PURE__ */ createDashProtectionXmlRules(playreadyXmlRules)\n)\n\nconst dashDrmRulesMapped = /* @__PURE__ */ mapXmlRules(dashDrmRules)\n\n/**\n * A Content handler for a dash manifest.\n */\nfunction dashManifestHandler() {\n return new ParseXmlHandlerImpl(dashDrmRulesMapped)\n}\n\n/**\n * Parses a Dash Manifest, according to the mpd:2011 schema.\n * @see https://raw.githubusercontent.com/Dash-Industry-Forum/MPEG-Conformance-and-reference-source/master/conformance/MPDValidator/schemas/DASH-MPD.xsd\n * @param manifest\n */\nexport function parseDashManifest(manifest: string): DashDrmManifest {\n return parseXml(manifest, dashManifestHandler())\n}\n\nexport function stringifyDashManifest(\n manifest: OptionalDeep<DashDrmManifest, ReservedXmlRuleKeys>\n): string {\n return stringifyXml(manifest, dashDrmRulesMapped)\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n parseStringVector,\n stringifyStringVector,\n} from '../../dashManifestXmlRules'\nimport type { XmlRules } from '@amazon/vinyl-xml'\nimport { attr, charactersString, element } from '@amazon/vinyl-xml'\nimport type { CencContentProtection } from '../../../xmlns/mpeg/cenc/2013'\nimport { CENC_NAMESPACE_URI } from '../../../xmlns/mpeg/cenc/2013'\n\n/**\n * A parser for ContentProtection elements using the cenc namespace.\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n */\nexport const cencXmlRules: XmlRules<CencContentProtection> = {\n default_KID: /* @__PURE__ */ attr(parseStringVector, stringifyStringVector, {\n namespaceUri: CENC_NAMESPACE_URI,\n }),\n pssh: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: CENC_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection xml types.\n *\n * @see https://github.com/sannies/rtp2dash/blob/master/src/main/resources/auxxsd/cenc.xsd\n * @module\n */\n\nexport const CENC_NAMESPACE_URI = 'urn:mpeg:cenc:2013'\n\n/**\n * A 128-bit integer written in canonical UUID notation.\n * Must be in the form:\n * `[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}`\n */\nexport type KeyIdType = string\n\nexport interface CencContentProtection {\n readonly default_KID?: readonly KeyIdType[]\n readonly pssh?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { element, elements, type XmlRules } from '@amazon/vinyl-xml'\nimport { dashNamespaceUri } from '../../dashManifestXmlRules'\n\n/**\n * ContentProtection extension point for Dash manifests.\n *\n * @module\n */\n\nexport interface WithProtections<T> {\n readonly ContentProtection?: readonly T[]\n}\n\nexport interface RepresentationTypeProtections<T> extends WithProtections<T> {\n readonly SubRepresentation?: readonly WithProtections<T>[]\n}\n\nexport interface AdaptationSetProtections<T> extends WithProtections<T> {\n readonly Representation?: readonly RepresentationTypeProtections<T>[]\n}\n\nexport interface PeriodProtections<T> {\n readonly AdaptationSet?: readonly AdaptationSetProtections<T>[]\n}\n\nexport interface MPDProtections<T> {\n readonly Period: readonly PeriodProtections<T>[]\n}\n\nexport interface DashProtections<T> {\n readonly MPD: MPDProtections<T>\n}\n\n/**\n * Creates a dash extension for content protection parsing rules.\n *\n * @param contentProtectionRules Rules to be used when processing `ContentProtection` elements.\n * @return Returns a rules map that should be merged with the dash manifest rules.\n */\nexport function createDashProtectionXmlRules<T extends object>(\n contentProtectionRules: XmlRules<T>\n): XmlRules<DashProtections<T>> {\n const withProtections: XmlRules<WithProtections<T>> = {\n ContentProtection: elements(contentProtectionRules),\n } as const\n\n return {\n MPD: element<MPDProtections<T>>(\n {\n Period: elements<PeriodProtections<T>>(\n {\n AdaptationSet: elements<AdaptationSetProtections<T>>({\n ...withProtections,\n Representation: elements<\n RepresentationTypeProtections<T>\n >({\n ...withProtections,\n SubRepresentation:\n elements<WithProtections<T>>(\n withProtections\n ),\n }),\n }),\n },\n {\n minOccurs: 1,\n }\n ),\n },\n { required: true, namespaceUri: dashNamespaceUri } as const\n ),\n } as const\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { charactersString, element, type XmlRules } from '@amazon/vinyl-xml'\nimport type { PlayreadyContentProtection } from '../../../xmlns/microsoft/playready'\nimport { PLAY_READY_NAMESPACE_URI } from '../../../xmlns/microsoft/playready'\n\nexport const playreadyXmlRules: XmlRules<PlayreadyContentProtection> = {\n pro: /* @__PURE__ */ element(\n {\n _content: charactersString,\n },\n {\n namespaceUri: PLAY_READY_NAMESPACE_URI,\n }\n ),\n} as const\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Base64BinaryType } from '@amazon/vinyl-xml'\n\n/**\n * Cenc content protection playready.\n *\n * @see https://learn.microsoft.com/en-us/playready/specifications/mpeg-dash-playready#21-dash-contentprotection-descriptor-elements\n * @module\n */\n\nexport const PLAY_READY_NAMESPACE_URI = 'urn:microsoft:playready'\n\nexport interface PlayreadyContentProtection {\n readonly pro?: Base64BinaryType\n}\n", "/*\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport const ContentProtectionScheme = {\n /**\n * CENC protection scheme. (Should not be used to create a key session)\n */\n CENC: 'urn:mpeg:dash:mp4protection:2011',\n\n /**\n * A simple, unencrypted content protection scheme. Not a full DRM solution.\n */\n CLEAR_KEY: 'urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e',\n\n /**\n * Apple's FairPlay.\n */\n FAIR_PLAY: 'urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2',\n\n /**\n * Open-standards community initiative by Marlin Developer Community.\n */\n MARLIN: 'urn:uuid:5e629af5-38da-4063-8977-97ffbd9902d4',\n\n /**\n * Microsoft's PlayReady.\n */\n PLAY_READY: 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95',\n\n /**\n * An old, unused PlayReady scheme id.\n */\n PLAY_READY_DEPRECATED: 'urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95',\n\n /**\n * Google's Widevine.\n */\n WIDEVINE: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed',\n}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,WAAW;AAAA;AAAA;AAAA;AAAA,EAKX,QAAQ;AAAA;AAAA;AAAA;AAAA,EAKR,YAAY;AAAA;AAAA;AAAA;AAAA,EAKZ,uBAAuB;AAAA;AAAA;AAAA;AAAA,EAKvB,UAAU;AACd;",
|
|
6
6
|
"names": ["ErrorOrigin", "ValidationError", "ErrorOrigin", "ErrorOrigin", "number", "attr", "charactersString", "element", "attr", "element", "charactersString", "element", "elements", "elements", "element", "charactersString", "element", "element", "charactersString"]
|
|
7
7
|
}
|
|
@@ -167,7 +167,8 @@ var LruCache=/*#__PURE__*/function(){function LruCache(initialCapacity){_classCa
|
|
|
167
167
|
*/},{key:"clear",value:function clear(){this.list.clear();this.cache.clear()}/**
|
|
168
168
|
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
|
|
169
169
|
*/},{key:"delete",value:function _delete(key){if(!this.has(key))return false;var node=this.cache.get(key);this.cache["delete"](key);this.list.remove(node);return true}/**
|
|
170
|
-
* Executes a provided function once per each key/value pair in the Map,
|
|
170
|
+
* Executes a provided function once per each key/value pair in the Map,
|
|
171
|
+
* ordered from least recently used to most.
|
|
171
172
|
*
|
|
172
173
|
* @param callback A callback to invoke for every element in the cache.
|
|
173
174
|
* @param thisArg Value to use as this when executing callback
|
|
@@ -180,11 +181,11 @@ var LruCache=/*#__PURE__*/function(){function LruCache(initialCapacity){_classCa
|
|
|
180
181
|
* Returns an iterable of values in the map. This will be ordered from least recently used to
|
|
181
182
|
* most.
|
|
182
183
|
*/},{key:"values",value:function values(){return mapIter(this.list,function(_ref5){var _ref6=_slicedToArray(_ref5,2),value=_ref6[1];return value})}},{key:Symbol.iterator,value:function value(){return this.list[Symbol.iterator]()}},{key:Symbol.toStringTag,get:function get(){return"LruCache"}}])}();// ../vinyl-util/src/util/fun/memoize.ts
|
|
183
|
-
function memoize(inner,keyProvider){var capacity=arguments.length>2&&arguments[2]!==undefined?arguments[2]:500;if(!keyProvider){var cached=false;var value=void 0;var memoized=function memoized(){if(!cached){
|
|
184
|
+
function memoize(inner,keyProvider){var capacity=arguments.length>2&&arguments[2]!==undefined?arguments[2]:500;if(!keyProvider){var cached=false;var value=void 0;var memoized=function memoized(){if(!cached){value=inner();cached=true}return value};return Object.assign(memoized,{clear:function clear(){cached=false;value=void 0}})}else if(capacity===0){var _memoized=function _memoized(){return inner.apply(void 0,arguments)};return Object.assign(_memoized,{clear:function clear(){}})}else if(capacity===1){var hasValue=false;var cachedKey;var cachedValue;var _memoized2=function _memoized2(){var key=keyProvider.apply(void 0,arguments);if(!hasValue||cachedKey!==key){cachedValue=inner.apply(void 0,arguments);cachedKey=key;hasValue=true}return cachedValue};return Object.assign(_memoized2,{clear:function clear(){hasValue=false}})}else{var cache=new LruCache(capacity);var _memoized3=function _memoized3(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2]}var key=keyProvider.apply(void 0,args);return getOrSet(cache,key,function(){return inner.apply(void 0,args)})};return Object.assign(_memoized3,{clear:function clear(){cache.clear()}})}}// ../vinyl-util/src/util/string/string.ts
|
|
184
185
|
var locale={variableNotDefined:"Variable '{name}' is not defined"};var DEFAULT_SUBSTITUTE_PATTERN=/\{(\w+)}/g;function substitute(str,variables){var pattern=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_SUBSTITUTE_PATTERN;return str.replace(pattern,function(_,name){if(!(name in variables)){throw new IllegalArgumentError(locale.variableNotDefined.replace("{name}",String(name)))}return String(variables[name])})}function isWhitespaceChar(charCode){return charCode===32||// ' ' (space)
|
|
185
186
|
charCode===9||// '\t' (tab)
|
|
186
187
|
charCode===13||// '\r' (carriage return)
|
|
187
|
-
charCode===10}var encodedEntitiesRegex=/&(
|
|
188
|
+
charCode===10}var encodedEntitiesRegex=/&(?:#(?:x([\da-f]+)|(\d+))|(\w+));/gi;var MAX_CODE_POINT=1114111;var predefinedDecodeEntities=/* @__PURE__ */new Map([["apos","'"],["amp","&"],["lt","<"],["gt",">"],["quot","\""]]);function decodeEntities(str){var namedEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:predefinedDecodeEntities;return str.replace(encodedEntitiesRegex,function(substring,hex,decimal,entityName){var _a2;if(hex==null&&decimal==null){return(_a2=namedEntities.get(entityName.toLowerCase()))!=null?_a2:substring}var codePoint=hex!=null?parseInt(hex,16):parseInt(decimal,10);if(codePoint>MAX_CODE_POINT||isSurrogate(codePoint))return substring;return String.fromCodePoint(codePoint)})}function isSurrogate(codePoint){return codePoint>=55296&&codePoint<=57343}var standardEntityValueToNames=flipMap(predefinedDecodeEntities);function eqStr(a,b){var ignoreCase=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(a==null&&b==null)return true;if(a==null||b==null)return false;if(a===b)return true;if(ignoreCase)return a.length===b.length&&a.toLowerCase()===b.toLowerCase();return false}function _char(str){return str.charCodeAt(0)}function truncate(str,maxLength){var indicator=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\u2026";if(str==null)return str;if(str.length>maxLength)return str.substring(0,maxLength-indicator.length)+indicator;return str}// ../vinyl-util/src/util/serialization/primitives.ts
|
|
188
189
|
function parseBoolean(str){return str==="true"||str==="1"}function stringify(value){if(value===null)return"null";if(value===void 0)return"undefined";return value.toString()}function parseIntSafe(str,radix){if(!str)return null;var value=parseInt(str,radix);if(!Number.isFinite(value))return null;return value}// ../vinyl-util/src/core/cloneable.ts
|
|
189
190
|
function isCloneable(value){return value!=null&&_typeof(value)==="object"&&"clone"in value&&typeof value.clone==="function"&&value.clone.length===0}// ../vinyl-util/src/util/object/object.ts
|
|
190
191
|
function ownKeys(obj){if(!obj)return/* @__PURE__ */new Set;if(typeof Reflect!=="undefined")return new Set(Reflect.ownKeys(obj));var properties=/* @__PURE__ */new Set;Object.getOwnPropertyNames(obj).forEach(function(item){return properties.add(item)});Object.getOwnPropertySymbols(obj).forEach(function(item){return properties.add(item)});return properties}function isPlainObject(value){if(!value||_typeof(value)!=="object"||Array.isArray(value))return false;var proto=Object.getPrototypeOf(value);return!proto||!Object.getPrototypeOf(proto)}// ../vinyl-util/src/util/serialization/json.ts
|
|
@@ -298,7 +299,7 @@ var StringReader=/*#__PURE__*/function(){/**
|
|
|
298
299
|
* If the given string matches the substring at the current position, returns true and advances
|
|
299
300
|
* the index by the string's length.
|
|
300
301
|
*/},{key:"stringIf",value:function stringIf(string){var ignoreCase=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this.remaining<string.length)return false;var substr=this.data.substring(this.position,this.position+string.length);var match=eqStr(substr,string,ignoreCase);if(match)this.position+=string.length;return match}}])}();var locale4={messageSeparator:", at: \n"};var StringParseError=/*#__PURE__*/function(_ReportableError6){function _StringParseError(str,position,reason){var _this7;_classCallCheck(this,_StringParseError);var location=printStringPosition(str,position);_this7=_callSuper(this,_StringParseError,["".concat(reason).concat(locale4.messageSeparator).concat(location),ErrorOrigin.PARSING]);__publicField(_this7,"position",position);__publicField(_this7,"reason",reason);__publicField(_this7,"location");_this7.location=location;Object.setPrototypeOf(_this7,_StringParseError.prototype);return _this7}_inherits(_StringParseError,_ReportableError6);return _createClass(_StringParseError,[{key:Symbol.toStringTag,get:function get(){return"StringParseError"}},{key:"toJSON",value:function toJSON(){return __spreadProps(__spreadValues({},_superPropGet(_StringParseError,"toJSON",this,3)([])),{position:this.position,location:this.location,reason:this.reason})}}])}(ReportableError);// src/duration/duration.ts
|
|
301
|
-
var I=60;var H=3600;var D=86400;var M=2592e3;var Y=31536e3;var iso8601Duration=/^(-?)P?(\d+(?:\.\d*)?Y)?(\d+(?:\.\d*)?M)?(\d+(?:\.\d*)?D)?T?(\d+(?:\.\d*)?H)?(\d+(?:\.\d*)?M)?(\d+(?:\.\d*)?S?)?$/i;function parseDuration(value){var match=iso8601Duration.exec(value);if(match==null)throw new ValidationError("Unexpected duration: '".concat(value,"', should be in iso 8601 format"),ErrorOrigin.PARSING);var sign=match[1]==="-"?-1:1;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"))}function stringifyDuration(value){var sign=value<0?"-":"";var abs=Math.abs(value);var years=Math.floor(abs/Y);abs-=years*Y;var months=Math.floor(abs
|
|
302
|
+
var I=60;var H=3600;var D=86400;var M=2592e3;var Y=31536e3;var iso8601Duration=/^(-?)P?(\d+(?:\.\d*)?Y)?(\d+(?:\.\d*)?M)?(\d+(?:\.\d*)?D)?T?(\d+(?:\.\d*)?H)?(\d+(?:\.\d*)?M)?(\d+(?:\.\d*)?S?)?$/i;function parseDuration(value){var match=iso8601Duration.exec(value);if(match==null)throw new ValidationError("Unexpected duration: '".concat(value,"', should be in iso 8601 format"),ErrorOrigin.PARSING);var sign=match[1]==="-"?-1:1;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"))}function stringifyDuration(value){var sign=value<0?"-":"";var abs=Math.abs(value);var years=Math.floor(abs/Y);abs-=years*Y;var months=Math.floor(abs/M);var days=Math.floor(abs%M/D);var hours=Math.floor(abs%D/H);var minutes=Math.floor(abs%H/I);var seconds=abs%I;var date="";if(years>0)date+="".concat(years,"Y");if(months>0)date+="".concat(months,"M");if(days>0)date+="".concat(days,"D");var time="";if(hours>0)time+="".concat(hours,"H");if(minutes>0)time+="".concat(minutes,"M");if(seconds>0)time+="".concat(roundToNearest(seconds,1e-3),"S");if(!date&&!time)time="0S";return"".concat(sign,"P").concat(date).concat(time&&"T".concat(time))}// src/error/parsingError.ts
|
|
302
303
|
function throwParsingError(message){throw new ValidationError(message,ErrorOrigin.PARSING)}// ../vinyl-validation/src/validation/Validator.ts
|
|
303
304
|
var validatorLocale={/**
|
|
304
305
|
* The expectation template string with the following replacement tokens:
|
|
@@ -442,7 +443,7 @@ var locale9={gte:"at least {value}",gt:"greater than {value}",lte:"at most {valu
|
|
|
442
443
|
*/},{key:"finite",value:function finite(){return this.chain(numberValidators.finite())}/**
|
|
443
444
|
* Creates a validator that asserts that the input number is a safe integer.
|
|
444
445
|
*/},{key:"safeInteger",value:function safeInteger(){return this.chain(numberValidators.safeInteger())}}],[{key:"base",get:/**
|
|
445
|
-
* The base
|
|
446
|
+
* The base NumberSchema instance validating that the input is a number.
|
|
446
447
|
*/function get(){if(this._base==null)this._base=new _NumberSchema(typeOfValidators.number);return this._base}}])}(ValueSchema);__publicField(_NumberSchema,"_base",null);var NumberSchema=_NumberSchema;// ../vinyl-validation/src/validation/validators.ts
|
|
447
448
|
var locale10={isOneOf:"one of: {value}",instanceOf:"instance of {value}",oneOfSeparator:" | "};function isOneOf(){for(var _len6=arguments.length,possibleValues=new Array(_len6),_key6=0;_key6<_len6;_key6++){possibleValues[_key6]=arguments[_key6]}return new ValueSchema(createValidator(substitute(locale10.isOneOf,{value:possibleValues.join(locale10.oneOfSeparator)}),function(input){return possibleValues.includes(input)},void 0,{"enum":[].concat(possibleValues)}))}function number(){return NumberSchema.base}// ../vinyl-xml/src/xlink/actuateValidator.ts
|
|
448
449
|
var actuateValidator=isOneOf("onLoad","onRequest");function assertActuateEnum(str){actuateValidator.assert(str,ErrorOrigin.PARSING);return str}// ../vinyl-xml/src/xml/xmlRules.ts
|