@utilix-tech/sdk 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,6 +64,29 @@ interface PdfMetadataError {
64
64
  * pdf.js or other PDF rendering library required.
65
65
  */
66
66
  declare function readPdfMetadata(bytes: Uint8Array): PdfMetadata | PdfMetadataError;
67
+ type PdfPageOrientation = 'portrait' | 'landscape' | 'square' | null;
68
+ interface PdfPageDimension {
69
+ pageNumber: number;
70
+ widthPt: number | null;
71
+ heightPt: number | null;
72
+ widthIn: number | null;
73
+ heightIn: number | null;
74
+ rotation: number;
75
+ orientation: PdfPageOrientation;
76
+ paperSize: string | null;
77
+ }
78
+ interface PdfPageDimensionsResult {
79
+ version: string | null;
80
+ pageCount: number;
81
+ pages: PdfPageDimension[];
82
+ }
83
+ /**
84
+ * List each page's MediaBox width/height (in points and inches), rotation,
85
+ * and orientation, in document order — walking the Root -> Pages -> Kids
86
+ * tree and inheriting /MediaBox / /Rotate from ancestor nodes the way the
87
+ * PDF spec requires. No PDF rendering library required.
88
+ */
89
+ declare function readPdfPageDimensions(bytes: Uint8Array): PdfPageDimensionsResult | PdfMetadataError;
67
90
  interface WavInfo {
68
91
  audioFormat: number;
69
92
  audioFormatLabel: string;
@@ -160,6 +183,25 @@ interface FlacInfoError {
160
183
  * metadata-block headers. No audio frame decoding is performed.
161
184
  */
162
185
  declare function readFlacInfo(bytes: Uint8Array): FlacInfo | FlacInfoError;
186
+ interface VideoInfo {
187
+ format: 'mp4' | 'webm';
188
+ durationSeconds?: number;
189
+ width?: number;
190
+ height?: number;
191
+ videoCodec?: string;
192
+ audioCodec?: string;
193
+ majorBrand?: string;
194
+ }
195
+ interface VideoInfoError {
196
+ error: string;
197
+ }
198
+ /**
199
+ * Read an MP4 (ISO BMFF) or WebM (EBML/Matroska) container's header boxes
200
+ * to report duration, resolution, and video/audio codec identifiers.
201
+ * No frame decoding, demuxing of sample data, or transcoding is performed;
202
+ * only the moov box (MP4) or Segment/Info/Tracks elements (WebM) are read.
203
+ */
204
+ declare function readVideoInfo(bytes: Uint8Array): VideoInfo | VideoInfoError;
163
205
 
164
206
  type media_ExifData = ExifData;
165
207
  type media_ExifError = ExifError;
@@ -175,6 +217,11 @@ type media_ImageInfo = ImageInfo;
175
217
  type media_ImageInfoError = ImageInfoError;
176
218
  type media_PdfMetadata = PdfMetadata;
177
219
  type media_PdfMetadataError = PdfMetadataError;
220
+ type media_PdfPageDimension = PdfPageDimension;
221
+ type media_PdfPageDimensionsResult = PdfPageDimensionsResult;
222
+ type media_PdfPageOrientation = PdfPageOrientation;
223
+ type media_VideoInfo = VideoInfo;
224
+ type media_VideoInfoError = VideoInfoError;
178
225
  type media_WavInfo = WavInfo;
179
226
  type media_WavInfoError = WavInfoError;
180
227
  declare const media_readExifData: typeof readExifData;
@@ -183,9 +230,11 @@ declare const media_readIcoInfo: typeof readIcoInfo;
183
230
  declare const media_readId3Tags: typeof readId3Tags;
184
231
  declare const media_readImageInfo: typeof readImageInfo;
185
232
  declare const media_readPdfMetadata: typeof readPdfMetadata;
233
+ declare const media_readPdfPageDimensions: typeof readPdfPageDimensions;
234
+ declare const media_readVideoInfo: typeof readVideoInfo;
186
235
  declare const media_readWavInfo: typeof readWavInfo;
187
236
  declare namespace media {
188
- export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_IcoImageEntry as IcoImageEntry, type media_IcoInfo as IcoInfo, type media_IcoInfoError as IcoInfoError, type media_Id3Tags as Id3Tags, type media_Id3TagsError as Id3TagsError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata, media_readWavInfo as readWavInfo };
237
+ export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_IcoImageEntry as IcoImageEntry, type media_IcoInfo as IcoInfo, type media_IcoInfoError as IcoInfoError, type media_Id3Tags as Id3Tags, type media_Id3TagsError as Id3TagsError, type media_ImageFormat as ImageFormat, type media_ImageInfo as ImageInfo, type media_ImageInfoError as ImageInfoError, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfPageDimension as PdfPageDimension, type media_PdfPageDimensionsResult as PdfPageDimensionsResult, type media_PdfPageOrientation as PdfPageOrientation, type media_VideoInfo as VideoInfo, type media_VideoInfoError as VideoInfoError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfPageDimensions as readPdfPageDimensions, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
189
238
  }
190
239
 
191
- export { type ExifData as E, type FlacInfo as F, type IcoImageEntry as I, type PdfMetadata as P, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type IcoInfo as c, type IcoInfoError as d, type Id3Tags as e, type Id3TagsError as f, type ImageFormat as g, type ImageInfo as h, type ImageInfoError as i, type PdfMetadataError as j, type WavInfoError as k, readFlacInfo as l, media as m, readIcoInfo as n, readId3Tags as o, readImageInfo as p, readPdfMetadata as q, readExifData as r, readWavInfo as s };
240
+ export { type ExifData as E, type FlacInfo as F, type IcoImageEntry as I, type PdfMetadata as P, type VideoInfo as V, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type IcoInfo as c, type IcoInfoError as d, type Id3Tags as e, type Id3TagsError as f, type ImageFormat as g, type ImageInfo as h, type ImageInfoError as i, type PdfMetadataError as j, type PdfPageDimension as k, type PdfPageDimensionsResult as l, media as m, type PdfPageOrientation as n, type VideoInfoError as o, type WavInfoError as p, readFlacInfo as q, readExifData as r, readIcoInfo as s, readId3Tags as t, readImageInfo as u, readPdfMetadata as v, readPdfPageDimensions as w, readVideoInfo as x, readWavInfo as y };
@@ -12,6 +12,7 @@
12
12
  * - robots-txt-validator: validateRobotsTxt
13
13
  * - user-agent-parser: parseUserAgent
14
14
  * - cache-control-builder: buildCacheControl
15
+ * - ipv6-compressor: parseIpv6Address
15
16
  */
16
17
  declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
17
18
  type DnsRecordType = typeof DNS_RECORD_TYPES[number];
@@ -291,6 +292,23 @@ interface CacheControlResult {
291
292
  declare function buildCacheControl(options?: CacheControlOptions): CacheControlResult | {
292
293
  error: string;
293
294
  };
295
+ type Ipv6AddressType = 'unspecified' | 'loopback' | 'link-local' | 'unique-local' | 'multicast' | 'ipv4-mapped' | 'documentation' | 'global-unicast';
296
+ interface Ipv6ParseResult {
297
+ expanded: string;
298
+ compressed: string;
299
+ groups: string[];
300
+ zoneId: string | null;
301
+ addressType: Ipv6AddressType;
302
+ }
303
+ /**
304
+ * Parse an IPv6 address into its expanded (full 8-group) and compressed
305
+ * (RFC 5952 canonical shortest) forms, classify its address type, and
306
+ * separate out an optional zone ID. Understands "::" shorthand and an
307
+ * embedded IPv4 suffix like "::ffff:192.168.1.1".
308
+ */
309
+ declare function parseIpv6Address(input: string): Ipv6ParseResult | {
310
+ error: string;
311
+ };
294
312
 
295
313
  type network_CacheControlDirective = CacheControlDirective;
296
314
  type network_CacheControlOptions = CacheControlOptions;
@@ -306,6 +324,8 @@ type network_HarParseResult = HarParseResult;
306
324
  type network_HarSummary = HarSummary;
307
325
  type network_HeaderCategory = HeaderCategory;
308
326
  type network_HttpHeader = HttpHeader;
327
+ type network_Ipv6AddressType = Ipv6AddressType;
328
+ type network_Ipv6ParseResult = Ipv6ParseResult;
309
329
  type network_ParsedDnsResult = ParsedDnsResult;
310
330
  type network_ParsedGeoResult = ParsedGeoResult;
311
331
  type network_RobotsGroup = RobotsGroup;
@@ -341,6 +361,7 @@ declare const network_isValidIpv6: typeof isValidIpv6;
341
361
  declare const network_parseDnsResponse: typeof parseDnsResponse;
342
362
  declare const network_parseGeoResponse: typeof parseGeoResponse;
343
363
  declare const network_parseHar: typeof parseHar;
364
+ declare const network_parseIpv6Address: typeof parseIpv6Address;
344
365
  declare const network_parseUserAgent: typeof parseUserAgent;
345
366
  declare const network_searchHeaders: typeof searchHeaders;
346
367
  declare const network_searchStatusCodes: typeof searchStatusCodes;
@@ -352,7 +373,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
352
373
  declare const network_validateRobotsTxt: typeof validateRobotsTxt;
353
374
  declare const network_validateSitemap: typeof validateSitemap;
354
375
  declare namespace network {
355
- export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
376
+ export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
356
377
  }
357
378
 
358
- export { statusCodeToText as $, formatCoordinates as A, formatTtl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, getByCategory as E, getHeader as F, type GeoResult as G, HTTP_HEADERS as H, getHeadersByCategory as I, getStatusByCategory as J, getStatusCode as K, isClientError as L, isServerError as M, isSuccess as N, isValidIp as O, type ParsedDnsResult as P, isValidIpv4 as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIpv6 as T, type UaDeviceType as U, parseDnsResponse as V, parseGeoResponse as W, parseHar as X, parseUserAgent as Y, searchHeaders as Z, searchStatusCodes as _, type CacheControlOptions as a, typeNumberToLabel as a0, validateDomain as a1, validateHeaderName as a2, validateHeaderValue as a3, validateRobotsTxt as a4, validateSitemap as a5, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type ParsedGeoResult as k, type RobotsIssue as l, type RobotsRule as m, network as n, type RobotsValidationResult as o, type SitemapIndexEntry as p, type SitemapIssue as q, type SitemapUrlEntry as r, type SitemapValidationResult as s, type StatusCode as t, type UserAgentInfo as u, buildCacheControl as v, buildDnsQueryUrl as w, buildGeoUrl as x, buildMapUrl as y, countryCodeToFlag as z };
379
+ export { parseUserAgent as $, countryCodeToFlag as A, formatCoordinates as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, formatTtl as E, getByCategory as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, getHeader as J, getHeadersByCategory as K, getStatusByCategory as L, getStatusCode as M, isClientError as N, isServerError as O, type ParsedDnsResult as P, isSuccess as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIp as T, type UaDeviceType as U, isValidIpv4 as V, isValidIpv6 as W, parseDnsResponse as X, parseGeoResponse as Y, parseHar as Z, parseIpv6Address as _, type CacheControlOptions as a, searchHeaders as a0, searchStatusCodes as a1, statusCodeToText as a2, typeNumberToLabel as a3, validateDomain as a4, validateHeaderName as a5, validateHeaderValue as a6, validateRobotsTxt as a7, validateSitemap as a8, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type ParsedGeoResult as l, type RobotsIssue as m, network as n, type RobotsRule as o, type RobotsValidationResult as p, type SitemapIndexEntry as q, type SitemapIssue as r, type SitemapUrlEntry as s, type SitemapValidationResult as t, type StatusCode as u, type UserAgentInfo as v, buildCacheControl as w, buildDnsQueryUrl as x, buildGeoUrl as y, buildMapUrl as z };
@@ -12,6 +12,7 @@
12
12
  * - robots-txt-validator: validateRobotsTxt
13
13
  * - user-agent-parser: parseUserAgent
14
14
  * - cache-control-builder: buildCacheControl
15
+ * - ipv6-compressor: parseIpv6Address
15
16
  */
16
17
  declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
17
18
  type DnsRecordType = typeof DNS_RECORD_TYPES[number];
@@ -291,6 +292,23 @@ interface CacheControlResult {
291
292
  declare function buildCacheControl(options?: CacheControlOptions): CacheControlResult | {
292
293
  error: string;
293
294
  };
295
+ type Ipv6AddressType = 'unspecified' | 'loopback' | 'link-local' | 'unique-local' | 'multicast' | 'ipv4-mapped' | 'documentation' | 'global-unicast';
296
+ interface Ipv6ParseResult {
297
+ expanded: string;
298
+ compressed: string;
299
+ groups: string[];
300
+ zoneId: string | null;
301
+ addressType: Ipv6AddressType;
302
+ }
303
+ /**
304
+ * Parse an IPv6 address into its expanded (full 8-group) and compressed
305
+ * (RFC 5952 canonical shortest) forms, classify its address type, and
306
+ * separate out an optional zone ID. Understands "::" shorthand and an
307
+ * embedded IPv4 suffix like "::ffff:192.168.1.1".
308
+ */
309
+ declare function parseIpv6Address(input: string): Ipv6ParseResult | {
310
+ error: string;
311
+ };
294
312
 
295
313
  type network_CacheControlDirective = CacheControlDirective;
296
314
  type network_CacheControlOptions = CacheControlOptions;
@@ -306,6 +324,8 @@ type network_HarParseResult = HarParseResult;
306
324
  type network_HarSummary = HarSummary;
307
325
  type network_HeaderCategory = HeaderCategory;
308
326
  type network_HttpHeader = HttpHeader;
327
+ type network_Ipv6AddressType = Ipv6AddressType;
328
+ type network_Ipv6ParseResult = Ipv6ParseResult;
309
329
  type network_ParsedDnsResult = ParsedDnsResult;
310
330
  type network_ParsedGeoResult = ParsedGeoResult;
311
331
  type network_RobotsGroup = RobotsGroup;
@@ -341,6 +361,7 @@ declare const network_isValidIpv6: typeof isValidIpv6;
341
361
  declare const network_parseDnsResponse: typeof parseDnsResponse;
342
362
  declare const network_parseGeoResponse: typeof parseGeoResponse;
343
363
  declare const network_parseHar: typeof parseHar;
364
+ declare const network_parseIpv6Address: typeof parseIpv6Address;
344
365
  declare const network_parseUserAgent: typeof parseUserAgent;
345
366
  declare const network_searchHeaders: typeof searchHeaders;
346
367
  declare const network_searchStatusCodes: typeof searchStatusCodes;
@@ -352,7 +373,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
352
373
  declare const network_validateRobotsTxt: typeof validateRobotsTxt;
353
374
  declare const network_validateSitemap: typeof validateSitemap;
354
375
  declare namespace network {
355
- export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
376
+ export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
356
377
  }
357
378
 
358
- export { statusCodeToText as $, formatCoordinates as A, formatTtl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, getByCategory as E, getHeader as F, type GeoResult as G, HTTP_HEADERS as H, getHeadersByCategory as I, getStatusByCategory as J, getStatusCode as K, isClientError as L, isServerError as M, isSuccess as N, isValidIp as O, type ParsedDnsResult as P, isValidIpv4 as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIpv6 as T, type UaDeviceType as U, parseDnsResponse as V, parseGeoResponse as W, parseHar as X, parseUserAgent as Y, searchHeaders as Z, searchStatusCodes as _, type CacheControlOptions as a, typeNumberToLabel as a0, validateDomain as a1, validateHeaderName as a2, validateHeaderValue as a3, validateRobotsTxt as a4, validateSitemap as a5, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type ParsedGeoResult as k, type RobotsIssue as l, type RobotsRule as m, network as n, type RobotsValidationResult as o, type SitemapIndexEntry as p, type SitemapIssue as q, type SitemapUrlEntry as r, type SitemapValidationResult as s, type StatusCode as t, type UserAgentInfo as u, buildCacheControl as v, buildDnsQueryUrl as w, buildGeoUrl as x, buildMapUrl as y, countryCodeToFlag as z };
379
+ export { parseUserAgent as $, countryCodeToFlag as A, formatCoordinates as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, formatTtl as E, getByCategory as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, getHeader as J, getHeadersByCategory as K, getStatusByCategory as L, getStatusCode as M, isClientError as N, isServerError as O, type ParsedDnsResult as P, isSuccess as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIp as T, type UaDeviceType as U, isValidIpv4 as V, isValidIpv6 as W, parseDnsResponse as X, parseGeoResponse as Y, parseHar as Z, parseIpv6Address as _, type CacheControlOptions as a, searchHeaders as a0, searchStatusCodes as a1, statusCodeToText as a2, typeNumberToLabel as a3, validateDomain as a4, validateHeaderName as a5, validateHeaderValue as a6, validateRobotsTxt as a7, validateSitemap as a8, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type ParsedGeoResult as l, type RobotsIssue as m, network as n, type RobotsRule as o, type RobotsValidationResult as p, type SitemapIndexEntry as q, type SitemapIssue as r, type SitemapUrlEntry as s, type SitemapValidationResult as t, type StatusCode as u, type UserAgentInfo as v, buildCacheControl as w, buildDnsQueryUrl as x, buildGeoUrl as y, buildMapUrl as z };
@@ -457,6 +457,116 @@ function readPdfMetadata(bytes) {
457
457
  encrypted
458
458
  };
459
459
  }
460
+ var PDF_COMMON_PAPER_SIZES = [
461
+ { name: "Letter", widthPt: 612, heightPt: 792 },
462
+ { name: "Legal", widthPt: 612, heightPt: 1008 },
463
+ { name: "Tabloid", widthPt: 792, heightPt: 1224 },
464
+ { name: "A3", widthPt: 842, heightPt: 1191 },
465
+ { name: "A4", widthPt: 595, heightPt: 842 },
466
+ { name: "A5", widthPt: 420, heightPt: 595 },
467
+ { name: "B5", widthPt: 499, heightPt: 709 }
468
+ ];
469
+ function matchPaperSize(widthPt, heightPt) {
470
+ for (const size of PDF_COMMON_PAPER_SIZES) {
471
+ const w = Math.abs(widthPt - size.widthPt) <= 1;
472
+ const h = Math.abs(heightPt - size.heightPt) <= 1;
473
+ const wSwapped = Math.abs(widthPt - size.heightPt) <= 1;
474
+ const hSwapped = Math.abs(heightPt - size.widthPt) <= 1;
475
+ if (w && h || wSwapped && hSwapped) return size.name;
476
+ }
477
+ return null;
478
+ }
479
+ function parsePdfMediaBox(dict) {
480
+ const m = dict.match(/\/MediaBox\s*\[\s*(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)\s+(-?[\d.]+)\s*\]/);
481
+ if (!m) return null;
482
+ return [Number(m[1]), Number(m[2]), Number(m[3]), Number(m[4])];
483
+ }
484
+ function parsePdfRotate(dict) {
485
+ const m = dict.match(/\/Rotate\s+(-?\d+)/);
486
+ return m ? Number(m[1]) : null;
487
+ }
488
+ function buildPdfPageDimension(pageNumber, mediaBox, rotate) {
489
+ const rotation = (rotate % 360 + 360) % 360;
490
+ if (!mediaBox) {
491
+ return { pageNumber, widthPt: null, heightPt: null, widthIn: null, heightIn: null, rotation, orientation: null, paperSize: null };
492
+ }
493
+ const [llx, lly, urx, ury] = mediaBox;
494
+ let widthPt = Math.abs(urx - llx);
495
+ let heightPt = Math.abs(ury - lly);
496
+ if (rotation === 90 || rotation === 270) [widthPt, heightPt] = [heightPt, widthPt];
497
+ const orientation = widthPt === heightPt ? "square" : widthPt > heightPt ? "landscape" : "portrait";
498
+ return {
499
+ pageNumber,
500
+ widthPt: round2(widthPt),
501
+ heightPt: round2(heightPt),
502
+ widthIn: round2(widthPt / 72),
503
+ heightIn: round2(heightPt / 72),
504
+ rotation,
505
+ orientation,
506
+ paperSize: matchPaperSize(widthPt, heightPt)
507
+ };
508
+ }
509
+ function walkPdfPageTree(objMap, nodeBody, inherited, visited, nodeKey, out) {
510
+ if (visited.has(nodeKey)) return;
511
+ visited.add(nodeKey);
512
+ const mediaBox = parsePdfMediaBox(nodeBody) ?? inherited.mediaBox;
513
+ const rotateMatch = parsePdfRotate(nodeBody);
514
+ const rotate = rotateMatch !== null ? rotateMatch : inherited.rotate;
515
+ if (/\/Type\s*\/Page(?!s)\b/.test(nodeBody)) {
516
+ out.push(buildPdfPageDimension(out.length + 1, mediaBox, rotate));
517
+ return;
518
+ }
519
+ const kidsMatch = nodeBody.match(/\/Kids\s*\[([^\]]*)\]/);
520
+ if (!kidsMatch) return;
521
+ const kidRefs = [...kidsMatch[1].matchAll(/(\d+)\s+(\d+)\s+R/g)];
522
+ for (const ref of kidRefs) {
523
+ const key = `${ref[1]} ${ref[2]}`;
524
+ const body = objMap.get(key);
525
+ if (body) walkPdfPageTree(objMap, body, { mediaBox, rotate }, visited, key, out);
526
+ }
527
+ }
528
+ function readPdfPageDimensions(bytes) {
529
+ if (bytes.length < 8) return { error: "File too small to be a PDF" };
530
+ const header = bytesToLatin1(bytes.subarray(0, 16));
531
+ const versionMatch = header.match(/%PDF-(\d\.\d)/);
532
+ if (!versionMatch) return { error: "Not a valid PDF file (missing %PDF header)" };
533
+ const version = versionMatch[1];
534
+ const text = bytesToLatin1(bytes);
535
+ const objBlocks = [...text.matchAll(/(\d+)\s+(\d+)\s+obj([\s\S]*?)endobj/g)];
536
+ const objMap = /* @__PURE__ */ new Map();
537
+ for (const b of objBlocks) objMap.set(`${b[1]} ${b[2]}`, b[3]);
538
+ const out = [];
539
+ const visited = /* @__PURE__ */ new Set();
540
+ let pagesRootBody = null;
541
+ const trailerMatches = [...text.matchAll(/trailer\s*<<([\s\S]*?)>>/g)];
542
+ if (trailerMatches.length > 0) {
543
+ const trailer = trailerMatches[trailerMatches.length - 1][1];
544
+ const rootRef = trailer.match(/\/Root\s+(\d+)\s+(\d+)\s+R/);
545
+ if (rootRef) {
546
+ const catalogBody = objMap.get(`${rootRef[1]} ${rootRef[2]}`);
547
+ const pagesRef = catalogBody?.match(/\/Pages\s+(\d+)\s+(\d+)\s+R/);
548
+ if (pagesRef) pagesRootBody = objMap.get(`${pagesRef[1]} ${pagesRef[2]}`) ?? null;
549
+ }
550
+ }
551
+ if (!pagesRootBody) {
552
+ for (const b of objBlocks) {
553
+ if (/\/Type\s*\/Pages\b/.test(b[3]) && !/\/Parent\s+\d+\s+\d+\s+R/.test(b[3])) {
554
+ pagesRootBody = b[3];
555
+ break;
556
+ }
557
+ }
558
+ }
559
+ if (pagesRootBody) walkPdfPageTree(objMap, pagesRootBody, { mediaBox: null, rotate: 0 }, visited, "root", out);
560
+ if (out.length === 0) {
561
+ for (const b of objBlocks) {
562
+ if (/\/Type\s*\/Page(?!s)\b/.test(b[3])) {
563
+ out.push(buildPdfPageDimension(out.length + 1, parsePdfMediaBox(b[3]), parsePdfRotate(b[3]) ?? 0));
564
+ }
565
+ }
566
+ }
567
+ if (out.length === 0) return { error: "Could not locate any page objects in this PDF" };
568
+ return { version, pageCount: out.length, pages: out };
569
+ }
460
570
  var AUDIO_FORMAT_LABELS = {
461
571
  1: "PCM",
462
572
  3: "IEEE float",
@@ -850,6 +960,254 @@ function readFlacInfo(bytes) {
850
960
  }
851
961
  return result;
852
962
  }
963
+ function readU64BE(bytes, offset) {
964
+ return readU32BE(bytes, offset) * 4294967296 + readU32BE(bytes, offset + 4);
965
+ }
966
+ function readMp4Boxes(bytes, start, end) {
967
+ const boxes = [];
968
+ let offset = start;
969
+ while (offset + 8 <= end) {
970
+ let size = readU32BE(bytes, offset);
971
+ const type = readAscii4(bytes, offset + 4);
972
+ let headerSize = 8;
973
+ if (size === 1) {
974
+ if (offset + 16 > end) break;
975
+ size = readU64BE(bytes, offset + 8);
976
+ headerSize = 16;
977
+ } else if (size === 0) {
978
+ size = end - offset;
979
+ }
980
+ if (size < headerSize || offset + size > end) break;
981
+ boxes.push({ type, start: offset + headerSize, end: offset + size });
982
+ offset += size;
983
+ }
984
+ return boxes;
985
+ }
986
+ function findMp4Box(boxes, type) {
987
+ return boxes.find((b) => b.type === type);
988
+ }
989
+ function parseMp4Mvhd(bytes, box) {
990
+ const o = box.start;
991
+ if (o >= box.end) return null;
992
+ const version = bytes[o];
993
+ if (version === 1) {
994
+ if (o + 32 > box.end) return null;
995
+ return { timescale: readU32BE(bytes, o + 20), duration: readU64BE(bytes, o + 24) };
996
+ }
997
+ if (o + 20 > box.end) return null;
998
+ return { timescale: readU32BE(bytes, o + 12), duration: readU32BE(bytes, o + 16) };
999
+ }
1000
+ function parseMp4Tkhd(bytes, box) {
1001
+ const o = box.start;
1002
+ if (o >= box.end) return null;
1003
+ const version = bytes[o];
1004
+ const fixedFieldsSize = version === 1 ? 4 + 8 + 8 + 4 + 4 + 8 : 4 + 4 + 4 + 4 + 4 + 4;
1005
+ const afterDuration = o + fixedFieldsSize;
1006
+ const matrixStart = afterDuration + 8 + 2 + 2 + 2 + 2;
1007
+ const widthOffset = matrixStart + 36;
1008
+ if (widthOffset + 8 > box.end) return null;
1009
+ return { width: readU32BE(bytes, widthOffset) / 65536, height: readU32BE(bytes, widthOffset + 4) / 65536 };
1010
+ }
1011
+ function parseMp4Hdlr(bytes, box) {
1012
+ const o = box.start;
1013
+ if (o + 12 > box.end) return null;
1014
+ return readAscii4(bytes, o + 8);
1015
+ }
1016
+ function parseMp4StsdCodec(bytes, box) {
1017
+ const o = box.start;
1018
+ if (o + 8 > box.end) return null;
1019
+ const entryCount = readU32BE(bytes, o + 4);
1020
+ if (entryCount < 1) return null;
1021
+ const entryStart = o + 8;
1022
+ if (entryStart + 8 > box.end) return null;
1023
+ return readAscii4(bytes, entryStart + 4);
1024
+ }
1025
+ function parseMp4StsdVideoDims(bytes, box) {
1026
+ const o = box.start;
1027
+ if (o + 8 > box.end) return null;
1028
+ const entryCount = readU32BE(bytes, o + 4);
1029
+ if (entryCount < 1) return null;
1030
+ const entryStart = o + 8;
1031
+ if (entryStart + 36 > box.end) return null;
1032
+ return {
1033
+ width: bytes[entryStart + 32] << 8 | bytes[entryStart + 33],
1034
+ height: bytes[entryStart + 34] << 8 | bytes[entryStart + 35]
1035
+ };
1036
+ }
1037
+ function parseMp4(bytes) {
1038
+ const topBoxes = readMp4Boxes(bytes, 0, bytes.length);
1039
+ const ftyp = findMp4Box(topBoxes, "ftyp");
1040
+ const moov = findMp4Box(topBoxes, "moov");
1041
+ if (!moov) return { error: "No moov box found (not a valid or fully-downloaded MP4 file)" };
1042
+ const result = { format: "mp4" };
1043
+ if (ftyp && ftyp.start + 4 <= ftyp.end) result.majorBrand = readAscii4(bytes, ftyp.start);
1044
+ const moovBoxes = readMp4Boxes(bytes, moov.start, moov.end);
1045
+ const mvhd = findMp4Box(moovBoxes, "mvhd");
1046
+ if (mvhd) {
1047
+ const info = parseMp4Mvhd(bytes, mvhd);
1048
+ if (info && info.timescale > 0) result.durationSeconds = Math.round(info.duration / info.timescale * 1e3) / 1e3;
1049
+ }
1050
+ for (const trak of moovBoxes.filter((b) => b.type === "trak")) {
1051
+ const trakBoxes = readMp4Boxes(bytes, trak.start, trak.end);
1052
+ const mdia = findMp4Box(trakBoxes, "mdia");
1053
+ if (!mdia) continue;
1054
+ const mdiaBoxes = readMp4Boxes(bytes, mdia.start, mdia.end);
1055
+ const hdlr = findMp4Box(mdiaBoxes, "hdlr");
1056
+ const handlerType = hdlr ? parseMp4Hdlr(bytes, hdlr) : null;
1057
+ const minf = findMp4Box(mdiaBoxes, "minf");
1058
+ if (!minf) continue;
1059
+ const stbl = findMp4Box(readMp4Boxes(bytes, minf.start, minf.end), "stbl");
1060
+ if (!stbl) continue;
1061
+ const stsd = findMp4Box(readMp4Boxes(bytes, stbl.start, stbl.end), "stsd");
1062
+ const codec = stsd ? parseMp4StsdCodec(bytes, stsd) : null;
1063
+ if (handlerType === "vide") {
1064
+ if (codec) result.videoCodec = codec;
1065
+ const tkhd = findMp4Box(trakBoxes, "tkhd");
1066
+ const dims = tkhd ? parseMp4Tkhd(bytes, tkhd) : null;
1067
+ if (dims && dims.width > 0 && dims.height > 0) {
1068
+ result.width = Math.round(dims.width);
1069
+ result.height = Math.round(dims.height);
1070
+ } else if (stsd) {
1071
+ const pixelDims = parseMp4StsdVideoDims(bytes, stsd);
1072
+ if (pixelDims && pixelDims.width > 0 && pixelDims.height > 0) {
1073
+ result.width = pixelDims.width;
1074
+ result.height = pixelDims.height;
1075
+ }
1076
+ }
1077
+ } else if (handlerType === "soun") {
1078
+ if (codec) result.audioCodec = codec;
1079
+ }
1080
+ }
1081
+ if (result.durationSeconds === void 0 && !result.videoCodec && !result.audioCodec) {
1082
+ return { error: "Could not find any usable track metadata in this MP4 file's moov box" };
1083
+ }
1084
+ return result;
1085
+ }
1086
+ function ebmlVintLength(firstByte) {
1087
+ if (firstByte === 0) return 0;
1088
+ let mask = 128;
1089
+ let length = 1;
1090
+ while (length <= 8 && (firstByte & mask) === 0) {
1091
+ mask >>= 1;
1092
+ length++;
1093
+ }
1094
+ return length;
1095
+ }
1096
+ function readEbmlId(bytes, offset) {
1097
+ if (offset >= bytes.length) return null;
1098
+ const length = ebmlVintLength(bytes[offset]);
1099
+ if (length === 0 || offset + length > bytes.length) return null;
1100
+ let id = 0;
1101
+ for (let i = 0; i < length; i++) id = id * 256 + bytes[offset + i];
1102
+ return { id, length };
1103
+ }
1104
+ function readEbmlSize(bytes, offset) {
1105
+ if (offset >= bytes.length) return null;
1106
+ const length = ebmlVintLength(bytes[offset]);
1107
+ if (length === 0 || offset + length > bytes.length) return null;
1108
+ const mask = 255 >> length;
1109
+ let value = bytes[offset] & mask;
1110
+ let allOnes = value === mask;
1111
+ for (let i = 1; i < length; i++) {
1112
+ value = value * 256 + bytes[offset + i];
1113
+ if (bytes[offset + i] !== 255) allOnes = false;
1114
+ }
1115
+ return { value, length, unknown: allOnes };
1116
+ }
1117
+ function readEbmlUint(bytes, offset, length) {
1118
+ let value = 0;
1119
+ for (let i = 0; i < length; i++) value = value * 256 + bytes[offset + i];
1120
+ return value;
1121
+ }
1122
+ function readEbmlFloat(bytes, offset, length) {
1123
+ if (offset + length > bytes.length) return 0;
1124
+ const view = new DataView(bytes.buffer, bytes.byteOffset + offset, length);
1125
+ if (length === 4) return view.getFloat32(0, false);
1126
+ if (length === 8) return view.getFloat64(0, false);
1127
+ return 0;
1128
+ }
1129
+ function ebmlChildren(bytes, start, end) {
1130
+ const children = [];
1131
+ let offset = start;
1132
+ while (offset < end) {
1133
+ const idInfo = readEbmlId(bytes, offset);
1134
+ if (!idInfo) break;
1135
+ const sizeInfo = readEbmlSize(bytes, offset + idInfo.length);
1136
+ if (!sizeInfo) break;
1137
+ const dataStart = offset + idInfo.length + sizeInfo.length;
1138
+ const dataEnd = sizeInfo.unknown ? end : Math.min(dataStart + sizeInfo.value, end);
1139
+ children.push({ id: idInfo.id, dataStart, dataEnd });
1140
+ offset = dataEnd;
1141
+ }
1142
+ return children;
1143
+ }
1144
+ var EBML_ID_SEGMENT = 408125543;
1145
+ var EBML_ID_INFO = 357149030;
1146
+ var EBML_ID_TIMECODE_SCALE = 2807729;
1147
+ var EBML_ID_DURATION = 17545;
1148
+ var EBML_ID_TRACKS = 374648427;
1149
+ var EBML_ID_TRACK_ENTRY = 174;
1150
+ var EBML_ID_TRACK_TYPE = 131;
1151
+ var EBML_ID_CODEC_ID = 134;
1152
+ var EBML_ID_VIDEO = 224;
1153
+ var EBML_ID_PIXEL_WIDTH = 176;
1154
+ var EBML_ID_PIXEL_HEIGHT = 186;
1155
+ var EBML_ID_CLUSTER = 524531317;
1156
+ function readVideoInfo(bytes) {
1157
+ if (bytes.length < 12) return { error: "File is too small to be a valid video file" };
1158
+ if (readAscii4(bytes, 4) === "ftyp") return parseMp4(bytes);
1159
+ if (bytes[0] === 26 && bytes[1] === 69 && bytes[2] === 223 && bytes[3] === 163) return parseWebm(bytes);
1160
+ return { error: 'Not a recognized MP4 or WebM file (missing an "ftyp" box or an EBML header signature)' };
1161
+ }
1162
+ function parseWebm(bytes) {
1163
+ const top = ebmlChildren(bytes, 0, bytes.length);
1164
+ const segment = top.find((c) => c.id === EBML_ID_SEGMENT);
1165
+ if (!segment) return { error: "No Segment element found (not a valid WebM/Matroska file)" };
1166
+ const result = { format: "webm" };
1167
+ let timecodeScale = 1e6;
1168
+ let rawDuration;
1169
+ for (const child of ebmlChildren(bytes, segment.dataStart, segment.dataEnd)) {
1170
+ if (child.id === EBML_ID_CLUSTER) break;
1171
+ if (child.id === EBML_ID_INFO) {
1172
+ for (const f of ebmlChildren(bytes, child.dataStart, child.dataEnd)) {
1173
+ if (f.id === EBML_ID_TIMECODE_SCALE) timecodeScale = readEbmlUint(bytes, f.dataStart, f.dataEnd - f.dataStart) || 1e6;
1174
+ else if (f.id === EBML_ID_DURATION) rawDuration = readEbmlFloat(bytes, f.dataStart, f.dataEnd - f.dataStart);
1175
+ }
1176
+ } else if (child.id === EBML_ID_TRACKS) {
1177
+ for (const entry of ebmlChildren(bytes, child.dataStart, child.dataEnd)) {
1178
+ if (entry.id !== EBML_ID_TRACK_ENTRY) continue;
1179
+ let trackType;
1180
+ let codecId;
1181
+ let pixelWidth;
1182
+ let pixelHeight;
1183
+ for (const f of ebmlChildren(bytes, entry.dataStart, entry.dataEnd)) {
1184
+ if (f.id === EBML_ID_TRACK_TYPE) trackType = readEbmlUint(bytes, f.dataStart, f.dataEnd - f.dataStart);
1185
+ else if (f.id === EBML_ID_CODEC_ID) codecId = Buffer.from(bytes.subarray(f.dataStart, f.dataEnd)).toString("ascii").replace(/\0+$/, "");
1186
+ else if (f.id === EBML_ID_VIDEO) {
1187
+ for (const v of ebmlChildren(bytes, f.dataStart, f.dataEnd)) {
1188
+ if (v.id === EBML_ID_PIXEL_WIDTH) pixelWidth = readEbmlUint(bytes, v.dataStart, v.dataEnd - v.dataStart);
1189
+ else if (v.id === EBML_ID_PIXEL_HEIGHT) pixelHeight = readEbmlUint(bytes, v.dataStart, v.dataEnd - v.dataStart);
1190
+ }
1191
+ }
1192
+ }
1193
+ if (trackType === 1) {
1194
+ if (codecId) result.videoCodec = codecId;
1195
+ if (pixelWidth) result.width = pixelWidth;
1196
+ if (pixelHeight) result.height = pixelHeight;
1197
+ } else if (trackType === 2) {
1198
+ if (codecId) result.audioCodec = codecId;
1199
+ }
1200
+ }
1201
+ }
1202
+ }
1203
+ if (rawDuration !== void 0 && timecodeScale > 0) {
1204
+ result.durationSeconds = Math.round(rawDuration * timecodeScale / 1e9 * 1e3) / 1e3;
1205
+ }
1206
+ if (result.durationSeconds === void 0 && !result.videoCodec && !result.audioCodec) {
1207
+ return { error: "Could not find any usable metadata in this WebM file's Segment element" };
1208
+ }
1209
+ return result;
1210
+ }
853
1211
 
854
1212
  exports.readExifData = readExifData;
855
1213
  exports.readFlacInfo = readFlacInfo;
@@ -857,4 +1215,6 @@ exports.readIcoInfo = readIcoInfo;
857
1215
  exports.readId3Tags = readId3Tags;
858
1216
  exports.readImageInfo = readImageInfo;
859
1217
  exports.readPdfMetadata = readPdfMetadata;
1218
+ exports.readPdfPageDimensions = readPdfPageDimensions;
1219
+ exports.readVideoInfo = readVideoInfo;
860
1220
  exports.readWavInfo = readWavInfo;
@@ -1 +1 @@
1
- export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, I as IcoImageEntry, c as IcoInfo, d as IcoInfoError, e as Id3Tags, f as Id3TagsError, g as ImageFormat, h as ImageInfo, i as ImageInfoError, P as PdfMetadata, j as PdfMetadataError, W as WavInfo, k as WavInfoError, r as readExifData, l as readFlacInfo, n as readIcoInfo, o as readId3Tags, p as readImageInfo, q as readPdfMetadata, s as readWavInfo } from '../media-CN17a3MM.cjs';
1
+ export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, I as IcoImageEntry, c as IcoInfo, d as IcoInfoError, e as Id3Tags, f as Id3TagsError, g as ImageFormat, h as ImageInfo, i as ImageInfoError, P as PdfMetadata, j as PdfMetadataError, k as PdfPageDimension, l as PdfPageDimensionsResult, n as PdfPageOrientation, V as VideoInfo, o as VideoInfoError, W as WavInfo, p as WavInfoError, r as readExifData, q as readFlacInfo, s as readIcoInfo, t as readId3Tags, u as readImageInfo, v as readPdfMetadata, w as readPdfPageDimensions, x as readVideoInfo, y as readWavInfo } from '../media-fD8dJ5qR.cjs';
@@ -1 +1 @@
1
- export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, I as IcoImageEntry, c as IcoInfo, d as IcoInfoError, e as Id3Tags, f as Id3TagsError, g as ImageFormat, h as ImageInfo, i as ImageInfoError, P as PdfMetadata, j as PdfMetadataError, W as WavInfo, k as WavInfoError, r as readExifData, l as readFlacInfo, n as readIcoInfo, o as readId3Tags, p as readImageInfo, q as readPdfMetadata, s as readWavInfo } from '../media-CN17a3MM.js';
1
+ export { E as ExifData, a as ExifError, F as FlacInfo, b as FlacInfoError, I as IcoImageEntry, c as IcoInfo, d as IcoInfoError, e as Id3Tags, f as Id3TagsError, g as ImageFormat, h as ImageInfo, i as ImageInfoError, P as PdfMetadata, j as PdfMetadataError, k as PdfPageDimension, l as PdfPageDimensionsResult, n as PdfPageOrientation, V as VideoInfo, o as VideoInfoError, W as WavInfo, p as WavInfoError, r as readExifData, q as readFlacInfo, s as readIcoInfo, t as readId3Tags, u as readImageInfo, v as readPdfMetadata, w as readPdfPageDimensions, x as readVideoInfo, y as readWavInfo } from '../media-fD8dJ5qR.js';
@@ -1,2 +1,2 @@
1
- export { readExifData, readFlacInfo, readIcoInfo, readId3Tags, readImageInfo, readPdfMetadata, readWavInfo } from '../chunk-Q3M23WNJ.js';
1
+ export { readExifData, readFlacInfo, readIcoInfo, readId3Tags, readImageInfo, readPdfMetadata, readPdfPageDimensions, readVideoInfo, readWavInfo } from '../chunk-L6V4W4SU.js';
2
2
  import '../chunk-MLKGABMK.js';