gutterpress 0.11.22-alpha.1 → 0.11.22-alpha.2

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.
Files changed (44) hide show
  1. package/dist/api/index.js +6 -6
  2. package/dist/{build-se85j9ec.js → build-84retk4k.js} +9 -9
  3. package/dist/{cli-sth219v1.js → cli-2ppw6q9v.js} +26 -6
  4. package/dist/{cli-gc9av5hs.js → cli-3twpesca.js} +1 -1
  5. package/dist/{cli-9vy4b6ec.js → cli-5et23z83.js} +4 -4
  6. package/dist/{cli-yejbb9f8.js → cli-5qhjwne5.js} +1 -1
  7. package/dist/{cli-5553w972.js → cli-80t93x2r.js} +1 -1
  8. package/dist/{cli-fbwqv7p4.js → cli-885pcze8.js} +173 -61
  9. package/dist/{cli-8hccw62p.js → cli-9pk65fqf.js} +2 -2
  10. package/dist/{cli-gmm3bdeq.js → cli-hndkg7bn.js} +2 -2
  11. package/dist/{cli-pfrg1r9x.js → cli-pn3z0y9p.js} +1 -1
  12. package/dist/cli.js +12 -12
  13. package/dist/{doctor-bv2t82zd.js → doctor-fmzpg7ag.js} +3 -3
  14. package/dist/engine/shared/print-area.d.ts +77 -1
  15. package/dist/{engine-h4ehmrvf.js → engine-5p8tn9b4.js} +2 -2
  16. package/dist/{engine-qwkyhrej.js → engine-9710cd7x.js} +3 -3
  17. package/dist/{ext-a8ndp142.js → ext-hsdnad5c.js} +9 -9
  18. package/dist/{extension-restore-926mv2qk.js → extension-restore-05pae3cp.js} +3 -3
  19. package/dist/{extension-restore-q1f7njec.js → extension-restore-3r7phztr.js} +5 -5
  20. package/dist/{gutterpress-viewer-w7njnkj7.js → gutterpress-viewer-w9jzx6sb.js} +56 -52
  21. package/dist/{index-gmfh6n05.js → index-2d8j0enc.js} +2 -2
  22. package/dist/{index-sth219v1.js → index-2ppw6q9v.js} +26 -6
  23. package/dist/{index-tkjvs1gf.js → index-3wcr69ba.js} +162 -58
  24. package/dist/{index-5h9a38jn.js → index-apc8w9w8.js} +55 -55
  25. package/dist/{index-dm7hx46j.js → index-ew7cyk7c.js} +3 -3
  26. package/dist/{index-dhknsvfz.js → index-jsz0s3dy.js} +2 -2
  27. package/dist/{index-38e18a7j.js → index-kx03e4m4.js} +1 -1
  28. package/dist/index.js +7 -7
  29. package/dist/lib/markdown/assemble.d.ts +3 -2
  30. package/dist/lib/page-size.d.ts +3 -4
  31. package/dist/lib/pdf-inspect.d.ts +12 -0
  32. package/dist/lib/project-scaffold.d.ts +3 -3
  33. package/dist/{manifest.schema-n292sb77.json → manifest.schema-nvawq0xv.json} +2 -2
  34. package/dist/{new-nadp2hvb.js → new-fqtt022k.js} +9 -9
  35. package/dist/{pdf-inspect-zdmy7qca.js → pdf-inspect-wnw4za71.js} +1 -1
  36. package/dist/{plugins-yeh4shd7.js → plugins-gfvsgnxb.js} +1 -1
  37. package/dist/{plugins-gy4q9vaa.js → plugins-nfxr831f.js} +3 -3
  38. package/dist/{preflight-c6q25xqa.js → preflight-gr9mscjw.js} +9 -9
  39. package/dist/{preview-y8chv4cb.js → preview-52w9pdps.js} +9 -9
  40. package/dist/{publish-3qwvxsxa.js → publish-esmcyhpb.js} +9 -9
  41. package/dist/render.js +586 -0
  42. package/dist/schema/manifest.types.d.ts +8 -3
  43. package/dist/{validate-w108kk87.js → validate-vt1d7h6k.js} +9 -9
  44. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  } from "./cli-d8xjns66.js";
