@ncukondo/reference-manager 0.33.2 → 0.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{SearchableMultiSelect-CvthFBf3.js → SearchableMultiSelect-C1bNcyEp.js} +2 -2
- package/dist/chunks/{SearchableMultiSelect-CvthFBf3.js.map → SearchableMultiSelect-C1bNcyEp.js.map} +1 -1
- package/dist/chunks/{action-menu-BWSeIIPB.js → action-menu-DBurp2_T.js} +3 -3
- package/dist/chunks/{action-menu-BWSeIIPB.js.map → action-menu-DBurp2_T.js.map} +1 -1
- package/dist/chunks/{checker-Bsxp9sCm.js → checker-DNZIxT-K.js} +4 -4
- package/dist/chunks/{checker-Bsxp9sCm.js.map → checker-DNZIxT-K.js.map} +1 -1
- package/dist/chunks/{crossref-client-CYwiZLF9.js → crossref-client-Ch4VorVK.js} +2 -2
- package/dist/chunks/{crossref-client-CYwiZLF9.js.map → crossref-client-Ch4VorVK.js.map} +1 -1
- package/dist/chunks/{fix-interaction-Ebrjh1H0.js → fix-interaction-DYmWi0uI.js} +5 -5
- package/dist/chunks/{fix-interaction-Ebrjh1H0.js.map → fix-interaction-DYmWi0uI.js.map} +1 -1
- package/dist/chunks/{index-BrfxHfSZ.js → index-Br6PW0sE.js} +4 -4
- package/dist/chunks/{index-BrfxHfSZ.js.map → index-Br6PW0sE.js.map} +1 -1
- package/dist/chunks/{index-CA7km4m0.js → index-D1nWqhHq.js} +271 -270
- package/dist/chunks/index-D1nWqhHq.js.map +1 -0
- package/dist/chunks/{index-QxdPt5c9.js → index-Dc9_7yoj.js} +3 -3
- package/dist/chunks/index-Dc9_7yoj.js.map +1 -0
- package/dist/chunks/{index-Bm25py-B.js → index-NVk2MuLS.js} +38 -28
- package/dist/chunks/index-NVk2MuLS.js.map +1 -0
- package/dist/chunks/{pubmed-client-Cw87sE2s.js → pubmed-client-oyH3AjO7.js} +2 -2
- package/dist/chunks/{pubmed-client-Cw87sE2s.js.map → pubmed-client-oyH3AjO7.js.map} +1 -1
- package/dist/chunks/{reference-select-CsXBOR8g.js → reference-select-BDL2RR3f.js} +3 -3
- package/dist/chunks/{reference-select-CsXBOR8g.js.map → reference-select-BDL2RR3f.js.map} +1 -1
- package/dist/chunks/{style-select-Bo9u9rtE.js → style-select-BVVwP7BF.js} +3 -3
- package/dist/chunks/{style-select-Bo9u9rtE.js.map → style-select-BVVwP7BF.js.map} +1 -1
- package/dist/cli/commands/add.d.ts +5 -0
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/server.js +3 -3
- package/package.json +1 -1
- package/dist/chunks/index-Bm25py-B.js.map +0 -1
- package/dist/chunks/index-CA7km4m0.js.map +0 -1
- package/dist/chunks/index-QxdPt5c9.js.map +0 -1
|
@@ -19,7 +19,7 @@ import "@citation-js/plugin-csl";
|
|
|
19
19
|
import { exec, execFile } from "node:child_process";
|
|
20
20
|
import "node:crypto";
|
|
21
21
|
const name = "@ncukondo/reference-manager";
|
|
22
|
-
const version = "0.33.
|
|
22
|
+
const version = "0.33.3";
|
|
23
23
|
const description = "A local reference management tool using CSL-JSON as the single source of truth";
|
|
24
24
|
const publishConfig = { "access": "public" };
|
|
25
25
|
const type$1 = "module";
|
|
@@ -57,6 +57,247 @@ const packageJson = {
|
|
|
57
57
|
repository,
|
|
58
58
|
"lint-staged": { "*.{ts,tsx,js,jsx}": ["biome check --write"] }
|
|
59
59
|
};
|
|
60
|
+
const DOI_URL_PREFIXES$1 = [
|
|
61
|
+
"https://doi.org/",
|
|
62
|
+
"http://doi.org/",
|
|
63
|
+
"https://dx.doi.org/",
|
|
64
|
+
"http://dx.doi.org/"
|
|
65
|
+
];
|
|
66
|
+
function normalizeDoi(doi) {
|
|
67
|
+
const trimmed = doi.trim();
|
|
68
|
+
if (!trimmed) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
const lowerInput = trimmed.toLowerCase();
|
|
72
|
+
for (const prefix of DOI_URL_PREFIXES$1) {
|
|
73
|
+
if (lowerInput.startsWith(prefix.toLowerCase())) {
|
|
74
|
+
return trimmed.slice(prefix.length);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return trimmed;
|
|
78
|
+
}
|
|
79
|
+
function normalizePmid(pmid) {
|
|
80
|
+
const trimmed = pmid.trim();
|
|
81
|
+
if (!trimmed) {
|
|
82
|
+
return "";
|
|
83
|
+
}
|
|
84
|
+
const normalized = trimmed.replace(/^pmid:\s*/i, "");
|
|
85
|
+
return normalized.trim();
|
|
86
|
+
}
|
|
87
|
+
function normalizeIsbn(isbn) {
|
|
88
|
+
const trimmed = isbn.trim();
|
|
89
|
+
if (!trimmed) {
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
if (!/^isbn:/i.test(trimmed)) {
|
|
93
|
+
return "";
|
|
94
|
+
}
|
|
95
|
+
let normalized = trimmed.replace(/^isbn:\s*/i, "");
|
|
96
|
+
normalized = normalized.replace(/[-\s]/g, "");
|
|
97
|
+
normalized = normalized.toUpperCase();
|
|
98
|
+
return normalized;
|
|
99
|
+
}
|
|
100
|
+
const ARXIV_URL_PREFIXES = [
|
|
101
|
+
"https://arxiv.org/abs/",
|
|
102
|
+
"http://arxiv.org/abs/",
|
|
103
|
+
"https://arxiv.org/pdf/",
|
|
104
|
+
"http://arxiv.org/pdf/",
|
|
105
|
+
"https://arxiv.org/html/",
|
|
106
|
+
"http://arxiv.org/html/"
|
|
107
|
+
];
|
|
108
|
+
function normalizeArxiv(arxiv) {
|
|
109
|
+
const trimmed = arxiv.trim();
|
|
110
|
+
if (!trimmed) {
|
|
111
|
+
return "";
|
|
112
|
+
}
|
|
113
|
+
const lowerInput = trimmed.toLowerCase();
|
|
114
|
+
for (const prefix of ARXIV_URL_PREFIXES) {
|
|
115
|
+
if (lowerInput.startsWith(prefix.toLowerCase())) {
|
|
116
|
+
return trimmed.slice(prefix.length);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const withoutPrefix = trimmed.replace(/^arxiv:\s*/i, "");
|
|
120
|
+
return withoutPrefix;
|
|
121
|
+
}
|
|
122
|
+
const EXTENSION_MAP = {
|
|
123
|
+
".json": "json",
|
|
124
|
+
".bib": "bibtex",
|
|
125
|
+
".ris": "ris",
|
|
126
|
+
".nbib": "nbib"
|
|
127
|
+
};
|
|
128
|
+
const DOI_URL_PREFIXES = [
|
|
129
|
+
"https://doi.org/",
|
|
130
|
+
"http://doi.org/",
|
|
131
|
+
"https://dx.doi.org/",
|
|
132
|
+
"http://dx.doi.org/"
|
|
133
|
+
];
|
|
134
|
+
function detectByExtension(input) {
|
|
135
|
+
if (!input) return "unknown";
|
|
136
|
+
const dotIndex = input.lastIndexOf(".");
|
|
137
|
+
if (dotIndex === -1 || dotIndex === input.length - 1) {
|
|
138
|
+
return "unknown";
|
|
139
|
+
}
|
|
140
|
+
const ext = input.slice(dotIndex).toLowerCase();
|
|
141
|
+
return EXTENSION_MAP[ext] ?? "unknown";
|
|
142
|
+
}
|
|
143
|
+
function detectByContent(content) {
|
|
144
|
+
const trimmed = content.trim();
|
|
145
|
+
if (!trimmed) return "unknown";
|
|
146
|
+
if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
|
|
147
|
+
return "json";
|
|
148
|
+
}
|
|
149
|
+
if (trimmed.startsWith("@")) {
|
|
150
|
+
return "bibtex";
|
|
151
|
+
}
|
|
152
|
+
if (trimmed.startsWith("TY -")) {
|
|
153
|
+
return "ris";
|
|
154
|
+
}
|
|
155
|
+
if (trimmed.startsWith("PMID-")) {
|
|
156
|
+
return "nbib";
|
|
157
|
+
}
|
|
158
|
+
return detectIdentifier(trimmed);
|
|
159
|
+
}
|
|
160
|
+
function detectIdentifier(input) {
|
|
161
|
+
const parts = input.split(/\s+/).filter((p) => p.length > 0);
|
|
162
|
+
if (parts.length === 0) {
|
|
163
|
+
return "unknown";
|
|
164
|
+
}
|
|
165
|
+
const formats = [];
|
|
166
|
+
for (const part of parts) {
|
|
167
|
+
const format = detectSingleIdentifier(part);
|
|
168
|
+
if (format === "unknown") {
|
|
169
|
+
return "unknown";
|
|
170
|
+
}
|
|
171
|
+
formats.push(format);
|
|
172
|
+
}
|
|
173
|
+
if (formats.length === 1) {
|
|
174
|
+
return formats[0];
|
|
175
|
+
}
|
|
176
|
+
return "identifiers";
|
|
177
|
+
}
|
|
178
|
+
function detectSingleIdentifier(input) {
|
|
179
|
+
if (isDoi(input)) {
|
|
180
|
+
return "doi";
|
|
181
|
+
}
|
|
182
|
+
if (isArxiv(input)) {
|
|
183
|
+
return "arxiv";
|
|
184
|
+
}
|
|
185
|
+
if (isIsbn(input)) {
|
|
186
|
+
return "isbn";
|
|
187
|
+
}
|
|
188
|
+
if (extractPubmedId(input) !== null) {
|
|
189
|
+
return "pmid";
|
|
190
|
+
}
|
|
191
|
+
if (isPmid(input)) {
|
|
192
|
+
return "pmid";
|
|
193
|
+
}
|
|
194
|
+
if (isUrl(input)) {
|
|
195
|
+
return "url";
|
|
196
|
+
}
|
|
197
|
+
return "unknown";
|
|
198
|
+
}
|
|
199
|
+
const PUBMED_URL_PATTERNS = [
|
|
200
|
+
// https://pubmed.ncbi.nlm.nih.gov/{PMID}/
|
|
201
|
+
{
|
|
202
|
+
pattern: /^https?:\/\/pubmed\.ncbi\.nlm\.nih\.gov\/(\d+)\/?$/,
|
|
203
|
+
extract: (m) => m[1]
|
|
204
|
+
},
|
|
205
|
+
// https://www.ncbi.nlm.nih.gov/pubmed/{PMID}
|
|
206
|
+
{
|
|
207
|
+
pattern: /^https?:\/\/(?:www\.)?ncbi\.nlm\.nih\.gov\/pubmed\/(\d+)\/?$/,
|
|
208
|
+
extract: (m) => m[1]
|
|
209
|
+
},
|
|
210
|
+
// https://pmc.ncbi.nlm.nih.gov/articles/PMC{ID}/
|
|
211
|
+
{
|
|
212
|
+
pattern: /^https?:\/\/(?:www\.)?pmc\.ncbi\.nlm\.nih\.gov\/articles\/PMC(\d+)\/?$/,
|
|
213
|
+
extract: (m) => `PMC${m[1]}`
|
|
214
|
+
}
|
|
215
|
+
];
|
|
216
|
+
function extractPubmedId(input) {
|
|
217
|
+
for (const { pattern, extract } of PUBMED_URL_PATTERNS) {
|
|
218
|
+
const match = pattern.exec(input);
|
|
219
|
+
if (match) {
|
|
220
|
+
return extract(match);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
function isUrl(input) {
|
|
226
|
+
if (!input) return false;
|
|
227
|
+
const lower = input.toLowerCase();
|
|
228
|
+
if (!lower.startsWith("http://") && !lower.startsWith("https://")) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
if (isDoi(input)) return false;
|
|
232
|
+
if (isArxiv(input)) return false;
|
|
233
|
+
if (extractPubmedId(input) !== null) return false;
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
function isDoi(input) {
|
|
237
|
+
for (const prefix of DOI_URL_PREFIXES) {
|
|
238
|
+
if (input.toLowerCase().startsWith(prefix.toLowerCase())) {
|
|
239
|
+
const remainder = input.slice(prefix.length);
|
|
240
|
+
return isDoiFormat(remainder);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return isDoiFormat(input);
|
|
244
|
+
}
|
|
245
|
+
function isDoiFormat(input) {
|
|
246
|
+
if (!input.startsWith("10.")) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
if (input.length <= 3) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
const slashIndex = input.indexOf("/");
|
|
253
|
+
if (slashIndex === -1 || slashIndex <= 3) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
function isPmid(input) {
|
|
259
|
+
if (!input || input.length === 0) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
const normalized = normalizePmid(input);
|
|
263
|
+
if (!normalized) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
return /^\d+$/.test(normalized);
|
|
267
|
+
}
|
|
268
|
+
function isIsbn(input) {
|
|
269
|
+
if (!input || input.length === 0) {
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
const normalized = normalizeIsbn(input);
|
|
273
|
+
if (!normalized) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
if (normalized.length !== 10 && normalized.length !== 13) {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
if (normalized.length === 10) {
|
|
280
|
+
if (!/^\d{9}[\dX]$/.test(normalized)) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
if (!/^\d{13}$/.test(normalized)) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
const ARXIV_ID_PATTERN = /^\d{4}\.\d{4,5}(v\d+)?$/;
|
|
291
|
+
function isArxiv(input) {
|
|
292
|
+
if (!input || input.length === 0) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
const normalized = normalizeArxiv(input);
|
|
296
|
+
if (!normalized) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
return ARXIV_ID_PATTERN.test(normalized);
|
|
300
|
+
}
|
|
60
301
|
function slugifyLabel(label) {
|
|
61
302
|
return label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
62
303
|
}
|
|
@@ -11519,247 +11760,6 @@ function getArxivFromCache(arxivId) {
|
|
|
11519
11760
|
function cacheArxivResult(arxivId, item, config) {
|
|
11520
11761
|
storeInCache(arxivCache, arxivId, item);
|
|
11521
11762
|
}
|
|
11522
|
-
const DOI_URL_PREFIXES$1 = [
|
|
11523
|
-
"https://doi.org/",
|
|
11524
|
-
"http://doi.org/",
|
|
11525
|
-
"https://dx.doi.org/",
|
|
11526
|
-
"http://dx.doi.org/"
|
|
11527
|
-
];
|
|
11528
|
-
function normalizeDoi(doi) {
|
|
11529
|
-
const trimmed = doi.trim();
|
|
11530
|
-
if (!trimmed) {
|
|
11531
|
-
return "";
|
|
11532
|
-
}
|
|
11533
|
-
const lowerInput = trimmed.toLowerCase();
|
|
11534
|
-
for (const prefix of DOI_URL_PREFIXES$1) {
|
|
11535
|
-
if (lowerInput.startsWith(prefix.toLowerCase())) {
|
|
11536
|
-
return trimmed.slice(prefix.length);
|
|
11537
|
-
}
|
|
11538
|
-
}
|
|
11539
|
-
return trimmed;
|
|
11540
|
-
}
|
|
11541
|
-
function normalizePmid(pmid) {
|
|
11542
|
-
const trimmed = pmid.trim();
|
|
11543
|
-
if (!trimmed) {
|
|
11544
|
-
return "";
|
|
11545
|
-
}
|
|
11546
|
-
const normalized = trimmed.replace(/^pmid:\s*/i, "");
|
|
11547
|
-
return normalized.trim();
|
|
11548
|
-
}
|
|
11549
|
-
function normalizeIsbn(isbn) {
|
|
11550
|
-
const trimmed = isbn.trim();
|
|
11551
|
-
if (!trimmed) {
|
|
11552
|
-
return "";
|
|
11553
|
-
}
|
|
11554
|
-
if (!/^isbn:/i.test(trimmed)) {
|
|
11555
|
-
return "";
|
|
11556
|
-
}
|
|
11557
|
-
let normalized = trimmed.replace(/^isbn:\s*/i, "");
|
|
11558
|
-
normalized = normalized.replace(/[-\s]/g, "");
|
|
11559
|
-
normalized = normalized.toUpperCase();
|
|
11560
|
-
return normalized;
|
|
11561
|
-
}
|
|
11562
|
-
const ARXIV_URL_PREFIXES = [
|
|
11563
|
-
"https://arxiv.org/abs/",
|
|
11564
|
-
"http://arxiv.org/abs/",
|
|
11565
|
-
"https://arxiv.org/pdf/",
|
|
11566
|
-
"http://arxiv.org/pdf/",
|
|
11567
|
-
"https://arxiv.org/html/",
|
|
11568
|
-
"http://arxiv.org/html/"
|
|
11569
|
-
];
|
|
11570
|
-
function normalizeArxiv(arxiv) {
|
|
11571
|
-
const trimmed = arxiv.trim();
|
|
11572
|
-
if (!trimmed) {
|
|
11573
|
-
return "";
|
|
11574
|
-
}
|
|
11575
|
-
const lowerInput = trimmed.toLowerCase();
|
|
11576
|
-
for (const prefix of ARXIV_URL_PREFIXES) {
|
|
11577
|
-
if (lowerInput.startsWith(prefix.toLowerCase())) {
|
|
11578
|
-
return trimmed.slice(prefix.length);
|
|
11579
|
-
}
|
|
11580
|
-
}
|
|
11581
|
-
const withoutPrefix = trimmed.replace(/^arxiv:\s*/i, "");
|
|
11582
|
-
return withoutPrefix;
|
|
11583
|
-
}
|
|
11584
|
-
const EXTENSION_MAP = {
|
|
11585
|
-
".json": "json",
|
|
11586
|
-
".bib": "bibtex",
|
|
11587
|
-
".ris": "ris",
|
|
11588
|
-
".nbib": "nbib"
|
|
11589
|
-
};
|
|
11590
|
-
const DOI_URL_PREFIXES = [
|
|
11591
|
-
"https://doi.org/",
|
|
11592
|
-
"http://doi.org/",
|
|
11593
|
-
"https://dx.doi.org/",
|
|
11594
|
-
"http://dx.doi.org/"
|
|
11595
|
-
];
|
|
11596
|
-
function detectByExtension(input) {
|
|
11597
|
-
if (!input) return "unknown";
|
|
11598
|
-
const dotIndex = input.lastIndexOf(".");
|
|
11599
|
-
if (dotIndex === -1 || dotIndex === input.length - 1) {
|
|
11600
|
-
return "unknown";
|
|
11601
|
-
}
|
|
11602
|
-
const ext = input.slice(dotIndex).toLowerCase();
|
|
11603
|
-
return EXTENSION_MAP[ext] ?? "unknown";
|
|
11604
|
-
}
|
|
11605
|
-
function detectByContent(content) {
|
|
11606
|
-
const trimmed = content.trim();
|
|
11607
|
-
if (!trimmed) return "unknown";
|
|
11608
|
-
if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
|
|
11609
|
-
return "json";
|
|
11610
|
-
}
|
|
11611
|
-
if (trimmed.startsWith("@")) {
|
|
11612
|
-
return "bibtex";
|
|
11613
|
-
}
|
|
11614
|
-
if (trimmed.startsWith("TY -")) {
|
|
11615
|
-
return "ris";
|
|
11616
|
-
}
|
|
11617
|
-
if (trimmed.startsWith("PMID-")) {
|
|
11618
|
-
return "nbib";
|
|
11619
|
-
}
|
|
11620
|
-
return detectIdentifier(trimmed);
|
|
11621
|
-
}
|
|
11622
|
-
function detectIdentifier(input) {
|
|
11623
|
-
const parts = input.split(/\s+/).filter((p) => p.length > 0);
|
|
11624
|
-
if (parts.length === 0) {
|
|
11625
|
-
return "unknown";
|
|
11626
|
-
}
|
|
11627
|
-
const formats = [];
|
|
11628
|
-
for (const part of parts) {
|
|
11629
|
-
const format = detectSingleIdentifier(part);
|
|
11630
|
-
if (format === "unknown") {
|
|
11631
|
-
return "unknown";
|
|
11632
|
-
}
|
|
11633
|
-
formats.push(format);
|
|
11634
|
-
}
|
|
11635
|
-
if (formats.length === 1) {
|
|
11636
|
-
return formats[0];
|
|
11637
|
-
}
|
|
11638
|
-
return "identifiers";
|
|
11639
|
-
}
|
|
11640
|
-
function detectSingleIdentifier(input) {
|
|
11641
|
-
if (isDoi(input)) {
|
|
11642
|
-
return "doi";
|
|
11643
|
-
}
|
|
11644
|
-
if (isArxiv(input)) {
|
|
11645
|
-
return "arxiv";
|
|
11646
|
-
}
|
|
11647
|
-
if (isIsbn(input)) {
|
|
11648
|
-
return "isbn";
|
|
11649
|
-
}
|
|
11650
|
-
if (extractPubmedId(input) !== null) {
|
|
11651
|
-
return "pmid";
|
|
11652
|
-
}
|
|
11653
|
-
if (isPmid(input)) {
|
|
11654
|
-
return "pmid";
|
|
11655
|
-
}
|
|
11656
|
-
if (isUrl(input)) {
|
|
11657
|
-
return "url";
|
|
11658
|
-
}
|
|
11659
|
-
return "unknown";
|
|
11660
|
-
}
|
|
11661
|
-
const PUBMED_URL_PATTERNS = [
|
|
11662
|
-
// https://pubmed.ncbi.nlm.nih.gov/{PMID}/
|
|
11663
|
-
{
|
|
11664
|
-
pattern: /^https?:\/\/pubmed\.ncbi\.nlm\.nih\.gov\/(\d+)\/?$/,
|
|
11665
|
-
extract: (m) => m[1]
|
|
11666
|
-
},
|
|
11667
|
-
// https://www.ncbi.nlm.nih.gov/pubmed/{PMID}
|
|
11668
|
-
{
|
|
11669
|
-
pattern: /^https?:\/\/(?:www\.)?ncbi\.nlm\.nih\.gov\/pubmed\/(\d+)\/?$/,
|
|
11670
|
-
extract: (m) => m[1]
|
|
11671
|
-
},
|
|
11672
|
-
// https://pmc.ncbi.nlm.nih.gov/articles/PMC{ID}/
|
|
11673
|
-
{
|
|
11674
|
-
pattern: /^https?:\/\/(?:www\.)?pmc\.ncbi\.nlm\.nih\.gov\/articles\/PMC(\d+)\/?$/,
|
|
11675
|
-
extract: (m) => `PMC${m[1]}`
|
|
11676
|
-
}
|
|
11677
|
-
];
|
|
11678
|
-
function extractPubmedId(input) {
|
|
11679
|
-
for (const { pattern, extract } of PUBMED_URL_PATTERNS) {
|
|
11680
|
-
const match = pattern.exec(input);
|
|
11681
|
-
if (match) {
|
|
11682
|
-
return extract(match);
|
|
11683
|
-
}
|
|
11684
|
-
}
|
|
11685
|
-
return null;
|
|
11686
|
-
}
|
|
11687
|
-
function isUrl(input) {
|
|
11688
|
-
if (!input) return false;
|
|
11689
|
-
const lower = input.toLowerCase();
|
|
11690
|
-
if (!lower.startsWith("http://") && !lower.startsWith("https://")) {
|
|
11691
|
-
return false;
|
|
11692
|
-
}
|
|
11693
|
-
if (isDoi(input)) return false;
|
|
11694
|
-
if (isArxiv(input)) return false;
|
|
11695
|
-
if (extractPubmedId(input) !== null) return false;
|
|
11696
|
-
return true;
|
|
11697
|
-
}
|
|
11698
|
-
function isDoi(input) {
|
|
11699
|
-
for (const prefix of DOI_URL_PREFIXES) {
|
|
11700
|
-
if (input.toLowerCase().startsWith(prefix.toLowerCase())) {
|
|
11701
|
-
const remainder = input.slice(prefix.length);
|
|
11702
|
-
return isDoiFormat(remainder);
|
|
11703
|
-
}
|
|
11704
|
-
}
|
|
11705
|
-
return isDoiFormat(input);
|
|
11706
|
-
}
|
|
11707
|
-
function isDoiFormat(input) {
|
|
11708
|
-
if (!input.startsWith("10.")) {
|
|
11709
|
-
return false;
|
|
11710
|
-
}
|
|
11711
|
-
if (input.length <= 3) {
|
|
11712
|
-
return false;
|
|
11713
|
-
}
|
|
11714
|
-
const slashIndex = input.indexOf("/");
|
|
11715
|
-
if (slashIndex === -1 || slashIndex <= 3) {
|
|
11716
|
-
return false;
|
|
11717
|
-
}
|
|
11718
|
-
return true;
|
|
11719
|
-
}
|
|
11720
|
-
function isPmid(input) {
|
|
11721
|
-
if (!input || input.length === 0) {
|
|
11722
|
-
return false;
|
|
11723
|
-
}
|
|
11724
|
-
const normalized = normalizePmid(input);
|
|
11725
|
-
if (!normalized) {
|
|
11726
|
-
return false;
|
|
11727
|
-
}
|
|
11728
|
-
return /^\d+$/.test(normalized);
|
|
11729
|
-
}
|
|
11730
|
-
function isIsbn(input) {
|
|
11731
|
-
if (!input || input.length === 0) {
|
|
11732
|
-
return false;
|
|
11733
|
-
}
|
|
11734
|
-
const normalized = normalizeIsbn(input);
|
|
11735
|
-
if (!normalized) {
|
|
11736
|
-
return false;
|
|
11737
|
-
}
|
|
11738
|
-
if (normalized.length !== 10 && normalized.length !== 13) {
|
|
11739
|
-
return false;
|
|
11740
|
-
}
|
|
11741
|
-
if (normalized.length === 10) {
|
|
11742
|
-
if (!/^\d{9}[\dX]$/.test(normalized)) {
|
|
11743
|
-
return false;
|
|
11744
|
-
}
|
|
11745
|
-
return true;
|
|
11746
|
-
}
|
|
11747
|
-
if (!/^\d{13}$/.test(normalized)) {
|
|
11748
|
-
return false;
|
|
11749
|
-
}
|
|
11750
|
-
return true;
|
|
11751
|
-
}
|
|
11752
|
-
const ARXIV_ID_PATTERN = /^\d{4}\.\d{4,5}(v\d+)?$/;
|
|
11753
|
-
function isArxiv(input) {
|
|
11754
|
-
if (!input || input.length === 0) {
|
|
11755
|
-
return false;
|
|
11756
|
-
}
|
|
11757
|
-
const normalized = normalizeArxiv(input);
|
|
11758
|
-
if (!normalized) {
|
|
11759
|
-
return false;
|
|
11760
|
-
}
|
|
11761
|
-
return ARXIV_ID_PATTERN.test(normalized);
|
|
11762
|
-
}
|
|
11763
11763
|
const RATE_LIMITS = {
|
|
11764
11764
|
pubmed: {
|
|
11765
11765
|
withoutApiKey: 3,
|
|
@@ -13538,7 +13538,7 @@ function createAddRoute(library, config) {
|
|
|
13538
13538
|
}
|
|
13539
13539
|
const CHECK_CONCURRENCY = 5;
|
|
13540
13540
|
async function checkReferences(library, options) {
|
|
13541
|
-
const { checkReference } = await import("./checker-
|
|
13541
|
+
const { checkReference } = await import("./checker-DNZIxT-K.js");
|
|
13542
13542
|
const save = options.save !== false;
|
|
13543
13543
|
const skipDays = options.skipDays ?? 7;
|
|
13544
13544
|
const items = await resolveItems(library, options);
|
|
@@ -14195,40 +14195,41 @@ async function startServerWithFileWatcher(libraryPath, config) {
|
|
|
14195
14195
|
};
|
|
14196
14196
|
}
|
|
14197
14197
|
export {
|
|
14198
|
-
|
|
14198
|
+
fetch$1 as A,
|
|
14199
14199
|
BUILTIN_STYLES as B,
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14200
|
+
remove as C,
|
|
14201
|
+
fetcher as D,
|
|
14202
|
+
add as E,
|
|
14203
|
+
check as F,
|
|
14204
|
+
cite as G,
|
|
14205
|
+
list as H,
|
|
14206
|
+
search as I,
|
|
14206
14207
|
RESERVED_ROLES as R,
|
|
14207
14208
|
addAttachment as a,
|
|
14208
|
-
|
|
14209
|
-
|
|
14209
|
+
isReservedRole as b,
|
|
14210
|
+
generateFilename as c,
|
|
14210
14211
|
deleteDirectoryIfEmpty as d,
|
|
14211
14212
|
ensureDirectory as e,
|
|
14212
14213
|
formatBibliographyCSL as f,
|
|
14213
14214
|
getRateLimiter as g,
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14215
|
+
findFulltextFiles as h,
|
|
14216
|
+
isUrl as i,
|
|
14217
|
+
findFulltextFile as j,
|
|
14218
|
+
extensionToFormat as k,
|
|
14219
|
+
fulltextAttach as l,
|
|
14220
|
+
fulltextDiscover as m,
|
|
14220
14221
|
normalizePathForOutput as n,
|
|
14221
|
-
|
|
14222
|
+
fulltextFetch as o,
|
|
14222
14223
|
parseFilename as p,
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14224
|
+
fulltextConvert as q,
|
|
14225
|
+
fulltextGet as r,
|
|
14226
|
+
getExtension as s,
|
|
14227
|
+
getDefaultExportFromCjs as t,
|
|
14228
|
+
packageJson as u,
|
|
14229
|
+
getFulltextAttachmentTypes as v,
|
|
14230
|
+
startServerWithFileWatcher as w,
|
|
14231
|
+
BUILTIN_CONVERTER_NAMES as x,
|
|
14232
|
+
BUILTIN_CONVERTER_INFO as y,
|
|
14233
|
+
createServer as z
|
|
14233
14234
|
};
|
|
14234
|
-
//# sourceMappingURL=index-
|
|
14235
|
+
//# sourceMappingURL=index-D1nWqhHq.js.map
|