@wirecat/drive-cli 0.63.0 → 0.65.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/README.md +2 -1
- package/dist/bin/drive.js +2 -2
- package/dist/bundle/{all-profiles-GZJS3UKC.js → all-profiles-PD7GJHFA.js} +14 -13
- package/dist/bundle/{anthropic-RGV3WXX5.js → anthropic-PJKFON5H.js} +25 -14
- package/dist/bundle/{app-server-AA2PJ7PV.js → app-server-6ELQA6FJ.js} +59 -56
- package/dist/bundle/{bun-OXZYIA3R.js → bun-P54TGES2.js} +2 -2
- package/dist/bundle/{bun-sqlite-D45NSDM3.js → bun-sqlite-TND5ZRJH.js} +12 -8
- package/dist/bundle/chunk-2AFI4KGI.js +185 -0
- package/dist/bundle/{chunk-Q5DJTRKV.js → chunk-3HXNDF6Q.js} +2 -2
- package/dist/bundle/{chunk-DJHLVUL6.js → chunk-3ONWN3IA.js} +278 -49
- package/dist/bundle/{chunk-WYGWWHZP.js → chunk-42G2XNPN.js} +2 -2
- package/dist/bundle/chunk-4AOINPN2.js +66 -0
- package/dist/bundle/{chunk-J4DIHPZ6.js → chunk-4EDWLR22.js} +1 -1
- package/dist/bundle/{chunk-ABYGSJZ4.js → chunk-4Y5YBFMS.js} +7 -7
- package/dist/bundle/{chunk-YGU6ULU5.js → chunk-54V4H6PM.js} +16 -16
- package/dist/bundle/{chunk-2TFXK3R4.js → chunk-5XSBCMAF.js} +4 -4
- package/dist/bundle/{chunk-2HF2MRXI.js → chunk-6DCLZLGX.js} +1 -1
- package/dist/bundle/{chunk-OD4U7GUY.js → chunk-7AQGVX5O.js} +20 -20
- package/dist/bundle/{chunk-YIP7ELON.js → chunk-7TAP7Y2E.js} +727 -518
- package/dist/bundle/{chunk-TF23BZW5.js → chunk-A27UVLPK.js} +3 -3
- package/dist/bundle/{chunk-LZEOQW7S.js → chunk-A4QNADEX.js} +58 -52
- package/dist/bundle/{chunk-FXBHOCJK.js → chunk-ADLS6FVG.js} +1 -1
- package/dist/bundle/{chunk-LMAVCYLQ.js → chunk-B2LPCHQN.js} +4 -4
- package/dist/bundle/{chunk-5PPL7JDM.js → chunk-CGQRZRTH.js} +2 -2
- package/dist/bundle/{chunk-VAUMOZU5.js → chunk-CWLL63JD.js} +107 -48
- package/dist/bundle/{chunk-V3NVXIQR.js → chunk-D6Z43SOG.js} +1563 -266
- package/dist/bundle/{chunk-OXY6SSZG.js → chunk-D7WB54P7.js} +127 -28
- package/dist/bundle/{chunk-VJEOGKAN.js → chunk-DA63E2UM.js} +13 -9
- package/dist/bundle/{chunk-EOOGWUTP.js → chunk-ECEP4SO3.js} +20 -20
- package/dist/bundle/{chunk-NEFSGCVA.js → chunk-EHU6EYGO.js} +38 -28
- package/dist/bundle/{chunk-4OSSOWDM.js → chunk-ELJUBPY4.js} +1 -1
- package/dist/bundle/{chunk-FRIJUILO.js → chunk-EM7NL5ES.js} +3 -3
- package/dist/bundle/{chunk-3BZRKLJ6.js → chunk-EU5MD24W.js} +13 -13
- package/dist/bundle/{chunk-MOTRI3SY.js → chunk-EZ2OLYEK.js} +24 -2
- package/dist/bundle/{chunk-6MQSQ4LX.js → chunk-F56DRBGY.js} +370 -717
- package/dist/bundle/{chunk-ZOJU7ZFI.js → chunk-FA6JNXCC.js} +8 -8
- package/dist/bundle/{chunk-ND6LLYGF.js → chunk-FBHSWQU7.js} +1531 -136
- package/dist/bundle/{chunk-Z42YYLTS.js → chunk-GW3LBY3T.js} +74 -72
- package/dist/bundle/{chunk-Y6GNA7HE.js → chunk-HP3NT6JJ.js} +23 -5
- package/dist/bundle/{chunk-DJ3SDJZY.js → chunk-I272E6UR.js} +9 -8
- package/dist/bundle/{chunk-L37LMMRJ.js → chunk-IBO23OID.js} +2 -2
- package/dist/bundle/{chunk-CE2TJBLP.js → chunk-II4S2DBJ.js} +3 -3
- package/dist/bundle/{chunk-ZM5J6ZMB.js → chunk-IKHOIXJR.js} +2 -2
- package/dist/bundle/{chunk-PO5RQQIG.js → chunk-IMHW7VIV.js} +5 -5
- package/dist/bundle/{chunk-3HK5WMI5.js → chunk-JMJIH6JH.js} +6 -6
- package/dist/bundle/{chunk-FUITWY7O.js → chunk-JPPPLKAO.js} +26 -1
- package/dist/bundle/{chunk-4S4JMW6I.js → chunk-LMKPP2JP.js} +1 -1
- package/dist/bundle/{chunk-HZZCEQTH.js → chunk-M7ELUGU6.js} +4 -4
- package/dist/bundle/{chunk-ZMOUUOT2.js → chunk-MCPOZNWG.js} +1 -1
- package/dist/bundle/{chunk-XNVFKMVR.js → chunk-NI5PD5KM.js} +39485 -35729
- package/dist/bundle/{chunk-2TDUGC5D.js → chunk-NQ5XMSLA.js} +4927 -1978
- package/dist/bundle/chunk-NQRTKYJB.js +257 -0
- package/dist/bundle/{chunk-44SBK6KB.js → chunk-O6K2E7OA.js} +4201 -2565
- package/dist/bundle/{chunk-534OBX5Y.js → chunk-O7ZDCOZE.js} +1 -1
- package/dist/bundle/{chunk-7EMQ26BA.js → chunk-OFJXHEFT.js} +13 -13
- package/dist/bundle/chunk-OWMZUWCM.js +109 -0
- package/dist/bundle/chunk-PHOL2DZM.js +138 -0
- package/dist/bundle/{chunk-UQLWMGSD.js → chunk-PLP5527C.js} +5 -5
- package/dist/bundle/{chunk-3QINVLZI.js → chunk-RNHGQ35R.js} +1 -1
- package/dist/bundle/{chunk-27YUUGXQ.js → chunk-RX5CJ55S.js} +1 -1
- package/dist/bundle/{chunk-XIUDS3OK.js → chunk-SE352DBY.js} +1 -1
- package/dist/bundle/chunk-SEQWBZYH.js +18 -0
- package/dist/bundle/{chunk-33MGFUED.js → chunk-SIWXYB4E.js} +3789 -3538
- package/dist/bundle/{chunk-4CIZWCXV.js → chunk-SNLSEYJO.js} +1 -1
- package/dist/bundle/{chunk-XDC3TWTL.js → chunk-SS4LKLD7.js} +52 -605
- package/dist/bundle/{chunk-BKYMKVHT.js → chunk-TMHF4BCL.js} +2 -2
- package/dist/bundle/{chunk-FEZF3TII.js → chunk-TOVWMURV.js} +74 -6
- package/dist/bundle/{chunk-QCKZ3GAA.js → chunk-TTP4NOP3.js} +4 -4
- package/dist/bundle/chunk-UTNRBOEN.js +53 -0
- package/dist/bundle/{chunk-2NIC72HH.js → chunk-VDZY3L7U.js} +3 -1
- package/dist/bundle/chunk-VHQYWFWV.js +13 -0
- package/dist/bundle/{chunk-VKPCONDQ.js → chunk-VLXWAH5E.js} +4 -4
- package/dist/bundle/{chunk-6KQJSFYF.js → chunk-VMAMRFFC.js} +23 -23
- package/dist/bundle/{chunk-6EY46GAN.js → chunk-W2XY6C5S.js} +2 -2
- package/dist/bundle/{chunk-J24ZFCWM.js → chunk-WRAUO5EJ.js} +22 -24
- package/dist/bundle/{chunk-S4RXABDR.js → chunk-WRMJN6UQ.js} +3 -3
- package/dist/bundle/{chunk-UPOSDTPT.js → chunk-WVJHZIDH.js} +3 -3
- package/dist/bundle/{chunk-E4SDKMBJ.js → chunk-X7YGGWXI.js} +1 -59
- package/dist/bundle/{chunk-O2XOX4HB.js → chunk-XPWZSW6Y.js} +50 -34
- package/dist/bundle/{chunk-PDCCYHCH.js → chunk-XYE7XZPB.js} +5 -5
- package/dist/bundle/{chunk-RKELRWH7.js → chunk-Y5PKRITX.js} +5 -5
- package/dist/bundle/{chunk-XR6ESRU6.js → chunk-Z2ADO6UA.js} +2 -2
- package/dist/bundle/{chunk-YUWPNG7B.js → chunk-ZD4MB7NH.js} +1 -1
- package/dist/bundle/{chunk-TWUH22Z5.js → chunk-ZILALBYQ.js} +4 -4
- package/dist/bundle/{chunk-SXM6MHRR.js → chunk-ZR2EJPMQ.js} +44 -15
- package/dist/bundle/command-contract-25E4PYMD.js +40 -0
- package/dist/bundle/command-server-entry-36JXYIJB.js +170 -0
- package/dist/bundle/{decode-G5YEIPNC.js → decode-T5ZW57WZ.js} +8 -8
- package/dist/bundle/{dispatch-GEFIXA6X.js → dispatch-RMA2XFYA.js} +11 -11
- package/dist/bundle/drive.js +11 -11
- package/dist/bundle/{echarts-W2CWHNXR.js → echarts-KQ44LPSF.js} +2 -2
- package/dist/bundle/{embed-OBFFPVF4.js → embed-Q7XST53J.js} +9 -9
- package/dist/bundle/{embedder-NGCBQHIG.js → embedder-RWZSBVW2.js} +12 -12
- package/dist/bundle/entry-HPLW4QL2.js +25 -0
- package/dist/bundle/{failure-GV77W3CD.js → failure-7NP4QPIN.js} +4 -4
- package/dist/bundle/first-run-RL3RKYZW.js +30 -0
- package/dist/bundle/first-screen-NX3TM2VJ.js +38 -0
- package/dist/bundle/google-DPD5N6AQ.js +42 -0
- package/dist/bundle/{google-api-Z3NSTBBR.js → google-api-P5DRHD7L.js} +61 -56
- package/dist/bundle/grants-TX4MHLI4.js +109 -0
- package/dist/bundle/{identity-OM6GFZ7T.js → identity-VDV6CHRW.js} +6 -6
- package/dist/bundle/{instructions-YQBQSYSS.js → instructions-Q45FVY6H.js} +1 -1
- package/dist/bundle/{login-7RYSDVN3.js → login-XKN3NI6X.js} +67 -62
- package/dist/bundle/{mcp-GWDA3HOA.js → mcp-7KQUJNFN.js} +2 -2
- package/dist/bundle/{node-IVU33RL7.js → node-MSW565D3.js} +2 -2
- package/dist/bundle/{node-KM3CUABH.js → node-P4E63KXA.js} +9 -9
- package/dist/bundle/{node-sqlite-SIH5BEW2.js → node-sqlite-S74XVVHL.js} +13 -9
- package/dist/bundle/oauth-6R7AWAES.js +22 -0
- package/dist/bundle/{open-IAO2SNII.js → open-P7UQG7XJ.js} +8 -8
- package/dist/bundle/{openai-SGOUBHXP.js → openai-DDHJ57KZ.js} +19 -40
- package/dist/bundle/{process-BPBMV3AT.js → process-NMUB5SHK.js} +1 -1
- package/dist/bundle/{program-MYKKJ4F6.js → program-PJNWP6JW.js} +517 -330
- package/dist/bundle/prompt-VOSMK4C2.js +19 -0
- package/dist/bundle/{reasons-57J2D77K.js → reasons-KDAXOC5S.js} +5 -5
- package/dist/bundle/{recognize-A5C5RPB3.js → recognize-GZIY63HS.js} +7 -7
- package/dist/bundle/{remote-VWYFLRGO.js → remote-V3YGN7LN.js} +10 -10
- package/dist/bundle/{rerank-4NGQWREA.js → rerank-XRU6AVN7.js} +10 -10
- package/dist/bundle/{serve-Y6LQTFH5.js → serve-NDOAFA57.js} +12 -12
- package/dist/bundle/{server-6AUHIIUA.js → server-BKGWJYMC.js} +46 -44
- package/dist/bundle/server-QD2MUJJZ.js +72 -0
- package/dist/bundle/{services-2W4J7EMW.js → services-TYDMFQCA.js} +129 -39
- package/dist/bundle/{sqlite-runtime-P6BBDX2H.js → sqlite-runtime-UAFJKSJR.js} +9 -9
- package/dist/bundle/{start-AFFA3LKM.js → start-2ZLDP2OE.js} +30 -8
- package/dist/bundle/{state-PXKKXR3R.js → state-6SP27J2K.js} +9 -9
- package/dist/bundle/{store-CN6JEUC4.js → store-4UUY545Q.js} +42 -18
- package/dist/bundle/{store-IVV2BAGZ.js → store-EJN27MXI.js} +69 -28
- package/dist/bundle/store-maintenance-command-LETURZDC.js +60 -0
- package/dist/bundle/tokens-MTFJPTYT.js +107 -0
- package/dist/commands/account.d.ts +4 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +33 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +6 -5
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context.d.ts +4 -2
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/documents.d.ts +2 -0
- package/dist/commands/documents.d.ts.map +1 -1
- package/dist/commands/documents.js +39 -3
- package/dist/commands/documents.js.map +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -2
- package/dist/config.js.map +1 -1
- package/dist/documents-add.d.ts +49 -0
- package/dist/documents-add.d.ts.map +1 -0
- package/dist/documents-add.js +122 -0
- package/dist/documents-add.js.map +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -1
- package/dist/errors.js.map +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.d.ts.map +1 -1
- package/dist/knowledge.js +15 -17
- package/dist/knowledge.js.map +1 -1
- package/dist/model.d.ts +3 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js.map +1 -1
- package/dist/profile-lock.d.ts +1 -0
- package/dist/profile-lock.d.ts.map +1 -1
- package/dist/profile-lock.js +1 -0
- package/dist/profile-lock.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +24 -15
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +25 -0
- package/dist/reasons.js.map +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +20 -0
- package/dist/store.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/bundle/chunk-AEX37ETW.js +0 -35
- package/dist/bundle/chunk-OTROVC4E.js +0 -62
- package/dist/bundle/chunk-Z5KC7XBR.js +0 -33
- package/dist/bundle/command-contract-BRW3AP44.js +0 -38
- package/dist/bundle/entry-ET6HGM7A.js +0 -22
- package/dist/bundle/first-run-JG52UZVO.js +0 -30
- package/dist/bundle/first-screen-CIL3GFAA.js +0 -36
- package/dist/bundle/google-CIWUVJ5C.js +0 -36
- package/dist/bundle/grants-3S4RL3WB.js +0 -104
- package/dist/bundle/oauth-PT4JEHLL.js +0 -22
- package/dist/bundle/prompt-3ZM64DCB.js +0 -17
- package/dist/bundle/server-PFHI35HA.js +0 -69
- package/dist/bundle/store-maintenance-command-MSY2QNEH.js +0 -59
- package/dist/bundle/tokens-P4LPNUFW.js +0 -102
- package/dist/bundle/{chunk-ZQ3GWKDQ.js → chunk-YVNHQFLC.js} +0 -0
- package/dist/bundle/{mdast-util-from-markdown-FXEPSNER.js → mdast-util-from-markdown-CE73EWJ2.js} +3 -3
|
@@ -1,22 +1,55 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
MAX_MODEL_IMAGE_BYTES,
|
|
5
|
+
checkedOptions,
|
|
6
|
+
messagesFor,
|
|
7
|
+
range,
|
|
8
|
+
systemFor,
|
|
9
|
+
validateImages
|
|
10
|
+
} from "./chunk-EZ2OLYEK.js";
|
|
3
11
|
import {
|
|
4
12
|
Unzip,
|
|
5
13
|
UnzipInflate
|
|
6
14
|
} from "./chunk-5DPV7X27.js";
|
|
15
|
+
import {
|
|
16
|
+
endpoint
|
|
17
|
+
} from "./chunk-OWMZUWCM.js";
|
|
18
|
+
import {
|
|
19
|
+
envName
|
|
20
|
+
} from "./chunk-IKHOIXJR.js";
|
|
7
21
|
import {
|
|
8
22
|
MAX_FILE_BYTES,
|
|
9
23
|
MAX_TEXT_CHARS,
|
|
10
24
|
attachmentMaxBytes
|
|
11
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-WVJHZIDH.js";
|
|
26
|
+
import {
|
|
27
|
+
isCliFailure
|
|
28
|
+
} from "./chunk-4AOINPN2.js";
|
|
29
|
+
import {
|
|
30
|
+
Credentials,
|
|
31
|
+
pathsAreOverridden,
|
|
32
|
+
resolvePaths
|
|
33
|
+
} from "./chunk-7AQGVX5O.js";
|
|
12
34
|
import {
|
|
13
35
|
importFrom,
|
|
14
36
|
resolveFrom
|
|
15
37
|
} from "./chunk-Y5E2WNWB.js";
|
|
38
|
+
import {
|
|
39
|
+
array,
|
|
40
|
+
integer,
|
|
41
|
+
number,
|
|
42
|
+
optional,
|
|
43
|
+
picklist,
|
|
44
|
+
pipe,
|
|
45
|
+
strictObject,
|
|
46
|
+
string,
|
|
47
|
+
union
|
|
48
|
+
} from "./chunk-TOVWMURV.js";
|
|
16
49
|
import {
|
|
17
50
|
CliError,
|
|
18
51
|
isCliError
|
|
19
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-ELJUBPY4.js";
|
|
20
53
|
import {
|
|
21
54
|
__commonJS,
|
|
22
55
|
__name,
|
|
@@ -808,15 +841,15 @@ var require_dom = __commonJS({
|
|
|
808
841
|
* @param {function} [options.nodeFilter]
|
|
809
842
|
* @returns {string}
|
|
810
843
|
*/
|
|
811
|
-
toString: /* @__PURE__ */ __name(function(
|
|
844
|
+
toString: /* @__PURE__ */ __name(function(options2) {
|
|
812
845
|
var opts;
|
|
813
|
-
if (typeof
|
|
814
|
-
opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter:
|
|
815
|
-
} else if (!!
|
|
846
|
+
if (typeof options2 === "function") {
|
|
847
|
+
opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: options2 };
|
|
848
|
+
} else if (!!options2) {
|
|
816
849
|
opts = {
|
|
817
|
-
requireWellFormed: !!
|
|
818
|
-
splitCDATASections:
|
|
819
|
-
nodeFilter:
|
|
850
|
+
requireWellFormed: !!options2.requireWellFormed,
|
|
851
|
+
splitCDATASections: options2.splitCDATASections !== false,
|
|
852
|
+
nodeFilter: options2.nodeFilter || null
|
|
820
853
|
};
|
|
821
854
|
} else {
|
|
822
855
|
opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: null };
|
|
@@ -1492,7 +1525,7 @@ var require_dom = __commonJS({
|
|
|
1492
1525
|
* @see https://dom.spec.whatwg.org/#dom-node-getrootnode
|
|
1493
1526
|
* @see https://dom.spec.whatwg.org/#concept-shadow-including-root
|
|
1494
1527
|
*/
|
|
1495
|
-
getRootNode: /* @__PURE__ */ __name(function(
|
|
1528
|
+
getRootNode: /* @__PURE__ */ __name(function(options2) {
|
|
1496
1529
|
var parent = this;
|
|
1497
1530
|
do {
|
|
1498
1531
|
if (!parent.parentNode) {
|
|
@@ -1951,9 +1984,9 @@ var require_dom = __commonJS({
|
|
|
1951
1984
|
walkDOM.STOP = /* @__PURE__ */ Symbol("walkDOM.STOP");
|
|
1952
1985
|
walkDOM.ENTER = 0;
|
|
1953
1986
|
walkDOM.EXIT = 1;
|
|
1954
|
-
function Document(symbol,
|
|
1987
|
+
function Document(symbol, options2) {
|
|
1955
1988
|
checkSymbol(symbol);
|
|
1956
|
-
var opt =
|
|
1989
|
+
var opt = options2 || {};
|
|
1957
1990
|
this.ownerDocument = this;
|
|
1958
1991
|
this.contentType = opt.contentType || MIME_TYPE.XML_APPLICATION;
|
|
1959
1992
|
this.type = isHTMLMimeType(this.contentType) ? "html" : "xml";
|
|
@@ -2854,19 +2887,19 @@ var require_dom = __commonJS({
|
|
|
2854
2887
|
function XMLSerializer() {
|
|
2855
2888
|
}
|
|
2856
2889
|
__name(XMLSerializer, "XMLSerializer");
|
|
2857
|
-
XMLSerializer.prototype.serializeToString = function(node,
|
|
2858
|
-
return nodeSerializeToString.call(node,
|
|
2890
|
+
XMLSerializer.prototype.serializeToString = function(node, options2) {
|
|
2891
|
+
return nodeSerializeToString.call(node, options2);
|
|
2859
2892
|
};
|
|
2860
2893
|
Node.prototype.toString = nodeSerializeToString;
|
|
2861
|
-
function nodeSerializeToString(
|
|
2894
|
+
function nodeSerializeToString(options2) {
|
|
2862
2895
|
var opts;
|
|
2863
|
-
if (typeof
|
|
2864
|
-
opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter:
|
|
2865
|
-
} else if (
|
|
2896
|
+
if (typeof options2 === "function") {
|
|
2897
|
+
opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: options2 };
|
|
2898
|
+
} else if (options2 != null) {
|
|
2866
2899
|
opts = {
|
|
2867
|
-
requireWellFormed: !!
|
|
2868
|
-
splitCDATASections:
|
|
2869
|
-
nodeFilter:
|
|
2900
|
+
requireWellFormed: !!options2.requireWellFormed,
|
|
2901
|
+
splitCDATASections: options2.splitCDATASections !== false,
|
|
2902
|
+
nodeFilter: options2.nodeFilter || null
|
|
2870
2903
|
};
|
|
2871
2904
|
} else {
|
|
2872
2905
|
opts = { requireWellFormed: false, splitCDATASections: true, nodeFilter: null };
|
|
@@ -6326,22 +6359,22 @@ var require_dom_parser = __commonJS({
|
|
|
6326
6359
|
return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028\u2029]/g, "\n");
|
|
6327
6360
|
}
|
|
6328
6361
|
__name(normalizeLineEndings, "normalizeLineEndings");
|
|
6329
|
-
function DOMParser2(
|
|
6330
|
-
|
|
6331
|
-
if (
|
|
6332
|
-
|
|
6333
|
-
}
|
|
6334
|
-
this.assign =
|
|
6335
|
-
this.domHandler =
|
|
6336
|
-
this.onError =
|
|
6337
|
-
if (
|
|
6362
|
+
function DOMParser2(options2) {
|
|
6363
|
+
options2 = options2 || {};
|
|
6364
|
+
if (options2.locator === void 0) {
|
|
6365
|
+
options2.locator = true;
|
|
6366
|
+
}
|
|
6367
|
+
this.assign = options2.assign || conventions.assign;
|
|
6368
|
+
this.domHandler = options2.domHandler || DOMHandler;
|
|
6369
|
+
this.onError = options2.onError || options2.errorHandler;
|
|
6370
|
+
if (options2.errorHandler && typeof options2.errorHandler !== "function") {
|
|
6338
6371
|
throw new TypeError("errorHandler object is no longer supported, switch to onError!");
|
|
6339
|
-
} else if (
|
|
6340
|
-
|
|
6372
|
+
} else if (options2.errorHandler) {
|
|
6373
|
+
options2.errorHandler("warning", "The `errorHandler` option has been deprecated, use `onError` instead!", this);
|
|
6341
6374
|
}
|
|
6342
|
-
this.normalizeLineEndings =
|
|
6343
|
-
this.locator = !!
|
|
6344
|
-
this.xmlns = this.assign(/* @__PURE__ */ Object.create(null),
|
|
6375
|
+
this.normalizeLineEndings = options2.normalizeLineEndings || normalizeLineEndings;
|
|
6376
|
+
this.locator = !!options2.locator;
|
|
6377
|
+
this.xmlns = this.assign(/* @__PURE__ */ Object.create(null), options2.xmlns);
|
|
6345
6378
|
}
|
|
6346
6379
|
__name(DOMParser2, "DOMParser");
|
|
6347
6380
|
DOMParser2.prototype.parseFromString = function(source, mimeType) {
|
|
@@ -6381,8 +6414,8 @@ var require_dom_parser = __commonJS({
|
|
|
6381
6414
|
}
|
|
6382
6415
|
return domBuilder.doc;
|
|
6383
6416
|
};
|
|
6384
|
-
function DOMHandler(
|
|
6385
|
-
var opt =
|
|
6417
|
+
function DOMHandler(options2) {
|
|
6418
|
+
var opt = options2 || {};
|
|
6386
6419
|
this.mimeType = opt.mimeType || MIME_TYPE.XML_APPLICATION;
|
|
6387
6420
|
this.defaultNamespace = opt.defaultNamespace || null;
|
|
6388
6421
|
this.cdata = false;
|
|
@@ -12878,7 +12911,7 @@ var require_bom_handling = __commonJS({
|
|
|
12878
12911
|
"use strict";
|
|
12879
12912
|
var BOMChar = "\uFEFF";
|
|
12880
12913
|
exports.PrependBOM = PrependBOMWrapper;
|
|
12881
|
-
function PrependBOMWrapper(encoder,
|
|
12914
|
+
function PrependBOMWrapper(encoder, options2) {
|
|
12882
12915
|
this.encoder = encoder;
|
|
12883
12916
|
this.addBOM = true;
|
|
12884
12917
|
}
|
|
@@ -12894,10 +12927,10 @@ var require_bom_handling = __commonJS({
|
|
|
12894
12927
|
return this.encoder.end();
|
|
12895
12928
|
};
|
|
12896
12929
|
exports.StripBOM = StripBOMWrapper;
|
|
12897
|
-
function StripBOMWrapper(
|
|
12898
|
-
this.decoder =
|
|
12930
|
+
function StripBOMWrapper(decoder3, options2) {
|
|
12931
|
+
this.decoder = decoder3;
|
|
12899
12932
|
this.pass = false;
|
|
12900
|
-
this.options =
|
|
12933
|
+
this.options = options2 || {};
|
|
12901
12934
|
}
|
|
12902
12935
|
__name(StripBOMWrapper, "StripBOMWrapper");
|
|
12903
12936
|
StripBOMWrapper.prototype.write = function(buf) {
|
|
@@ -12975,7 +13008,7 @@ var require_internal = __commonJS({
|
|
|
12975
13008
|
InternalCodec.prototype.encoder = InternalEncoder;
|
|
12976
13009
|
InternalCodec.prototype.decoder = InternalDecoder;
|
|
12977
13010
|
var StringDecoder = __require("string_decoder").StringDecoder;
|
|
12978
|
-
function InternalDecoder(
|
|
13011
|
+
function InternalDecoder(options2, codec) {
|
|
12979
13012
|
this.decoder = new StringDecoder(codec.enc);
|
|
12980
13013
|
}
|
|
12981
13014
|
__name(InternalDecoder, "InternalDecoder");
|
|
@@ -12988,7 +13021,7 @@ var require_internal = __commonJS({
|
|
|
12988
13021
|
InternalDecoder.prototype.end = function() {
|
|
12989
13022
|
return this.decoder.end();
|
|
12990
13023
|
};
|
|
12991
|
-
function InternalEncoder(
|
|
13024
|
+
function InternalEncoder(options2, codec) {
|
|
12992
13025
|
this.enc = codec.enc;
|
|
12993
13026
|
}
|
|
12994
13027
|
__name(InternalEncoder, "InternalEncoder");
|
|
@@ -12997,7 +13030,7 @@ var require_internal = __commonJS({
|
|
|
12997
13030
|
};
|
|
12998
13031
|
InternalEncoder.prototype.end = function() {
|
|
12999
13032
|
};
|
|
13000
|
-
function InternalEncoderBase64(
|
|
13033
|
+
function InternalEncoderBase64(options2, codec) {
|
|
13001
13034
|
this.prevStr = "";
|
|
13002
13035
|
}
|
|
13003
13036
|
__name(InternalEncoderBase64, "InternalEncoderBase64");
|
|
@@ -13011,7 +13044,7 @@ var require_internal = __commonJS({
|
|
|
13011
13044
|
InternalEncoderBase64.prototype.end = function() {
|
|
13012
13045
|
return Buffer2.from(this.prevStr, "base64");
|
|
13013
13046
|
};
|
|
13014
|
-
function InternalEncoderCesu8(
|
|
13047
|
+
function InternalEncoderCesu8(options2, codec) {
|
|
13015
13048
|
}
|
|
13016
13049
|
__name(InternalEncoderCesu8, "InternalEncoderCesu8");
|
|
13017
13050
|
InternalEncoderCesu8.prototype.write = function(str) {
|
|
@@ -13034,7 +13067,7 @@ var require_internal = __commonJS({
|
|
|
13034
13067
|
};
|
|
13035
13068
|
InternalEncoderCesu8.prototype.end = function() {
|
|
13036
13069
|
};
|
|
13037
|
-
function InternalDecoderCesu8(
|
|
13070
|
+
function InternalDecoderCesu8(options2, codec) {
|
|
13038
13071
|
this.acc = 0;
|
|
13039
13072
|
this.contBytes = 0;
|
|
13040
13073
|
this.accBytes = 0;
|
|
@@ -13097,7 +13130,7 @@ var require_internal = __commonJS({
|
|
|
13097
13130
|
}
|
|
13098
13131
|
return res;
|
|
13099
13132
|
};
|
|
13100
|
-
function InternalEncoderUtf8(
|
|
13133
|
+
function InternalEncoderUtf8(options2, codec) {
|
|
13101
13134
|
this.highSurrogate = "";
|
|
13102
13135
|
}
|
|
13103
13136
|
__name(InternalEncoderUtf8, "InternalEncoderUtf8");
|
|
@@ -13143,7 +13176,7 @@ var require_utf32 = __commonJS({
|
|
|
13143
13176
|
exports.ucs4be = "utf32be";
|
|
13144
13177
|
Utf32Codec.prototype.encoder = Utf32Encoder;
|
|
13145
13178
|
Utf32Codec.prototype.decoder = Utf32Decoder;
|
|
13146
|
-
function Utf32Encoder(
|
|
13179
|
+
function Utf32Encoder(options2, codec) {
|
|
13147
13180
|
this.isLE = codec.isLE;
|
|
13148
13181
|
this.highSurrogate = 0;
|
|
13149
13182
|
}
|
|
@@ -13195,7 +13228,7 @@ var require_utf32 = __commonJS({
|
|
|
13195
13228
|
this.highSurrogate = 0;
|
|
13196
13229
|
return buf;
|
|
13197
13230
|
};
|
|
13198
|
-
function Utf32Decoder(
|
|
13231
|
+
function Utf32Decoder(options2, codec) {
|
|
13199
13232
|
this.isLE = codec.isLE;
|
|
13200
13233
|
this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0);
|
|
13201
13234
|
this.overflow = [];
|
|
@@ -13264,18 +13297,18 @@ var require_utf32 = __commonJS({
|
|
|
13264
13297
|
};
|
|
13265
13298
|
exports.utf32 = Utf32AutoCodec;
|
|
13266
13299
|
exports.ucs4 = "utf32";
|
|
13267
|
-
function Utf32AutoCodec(
|
|
13300
|
+
function Utf32AutoCodec(options2, iconv3) {
|
|
13268
13301
|
this.iconv = iconv3;
|
|
13269
13302
|
}
|
|
13270
13303
|
__name(Utf32AutoCodec, "Utf32AutoCodec");
|
|
13271
13304
|
Utf32AutoCodec.prototype.encoder = Utf32AutoEncoder;
|
|
13272
13305
|
Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder;
|
|
13273
|
-
function Utf32AutoEncoder(
|
|
13274
|
-
|
|
13275
|
-
if (
|
|
13276
|
-
|
|
13306
|
+
function Utf32AutoEncoder(options2, codec) {
|
|
13307
|
+
options2 = options2 || {};
|
|
13308
|
+
if (options2.addBOM === void 0) {
|
|
13309
|
+
options2.addBOM = true;
|
|
13277
13310
|
}
|
|
13278
|
-
this.encoder = codec.iconv.getEncoder(
|
|
13311
|
+
this.encoder = codec.iconv.getEncoder(options2.defaultEncoding || "utf-32le", options2);
|
|
13279
13312
|
}
|
|
13280
13313
|
__name(Utf32AutoEncoder, "Utf32AutoEncoder");
|
|
13281
13314
|
Utf32AutoEncoder.prototype.write = function(str) {
|
|
@@ -13284,11 +13317,11 @@ var require_utf32 = __commonJS({
|
|
|
13284
13317
|
Utf32AutoEncoder.prototype.end = function() {
|
|
13285
13318
|
return this.encoder.end();
|
|
13286
13319
|
};
|
|
13287
|
-
function Utf32AutoDecoder(
|
|
13320
|
+
function Utf32AutoDecoder(options2, codec) {
|
|
13288
13321
|
this.decoder = null;
|
|
13289
13322
|
this.initialBufs = [];
|
|
13290
13323
|
this.initialBufsLen = 0;
|
|
13291
|
-
this.options =
|
|
13324
|
+
this.options = options2 || {};
|
|
13292
13325
|
this.iconv = codec.iconv;
|
|
13293
13326
|
}
|
|
13294
13327
|
__name(Utf32AutoDecoder, "Utf32AutoDecoder");
|
|
@@ -13428,12 +13461,12 @@ var require_utf16 = __commonJS({
|
|
|
13428
13461
|
__name(Utf16Codec, "Utf16Codec");
|
|
13429
13462
|
Utf16Codec.prototype.encoder = Utf16Encoder;
|
|
13430
13463
|
Utf16Codec.prototype.decoder = Utf16Decoder;
|
|
13431
|
-
function Utf16Encoder(
|
|
13432
|
-
|
|
13433
|
-
if (
|
|
13434
|
-
|
|
13464
|
+
function Utf16Encoder(options2, codec) {
|
|
13465
|
+
options2 = options2 || {};
|
|
13466
|
+
if (options2.addBOM === void 0) {
|
|
13467
|
+
options2.addBOM = true;
|
|
13435
13468
|
}
|
|
13436
|
-
this.encoder = codec.iconv.getEncoder("utf-16le",
|
|
13469
|
+
this.encoder = codec.iconv.getEncoder("utf-16le", options2);
|
|
13437
13470
|
}
|
|
13438
13471
|
__name(Utf16Encoder, "Utf16Encoder");
|
|
13439
13472
|
Utf16Encoder.prototype.write = function(str) {
|
|
@@ -13442,11 +13475,11 @@ var require_utf16 = __commonJS({
|
|
|
13442
13475
|
Utf16Encoder.prototype.end = function() {
|
|
13443
13476
|
return this.encoder.end();
|
|
13444
13477
|
};
|
|
13445
|
-
function Utf16Decoder(
|
|
13478
|
+
function Utf16Decoder(options2, codec) {
|
|
13446
13479
|
this.decoder = null;
|
|
13447
13480
|
this.initialBufs = [];
|
|
13448
13481
|
this.initialBufsLen = 0;
|
|
13449
|
-
this.options =
|
|
13482
|
+
this.options = options2 || {};
|
|
13450
13483
|
this.iconv = codec.iconv;
|
|
13451
13484
|
}
|
|
13452
13485
|
__name(Utf16Decoder, "Utf16Decoder");
|
|
@@ -13533,7 +13566,7 @@ var require_utf7 = __commonJS({
|
|
|
13533
13566
|
Utf7Codec.prototype.decoder = Utf7Decoder;
|
|
13534
13567
|
Utf7Codec.prototype.bomAware = true;
|
|
13535
13568
|
var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
|
|
13536
|
-
function Utf7Encoder(
|
|
13569
|
+
function Utf7Encoder(options2, codec) {
|
|
13537
13570
|
this.iconv = codec.iconv;
|
|
13538
13571
|
}
|
|
13539
13572
|
__name(Utf7Encoder, "Utf7Encoder");
|
|
@@ -13544,7 +13577,7 @@ var require_utf7 = __commonJS({
|
|
|
13544
13577
|
};
|
|
13545
13578
|
Utf7Encoder.prototype.end = function() {
|
|
13546
13579
|
};
|
|
13547
|
-
function Utf7Decoder(
|
|
13580
|
+
function Utf7Decoder(options2, codec) {
|
|
13548
13581
|
this.iconv = codec.iconv;
|
|
13549
13582
|
this.inBase64 = false;
|
|
13550
13583
|
this.base64Accum = "";
|
|
@@ -13618,7 +13651,7 @@ var require_utf7 = __commonJS({
|
|
|
13618
13651
|
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;
|
|
13619
13652
|
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;
|
|
13620
13653
|
Utf7IMAPCodec.prototype.bomAware = true;
|
|
13621
|
-
function Utf7IMAPEncoder(
|
|
13654
|
+
function Utf7IMAPEncoder(options2, codec) {
|
|
13622
13655
|
this.iconv = codec.iconv;
|
|
13623
13656
|
this.inBase64 = false;
|
|
13624
13657
|
this.base64Accum = Buffer2.alloc(6);
|
|
@@ -13680,7 +13713,7 @@ var require_utf7 = __commonJS({
|
|
|
13680
13713
|
}
|
|
13681
13714
|
return buf.slice(0, bufIdx);
|
|
13682
13715
|
};
|
|
13683
|
-
function Utf7IMAPDecoder(
|
|
13716
|
+
function Utf7IMAPDecoder(options2, codec) {
|
|
13684
13717
|
this.iconv = codec.iconv;
|
|
13685
13718
|
this.inBase64 = false;
|
|
13686
13719
|
this.base64Accum = "";
|
|
@@ -13772,7 +13805,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
13772
13805
|
__name(SBCSCodec, "SBCSCodec");
|
|
13773
13806
|
SBCSCodec.prototype.encoder = SBCSEncoder;
|
|
13774
13807
|
SBCSCodec.prototype.decoder = SBCSDecoder;
|
|
13775
|
-
function SBCSEncoder(
|
|
13808
|
+
function SBCSEncoder(options2, codec) {
|
|
13776
13809
|
this.encodeBuf = codec.encodeBuf;
|
|
13777
13810
|
}
|
|
13778
13811
|
__name(SBCSEncoder, "SBCSEncoder");
|
|
@@ -13785,7 +13818,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
13785
13818
|
};
|
|
13786
13819
|
SBCSEncoder.prototype.end = function() {
|
|
13787
13820
|
};
|
|
13788
|
-
function SBCSDecoder(
|
|
13821
|
+
function SBCSDecoder(options2, codec) {
|
|
13789
13822
|
this.decodeBuf = codec.decodeBuf;
|
|
13790
13823
|
}
|
|
13791
13824
|
__name(SBCSDecoder, "SBCSDecoder");
|
|
@@ -14649,7 +14682,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
14649
14682
|
}
|
|
14650
14683
|
return hasValues;
|
|
14651
14684
|
};
|
|
14652
|
-
function DBCSEncoder(
|
|
14685
|
+
function DBCSEncoder(options2, codec) {
|
|
14653
14686
|
this.leadSurrogate = -1;
|
|
14654
14687
|
this.seqObj = void 0;
|
|
14655
14688
|
this.encodeTable = codec.encodeTable;
|
|
@@ -14785,7 +14818,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
14785
14818
|
return newBuf.slice(0, j);
|
|
14786
14819
|
};
|
|
14787
14820
|
DBCSEncoder.prototype.findIdx = findIdx;
|
|
14788
|
-
function DBCSDecoder(
|
|
14821
|
+
function DBCSDecoder(options2, codec) {
|
|
14789
14822
|
this.nodeIdx = 0;
|
|
14790
14823
|
this.prevBytes = [];
|
|
14791
14824
|
this.decodeTables = codec.decodeTables;
|
|
@@ -16408,11 +16441,11 @@ var require_streams = __commonJS({
|
|
|
16408
16441
|
var Buffer2 = require_safer().Buffer;
|
|
16409
16442
|
module.exports = function(streamModule) {
|
|
16410
16443
|
var Transform = streamModule.Transform;
|
|
16411
|
-
function IconvLiteEncoderStream(conv,
|
|
16444
|
+
function IconvLiteEncoderStream(conv, options2) {
|
|
16412
16445
|
this.conv = conv;
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
Transform.call(this,
|
|
16446
|
+
options2 = options2 || {};
|
|
16447
|
+
options2.decodeStrings = false;
|
|
16448
|
+
Transform.call(this, options2);
|
|
16416
16449
|
}
|
|
16417
16450
|
__name(IconvLiteEncoderStream, "IconvLiteEncoderStream");
|
|
16418
16451
|
IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
|
|
@@ -16450,11 +16483,11 @@ var require_streams = __commonJS({
|
|
|
16450
16483
|
});
|
|
16451
16484
|
return this;
|
|
16452
16485
|
};
|
|
16453
|
-
function IconvLiteDecoderStream(conv,
|
|
16486
|
+
function IconvLiteDecoderStream(conv, options2) {
|
|
16454
16487
|
this.conv = conv;
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
Transform.call(this,
|
|
16488
|
+
options2 = options2 || {};
|
|
16489
|
+
options2.encoding = this.encoding = "utf8";
|
|
16490
|
+
Transform.call(this, options2);
|
|
16458
16491
|
}
|
|
16459
16492
|
__name(IconvLiteDecoderStream, "IconvLiteDecoderStream");
|
|
16460
16493
|
IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
|
|
@@ -16510,14 +16543,14 @@ var require_lib3 = __commonJS({
|
|
|
16510
16543
|
module.exports.encodings = null;
|
|
16511
16544
|
module.exports.defaultCharUnicode = "\uFFFD";
|
|
16512
16545
|
module.exports.defaultCharSingleByte = "?";
|
|
16513
|
-
module.exports.encode = /* @__PURE__ */ __name(function encode(str, encoding,
|
|
16546
|
+
module.exports.encode = /* @__PURE__ */ __name(function encode(str, encoding, options2) {
|
|
16514
16547
|
str = "" + (str || "");
|
|
16515
|
-
var encoder = module.exports.getEncoder(encoding,
|
|
16548
|
+
var encoder = module.exports.getEncoder(encoding, options2);
|
|
16516
16549
|
var res = encoder.write(str);
|
|
16517
16550
|
var trail = encoder.end();
|
|
16518
16551
|
return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
|
|
16519
16552
|
}, "encode");
|
|
16520
|
-
module.exports.decode = /* @__PURE__ */ __name(function decode2(buf, encoding,
|
|
16553
|
+
module.exports.decode = /* @__PURE__ */ __name(function decode2(buf, encoding, options2) {
|
|
16521
16554
|
if (typeof buf === "string") {
|
|
16522
16555
|
if (!module.exports.skipDecodeWarning) {
|
|
16523
16556
|
console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
|
|
@@ -16525,9 +16558,9 @@ var require_lib3 = __commonJS({
|
|
|
16525
16558
|
}
|
|
16526
16559
|
buf = Buffer2.from("" + (buf || ""), "binary");
|
|
16527
16560
|
}
|
|
16528
|
-
var
|
|
16529
|
-
var res =
|
|
16530
|
-
var trail =
|
|
16561
|
+
var decoder3 = module.exports.getDecoder(encoding, options2);
|
|
16562
|
+
var res = decoder3.write(buf);
|
|
16563
|
+
var trail = decoder3.end();
|
|
16531
16564
|
return trail ? res + trail : res;
|
|
16532
16565
|
}, "decode");
|
|
16533
16566
|
module.exports.encodingExists = /* @__PURE__ */ __name(function encodingExists(enc) {
|
|
@@ -16583,21 +16616,21 @@ var require_lib3 = __commonJS({
|
|
|
16583
16616
|
module.exports._canonicalizeEncoding = function(encoding) {
|
|
16584
16617
|
return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
|
|
16585
16618
|
};
|
|
16586
|
-
module.exports.getEncoder = /* @__PURE__ */ __name(function getEncoder(encoding,
|
|
16619
|
+
module.exports.getEncoder = /* @__PURE__ */ __name(function getEncoder(encoding, options2) {
|
|
16587
16620
|
var codec = module.exports.getCodec(encoding);
|
|
16588
|
-
var encoder = new codec.encoder(
|
|
16589
|
-
if (codec.bomAware &&
|
|
16590
|
-
encoder = new bomHandling.PrependBOM(encoder,
|
|
16621
|
+
var encoder = new codec.encoder(options2, codec);
|
|
16622
|
+
if (codec.bomAware && options2 && options2.addBOM) {
|
|
16623
|
+
encoder = new bomHandling.PrependBOM(encoder, options2);
|
|
16591
16624
|
}
|
|
16592
16625
|
return encoder;
|
|
16593
16626
|
}, "getEncoder");
|
|
16594
|
-
module.exports.getDecoder = /* @__PURE__ */ __name(function getDecoder(encoding,
|
|
16627
|
+
module.exports.getDecoder = /* @__PURE__ */ __name(function getDecoder(encoding, options2) {
|
|
16595
16628
|
var codec = module.exports.getCodec(encoding);
|
|
16596
|
-
var
|
|
16597
|
-
if (codec.bomAware && !(
|
|
16598
|
-
|
|
16629
|
+
var decoder3 = new codec.decoder(options2, codec);
|
|
16630
|
+
if (codec.bomAware && !(options2 && options2.stripBOM === false)) {
|
|
16631
|
+
decoder3 = new bomHandling.StripBOM(decoder3, options2);
|
|
16599
16632
|
}
|
|
16600
|
-
return
|
|
16633
|
+
return decoder3;
|
|
16601
16634
|
}, "getDecoder");
|
|
16602
16635
|
module.exports.enableStreamingAPI = /* @__PURE__ */ __name(function enableStreamingAPI(streamModule2) {
|
|
16603
16636
|
if (module.exports.supportsStreams) {
|
|
@@ -16606,11 +16639,11 @@ var require_lib3 = __commonJS({
|
|
|
16606
16639
|
var streams = require_streams()(streamModule2);
|
|
16607
16640
|
module.exports.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
|
|
16608
16641
|
module.exports.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
|
|
16609
|
-
module.exports.encodeStream = /* @__PURE__ */ __name(function encodeStream(encoding,
|
|
16610
|
-
return new module.exports.IconvLiteEncoderStream(module.exports.getEncoder(encoding,
|
|
16642
|
+
module.exports.encodeStream = /* @__PURE__ */ __name(function encodeStream(encoding, options2) {
|
|
16643
|
+
return new module.exports.IconvLiteEncoderStream(module.exports.getEncoder(encoding, options2), options2);
|
|
16611
16644
|
}, "encodeStream");
|
|
16612
|
-
module.exports.decodeStream = /* @__PURE__ */ __name(function decodeStream(encoding,
|
|
16613
|
-
return new module.exports.IconvLiteDecoderStream(module.exports.getDecoder(encoding,
|
|
16645
|
+
module.exports.decodeStream = /* @__PURE__ */ __name(function decodeStream(encoding, options2) {
|
|
16646
|
+
return new module.exports.IconvLiteDecoderStream(module.exports.getDecoder(encoding, options2), options2);
|
|
16614
16647
|
}, "decodeStream");
|
|
16615
16648
|
module.exports.supportsStreams = true;
|
|
16616
16649
|
}, "enableStreamingAPI");
|
|
@@ -16632,20 +16665,20 @@ var require_lib3 = __commonJS({
|
|
|
16632
16665
|
}
|
|
16633
16666
|
});
|
|
16634
16667
|
|
|
16635
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16668
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/extract.js
|
|
16636
16669
|
import { extname as extname2 } from "node:path";
|
|
16637
16670
|
|
|
16638
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16671
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/engine.js
|
|
16639
16672
|
import { readFileSync } from "node:fs";
|
|
16640
16673
|
import { dirname, extname, join } from "node:path";
|
|
16641
16674
|
import { fileURLToPath } from "node:url";
|
|
16642
16675
|
|
|
16643
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16676
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/container.js
|
|
16644
16677
|
import { setImmediate as tick } from "node:timers/promises";
|
|
16645
16678
|
import { crc32 } from "node:zlib";
|
|
16646
16679
|
var import_xmldom = __toESM(require_lib(), 1);
|
|
16647
16680
|
|
|
16648
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16681
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
|
|
16649
16682
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
16650
16683
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
16651
16684
|
var SAMPLE = 65536;
|
|
@@ -16674,13 +16707,13 @@ var canonicalEncoding = /* @__PURE__ */ __name((label) => {
|
|
|
16674
16707
|
var decode = /* @__PURE__ */ __name((bytes, label) => {
|
|
16675
16708
|
try {
|
|
16676
16709
|
const encoding = canonicalEncoding(label);
|
|
16677
|
-
let
|
|
16710
|
+
let decoder3;
|
|
16678
16711
|
try {
|
|
16679
|
-
|
|
16712
|
+
decoder3 = new TextDecoder(encoding, { fatal: true });
|
|
16680
16713
|
} catch {
|
|
16681
16714
|
}
|
|
16682
|
-
const text =
|
|
16683
|
-
if (!
|
|
16715
|
+
const text = decoder3 ? decoder3.decode(bytes) : import_iconv_lite.default.decode(Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength), encoding);
|
|
16716
|
+
if (!decoder3 && text.includes("\uFFFD"))
|
|
16684
16717
|
return { error: "invalid_encoding" };
|
|
16685
16718
|
const binary = encoding.startsWith("utf-") ? text.includes("\0") : invalidText(text);
|
|
16686
16719
|
return binary ? { error: "binary" } : { text, encoding };
|
|
@@ -16747,7 +16780,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes) => {
|
|
|
16747
16780
|
return result.text;
|
|
16748
16781
|
}, "decodeXml");
|
|
16749
16782
|
|
|
16750
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16783
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/container.js
|
|
16751
16784
|
var MAX_PART = 10 * 1024 * 1024;
|
|
16752
16785
|
var MAX_ENTRIES = 1e3;
|
|
16753
16786
|
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
@@ -16962,7 +16995,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
|
|
|
16962
16995
|
return found;
|
|
16963
16996
|
}, "elements");
|
|
16964
16997
|
|
|
16965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16998
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/engine.js
|
|
16966
16999
|
var BUILT_IN = ["unpdf", "mammoth", "word-extractor", "linkedom", "defuddle/node"];
|
|
16967
17000
|
var ENGINES = [...BUILT_IN, "@napi-rs/canvas"];
|
|
16968
17001
|
var isMissing = /* @__PURE__ */ __name((error, name) => error?.code === "ERR_MODULE_NOT_FOUND" && String(error.message).includes(name), "isMissing");
|
|
@@ -17020,7 +17053,7 @@ var derived = /* @__PURE__ */ __name((bytes, extractor, read) => {
|
|
|
17020
17053
|
}
|
|
17021
17054
|
}, "derived");
|
|
17022
17055
|
|
|
17023
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17056
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/image/index.js
|
|
17024
17057
|
var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
|
|
17025
17058
|
var image = {
|
|
17026
17059
|
id: "image",
|
|
@@ -17029,7 +17062,7 @@ var image = {
|
|
|
17029
17062
|
read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
|
|
17030
17063
|
};
|
|
17031
17064
|
|
|
17032
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17065
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
|
|
17033
17066
|
var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
|
|
17034
17067
|
var doc = {
|
|
17035
17068
|
id: "doc",
|
|
@@ -17041,7 +17074,7 @@ var doc = {
|
|
|
17041
17074
|
}), "read")
|
|
17042
17075
|
};
|
|
17043
17076
|
|
|
17044
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17077
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
|
|
17045
17078
|
var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
17046
17079
|
var docx = {
|
|
17047
17080
|
id: "docx",
|
|
@@ -17054,7 +17087,7 @@ var docx = {
|
|
|
17054
17087
|
}), "read")
|
|
17055
17088
|
};
|
|
17056
17089
|
|
|
17057
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17090
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/markup.js
|
|
17058
17091
|
var import_iconv_lite2 = __toESM(require_lib3(), 1);
|
|
17059
17092
|
var RTF_SKIPPED = /* @__PURE__ */ new Set([
|
|
17060
17093
|
"fonttbl",
|
|
@@ -17230,7 +17263,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
|
|
|
17230
17263
|
}, "htmlText");
|
|
17231
17264
|
var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
|
|
17232
17265
|
|
|
17233
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17266
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/html/page.js
|
|
17234
17267
|
var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
|
|
17235
17268
|
var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
|
|
17236
17269
|
var jsonLdNodes = /* @__PURE__ */ __name((document) => {
|
|
@@ -17286,7 +17319,7 @@ var markdownSections = /* @__PURE__ */ __name((text) => {
|
|
|
17286
17319
|
return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text.length }));
|
|
17287
17320
|
}, "markdownSections");
|
|
17288
17321
|
|
|
17289
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17322
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/html/index.js
|
|
17290
17323
|
var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
|
|
17291
17324
|
var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
|
|
17292
17325
|
var loaded = /* @__PURE__ */ __name(async (load, name) => {
|
|
@@ -17357,10 +17390,10 @@ var html = {
|
|
|
17357
17390
|
}, "read")
|
|
17358
17391
|
};
|
|
17359
17392
|
|
|
17360
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17393
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/documents.js
|
|
17361
17394
|
import { posix } from "node:path";
|
|
17362
17395
|
|
|
17363
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17396
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
|
|
17364
17397
|
var columnName = /* @__PURE__ */ __name((column) => {
|
|
17365
17398
|
let name = "";
|
|
17366
17399
|
for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
|
|
@@ -17415,7 +17448,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
|
|
|
17415
17448
|
return { text: parts.join("").trim(), truncated: false };
|
|
17416
17449
|
}, "sheetText");
|
|
17417
17450
|
|
|
17418
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17451
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/documents.js
|
|
17419
17452
|
var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
|
|
17420
17453
|
var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
|
|
17421
17454
|
var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
|
|
@@ -17517,14 +17550,14 @@ var relationships = /* @__PURE__ */ __name((archive, owner) => {
|
|
|
17517
17550
|
}, "relationships");
|
|
17518
17551
|
var relationId = /* @__PURE__ */ __name((element) => required(attribute(element, "id", REL) || attribute(element, "id", STRICT_REL)), "relationId");
|
|
17519
17552
|
var mainPart = /* @__PURE__ */ __name((archive, contentType) => {
|
|
17520
|
-
const
|
|
17553
|
+
const types2 = xmlPart(archive, "[Content_Types].xml");
|
|
17521
17554
|
const namespace = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
17522
|
-
rootIs(
|
|
17555
|
+
rootIs(types2, "Types", [namespace]);
|
|
17523
17556
|
const matches = [...relationships(archive, "").values()].filter((entry) => entry.type.endsWith("/officeDocument"));
|
|
17524
17557
|
if (matches.length !== 1)
|
|
17525
17558
|
throw new Error("missing_main_part");
|
|
17526
17559
|
const path = matches[0]?.path;
|
|
17527
|
-
if (!elements(
|
|
17560
|
+
if (!elements(types2, "Override", namespace).some((entry) => attribute(entry, "PartName") === `/${path}` && attribute(entry, "ContentType") === contentType))
|
|
17528
17561
|
throw new Error("wrong_format");
|
|
17529
17562
|
return path;
|
|
17530
17563
|
}, "mainPart");
|
|
@@ -17727,14 +17760,14 @@ var readSlides = /* @__PURE__ */ __name((archive, output) => {
|
|
|
17727
17760
|
const document = xmlPart(archive, path);
|
|
17728
17761
|
const namespace = rootIs(document, "presentation", [SLIDE, "http://purl.oclc.org/ooxml/presentationml/main"]);
|
|
17729
17762
|
const rels = relationships(archive, path);
|
|
17730
|
-
let
|
|
17763
|
+
let number2 = 0;
|
|
17731
17764
|
for (const slide of elements(document, "sldId", namespace)) {
|
|
17732
17765
|
const relationship = rels.get(relationId(slide));
|
|
17733
17766
|
if (!relationship?.type.endsWith("/slide"))
|
|
17734
17767
|
throw new Error("missing_slide");
|
|
17735
17768
|
const content = xmlPart(archive, relationship.path);
|
|
17736
17769
|
rootIs(content, "sld", [namespace]);
|
|
17737
|
-
output.section(`Slide ${++
|
|
17770
|
+
output.section(`Slide ${++number2}`);
|
|
17738
17771
|
const drawing = namespace === SLIDE ? DRAW : "http://purl.oclc.org/ooxml/drawingml/main";
|
|
17739
17772
|
for (const paragraph of elements(content, "p", drawing))
|
|
17740
17773
|
output.add(`${drawingText(paragraph, drawing)}
|
|
@@ -17757,7 +17790,7 @@ var readBook = /* @__PURE__ */ __name((archive, output) => {
|
|
|
17757
17790
|
throw new Error("duplicate_chapter");
|
|
17758
17791
|
manifest.set(id, { path: target(path, required(attribute(item, "href"))), type: attribute(item, "media-type") });
|
|
17759
17792
|
}
|
|
17760
|
-
let
|
|
17793
|
+
let number2 = 0;
|
|
17761
17794
|
const chapters = elements(book, "itemref", OPF);
|
|
17762
17795
|
if (!chapters.length)
|
|
17763
17796
|
throw new Error("missing_chapters");
|
|
@@ -17769,7 +17802,7 @@ var readBook = /* @__PURE__ */ __name((archive, output) => {
|
|
|
17769
17802
|
const bodies = elements(document, "body", XHTML);
|
|
17770
17803
|
if (bodies.length !== 1)
|
|
17771
17804
|
throw new Error("missing_chapter");
|
|
17772
|
-
output.section(`Chapter ${++
|
|
17805
|
+
output.section(`Chapter ${++number2}`);
|
|
17773
17806
|
const visit = /* @__PURE__ */ __name((node) => {
|
|
17774
17807
|
if (node.nodeType === 3 || node.nodeType === 4) {
|
|
17775
17808
|
output.add(node.nodeValue ?? "");
|
|
@@ -17830,7 +17863,7 @@ var readDocument = /* @__PURE__ */ __name(async (bytes, kind, signal) => {
|
|
|
17830
17863
|
}
|
|
17831
17864
|
}, "readDocument");
|
|
17832
17865
|
|
|
17833
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17866
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/office/index.js
|
|
17834
17867
|
var office = {
|
|
17835
17868
|
id: "office",
|
|
17836
17869
|
version: documentExtractor("odt"),
|
|
@@ -17841,7 +17874,7 @@ var office = {
|
|
|
17841
17874
|
}, "read")
|
|
17842
17875
|
};
|
|
17843
17876
|
|
|
17844
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17877
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
|
|
17845
17878
|
var pdf = {
|
|
17846
17879
|
id: "pdf",
|
|
17847
17880
|
version: "unpdf",
|
|
@@ -17908,7 +17941,7 @@ var pdf = {
|
|
|
17908
17941
|
}), "read")
|
|
17909
17942
|
};
|
|
17910
17943
|
|
|
17911
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17944
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
|
|
17912
17945
|
var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
|
|
17913
17946
|
var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
|
|
17914
17947
|
var readPlain = /* @__PURE__ */ __name((bytes) => {
|
|
@@ -17928,7 +17961,7 @@ var plain = {
|
|
|
17928
17961
|
read: /* @__PURE__ */ __name(async (bytes) => readPlain(bytes), "read")
|
|
17929
17962
|
};
|
|
17930
17963
|
|
|
17931
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17964
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
|
|
17932
17965
|
var rtf = {
|
|
17933
17966
|
id: "rtf",
|
|
17934
17967
|
version: "v1",
|
|
@@ -17936,10 +17969,10 @@ var rtf = {
|
|
|
17936
17969
|
read: /* @__PURE__ */ __name(async (bytes) => derived(bytes, "rtf:v1", rtfText), "read")
|
|
17937
17970
|
};
|
|
17938
17971
|
|
|
17939
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17972
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
|
|
17940
17973
|
import { basename } from "node:path";
|
|
17941
17974
|
|
|
17942
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17975
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
|
|
17943
17976
|
var delimitedSpans = /* @__PURE__ */ __name((text, delimiter, maxCells = 1e4) => {
|
|
17944
17977
|
const cells = [];
|
|
17945
17978
|
let row = 1, column = 1, start = 0, quoted = false, truncated = false;
|
|
@@ -17977,7 +18010,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text, delimiter, maxCells = 1e4) =>
|
|
|
17977
18010
|
return { cells, truncated };
|
|
17978
18011
|
}, "delimitedSpans");
|
|
17979
18012
|
|
|
17980
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18013
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
|
|
17981
18014
|
var DELIMITED = {
|
|
17982
18015
|
".csv": ",",
|
|
17983
18016
|
".tsv": " ",
|
|
@@ -18016,7 +18049,7 @@ var sheets = {
|
|
|
18016
18049
|
}, "read")
|
|
18017
18050
|
};
|
|
18018
18051
|
|
|
18019
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18052
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/readers/registry.js
|
|
18020
18053
|
var BUILT_INS = [office, pdf, docx, doc, rtf, html, sheets, plain, image];
|
|
18021
18054
|
var HEAD_BYTES = 1024;
|
|
18022
18055
|
var readers = [...BUILT_INS];
|
|
@@ -18026,7 +18059,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes, hint, context) => {
|
|
|
18026
18059
|
return reader ? reader.read(bytes, hint, context) : { status: "unsupported" };
|
|
18027
18060
|
}, "readWithRegistry");
|
|
18028
18061
|
|
|
18029
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18062
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/extract.js
|
|
18030
18063
|
var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
|
|
18031
18064
|
var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname2(name ?? path).toLowerCase(), "extensionOf");
|
|
18032
18065
|
var extractText = /* @__PURE__ */ __name(async (bytes, hint, load, signal, env = process.env) => {
|
|
@@ -18064,7 +18097,40 @@ var engineStates = /* @__PURE__ */ __name((resolve = (name) => resolveFrom(new U
|
|
|
18064
18097
|
}
|
|
18065
18098
|
})), "engineStates");
|
|
18066
18099
|
|
|
18067
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
|
|
18101
|
+
var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
|
|
18102
|
+
const host = new URL(baseUrl).host;
|
|
18103
|
+
return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
|
|
18104
|
+
}, "endpointKeyName");
|
|
18105
|
+
var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) => {
|
|
18106
|
+
const where = { appName: app.appName, prefix: app.envPrefix, env };
|
|
18107
|
+
const credentials = /* @__PURE__ */ __name((provider) => new Credentials({
|
|
18108
|
+
configDir: resolvePaths(where).config,
|
|
18109
|
+
service: app.appName,
|
|
18110
|
+
...["openai", "anthropic"].includes(provider) ? { envVar: envName(app, `${provider.toUpperCase()}_API_KEY`) } : {},
|
|
18111
|
+
isolated: pathsAreOverridden(where),
|
|
18112
|
+
env,
|
|
18113
|
+
...keyring ? { keyring } : {},
|
|
18114
|
+
warn: /* @__PURE__ */ __name((message) => process.stderr.write(`${message}
|
|
18115
|
+
`), "warn")
|
|
18116
|
+
}), "credentials");
|
|
18117
|
+
const account = /* @__PURE__ */ __name((provider) => `embeddings:${provider}`, "account");
|
|
18118
|
+
return {
|
|
18119
|
+
read: /* @__PURE__ */ __name((provider) => {
|
|
18120
|
+
const stored = credentials(provider).read(account(provider));
|
|
18121
|
+
if (stored)
|
|
18122
|
+
return { key: stored.secret, source: stored.source };
|
|
18123
|
+
const shared = ["openai", "anthropic"].includes(provider) ? env[`${provider.toUpperCase()}_API_KEY`]?.trim() : void 0;
|
|
18124
|
+
return shared ? { key: shared, source: "env" } : void 0;
|
|
18125
|
+
}, "read"),
|
|
18126
|
+
/** A key kept under the provider's own name, as an owner may have stored it by hand for the whole tool. */
|
|
18127
|
+
readPlain: /* @__PURE__ */ __name((provider) => credentials(provider).read(provider)?.secret, "readPlain"),
|
|
18128
|
+
write: /* @__PURE__ */ __name((provider, key) => credentials(provider).write(account(provider), key, { signIn: true }), "write"),
|
|
18129
|
+
remove: /* @__PURE__ */ __name((provider) => credentials(provider).remove(account(provider)), "remove")
|
|
18130
|
+
};
|
|
18131
|
+
}, "embeddingKeys");
|
|
18132
|
+
|
|
18133
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/http/time-limit.js
|
|
18068
18134
|
var timeLimit = /* @__PURE__ */ __name((ms) => {
|
|
18069
18135
|
const controller = new AbortController();
|
|
18070
18136
|
const timer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
|
|
@@ -18080,8 +18146,1334 @@ var withTimeLimit = /* @__PURE__ */ __name(async (ms, run) => {
|
|
|
18080
18146
|
}
|
|
18081
18147
|
}, "withTimeLimit");
|
|
18082
18148
|
|
|
18149
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/models/openai.js
|
|
18150
|
+
var options = strictObject({
|
|
18151
|
+
temperature: range(0, 2),
|
|
18152
|
+
top_p: range(0, 1),
|
|
18153
|
+
presence_penalty: range(-2, 2),
|
|
18154
|
+
frequency_penalty: range(-2, 2),
|
|
18155
|
+
seed: optional(pipe(number(), integer())),
|
|
18156
|
+
stop: optional(union([string(), array(string())])),
|
|
18157
|
+
response_format: optional(strictObject({ type: picklist(["text", "json_object"]) }))
|
|
18158
|
+
});
|
|
18159
|
+
var openai = {
|
|
18160
|
+
images: true,
|
|
18161
|
+
baseUrl: "https://api.openai.com/v1",
|
|
18162
|
+
validate: /* @__PURE__ */ __name((given) => checkedOptions("openai", options, given), "validate"),
|
|
18163
|
+
complete: /* @__PURE__ */ __name((target2, request, checked, apiKey, fetcher) => withTimeLimit(12e4, async (deadline) => {
|
|
18164
|
+
const response = await fetcher(`${target2.baseUrl.replace(/\/+$/, "")}/chat/completions`, {
|
|
18165
|
+
method: "POST",
|
|
18166
|
+
headers: { "Content-Type": "application/json", ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {} },
|
|
18167
|
+
body: JSON.stringify({
|
|
18168
|
+
...checked,
|
|
18169
|
+
model: target2.model,
|
|
18170
|
+
messages: [
|
|
18171
|
+
{ role: "system", content: systemFor(request) },
|
|
18172
|
+
...messagesFor(request),
|
|
18173
|
+
...request.images === void 0 ? [] : [
|
|
18174
|
+
{
|
|
18175
|
+
role: "user",
|
|
18176
|
+
content: request.images.map((image2) => ({
|
|
18177
|
+
type: "image_url",
|
|
18178
|
+
image_url: { url: `data:${image2.mimeType};base64,${image2.data}`, detail: "high" }
|
|
18179
|
+
}))
|
|
18180
|
+
}
|
|
18181
|
+
]
|
|
18182
|
+
],
|
|
18183
|
+
...new URL(target2.baseUrl).hostname === "api.openai.com" ? { max_completion_tokens: request.maxTokens } : { max_tokens: request.maxTokens }
|
|
18184
|
+
}),
|
|
18185
|
+
signal: deadline,
|
|
18186
|
+
redirect: "error"
|
|
18187
|
+
});
|
|
18188
|
+
if (!response.ok)
|
|
18189
|
+
throw new Error("provider rejected request");
|
|
18190
|
+
const body = await response.json();
|
|
18191
|
+
const choice = body.choices?.[0];
|
|
18192
|
+
if (choice?.finish_reason !== "stop" || typeof choice.message?.content !== "string" || !Number.isInteger(body.usage?.total_tokens) || (body.usage?.total_tokens ?? 0) < 1)
|
|
18193
|
+
throw new Error("incomplete response");
|
|
18194
|
+
const { prompt_tokens: input, completion_tokens: output } = body.usage ?? {};
|
|
18195
|
+
return {
|
|
18196
|
+
text: choice.message.content,
|
|
18197
|
+
tokens: body.usage?.total_tokens,
|
|
18198
|
+
...Number.isInteger(input) && Number.isInteger(output) ? { usage: { input, output } } : {}
|
|
18199
|
+
};
|
|
18200
|
+
}), "complete")
|
|
18201
|
+
};
|
|
18202
|
+
|
|
18203
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/models/index.js
|
|
18204
|
+
var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
18205
|
+
complete: /* @__PURE__ */ __name(async (request) => {
|
|
18206
|
+
if (deps.signal?.aborted)
|
|
18207
|
+
throw new CliError("cancelled", "model request cancelled");
|
|
18208
|
+
const target2 = deps.resolve(request.purpose);
|
|
18209
|
+
if (!target2 || target2.provider === "off")
|
|
18210
|
+
throw new CliError("configuration_error", `models.${request.purpose}.provider is not configured; no model was called`);
|
|
18211
|
+
if (!request.purpose || !Number.isSafeInteger(request.maxTokens) || request.maxTokens < 1 || typeof request.prompt !== "string")
|
|
18212
|
+
throw new CliError("validation_error", "a model request needs a purpose, prompt and positive whole maxTokens");
|
|
18213
|
+
validateImages(request.images);
|
|
18214
|
+
let adapter = deps.adapters?.[target2.provider];
|
|
18215
|
+
if (!adapter && target2.provider === "openai")
|
|
18216
|
+
adapter = openai;
|
|
18217
|
+
if (!adapter && target2.provider === "anthropic")
|
|
18218
|
+
adapter = (await import("./anthropic-PJKFON5H.js")).anthropic;
|
|
18219
|
+
if (!adapter)
|
|
18220
|
+
throw new CliError("validation_error", `no model adapter for ${target2.provider}`);
|
|
18221
|
+
if (request.images !== void 0 && adapter.images !== true)
|
|
18222
|
+
throw new CliError("validation_error", "the model adapter does not support image inputs");
|
|
18223
|
+
const options2 = adapter.validate(request.options ?? {});
|
|
18224
|
+
const baseUrl = target2.baseUrl ?? adapter.baseUrl;
|
|
18225
|
+
if (!target2.model.trim() || !endpoint(baseUrl))
|
|
18226
|
+
throw new CliError("validation_error", "a model target needs a model and an HTTP/S endpoint without credentials, query or fragment");
|
|
18227
|
+
if (!await deps.consent(request, { ...target2, baseUrl }))
|
|
18228
|
+
throw new CliError("permission_error", `model consent for ${request.purpose} is missing; no data was sent`);
|
|
18229
|
+
const apiKey = await deps.key?.(target2.provider, target2);
|
|
18230
|
+
if (deps.signal?.aborted)
|
|
18231
|
+
throw new CliError("cancelled", "model request cancelled");
|
|
18232
|
+
const fetcher = deps.fetch ?? fetch;
|
|
18233
|
+
let limited = false;
|
|
18234
|
+
let unreachable = false;
|
|
18235
|
+
let refused = false;
|
|
18236
|
+
let status;
|
|
18237
|
+
const cancellable = /* @__PURE__ */ __name(async (input, init) => {
|
|
18238
|
+
const signal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
|
|
18239
|
+
let response;
|
|
18240
|
+
try {
|
|
18241
|
+
response = await fetcher(input, {
|
|
18242
|
+
...init,
|
|
18243
|
+
signal: deps.signal ? AbortSignal.any([deps.signal, ...signal ? [signal] : []]) : signal
|
|
18244
|
+
});
|
|
18245
|
+
} catch (error) {
|
|
18246
|
+
unreachable = true;
|
|
18247
|
+
throw error;
|
|
18248
|
+
}
|
|
18249
|
+
if (!response.ok)
|
|
18250
|
+
status = response.status;
|
|
18251
|
+
if (response.status === 429)
|
|
18252
|
+
limited = true;
|
|
18253
|
+
if (response.status === 401 || response.status === 403)
|
|
18254
|
+
refused = true;
|
|
18255
|
+
return response;
|
|
18256
|
+
}, "cancellable");
|
|
18257
|
+
try {
|
|
18258
|
+
const answer = await adapter.complete({ ...target2, baseUrl }, request, options2, apiKey, cancellable);
|
|
18259
|
+
if (deps.signal?.aborted)
|
|
18260
|
+
throw new Error("cancelled");
|
|
18261
|
+
if (typeof answer.text !== "string" || !Number.isSafeInteger(answer.tokens) || answer.tokens < 1)
|
|
18262
|
+
throw new Error("incomplete");
|
|
18263
|
+
return { ...answer, provider: target2.provider, model: target2.model };
|
|
18264
|
+
} catch {
|
|
18265
|
+
if (limited)
|
|
18266
|
+
throw new CliError("rate_limited", `${request.purpose} provider rate limit reached; no result was stored`);
|
|
18267
|
+
const reason = refused ? "model.key-rejected" : unreachable && !deps.signal?.aborted ? "model.unreachable" : void 0;
|
|
18268
|
+
throw new CliError("invalid_response", `${request.purpose} provider failed or returned an incomplete response; no result was stored`, reason === void 0 && status === void 0 ? void 0 : { ...reason === void 0 ? {} : { reason }, ...status === void 0 ? {} : { status } });
|
|
18269
|
+
}
|
|
18270
|
+
}, "complete")
|
|
18271
|
+
}), "modelGateway");
|
|
18272
|
+
|
|
18273
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/domain/recovery.js
|
|
18274
|
+
var withRecovery = /* @__PURE__ */ __name((error) => ({
|
|
18275
|
+
...error,
|
|
18276
|
+
retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
|
|
18277
|
+
}), "withRecovery");
|
|
18278
|
+
|
|
18279
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/utils.js
|
|
18280
|
+
var decoder2 = new TextDecoder();
|
|
18281
|
+
var toUTF8String = /* @__PURE__ */ __name((input, start = 0, end = input.length) => decoder2.decode(input.slice(start, end)), "toUTF8String");
|
|
18282
|
+
var toHexString = /* @__PURE__ */ __name((input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + `0${i.toString(16)}`.slice(-2), ""), "toHexString");
|
|
18283
|
+
var getView = /* @__PURE__ */ __name((input, offset) => new DataView(input.buffer, input.byteOffset + offset), "getView");
|
|
18284
|
+
var readInt16LE = /* @__PURE__ */ __name((input, offset = 0) => getView(input, offset).getInt16(0, true), "readInt16LE");
|
|
18285
|
+
var readUInt16BE = /* @__PURE__ */ __name((input, offset = 0) => getView(input, offset).getUint16(0, false), "readUInt16BE");
|
|
18286
|
+
var readUInt16LE = /* @__PURE__ */ __name((input, offset = 0) => getView(input, offset).getUint16(0, true), "readUInt16LE");
|
|
18287
|
+
var readUInt24LE = /* @__PURE__ */ __name((input, offset = 0) => {
|
|
18288
|
+
const view = getView(input, offset);
|
|
18289
|
+
return view.getUint16(0, true) + (view.getUint8(2) << 16);
|
|
18290
|
+
}, "readUInt24LE");
|
|
18291
|
+
var readInt32LE = /* @__PURE__ */ __name((input, offset = 0) => getView(input, offset).getInt32(0, true), "readInt32LE");
|
|
18292
|
+
var readUInt32BE = /* @__PURE__ */ __name((input, offset = 0) => getView(input, offset).getUint32(0, false), "readUInt32BE");
|
|
18293
|
+
var readUInt32LE = /* @__PURE__ */ __name((input, offset = 0) => getView(input, offset).getUint32(0, true), "readUInt32LE");
|
|
18294
|
+
var readUInt64 = /* @__PURE__ */ __name((input, offset, isBigEndian) => getView(input, offset).getBigUint64(0, !isBigEndian), "readUInt64");
|
|
18295
|
+
var methods = {
|
|
18296
|
+
readUInt16BE,
|
|
18297
|
+
readUInt16LE,
|
|
18298
|
+
readUInt32BE,
|
|
18299
|
+
readUInt32LE
|
|
18300
|
+
};
|
|
18301
|
+
function readUInt(input, bits, offset = 0, isBigEndian = false) {
|
|
18302
|
+
const endian = isBigEndian ? "BE" : "LE";
|
|
18303
|
+
const methodName = `readUInt${bits}${endian}`;
|
|
18304
|
+
return methods[methodName](input, offset);
|
|
18305
|
+
}
|
|
18306
|
+
__name(readUInt, "readUInt");
|
|
18307
|
+
var BOX_HEADER_SIZE = 8;
|
|
18308
|
+
function readBox(input, offset) {
|
|
18309
|
+
if (input.length - offset < BOX_HEADER_SIZE)
|
|
18310
|
+
return void 0;
|
|
18311
|
+
const boxSize = readUInt32BE(input, offset);
|
|
18312
|
+
if (input.length - offset < boxSize)
|
|
18313
|
+
return void 0;
|
|
18314
|
+
return {
|
|
18315
|
+
name: toUTF8String(input, 4 + offset, 8 + offset),
|
|
18316
|
+
offset,
|
|
18317
|
+
size: boxSize
|
|
18318
|
+
};
|
|
18319
|
+
}
|
|
18320
|
+
__name(readBox, "readBox");
|
|
18321
|
+
function findBox(input, boxName, startOffset) {
|
|
18322
|
+
let currentOffset = startOffset;
|
|
18323
|
+
while (currentOffset < input.length) {
|
|
18324
|
+
if (input.length - currentOffset < 4)
|
|
18325
|
+
break;
|
|
18326
|
+
const boxSize = readUInt32BE(input, currentOffset);
|
|
18327
|
+
if (boxSize < BOX_HEADER_SIZE) {
|
|
18328
|
+
currentOffset += BOX_HEADER_SIZE;
|
|
18329
|
+
continue;
|
|
18330
|
+
}
|
|
18331
|
+
const box = readBox(input, currentOffset);
|
|
18332
|
+
if (!box)
|
|
18333
|
+
break;
|
|
18334
|
+
if (box.name === boxName)
|
|
18335
|
+
return box;
|
|
18336
|
+
currentOffset += box.size;
|
|
18337
|
+
}
|
|
18338
|
+
return void 0;
|
|
18339
|
+
}
|
|
18340
|
+
__name(findBox, "findBox");
|
|
18341
|
+
|
|
18342
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/bmp.js
|
|
18343
|
+
var BMP = {
|
|
18344
|
+
validate: /* @__PURE__ */ __name((input) => toUTF8String(input, 0, 2) === "BM", "validate"),
|
|
18345
|
+
calculate: /* @__PURE__ */ __name((input) => ({
|
|
18346
|
+
height: Math.abs(readInt32LE(input, 22)),
|
|
18347
|
+
width: readUInt32LE(input, 18)
|
|
18348
|
+
}), "calculate")
|
|
18349
|
+
};
|
|
18350
|
+
|
|
18351
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/ico.js
|
|
18352
|
+
var TYPE_ICON = 1;
|
|
18353
|
+
var SIZE_HEADER = 2 + 2 + 2;
|
|
18354
|
+
var SIZE_IMAGE_ENTRY = 1 + 1 + 1 + 1 + 2 + 2 + 4 + 4;
|
|
18355
|
+
function getSizeFromOffset(input, offset) {
|
|
18356
|
+
const value = input[offset];
|
|
18357
|
+
return value === 0 ? 256 : value;
|
|
18358
|
+
}
|
|
18359
|
+
__name(getSizeFromOffset, "getSizeFromOffset");
|
|
18360
|
+
function getImageSize(input, imageIndex) {
|
|
18361
|
+
const offset = SIZE_HEADER + imageIndex * SIZE_IMAGE_ENTRY;
|
|
18362
|
+
return {
|
|
18363
|
+
height: getSizeFromOffset(input, offset + 1),
|
|
18364
|
+
width: getSizeFromOffset(input, offset)
|
|
18365
|
+
};
|
|
18366
|
+
}
|
|
18367
|
+
__name(getImageSize, "getImageSize");
|
|
18368
|
+
var ICO = {
|
|
18369
|
+
validate(input) {
|
|
18370
|
+
const reserved = readUInt16LE(input, 0);
|
|
18371
|
+
const imageCount = readUInt16LE(input, 4);
|
|
18372
|
+
if (reserved !== 0 || imageCount === 0)
|
|
18373
|
+
return false;
|
|
18374
|
+
const imageType = readUInt16LE(input, 2);
|
|
18375
|
+
return imageType === TYPE_ICON;
|
|
18376
|
+
},
|
|
18377
|
+
calculate(input) {
|
|
18378
|
+
const nbImages = readUInt16LE(input, 4);
|
|
18379
|
+
if (SIZE_HEADER + nbImages * SIZE_IMAGE_ENTRY > input.length) {
|
|
18380
|
+
throw new TypeError("Invalid ICO");
|
|
18381
|
+
}
|
|
18382
|
+
const imageSize2 = getImageSize(input, 0);
|
|
18383
|
+
if (nbImages === 1)
|
|
18384
|
+
return imageSize2;
|
|
18385
|
+
const images = [];
|
|
18386
|
+
for (let imageIndex = 0; imageIndex < nbImages; imageIndex += 1) {
|
|
18387
|
+
images.push(getImageSize(input, imageIndex));
|
|
18388
|
+
}
|
|
18389
|
+
return {
|
|
18390
|
+
width: imageSize2.width,
|
|
18391
|
+
height: imageSize2.height,
|
|
18392
|
+
images
|
|
18393
|
+
};
|
|
18394
|
+
}
|
|
18395
|
+
};
|
|
18396
|
+
|
|
18397
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/cur.js
|
|
18398
|
+
var TYPE_CURSOR = 2;
|
|
18399
|
+
var CUR = {
|
|
18400
|
+
validate(input) {
|
|
18401
|
+
const reserved = readUInt16LE(input, 0);
|
|
18402
|
+
const imageCount = readUInt16LE(input, 4);
|
|
18403
|
+
if (reserved !== 0 || imageCount === 0)
|
|
18404
|
+
return false;
|
|
18405
|
+
const imageType = readUInt16LE(input, 2);
|
|
18406
|
+
return imageType === TYPE_CURSOR;
|
|
18407
|
+
},
|
|
18408
|
+
calculate: /* @__PURE__ */ __name((input) => ICO.calculate(input), "calculate")
|
|
18409
|
+
};
|
|
18410
|
+
|
|
18411
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/dds.js
|
|
18412
|
+
var DDS = {
|
|
18413
|
+
validate: /* @__PURE__ */ __name((input) => readUInt32LE(input, 0) === 542327876, "validate"),
|
|
18414
|
+
calculate: /* @__PURE__ */ __name((input) => ({
|
|
18415
|
+
height: readUInt32LE(input, 12),
|
|
18416
|
+
width: readUInt32LE(input, 16)
|
|
18417
|
+
}), "calculate")
|
|
18418
|
+
};
|
|
18419
|
+
|
|
18420
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/gif.js
|
|
18421
|
+
var gifRegexp = /^GIF8[79]a/;
|
|
18422
|
+
var GIF = {
|
|
18423
|
+
validate: /* @__PURE__ */ __name((input) => gifRegexp.test(toUTF8String(input, 0, 6)), "validate"),
|
|
18424
|
+
calculate: /* @__PURE__ */ __name((input) => ({
|
|
18425
|
+
height: readUInt16LE(input, 8),
|
|
18426
|
+
width: readUInt16LE(input, 6)
|
|
18427
|
+
}), "calculate")
|
|
18428
|
+
};
|
|
18429
|
+
|
|
18430
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/heif.js
|
|
18431
|
+
var brandMap = {
|
|
18432
|
+
avif: "avif",
|
|
18433
|
+
mif1: "heif",
|
|
18434
|
+
msf1: "heif",
|
|
18435
|
+
heic: "heic",
|
|
18436
|
+
heix: "heic",
|
|
18437
|
+
hevc: "heic",
|
|
18438
|
+
hevx: "heic"
|
|
18439
|
+
};
|
|
18440
|
+
var HEIF = {
|
|
18441
|
+
validate(input) {
|
|
18442
|
+
const boxType = toUTF8String(input, 4, 8);
|
|
18443
|
+
if (boxType !== "ftyp")
|
|
18444
|
+
return false;
|
|
18445
|
+
const ftypBox = findBox(input, "ftyp", 0);
|
|
18446
|
+
if (!ftypBox)
|
|
18447
|
+
return false;
|
|
18448
|
+
const brand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
|
|
18449
|
+
return brand in brandMap;
|
|
18450
|
+
},
|
|
18451
|
+
calculate(input) {
|
|
18452
|
+
const metaBox = findBox(input, "meta", 0);
|
|
18453
|
+
const iprpBox = metaBox && findBox(input, "iprp", metaBox.offset + 12);
|
|
18454
|
+
const ipcoBox = iprpBox && findBox(input, "ipco", iprpBox.offset + 8);
|
|
18455
|
+
if (!ipcoBox) {
|
|
18456
|
+
throw new TypeError("Invalid HEIF, no ipco box found");
|
|
18457
|
+
}
|
|
18458
|
+
const type = toUTF8String(input, 8, 12);
|
|
18459
|
+
const images = [];
|
|
18460
|
+
let currentOffset = ipcoBox.offset + 8;
|
|
18461
|
+
while (currentOffset < ipcoBox.offset + ipcoBox.size) {
|
|
18462
|
+
const ispeBox = findBox(input, "ispe", currentOffset);
|
|
18463
|
+
if (!ispeBox)
|
|
18464
|
+
break;
|
|
18465
|
+
if (ispeBox.size < 20) {
|
|
18466
|
+
throw new TypeError("Invalid HEIF");
|
|
18467
|
+
}
|
|
18468
|
+
const rawWidth = readUInt32BE(input, ispeBox.offset + 12);
|
|
18469
|
+
const rawHeight = readUInt32BE(input, ispeBox.offset + 16);
|
|
18470
|
+
const clapBox = findBox(input, "clap", currentOffset);
|
|
18471
|
+
let width = rawWidth;
|
|
18472
|
+
const height = rawHeight;
|
|
18473
|
+
if (clapBox && clapBox.size >= 16 && clapBox.offset < ipcoBox.offset + ipcoBox.size) {
|
|
18474
|
+
const cropRight = readUInt32BE(input, clapBox.offset + 12);
|
|
18475
|
+
width = rawWidth - cropRight;
|
|
18476
|
+
}
|
|
18477
|
+
images.push({ height, width });
|
|
18478
|
+
const nextOffset = ispeBox.offset + ispeBox.size;
|
|
18479
|
+
if (nextOffset <= currentOffset) {
|
|
18480
|
+
throw new TypeError("Invalid HEIF");
|
|
18481
|
+
}
|
|
18482
|
+
currentOffset = nextOffset;
|
|
18483
|
+
}
|
|
18484
|
+
if (images.length === 0) {
|
|
18485
|
+
throw new TypeError("Invalid HEIF, no sizes found");
|
|
18486
|
+
}
|
|
18487
|
+
return {
|
|
18488
|
+
width: images[0].width,
|
|
18489
|
+
height: images[0].height,
|
|
18490
|
+
type,
|
|
18491
|
+
...images.length > 1 ? { images } : {}
|
|
18492
|
+
};
|
|
18493
|
+
}
|
|
18494
|
+
};
|
|
18495
|
+
|
|
18496
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/icns.js
|
|
18497
|
+
var SIZE_HEADER2 = 4 + 4;
|
|
18498
|
+
var FILE_LENGTH_OFFSET = 4;
|
|
18499
|
+
var ENTRY_LENGTH_OFFSET = 4;
|
|
18500
|
+
var ICON_TYPE_SIZE = {
|
|
18501
|
+
ICON: 32,
|
|
18502
|
+
"ICN#": 32,
|
|
18503
|
+
"icm#": 16,
|
|
18504
|
+
icm4: 16,
|
|
18505
|
+
icm8: 16,
|
|
18506
|
+
"ics#": 16,
|
|
18507
|
+
ics4: 16,
|
|
18508
|
+
ics8: 16,
|
|
18509
|
+
is32: 16,
|
|
18510
|
+
s8mk: 16,
|
|
18511
|
+
icp4: 16,
|
|
18512
|
+
icl4: 32,
|
|
18513
|
+
icl8: 32,
|
|
18514
|
+
il32: 32,
|
|
18515
|
+
l8mk: 32,
|
|
18516
|
+
icp5: 32,
|
|
18517
|
+
ic11: 32,
|
|
18518
|
+
ich4: 48,
|
|
18519
|
+
ich8: 48,
|
|
18520
|
+
ih32: 48,
|
|
18521
|
+
h8mk: 48,
|
|
18522
|
+
icp6: 64,
|
|
18523
|
+
ic12: 32,
|
|
18524
|
+
it32: 128,
|
|
18525
|
+
t8mk: 128,
|
|
18526
|
+
ic07: 128,
|
|
18527
|
+
ic08: 256,
|
|
18528
|
+
ic13: 256,
|
|
18529
|
+
ic09: 512,
|
|
18530
|
+
ic14: 512,
|
|
18531
|
+
ic10: 1024
|
|
18532
|
+
};
|
|
18533
|
+
function readImageHeader(input, imageOffset) {
|
|
18534
|
+
const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
|
|
18535
|
+
if (imageLengthOffset + 4 > input.length) {
|
|
18536
|
+
throw new TypeError("Invalid ICNS");
|
|
18537
|
+
}
|
|
18538
|
+
return [
|
|
18539
|
+
toUTF8String(input, imageOffset, imageLengthOffset),
|
|
18540
|
+
readUInt32BE(input, imageLengthOffset)
|
|
18541
|
+
];
|
|
18542
|
+
}
|
|
18543
|
+
__name(readImageHeader, "readImageHeader");
|
|
18544
|
+
function getImageSize2(type) {
|
|
18545
|
+
const size = ICON_TYPE_SIZE[type];
|
|
18546
|
+
return { width: size, height: size, type };
|
|
18547
|
+
}
|
|
18548
|
+
__name(getImageSize2, "getImageSize");
|
|
18549
|
+
var ICNS = {
|
|
18550
|
+
validate: /* @__PURE__ */ __name((input) => toUTF8String(input, 0, 4) === "icns", "validate"),
|
|
18551
|
+
calculate(input) {
|
|
18552
|
+
const inputLength = input.length;
|
|
18553
|
+
const fileLength = readUInt32BE(input, FILE_LENGTH_OFFSET);
|
|
18554
|
+
let imageOffset = SIZE_HEADER2;
|
|
18555
|
+
const images = [];
|
|
18556
|
+
while (imageOffset < fileLength && imageOffset < inputLength) {
|
|
18557
|
+
const imageHeader = readImageHeader(input, imageOffset);
|
|
18558
|
+
const entryLength = imageHeader[1];
|
|
18559
|
+
if (entryLength < 8) {
|
|
18560
|
+
throw new TypeError("Invalid ICNS");
|
|
18561
|
+
}
|
|
18562
|
+
const imageSize2 = getImageSize2(imageHeader[0]);
|
|
18563
|
+
images.push(imageSize2);
|
|
18564
|
+
imageOffset += entryLength;
|
|
18565
|
+
}
|
|
18566
|
+
if (images.length === 0) {
|
|
18567
|
+
throw new TypeError("Invalid ICNS, no sizes found");
|
|
18568
|
+
}
|
|
18569
|
+
return {
|
|
18570
|
+
width: images[0].width,
|
|
18571
|
+
height: images[0].height,
|
|
18572
|
+
...images.length > 1 ? { images } : {}
|
|
18573
|
+
};
|
|
18574
|
+
}
|
|
18575
|
+
};
|
|
18576
|
+
|
|
18577
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/j2c.js
|
|
18578
|
+
var J2C = {
|
|
18579
|
+
validate: /* @__PURE__ */ __name((input) => readUInt32BE(input, 0) === 4283432785, "validate"),
|
|
18580
|
+
calculate: /* @__PURE__ */ __name((input) => ({
|
|
18581
|
+
height: readUInt32BE(input, 12),
|
|
18582
|
+
width: readUInt32BE(input, 8)
|
|
18583
|
+
}), "calculate")
|
|
18584
|
+
};
|
|
18585
|
+
|
|
18586
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/jp2.js
|
|
18587
|
+
var JP2 = {
|
|
18588
|
+
validate(input) {
|
|
18589
|
+
const boxType = toUTF8String(input, 4, 8);
|
|
18590
|
+
if (boxType !== "jP ")
|
|
18591
|
+
return false;
|
|
18592
|
+
const ftypBox = findBox(input, "ftyp", 0);
|
|
18593
|
+
if (!ftypBox)
|
|
18594
|
+
return false;
|
|
18595
|
+
const brand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
|
|
18596
|
+
return brand === "jp2 ";
|
|
18597
|
+
},
|
|
18598
|
+
calculate(input) {
|
|
18599
|
+
const jp2hBox = findBox(input, "jp2h", 0);
|
|
18600
|
+
const ihdrBox = jp2hBox && findBox(input, "ihdr", jp2hBox.offset + 8);
|
|
18601
|
+
if (ihdrBox) {
|
|
18602
|
+
return {
|
|
18603
|
+
height: readUInt32BE(input, ihdrBox.offset + 8),
|
|
18604
|
+
width: readUInt32BE(input, ihdrBox.offset + 12)
|
|
18605
|
+
};
|
|
18606
|
+
}
|
|
18607
|
+
throw new TypeError("Unsupported JPEG 2000 format");
|
|
18608
|
+
}
|
|
18609
|
+
};
|
|
18610
|
+
|
|
18611
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/jpg.js
|
|
18612
|
+
var EXIF_MARKER = "45786966";
|
|
18613
|
+
var APP1_DATA_SIZE_BYTES = 2;
|
|
18614
|
+
var EXIF_HEADER_BYTES = 6;
|
|
18615
|
+
var TIFF_BYTE_ALIGN_BYTES = 2;
|
|
18616
|
+
var BIG_ENDIAN_BYTE_ALIGN = "4d4d";
|
|
18617
|
+
var LITTLE_ENDIAN_BYTE_ALIGN = "4949";
|
|
18618
|
+
var IDF_ENTRY_BYTES = 12;
|
|
18619
|
+
var NUM_DIRECTORY_ENTRIES_BYTES = 2;
|
|
18620
|
+
function isEXIF(input) {
|
|
18621
|
+
return toHexString(input, 2, 6) === EXIF_MARKER;
|
|
18622
|
+
}
|
|
18623
|
+
__name(isEXIF, "isEXIF");
|
|
18624
|
+
function extractSize(input, index) {
|
|
18625
|
+
return {
|
|
18626
|
+
height: readUInt16BE(input, index),
|
|
18627
|
+
width: readUInt16BE(input, index + 2)
|
|
18628
|
+
};
|
|
18629
|
+
}
|
|
18630
|
+
__name(extractSize, "extractSize");
|
|
18631
|
+
function extractOrientation(exifBlock, isBigEndian) {
|
|
18632
|
+
const idfOffset = 8;
|
|
18633
|
+
const offset = EXIF_HEADER_BYTES + idfOffset;
|
|
18634
|
+
const idfDirectoryEntries = readUInt(exifBlock, 16, offset, isBigEndian);
|
|
18635
|
+
for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
|
|
18636
|
+
const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES;
|
|
18637
|
+
const end = start + IDF_ENTRY_BYTES;
|
|
18638
|
+
if (start > exifBlock.length) {
|
|
18639
|
+
return;
|
|
18640
|
+
}
|
|
18641
|
+
const block = exifBlock.slice(start, end);
|
|
18642
|
+
const tagNumber = readUInt(block, 16, 0, isBigEndian);
|
|
18643
|
+
if (tagNumber === 274) {
|
|
18644
|
+
const dataFormat = readUInt(block, 16, 2, isBigEndian);
|
|
18645
|
+
if (dataFormat !== 3) {
|
|
18646
|
+
return;
|
|
18647
|
+
}
|
|
18648
|
+
const numberOfComponents = readUInt(block, 32, 4, isBigEndian);
|
|
18649
|
+
if (numberOfComponents !== 1) {
|
|
18650
|
+
return;
|
|
18651
|
+
}
|
|
18652
|
+
return readUInt(block, 16, 8, isBigEndian);
|
|
18653
|
+
}
|
|
18654
|
+
}
|
|
18655
|
+
}
|
|
18656
|
+
__name(extractOrientation, "extractOrientation");
|
|
18657
|
+
function validateExifBlock(input, index) {
|
|
18658
|
+
const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
|
|
18659
|
+
const byteAlign = toHexString(exifBlock, EXIF_HEADER_BYTES, EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES);
|
|
18660
|
+
const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
|
|
18661
|
+
const isLittleEndian = byteAlign === LITTLE_ENDIAN_BYTE_ALIGN;
|
|
18662
|
+
if (isBigEndian || isLittleEndian) {
|
|
18663
|
+
return extractOrientation(exifBlock, isBigEndian);
|
|
18664
|
+
}
|
|
18665
|
+
}
|
|
18666
|
+
__name(validateExifBlock, "validateExifBlock");
|
|
18667
|
+
function validateInput(input, index) {
|
|
18668
|
+
if (index > input.length) {
|
|
18669
|
+
throw new TypeError("Corrupt JPG, exceeded buffer limits");
|
|
18670
|
+
}
|
|
18671
|
+
}
|
|
18672
|
+
__name(validateInput, "validateInput");
|
|
18673
|
+
var JPG = {
|
|
18674
|
+
validate: /* @__PURE__ */ __name((input) => toHexString(input, 0, 2) === "ffd8", "validate"),
|
|
18675
|
+
calculate(_input) {
|
|
18676
|
+
let input = _input.slice(4);
|
|
18677
|
+
let orientation;
|
|
18678
|
+
let next;
|
|
18679
|
+
while (input.length) {
|
|
18680
|
+
const i = readUInt16BE(input, 0);
|
|
18681
|
+
validateInput(input, i);
|
|
18682
|
+
if (input[i] !== 255) {
|
|
18683
|
+
input = input.slice(1);
|
|
18684
|
+
continue;
|
|
18685
|
+
}
|
|
18686
|
+
if (isEXIF(input)) {
|
|
18687
|
+
orientation = validateExifBlock(input, i);
|
|
18688
|
+
}
|
|
18689
|
+
next = input[i + 1];
|
|
18690
|
+
if (next === 192 || next === 193 || next === 194) {
|
|
18691
|
+
const size = extractSize(input, i + 5);
|
|
18692
|
+
if (!orientation) {
|
|
18693
|
+
return size;
|
|
18694
|
+
}
|
|
18695
|
+
return {
|
|
18696
|
+
height: size.height,
|
|
18697
|
+
orientation,
|
|
18698
|
+
width: size.width
|
|
18699
|
+
};
|
|
18700
|
+
}
|
|
18701
|
+
input = input.slice(i + 2);
|
|
18702
|
+
}
|
|
18703
|
+
throw new TypeError("Invalid JPG, no size found");
|
|
18704
|
+
}
|
|
18705
|
+
};
|
|
18706
|
+
|
|
18707
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/utils/bit-reader.js
|
|
18708
|
+
var BitReader = class {
|
|
18709
|
+
static {
|
|
18710
|
+
__name(this, "BitReader");
|
|
18711
|
+
}
|
|
18712
|
+
input;
|
|
18713
|
+
endianness;
|
|
18714
|
+
byteOffset = 2;
|
|
18715
|
+
bitOffset = 0;
|
|
18716
|
+
constructor(input, endianness) {
|
|
18717
|
+
this.input = input;
|
|
18718
|
+
this.endianness = endianness;
|
|
18719
|
+
}
|
|
18720
|
+
getBits(length = 1) {
|
|
18721
|
+
let result = 0;
|
|
18722
|
+
let bitsRead = 0;
|
|
18723
|
+
while (bitsRead < length) {
|
|
18724
|
+
if (this.byteOffset >= this.input.length) {
|
|
18725
|
+
throw new Error("Reached end of input");
|
|
18726
|
+
}
|
|
18727
|
+
const currentByte = this.input[this.byteOffset];
|
|
18728
|
+
const bitsLeft = 8 - this.bitOffset;
|
|
18729
|
+
const bitsToRead = Math.min(length - bitsRead, bitsLeft);
|
|
18730
|
+
if (this.endianness === "little-endian") {
|
|
18731
|
+
const mask = (1 << bitsToRead) - 1;
|
|
18732
|
+
const bits = currentByte >> this.bitOffset & mask;
|
|
18733
|
+
result |= bits << bitsRead;
|
|
18734
|
+
} else {
|
|
18735
|
+
const mask = (1 << bitsToRead) - 1 << 8 - this.bitOffset - bitsToRead;
|
|
18736
|
+
const bits = (currentByte & mask) >> 8 - this.bitOffset - bitsToRead;
|
|
18737
|
+
result = result << bitsToRead | bits;
|
|
18738
|
+
}
|
|
18739
|
+
bitsRead += bitsToRead;
|
|
18740
|
+
this.bitOffset += bitsToRead;
|
|
18741
|
+
if (this.bitOffset === 8) {
|
|
18742
|
+
this.byteOffset++;
|
|
18743
|
+
this.bitOffset = 0;
|
|
18744
|
+
}
|
|
18745
|
+
}
|
|
18746
|
+
return result;
|
|
18747
|
+
}
|
|
18748
|
+
};
|
|
18749
|
+
|
|
18750
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/jxl-stream.js
|
|
18751
|
+
function calculateImageDimension(reader, isSmallImage) {
|
|
18752
|
+
if (isSmallImage) {
|
|
18753
|
+
return 8 * (1 + reader.getBits(5));
|
|
18754
|
+
}
|
|
18755
|
+
const sizeClass = reader.getBits(2);
|
|
18756
|
+
const extraBits = [9, 13, 18, 30][sizeClass];
|
|
18757
|
+
return 1 + reader.getBits(extraBits);
|
|
18758
|
+
}
|
|
18759
|
+
__name(calculateImageDimension, "calculateImageDimension");
|
|
18760
|
+
function calculateImageWidth(reader, isSmallImage, widthMode, height) {
|
|
18761
|
+
if (isSmallImage && widthMode === 0) {
|
|
18762
|
+
return 8 * (1 + reader.getBits(5));
|
|
18763
|
+
}
|
|
18764
|
+
if (widthMode === 0) {
|
|
18765
|
+
return calculateImageDimension(reader, false);
|
|
18766
|
+
}
|
|
18767
|
+
const aspectRatios = [1, 1.2, 4 / 3, 1.5, 16 / 9, 5 / 4, 2];
|
|
18768
|
+
return Math.floor(height * aspectRatios[widthMode - 1]);
|
|
18769
|
+
}
|
|
18770
|
+
__name(calculateImageWidth, "calculateImageWidth");
|
|
18771
|
+
var JXLStream = {
|
|
18772
|
+
validate: /* @__PURE__ */ __name((input) => {
|
|
18773
|
+
return toHexString(input, 0, 2) === "ff0a";
|
|
18774
|
+
}, "validate"),
|
|
18775
|
+
calculate(input) {
|
|
18776
|
+
const reader = new BitReader(input, "little-endian");
|
|
18777
|
+
const isSmallImage = reader.getBits(1) === 1;
|
|
18778
|
+
const height = calculateImageDimension(reader, isSmallImage);
|
|
18779
|
+
const widthMode = reader.getBits(3);
|
|
18780
|
+
const width = calculateImageWidth(reader, isSmallImage, widthMode, height);
|
|
18781
|
+
return { width, height };
|
|
18782
|
+
}
|
|
18783
|
+
};
|
|
18784
|
+
|
|
18785
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/jxl.js
|
|
18786
|
+
function extractCodestream(input) {
|
|
18787
|
+
const jxlcBox = findBox(input, "jxlc", 0);
|
|
18788
|
+
if (jxlcBox) {
|
|
18789
|
+
return input.slice(jxlcBox.offset + 8, jxlcBox.offset + jxlcBox.size);
|
|
18790
|
+
}
|
|
18791
|
+
const partialStreams = extractPartialStreams(input);
|
|
18792
|
+
if (partialStreams.length > 0) {
|
|
18793
|
+
return concatenateCodestreams(partialStreams);
|
|
18794
|
+
}
|
|
18795
|
+
return void 0;
|
|
18796
|
+
}
|
|
18797
|
+
__name(extractCodestream, "extractCodestream");
|
|
18798
|
+
function extractPartialStreams(input) {
|
|
18799
|
+
const partialStreams = [];
|
|
18800
|
+
let offset = 0;
|
|
18801
|
+
while (offset < input.length) {
|
|
18802
|
+
const jxlpBox = findBox(input, "jxlp", offset);
|
|
18803
|
+
if (!jxlpBox)
|
|
18804
|
+
break;
|
|
18805
|
+
if (jxlpBox.size < 12) {
|
|
18806
|
+
throw new TypeError("Invalid JXL");
|
|
18807
|
+
}
|
|
18808
|
+
partialStreams.push(input.slice(jxlpBox.offset + 12, jxlpBox.offset + jxlpBox.size));
|
|
18809
|
+
offset = jxlpBox.offset + jxlpBox.size;
|
|
18810
|
+
}
|
|
18811
|
+
return partialStreams;
|
|
18812
|
+
}
|
|
18813
|
+
__name(extractPartialStreams, "extractPartialStreams");
|
|
18814
|
+
function concatenateCodestreams(partialCodestreams) {
|
|
18815
|
+
const totalLength = partialCodestreams.reduce((acc, curr) => acc + curr.length, 0);
|
|
18816
|
+
const codestream = new Uint8Array(totalLength);
|
|
18817
|
+
let position = 0;
|
|
18818
|
+
for (const partial of partialCodestreams) {
|
|
18819
|
+
codestream.set(partial, position);
|
|
18820
|
+
position += partial.length;
|
|
18821
|
+
}
|
|
18822
|
+
return codestream;
|
|
18823
|
+
}
|
|
18824
|
+
__name(concatenateCodestreams, "concatenateCodestreams");
|
|
18825
|
+
var JXL = {
|
|
18826
|
+
validate: /* @__PURE__ */ __name((input) => {
|
|
18827
|
+
const boxType = toUTF8String(input, 4, 8);
|
|
18828
|
+
if (boxType !== "JXL ")
|
|
18829
|
+
return false;
|
|
18830
|
+
const ftypBox = findBox(input, "ftyp", 0);
|
|
18831
|
+
if (!ftypBox)
|
|
18832
|
+
return false;
|
|
18833
|
+
const brand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
|
|
18834
|
+
return brand === "jxl ";
|
|
18835
|
+
}, "validate"),
|
|
18836
|
+
calculate(input) {
|
|
18837
|
+
const codestream = extractCodestream(input);
|
|
18838
|
+
if (codestream)
|
|
18839
|
+
return JXLStream.calculate(codestream);
|
|
18840
|
+
throw new TypeError("Invalid JXL");
|
|
18841
|
+
}
|
|
18842
|
+
};
|
|
18843
|
+
|
|
18844
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/ktx.js
|
|
18845
|
+
var KTX = {
|
|
18846
|
+
validate: /* @__PURE__ */ __name((input) => {
|
|
18847
|
+
const signature = toUTF8String(input, 1, 7);
|
|
18848
|
+
return ["KTX 11", "KTX 20"].includes(signature);
|
|
18849
|
+
}, "validate"),
|
|
18850
|
+
calculate: /* @__PURE__ */ __name((input) => {
|
|
18851
|
+
const type = input[5] === 49 ? "ktx" : "ktx2";
|
|
18852
|
+
const offset = type === "ktx" ? 36 : 20;
|
|
18853
|
+
return {
|
|
18854
|
+
height: readUInt32LE(input, offset + 4),
|
|
18855
|
+
width: readUInt32LE(input, offset),
|
|
18856
|
+
type
|
|
18857
|
+
};
|
|
18858
|
+
}, "calculate")
|
|
18859
|
+
};
|
|
18860
|
+
|
|
18861
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/png.js
|
|
18862
|
+
var pngSignature = "PNG\r\n\n";
|
|
18863
|
+
var pngImageHeaderChunkName = "IHDR";
|
|
18864
|
+
var pngFriedChunkName = "CgBI";
|
|
18865
|
+
var PNG = {
|
|
18866
|
+
validate(input) {
|
|
18867
|
+
if (pngSignature === toUTF8String(input, 1, 8)) {
|
|
18868
|
+
let chunkName = toUTF8String(input, 12, 16);
|
|
18869
|
+
if (chunkName === pngFriedChunkName) {
|
|
18870
|
+
chunkName = toUTF8String(input, 28, 32);
|
|
18871
|
+
}
|
|
18872
|
+
if (chunkName !== pngImageHeaderChunkName) {
|
|
18873
|
+
throw new TypeError("Invalid PNG");
|
|
18874
|
+
}
|
|
18875
|
+
return true;
|
|
18876
|
+
}
|
|
18877
|
+
return false;
|
|
18878
|
+
},
|
|
18879
|
+
calculate(input) {
|
|
18880
|
+
if (toUTF8String(input, 12, 16) === pngFriedChunkName) {
|
|
18881
|
+
return {
|
|
18882
|
+
height: readUInt32BE(input, 36),
|
|
18883
|
+
width: readUInt32BE(input, 32)
|
|
18884
|
+
};
|
|
18885
|
+
}
|
|
18886
|
+
return {
|
|
18887
|
+
height: readUInt32BE(input, 20),
|
|
18888
|
+
width: readUInt32BE(input, 16)
|
|
18889
|
+
};
|
|
18890
|
+
}
|
|
18891
|
+
};
|
|
18892
|
+
|
|
18893
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/pnm.js
|
|
18894
|
+
var PNMTypes = {
|
|
18895
|
+
P1: "pbm/ascii",
|
|
18896
|
+
P2: "pgm/ascii",
|
|
18897
|
+
P3: "ppm/ascii",
|
|
18898
|
+
P4: "pbm",
|
|
18899
|
+
P5: "pgm",
|
|
18900
|
+
P6: "ppm",
|
|
18901
|
+
P7: "pam",
|
|
18902
|
+
PF: "pfm"
|
|
18903
|
+
};
|
|
18904
|
+
var handlers = {
|
|
18905
|
+
default: /* @__PURE__ */ __name((lines) => {
|
|
18906
|
+
let dimensions = [];
|
|
18907
|
+
while (lines.length > 0) {
|
|
18908
|
+
const line = lines.shift();
|
|
18909
|
+
if (line[0] === "#") {
|
|
18910
|
+
continue;
|
|
18911
|
+
}
|
|
18912
|
+
dimensions = line.split(" ");
|
|
18913
|
+
break;
|
|
18914
|
+
}
|
|
18915
|
+
if (dimensions.length === 2) {
|
|
18916
|
+
return {
|
|
18917
|
+
height: Number.parseInt(dimensions[1], 10),
|
|
18918
|
+
width: Number.parseInt(dimensions[0], 10)
|
|
18919
|
+
};
|
|
18920
|
+
}
|
|
18921
|
+
throw new TypeError("Invalid PNM");
|
|
18922
|
+
}, "default"),
|
|
18923
|
+
pam: /* @__PURE__ */ __name((lines) => {
|
|
18924
|
+
const size = {};
|
|
18925
|
+
while (lines.length > 0) {
|
|
18926
|
+
const line = lines.shift();
|
|
18927
|
+
if (line.length > 16 || line.charCodeAt(0) > 128) {
|
|
18928
|
+
continue;
|
|
18929
|
+
}
|
|
18930
|
+
const [key, value] = line.split(" ");
|
|
18931
|
+
if (key && value) {
|
|
18932
|
+
size[key.toLowerCase()] = Number.parseInt(value, 10);
|
|
18933
|
+
}
|
|
18934
|
+
if (size.height && size.width) {
|
|
18935
|
+
break;
|
|
18936
|
+
}
|
|
18937
|
+
}
|
|
18938
|
+
if (size.height && size.width) {
|
|
18939
|
+
return {
|
|
18940
|
+
height: size.height,
|
|
18941
|
+
width: size.width
|
|
18942
|
+
};
|
|
18943
|
+
}
|
|
18944
|
+
throw new TypeError("Invalid PAM");
|
|
18945
|
+
}, "pam")
|
|
18946
|
+
};
|
|
18947
|
+
var PNM = {
|
|
18948
|
+
validate: /* @__PURE__ */ __name((input) => toUTF8String(input, 0, 2) in PNMTypes, "validate"),
|
|
18949
|
+
calculate(input) {
|
|
18950
|
+
const signature = toUTF8String(input, 0, 2);
|
|
18951
|
+
const type = PNMTypes[signature];
|
|
18952
|
+
const lines = toUTF8String(input, 3).split(/[\r\n]+/);
|
|
18953
|
+
const handler = handlers[type] || handlers.default;
|
|
18954
|
+
return handler(lines);
|
|
18955
|
+
}
|
|
18956
|
+
};
|
|
18957
|
+
|
|
18958
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/psd.js
|
|
18959
|
+
var PSD = {
|
|
18960
|
+
validate: /* @__PURE__ */ __name((input) => toUTF8String(input, 0, 4) === "8BPS", "validate"),
|
|
18961
|
+
calculate: /* @__PURE__ */ __name((input) => ({
|
|
18962
|
+
height: readUInt32BE(input, 14),
|
|
18963
|
+
width: readUInt32BE(input, 18)
|
|
18964
|
+
}), "calculate")
|
|
18965
|
+
};
|
|
18966
|
+
|
|
18967
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/svg.js
|
|
18968
|
+
var svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
|
|
18969
|
+
var extractorRegExps = {
|
|
18970
|
+
height: /\sheight=(['"])([^%]+?)\1/,
|
|
18971
|
+
root: svgReg,
|
|
18972
|
+
viewbox: /\sviewBox=(['"])(.+?)\1/i,
|
|
18973
|
+
width: /\swidth=(['"])([^%]+?)\1/
|
|
18974
|
+
};
|
|
18975
|
+
var INCH_CM = 2.54;
|
|
18976
|
+
var units = {
|
|
18977
|
+
in: 96,
|
|
18978
|
+
cm: 96 / INCH_CM,
|
|
18979
|
+
em: 16,
|
|
18980
|
+
ex: 8,
|
|
18981
|
+
m: 96 / INCH_CM * 100,
|
|
18982
|
+
mm: 96 / INCH_CM / 10,
|
|
18983
|
+
pc: 96 / 72 / 12,
|
|
18984
|
+
pt: 96 / 72,
|
|
18985
|
+
px: 1
|
|
18986
|
+
};
|
|
18987
|
+
var unitsReg = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
|
|
18988
|
+
function parseLength(len) {
|
|
18989
|
+
const m = unitsReg.exec(len);
|
|
18990
|
+
if (!m) {
|
|
18991
|
+
return void 0;
|
|
18992
|
+
}
|
|
18993
|
+
return Math.round(Number(m[1]) * (units[m[2]] || 1));
|
|
18994
|
+
}
|
|
18995
|
+
__name(parseLength, "parseLength");
|
|
18996
|
+
function parseViewbox(viewbox) {
|
|
18997
|
+
const bounds = viewbox.split(" ");
|
|
18998
|
+
return {
|
|
18999
|
+
height: parseLength(bounds[3]),
|
|
19000
|
+
width: parseLength(bounds[2])
|
|
19001
|
+
};
|
|
19002
|
+
}
|
|
19003
|
+
__name(parseViewbox, "parseViewbox");
|
|
19004
|
+
function parseAttributes(root) {
|
|
19005
|
+
const width = root.match(extractorRegExps.width);
|
|
19006
|
+
const height = root.match(extractorRegExps.height);
|
|
19007
|
+
const viewbox = root.match(extractorRegExps.viewbox);
|
|
19008
|
+
return {
|
|
19009
|
+
height: height && parseLength(height[2]),
|
|
19010
|
+
viewbox: viewbox && parseViewbox(viewbox[2]),
|
|
19011
|
+
width: width && parseLength(width[2])
|
|
19012
|
+
};
|
|
19013
|
+
}
|
|
19014
|
+
__name(parseAttributes, "parseAttributes");
|
|
19015
|
+
function calculateByDimensions(attrs) {
|
|
19016
|
+
return {
|
|
19017
|
+
height: attrs.height,
|
|
19018
|
+
width: attrs.width
|
|
19019
|
+
};
|
|
19020
|
+
}
|
|
19021
|
+
__name(calculateByDimensions, "calculateByDimensions");
|
|
19022
|
+
function calculateByViewbox(attrs, viewbox) {
|
|
19023
|
+
const ratio = viewbox.width / viewbox.height;
|
|
19024
|
+
if (attrs.width) {
|
|
19025
|
+
return {
|
|
19026
|
+
height: Math.floor(attrs.width / ratio),
|
|
19027
|
+
width: attrs.width
|
|
19028
|
+
};
|
|
19029
|
+
}
|
|
19030
|
+
if (attrs.height) {
|
|
19031
|
+
return {
|
|
19032
|
+
height: attrs.height,
|
|
19033
|
+
width: Math.floor(attrs.height * ratio)
|
|
19034
|
+
};
|
|
19035
|
+
}
|
|
19036
|
+
return {
|
|
19037
|
+
height: viewbox.height,
|
|
19038
|
+
width: viewbox.width
|
|
19039
|
+
};
|
|
19040
|
+
}
|
|
19041
|
+
__name(calculateByViewbox, "calculateByViewbox");
|
|
19042
|
+
var SVG = {
|
|
19043
|
+
validate: /* @__PURE__ */ __name((input) => svgReg.test(toUTF8String(input, 0, 1e3)), "validate"),
|
|
19044
|
+
calculate(input) {
|
|
19045
|
+
const root = toUTF8String(input).match(extractorRegExps.root);
|
|
19046
|
+
if (root) {
|
|
19047
|
+
const attrs = parseAttributes(root[0]);
|
|
19048
|
+
if (attrs.width && attrs.height) {
|
|
19049
|
+
return calculateByDimensions(attrs);
|
|
19050
|
+
}
|
|
19051
|
+
if (attrs.viewbox) {
|
|
19052
|
+
return calculateByViewbox(attrs, attrs.viewbox);
|
|
19053
|
+
}
|
|
19054
|
+
}
|
|
19055
|
+
throw new TypeError("Invalid SVG");
|
|
19056
|
+
}
|
|
19057
|
+
};
|
|
19058
|
+
|
|
19059
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/tga.js
|
|
19060
|
+
var TGA = {
|
|
19061
|
+
validate(input) {
|
|
19062
|
+
return readUInt16LE(input, 0) === 0 && readUInt16LE(input, 4) === 0;
|
|
19063
|
+
},
|
|
19064
|
+
calculate(input) {
|
|
19065
|
+
return {
|
|
19066
|
+
height: readUInt16LE(input, 14),
|
|
19067
|
+
width: readUInt16LE(input, 12)
|
|
19068
|
+
};
|
|
19069
|
+
}
|
|
19070
|
+
};
|
|
19071
|
+
|
|
19072
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/tiff.js
|
|
19073
|
+
var CONSTANTS = {
|
|
19074
|
+
TAG: {
|
|
19075
|
+
WIDTH: 256,
|
|
19076
|
+
HEIGHT: 257,
|
|
19077
|
+
COMPRESSION: 259
|
|
19078
|
+
},
|
|
19079
|
+
TYPE: {
|
|
19080
|
+
SHORT: 3,
|
|
19081
|
+
LONG: 4,
|
|
19082
|
+
LONG8: 16
|
|
19083
|
+
},
|
|
19084
|
+
ENTRY_SIZE: {
|
|
19085
|
+
STANDARD: 12,
|
|
19086
|
+
BIG: 20
|
|
19087
|
+
},
|
|
19088
|
+
COUNT_SIZE: {
|
|
19089
|
+
STANDARD: 2,
|
|
19090
|
+
BIG: 8
|
|
19091
|
+
}
|
|
19092
|
+
};
|
|
19093
|
+
function readIFD(input, { isBigEndian, isBigTiff }) {
|
|
19094
|
+
const ifdOffset = isBigTiff ? Number(readUInt64(input, 8, isBigEndian)) : readUInt(input, 32, 4, isBigEndian);
|
|
19095
|
+
const entryCountSize = isBigTiff ? CONSTANTS.COUNT_SIZE.BIG : CONSTANTS.COUNT_SIZE.STANDARD;
|
|
19096
|
+
return input.slice(ifdOffset + entryCountSize);
|
|
19097
|
+
}
|
|
19098
|
+
__name(readIFD, "readIFD");
|
|
19099
|
+
function readTagValue(input, type, offset, isBigEndian) {
|
|
19100
|
+
switch (type) {
|
|
19101
|
+
case CONSTANTS.TYPE.SHORT:
|
|
19102
|
+
return readUInt(input, 16, offset, isBigEndian);
|
|
19103
|
+
case CONSTANTS.TYPE.LONG:
|
|
19104
|
+
return readUInt(input, 32, offset, isBigEndian);
|
|
19105
|
+
case CONSTANTS.TYPE.LONG8: {
|
|
19106
|
+
const value = Number(readUInt64(input, offset, isBigEndian));
|
|
19107
|
+
if (value > Number.MAX_SAFE_INTEGER) {
|
|
19108
|
+
throw new TypeError("Value too large");
|
|
19109
|
+
}
|
|
19110
|
+
return value;
|
|
19111
|
+
}
|
|
19112
|
+
default:
|
|
19113
|
+
return 0;
|
|
19114
|
+
}
|
|
19115
|
+
}
|
|
19116
|
+
__name(readTagValue, "readTagValue");
|
|
19117
|
+
function nextTag(input, isBigTiff) {
|
|
19118
|
+
const entrySize = isBigTiff ? CONSTANTS.ENTRY_SIZE.BIG : CONSTANTS.ENTRY_SIZE.STANDARD;
|
|
19119
|
+
if (input.length > entrySize) {
|
|
19120
|
+
return input.slice(entrySize);
|
|
19121
|
+
}
|
|
19122
|
+
}
|
|
19123
|
+
__name(nextTag, "nextTag");
|
|
19124
|
+
function extractTags(input, { isBigEndian, isBigTiff }) {
|
|
19125
|
+
const tags = {};
|
|
19126
|
+
let temp = input;
|
|
19127
|
+
while (temp?.length) {
|
|
19128
|
+
const code = readUInt(temp, 16, 0, isBigEndian);
|
|
19129
|
+
const type = readUInt(temp, 16, 2, isBigEndian);
|
|
19130
|
+
const length = isBigTiff ? Number(readUInt64(temp, 4, isBigEndian)) : readUInt(temp, 32, 4, isBigEndian);
|
|
19131
|
+
if (code === 0)
|
|
19132
|
+
break;
|
|
19133
|
+
if (length === 1 && (type === CONSTANTS.TYPE.SHORT || type === CONSTANTS.TYPE.LONG || isBigTiff && type === CONSTANTS.TYPE.LONG8)) {
|
|
19134
|
+
const valueOffset = isBigTiff ? 12 : 8;
|
|
19135
|
+
tags[code] = readTagValue(temp, type, valueOffset, isBigEndian);
|
|
19136
|
+
}
|
|
19137
|
+
temp = nextTag(temp, isBigTiff);
|
|
19138
|
+
}
|
|
19139
|
+
return tags;
|
|
19140
|
+
}
|
|
19141
|
+
__name(extractTags, "extractTags");
|
|
19142
|
+
function determineFormat(input) {
|
|
19143
|
+
const signature = toUTF8String(input, 0, 2);
|
|
19144
|
+
const version = readUInt(input, 16, 2, signature === "MM");
|
|
19145
|
+
return {
|
|
19146
|
+
isBigEndian: signature === "MM",
|
|
19147
|
+
isBigTiff: version === 43
|
|
19148
|
+
};
|
|
19149
|
+
}
|
|
19150
|
+
__name(determineFormat, "determineFormat");
|
|
19151
|
+
function validateBigTIFFHeader(input, isBigEndian) {
|
|
19152
|
+
const byteSize = readUInt(input, 16, 4, isBigEndian);
|
|
19153
|
+
const reserved = readUInt(input, 16, 6, isBigEndian);
|
|
19154
|
+
if (byteSize !== 8 || reserved !== 0) {
|
|
19155
|
+
throw new TypeError("Invalid BigTIFF header");
|
|
19156
|
+
}
|
|
19157
|
+
}
|
|
19158
|
+
__name(validateBigTIFFHeader, "validateBigTIFFHeader");
|
|
19159
|
+
var signatures = /* @__PURE__ */ new Set([
|
|
19160
|
+
"49492a00",
|
|
19161
|
+
"4d4d002a",
|
|
19162
|
+
"49492b00",
|
|
19163
|
+
"4d4d002b"
|
|
19164
|
+
]);
|
|
19165
|
+
var TIFF = {
|
|
19166
|
+
validate: /* @__PURE__ */ __name((input) => {
|
|
19167
|
+
const signature = toHexString(input, 0, 4);
|
|
19168
|
+
return signatures.has(signature);
|
|
19169
|
+
}, "validate"),
|
|
19170
|
+
calculate(input) {
|
|
19171
|
+
const format = determineFormat(input);
|
|
19172
|
+
if (format.isBigTiff) {
|
|
19173
|
+
validateBigTIFFHeader(input, format.isBigEndian);
|
|
19174
|
+
}
|
|
19175
|
+
const ifdBuffer = readIFD(input, format);
|
|
19176
|
+
const tags = extractTags(ifdBuffer, format);
|
|
19177
|
+
const info = {
|
|
19178
|
+
height: tags[CONSTANTS.TAG.HEIGHT],
|
|
19179
|
+
width: tags[CONSTANTS.TAG.WIDTH],
|
|
19180
|
+
type: format.isBigTiff ? "bigtiff" : "tiff"
|
|
19181
|
+
};
|
|
19182
|
+
if (tags[CONSTANTS.TAG.COMPRESSION]) {
|
|
19183
|
+
info.compression = tags[CONSTANTS.TAG.COMPRESSION];
|
|
19184
|
+
}
|
|
19185
|
+
if (!info.width || !info.height) {
|
|
19186
|
+
throw new TypeError("Invalid Tiff. Missing tags");
|
|
19187
|
+
}
|
|
19188
|
+
return info;
|
|
19189
|
+
}
|
|
19190
|
+
};
|
|
19191
|
+
|
|
19192
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/webp.js
|
|
19193
|
+
function calculateExtended(input) {
|
|
19194
|
+
return {
|
|
19195
|
+
height: 1 + readUInt24LE(input, 7),
|
|
19196
|
+
width: 1 + readUInt24LE(input, 4)
|
|
19197
|
+
};
|
|
19198
|
+
}
|
|
19199
|
+
__name(calculateExtended, "calculateExtended");
|
|
19200
|
+
function calculateLossless(input) {
|
|
19201
|
+
return {
|
|
19202
|
+
height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
|
|
19203
|
+
width: 1 + ((input[2] & 63) << 8 | input[1])
|
|
19204
|
+
};
|
|
19205
|
+
}
|
|
19206
|
+
__name(calculateLossless, "calculateLossless");
|
|
19207
|
+
function calculateLossy(input) {
|
|
19208
|
+
return {
|
|
19209
|
+
height: readInt16LE(input, 8) & 16383,
|
|
19210
|
+
width: readInt16LE(input, 6) & 16383
|
|
19211
|
+
};
|
|
19212
|
+
}
|
|
19213
|
+
__name(calculateLossy, "calculateLossy");
|
|
19214
|
+
var WEBP = {
|
|
19215
|
+
validate(input) {
|
|
19216
|
+
const riffHeader = "RIFF" === toUTF8String(input, 0, 4);
|
|
19217
|
+
const webpHeader = "WEBP" === toUTF8String(input, 8, 12);
|
|
19218
|
+
const vp8Header = "VP8" === toUTF8String(input, 12, 15);
|
|
19219
|
+
return riffHeader && webpHeader && vp8Header;
|
|
19220
|
+
},
|
|
19221
|
+
calculate(_input) {
|
|
19222
|
+
const chunkHeader = toUTF8String(_input, 12, 16);
|
|
19223
|
+
const input = _input.slice(20, 30);
|
|
19224
|
+
if (chunkHeader === "VP8X") {
|
|
19225
|
+
const extendedHeader = input[0];
|
|
19226
|
+
const validStart = (extendedHeader & 192) === 0;
|
|
19227
|
+
const validEnd = (extendedHeader & 1) === 0;
|
|
19228
|
+
if (validStart && validEnd) {
|
|
19229
|
+
return calculateExtended(input);
|
|
19230
|
+
}
|
|
19231
|
+
throw new TypeError("Invalid WebP");
|
|
19232
|
+
}
|
|
19233
|
+
if (chunkHeader === "VP8 " && input[0] !== 47) {
|
|
19234
|
+
return calculateLossy(input);
|
|
19235
|
+
}
|
|
19236
|
+
const signature = toHexString(input, 3, 6);
|
|
19237
|
+
if (chunkHeader === "VP8L" && signature !== "9d012a") {
|
|
19238
|
+
return calculateLossless(input);
|
|
19239
|
+
}
|
|
19240
|
+
throw new TypeError("Invalid WebP");
|
|
19241
|
+
}
|
|
19242
|
+
};
|
|
19243
|
+
|
|
19244
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/types/index.js
|
|
19245
|
+
var typeHandlers = /* @__PURE__ */ new Map([
|
|
19246
|
+
["bmp", BMP],
|
|
19247
|
+
["cur", CUR],
|
|
19248
|
+
["dds", DDS],
|
|
19249
|
+
["gif", GIF],
|
|
19250
|
+
["heif", HEIF],
|
|
19251
|
+
["icns", ICNS],
|
|
19252
|
+
["ico", ICO],
|
|
19253
|
+
["j2c", J2C],
|
|
19254
|
+
["jp2", JP2],
|
|
19255
|
+
["jpg", JPG],
|
|
19256
|
+
["jxl", JXL],
|
|
19257
|
+
["jxl-stream", JXLStream],
|
|
19258
|
+
["ktx", KTX],
|
|
19259
|
+
["png", PNG],
|
|
19260
|
+
["pnm", PNM],
|
|
19261
|
+
["psd", PSD],
|
|
19262
|
+
["svg", SVG],
|
|
19263
|
+
["tga", TGA],
|
|
19264
|
+
["tiff", TIFF],
|
|
19265
|
+
["webp", WEBP]
|
|
19266
|
+
]);
|
|
19267
|
+
var types = Array.from(typeHandlers.keys());
|
|
19268
|
+
|
|
19269
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/detector.js
|
|
19270
|
+
var firstBytes = /* @__PURE__ */ new Map([
|
|
19271
|
+
[0, "heif"],
|
|
19272
|
+
[56, "psd"],
|
|
19273
|
+
[66, "bmp"],
|
|
19274
|
+
[68, "dds"],
|
|
19275
|
+
[71, "gif"],
|
|
19276
|
+
[73, "tiff"],
|
|
19277
|
+
[77, "tiff"],
|
|
19278
|
+
[82, "webp"],
|
|
19279
|
+
[105, "icns"],
|
|
19280
|
+
[137, "png"],
|
|
19281
|
+
[255, "jpg"]
|
|
19282
|
+
]);
|
|
19283
|
+
function detector(input) {
|
|
19284
|
+
const byte = input[0];
|
|
19285
|
+
const type = firstBytes.get(byte);
|
|
19286
|
+
if (type && typeHandlers.get(type)?.validate(input)) {
|
|
19287
|
+
return type;
|
|
19288
|
+
}
|
|
19289
|
+
return types.find((type2) => typeHandlers.get(type2)?.validate(input));
|
|
19290
|
+
}
|
|
19291
|
+
__name(detector, "detector");
|
|
19292
|
+
|
|
19293
|
+
// node_modules/.pnpm/image-size@2.0.4/node_modules/image-size/dist/esm/lookup.js
|
|
19294
|
+
var globalOptions = {
|
|
19295
|
+
disabledTypes: []
|
|
19296
|
+
};
|
|
19297
|
+
function imageSize(input) {
|
|
19298
|
+
const type = detector(input);
|
|
19299
|
+
if (typeof type !== "undefined") {
|
|
19300
|
+
if (globalOptions.disabledTypes.indexOf(type) > -1) {
|
|
19301
|
+
throw new TypeError(`disabled file type: ${type}`);
|
|
19302
|
+
}
|
|
19303
|
+
const size = typeHandlers.get(type)?.calculate(input);
|
|
19304
|
+
if (size !== void 0) {
|
|
19305
|
+
size.type = size.type ?? type;
|
|
19306
|
+
if (size.images && size.images.length > 1) {
|
|
19307
|
+
const largestImage = size.images.reduce((largest, current) => {
|
|
19308
|
+
return current.width * current.height > largest.width * largest.height ? current : largest;
|
|
19309
|
+
}, size.images[0]);
|
|
19310
|
+
size.width = largestImage.width;
|
|
19311
|
+
size.height = largestImage.height;
|
|
19312
|
+
}
|
|
19313
|
+
return size;
|
|
19314
|
+
}
|
|
19315
|
+
}
|
|
19316
|
+
throw new TypeError(`unsupported file type: ${type}`);
|
|
19317
|
+
}
|
|
19318
|
+
__name(imageSize, "imageSize");
|
|
19319
|
+
|
|
19320
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.634.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_795ed7a67bda78d624888739490b3720/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
|
|
19321
|
+
var MAX_PAGES = 20;
|
|
19322
|
+
var MAX_PIXELS = 2e7;
|
|
19323
|
+
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
19324
|
+
if (signal?.aborted)
|
|
19325
|
+
throw new CliError("cancelled", "attachment OCR cancelled");
|
|
19326
|
+
}, "cancelled");
|
|
19327
|
+
var imageOf = /* @__PURE__ */ __name((bytes) => {
|
|
19328
|
+
if (bytes.byteLength > MAX_MODEL_IMAGE_BYTES)
|
|
19329
|
+
return void 0;
|
|
19330
|
+
const { width, height, type } = imageSize(bytes);
|
|
19331
|
+
if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width < 1 || height < 1)
|
|
19332
|
+
throw new Error("invalid image dimensions");
|
|
19333
|
+
if (width * height > MAX_PIXELS || width > 8e3 || height > 8e3)
|
|
19334
|
+
return void 0;
|
|
19335
|
+
const mimeType = type === "jpg" ? "image/jpeg" : type === "png" ? "image/png" : type === "webp" ? "image/webp" : null;
|
|
19336
|
+
if (mimeType === null)
|
|
19337
|
+
return void 0;
|
|
19338
|
+
return { mimeType, data: Buffer.from(bytes).toString("base64") };
|
|
19339
|
+
}, "imageOf");
|
|
19340
|
+
var checkedText = /* @__PURE__ */ __name((text) => {
|
|
19341
|
+
if (typeof text !== "string" || !text.trim() || text.length > MAX_TEXT_CHARS)
|
|
19342
|
+
throw new Error("empty or oversized OCR result");
|
|
19343
|
+
return text;
|
|
19344
|
+
}, "checkedText");
|
|
19345
|
+
var ocrImage = /* @__PURE__ */ __name(async (bytes, pipeline, signal) => {
|
|
19346
|
+
cancelled2(signal);
|
|
19347
|
+
try {
|
|
19348
|
+
const image2 = imageOf(bytes);
|
|
19349
|
+
if (image2 === void 0)
|
|
19350
|
+
return { status: "needs-agent", extractor: pipeline.extractor };
|
|
19351
|
+
const text = checkedText(await pipeline.transcribe(image2));
|
|
19352
|
+
cancelled2(signal);
|
|
19353
|
+
return { status: "extracted", text, extractor: pipeline.extractor, pages: 1, ocrPages: 1 };
|
|
19354
|
+
} catch (error) {
|
|
19355
|
+
cancelled2(signal);
|
|
19356
|
+
return {
|
|
19357
|
+
status: "unreadable",
|
|
19358
|
+
extractor: pipeline.extractor,
|
|
19359
|
+
error: error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "ocr_failed",
|
|
19360
|
+
issue: withRecovery({
|
|
19361
|
+
code: isCliFailure(error) ? error.code : "provider_error",
|
|
19362
|
+
message: "OCR provider refused this item; retry or skip it",
|
|
19363
|
+
...isCliFailure(error) && typeof error.details?.retry_after_ms === "number" ? { retry_after_ms: error.details.retry_after_ms } : {}
|
|
19364
|
+
})
|
|
19365
|
+
};
|
|
19366
|
+
}
|
|
19367
|
+
}, "ocrImage");
|
|
19368
|
+
var ocrPdf = /* @__PURE__ */ __name(async (bytes, pipeline, load, signal) => {
|
|
19369
|
+
cancelled2(signal);
|
|
19370
|
+
let unpdf;
|
|
19371
|
+
try {
|
|
19372
|
+
unpdf = await load("unpdf");
|
|
19373
|
+
} catch {
|
|
19374
|
+
return { status: "engine-missing", engine: "unpdf" };
|
|
19375
|
+
}
|
|
19376
|
+
let document;
|
|
19377
|
+
let rendered;
|
|
19378
|
+
const close = /* @__PURE__ */ __name(() => {
|
|
19379
|
+
void document?.loadingTask.destroy().catch(() => {
|
|
19380
|
+
});
|
|
19381
|
+
void rendered?.loadingTask.destroy().catch(() => {
|
|
19382
|
+
});
|
|
19383
|
+
}, "close");
|
|
19384
|
+
try {
|
|
19385
|
+
document = await unpdf.getDocumentProxy(new Uint8Array(bytes), {
|
|
19386
|
+
isEvalSupported: false,
|
|
19387
|
+
verbosity: 0,
|
|
19388
|
+
maxImageSize: MAX_PIXELS
|
|
19389
|
+
});
|
|
19390
|
+
signal?.addEventListener("abort", close, { once: true });
|
|
19391
|
+
cancelled2(signal);
|
|
19392
|
+
if (!Number.isSafeInteger(document.numPages) || document.numPages < 1 || document.numPages > MAX_PAGES)
|
|
19393
|
+
return { status: "too-large" };
|
|
19394
|
+
const texts = [];
|
|
19395
|
+
let ocrPages = 0;
|
|
19396
|
+
let canvas;
|
|
19397
|
+
try {
|
|
19398
|
+
for (let index = 1; index <= document.numPages; index += 1) {
|
|
19399
|
+
cancelled2(signal);
|
|
19400
|
+
const page = await document.getPage(index);
|
|
19401
|
+
let text;
|
|
19402
|
+
try {
|
|
19403
|
+
const content = await page.getTextContent();
|
|
19404
|
+
text = content.items.map((item) => `${item.str ?? ""}${item.hasEOL ? "\n" : " "}`).join("").trim();
|
|
19405
|
+
if (!text) {
|
|
19406
|
+
if (typeof unpdf.createIsomorphicCanvasFactory !== "function" || typeof unpdf.renderPageAsImage !== "function")
|
|
19407
|
+
return { status: "engine-missing", engine: "unpdf" };
|
|
19408
|
+
if (canvas === void 0) {
|
|
19409
|
+
try {
|
|
19410
|
+
canvas = await load("@napi-rs/canvas");
|
|
19411
|
+
} catch {
|
|
19412
|
+
return { status: "engine-missing", engine: "@napi-rs/canvas" };
|
|
19413
|
+
}
|
|
19414
|
+
const CanvasFactory = await unpdf.createIsomorphicCanvasFactory(async () => canvas);
|
|
19415
|
+
rendered = await unpdf.getDocumentProxy(new Uint8Array(bytes), {
|
|
19416
|
+
CanvasFactory,
|
|
19417
|
+
isEvalSupported: false,
|
|
19418
|
+
verbosity: 0,
|
|
19419
|
+
maxImageSize: MAX_PIXELS
|
|
19420
|
+
});
|
|
19421
|
+
}
|
|
19422
|
+
const viewport = page.getViewport({ scale: 1 });
|
|
19423
|
+
if (![viewport.width, viewport.height].every((value) => Number.isFinite(value) && value > 0))
|
|
19424
|
+
throw new Error("invalid PDF dimensions");
|
|
19425
|
+
const scale = Math.min(2, 2e3 / viewport.width, 2e3 / viewport.height);
|
|
19426
|
+
const image2 = imageOf(new Uint8Array(await unpdf.renderPageAsImage(rendered, index, {
|
|
19427
|
+
scale,
|
|
19428
|
+
canvasImport: /* @__PURE__ */ __name(async () => canvas, "canvasImport")
|
|
19429
|
+
})));
|
|
19430
|
+
if (!image2)
|
|
19431
|
+
return { status: "too-large" };
|
|
19432
|
+
text = checkedText(await pipeline.transcribe(image2));
|
|
19433
|
+
ocrPages += 1;
|
|
19434
|
+
}
|
|
19435
|
+
} finally {
|
|
19436
|
+
page.cleanup();
|
|
19437
|
+
}
|
|
19438
|
+
cancelled2(signal);
|
|
19439
|
+
texts.push(text);
|
|
19440
|
+
if (texts.reduce((sum, one) => sum + one.length + 2, 0) > MAX_TEXT_CHARS)
|
|
19441
|
+
return { status: "too-large" };
|
|
19442
|
+
}
|
|
19443
|
+
return {
|
|
19444
|
+
status: "extracted",
|
|
19445
|
+
text: texts.join("\n\n"),
|
|
19446
|
+
extractor: pipeline.extractor,
|
|
19447
|
+
pages: document.numPages,
|
|
19448
|
+
ocrPages
|
|
19449
|
+
};
|
|
19450
|
+
} finally {
|
|
19451
|
+
await rendered?.loadingTask.destroy();
|
|
19452
|
+
}
|
|
19453
|
+
} catch (error) {
|
|
19454
|
+
cancelled2(signal);
|
|
19455
|
+
return {
|
|
19456
|
+
status: "unreadable",
|
|
19457
|
+
extractor: pipeline.extractor,
|
|
19458
|
+
error: error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "ocr_failed",
|
|
19459
|
+
issue: withRecovery({
|
|
19460
|
+
code: isCliFailure(error) ? error.code : "provider_error",
|
|
19461
|
+
message: "OCR provider refused this item; retry or skip it",
|
|
19462
|
+
...isCliFailure(error) && typeof error.details?.retry_after_ms === "number" ? { retry_after_ms: error.details.retry_after_ms } : {}
|
|
19463
|
+
})
|
|
19464
|
+
};
|
|
19465
|
+
} finally {
|
|
19466
|
+
signal?.removeEventListener("abort", close);
|
|
19467
|
+
await document?.loadingTask.destroy();
|
|
19468
|
+
}
|
|
19469
|
+
}, "ocrPdf");
|
|
19470
|
+
|
|
18083
19471
|
export {
|
|
19472
|
+
endpointKeyName,
|
|
19473
|
+
embeddingKeys,
|
|
18084
19474
|
withTimeLimit,
|
|
19475
|
+
modelGateway,
|
|
19476
|
+
withRecovery,
|
|
18085
19477
|
columnName,
|
|
18086
19478
|
documentKind,
|
|
18087
19479
|
documentExtractor,
|
|
@@ -18091,5 +19483,8 @@ export {
|
|
|
18091
19483
|
classify,
|
|
18092
19484
|
engineMissing,
|
|
18093
19485
|
engineHint,
|
|
18094
|
-
engineStates
|
|
19486
|
+
engineStates,
|
|
19487
|
+
imageSize,
|
|
19488
|
+
ocrImage,
|
|
19489
|
+
ocrPdf
|
|
18095
19490
|
};
|