9
9
  import {
10
10
  package_default
11
- } from "./cli-gc9av5hs.js";
11
+ } from "./cli-3twpesca.js";
12
12
  import {
13
13
  EXIT_CODES
14
14
  } from "./cli-46ycxe6r.js";
@@ -20,14 +20,14 @@ import {
20
20
  import { defineCommand, parseArgs, runMain } from "citty";
21
21
  import { statSync } from "node:fs";
22
22
  var SUBCOMMANDS = {
23
- new: () => import("./new-nadp2hvb.js").then((m) => m.default),
24
- preview: () => import("./preview-y8chv4cb.js").then((m) => m.default),
25
- build: () => import("./build-se85j9ec.js").then((m) => m.default),
26
- publish: () => import("./publish-3qwvxsxa.js").then((m) => m.default),
27
- validate: () => import("./validate-w108kk87.js").then((m) => m.default),
28
- preflight: () => import("./preflight-c6q25xqa.js").then((m) => m.default),
29
- doctor: () => import("./doctor-bv2t82zd.js").then((m) => m.default),
30
- ext: () => import("./ext-a8ndp142.js").then((m) => m.default)
23
+ new: () => import("./new-fqtt022k.js").then((m) => m.default),
24
+ preview: () => import("./preview-52w9pdps.js").then((m) => m.default),
25
+ build: () => import("./build-84retk4k.js").then((m) => m.default),
26
+ publish: () => import("./publish-esmcyhpb.js").then((m) => m.default),
27
+ validate: () => import("./validate-vt1d7h6k.js").then((m) => m.default),
28
+ preflight: () => import("./preflight-gr9mscjw.js").then((m) => m.default),
29
+ doctor: () => import("./doctor-fmzpg7ag.js").then((m) => m.default),
30
+ ext: () => import("./ext-hsdnad5c.js").then((m) => m.default)
31
31
  };
32
32
  var VERSION = package_default.version;
33
33
  var main = defineCommand({
@@ -52,7 +52,7 @@ async function preflightRequiredInvocations(rawArgs) {
52
52
  const [command, ...commandArgs] = rawArgs;
53
53
  try {
54
54
  if (command === "new") {
55
- const { newArgs } = await import("./new-nadp2hvb.js");
55
+ const { newArgs } = await import("./new-fqtt022k.js");
56
56
  rejectUnknownFlags(commandArgs, newArgs, "new");
57
57
  const parsed = parseArgs(commandArgs, {
58
58
  ...newArgs,
@@ -64,7 +64,7 @@ async function preflightRequiredInvocations(rawArgs) {
64
64
  return;
65
65
  }
66
66
  if (command === "preflight") {
67
- const { preflightArgs } = await import("./preflight-c6q25xqa.js");
67
+ const { preflightArgs } = await import("./preflight-gr9mscjw.js");
68
68
  rejectUnknownFlags(commandArgs, preflightArgs, "preflight");
69
69
  const parsed = parseArgs(commandArgs, {
70
70
  ...preflightArgs,
@@ -84,7 +84,7 @@ async function preflightRequiredInvocations(rawArgs) {
84
84
  }
85
85
  if (subcommand.startsWith("-"))
86
86
  return;
87
- const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-a8ndp142.js");
87
+ const { EXT_SUBCOMMANDS, extAddArgs, extRemoveArgs, extEnableArgs, extDisableArgs } = await import("./ext-hsdnad5c.js");
88
88
  if (!EXT_SUBCOMMANDS.includes(subcommand)) {
89
89
  throw new UsageError(`gutterpress ext: unknown command "${subcommand}"`);
90
90
  }
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  getSystemDiagnostics
3
- } from "./cli-yejbb9f8.js";
3
+ } from "./cli-5qhjwne5.js";
4
4
  import"./cli-asap4t1z.js";
5
5
  import {
6
6
  log
7
- } from "./cli-5553w972.js";
7
+ } from "./cli-80t93x2r.js";
8
8
  import {
9
9
  UsageError,
10
10
  rejectExtraPositionals,
11
11
  rejectUnknownFlags
12
12
  } from "./cli-d8xjns66.js";
13
- import"./cli-gc9av5hs.js";
13
+ import"./cli-3twpesca.js";
14
14
  import"./cli-46ycxe6r.js";
15
15
  import"./cli-37x76zdn.js";
16
16
 
@@ -4,7 +4,12 @@
4
4
  * `<meta name="gp-print-area">` by the markdown assembly
5
5
  * (lib/markdown/assemble.ts) and read back here by everything that needs it:
6
6
  * the preview's print overlays (viewer/overlay.ts) and both engines' pinned
7
- * art (pin-edges.ts — a pin sits on the printer's art-safe line).
7
+ * art (pin-edges.ts — a pin sits on the printer's art-safe line). The boxes
8
+ * those numbers draw on a page (`pageBoxes`) and the judge of a piece of ink
9
+ * against them (`judgeRect` / `classifyRect`) live here too, so the overlay
10
+ * and the `pdf.print.safe-margins` check (checks/pdf/safe-margins.ts) read
11
+ * one definition of "safe" — not in a module of their own, because the four
12
+ * numbers mean nothing but those boxes.
8
13
  *
9
14
  * Only the manifest feeds it — `page.width` x `page.height` (the sheet),
10
15
  * `page.bleed` (a bleed the sheet already contains on the top, bottom and
@@ -56,6 +61,18 @@ export interface PrintAreaSource {
56
61
  url: string;
57
62
  };
58
63
  }
64
+ /** A usable point value: finite and positive (a page dimension, an inset). */
65
+ export declare function isPositivePoints(value: unknown): value is number;
66
+ /**
67
+ * The `size` value written for a page — `8.5in 11in`, `595pt 842pt` — by
68
+ * everything that writes one: Book settings (lib/page-size.ts) into the
69
+ * book's stylesheet, and the assembly's manifest default
70
+ * (lib/markdown/assemble.ts), so one size has one spelling.
71
+ */
72
+ export declare function formatPageSize(page: {
73
+ width: number;
74
+ height: number;
75
+ }): string;
59
76
  /**
60
77
  * The `<meta>` tag for one book. An unset bleed or text rule is written as 0,
61
78
  * never left out; an unset art rule or gutter stays out (the reader takes each
@@ -71,3 +88,62 @@ export interface MetaDocument {
71
88
  }
72
89
  /** The book's print area from its `<meta name="gp-print-area">`; `null` without one. */
73
90
  export declare function printAreaFromMeta(doc: MetaDocument): PrintArea | null;
91
+ export interface Rect {
92
+ x: number;
93
+ y: number;
94
+ w: number;
95
+ h: number;
96
+ }
97
+ /** The nested boxes of one page, in one unit, origin at the sheet's top-left. */
98
+ export interface PageBoxes {
99
+ /** the whole sheet (the bleed box when the sheet contains a bleed) */
100
+ sheet: Rect;
101
+ /** the cut page */
102
+ trim: Rect;
103
+ /** where TEXT is safe from the cut: the trim inset by `safe`, and by `gutter` at the binding */
104
+ safe: Rect;
105
+ /** where ART is safe from the cut: the trim inset by `artSafe`, and by `gutter` at the binding */
106
+ safeArt: Rect;
107
+ bleed: number;
108
+ }
109
+ /**
110
+ * Boxes for one page. The trim is the sheet pulled in by `bleed` on the top,
111
+ * bottom and OUTER edge — the right edge of a recto, the left edge of a verso;
112
+ * the binding edge has no bleed. The text box is the trim pulled in by `safe`
113
+ * on the top, bottom and outer edge and by `gutter` on the binding edge (left
114
+ * of a recto, right of a verso); the art box is pulled in by `artSafe` on the
115
+ * top, bottom and outer edge and by `gutter` on the binding edge.
116
+ */
117
+ export declare function pageBoxes(area: PrintArea, side: PageSide, scale?: number): PageBoxes;
118
+ /**
119
+ * Where a piece of ink sits relative to its page, worst first:
120
+ * - `inside` within the box its rule allows
121
+ * - `unsafe` leaves that box but stays on the trimmed page
122
+ * - `bleed` crosses the trim but stays on the sheet (in the bleed band)
123
+ * - `off-page` crosses the sheet's edge: that part is not printed at all
124
+ */
125
+ export type OverflowKind = "inside" | "unsafe" | "bleed" | "off-page";
126
+ /** The rule a piece of ink is judged by: text against `page.safe`, art against `page.artSafe`. */
127
+ export type OverflowRule = "text" | "art";
128
+ /** One edge of a page as drawn: `left` and `right` are the page's own, so the binding is a recto's left and a verso's right. */
129
+ export type PageEdge = "left" | "right" | "top" | "bottom";
130
+ /** The verdict on a piece of ink: see `judgeRect`. */
131
+ export interface Overflow {
132
+ kind: OverflowKind;
133
+ gap: number;
134
+ need: number;
135
+ }
136
+ /**
137
+ * Judge one rect of ink, edge by edge, against the box its rule allows (text:
138
+ * `boxes.safe`; art: `boxes.safeArt`). `kind` is the worst edge's and `edge`
139
+ * names it (`null` when the ink is inside). `gap` is how far that edge sits
140
+ * inside the trim (negative = past it) and `need` how far inside the rule
141
+ * wants it, in the boxes' unit. Art that runs out to the sheet's edge is
142
+ * bleeding there, as it should, so that edge passes. `tol` absorbs sub-pixel
143
+ * layout (LayoutUnit is 1/64 px) and PDF rounding so an exact fit is not flagged.
144
+ */
145
+ export declare function judgeRect(r: Rect, boxes: PageBoxes, rule: OverflowRule, tol?: number): Overflow & {
146
+ edge: PageEdge | null;
147
+ };
148
+ /** `judgeRect` without the edge: the verdict the overlay paints. */
149
+ export declare function classifyRect(r: Rect, boxes: PageBoxes, rule: OverflowRule, tol?: number): Overflow;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  build
3
- } from "./cli-8hccw62p.js";
3
+ } from "./cli-9pk65fqf.js";
4
4
  import"./cli-eyyggect.js";
5
5
  import"./cli-asap4t1z.js";
6
- import"./cli-gmm3bdeq.js";
6
+ import"./cli-hndkg7bn.js";
7
7
  import {
8
8
  BuildError
9
9
  } from "./cli-46ycxe6r.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  build
3
- } from "./index-gmfh6n05.js";
4
- import"./index-5h9a38jn.js";
3
+ } from "./index-2d8j0enc.js";
4
+ import"./index-apc8w9w8.js";
5
5
  import {
6
6
  BuildError
7
- } from "./index-dhknsvfz.js";
7
+ } from "./index-jsz0s3dy.js";
8
8
  import"./index-bt0qws5c.js";
9
9
  import"./index-37x76zdn.js";
10
10
 
@@ -2,11 +2,11 @@ import {
2
2
  importExtensionFromFile,
3
3
  importExtensionFromUrl,
4
4
  searchNpmExtensions
5
- } from "./cli-fbwqv7p4.js";
6
- import"./cli-yejbb9f8.js";
5
+ } from "./cli-885pcze8.js";
6
+ import"./cli-5qhjwne5.js";
7
7
  import"./cli-ht1bcqdd.js";
8
- import"./cli-8hccw62p.js";
9
- import"./cli-sth219v1.js";
8
+ import"./cli-9pk65fqf.js";
9
+ import"./cli-2ppw6q9v.js";
10
10
  import"./cli-eyyggect.js";
11
11
  import"./cli-asap4t1z.js";
12
12
  import"./cli-habkc5ng.js";
@@ -22,9 +22,9 @@ import {
22
22
  removeExtension,
23
23
  setExtensionEnabled,
24
24
  updateExtensions
25
- } from "./cli-9vy4b6ec.js";
26
- import"./cli-pfrg1r9x.js";
27
- import"./cli-5553w972.js";
25
+ } from "./cli-5et23z83.js";
26
+ import"./cli-pn3z0y9p.js";
27
+ import"./cli-80t93x2r.js";
28
28
  import {
29
29
  UsageError,
30
30
  exitForUsage,
@@ -32,8 +32,8 @@ import {
32
32
  rejectUnknownFlags,
33
33
  resolveProjectDir
34
34
  } from "./cli-d8xjns66.js";
35
- import"./cli-gc9av5hs.js";
36
- import"./cli-gmm3bdeq.js";
35
+ import"./cli-3twpesca.js";
36
+ import"./cli-hndkg7bn.js";
37
37
  import {
38
38
  EXIT_CODES
39
39
  } from "./cli-46ycxe6r.js";
@@ -3,9 +3,9 @@ import {
3
3
  restoreForCommand,
4
4
  restoreOfflineMessage,
5
5
  restorePinnedExtensions
6
- } from "./index-dm7hx46j.js";
7
- import"./index-38e18a7j.js";
8
- import"./index-dhknsvfz.js";
6
+ } from "./index-ew7cyk7c.js";
7
+ import"./index-kx03e4m4.js";
8
+ import"./index-jsz0s3dy.js";
9
9
  import"./index-r7jcsk6h.js";
10
10
  import"./index-37x76zdn.js";
11
11
  export {
@@ -3,12 +3,12 @@ import {
3
3
  restoreForCommand,
4
4
  restoreOfflineMessage,
5
5
  restorePinnedExtensions
6
- } from "./cli-9vy4b6ec.js";
7
- import"./cli-pfrg1r9x.js";
8
- import"./cli-5553w972.js";
6
+ } from "./cli-5et23z83.js";
7
+ import"./cli-pn3z0y9p.js";
8
+ import"./cli-80t93x2r.js";
9
9
  import"./cli-d8xjns66.js";
10
- import"./cli-gc9av5hs.js";
11
- import"./cli-gmm3bdeq.js";
10
+ import"./cli-3twpesca.js";
11
+ import"./cli-hndkg7bn.js";
12
12
  import"./cli-46ycxe6r.js";
13
13
  import"./cli-h3phdstf.js";
14
14
  import"./cli-37x76zdn.js";
@@ -1136,6 +1136,62 @@
1136
1136
  return null;
1137
1137
  }
1138
1138
  }
1139
+ function pageBoxes(area, side, scale = 1) {
1140
+ const w = area.width * scale;
1141
+ const h = area.height * scale;
1142
+ const b = Math.max(0, area.bleed) * scale;
1143
+ const s = Math.max(0, area.safe) * scale;
1144
+ const a = Math.max(0, area.artSafe) * scale;
1145
+ const g = Math.max(0, area.gutter) * scale;
1146
+ const [textLeft, textRight] = side === "verso" ? [s, g] : [g, s];
1147
+ const [artLeft, artRight] = side === "verso" ? [a, g] : [g, a];
1148
+ const trim = { x: side === "verso" ? b : 0, y: b, w: Math.max(0, w - b), h: Math.max(0, h - 2 * b) };
1149
+ return {
1150
+ sheet: { x: 0, y: 0, w, h },
1151
+ trim,
1152
+ safe: {
1153
+ x: trim.x + textLeft,
1154
+ y: trim.y + s,
1155
+ w: Math.max(0, trim.w - textLeft - textRight),
1156
+ h: Math.max(0, trim.h - 2 * s)
1157
+ },
1158
+ safeArt: {
1159
+ x: trim.x + artLeft,
1160
+ y: trim.y + a,
1161
+ w: Math.max(0, trim.w - artLeft - artRight),
1162
+ h: Math.max(0, trim.h - 2 * a)
1163
+ },
1164
+ bleed: b
1165
+ };
1166
+ }
1167
+ var SEVERITY = { inside: 0, unsafe: 1, bleed: 2, "off-page": 3 };
1168
+ function judgeRect(r, boxes, rule, tol = 0) {
1169
+ const { sheet, trim } = boxes;
1170
+ const safe = rule === "art" ? boxes.safeArt : boxes.safe;
1171
+ const sides = [
1172
+ ["left", -r.x, -safe.x, -trim.x, -sheet.x],
1173
+ ["right", r.x + r.w, safe.x + safe.w, trim.x + trim.w, sheet.x + sheet.w],
1174
+ ["top", -r.y, -safe.y, -trim.y, -sheet.y],
1175
+ ["bottom", r.y + r.h, safe.y + safe.h, trim.y + trim.h, sheet.y + sheet.h]
1176
+ ];
1177
+ let worst = { kind: "inside", gap: 0, need: 0, edge: null };
1178
+ let beyond = 0;
1179
+ for (const [edge, ink, limit, trimEdge, sheetEdge] of sides) {
1180
+ const past = ink - limit;
1181
+ if (past <= tol || rule === "art" && ink >= sheetEdge - tol)
1182
+ continue;
1183
+ const kind = ink > sheetEdge + tol ? "off-page" : ink > trimEdge + tol ? "bleed" : "unsafe";
1184
+ if (SEVERITY[kind] > SEVERITY[worst.kind] || kind === worst.kind && past > beyond) {
1185
+ worst = { kind, gap: trimEdge - ink, need: trimEdge - limit, edge };
1186
+ beyond = past;
1187
+ }
1188
+ }
1189
+ return worst;
1190
+ }
1191
+ function classifyRect(r, boxes, rule, tol = 0) {
1192
+ const { kind, gap, need } = judgeRect(r, boxes, rule, tol);
1193
+ return { kind, gap, need };
1194
+ }
1139
1195
 
1140
1196
  // src/engine/viewer/fragment.ts
1141
1197
  var PX_PER_PT = 96 / 72;
@@ -2250,58 +2306,6 @@
2250
2306
  }
