@utilix-tech/sdk 0.93.0 → 0.95.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.
package/dist/index.cjs CHANGED
@@ -9372,6 +9372,7 @@ __export(units_exports, {
9372
9372
  decimalToIpCidr: () => decimalToIpCidr,
9373
9373
  describePermissions: () => describePermissions,
9374
9374
  detectNegativeAmortization: () => detectNegativeAmortization,
9375
+ estimateAudioFileSize: () => estimateAudioFileSize,
9375
9376
  fitIntoBox: () => fitIntoBox,
9376
9377
  formatNumber: () => formatNumber,
9377
9378
  formatValue: () => formatValue,
@@ -12468,6 +12469,56 @@ function detectNegativeAmortization(input) {
12468
12469
  capCrossedMonth
12469
12470
  };
12470
12471
  }
12472
+ var AUDIO_FILE_SIZE_WAV_HEADER_BYTES = 44;
12473
+ function estimateAudioFileSize(input) {
12474
+ const { mode, durationSeconds } = input;
12475
+ if (!Number.isFinite(durationSeconds) || durationSeconds <= 0) {
12476
+ return { error: "durationSeconds must be a positive number" };
12477
+ }
12478
+ const round23 = (n) => Math.round(n * 100) / 100;
12479
+ if (mode === "pcm") {
12480
+ const { sampleRateHz, bitDepth, channels } = input;
12481
+ if (!Number.isFinite(sampleRateHz) || sampleRateHz <= 0) {
12482
+ return { error: 'sampleRateHz must be a positive number for mode "pcm"' };
12483
+ }
12484
+ if (!Number.isFinite(bitDepth) || bitDepth <= 0) {
12485
+ return { error: 'bitDepth must be a positive number for mode "pcm"' };
12486
+ }
12487
+ if (!Number.isInteger(channels) || channels <= 0) {
12488
+ return { error: 'channels must be a positive whole number for mode "pcm"' };
12489
+ }
12490
+ const dataBytes = sampleRateHz * (bitDepth / 8) * channels * durationSeconds;
12491
+ const fileSizeBytes = dataBytes + AUDIO_FILE_SIZE_WAV_HEADER_BYTES;
12492
+ return {
12493
+ mode,
12494
+ durationSeconds,
12495
+ sampleRateHz,
12496
+ bitDepth,
12497
+ channels,
12498
+ dataBytes: Math.round(dataBytes),
12499
+ fileSizeBytes: Math.round(fileSizeBytes),
12500
+ fileSizeMB: round23(fileSizeBytes / 1e6),
12501
+ fileSizeMiB: round23(fileSizeBytes / 1048576)
12502
+ };
12503
+ }
12504
+ if (mode === "compressed") {
12505
+ const { bitrateKbps } = input;
12506
+ if (!Number.isFinite(bitrateKbps) || bitrateKbps <= 0) {
12507
+ return { error: 'bitrateKbps must be a positive number for mode "compressed"' };
12508
+ }
12509
+ const dataBytes = bitrateKbps * 1e3 * durationSeconds / 8;
12510
+ return {
12511
+ mode,
12512
+ durationSeconds,
12513
+ bitrateKbps,
12514
+ dataBytes: Math.round(dataBytes),
12515
+ fileSizeBytes: Math.round(dataBytes),
12516
+ fileSizeMB: round23(dataBytes / 1e6),
12517
+ fileSizeMiB: round23(dataBytes / 1048576)
12518
+ };
12519
+ }
12520
+ return { error: 'mode must be "pcm" or "compressed"' };
12521
+ }
12471
12522
 
12472
12523
  // src/tools/network.ts
12473
12524
  var network_exports = {};
@@ -12483,6 +12534,7 @@ __export(network_exports, {
12483
12534
  analyzeEmailHeaders: () => analyzeEmailHeaders,
12484
12535
  assessContentTypeRisk: () => assessContentTypeRisk,
12485
12536
  buildAcceptLanguage: () => buildAcceptLanguage,
12537
+ buildAltSvcHeader: () => buildAltSvcHeader,
12486
12538
  buildCacheControl: () => buildCacheControl,
12487
12539
  buildClearSiteData: () => buildClearSiteData,
12488
12540
  buildClientHints: () => buildClientHints,
@@ -12525,6 +12577,7 @@ __export(network_exports, {
12525
12577
  lookupCloseCode: () => lookupCloseCode,
12526
12578
  lookupOpcode: () => lookupOpcode,
12527
12579
  parseAcceptLanguage: () => parseAcceptLanguage,
12580
+ parseAltSvcHeader: () => parseAltSvcHeader,
12528
12581
  parseClearSiteData: () => parseClearSiteData,
12529
12582
  parseClientHintHeaders: () => parseClientHintHeaders,
12530
12583
  parseContentDisposition: () => parseContentDisposition,
@@ -16180,6 +16233,114 @@ function parseClearSiteData(raw) {
16180
16233
  }
16181
16234
  return buildClearSiteData(directives);
16182
16235
  }
16236
+ var ALT_SVC_DEFAULT_MAX_AGE = 86400;
16237
+ var ALT_SVC_DEPRECATED_H3_DRAFTS = /* @__PURE__ */ new Set(["h3-29", "h3-27", "h3-25", "h3-24", "h3-23", "h3-22"]);
16238
+ var ALT_SVC_PROTOCOL_NOTES = {
16239
+ "h3": "HTTP/3 over QUIC, the current protocol ID clients should be offered.",
16240
+ "h3-29": 'An outdated HTTP/3 draft version (draft-29); modern clients only match "h3".',
16241
+ "h3-27": 'An outdated HTTP/3 draft version (draft-27); modern clients only match "h3".',
16242
+ "h3-25": 'An outdated HTTP/3 draft version (draft-25); modern clients only match "h3".',
16243
+ "h2": "HTTP/2 over TLS.",
16244
+ "h2c": "HTTP/2 over cleartext TCP; rarely advertised via Alt-Svc since it needs an out-of-band upgrade rather than ALPN negotiation.",
16245
+ "http/1.1": "Plain HTTP/1.1; advertising it via Alt-Svc is unusual since it is already the universal fallback."
16246
+ };
16247
+ function buildAltSvcHeader(alternatives) {
16248
+ if (!Array.isArray(alternatives) || alternatives.length === 0) {
16249
+ return { error: "At least one alternative service is required" };
16250
+ }
16251
+ const warnings = [];
16252
+ const entries = [];
16253
+ const seen = /* @__PURE__ */ new Set();
16254
+ for (const alt of alternatives) {
16255
+ const protocolId = typeof alt.protocolId === "string" ? alt.protocolId.trim() : "";
16256
+ if (!protocolId) return { error: 'Each alternative needs a protocol-id (e.g. "h3")' };
16257
+ if (!Number.isInteger(alt.port) || alt.port < 1 || alt.port > 65535) {
16258
+ return { error: `Each alternative needs a valid port (1-65535), got ${JSON.stringify(alt.port)}` };
16259
+ }
16260
+ const host = alt.host?.trim();
16261
+ const authority = `${host ?? ""}:${alt.port}`;
16262
+ const maxAge = alt.maxAge !== void 0 ? alt.maxAge : ALT_SVC_DEFAULT_MAX_AGE;
16263
+ if (!Number.isFinite(maxAge) || maxAge < 0) return { error: "maxAge must be a non-negative number of seconds" };
16264
+ const persist = alt.persist === true;
16265
+ const dedupeKey = `${protocolId.toLowerCase()}|${authority.toLowerCase()}`;
16266
+ if (seen.has(dedupeKey)) {
16267
+ warnings.push(`duplicate alternative "${protocolId}=${JSON.stringify(authority)}" was removed`);
16268
+ continue;
16269
+ }
16270
+ seen.add(dedupeKey);
16271
+ if (maxAge === 0) warnings.push(`"${protocolId}" has ma=0, so clients should treat it as already expired`);
16272
+ if (persist && maxAge === 0) warnings.push(`"${protocolId}" sets persist=1 with ma=0, which is contradictory: the entry expires immediately`);
16273
+ if (ALT_SVC_DEPRECATED_H3_DRAFTS.has(protocolId.toLowerCase())) {
16274
+ warnings.push(`"${protocolId}" is an outdated HTTP/3 draft protocol-id; modern clients only match "h3"`);
16275
+ }
16276
+ const note = ALT_SVC_PROTOCOL_NOTES[protocolId.toLowerCase()] ?? `Advertises "${protocolId}" as an alternative protocol clients may switch to for this authority.`;
16277
+ entries.push({ protocolId, authority, maxAge, persist, note });
16278
+ }
16279
+ if (entries.length === 0) return { error: "At least one alternative service is required" };
16280
+ const headerValue = entries.map((e) => {
16281
+ let s = `${e.protocolId}="${e.authority}"; ma=${e.maxAge}`;
16282
+ if (e.persist) s += "; persist=1";
16283
+ return s;
16284
+ }).join(", ");
16285
+ return { header: `Alt-Svc: ${headerValue}`, headerValue, entries, cleared: false, warnings };
16286
+ }
16287
+ function altSvcSplitTopLevel(s, sep) {
16288
+ const out = [];
16289
+ let inQuotes = false;
16290
+ let current = "";
16291
+ for (const ch of s) {
16292
+ if (ch === '"') inQuotes = !inQuotes;
16293
+ if (ch === sep && !inQuotes) {
16294
+ out.push(current);
16295
+ current = "";
16296
+ } else {
16297
+ current += ch;
16298
+ }
16299
+ }
16300
+ out.push(current);
16301
+ return out;
16302
+ }
16303
+ function parseAltSvcHeader(raw) {
16304
+ if (!raw || raw.trim() === "") return { error: "Input is empty" };
16305
+ const withoutLabel = raw.trim().replace(/^alt-svc:\s*/i, "");
16306
+ if (withoutLabel.toLowerCase() === "clear") {
16307
+ return { header: "Alt-Svc: clear", headerValue: "clear", entries: [], cleared: true, warnings: [] };
16308
+ }
16309
+ const parts = altSvcSplitTopLevel(withoutLabel, ",");
16310
+ const alternatives = [];
16311
+ for (const part of parts) {
16312
+ const trimmedPart = part.trim();
16313
+ if (!trimmedPart) continue;
16314
+ const eq = trimmedPart.indexOf("=");
16315
+ if (eq === -1) return { error: `Could not parse alternative: "${trimmedPart}"` };
16316
+ const protocolId = trimmedPart.slice(0, eq).trim();
16317
+ const rest = trimmedPart.slice(eq + 1).trim();
16318
+ const segments = altSvcSplitTopLevel(rest, ";").map((s) => s.trim());
16319
+ const authorityMatch = segments[0]?.match(/^"(.*)"$/);
16320
+ if (!authorityMatch) return { error: `Alternative "${protocolId}" is missing a quoted authority (e.g. ":443")` };
16321
+ const authority = authorityMatch[1];
16322
+ const colonIdx = authority.lastIndexOf(":");
16323
+ if (colonIdx === -1) return { error: `Alternative "${protocolId}" has an authority with no port: "${authority}"` };
16324
+ const host = authority.slice(0, colonIdx) || void 0;
16325
+ const portStr = authority.slice(colonIdx + 1);
16326
+ const port = Number(portStr);
16327
+ if (!Number.isInteger(port) || port < 1 || port > 65535) return { error: `Alternative "${protocolId}" has an invalid port: "${portStr}"` };
16328
+ let maxAge;
16329
+ let persist = false;
16330
+ for (const seg of segments.slice(1)) {
16331
+ const sepIdx = seg.indexOf("=");
16332
+ if (sepIdx === -1) continue;
16333
+ const key = seg.slice(0, sepIdx).trim().toLowerCase();
16334
+ const value = seg.slice(sepIdx + 1).trim();
16335
+ if (key === "ma") maxAge = Number(value);
16336
+ if (key === "persist") persist = value === "1";
16337
+ }
16338
+ if (maxAge !== void 0 && !Number.isFinite(maxAge)) return { error: `Alternative "${protocolId}" has a non-numeric ma value` };
16339
+ alternatives.push({ protocolId, host, port, maxAge, persist });
16340
+ }
16341
+ if (alternatives.length === 0) return { error: "No alternative services found" };
16342
+ return buildAltSvcHeader(alternatives);
16343
+ }
16183
16344
 
16184
16345
  // src/tools/api.ts
16185
16346
  var api_exports = {};
@@ -27224,6 +27385,7 @@ __export(media_exports, {
27224
27385
  readPdfMetadata: () => readPdfMetadata,
27225
27386
  readPdfOutline: () => readPdfOutline,
27226
27387
  readPdfPageDimensions: () => readPdfPageDimensions,
27388
+ readPngChunks: () => readPngChunks,
27227
27389
  readVideoInfo: () => readVideoInfo,
27228
27390
  readWavInfo: () => readWavInfo
27229
27391
  });
@@ -28717,6 +28879,116 @@ function readMidiInfo(bytes) {
28717
28879
  tracks
28718
28880
  };
28719
28881
  }
28882
+ var PNG_SIGNATURE = [137, 80, 78, 71, 13, 10, 26, 10];
28883
+ var PNG_CRC_TABLE = null;
28884
+ function getPngCrcTable() {
28885
+ if (PNG_CRC_TABLE) return PNG_CRC_TABLE;
28886
+ const table = new Uint32Array(256);
28887
+ for (let n = 0; n < 256; n++) {
28888
+ let c = n;
28889
+ for (let k = 0; k < 8; k++) {
28890
+ c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
28891
+ }
28892
+ table[n] = c;
28893
+ }
28894
+ PNG_CRC_TABLE = table;
28895
+ return table;
28896
+ }
28897
+ function pngCrc32(bytes) {
28898
+ const table = getPngCrcTable();
28899
+ let crc = 4294967295;
28900
+ for (let i = 0; i < bytes.length; i++) {
28901
+ crc = table[(crc ^ bytes[i]) & 255] ^ crc >>> 8;
28902
+ }
28903
+ return (crc ^ 4294967295) >>> 0;
28904
+ }
28905
+ function pad2(n) {
28906
+ return n < 10 ? `0${n}` : `${n}`;
28907
+ }
28908
+ function readPngChunks(bytes) {
28909
+ if (bytes.length < 8) return { error: "File too small to be a valid PNG file" };
28910
+ for (let i = 0; i < 8; i++) {
28911
+ if (bytes[i] !== PNG_SIGNATURE[i]) return { error: "Not a valid PNG file (bad 8-byte signature)" };
28912
+ }
28913
+ const chunks = [];
28914
+ const textChunks = [];
28915
+ let header = null;
28916
+ let physicalDimensions = null;
28917
+ let gamma = null;
28918
+ let lastModified = null;
28919
+ let isAnimated = false;
28920
+ let offset = 8;
28921
+ while (offset + 8 <= bytes.length) {
28922
+ const dataLength = readU32BE(bytes, offset);
28923
+ const type = String.fromCharCode(bytes[offset + 4], bytes[offset + 5], bytes[offset + 6], bytes[offset + 7]);
28924
+ const dataStart = offset + 8;
28925
+ const dataEnd = dataStart + dataLength;
28926
+ const crcOffset = dataEnd;
28927
+ if (crcOffset + 4 > bytes.length) {
28928
+ return { error: `Truncated chunk "${type}" at offset ${offset}` };
28929
+ }
28930
+ const data = bytes.subarray(dataStart, dataEnd);
28931
+ const expectedCrc = readU32BE(bytes, crcOffset);
28932
+ const actualCrc = pngCrc32(bytes.subarray(offset + 4, dataEnd));
28933
+ const firstChar = type.charCodeAt(0);
28934
+ const critical = firstChar >= 65 && firstChar <= 90;
28935
+ chunks.push({ type, offset, dataLength, crcValid: actualCrc === expectedCrc, critical });
28936
+ if (type === "IHDR" && data.length >= 13) {
28937
+ const colorTypeNum = data[9];
28938
+ header = {
28939
+ width: readU32BE(data, 0),
28940
+ height: readU32BE(data, 4),
28941
+ bitDepth: data[8],
28942
+ colorType: PNG_COLOR_TYPES[colorTypeNum] ?? "unknown",
28943
+ hasAlpha: colorTypeNum === 4 || colorTypeNum === 6,
28944
+ interlace: data[12] === 1
28945
+ };
28946
+ } else if (type === "tEXt") {
28947
+ const nullIdx = data.indexOf(0);
28948
+ if (nullIdx !== -1) {
28949
+ textChunks.push({
28950
+ keyword: Buffer.from(data.subarray(0, nullIdx)).toString("latin1"),
28951
+ text: Buffer.from(data.subarray(nullIdx + 1)).toString("latin1"),
28952
+ compressed: false
28953
+ });
28954
+ }
28955
+ } else if (type === "zTXt" || type === "iTXt") {
28956
+ const nullIdx = data.indexOf(0);
28957
+ if (nullIdx !== -1) {
28958
+ textChunks.push({ keyword: Buffer.from(data.subarray(0, nullIdx)).toString("latin1"), text: null, compressed: true });
28959
+ }
28960
+ } else if (type === "pHYs" && data.length >= 9) {
28961
+ physicalDimensions = {
28962
+ pixelsPerUnitX: readU32BE(data, 0),
28963
+ pixelsPerUnitY: readU32BE(data, 4),
28964
+ unit: data[8] === 1 ? "meter" : "unknown"
28965
+ };
28966
+ } else if (type === "gAMA" && data.length >= 4) {
28967
+ gamma = readU32BE(data, 0) / 1e5;
28968
+ } else if (type === "tIME" && data.length >= 7) {
28969
+ const year = data[0] << 8 | data[1];
28970
+ lastModified = `${year}-${pad2(data[2])}-${pad2(data[3])}T${pad2(data[4])}:${pad2(data[5])}:${pad2(data[6])}Z`;
28971
+ } else if (type === "acTL") {
28972
+ isAnimated = true;
28973
+ }
28974
+ offset = crcOffset + 4;
28975
+ if (type === "IEND") break;
28976
+ }
28977
+ if (chunks.length === 0) return { error: "No chunks found after the PNG signature" };
28978
+ if (!header) return { error: "Missing required IHDR chunk" };
28979
+ return {
28980
+ valid: true,
28981
+ fileSize: bytes.length,
28982
+ chunkCount: chunks.length,
28983
+ chunks,
28984
+ header,
28985
+ textChunks,
28986
+ physicalDimensions,
28987
+ gamma,
28988
+ lastModified,
28989
+ isAnimated
28990
+ };
28991
+ }
28720
28992
 
28721
28993
  // src/index.ts
28722
28994
  var version = "0.1.0";
package/dist/index.d.cts CHANGED
@@ -5,15 +5,15 @@ export { t as text } from './text-DOopHoK3.cjs';
5
5
  export { d as data } from './data-3qMdFIF5.cjs';
6
6
  export { g as generators } from './generators-DAXXrMvG.cjs';
7
7
  export { t as time } from './time-VMAy_SrV.cjs';
8
- export { u as units } from './units-DnWrOTSV.cjs';
9
- export { n as network } from './network-9j5aKpoR.cjs';
8
+ export { u as units } from './units-BBzv0VIt.cjs';
9
+ export { n as network } from './network-B6fQrsCc.cjs';
10
10
  export { a as api } from './api-CQnIUrVB.cjs';
11
11
  export { c as code } from './code-CZHElFHu.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
13
13
  export { c as css } from './css-Cf7AMGM-.cjs';
14
14
  export { m as misc } from './misc-CA3N198T.cjs';
15
15
  export { a as ai_agent } from './ai_agent-B9wWLBDf.cjs';
16
- export { m as media } from './media-DF8BS-iA.cjs';
16
+ export { m as media } from './media-C8Y67lUI.cjs';
17
17
 
18
18
  declare const version = "0.1.0";
19
19
 
package/dist/index.d.ts CHANGED
@@ -5,15 +5,15 @@ export { t as text } from './text-DOopHoK3.js';
5
5
  export { d as data } from './data-3qMdFIF5.js';
6
6
  export { g as generators } from './generators-DAXXrMvG.js';
7
7
  export { t as time } from './time-VMAy_SrV.js';
8
- export { u as units } from './units-DnWrOTSV.js';
9
- export { n as network } from './network-9j5aKpoR.js';
8
+ export { u as units } from './units-BBzv0VIt.js';
9
+ export { n as network } from './network-B6fQrsCc.js';
10
10
  export { a as api } from './api-CQnIUrVB.js';
11
11
  export { c as code } from './code-CZHElFHu.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
13
13
  export { c as css } from './css-Cf7AMGM-.js';
14
14
  export { m as misc } from './misc-CA3N198T.js';
15
15
  export { a as ai_agent } from './ai_agent-B9wWLBDf.js';
16
- export { m as media } from './media-DF8BS-iA.js';
16
+ export { m as media } from './media-C8Y67lUI.js';
17
17
 
18
18
  declare const version = "0.1.0";
19
19
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { media_exports as media } from './chunk-ZWFZRDQ4.js';
2
- export { units_exports as units } from './chunk-XAPHAUPI.js';
3
- export { network_exports as network } from './chunk-K3B4JTHN.js';
1
+ export { media_exports as media } from './chunk-YSS4VVZU.js';
2
+ export { units_exports as units } from './chunk-G5NUC5MV.js';
3
+ export { network_exports as network } from './chunk-K242OOF4.js';
4
4
  export { api_exports as api } from './chunk-U2HREMZU.js';
5
5
  export { code_exports as code } from './chunk-KRPIOHJ4.js';
6
6
  export { color_exports as color } from './chunk-BPVAB4P2.js';
@@ -289,6 +289,59 @@ interface MidiInfoError {
289
289
  * frames-per-second/ticks-per-frame rate instead.
290
290
  */
291
291
  declare function readMidiInfo(bytes: Uint8Array): MidiInfo | MidiInfoError;
292
+ interface PngChunkEntry {
293
+ type: string;
294
+ offset: number;
295
+ dataLength: number;
296
+ crcValid: boolean;
297
+ /** A chunk type is "critical" (decoders must understand it) when its
298
+ * first letter is uppercase, e.g. IHDR vs. an ancillary tEXt. */
299
+ critical: boolean;
300
+ }
301
+ interface PngHeaderInfo {
302
+ width: number;
303
+ height: number;
304
+ bitDepth: number;
305
+ colorType: string;
306
+ hasAlpha: boolean;
307
+ interlace: boolean;
308
+ }
309
+ interface PngTextChunk {
310
+ keyword: string;
311
+ text: string | null;
312
+ /** True for zTXt/iTXt, whose text this function does not decode. */
313
+ compressed: boolean;
314
+ }
315
+ interface PngPhysicalDimensions {
316
+ pixelsPerUnitX: number;
317
+ pixelsPerUnitY: number;
318
+ unit: 'meter' | 'unknown';
319
+ }
320
+ interface PngChunkInfo {
321
+ valid: true;
322
+ fileSize: number;
323
+ chunkCount: number;
324
+ chunks: PngChunkEntry[];
325
+ header: PngHeaderInfo | null;
326
+ textChunks: PngTextChunk[];
327
+ physicalDimensions: PngPhysicalDimensions | null;
328
+ gamma: number | null;
329
+ lastModified: string | null;
330
+ isAnimated: boolean;
331
+ }
332
+ interface PngChunkInfoError {
333
+ error: string;
334
+ }
335
+ /**
336
+ * Walk a PNG file's full chunk stream directly from its bytes: every
337
+ * chunk's type, byte offset, data length, and whether its stored CRC-32
338
+ * matches the type+data it covers, plus the decoded IHDR header and a
339
+ * handful of common ancillary chunks (tEXt, pHYs, gAMA, tIME, and acTL for
340
+ * APNG animation). No image library or pixel decoding is involved, and
341
+ * zTXt/iTXt text is listed but not zlib-inflated, so the result is
342
+ * identical in a browser tool and on a server.
343
+ */
344
+ declare function readPngChunks(bytes: Uint8Array): PngChunkInfo | PngChunkInfoError;
292
345
 
293
346
  type media_ExifData = ExifData;
294
347
  type media_ExifError = ExifError;
@@ -318,6 +371,12 @@ type media_PdfOutlineResult = PdfOutlineResult;
318
371
  type media_PdfPageDimension = PdfPageDimension;
319
372
  type media_PdfPageDimensionsResult = PdfPageDimensionsResult;
320
373
  type media_PdfPageOrientation = PdfPageOrientation;
374
+ type media_PngChunkEntry = PngChunkEntry;
375
+ type media_PngChunkInfo = PngChunkInfo;
376
+ type media_PngChunkInfoError = PngChunkInfoError;
377
+ type media_PngHeaderInfo = PngHeaderInfo;
378
+ type media_PngPhysicalDimensions = PngPhysicalDimensions;
379
+ type media_PngTextChunk = PngTextChunk;
321
380
  type media_VideoInfo = VideoInfo;
322
381
  type media_VideoInfoError = VideoInfoError;
323
382
  type media_WavInfo = WavInfo;
@@ -332,10 +391,11 @@ declare const media_readMidiInfo: typeof readMidiInfo;
332
391
  declare const media_readPdfMetadata: typeof readPdfMetadata;
333
392
  declare const media_readPdfOutline: typeof readPdfOutline;
334
393
  declare const media_readPdfPageDimensions: typeof readPdfPageDimensions;
394
+ declare const media_readPngChunks: typeof readPngChunks;
335
395
  declare const media_readVideoInfo: typeof readVideoInfo;
336
396
  declare const media_readWavInfo: typeof readWavInfo;
337
397
  declare namespace media {
338
- export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_GifInfo as GifInfo, type media_GifInfoError as GifInfoError, 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_MidiDivision as MidiDivision, type media_MidiInfo as MidiInfo, type media_MidiInfoError as MidiInfoError, type media_MidiTimeSignature as MidiTimeSignature, type media_MidiTrackInfo as MidiTrackInfo, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfOutlineDestType as PdfOutlineDestType, type media_PdfOutlineError as PdfOutlineError, type media_PdfOutlineItem as PdfOutlineItem, type media_PdfOutlineResult as PdfOutlineResult, 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_inspectGifFrames as inspectGifFrames, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readMidiInfo as readMidiInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfOutline as readPdfOutline, media_readPdfPageDimensions as readPdfPageDimensions, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
398
+ export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_GifInfo as GifInfo, type media_GifInfoError as GifInfoError, 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_MidiDivision as MidiDivision, type media_MidiInfo as MidiInfo, type media_MidiInfoError as MidiInfoError, type media_MidiTimeSignature as MidiTimeSignature, type media_MidiTrackInfo as MidiTrackInfo, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfOutlineDestType as PdfOutlineDestType, type media_PdfOutlineError as PdfOutlineError, type media_PdfOutlineItem as PdfOutlineItem, type media_PdfOutlineResult as PdfOutlineResult, type media_PdfPageDimension as PdfPageDimension, type media_PdfPageDimensionsResult as PdfPageDimensionsResult, type media_PdfPageOrientation as PdfPageOrientation, type media_PngChunkEntry as PngChunkEntry, type media_PngChunkInfo as PngChunkInfo, type media_PngChunkInfoError as PngChunkInfoError, type media_PngHeaderInfo as PngHeaderInfo, type media_PngPhysicalDimensions as PngPhysicalDimensions, type media_PngTextChunk as PngTextChunk, type media_VideoInfo as VideoInfo, type media_VideoInfoError as VideoInfoError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_inspectGifFrames as inspectGifFrames, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readMidiInfo as readMidiInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfOutline as readPdfOutline, media_readPdfPageDimensions as readPdfPageDimensions, media_readPngChunks as readPngChunks, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
339
399
  }
340
400
 
341
- export { readExifData as A, readFlacInfo as B, readIcoInfo as C, readId3Tags as D, type ExifData as E, type FlacInfo as F, type GifInfo as G, readImageInfo as H, type IcoImageEntry as I, readMidiInfo as J, readPdfMetadata as K, readPdfOutline as L, type MidiDivision as M, readPdfPageDimensions as N, readVideoInfo as O, type PdfMetadata as P, readWavInfo as Q, type VideoInfo as V, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type GifInfoError as c, type IcoInfo as d, type IcoInfoError as e, type Id3Tags as f, type Id3TagsError as g, type ImageFormat as h, type ImageInfo as i, type ImageInfoError as j, type MidiInfo as k, type MidiInfoError as l, media as m, type MidiTimeSignature as n, type MidiTrackInfo as o, type PdfMetadataError as p, type PdfOutlineDestType as q, type PdfOutlineError as r, type PdfOutlineItem as s, type PdfOutlineResult as t, type PdfPageDimension as u, type PdfPageDimensionsResult as v, type PdfPageOrientation as w, type VideoInfoError as x, type WavInfoError as y, inspectGifFrames as z };
401
+ export { type PngHeaderInfo as A, type PngPhysicalDimensions as B, type PngTextChunk as C, type VideoInfoError as D, type ExifData as E, type FlacInfo as F, type GifInfo as G, type WavInfoError as H, type IcoImageEntry as I, inspectGifFrames as J, readExifData as K, readFlacInfo as L, type MidiDivision as M, readIcoInfo as N, readId3Tags as O, type PdfMetadata as P, readImageInfo as Q, readMidiInfo as R, readPdfMetadata as S, readPdfOutline as T, readPdfPageDimensions as U, type VideoInfo as V, type WavInfo as W, readPngChunks as X, readVideoInfo as Y, readWavInfo as Z, type ExifError as a, type FlacInfoError as b, type GifInfoError as c, type IcoInfo as d, type IcoInfoError as e, type Id3Tags as f, type Id3TagsError as g, type ImageFormat as h, type ImageInfo as i, type ImageInfoError as j, type MidiInfo as k, type MidiInfoError as l, media as m, type MidiTimeSignature as n, type MidiTrackInfo as o, type PdfMetadataError as p, type PdfOutlineDestType as q, type PdfOutlineError as r, type PdfOutlineItem as s, type PdfOutlineResult as t, type PdfPageDimension as u, type PdfPageDimensionsResult as v, type PdfPageOrientation as w, type PngChunkEntry as x, type PngChunkInfo as y, type PngChunkInfoError as z };
@@ -289,6 +289,59 @@ interface MidiInfoError {
289
289
  * frames-per-second/ticks-per-frame rate instead.
290
290
  */
291
291
  declare function readMidiInfo(bytes: Uint8Array): MidiInfo | MidiInfoError;
292
+ interface PngChunkEntry {
293
+ type: string;
294
+ offset: number;
295
+ dataLength: number;
296
+ crcValid: boolean;
297
+ /** A chunk type is "critical" (decoders must understand it) when its
298
+ * first letter is uppercase, e.g. IHDR vs. an ancillary tEXt. */
299
+ critical: boolean;
300
+ }
301
+ interface PngHeaderInfo {
302
+ width: number;
303
+ height: number;
304
+ bitDepth: number;
305
+ colorType: string;
306
+ hasAlpha: boolean;
307
+ interlace: boolean;
308
+ }
309
+ interface PngTextChunk {
310
+ keyword: string;
311
+ text: string | null;
312
+ /** True for zTXt/iTXt, whose text this function does not decode. */
313
+ compressed: boolean;
314
+ }
315
+ interface PngPhysicalDimensions {
316
+ pixelsPerUnitX: number;
317
+ pixelsPerUnitY: number;
318
+ unit: 'meter' | 'unknown';
319
+ }
320
+ interface PngChunkInfo {
321
+ valid: true;
322
+ fileSize: number;
323
+ chunkCount: number;
324
+ chunks: PngChunkEntry[];
325
+ header: PngHeaderInfo | null;
326
+ textChunks: PngTextChunk[];
327
+ physicalDimensions: PngPhysicalDimensions | null;
328
+ gamma: number | null;
329
+ lastModified: string | null;
330
+ isAnimated: boolean;
331
+ }
332
+ interface PngChunkInfoError {
333
+ error: string;
334
+ }
335
+ /**
336
+ * Walk a PNG file's full chunk stream directly from its bytes: every
337
+ * chunk's type, byte offset, data length, and whether its stored CRC-32
338
+ * matches the type+data it covers, plus the decoded IHDR header and a
339
+ * handful of common ancillary chunks (tEXt, pHYs, gAMA, tIME, and acTL for
340
+ * APNG animation). No image library or pixel decoding is involved, and
341
+ * zTXt/iTXt text is listed but not zlib-inflated, so the result is
342
+ * identical in a browser tool and on a server.
343
+ */
344
+ declare function readPngChunks(bytes: Uint8Array): PngChunkInfo | PngChunkInfoError;
292
345
 
293
346
  type media_ExifData = ExifData;
294
347
  type media_ExifError = ExifError;
@@ -318,6 +371,12 @@ type media_PdfOutlineResult = PdfOutlineResult;
318
371
  type media_PdfPageDimension = PdfPageDimension;
319
372
  type media_PdfPageDimensionsResult = PdfPageDimensionsResult;
320
373
  type media_PdfPageOrientation = PdfPageOrientation;
374
+ type media_PngChunkEntry = PngChunkEntry;
375
+ type media_PngChunkInfo = PngChunkInfo;
376
+ type media_PngChunkInfoError = PngChunkInfoError;
377
+ type media_PngHeaderInfo = PngHeaderInfo;
378
+ type media_PngPhysicalDimensions = PngPhysicalDimensions;
379
+ type media_PngTextChunk = PngTextChunk;
321
380
  type media_VideoInfo = VideoInfo;
322
381
  type media_VideoInfoError = VideoInfoError;
323
382
  type media_WavInfo = WavInfo;
@@ -332,10 +391,11 @@ declare const media_readMidiInfo: typeof readMidiInfo;
332
391
  declare const media_readPdfMetadata: typeof readPdfMetadata;
333
392
  declare const media_readPdfOutline: typeof readPdfOutline;
334
393
  declare const media_readPdfPageDimensions: typeof readPdfPageDimensions;
394
+ declare const media_readPngChunks: typeof readPngChunks;
335
395
  declare const media_readVideoInfo: typeof readVideoInfo;
336
396
  declare const media_readWavInfo: typeof readWavInfo;
337
397
  declare namespace media {
338
- export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_GifInfo as GifInfo, type media_GifInfoError as GifInfoError, 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_MidiDivision as MidiDivision, type media_MidiInfo as MidiInfo, type media_MidiInfoError as MidiInfoError, type media_MidiTimeSignature as MidiTimeSignature, type media_MidiTrackInfo as MidiTrackInfo, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfOutlineDestType as PdfOutlineDestType, type media_PdfOutlineError as PdfOutlineError, type media_PdfOutlineItem as PdfOutlineItem, type media_PdfOutlineResult as PdfOutlineResult, 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_inspectGifFrames as inspectGifFrames, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readMidiInfo as readMidiInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfOutline as readPdfOutline, media_readPdfPageDimensions as readPdfPageDimensions, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
398
+ export { type media_ExifData as ExifData, type media_ExifError as ExifError, type media_FlacInfo as FlacInfo, type media_FlacInfoError as FlacInfoError, type media_GifInfo as GifInfo, type media_GifInfoError as GifInfoError, 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_MidiDivision as MidiDivision, type media_MidiInfo as MidiInfo, type media_MidiInfoError as MidiInfoError, type media_MidiTimeSignature as MidiTimeSignature, type media_MidiTrackInfo as MidiTrackInfo, type media_PdfMetadata as PdfMetadata, type media_PdfMetadataError as PdfMetadataError, type media_PdfOutlineDestType as PdfOutlineDestType, type media_PdfOutlineError as PdfOutlineError, type media_PdfOutlineItem as PdfOutlineItem, type media_PdfOutlineResult as PdfOutlineResult, type media_PdfPageDimension as PdfPageDimension, type media_PdfPageDimensionsResult as PdfPageDimensionsResult, type media_PdfPageOrientation as PdfPageOrientation, type media_PngChunkEntry as PngChunkEntry, type media_PngChunkInfo as PngChunkInfo, type media_PngChunkInfoError as PngChunkInfoError, type media_PngHeaderInfo as PngHeaderInfo, type media_PngPhysicalDimensions as PngPhysicalDimensions, type media_PngTextChunk as PngTextChunk, type media_VideoInfo as VideoInfo, type media_VideoInfoError as VideoInfoError, type media_WavInfo as WavInfo, type media_WavInfoError as WavInfoError, media_inspectGifFrames as inspectGifFrames, media_readExifData as readExifData, media_readFlacInfo as readFlacInfo, media_readIcoInfo as readIcoInfo, media_readId3Tags as readId3Tags, media_readImageInfo as readImageInfo, media_readMidiInfo as readMidiInfo, media_readPdfMetadata as readPdfMetadata, media_readPdfOutline as readPdfOutline, media_readPdfPageDimensions as readPdfPageDimensions, media_readPngChunks as readPngChunks, media_readVideoInfo as readVideoInfo, media_readWavInfo as readWavInfo };
339
399
  }
340
400
 
341
- export { readExifData as A, readFlacInfo as B, readIcoInfo as C, readId3Tags as D, type ExifData as E, type FlacInfo as F, type GifInfo as G, readImageInfo as H, type IcoImageEntry as I, readMidiInfo as J, readPdfMetadata as K, readPdfOutline as L, type MidiDivision as M, readPdfPageDimensions as N, readVideoInfo as O, type PdfMetadata as P, readWavInfo as Q, type VideoInfo as V, type WavInfo as W, type ExifError as a, type FlacInfoError as b, type GifInfoError as c, type IcoInfo as d, type IcoInfoError as e, type Id3Tags as f, type Id3TagsError as g, type ImageFormat as h, type ImageInfo as i, type ImageInfoError as j, type MidiInfo as k, type MidiInfoError as l, media as m, type MidiTimeSignature as n, type MidiTrackInfo as o, type PdfMetadataError as p, type PdfOutlineDestType as q, type PdfOutlineError as r, type PdfOutlineItem as s, type PdfOutlineResult as t, type PdfPageDimension as u, type PdfPageDimensionsResult as v, type PdfPageOrientation as w, type VideoInfoError as x, type WavInfoError as y, inspectGifFrames as z };
401
+ export { type PngHeaderInfo as A, type PngPhysicalDimensions as B, type PngTextChunk as C, type VideoInfoError as D, type ExifData as E, type FlacInfo as F, type GifInfo as G, type WavInfoError as H, type IcoImageEntry as I, inspectGifFrames as J, readExifData as K, readFlacInfo as L, type MidiDivision as M, readIcoInfo as N, readId3Tags as O, type PdfMetadata as P, readImageInfo as Q, readMidiInfo as R, readPdfMetadata as S, readPdfOutline as T, readPdfPageDimensions as U, type VideoInfo as V, type WavInfo as W, readPngChunks as X, readVideoInfo as Y, readWavInfo as Z, type ExifError as a, type FlacInfoError as b, type GifInfoError as c, type IcoInfo as d, type IcoInfoError as e, type Id3Tags as f, type Id3TagsError as g, type ImageFormat as h, type ImageInfo as i, type ImageInfoError as j, type MidiInfo as k, type MidiInfoError as l, media as m, type MidiTimeSignature as n, type MidiTrackInfo as o, type PdfMetadataError as p, type PdfOutlineDestType as q, type PdfOutlineError as r, type PdfOutlineItem as s, type PdfOutlineResult as t, type PdfPageDimension as u, type PdfPageDimensionsResult as v, type PdfPageOrientation as w, type PngChunkEntry as x, type PngChunkInfo as y, type PngChunkInfoError as z };