@poe-platform/safe-bash 0.1.781 → 0.1.783
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/README.md +40 -0
- package/dist/office-package/zip-sync.d.ts +2 -0
- package/dist/office-package/zip-sync.js +111 -0
- package/dist/safe-bash/chunks/chunk-4FDQJUFW.js +3464 -0
- package/dist/safe-bash/chunks/csvkit-K55OYAQC.js +1564 -0
- package/dist/safe-bash/chunks/ffmpeg-BEFTQ6DZ.js +60 -0
- package/dist/safe-bash/chunks/gh-HQWOWLWE.js +41 -0
- package/dist/safe-bash/chunks/git-UFNPAOYZ.js +52 -0
- package/dist/safe-bash/chunks/imagemagick-53BMHH6D.js +134 -0
- package/dist/safe-bash/chunks/implementation-QUTAAYMT.js +105 -0
- package/dist/safe-bash/chunks/pdfimages-4OYI6FLG.js +73 -0
- package/dist/safe-bash/chunks/pdfinfo-I7U6TQPP.js +153 -0
- package/dist/safe-bash/chunks/pdftk-SUA6FMHI.js +79 -0
- package/dist/safe-bash/chunks/pdftoppm-4C5DGEWX.js +139 -0
- package/dist/safe-bash/chunks/pdftotext-Y4WI225Y.js +118 -0
- package/dist/safe-bash/chunks/qpdf-IORB4RV5.js +68 -0
- package/dist/safe-bash/chunks/sips-WHAMJFEU.js +77 -0
- package/dist/safe-bash/chunks/soffice-SYEK6WJS.js +89 -0
- package/dist/safe-bash/chunks/wkhtmltopdf-ZIICWJLF.js +85 -0
- package/dist/safe-bash/command-chunks/chunk-2LP3VMPA.js +58 -0
- package/dist/safe-bash/command-chunks/{chunk-CG4JSOK2.js → chunk-3HDIDEUJ.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-4DSJDVBM.js +2897 -0
- package/dist/safe-bash/command-chunks/{chunk-GBHSE6ZO.js → chunk-5GRLAARV.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-7OKDCM5U.js +112 -0
- package/dist/safe-bash/command-chunks/{chunk-FH3D75FC.js → chunk-ADCGH6A7.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-MTKXVRXL.js → chunk-DREUDEQG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ADBFNLLK.js → chunk-FXYWQ6S4.js} +16 -14
- package/dist/safe-bash/command-chunks/{chunk-Y2KHC6TZ.js → chunk-IDKD76KR.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-K6KBYLQC.js → chunk-JUDOV5MJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3ZK5F23O.js → chunk-L3MLMXL4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-E5TEVROY.js → chunk-PFBJR2PY.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-YGYOVXTO.js → chunk-UUR2S7AD.js} +9 -5
- package/dist/safe-bash/command-chunks/chunk-VIVYKW7Q.js +101 -0
- package/dist/safe-bash/command-chunks/{chunk-I5GLTNVH.js → chunk-X4P42NYK.js} +2 -27
- package/dist/safe-bash/command-chunks/{chunk-XF6TXYLD.js → chunk-Z57TV6TC.js} +4 -54
- package/dist/safe-bash/command-chunks/{chunk-QDPRSPHQ.js → chunk-Z64BW7CG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-X3IVPNC3.js → chunk-Z7TYZG3A.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-GZXLPWT5.js → chunk-ZF3ZVGQC.js} +259 -258
- package/dist/safe-bash/command-chunks/{pptx-ZL6L7KP2-QVZEYFUV.js → pptx-KY2OJWZW-76LBHCHD.js} +4 -3
- package/dist/safe-bash/commands/csvkit/index.d.ts +1 -8
- package/dist/safe-bash/commands/csvkit/index.js +5 -1639
- package/dist/safe-bash/commands/csvkit/sync.d.ts +9 -0
- package/dist/safe-bash/commands/csvkit/sync.js +1639 -0
- package/dist/safe-bash/commands/pandoc/implementation.d.ts +8 -0
- package/dist/safe-bash/commands/pandoc/implementation.js +92 -0
- package/dist/safe-bash/commands/pandoc/index.d.ts +2 -6
- package/dist/safe-bash/commands/pandoc/index.js +2 -90
- package/dist/safe-bash/core.browser.js +808 -6271
- package/dist/safe-bash/core.d.ts +17 -16
- package/dist/safe-bash/core.js +17 -16
- package/dist/safe-bash/lazy-gh.d.ts +10 -0
- package/dist/safe-bash/lazy-gh.js +30 -0
- package/dist/safe-bash/lazy-optional.d.ts +499 -0
- package/dist/safe-bash/lazy-optional.js +609 -0
- package/dist/safe-bash/plugins/composition.d.ts +1 -1
- package/dist/safe-bash/plugins/composition.js +1 -1
- package/dist/safe-bash/plugins/lazy-command.d.ts +9 -0
- package/dist/safe-bash/plugins/lazy-command.js +57 -0
- package/dist/safe-bash/shell/runtime.js +24 -25
- package/dist/safe-bash-command-csvkit/cli/lexical.d.ts +3 -0
- package/dist/safe-bash-command-csvkit/cli/parser.d.ts +1 -2
- package/dist/safe-bash-command-csvkit/codecs/python.js +3 -2
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +2 -1
- package/dist/safe-bash-command-csvkit/index.js +453 -3270
- package/dist/safe-bash-command-csvkit/sync-support.d.ts +7 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +31 -0
- package/dist/safe-bash-command-gh/index.js +25 -17
- package/dist/safe-bash-command-git/index.js +6 -10
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/citeproc-filters.js +4 -2
- package/dist/safe-bash-command-pandoc/command.js +8 -6
- package/dist/safe-bash-command-pandoc/index.js +8 -6
- package/dist/safe-bash-command-pandoc/lua-filters.js +3 -2
- package/dist/safe-bash-command-pandoc/options.d.ts +5 -0
- package/dist/safe-bash-command-pandoc/options.js +93 -0
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.d.ts +1 -2
- package/dist/safe-bash-command-soffice/index.js +22 -18
- package/dist/safe-bash-command-ssconvert/commands.js +2 -2
- package/dist/safe-bash-command-ssconvert/core.js +2 -2
- package/dist/safe-bash-command-ssconvert/formats/csv.js +2 -2
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-ssconvert/formats/xlsx.js +3 -3
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-yq/index.js +5 -5
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +7 -7
- package/dist/safe-bash-compression-engine/index.js +6 -6
- package/dist/safe-bash-compression-engine/operand.js +7 -7
- package/dist/safe-bash-compression-engine/stream.js +6 -6
- package/dist/safe-bash-compression-engine/zstd-decode.js +5 -5
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
- package/dist/safe-bash-contracts/filesystem-output.js +10 -10
- package/dist/safe-bash-contracts/index.js +40 -40
- package/dist/safe-bash-io-engine/commands/search/requirements.js +4 -4
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +4 -4
- package/dist/safe-bash-io-engine/internal.d.ts +9 -0
- package/dist/safe-bash-io-engine/internal.js +3 -3
- package/dist/safe-bash-query-engine/index.js +6 -6
- package/dist/safe-bash-query-engine/interpreter.js +5 -5
- package/dist/safe-bash-query-engine/query-core.js +6 -6
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +3 -3
- package/dist/safe-bash-regex-engine/index.js +2 -2
- package/dist/safe-bash-regex-engine/text/regex.js +2 -2
- package/dist/safe-bash-xml-engine/index.js +3 -3
- package/package.json +4 -4
- package/dist/safe-bash/command-chunks/{chunk-DC52GWRK.js → chunk-BUKYQBXO.js} +13 -13
- package/dist/safe-bash/command-chunks/{chunk-QJ3ONEBI.js → chunk-DEH3CMGL.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-Y64PA6IA.js → chunk-KHZZ4V3L.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-I7PKIGII.js → chunk-QIRUOY2W.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-HQG2IBZL.js → chunk-TOSM3T3A.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-F4IQCXZG.js → chunk-VBZMCL23.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-J2NPH7DO.js → chunk-W2T7JWT3.js} +3 -3
|
@@ -2,6 +2,12 @@ import {
|
|
|
2
2
|
init_buffer
|
|
3
3
|
} from "./chunk-HX3SHTCE.js";
|
|
4
4
|
|
|
5
|
+
// packages/pdf-ast/src/canvas.ts
|
|
6
|
+
init_buffer();
|
|
7
|
+
|
|
8
|
+
// packages/pdf-ast/src/ast.ts
|
|
9
|
+
init_buffer();
|
|
10
|
+
|
|
5
11
|
// packages/pdf-ast/src/cos/filters.ts
|
|
6
12
|
init_buffer();
|
|
7
13
|
import { deflate, Inflate, Z_BUF_ERROR } from "pako";
|
|
@@ -22380,261 +22386,6 @@ var MeshShading = class _MeshShading extends BaseShading {
|
|
|
22380
22386
|
}
|
|
22381
22387
|
};
|
|
22382
22388
|
|
|
22383
|
-
// packages/pdf-ast/src/ast.ts
|
|
22384
|
-
init_buffer();
|
|
22385
|
-
var textEncoder = new TextEncoder();
|
|
22386
|
-
function cosBool(value, span) {
|
|
22387
|
-
return { kind: "boolean", value, span };
|
|
22388
|
-
}
|
|
22389
|
-
function formatPdfNumber(value) {
|
|
22390
|
-
if (!Number.isFinite(value) || Math.abs(value) < 1e-10) {
|
|
22391
|
-
return "0";
|
|
22392
|
-
}
|
|
22393
|
-
if (Number.isInteger(value)) {
|
|
22394
|
-
return String(value);
|
|
22395
|
-
}
|
|
22396
|
-
let fixed = value.toFixed(6);
|
|
22397
|
-
while (fixed.endsWith("0")) fixed = fixed.slice(0, -1);
|
|
22398
|
-
if (fixed.endsWith(".")) fixed = fixed.slice(0, -1);
|
|
22399
|
-
return fixed === "-0" || fixed === "" ? "0" : fixed;
|
|
22400
|
-
}
|
|
22401
|
-
function cosNumber(value, raw, span) {
|
|
22402
|
-
if (!Number.isFinite(value)) {
|
|
22403
|
-
throw new Error(`Invalid non-finite PDF number: ${String(value)}`);
|
|
22404
|
-
}
|
|
22405
|
-
const isInteger = Number.isInteger(value);
|
|
22406
|
-
const hasExponent = raw !== void 0 && (raw.includes("e") || raw.includes("E"));
|
|
22407
|
-
const formatted = raw !== void 0 && !hasExponent ? raw : formatPdfNumber(value);
|
|
22408
|
-
return { kind: "number", value, raw: formatted, isInteger, span };
|
|
22409
|
-
}
|
|
22410
|
-
function cosName(decoded, rawBytes, span) {
|
|
22411
|
-
return {
|
|
22412
|
-
kind: "name",
|
|
22413
|
-
decoded,
|
|
22414
|
-
rawBytes: rawBytes ?? textEncoder.encode(decoded),
|
|
22415
|
-
span
|
|
22416
|
-
};
|
|
22417
|
-
}
|
|
22418
|
-
function cosString(value, span) {
|
|
22419
|
-
if (typeof value === "string") {
|
|
22420
|
-
let needsUtf16 = false;
|
|
22421
|
-
for (let i = 0; i < value.length; i++) {
|
|
22422
|
-
if (!PDF_DOC_ENCODING_REVERSE.has(value.charCodeAt(i))) {
|
|
22423
|
-
needsUtf16 = true;
|
|
22424
|
-
break;
|
|
22425
|
-
}
|
|
22426
|
-
}
|
|
22427
|
-
if (needsUtf16) {
|
|
22428
|
-
const bytes2 = new Uint8Array(2 + value.length * 2);
|
|
22429
|
-
bytes2[0] = 254;
|
|
22430
|
-
bytes2[1] = 255;
|
|
22431
|
-
for (let i = 0; i < value.length; i++) {
|
|
22432
|
-
const code = value.charCodeAt(i);
|
|
22433
|
-
bytes2[2 + i * 2] = code >>> 8 & 255;
|
|
22434
|
-
bytes2[2 + i * 2 + 1] = code & 255;
|
|
22435
|
-
}
|
|
22436
|
-
return { kind: "string", format: "hex", bytes: bytes2, span };
|
|
22437
|
-
}
|
|
22438
|
-
const bytes = new Uint8Array(value.length);
|
|
22439
|
-
for (let i = 0; i < value.length; i++) {
|
|
22440
|
-
bytes[i] = PDF_DOC_ENCODING_REVERSE.get(value.charCodeAt(i));
|
|
22441
|
-
}
|
|
22442
|
-
return { kind: "string", format: "literal", bytes, span };
|
|
22443
|
-
}
|
|
22444
|
-
return { kind: "string", format: "literal", bytes: value, span };
|
|
22445
|
-
}
|
|
22446
|
-
function cosHexString(hexOrBytes, span) {
|
|
22447
|
-
if (typeof hexOrBytes === "string") {
|
|
22448
|
-
let clean = "";
|
|
22449
|
-
for (let i = 0; i < hexOrBytes.length; i++) {
|
|
22450
|
-
const ch3 = hexOrBytes[i];
|
|
22451
|
-
if (ch3 !== " " && ch3 !== " " && ch3 !== "\r" && ch3 !== "\n" && ch3 !== "\f") {
|
|
22452
|
-
clean += ch3;
|
|
22453
|
-
}
|
|
22454
|
-
}
|
|
22455
|
-
const padded = clean.length % 2 === 1 ? `${clean}0` : clean;
|
|
22456
|
-
const bytes = new Uint8Array(padded.length / 2);
|
|
22457
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
22458
|
-
bytes[i] = parseInt(padded.slice(i * 2, i * 2 + 2), 16) || 0;
|
|
22459
|
-
}
|
|
22460
|
-
return { kind: "string", format: "hex", bytes, span };
|
|
22461
|
-
}
|
|
22462
|
-
return { kind: "string", format: "hex", bytes: hexOrBytes, span };
|
|
22463
|
-
}
|
|
22464
|
-
function cosArray(items, span) {
|
|
22465
|
-
return { kind: "array", items: [...items], span };
|
|
22466
|
-
}
|
|
22467
|
-
function cosDict(entriesOrRecord = [], span) {
|
|
22468
|
-
if (Array.isArray(entriesOrRecord)) {
|
|
22469
|
-
const normalized = entriesOrRecord.map(
|
|
22470
|
-
(entry) => Array.isArray(entry) ? { key: cosName(entry[0]), value: entry[1] } : entry
|
|
22471
|
-
);
|
|
22472
|
-
return { kind: "dict", entries: normalized, span };
|
|
22473
|
-
}
|
|
22474
|
-
const rec = entriesOrRecord;
|
|
22475
|
-
const entries = [];
|
|
22476
|
-
for (const [k, v] of Object.entries(rec)) {
|
|
22477
|
-
if (v !== void 0) {
|
|
22478
|
-
entries.push({ key: cosName(k), value: v });
|
|
22479
|
-
}
|
|
22480
|
-
}
|
|
22481
|
-
return { kind: "dict", entries, span };
|
|
22482
|
-
}
|
|
22483
|
-
function cosRef(objectNumber, generationNumber = 0, span) {
|
|
22484
|
-
return { kind: "ref", objectNumber, generationNumber, span };
|
|
22485
|
-
}
|
|
22486
|
-
function cosStream(dataOrDict, optionsOrData = {}, span) {
|
|
22487
|
-
const data = dataOrDict instanceof Uint8Array ? dataOrDict : optionsOrData;
|
|
22488
|
-
const options = dataOrDict instanceof Uint8Array ? optionsOrData : { dict: dataOrDict };
|
|
22489
|
-
const entries = options.dict ? [...options.dict.entries] : [];
|
|
22490
|
-
const setEntry = (name, value) => {
|
|
22491
|
-
const idx = entries.findIndex((e) => e.key.decoded === name);
|
|
22492
|
-
if (idx >= 0) entries[idx] = { key: cosName(name), value };
|
|
22493
|
-
else entries.push({ key: cosName(name), value });
|
|
22494
|
-
};
|
|
22495
|
-
if (options.compress) {
|
|
22496
|
-
const compressed = encodeFlate(data);
|
|
22497
|
-
setEntry("Filter", cosName("FlateDecode"));
|
|
22498
|
-
setEntry("Length", cosNumber(compressed.length));
|
|
22499
|
-
return {
|
|
22500
|
-
kind: "stream",
|
|
22501
|
-
dict: { kind: "dict", entries },
|
|
22502
|
-
rawBytes: compressed,
|
|
22503
|
-
decodedBytes: data,
|
|
22504
|
-
span
|
|
22505
|
-
};
|
|
22506
|
-
}
|
|
22507
|
-
setEntry("Length", cosNumber(data.length));
|
|
22508
|
-
const hasExplicitFilter = entries.some(
|
|
22509
|
-
(e) => e.key.decoded === "Filter" || e.key.decoded === "F"
|
|
22510
|
-
);
|
|
22511
|
-
return {
|
|
22512
|
-
kind: "stream",
|
|
22513
|
-
dict: { kind: "dict", entries },
|
|
22514
|
-
rawBytes: data,
|
|
22515
|
-
...hasExplicitFilter ? {} : { decodedBytes: data },
|
|
22516
|
-
span
|
|
22517
|
-
};
|
|
22518
|
-
}
|
|
22519
|
-
function dictGet(dict, key) {
|
|
22520
|
-
for (let i = dict.entries.length - 1; i >= 0; i--) {
|
|
22521
|
-
if (dict.entries[i].key.decoded === key) {
|
|
22522
|
-
return dict.entries[i].value;
|
|
22523
|
-
}
|
|
22524
|
-
}
|
|
22525
|
-
return void 0;
|
|
22526
|
-
}
|
|
22527
|
-
function dictSet(dict, key, value) {
|
|
22528
|
-
for (let i = dict.entries.length - 1; i >= 0; i--) {
|
|
22529
|
-
if (dict.entries[i].key.decoded === key) {
|
|
22530
|
-
dict.entries[i] = { key: cosName(key), value };
|
|
22531
|
-
return;
|
|
22532
|
-
}
|
|
22533
|
-
}
|
|
22534
|
-
dict.entries.push({ key: cosName(key), value });
|
|
22535
|
-
}
|
|
22536
|
-
function dictDelete(dict, key) {
|
|
22537
|
-
for (let i = dict.entries.length - 1; i >= 0; i--) {
|
|
22538
|
-
if (dict.entries[i].key.decoded === key) {
|
|
22539
|
-
dict.entries.splice(i, 1);
|
|
22540
|
-
}
|
|
22541
|
-
}
|
|
22542
|
-
}
|
|
22543
|
-
var PDF_DOC_ENCODING_MAP = {
|
|
22544
|
-
24: 728,
|
|
22545
|
-
25: 711,
|
|
22546
|
-
26: 710,
|
|
22547
|
-
27: 729,
|
|
22548
|
-
28: 733,
|
|
22549
|
-
29: 731,
|
|
22550
|
-
30: 730,
|
|
22551
|
-
31: 732,
|
|
22552
|
-
128: 8226,
|
|
22553
|
-
129: 8224,
|
|
22554
|
-
130: 8225,
|
|
22555
|
-
131: 8230,
|
|
22556
|
-
132: 8212,
|
|
22557
|
-
133: 8211,
|
|
22558
|
-
134: 402,
|
|
22559
|
-
135: 8260,
|
|
22560
|
-
136: 8249,
|
|
22561
|
-
137: 8250,
|
|
22562
|
-
138: 8722,
|
|
22563
|
-
139: 8240,
|
|
22564
|
-
140: 8222,
|
|
22565
|
-
141: 8220,
|
|
22566
|
-
142: 8221,
|
|
22567
|
-
143: 8216,
|
|
22568
|
-
144: 8217,
|
|
22569
|
-
145: 8218,
|
|
22570
|
-
146: 8482,
|
|
22571
|
-
147: 64257,
|
|
22572
|
-
148: 64258,
|
|
22573
|
-
149: 321,
|
|
22574
|
-
150: 338,
|
|
22575
|
-
151: 352,
|
|
22576
|
-
152: 376,
|
|
22577
|
-
153: 381,
|
|
22578
|
-
154: 305,
|
|
22579
|
-
155: 322,
|
|
22580
|
-
156: 339,
|
|
22581
|
-
157: 353,
|
|
22582
|
-
158: 382,
|
|
22583
|
-
159: 65533,
|
|
22584
|
-
160: 8364,
|
|
22585
|
-
173: 65533
|
|
22586
|
-
};
|
|
22587
|
-
var PDF_DOC_ENCODING_REVERSE = new Map(
|
|
22588
|
-
Array.from({ length: 256 }, (_, byte) => [PDF_DOC_ENCODING_MAP[byte] ?? byte, byte])
|
|
22589
|
-
);
|
|
22590
|
-
function decodeUtf16UnitsWithSurrogateCheck(units) {
|
|
22591
|
-
let out = "";
|
|
22592
|
-
for (let i = 0; i < units.length; i++) {
|
|
22593
|
-
const u = units[i];
|
|
22594
|
-
if (u >= 55296 && u <= 56319) {
|
|
22595
|
-
const next = units[i + 1];
|
|
22596
|
-
if (next !== void 0 && next >= 56320 && next <= 57343) {
|
|
22597
|
-
out += String.fromCharCode(u, next);
|
|
22598
|
-
i++;
|
|
22599
|
-
} else {
|
|
22600
|
-
out += "\uFFFD";
|
|
22601
|
-
}
|
|
22602
|
-
} else if (u >= 56320 && u <= 57343) {
|
|
22603
|
-
out += "\uFFFD";
|
|
22604
|
-
} else {
|
|
22605
|
-
out += String.fromCharCode(u);
|
|
22606
|
-
}
|
|
22607
|
-
}
|
|
22608
|
-
return out;
|
|
22609
|
-
}
|
|
22610
|
-
function decodePdfString(node) {
|
|
22611
|
-
const bytes = node.bytes;
|
|
22612
|
-
if (bytes.length >= 2 && bytes[0] === 254 && bytes[1] === 255) {
|
|
22613
|
-
const units = [];
|
|
22614
|
-
for (let i = 2; i + 1 < bytes.length; i += 2) {
|
|
22615
|
-
units.push(bytes[i] << 8 | bytes[i + 1]);
|
|
22616
|
-
}
|
|
22617
|
-
return decodeUtf16UnitsWithSurrogateCheck(units);
|
|
22618
|
-
}
|
|
22619
|
-
if (bytes.length >= 2 && bytes[0] === 255 && bytes[1] === 254) {
|
|
22620
|
-
const units = [];
|
|
22621
|
-
for (let i = 2; i + 1 < bytes.length; i += 2) {
|
|
22622
|
-
units.push(bytes[i + 1] << 8 | bytes[i]);
|
|
22623
|
-
}
|
|
22624
|
-
return decodeUtf16UnitsWithSurrogateCheck(units);
|
|
22625
|
-
}
|
|
22626
|
-
if (bytes.length >= 3 && bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191) {
|
|
22627
|
-
return new TextDecoder("utf-8").decode(bytes.subarray(3));
|
|
22628
|
-
}
|
|
22629
|
-
let out = "";
|
|
22630
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
22631
|
-
const b = bytes[i];
|
|
22632
|
-
const mapped = PDF_DOC_ENCODING_MAP[b];
|
|
22633
|
-
out += String.fromCharCode(mapped !== void 0 ? mapped : b);
|
|
22634
|
-
}
|
|
22635
|
-
return out;
|
|
22636
|
-
}
|
|
22637
|
-
|
|
22638
22389
|
// packages/pdf-ast/src/errors.ts
|
|
22639
22390
|
init_buffer();
|
|
22640
22391
|
var PdfError = class extends Error {
|
|
@@ -23350,8 +23101,259 @@ function decodeStreamObject(stream, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES,
|
|
|
23350
23101
|
return stream.rawBytes;
|
|
23351
23102
|
}
|
|
23352
23103
|
|
|
23353
|
-
// packages/pdf-ast/src/
|
|
23354
|
-
|
|
23104
|
+
// packages/pdf-ast/src/ast.ts
|
|
23105
|
+
var textEncoder = new TextEncoder();
|
|
23106
|
+
function cosBool(value, span) {
|
|
23107
|
+
return { kind: "boolean", value, span };
|
|
23108
|
+
}
|
|
23109
|
+
function formatPdfNumber(value) {
|
|
23110
|
+
if (!Number.isFinite(value) || Math.abs(value) < 1e-10) {
|
|
23111
|
+
return "0";
|
|
23112
|
+
}
|
|
23113
|
+
if (Number.isInteger(value)) {
|
|
23114
|
+
return String(value);
|
|
23115
|
+
}
|
|
23116
|
+
let fixed = value.toFixed(6);
|
|
23117
|
+
while (fixed.endsWith("0")) fixed = fixed.slice(0, -1);
|
|
23118
|
+
if (fixed.endsWith(".")) fixed = fixed.slice(0, -1);
|
|
23119
|
+
return fixed === "-0" || fixed === "" ? "0" : fixed;
|
|
23120
|
+
}
|
|
23121
|
+
function cosNumber(value, raw, span) {
|
|
23122
|
+
if (!Number.isFinite(value)) {
|
|
23123
|
+
throw new Error(`Invalid non-finite PDF number: ${String(value)}`);
|
|
23124
|
+
}
|
|
23125
|
+
const isInteger = Number.isInteger(value);
|
|
23126
|
+
const hasExponent = raw !== void 0 && (raw.includes("e") || raw.includes("E"));
|
|
23127
|
+
const formatted = raw !== void 0 && !hasExponent ? raw : formatPdfNumber(value);
|
|
23128
|
+
return { kind: "number", value, raw: formatted, isInteger, span };
|
|
23129
|
+
}
|
|
23130
|
+
function cosName(decoded, rawBytes, span) {
|
|
23131
|
+
return {
|
|
23132
|
+
kind: "name",
|
|
23133
|
+
decoded,
|
|
23134
|
+
rawBytes: rawBytes ?? textEncoder.encode(decoded),
|
|
23135
|
+
span
|
|
23136
|
+
};
|
|
23137
|
+
}
|
|
23138
|
+
function cosString(value, span) {
|
|
23139
|
+
if (typeof value === "string") {
|
|
23140
|
+
let needsUtf16 = false;
|
|
23141
|
+
for (let i = 0; i < value.length; i++) {
|
|
23142
|
+
if (!PDF_DOC_ENCODING_REVERSE.has(value.charCodeAt(i))) {
|
|
23143
|
+
needsUtf16 = true;
|
|
23144
|
+
break;
|
|
23145
|
+
}
|
|
23146
|
+
}
|
|
23147
|
+
if (needsUtf16) {
|
|
23148
|
+
const bytes2 = new Uint8Array(2 + value.length * 2);
|
|
23149
|
+
bytes2[0] = 254;
|
|
23150
|
+
bytes2[1] = 255;
|
|
23151
|
+
for (let i = 0; i < value.length; i++) {
|
|
23152
|
+
const code = value.charCodeAt(i);
|
|
23153
|
+
bytes2[2 + i * 2] = code >>> 8 & 255;
|
|
23154
|
+
bytes2[2 + i * 2 + 1] = code & 255;
|
|
23155
|
+
}
|
|
23156
|
+
return { kind: "string", format: "hex", bytes: bytes2, span };
|
|
23157
|
+
}
|
|
23158
|
+
const bytes = new Uint8Array(value.length);
|
|
23159
|
+
for (let i = 0; i < value.length; i++) {
|
|
23160
|
+
bytes[i] = PDF_DOC_ENCODING_REVERSE.get(value.charCodeAt(i));
|
|
23161
|
+
}
|
|
23162
|
+
return { kind: "string", format: "literal", bytes, span };
|
|
23163
|
+
}
|
|
23164
|
+
return { kind: "string", format: "literal", bytes: value, span };
|
|
23165
|
+
}
|
|
23166
|
+
function cosHexString(hexOrBytes, span) {
|
|
23167
|
+
if (typeof hexOrBytes === "string") {
|
|
23168
|
+
let clean = "";
|
|
23169
|
+
for (let i = 0; i < hexOrBytes.length; i++) {
|
|
23170
|
+
const ch3 = hexOrBytes[i];
|
|
23171
|
+
if (ch3 !== " " && ch3 !== " " && ch3 !== "\r" && ch3 !== "\n" && ch3 !== "\f") {
|
|
23172
|
+
clean += ch3;
|
|
23173
|
+
}
|
|
23174
|
+
}
|
|
23175
|
+
const padded = clean.length % 2 === 1 ? `${clean}0` : clean;
|
|
23176
|
+
const bytes = new Uint8Array(padded.length / 2);
|
|
23177
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
23178
|
+
bytes[i] = parseInt(padded.slice(i * 2, i * 2 + 2), 16) || 0;
|
|
23179
|
+
}
|
|
23180
|
+
return { kind: "string", format: "hex", bytes, span };
|
|
23181
|
+
}
|
|
23182
|
+
return { kind: "string", format: "hex", bytes: hexOrBytes, span };
|
|
23183
|
+
}
|
|
23184
|
+
function cosArray(items, span) {
|
|
23185
|
+
return { kind: "array", items: [...items], span };
|
|
23186
|
+
}
|
|
23187
|
+
function cosDict(entriesOrRecord = [], span) {
|
|
23188
|
+
if (Array.isArray(entriesOrRecord)) {
|
|
23189
|
+
const normalized = entriesOrRecord.map(
|
|
23190
|
+
(entry) => Array.isArray(entry) ? { key: cosName(entry[0]), value: entry[1] } : entry
|
|
23191
|
+
);
|
|
23192
|
+
return { kind: "dict", entries: normalized, span };
|
|
23193
|
+
}
|
|
23194
|
+
const rec = entriesOrRecord;
|
|
23195
|
+
const entries = [];
|
|
23196
|
+
for (const [k, v] of Object.entries(rec)) {
|
|
23197
|
+
if (v !== void 0) {
|
|
23198
|
+
entries.push({ key: cosName(k), value: v });
|
|
23199
|
+
}
|
|
23200
|
+
}
|
|
23201
|
+
return { kind: "dict", entries, span };
|
|
23202
|
+
}
|
|
23203
|
+
function cosRef(objectNumber, generationNumber = 0, span) {
|
|
23204
|
+
return { kind: "ref", objectNumber, generationNumber, span };
|
|
23205
|
+
}
|
|
23206
|
+
function cosStream(dataOrDict, optionsOrData = {}, span) {
|
|
23207
|
+
const data = dataOrDict instanceof Uint8Array ? dataOrDict : optionsOrData;
|
|
23208
|
+
const options = dataOrDict instanceof Uint8Array ? optionsOrData : { dict: dataOrDict };
|
|
23209
|
+
const entries = options.dict ? [...options.dict.entries] : [];
|
|
23210
|
+
const setEntry = (name, value) => {
|
|
23211
|
+
const idx = entries.findIndex((e) => e.key.decoded === name);
|
|
23212
|
+
if (idx >= 0) entries[idx] = { key: cosName(name), value };
|
|
23213
|
+
else entries.push({ key: cosName(name), value });
|
|
23214
|
+
};
|
|
23215
|
+
if (options.compress) {
|
|
23216
|
+
const compressed = encodeFlate(data);
|
|
23217
|
+
setEntry("Filter", cosName("FlateDecode"));
|
|
23218
|
+
setEntry("Length", cosNumber(compressed.length));
|
|
23219
|
+
return {
|
|
23220
|
+
kind: "stream",
|
|
23221
|
+
dict: { kind: "dict", entries },
|
|
23222
|
+
rawBytes: compressed,
|
|
23223
|
+
decodedBytes: data,
|
|
23224
|
+
span
|
|
23225
|
+
};
|
|
23226
|
+
}
|
|
23227
|
+
setEntry("Length", cosNumber(data.length));
|
|
23228
|
+
const hasExplicitFilter = entries.some(
|
|
23229
|
+
(e) => e.key.decoded === "Filter" || e.key.decoded === "F"
|
|
23230
|
+
);
|
|
23231
|
+
return {
|
|
23232
|
+
kind: "stream",
|
|
23233
|
+
dict: { kind: "dict", entries },
|
|
23234
|
+
rawBytes: data,
|
|
23235
|
+
...hasExplicitFilter ? {} : { decodedBytes: data },
|
|
23236
|
+
span
|
|
23237
|
+
};
|
|
23238
|
+
}
|
|
23239
|
+
function dictGet(dict, key) {
|
|
23240
|
+
for (let i = dict.entries.length - 1; i >= 0; i--) {
|
|
23241
|
+
if (dict.entries[i].key.decoded === key) {
|
|
23242
|
+
return dict.entries[i].value;
|
|
23243
|
+
}
|
|
23244
|
+
}
|
|
23245
|
+
return void 0;
|
|
23246
|
+
}
|
|
23247
|
+
function dictSet(dict, key, value) {
|
|
23248
|
+
for (let i = dict.entries.length - 1; i >= 0; i--) {
|
|
23249
|
+
if (dict.entries[i].key.decoded === key) {
|
|
23250
|
+
dict.entries[i] = { key: cosName(key), value };
|
|
23251
|
+
return;
|
|
23252
|
+
}
|
|
23253
|
+
}
|
|
23254
|
+
dict.entries.push({ key: cosName(key), value });
|
|
23255
|
+
}
|
|
23256
|
+
function dictDelete(dict, key) {
|
|
23257
|
+
for (let i = dict.entries.length - 1; i >= 0; i--) {
|
|
23258
|
+
if (dict.entries[i].key.decoded === key) {
|
|
23259
|
+
dict.entries.splice(i, 1);
|
|
23260
|
+
}
|
|
23261
|
+
}
|
|
23262
|
+
}
|
|
23263
|
+
var PDF_DOC_ENCODING_MAP = {
|
|
23264
|
+
24: 728,
|
|
23265
|
+
25: 711,
|
|
23266
|
+
26: 710,
|
|
23267
|
+
27: 729,
|
|
23268
|
+
28: 733,
|
|
23269
|
+
29: 731,
|
|
23270
|
+
30: 730,
|
|
23271
|
+
31: 732,
|
|
23272
|
+
128: 8226,
|
|
23273
|
+
129: 8224,
|
|
23274
|
+
130: 8225,
|
|
23275
|
+
131: 8230,
|
|
23276
|
+
132: 8212,
|
|
23277
|
+
133: 8211,
|
|
23278
|
+
134: 402,
|
|
23279
|
+
135: 8260,
|
|
23280
|
+
136: 8249,
|
|
23281
|
+
137: 8250,
|
|
23282
|
+
138: 8722,
|
|
23283
|
+
139: 8240,
|
|
23284
|
+
140: 8222,
|
|
23285
|
+
141: 8220,
|
|
23286
|
+
142: 8221,
|
|
23287
|
+
143: 8216,
|
|
23288
|
+
144: 8217,
|
|
23289
|
+
145: 8218,
|
|
23290
|
+
146: 8482,
|
|
23291
|
+
147: 64257,
|
|
23292
|
+
148: 64258,
|
|
23293
|
+
149: 321,
|
|
23294
|
+
150: 338,
|
|
23295
|
+
151: 352,
|
|
23296
|
+
152: 376,
|
|
23297
|
+
153: 381,
|
|
23298
|
+
154: 305,
|
|
23299
|
+
155: 322,
|
|
23300
|
+
156: 339,
|
|
23301
|
+
157: 353,
|
|
23302
|
+
158: 382,
|
|
23303
|
+
159: 65533,
|
|
23304
|
+
160: 8364,
|
|
23305
|
+
173: 65533
|
|
23306
|
+
};
|
|
23307
|
+
var PDF_DOC_ENCODING_REVERSE = new Map(
|
|
23308
|
+
Array.from({ length: 256 }, (_, byte) => [PDF_DOC_ENCODING_MAP[byte] ?? byte, byte])
|
|
23309
|
+
);
|
|
23310
|
+
function decodeUtf16UnitsWithSurrogateCheck(units) {
|
|
23311
|
+
let out = "";
|
|
23312
|
+
for (let i = 0; i < units.length; i++) {
|
|
23313
|
+
const u = units[i];
|
|
23314
|
+
if (u >= 55296 && u <= 56319) {
|
|
23315
|
+
const next = units[i + 1];
|
|
23316
|
+
if (next !== void 0 && next >= 56320 && next <= 57343) {
|
|
23317
|
+
out += String.fromCharCode(u, next);
|
|
23318
|
+
i++;
|
|
23319
|
+
} else {
|
|
23320
|
+
out += "\uFFFD";
|
|
23321
|
+
}
|
|
23322
|
+
} else if (u >= 56320 && u <= 57343) {
|
|
23323
|
+
out += "\uFFFD";
|
|
23324
|
+
} else {
|
|
23325
|
+
out += String.fromCharCode(u);
|
|
23326
|
+
}
|
|
23327
|
+
}
|
|
23328
|
+
return out;
|
|
23329
|
+
}
|
|
23330
|
+
function decodePdfString(node) {
|
|
23331
|
+
const bytes = node.bytes;
|
|
23332
|
+
if (bytes.length >= 2 && bytes[0] === 254 && bytes[1] === 255) {
|
|
23333
|
+
const units = [];
|
|
23334
|
+
for (let i = 2; i + 1 < bytes.length; i += 2) {
|
|
23335
|
+
units.push(bytes[i] << 8 | bytes[i + 1]);
|
|
23336
|
+
}
|
|
23337
|
+
return decodeUtf16UnitsWithSurrogateCheck(units);
|
|
23338
|
+
}
|
|
23339
|
+
if (bytes.length >= 2 && bytes[0] === 255 && bytes[1] === 254) {
|
|
23340
|
+
const units = [];
|
|
23341
|
+
for (let i = 2; i + 1 < bytes.length; i += 2) {
|
|
23342
|
+
units.push(bytes[i + 1] << 8 | bytes[i]);
|
|
23343
|
+
}
|
|
23344
|
+
return decodeUtf16UnitsWithSurrogateCheck(units);
|
|
23345
|
+
}
|
|
23346
|
+
if (bytes.length >= 3 && bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191) {
|
|
23347
|
+
return new TextDecoder("utf-8").decode(bytes.subarray(3));
|
|
23348
|
+
}
|
|
23349
|
+
let out = "";
|
|
23350
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
23351
|
+
const b = bytes[i];
|
|
23352
|
+
const mapped = PDF_DOC_ENCODING_MAP[b];
|
|
23353
|
+
out += String.fromCharCode(mapped !== void 0 ? mapped : b);
|
|
23354
|
+
}
|
|
23355
|
+
return out;
|
|
23356
|
+
}
|
|
23355
23357
|
|
|
23356
23358
|
// packages/pdf-ast/src/content/evaluator.ts
|
|
23357
23359
|
init_buffer();
|
|
@@ -40496,7 +40498,6 @@ var PdfDocument = class _PdfDocument {
|
|
|
40496
40498
|
init_buffer();
|
|
40497
40499
|
|
|
40498
40500
|
export {
|
|
40499
|
-
decodeFlate,
|
|
40500
40501
|
rgb,
|
|
40501
40502
|
encodePng,
|
|
40502
40503
|
renderPdfPageToPng,
|
package/dist/safe-bash/command-chunks/{pptx-ZL6L7KP2-QVZEYFUV.js → pptx-KY2OJWZW-76LBHCHD.js}
RENAMED
|
@@ -8,12 +8,13 @@ import {
|
|
|
8
8
|
} from "./chunk-RDV7UCYZ.js";
|
|
9
9
|
import {
|
|
10
10
|
PandocError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7OKDCM5U.js";
|
|
12
|
+
import "./chunk-X4P42NYK.js";
|
|
12
13
|
import {
|
|
13
14
|
init_buffer
|
|
14
15
|
} from "./chunk-HX3SHTCE.js";
|
|
15
16
|
|
|
16
|
-
// packages/safe-bash-command-pandoc/dist/chunks/pptx-
|
|
17
|
+
// packages/safe-bash-command-pandoc/dist/chunks/pptx-KY2OJWZW.js
|
|
17
18
|
init_buffer();
|
|
18
19
|
|
|
19
20
|
// packages/pptx/src/index.ts
|
|
@@ -30125,7 +30126,7 @@ var declaredOperations = {
|
|
|
30125
30126
|
// packages/pptx/src/chart-objects.ts
|
|
30126
30127
|
init_buffer();
|
|
30127
30128
|
|
|
30128
|
-
// packages/safe-bash-command-pandoc/dist/chunks/pptx-
|
|
30129
|
+
// packages/safe-bash-command-pandoc/dist/chunks/pptx-KY2OJWZW.js
|
|
30129
30130
|
var attr8 = ["", [], []];
|
|
30130
30131
|
function engineContext(context) {
|
|
30131
30132
|
const l = context.limits;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import type { CommandDefinition, VirtualShellPlugin } from "../../contracts/index.js";
|
|
2
2
|
import { type CsvkitCommandsOptions } from "../../../safe-bash-command-csvkit/index.js";
|
|
3
3
|
export * from "../../../safe-bash-command-csvkit/index.js";
|
|
4
|
+
export * from "./sync.js";
|
|
4
5
|
export declare function createCsvkitCommands(options?: CsvkitCommandsOptions): readonly CommandDefinition[];
|
|
5
6
|
export declare function csvkitCommands(options?: CsvkitCommandsOptions): VirtualShellPlugin;
|
|
6
|
-
export declare function evalSyncCsvlook(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
7
|
-
export declare function evalSyncCsvjson(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
8
|
-
export declare function evalSyncCsvsort(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
9
|
-
export declare function evalSyncCsvformat(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
10
|
-
export declare function evalSyncCsvstat(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
11
|
-
export declare function evalSyncIn2csv(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
12
|
-
export declare function evalSyncCsvstack(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
13
|
-
export declare function evalSyncCsvjoin(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
14
7
|
//# sourceMappingURL=index.d.ts.map
|