2251
2307
 
2252
2308
  // src/engine/viewer/overlay.ts
2253
- function pageBoxes(area, side, scale = 1) {
2254
- const w = area.width * scale;
2255
- const h = area.height * scale;
2256
- const b = Math.max(0, area.bleed) * scale;
2257
- const s = Math.max(0, area.safe) * scale;
2258
- const a = Math.max(0, area.artSafe) * scale;
2259
- const g = Math.max(0, area.gutter) * scale;
2260
- const [textLeft, textRight] = side === "verso" ? [s, g] : [g, s];
2261
- const [artLeft, artRight] = side === "verso" ? [a, g] : [g, a];
2262
- const trim = { x: side === "verso" ? b : 0, y: b, w: Math.max(0, w - b), h: Math.max(0, h - 2 * b) };
2263
- return {
2264
- sheet: { x: 0, y: 0, w, h },
2265
- trim,
2266
- safe: {
2267
- x: trim.x + textLeft,
2268
- y: trim.y + s,
2269
- w: Math.max(0, trim.w - textLeft - textRight),
2270
- h: Math.max(0, trim.h - 2 * s)
2271
- },
2272
- safeArt: {
2273
- x: trim.x + artLeft,
2274
- y: trim.y + a,
2275
- w: Math.max(0, trim.w - artLeft - artRight),
2276
- h: Math.max(0, trim.h - 2 * a)
2277
- },
2278
- bleed: b
2279
- };
2280
- }
2281
- var SEVERITY = { inside: 0, unsafe: 1, bleed: 2, "off-page": 3 };
2282
- function classifyRect(r, boxes, rule, tol = 0) {
2283
- const { sheet, trim } = boxes;
2284
- const safe = rule === "art" ? boxes.safeArt : boxes.safe;
2285
- const sides = [
2286
- [-r.x, -safe.x, -trim.x, -sheet.x],
2287
- [r.x + r.w, safe.x + safe.w, trim.x + trim.w, sheet.x + sheet.w],
2288
- [-r.y, -safe.y, -trim.y, -sheet.y],
2289
- [r.y + r.h, safe.y + safe.h, trim.y + trim.h, sheet.y + sheet.h]
2290
- ];
2291
- let worst = { kind: "inside", gap: 0, need: 0 };
2292
- let beyond = 0;
2293
- for (const [ink, limit, edge, sheetEdge] of sides) {
2294
- const past = ink - limit;
2295
- if (past <= tol || rule === "art" && ink >= sheetEdge - tol)
2296
- continue;
2297
- const kind = ink > sheetEdge + tol ? "off-page" : ink > edge + tol ? "bleed" : "unsafe";
2298
- if (SEVERITY[kind] > SEVERITY[worst.kind] || kind === worst.kind && past > beyond) {
2299
- worst = { kind, gap: edge - ink, need: edge - limit };
2300
- beyond = past;
2301
- }
2302
- }
2303
- return worst;
2304
- }
2305
2309
  var INTENT_SELECTOR = ".gp-bleed, .gp-pin, .gp-flush, .gp-behind, .gp-page-full-bleed";
