@embedpdf/engine-core 3.0.0-next.13 → 3.0.0-next.14
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/{AbortError-DHqPBnYc.js → AbortError-DwuHPK_I.js} +2 -2
- package/dist/{AbortError-DHqPBnYc.js.map → AbortError-DwuHPK_I.js.map} +1 -1
- package/dist/{AbortError-Cq2igpZ6.cjs → AbortError-P0RU0Mgg.cjs} +4 -4
- package/dist/{AbortError-Cq2igpZ6.cjs.map → AbortError-P0RU0Mgg.cjs.map} +1 -1
- package/dist/{AnnotationListSnapshot-D3mFut1e.d.cts → AnnotationListSnapshot-D9R5n2Kf.d.cts} +237 -7
- package/dist/{AnnotationListSnapshot-D3mFut1e.d.ts → AnnotationListSnapshot-D9R5n2Kf.d.ts} +237 -7
- package/dist/{DocumentSecurityService-ClTZc0zO.d.cts → DocumentSecurityService-CIx1MT0T.d.cts} +2 -2
- package/dist/{DocumentSecurityService-_JRjqvoI.d.ts → DocumentSecurityService-Ca6EK3-3.d.ts} +2 -2
- package/dist/{Engine-Bx0NOfmd.d.cts → Engine-EWWHhEIi.d.ts} +17 -4
- package/dist/{Engine-DxtpCYcP.d.ts → Engine-FNaAEjfb.d.cts} +17 -4
- package/dist/conformance.cjs +382 -95
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +7 -3
- package/dist/conformance.d.ts +7 -3
- package/dist/conformance.js +302 -16
- package/dist/conformance.js.map +1 -1
- package/dist/derive-BbsDk_Kz.cjs +880 -0
- package/dist/derive-BbsDk_Kz.cjs.map +1 -0
- package/dist/derive-DAFJolWu.js +647 -0
- package/dist/derive-DAFJolWu.js.map +1 -0
- package/dist/{PageInsertBlankInput-cHq9-i-z.js → format-Bbphf4zR.js} +59 -2
- package/dist/format-Bbphf4zR.js.map +1 -0
- package/dist/{PageInsertBlankInput-CqXBmFhN.cjs → format-D_epWlob.cjs} +70 -1
- package/dist/format-D_epWlob.cjs.map +1 -0
- package/dist/index.cjs +127 -107
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/runtime.cjs +137 -117
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +29 -5
- package/dist/runtime.d.ts +29 -5
- package/dist/runtime.js +5 -5
- package/dist/{schemas-BLARNCgx.js → schemas-CFQGvWiu.js} +134 -4
- package/dist/schemas-CFQGvWiu.js.map +1 -0
- package/dist/{schemas-DIqFMmrC.cjs → schemas-D0g6tKa9.cjs} +250 -24
- package/dist/schemas-D0g6tKa9.cjs.map +1 -0
- package/dist/{builders-Bqm8yTpi.cjs → viewport-BWeNHZmb.cjs} +71 -132
- package/dist/viewport-BWeNHZmb.cjs.map +1 -0
- package/dist/{builders-Dqo2X-dt.js → viewport-CvMcadfQ.js} +39 -88
- package/dist/viewport-CvMcadfQ.js.map +1 -0
- package/dist/wire.cjs +25 -2
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +2739 -8
- package/dist/wire.d.ts +2739 -8
- package/dist/wire.js +10 -3
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
- package/dist/PageInsertBlankInput-CqXBmFhN.cjs.map +0 -1
- package/dist/PageInsertBlankInput-cHq9-i-z.js.map +0 -1
- package/dist/builders-Bqm8yTpi.cjs.map +0 -1
- package/dist/builders-Dqo2X-dt.js.map +0 -1
- package/dist/fold-2V29cxCV.cjs +0 -447
- package/dist/fold-2V29cxCV.cjs.map +0 -1
- package/dist/fold-CdEJTBTn.js +0 -334
- package/dist/fold-CdEJTBTn.js.map +0 -1
- package/dist/schemas-BLARNCgx.js.map +0 -1
- package/dist/schemas-DIqFMmrC.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const require_derive = require("./derive-BbsDk_Kz.cjs");
|
|
2
|
+
const require_format = require("./format-D_epWlob.cjs");
|
|
3
3
|
const require_resolver = require("./resolver-CYVNV4hn.cjs");
|
|
4
4
|
//#region src/dto/PdfAction.ts
|
|
5
5
|
/**
|
|
@@ -30,7 +30,7 @@ function createPageImageHandle(result, blobSource) {
|
|
|
30
30
|
return {
|
|
31
31
|
...result,
|
|
32
32
|
async objectUrl(signal) {
|
|
33
|
-
if (typeof Blob === "undefined" || typeof URL === "undefined" || !URL.createObjectURL) throw new
|
|
33
|
+
if (typeof Blob === "undefined" || typeof URL === "undefined" || !URL.createObjectURL) throw new require_derive.EngineError(require_format.EngineErrorCode.RuntimeUnavailable, "Object URLs are not available in this environment");
|
|
34
34
|
const blob = await blobSource.blob(signal);
|
|
35
35
|
const url = URL.createObjectURL(blob);
|
|
36
36
|
return {
|
|
@@ -272,7 +272,7 @@ function parseJpeg(buffer) {
|
|
|
272
272
|
async function normalizeAttachmentFileSource(file, key) {
|
|
273
273
|
const resolved = await resolveBinarySource(file.data);
|
|
274
274
|
const name = file.name ?? resolved.name;
|
|
275
|
-
if (!name) throw new
|
|
275
|
+
if (!name) throw new require_derive.EngineError(require_format.EngineErrorCode.InvalidArg, "attachment file requires a name — pass { data, name } or a File whose name is set");
|
|
276
276
|
const mimeType = file.mimeType ?? resolved.mimeType;
|
|
277
277
|
return {
|
|
278
278
|
wireFile: {
|
|
@@ -310,7 +310,7 @@ async function normalizeFileAttachmentDraft(draft, allocateKey) {
|
|
|
310
310
|
async function resolveStampSource(source) {
|
|
311
311
|
const resolved = await resolveBinarySource(source);
|
|
312
312
|
const meta = sniffBinaryMetadata(resolved.bytes);
|
|
313
|
-
if (!meta) throw new
|
|
313
|
+
if (!meta) throw new require_derive.EngineError(require_format.EngineErrorCode.InvalidArg, "stamp source must be PNG, JPEG, or single-page PDF bytes (format is detected from the data, not the declared mime type)");
|
|
314
314
|
return {
|
|
315
315
|
...resolved,
|
|
316
316
|
mimeType: meta.mimeType
|
|
@@ -373,85 +373,6 @@ async function normalizeAnnotationPatch(patch) {
|
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
//#endregion
|
|
376
|
-
//#region src/annotation/relationships.ts
|
|
377
|
-
/**
|
|
378
|
-
* Classify one annotation by its relationship edge alone. Mirrors the
|
|
379
|
-
* spec's "practical parser rule": no `/IRT` is top-level; `/RT /Group` is
|
|
380
|
-
* a grouped subordinate; anything else with an `/IRT` is a reply (the
|
|
381
|
-
* engine has already normalized a missing `/RT` to `'reply'`).
|
|
382
|
-
*/
|
|
383
|
-
function classifyRelation(a) {
|
|
384
|
-
if (!a.inReplyTo) return "top-level";
|
|
385
|
-
return a.replyType === "group" ? "grouped-subordinate" : "reply";
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Stable string key for an {@link AnnotationRef}, used to match a child's
|
|
389
|
-
* `inReplyTo` against a candidate parent's `ref`. Both sides are produced
|
|
390
|
-
* by the engine with the same identity precedence (objectNumber, then nm,
|
|
391
|
-
* then index), so equal keys mean "same annotation".
|
|
392
|
-
*/
|
|
393
|
-
function refKey(ref) {
|
|
394
|
-
switch (ref.kind) {
|
|
395
|
-
case "objectNumber": return `obj:${ref.pageObjectNumber}:${ref.annotObjectNumber}`;
|
|
396
|
-
case "nm": return `nm:${ref.pageObjectNumber}:${ref.nm}`;
|
|
397
|
-
case "index": return `idx:${ref.pageObjectNumber}:${ref.index}`;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Compose a flat annotation list (one page, or a whole document via
|
|
402
|
-
* `listRawAll()` flattened) into {@link AnnotationThread}s in primary
|
|
403
|
-
* order.
|
|
404
|
-
*
|
|
405
|
-
* Rules (ISO 32000 §12.5.6.2 + the spec's UI rule):
|
|
406
|
-
* - Annotations with no `/IRT` become thread primaries, in input order.
|
|
407
|
-
* - A `/RT /Group` child is attached to its primary's `groupedParts`.
|
|
408
|
-
* - A `/RT /R` (or default) child is attached to its primary's `replies`.
|
|
409
|
-
* - A child whose parent is not in the input set is treated as an
|
|
410
|
-
* orphan primary (defensive — e.g. a partial/filtered page slice).
|
|
411
|
-
*
|
|
412
|
-
* Limitations (v1, matches the legacy stack): threading is one level deep
|
|
413
|
-
* — a reply-to-a-reply is keyed to its direct parent, so it only appears
|
|
414
|
-
* nested if that direct parent is itself a primary. Callers that want a
|
|
415
|
-
* sidebar of "most annotations, not widgets/popups" should pre-filter the
|
|
416
|
-
* input; this helper is intentionally unopinionated about eligibility.
|
|
417
|
-
*/
|
|
418
|
-
function buildThreads(annotations) {
|
|
419
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
420
|
-
for (const a of annotations) {
|
|
421
|
-
byKey.set(refKey(a.ref), a);
|
|
422
|
-
if (a.nm && a.nm.length > 0) byKey.set(`nm:${a.ref.pageObjectNumber}:${a.nm}`, a);
|
|
423
|
-
}
|
|
424
|
-
const threads = [];
|
|
425
|
-
const threadByPrimaryKey = /* @__PURE__ */ new Map();
|
|
426
|
-
const primaryThread = (primary) => {
|
|
427
|
-
const key = refKey(primary.ref);
|
|
428
|
-
let thread = threadByPrimaryKey.get(key);
|
|
429
|
-
if (!thread) {
|
|
430
|
-
thread = {
|
|
431
|
-
primary,
|
|
432
|
-
groupedParts: [],
|
|
433
|
-
replies: []
|
|
434
|
-
};
|
|
435
|
-
threadByPrimaryKey.set(key, thread);
|
|
436
|
-
threads.push(thread);
|
|
437
|
-
}
|
|
438
|
-
return thread;
|
|
439
|
-
};
|
|
440
|
-
for (const a of annotations) if (!a.inReplyTo) primaryThread(a);
|
|
441
|
-
for (const a of annotations) {
|
|
442
|
-
if (!a.inReplyTo) continue;
|
|
443
|
-
const parent = byKey.get(refKey(a.inReplyTo));
|
|
444
|
-
if (!parent || parent.inReplyTo) {
|
|
445
|
-
primaryThread(a);
|
|
446
|
-
continue;
|
|
447
|
-
}
|
|
448
|
-
const thread = primaryThread(parent);
|
|
449
|
-
if (a.replyType === "group") thread.groupedParts.push(a);
|
|
450
|
-
else thread.replies.push(a);
|
|
451
|
-
}
|
|
452
|
-
return threads;
|
|
453
|
-
}
|
|
454
|
-
//#endregion
|
|
455
376
|
//#region src/annotation/comments.ts
|
|
456
377
|
/** Subtypes that never participate in comment threads. `unsupported`
|
|
457
378
|
* covers `/Popup` dictionaries (raw code 16) and unreadable foreign
|
|
@@ -482,10 +403,10 @@ function buildCommentThreads(annotations, opts = {}) {
|
|
|
482
403
|
const eligible = annotations.filter((a) => !EXCLUDED_SUBTYPES.has(a.subtype));
|
|
483
404
|
const byKey = /* @__PURE__ */ new Map();
|
|
484
405
|
for (const a of eligible) {
|
|
485
|
-
const key = refKey(a.ref);
|
|
406
|
+
const key = require_derive.refKey(a.ref);
|
|
486
407
|
if (!byKey.has(key)) byKey.set(key, a);
|
|
487
408
|
if (a.nm) {
|
|
488
|
-
const aliasKey = refKey({
|
|
409
|
+
const aliasKey = require_derive.refKey({
|
|
489
410
|
kind: "nm",
|
|
490
411
|
pageObjectNumber: a.pageObjectNumber,
|
|
491
412
|
nm: a.nm
|
|
@@ -496,9 +417,9 @@ function buildCommentThreads(annotations, opts = {}) {
|
|
|
496
417
|
const children = /* @__PURE__ */ new Map();
|
|
497
418
|
for (const a of eligible) {
|
|
498
419
|
if (!a.inReplyTo) continue;
|
|
499
|
-
const parent = byKey.get(refKey(a.inReplyTo));
|
|
420
|
+
const parent = byKey.get(require_derive.refKey(a.inReplyTo));
|
|
500
421
|
if (!parent) continue;
|
|
501
|
-
const parentKey = refKey(parent.ref);
|
|
422
|
+
const parentKey = require_derive.refKey(parent.ref);
|
|
502
423
|
const list = children.get(parentKey);
|
|
503
424
|
if (list) list.push(a);
|
|
504
425
|
else children.set(parentKey, [a]);
|
|
@@ -509,15 +430,15 @@ function buildCommentThreads(annotations, opts = {}) {
|
|
|
509
430
|
const replies = [];
|
|
510
431
|
const groupedParts = [];
|
|
511
432
|
const states = [];
|
|
512
|
-
visited.add(refKey(root.ref));
|
|
513
|
-
const stack = [...children.get(refKey(root.ref)) ?? []];
|
|
433
|
+
visited.add(require_derive.refKey(root.ref));
|
|
434
|
+
const stack = [...children.get(require_derive.refKey(root.ref)) ?? []];
|
|
514
435
|
while (stack.length > 0) {
|
|
515
436
|
const a = stack.pop();
|
|
516
|
-
const key = refKey(a.ref);
|
|
437
|
+
const key = require_derive.refKey(a.ref);
|
|
517
438
|
if (visited.has(key)) continue;
|
|
518
439
|
visited.add(key);
|
|
519
440
|
if (isStateAnnotation(a)) states.push(a);
|
|
520
|
-
else if (classifyRelation(a) === "grouped-subordinate") groupedParts.push(a);
|
|
441
|
+
else if (require_derive.classifyRelation(a) === "grouped-subordinate") groupedParts.push(a);
|
|
521
442
|
else replies.push(a);
|
|
522
443
|
stack.push(...children.get(key) ?? []);
|
|
523
444
|
}
|
|
@@ -533,7 +454,7 @@ function buildCommentThreads(annotations, opts = {}) {
|
|
|
533
454
|
};
|
|
534
455
|
for (const a of eligible) if (!a.inReplyTo && !isStateAnnotation(a)) walk(a);
|
|
535
456
|
for (const a of eligible) {
|
|
536
|
-
if (visited.has(refKey(a.ref))) continue;
|
|
457
|
+
if (visited.has(require_derive.refKey(a.ref))) continue;
|
|
537
458
|
if (isStateAnnotation(a)) continue;
|
|
538
459
|
walk(a);
|
|
539
460
|
}
|
|
@@ -803,15 +724,22 @@ function appearanceImpactOf(current, patch) {
|
|
|
803
724
|
const cur = current;
|
|
804
725
|
const pat = patch;
|
|
805
726
|
const subtype = patch.subtype;
|
|
727
|
+
const caption = pat.caption === void 0 ? cur.caption : pat.caption;
|
|
728
|
+
const contentsPainted = CONTENTS_PAINTED.has(subtype) || [
|
|
729
|
+
"line",
|
|
730
|
+
"polygon",
|
|
731
|
+
"polyline"
|
|
732
|
+
].includes(subtype) && !!caption?.enabled;
|
|
806
733
|
const touched = [];
|
|
807
734
|
for (const [key, value] of Object.entries(pat)) {
|
|
808
735
|
if (value === void 0 || INERT_KEYS.has(key)) continue;
|
|
809
|
-
if (key === "contents" && !
|
|
736
|
+
if (key === "contents" && !contentsPainted) continue;
|
|
810
737
|
if (key === "rotation" && ADVISORY_ROTATION.has(subtype)) continue;
|
|
811
738
|
if (!semanticEqual(value, cur[key])) touched.push(key);
|
|
812
739
|
}
|
|
813
740
|
if (touched.length === 0) return "inert";
|
|
814
|
-
const
|
|
741
|
+
const baseGeometryKeys = TRANSLATABLE_GEOMETRY[subtype];
|
|
742
|
+
const geometryKeys = baseGeometryKeys && (subtype === "polygon" || subtype === "polyline") && cur.caption?.center ? [...baseGeometryKeys, "caption"] : baseGeometryKeys;
|
|
815
743
|
if (!geometryKeys) return "regenerate";
|
|
816
744
|
if (!touched.every((k) => geometryKeys.includes(k))) return "regenerate";
|
|
817
745
|
return isRigidTranslation(cur, pat, subtype, geometryKeys) ? "translation" : "regenerate";
|
|
@@ -889,7 +817,7 @@ function parsePdfValue(text) {
|
|
|
889
817
|
var Parser = class {
|
|
890
818
|
constructor(text) {
|
|
891
819
|
this.text = text;
|
|
892
|
-
|
|
820
|
+
require_derive._defineProperty(this, "pos", 0);
|
|
893
821
|
}
|
|
894
822
|
atEnd() {
|
|
895
823
|
return this.pos >= this.text.length;
|
|
@@ -1466,12 +1394,12 @@ var StepContext = class {
|
|
|
1466
1394
|
this.input = input;
|
|
1467
1395
|
this.level = level;
|
|
1468
1396
|
this.locks = locks;
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1397
|
+
require_derive._defineProperty(this, "findings", []);
|
|
1398
|
+
require_derive._defineProperty(this, "byNum", /* @__PURE__ */ new Map());
|
|
1399
|
+
require_derive._defineProperty(this, "before", void 0);
|
|
1400
|
+
require_derive._defineProperty(this, "after", void 0);
|
|
1401
|
+
require_derive._defineProperty(this, "claims", /* @__PURE__ */ new Map());
|
|
1402
|
+
require_derive._defineProperty(this, "locked", /* @__PURE__ */ new Set());
|
|
1475
1403
|
for (const c of input.changes) this.byNum.set(c.objectNumber, c);
|
|
1476
1404
|
this.before = indexRoles(input.before);
|
|
1477
1405
|
this.after = indexRoles(input.after);
|
|
@@ -2145,9 +2073,9 @@ var EdgeResolver = class {
|
|
|
2145
2073
|
this.read = read;
|
|
2146
2074
|
this.anchors = anchors;
|
|
2147
2075
|
this.budget = budget;
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2076
|
+
require_derive._defineProperty(this, "memo", /* @__PURE__ */ new Map());
|
|
2077
|
+
require_derive._defineProperty(this, "reads", 0);
|
|
2078
|
+
require_derive._defineProperty(this, "exhausted", false);
|
|
2151
2079
|
}
|
|
2152
2080
|
/** Anchored edges of `objectNumber`, or `incomplete` when a budget was exceeded. */
|
|
2153
2081
|
resolve(objectNumber) {
|
|
@@ -2208,7 +2136,8 @@ var EdgeResolver = class {
|
|
|
2208
2136
|
function foldOptionsFor(query) {
|
|
2209
2137
|
return {
|
|
2210
2138
|
keepCase: !!query.matchCase,
|
|
2211
|
-
keepMarks: !!query.matchDiacritics
|
|
2139
|
+
keepMarks: !!query.matchDiacritics,
|
|
2140
|
+
dropWhitespace: !!query.ignoreWhitespace
|
|
2212
2141
|
};
|
|
2213
2142
|
}
|
|
2214
2143
|
const WORD_UNIT = /[\p{L}\p{N}_]/u;
|
|
@@ -2226,18 +2155,29 @@ function wordAt(text, index) {
|
|
|
2226
2155
|
return WORD_UNIT.test(String.fromCodePoint(text.codePointAt(index)));
|
|
2227
2156
|
}
|
|
2228
2157
|
/**
|
|
2158
|
+
* Whether the folded hit at `at` sits on word boundaries. Checked on the
|
|
2159
|
+
* folded plane, except under `ignoreWhitespace`: dropping whitespace glues
|
|
2160
|
+
* neighbouring words together ("i n v o i c e 42" folds to "invoice42"), so there the
|
|
2161
|
+
* boundaries are read off the ORIGINAL text around the mapped range.
|
|
2162
|
+
*/
|
|
2163
|
+
function isWholeWordHit(haystack, at, needleLength, query) {
|
|
2164
|
+
if (!query.ignoreWhitespace) return !wordBefore(haystack.folded, at) && !wordAt(haystack.folded, at + needleLength);
|
|
2165
|
+
const { start, length } = require_derive.toOriginalRange(haystack, at, needleLength);
|
|
2166
|
+
return !wordBefore(haystack.original, start) && !wordAt(haystack.original, start + length);
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2229
2169
|
* All non-overlapping literal matches, in original code-unit space.
|
|
2230
2170
|
* `haystack` must have been folded with `foldOptionsFor(query)`.
|
|
2231
2171
|
*/
|
|
2232
2172
|
function matchLiteral(haystack, query) {
|
|
2233
|
-
const needle =
|
|
2173
|
+
const needle = require_derive.foldText(query.text, foldOptionsFor(query)).folded;
|
|
2234
2174
|
if (needle.trim().length === 0) return [];
|
|
2235
2175
|
const out = [];
|
|
2236
2176
|
let from = 0;
|
|
2237
2177
|
while (from <= haystack.folded.length - needle.length) {
|
|
2238
2178
|
const at = haystack.folded.indexOf(needle, from);
|
|
2239
2179
|
if (at < 0) break;
|
|
2240
|
-
if (query.wholeWord && (
|
|
2180
|
+
if (query.wholeWord && !isWholeWordHit(haystack, at, needle.length, query)) {
|
|
2241
2181
|
from = at + 1;
|
|
2242
2182
|
continue;
|
|
2243
2183
|
}
|
|
@@ -2248,7 +2188,7 @@ function matchLiteral(haystack, query) {
|
|
|
2248
2188
|
continue;
|
|
2249
2189
|
}
|
|
2250
2190
|
}
|
|
2251
|
-
out.push(
|
|
2191
|
+
out.push(require_derive.toOriginalRange(haystack, at, needle.length));
|
|
2252
2192
|
from = at + needle.length;
|
|
2253
2193
|
}
|
|
2254
2194
|
return out;
|
|
@@ -2338,6 +2278,11 @@ function validateSearchQuery(query) {
|
|
|
2338
2278
|
issue: "diacritics-with-regex",
|
|
2339
2279
|
message: "Diacritic-sensitive matching is not available for regex patterns (regex runs on the raw text plane)."
|
|
2340
2280
|
};
|
|
2281
|
+
if (query.ignoreWhitespace) return {
|
|
2282
|
+
ok: false,
|
|
2283
|
+
issue: "ignore-whitespace-with-regex",
|
|
2284
|
+
message: "Whitespace-insensitive matching is not available for regex patterns (regex runs on the raw text plane; use \\s* in the pattern)."
|
|
2285
|
+
};
|
|
2341
2286
|
return validateSearchRegex(query.text);
|
|
2342
2287
|
}
|
|
2343
2288
|
/**
|
|
@@ -2385,7 +2330,7 @@ function matchRegex(text, query) {
|
|
|
2385
2330
|
*/
|
|
2386
2331
|
function matchPageText(text, query) {
|
|
2387
2332
|
if (query.regex) return matchRegex(text, query);
|
|
2388
|
-
return matchLiteral(
|
|
2333
|
+
return matchLiteral(require_derive.foldText(text, foldOptionsFor(query)), query);
|
|
2389
2334
|
}
|
|
2390
2335
|
//#endregion
|
|
2391
2336
|
//#region src/search/snippet.ts
|
|
@@ -2525,7 +2470,7 @@ function buildPageTextLayout(snapshot) {
|
|
|
2525
2470
|
const runs = [];
|
|
2526
2471
|
const frames = [IDENTITY_FRAME];
|
|
2527
2472
|
for (const run of snapshot.runs) {
|
|
2528
|
-
if (!
|
|
2473
|
+
if (!require_derive.isRotatedGeometryRun(run)) {
|
|
2529
2474
|
for (const g of run.glyphs) glyphs.push({
|
|
2530
2475
|
loose: g.looseBox,
|
|
2531
2476
|
tight: g.tightBox,
|
|
@@ -2921,8 +2866,8 @@ function fnv1a64(input) {
|
|
|
2921
2866
|
* untouched (their raw form IS the query).
|
|
2922
2867
|
*/
|
|
2923
2868
|
function canonicalSearchQuery(query) {
|
|
2924
|
-
if (query.regex || query.matchCase || query.matchDiacritics) return query;
|
|
2925
|
-
const canonical = { text:
|
|
2869
|
+
if (query.regex || query.matchCase || query.matchDiacritics || query.ignoreWhitespace) return query;
|
|
2870
|
+
const canonical = { text: require_derive.foldText(query.text).folded };
|
|
2926
2871
|
if (query.wholeWord) canonical.wholeWord = true;
|
|
2927
2872
|
return canonical;
|
|
2928
2873
|
}
|
|
@@ -3116,6 +3061,12 @@ function materializePdfPermissions(b) {
|
|
|
3116
3061
|
return [...out];
|
|
3117
3062
|
}
|
|
3118
3063
|
//#endregion
|
|
3064
|
+
//#region src/measure/viewport.ts
|
|
3065
|
+
/** Last containing viewport wins. A foreign measure still wins; never guess a fallback. */
|
|
3066
|
+
function viewportForPoint(viewports, point) {
|
|
3067
|
+
return [...viewports].reverse().find(({ bbox: b }) => point.x >= b.left && point.x <= b.right && point.y >= b.bottom && point.y <= b.top);
|
|
3068
|
+
}
|
|
3069
|
+
//#endregion
|
|
3119
3070
|
Object.defineProperty(exports, "DEFAULT_EDGE_RESOLVER_BUDGET", {
|
|
3120
3071
|
enumerable: true,
|
|
3121
3072
|
get: function() {
|
|
@@ -3200,12 +3151,6 @@ Object.defineProperty(exports, "buildSnippet", {
|
|
|
3200
3151
|
return buildSnippet;
|
|
3201
3152
|
}
|
|
3202
3153
|
});
|
|
3203
|
-
Object.defineProperty(exports, "buildThreads", {
|
|
3204
|
-
enumerable: true,
|
|
3205
|
-
get: function() {
|
|
3206
|
-
return buildThreads;
|
|
3207
|
-
}
|
|
3208
|
-
});
|
|
3209
3154
|
Object.defineProperty(exports, "canonicalSearchQuery", {
|
|
3210
3155
|
enumerable: true,
|
|
3211
3156
|
get: function() {
|
|
@@ -3230,12 +3175,6 @@ Object.defineProperty(exports, "changesAnnotationList", {
|
|
|
3230
3175
|
return changesAnnotationList;
|
|
3231
3176
|
}
|
|
3232
3177
|
});
|
|
3233
|
-
Object.defineProperty(exports, "classifyRelation", {
|
|
3234
|
-
enumerable: true,
|
|
3235
|
-
get: function() {
|
|
3236
|
-
return classifyRelation;
|
|
3237
|
-
}
|
|
3238
|
-
});
|
|
3239
3178
|
Object.defineProperty(exports, "collab", {
|
|
3240
3179
|
enumerable: true,
|
|
3241
3180
|
get: function() {
|
|
@@ -3416,12 +3355,6 @@ Object.defineProperty(exports, "primaryFinding", {
|
|
|
3416
3355
|
return primaryFinding;
|
|
3417
3356
|
}
|
|
3418
3357
|
});
|
|
3419
|
-
Object.defineProperty(exports, "refKey", {
|
|
3420
|
-
enumerable: true,
|
|
3421
|
-
get: function() {
|
|
3422
|
-
return refKey;
|
|
3423
|
-
}
|
|
3424
|
-
});
|
|
3425
3358
|
Object.defineProperty(exports, "refsOf", {
|
|
3426
3359
|
enumerable: true,
|
|
3427
3360
|
get: function() {
|
|
@@ -3542,6 +3475,12 @@ Object.defineProperty(exports, "validateSearchRegex", {
|
|
|
3542
3475
|
return validateSearchRegex;
|
|
3543
3476
|
}
|
|
3544
3477
|
});
|
|
3478
|
+
Object.defineProperty(exports, "viewportForPoint", {
|
|
3479
|
+
enumerable: true,
|
|
3480
|
+
get: function() {
|
|
3481
|
+
return viewportForPoint;
|
|
3482
|
+
}
|
|
3483
|
+
});
|
|
3545
3484
|
Object.defineProperty(exports, "wordAt", {
|
|
3546
3485
|
enumerable: true,
|
|
3547
3486
|
get: function() {
|
|
@@ -3561,4 +3500,4 @@ Object.defineProperty(exports, "worstVerdict", {
|
|
|
3561
3500
|
}
|
|
3562
3501
|
});
|
|
3563
3502
|
|
|
3564
|
-
//# sourceMappingURL=
|
|
3503
|
+
//# sourceMappingURL=viewport-BWeNHZmb.cjs.map
|