@utilix-tech/sdk 0.45.0 → 0.47.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/CHANGELOG.md +8 -0
- package/README.md +36 -9
- package/dist/{chunk-L6V4W4SU.js → chunk-226EH3ZI.js} +87 -1
- package/dist/{chunk-DFLHX4NW.js → chunk-KMQHBUYO.js} +55 -1
- package/dist/{chunk-F2CEN226.js → chunk-P7TXG7CI.js} +127 -1
- package/dist/{chunk-7PEKYLRB.js → chunk-S3OA5VCX.js} +50 -1
- package/dist/index.cjs +315 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{media-fD8dJ5qR.d.cts → media-BUvwm4wU.d.cts} +27 -2
- package/dist/{media-fD8dJ5qR.d.ts → media-BUvwm4wU.d.ts} +27 -2
- package/dist/{network-Bzm1tjMA.d.cts → network-BG0XDx5W.d.cts} +40 -2
- package/dist/{network-Bzm1tjMA.d.ts → network-BG0XDx5W.d.ts} +40 -2
- package/dist/{text-kHkT9VtT.d.cts → text-DWUcY8H1.d.cts} +34 -2
- package/dist/{text-kHkT9VtT.d.ts → text-DWUcY8H1.d.ts} +34 -2
- package/dist/tools/media.cjs +86 -0
- package/dist/tools/media.d.cts +1 -1
- package/dist/tools/media.d.ts +1 -1
- package/dist/tools/media.js +1 -1
- package/dist/tools/network.cjs +49 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/dist/tools/text.cjs +126 -0
- package/dist/tools/text.d.cts +1 -1
- package/dist/tools/text.d.ts +1 -1
- package/dist/tools/text.js +1 -1
- package/dist/tools/units.cjs +54 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-DWRmbS_a.d.cts → units-DU4Pisfx.d.cts} +36 -2
- package/dist/{units-DWRmbS_a.d.ts → units-DU4Pisfx.d.ts} +36 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2063,6 +2063,7 @@ __export(text_exports, {
|
|
|
2063
2063
|
LINE_OPS: () => LINE_OPS,
|
|
2064
2064
|
MORSE_CODE: () => MORSE_CODE,
|
|
2065
2065
|
addBorder: () => addBorder,
|
|
2066
|
+
analyzeKeywordDensity: () => analyzeKeywordDensity,
|
|
2066
2067
|
analyzeSentenceLengths: () => analyzeSentenceLengths,
|
|
2067
2068
|
analyzeText: () => analyzeText,
|
|
2068
2069
|
applyOp: () => applyOp,
|
|
@@ -4722,6 +4723,131 @@ function analyzeSentenceLengths(text) {
|
|
|
4722
4723
|
buckets
|
|
4723
4724
|
};
|
|
4724
4725
|
}
|
|
4726
|
+
var KEYWORD_DENSITY_STOPWORDS = /* @__PURE__ */ new Set([
|
|
4727
|
+
"a",
|
|
4728
|
+
"an",
|
|
4729
|
+
"the",
|
|
4730
|
+
"and",
|
|
4731
|
+
"or",
|
|
4732
|
+
"but",
|
|
4733
|
+
"if",
|
|
4734
|
+
"then",
|
|
4735
|
+
"else",
|
|
4736
|
+
"for",
|
|
4737
|
+
"nor",
|
|
4738
|
+
"so",
|
|
4739
|
+
"yet",
|
|
4740
|
+
"of",
|
|
4741
|
+
"in",
|
|
4742
|
+
"on",
|
|
4743
|
+
"at",
|
|
4744
|
+
"to",
|
|
4745
|
+
"from",
|
|
4746
|
+
"by",
|
|
4747
|
+
"with",
|
|
4748
|
+
"about",
|
|
4749
|
+
"against",
|
|
4750
|
+
"between",
|
|
4751
|
+
"into",
|
|
4752
|
+
"through",
|
|
4753
|
+
"during",
|
|
4754
|
+
"before",
|
|
4755
|
+
"after",
|
|
4756
|
+
"above",
|
|
4757
|
+
"below",
|
|
4758
|
+
"up",
|
|
4759
|
+
"down",
|
|
4760
|
+
"out",
|
|
4761
|
+
"off",
|
|
4762
|
+
"over",
|
|
4763
|
+
"under",
|
|
4764
|
+
"again",
|
|
4765
|
+
"further",
|
|
4766
|
+
"once",
|
|
4767
|
+
"is",
|
|
4768
|
+
"are",
|
|
4769
|
+
"was",
|
|
4770
|
+
"were",
|
|
4771
|
+
"be",
|
|
4772
|
+
"been",
|
|
4773
|
+
"being",
|
|
4774
|
+
"am",
|
|
4775
|
+
"do",
|
|
4776
|
+
"does",
|
|
4777
|
+
"did",
|
|
4778
|
+
"doing",
|
|
4779
|
+
"have",
|
|
4780
|
+
"has",
|
|
4781
|
+
"had",
|
|
4782
|
+
"having",
|
|
4783
|
+
"i",
|
|
4784
|
+
"me",
|
|
4785
|
+
"my",
|
|
4786
|
+
"we",
|
|
4787
|
+
"our",
|
|
4788
|
+
"you",
|
|
4789
|
+
"your",
|
|
4790
|
+
"he",
|
|
4791
|
+
"him",
|
|
4792
|
+
"his",
|
|
4793
|
+
"she",
|
|
4794
|
+
"her",
|
|
4795
|
+
"it",
|
|
4796
|
+
"its",
|
|
4797
|
+
"they",
|
|
4798
|
+
"them",
|
|
4799
|
+
"their",
|
|
4800
|
+
"this",
|
|
4801
|
+
"that",
|
|
4802
|
+
"these",
|
|
4803
|
+
"those",
|
|
4804
|
+
"as",
|
|
4805
|
+
"not",
|
|
4806
|
+
"no",
|
|
4807
|
+
"can",
|
|
4808
|
+
"will",
|
|
4809
|
+
"just",
|
|
4810
|
+
"than",
|
|
4811
|
+
"too",
|
|
4812
|
+
"very",
|
|
4813
|
+
"would",
|
|
4814
|
+
"should",
|
|
4815
|
+
"could",
|
|
4816
|
+
"there",
|
|
4817
|
+
"here",
|
|
4818
|
+
"what",
|
|
4819
|
+
"which",
|
|
4820
|
+
"who",
|
|
4821
|
+
"whom"
|
|
4822
|
+
]);
|
|
4823
|
+
function analyzeKeywordDensity(text, options = {}) {
|
|
4824
|
+
if (!text || !text.trim()) return { error: "Input text is empty" };
|
|
4825
|
+
const topN = options.topN ?? 10;
|
|
4826
|
+
const minWordLength = options.minWordLength ?? 3;
|
|
4827
|
+
const ngramSize = options.ngramSize ?? 1;
|
|
4828
|
+
if (!Number.isInteger(topN) || topN <= 0) return { error: "topN must be a positive whole number" };
|
|
4829
|
+
if (!Number.isInteger(minWordLength) || minWordLength < 1) return { error: "minWordLength must be a positive whole number" };
|
|
4830
|
+
if (!Number.isInteger(ngramSize) || ngramSize < 1 || ngramSize > 3) return { error: "ngramSize must be 1, 2, or 3" };
|
|
4831
|
+
const tokens = text.toLowerCase().match(/[a-z0-9']+/g) ?? [];
|
|
4832
|
+
const totalWords = tokens.length;
|
|
4833
|
+
if (totalWords === 0) return { error: "No words found in input text" };
|
|
4834
|
+
if (totalWords < ngramSize) return { error: "Input text has fewer words than the requested phrase length" };
|
|
4835
|
+
const counts = /* @__PURE__ */ new Map();
|
|
4836
|
+
for (let i = 0; i <= tokens.length - ngramSize; i++) {
|
|
4837
|
+
const phraseWords = tokens.slice(i, i + ngramSize);
|
|
4838
|
+
if (phraseWords.some((w) => w.length < minWordLength)) continue;
|
|
4839
|
+
if (ngramSize === 1 && KEYWORD_DENSITY_STOPWORDS.has(phraseWords[0])) continue;
|
|
4840
|
+
const phrase = phraseWords.join(" ");
|
|
4841
|
+
counts.set(phrase, (counts.get(phrase) ?? 0) + 1);
|
|
4842
|
+
}
|
|
4843
|
+
const keywords = Array.from(counts.entries()).map(([keyword, count]) => ({ keyword, count, density: Math.round(count / totalWords * 1e3) / 10 })).sort((a, b) => b.count - a.count || a.keyword.localeCompare(b.keyword)).slice(0, topN);
|
|
4844
|
+
return {
|
|
4845
|
+
totalWords,
|
|
4846
|
+
uniqueKeywords: counts.size,
|
|
4847
|
+
ngramSize,
|
|
4848
|
+
keywords
|
|
4849
|
+
};
|
|
4850
|
+
}
|
|
4725
4851
|
var EMOJI_TABLE = [
|
|
4726
4852
|
{ emoji: "\u{1F600}", name: "grinning face", shortcode: "grinning", codepoint: "U+1F600", category: "Smileys & Emotion", keywords: ["happy", "smile"] },
|
|
4727
4853
|
{ emoji: "\u{1F603}", name: "grinning face with big eyes", shortcode: "smiley", codepoint: "U+1F603", category: "Smileys & Emotion", keywords: ["happy", "joy"] },
|
|
@@ -8002,6 +8128,7 @@ __export(units_exports, {
|
|
|
8002
8128
|
calculateCdMaturity: () => calculateCdMaturity,
|
|
8003
8129
|
calculateChange: () => calculateChange,
|
|
8004
8130
|
calculateCompoundInterest: () => calculateCompoundInterest,
|
|
8131
|
+
calculateDepreciationSchedule: () => calculateDepreciationSchedule,
|
|
8005
8132
|
calculateDiscount: () => calculateDiscount,
|
|
8006
8133
|
calculateEmi: () => calculateEmi,
|
|
8007
8134
|
calculateLoan: () => calculateLoan,
|
|
@@ -9999,6 +10126,59 @@ function calculateCdMaturity(principal, annualRatePercent, termMonths, compounds
|
|
|
9999
10126
|
}
|
|
10000
10127
|
return result;
|
|
10001
10128
|
}
|
|
10129
|
+
var DEPRECIATION_METHODS = ["straight-line", "double-declining-balance", "sum-of-years-digits"];
|
|
10130
|
+
function calculateDepreciationSchedule(cost, salvageValue, usefulLifeYears, method) {
|
|
10131
|
+
if (!Number.isFinite(cost) || cost <= 0) return { error: "Cost must be a positive number" };
|
|
10132
|
+
if (!Number.isFinite(salvageValue) || salvageValue < 0) {
|
|
10133
|
+
return { error: "Salvage value must be zero or a positive number" };
|
|
10134
|
+
}
|
|
10135
|
+
if (salvageValue >= cost) return { error: "Salvage value must be less than cost" };
|
|
10136
|
+
if (!Number.isInteger(usefulLifeYears) || usefulLifeYears <= 0) {
|
|
10137
|
+
return { error: "Useful life must be a positive whole number of years" };
|
|
10138
|
+
}
|
|
10139
|
+
if (!DEPRECIATION_METHODS.includes(method)) {
|
|
10140
|
+
return { error: `Method must be one of: ${DEPRECIATION_METHODS.join(", ")}` };
|
|
10141
|
+
}
|
|
10142
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
10143
|
+
const depreciableBase = round23(cost - salvageValue);
|
|
10144
|
+
const schedule = [];
|
|
10145
|
+
let accumulated = 0;
|
|
10146
|
+
if (method === "straight-line") {
|
|
10147
|
+
const annual = round23(depreciableBase / usefulLifeYears);
|
|
10148
|
+
for (let year = 1; year <= usefulLifeYears; year++) {
|
|
10149
|
+
const expense = year === usefulLifeYears ? round23(depreciableBase - accumulated) : annual;
|
|
10150
|
+
accumulated = round23(accumulated + expense);
|
|
10151
|
+
schedule.push({ year, depreciationExpense: expense, accumulatedDepreciation: accumulated, bookValue: round23(cost - accumulated) });
|
|
10152
|
+
}
|
|
10153
|
+
} else if (method === "double-declining-balance") {
|
|
10154
|
+
const rate = 2 / usefulLifeYears;
|
|
10155
|
+
let bookValue = cost;
|
|
10156
|
+
for (let year = 1; year <= usefulLifeYears; year++) {
|
|
10157
|
+
let expense = round23(bookValue * rate);
|
|
10158
|
+
if (bookValue - expense < salvageValue) expense = round23(bookValue - salvageValue);
|
|
10159
|
+
if (expense < 0) expense = 0;
|
|
10160
|
+
bookValue = round23(bookValue - expense);
|
|
10161
|
+
accumulated = round23(accumulated + expense);
|
|
10162
|
+
schedule.push({ year, depreciationExpense: expense, accumulatedDepreciation: accumulated, bookValue });
|
|
10163
|
+
}
|
|
10164
|
+
} else {
|
|
10165
|
+
const sumOfYears = usefulLifeYears * (usefulLifeYears + 1) / 2;
|
|
10166
|
+
for (let year = 1; year <= usefulLifeYears; year++) {
|
|
10167
|
+
const fraction = (usefulLifeYears - year + 1) / sumOfYears;
|
|
10168
|
+
const expense = year === usefulLifeYears ? round23(depreciableBase - accumulated) : round23(fraction * depreciableBase);
|
|
10169
|
+
accumulated = round23(accumulated + expense);
|
|
10170
|
+
schedule.push({ year, depreciationExpense: expense, accumulatedDepreciation: accumulated, bookValue: round23(cost - accumulated) });
|
|
10171
|
+
}
|
|
10172
|
+
}
|
|
10173
|
+
return {
|
|
10174
|
+
cost,
|
|
10175
|
+
salvageValue,
|
|
10176
|
+
usefulLifeYears,
|
|
10177
|
+
method,
|
|
10178
|
+
totalDepreciation: accumulated,
|
|
10179
|
+
schedule
|
|
10180
|
+
};
|
|
10181
|
+
}
|
|
10002
10182
|
|
|
10003
10183
|
// src/tools/network.ts
|
|
10004
10184
|
var network_exports = {};
|
|
@@ -10013,6 +10193,7 @@ __export(network_exports, {
|
|
|
10013
10193
|
analyzeEmailHeaders: () => analyzeEmailHeaders,
|
|
10014
10194
|
buildCacheControl: () => buildCacheControl,
|
|
10015
10195
|
buildClientHints: () => buildClientHints,
|
|
10196
|
+
buildContentDisposition: () => buildContentDisposition,
|
|
10016
10197
|
buildDnsQueryUrl: () => buildDnsQueryUrl,
|
|
10017
10198
|
buildGeoUrl: () => buildGeoUrl,
|
|
10018
10199
|
buildLinkHeader: () => buildLinkHeader,
|
|
@@ -10037,6 +10218,7 @@ __export(network_exports, {
|
|
|
10037
10218
|
isValidIpv4: () => isValidIpv42,
|
|
10038
10219
|
isValidIpv6: () => isValidIpv6,
|
|
10039
10220
|
parseClientHintHeaders: () => parseClientHintHeaders,
|
|
10221
|
+
parseContentDisposition: () => parseContentDisposition,
|
|
10040
10222
|
parseContentRangeHeader: () => parseContentRangeHeader,
|
|
10041
10223
|
parseDnsResponse: () => parseDnsResponse,
|
|
10042
10224
|
parseGeoResponse: () => parseGeoResponse,
|
|
@@ -12678,6 +12860,53 @@ function parseClientHintHeaders(rawHeaders) {
|
|
|
12678
12860
|
}
|
|
12679
12861
|
return { hints, unrecognized };
|
|
12680
12862
|
}
|
|
12863
|
+
function encodeRFC5987ValueChars(value) {
|
|
12864
|
+
return encodeURIComponent(value).replace(/[!'()*]/g, (c) => "%" + c.charCodeAt(0).toString(16).toUpperCase());
|
|
12865
|
+
}
|
|
12866
|
+
function buildContentDisposition(options = {}) {
|
|
12867
|
+
const type = options.type ?? "attachment";
|
|
12868
|
+
if (type !== "inline" && type !== "attachment") return { error: 'type must be "inline" or "attachment"' };
|
|
12869
|
+
if (!options.filename) return { header: type, type, filenameEncoded: false };
|
|
12870
|
+
const filename = options.filename;
|
|
12871
|
+
if (filename.includes("/") || filename.includes("\\")) return { error: "filename must not contain path separators" };
|
|
12872
|
+
const isAscii = /^[\x20-\x7e]*$/.test(filename);
|
|
12873
|
+
const asciiFallback = filename.replace(/[^\x20-\x7e]/g, "_").replace(/(["\\])/g, "\\$1");
|
|
12874
|
+
let header = `${type}; filename="${asciiFallback}"`;
|
|
12875
|
+
let filenameEncoded = false;
|
|
12876
|
+
if (!isAscii) {
|
|
12877
|
+
header += `; filename*=UTF-8''${encodeRFC5987ValueChars(filename)}`;
|
|
12878
|
+
filenameEncoded = true;
|
|
12879
|
+
}
|
|
12880
|
+
return { header, type, filename, filenameEncoded };
|
|
12881
|
+
}
|
|
12882
|
+
function parseContentDisposition(header) {
|
|
12883
|
+
if (typeof header !== "string" || header.trim() === "") return { error: "header is required" };
|
|
12884
|
+
const parts = header.split(";").map((p) => p.trim()).filter(Boolean);
|
|
12885
|
+
const type = parts[0]?.toLowerCase();
|
|
12886
|
+
if (!type) return { error: "Could not parse a disposition type from the header" };
|
|
12887
|
+
const params = {};
|
|
12888
|
+
for (let i = 1; i < parts.length; i++) {
|
|
12889
|
+
const eq = parts[i].indexOf("=");
|
|
12890
|
+
if (eq === -1) continue;
|
|
12891
|
+
const key = parts[i].slice(0, eq).trim().toLowerCase();
|
|
12892
|
+
let value = parts[i].slice(eq + 1).trim();
|
|
12893
|
+
if (value.startsWith('"') && value.endsWith('"')) value = value.slice(1, -1).replace(/\\(.)/g, "$1");
|
|
12894
|
+
params[key] = value;
|
|
12895
|
+
}
|
|
12896
|
+
let filename = params.filename;
|
|
12897
|
+
let filenameIsExtended = false;
|
|
12898
|
+
if (params["filename*"]) {
|
|
12899
|
+
const match = params["filename*"].match(/^([^']*)'([^']*)'(.*)$/);
|
|
12900
|
+
if (match) {
|
|
12901
|
+
try {
|
|
12902
|
+
filename = decodeURIComponent(match[3]);
|
|
12903
|
+
filenameIsExtended = true;
|
|
12904
|
+
} catch {
|
|
12905
|
+
}
|
|
12906
|
+
}
|
|
12907
|
+
}
|
|
12908
|
+
return { type, filename, filenameIsExtended, params };
|
|
12909
|
+
}
|
|
12681
12910
|
|
|
12682
12911
|
// src/tools/api.ts
|
|
12683
12912
|
var api_exports = {};
|
|
@@ -21626,6 +21855,7 @@ function lintToolSchema(jsonText) {
|
|
|
21626
21855
|
// src/tools/media.ts
|
|
21627
21856
|
var media_exports = {};
|
|
21628
21857
|
__export(media_exports, {
|
|
21858
|
+
inspectGifFrames: () => inspectGifFrames,
|
|
21629
21859
|
readExifData: () => readExifData,
|
|
21630
21860
|
readFlacInfo: () => readFlacInfo,
|
|
21631
21861
|
readIcoInfo: () => readIcoInfo,
|
|
@@ -22843,6 +23073,91 @@ function parseWebm(bytes) {
|
|
|
22843
23073
|
}
|
|
22844
23074
|
return result;
|
|
22845
23075
|
}
|
|
23076
|
+
function skipGifSubBlocks(bytes, offset) {
|
|
23077
|
+
while (offset < bytes.length) {
|
|
23078
|
+
const len = bytes[offset];
|
|
23079
|
+
offset += 1;
|
|
23080
|
+
if (len === 0) break;
|
|
23081
|
+
offset += len;
|
|
23082
|
+
}
|
|
23083
|
+
return offset;
|
|
23084
|
+
}
|
|
23085
|
+
function inspectGifFrames(bytes) {
|
|
23086
|
+
if (bytes.length < 13) return { error: "File too small to be a valid GIF file" };
|
|
23087
|
+
const signature = Buffer.from(bytes.subarray(0, 6)).toString("ascii");
|
|
23088
|
+
if (signature !== "GIF87a" && signature !== "GIF89a") return { error: "Not a valid GIF file (missing GIF87a/GIF89a signature)" };
|
|
23089
|
+
const version2 = signature.slice(3);
|
|
23090
|
+
const width = readU16LE(bytes, 6);
|
|
23091
|
+
const height = readU16LE(bytes, 8);
|
|
23092
|
+
const packed = bytes[10];
|
|
23093
|
+
const hasGlobalColorTable = (packed & 128) !== 0;
|
|
23094
|
+
const globalColorTableSize = hasGlobalColorTable ? 2 << (packed & 7) : 0;
|
|
23095
|
+
let offset = 13;
|
|
23096
|
+
if (hasGlobalColorTable) offset += globalColorTableSize * 3;
|
|
23097
|
+
let frameCount = 0;
|
|
23098
|
+
let loopCount = null;
|
|
23099
|
+
let totalDurationMs = 0;
|
|
23100
|
+
let hasTransparency = false;
|
|
23101
|
+
let pendingDelay = 0;
|
|
23102
|
+
while (offset < bytes.length) {
|
|
23103
|
+
const blockType = bytes[offset];
|
|
23104
|
+
if (blockType === 59) break;
|
|
23105
|
+
if (blockType === 33) {
|
|
23106
|
+
const label = bytes[offset + 1];
|
|
23107
|
+
offset += 2;
|
|
23108
|
+
if (label === 249) {
|
|
23109
|
+
const subLen = bytes[offset] ?? 0;
|
|
23110
|
+
if (subLen >= 4) {
|
|
23111
|
+
const flags = bytes[offset + 1];
|
|
23112
|
+
pendingDelay = readU16LE(bytes, offset + 2);
|
|
23113
|
+
if (flags & 1) hasTransparency = true;
|
|
23114
|
+
}
|
|
23115
|
+
offset += 1 + subLen;
|
|
23116
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23117
|
+
} else if (label === 255) {
|
|
23118
|
+
const blockSize = bytes[offset] ?? 0;
|
|
23119
|
+
const appId = Buffer.from(bytes.subarray(offset + 1, offset + 1 + Math.min(blockSize, 11))).toString("ascii");
|
|
23120
|
+
offset += 1 + blockSize;
|
|
23121
|
+
if (appId === "NETSCAPE2.0") {
|
|
23122
|
+
const subLen = bytes[offset] ?? 0;
|
|
23123
|
+
if (subLen >= 3 && bytes[offset + 1] === 1) {
|
|
23124
|
+
loopCount = readU16LE(bytes, offset + 2);
|
|
23125
|
+
}
|
|
23126
|
+
}
|
|
23127
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23128
|
+
} else {
|
|
23129
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23130
|
+
}
|
|
23131
|
+
} else if (blockType === 44) {
|
|
23132
|
+
if (offset + 10 > bytes.length) return { error: "Truncated image descriptor" };
|
|
23133
|
+
frameCount++;
|
|
23134
|
+
totalDurationMs += pendingDelay * 10;
|
|
23135
|
+
pendingDelay = 0;
|
|
23136
|
+
const packedImg = bytes[offset + 9];
|
|
23137
|
+
const hasLocalColorTable = (packedImg & 128) !== 0;
|
|
23138
|
+
const localColorTableSize = hasLocalColorTable ? 2 << (packedImg & 7) : 0;
|
|
23139
|
+
offset += 10;
|
|
23140
|
+
if (hasLocalColorTable) offset += localColorTableSize * 3;
|
|
23141
|
+
offset += 1;
|
|
23142
|
+
offset = skipGifSubBlocks(bytes, offset);
|
|
23143
|
+
} else {
|
|
23144
|
+
break;
|
|
23145
|
+
}
|
|
23146
|
+
}
|
|
23147
|
+
if (frameCount === 0) return { error: "No image data blocks found in this GIF file" };
|
|
23148
|
+
return {
|
|
23149
|
+
version: version2,
|
|
23150
|
+
width,
|
|
23151
|
+
height,
|
|
23152
|
+
frameCount,
|
|
23153
|
+
animated: frameCount > 1,
|
|
23154
|
+
loopCount,
|
|
23155
|
+
totalDurationMs,
|
|
23156
|
+
hasGlobalColorTable,
|
|
23157
|
+
globalColorTableSize,
|
|
23158
|
+
hasTransparency
|
|
23159
|
+
};
|
|
23160
|
+
}
|
|
22846
23161
|
|
|
22847
23162
|
// src/index.ts
|
|
22848
23163
|
var version = "0.1.0";
|
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.cjs';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.cjs';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-DWUcY8H1.cjs';
|
|
5
5
|
export { d as data } from './data-BKpEOcOX.cjs';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
9
|
-
export { n as network } from './network-
|
|
8
|
+
export { u as units } from './units-DU4Pisfx.cjs';
|
|
9
|
+
export { n as network } from './network-BG0XDx5W.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.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-CmrVjvYH.cjs';
|
|
16
|
-
export { m as media } from './media-
|
|
16
|
+
export { m as media } from './media-BUvwm4wU.cjs';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
|
19
19
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.js';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.js';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-DWUcY8H1.js';
|
|
5
5
|
export { d as data } from './data-BKpEOcOX.js';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
|
-
export { u as units } from './units-
|
|
9
|
-
export { n as network } from './network-
|
|
8
|
+
export { u as units } from './units-DU4Pisfx.js';
|
|
9
|
+
export { n as network } from './network-BG0XDx5W.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.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-CmrVjvYH.js';
|
|
16
|
-
export { m as media } from './media-
|
|
16
|
+
export { m as media } from './media-BUvwm4wU.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-
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
1
|
+
export { media_exports as media } from './chunk-226EH3ZI.js';
|
|
2
|
+
export { units_exports as units } from './chunk-KMQHBUYO.js';
|
|
3
|
+
export { network_exports as network } from './chunk-S3OA5VCX.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
5
|
export { code_exports as code } from './chunk-JL7YTXRB.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
@@ -10,7 +10,7 @@ export { ai_agent_exports as ai_agent } from './chunk-EKIXOA7B.js';
|
|
|
10
10
|
export { json_exports as json } from './chunk-WVEKRKGU.js';
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
|
|
13
|
-
export { text_exports as text } from './chunk-
|
|
13
|
+
export { text_exports as text } from './chunk-P7TXG7CI.js';
|
|
14
14
|
export { data_exports as data } from './chunk-JR354NH4.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-3TYWIX3B.js';
|
|
16
16
|
export { time_exports as time } from './chunk-IEPWZERQ.js';
|
|
@@ -202,11 +202,35 @@ interface VideoInfoError {
|
|
|
202
202
|
* only the moov box (MP4) or Segment/Info/Tracks elements (WebM) are read.
|
|
203
203
|
*/
|
|
204
204
|
declare function readVideoInfo(bytes: Uint8Array): VideoInfo | VideoInfoError;
|
|
205
|
+
interface GifInfo {
|
|
206
|
+
version: '87a' | '89a';
|
|
207
|
+
width: number;
|
|
208
|
+
height: number;
|
|
209
|
+
frameCount: number;
|
|
210
|
+
animated: boolean;
|
|
211
|
+
loopCount: number | null;
|
|
212
|
+
totalDurationMs: number;
|
|
213
|
+
hasGlobalColorTable: boolean;
|
|
214
|
+
globalColorTableSize: number;
|
|
215
|
+
hasTransparency: boolean;
|
|
216
|
+
}
|
|
217
|
+
interface GifInfoError {
|
|
218
|
+
error: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Walk a GIF87a/89a file's block structure (image descriptors, graphic
|
|
222
|
+
* control extensions, the NETSCAPE2.0 application extension) to report
|
|
223
|
+
* frame count, total animation duration, and loop count, without decoding
|
|
224
|
+
* any LZW-compressed pixel data.
|
|
225
|
+
*/
|
|
226
|
+
declare function inspectGifFrames(bytes: Uint8Array): GifInfo | GifInfoError;
|
|
205
227
|
|
|
206
228
|
type media_ExifData = ExifData;
|
|
207
229
|
type media_ExifError = ExifError;
|
|
208
230
|
type media_FlacInfo = FlacInfo;
|
|
209
231
|
type media_FlacInfoError = FlacInfoError;
|
|
232
|
+
type media_GifInfo = GifInfo;
|
|
233
|
+
type media_GifInfoError = GifInfoError;
|
|
210
234
|
type media_IcoImageEntry = IcoImageEntry;
|
|
211
235
|
type media_IcoInfo = IcoInfo;
|
|
212
236
|
type media_IcoInfoError = IcoInfoError;
|
|
@@ -224,6 +248,7 @@ type media_VideoInfo = VideoInfo;
|
|
|
224
248
|
type media_VideoInfoError = VideoInfoError;
|
|
225
249
|
type media_WavInfo = WavInfo;
|
|
226
250
|
type media_WavInfoError = WavInfoError;
|
|
251
|
+
declare const media_inspectGifFrames: typeof inspectGifFrames;
|
|
227
252
|
declare const media_readExifData: typeof readExifData;
|
|
228
253
|
declare const media_readFlacInfo: typeof readFlacInfo;
|
|
229
254
|
declare const media_readIcoInfo: typeof readIcoInfo;
|
|
@@ -234,7 +259,7 @@ declare const media_readPdfPageDimensions: typeof readPdfPageDimensions;
|
|
|
234
259
|
declare const media_readVideoInfo: typeof readVideoInfo;
|
|
235
260
|
declare const media_readWavInfo: typeof readWavInfo;
|
|
236
261
|
declare namespace media {
|
|
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 };
|
|
262
|
+
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_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_inspectGifFrames as inspectGifFrames, 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 };
|
|
238
263
|
}
|
|
239
264
|
|
|
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
|
|
265
|
+
export { readWavInfo as A, type ExifData as E, type FlacInfo as F, type GifInfo as G, 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 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 PdfMetadataError as k, type PdfPageDimension as l, media as m, type PdfPageDimensionsResult as n, type PdfPageOrientation as o, type VideoInfoError as p, type WavInfoError as q, inspectGifFrames as r, readExifData as s, readFlacInfo as t, readIcoInfo as u, readId3Tags as v, readImageInfo as w, readPdfMetadata as x, readPdfPageDimensions as y, readVideoInfo as z };
|
|
@@ -202,11 +202,35 @@ interface VideoInfoError {
|
|
|
202
202
|
* only the moov box (MP4) or Segment/Info/Tracks elements (WebM) are read.
|
|
203
203
|
*/
|
|
204
204
|
declare function readVideoInfo(bytes: Uint8Array): VideoInfo | VideoInfoError;
|
|
205
|
+
interface GifInfo {
|
|
206
|
+
version: '87a' | '89a';
|
|
207
|
+
width: number;
|
|
208
|
+
height: number;
|
|
209
|
+
frameCount: number;
|
|
210
|
+
animated: boolean;
|
|
211
|
+
loopCount: number | null;
|
|
212
|
+
totalDurationMs: number;
|
|
213
|
+
hasGlobalColorTable: boolean;
|
|
214
|
+
globalColorTableSize: number;
|
|
215
|
+
hasTransparency: boolean;
|
|
216
|
+
}
|
|
217
|
+
interface GifInfoError {
|
|
218
|
+
error: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Walk a GIF87a/89a file's block structure (image descriptors, graphic
|
|
222
|
+
* control extensions, the NETSCAPE2.0 application extension) to report
|
|
223
|
+
* frame count, total animation duration, and loop count, without decoding
|
|
224
|
+
* any LZW-compressed pixel data.
|
|
225
|
+
*/
|
|
226
|
+
declare function inspectGifFrames(bytes: Uint8Array): GifInfo | GifInfoError;
|
|
205
227
|
|
|
206
228
|
type media_ExifData = ExifData;
|
|
207
229
|
type media_ExifError = ExifError;
|
|
208
230
|
type media_FlacInfo = FlacInfo;
|
|
209
231
|
type media_FlacInfoError = FlacInfoError;
|
|
232
|
+
type media_GifInfo = GifInfo;
|
|
233
|
+
type media_GifInfoError = GifInfoError;
|
|
210
234
|
type media_IcoImageEntry = IcoImageEntry;
|
|
211
235
|
type media_IcoInfo = IcoInfo;
|
|
212
236
|
type media_IcoInfoError = IcoInfoError;
|
|
@@ -224,6 +248,7 @@ type media_VideoInfo = VideoInfo;
|
|
|
224
248
|
type media_VideoInfoError = VideoInfoError;
|
|
225
249
|
type media_WavInfo = WavInfo;
|
|
226
250
|
type media_WavInfoError = WavInfoError;
|
|
251
|
+
declare const media_inspectGifFrames: typeof inspectGifFrames;
|
|
227
252
|
declare const media_readExifData: typeof readExifData;
|
|
228
253
|
declare const media_readFlacInfo: typeof readFlacInfo;
|
|
229
254
|
declare const media_readIcoInfo: typeof readIcoInfo;
|
|
@@ -234,7 +259,7 @@ declare const media_readPdfPageDimensions: typeof readPdfPageDimensions;
|
|
|
234
259
|
declare const media_readVideoInfo: typeof readVideoInfo;
|
|
235
260
|
declare const media_readWavInfo: typeof readWavInfo;
|
|
236
261
|
declare namespace media {
|
|
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 };
|
|
262
|
+
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_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_inspectGifFrames as inspectGifFrames, 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 };
|
|
238
263
|
}
|
|
239
264
|
|
|
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
|
|
265
|
+
export { readWavInfo as A, type ExifData as E, type FlacInfo as F, type GifInfo as G, 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 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 PdfMetadataError as k, type PdfPageDimension as l, media as m, type PdfPageDimensionsResult as n, type PdfPageOrientation as o, type VideoInfoError as p, type WavInfoError as q, inspectGifFrames as r, readExifData as s, readFlacInfo as t, readIcoInfo as u, readId3Tags as v, readImageInfo as w, readPdfMetadata as x, readPdfPageDimensions as y, readVideoInfo as z };
|