2306
2310
  var OVERLAY_LAYERS = ["bleed", "safe", "art", "margins"];
2307
2311
  function layersFrom(state) {
@@ -18,10 +18,10 @@ import {
18
18
  stringValueAt,
19
19
  toFolioPage,
20
20
  wantsRecto
21
- } from "./index-5h9a38jn.js";
21
+ } from "./index-apc8w9w8.js";
22
22
  import {
23
23
  getAssetPath
24
- } from "./index-dhknsvfz.js";
24
+ } from "./index-jsz0s3dy.js";
25
25
  import {
26
26
  launchChromium
27
27
  } from "./index-bt0qws5c.js";
@@ -168,6 +168,14 @@ function getTextPass(doc) {
168
168
  return p;
169
169
  }
170
170
  var opCache = new WeakMap;
171
+ var opSet = (names) => new Set(names.map((name) => OPS[name]).filter((op) => op !== undefined));
172
+ var IMAGE_OPS = opSet([
173
+ "paintImageXObject",
174
+ "paintImageXObjectRepeat",
175
+ "paintInlineImageXObject",
176
+ "paintImageMaskXObject",
177
+ "paintJpegXObject"
178
+ ]);
171
179
  function multiply(m1, m2) {
172
180
  return [
173
181
  m1[0] * m2[0] + m1[2] * m2[1],
@@ -219,14 +227,27 @@ function getOpPass(doc) {
219
227
  ctm = stack.pop() ?? ctm;
220
228
  } else if (fn === OPS.transform) {
221
229
  ctm = multiply(ctm, args);
222
- } else if (fn === OPS.paintImageXObject || fn === OPS.paintImageXObjectRepeat || fn === OPS.paintInlineImageXObject) {
230
+ } else if (fn === OPS.paintFormXObjectBegin) {
231
+ stack.push(ctm.slice());
232
+ const matrix = args[0];
233
+ if (Array.isArray(matrix))
234
+ ctm = multiply(ctm, matrix);
235
+ } else if (fn === OPS.paintFormXObjectEnd) {
236
+ ctm = stack.pop() ?? ctm;
237
+ } else if (IMAGE_OPS.has(fn)) {
223
238
  const name = typeof args[0] === "string" ? args[0] : "(inline)";
239
+ const [a, b, c, d, e, f] = ctm;
240
+ const xs = [e, a + e, c + e, a + c + e];
241
+ const ys = [f, b + f, d + f, b + d + f];
242
+ const x0 = Math.min(...xs);
243
+ const y0 = Math.min(...ys);
224
244
  pageImages.push({
225
245
  name,
226
- placedW: Math.hypot(ctm[0], ctm[1]),
227
- placedH: Math.hypot(ctm[2], ctm[3]),
228
- x: ctm[4],
229
- y: ctm[5],
246
+ placedW: Math.hypot(a, b),
247
+ placedH: Math.hypot(c, d),
248
+ x: e,
249
+ y: f,
250
+ bounds: { x: x0, y: y0, w: Math.max(...xs) - x0, h: Math.max(...ys) - y0 },
230
251
  page: i
231
252
  });
232
253
  } else if (fn === OPS.setFont) {
@@ -254,7 +275,6 @@ function getOpPass(doc) {
254
275
  }
255
276
  return p;
256
277
  }
257
- var opSet = (names) => new Set(names.map((name) => OPS[name]).filter((op) => op !== undefined));
258
278
  var FILL_COLOR_OPS = opSet(["setFillGray", "setFillRGBColor", "setFillCMYKColor", "setFillColor"]);
259
279
  var STROKE_COLOR_OPS = opSet(["setStrokeGray", "setStrokeRGBColor", "setStrokeCMYKColor", "setStrokeColor"]);
260
280
  var SHOW_TEXT_OPS = opSet(["showText", "showSpacedText", "nextLineShowText", "nextLineSetSpacingShowText"]);