baiten3d 0.1.0 → 0.1.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.
@@ -1,28 +1,28 @@
1
1
  import { access as e, copyFile as t, cp as n, mkdir as r, mkdtemp as i, readFile as a, readdir as o, realpath as s, rm as c, stat as l, writeFile as u } from "node:fs/promises";
2
2
  import { basename as d, dirname as f, isAbsolute as p, join as m, relative as h, resolve as g, sep as _ } from "node:path";
3
3
  import v from "yaml";
4
- import { t as y } from "../../composeSite-CcP_4wa0.js";
5
- import { n as b } from "../../rack-DndsEqJP.js";
6
- import x from "rehype-highlight";
7
- import ee, { defaultSchema as S } from "rehype-sanitize";
8
- import te from "rehype-stringify";
9
- import ne from "remark-gfm";
10
- import re from "remark-parse";
11
- import ie from "remark-rehype";
12
- import { unified as ae } from "unified";
13
- import { parse as oe } from "parse5";
14
- import { watch as se } from "node:fs";
15
- import { createServer as ce } from "node:http";
16
- import { tmpdir as le } from "node:os";
17
- import { gzipSync as ue } from "node:zlib";
18
- import de from "mime-types";
4
+ import { t as y } from "../../composeSite-BEb4A7zA.js";
5
+ import { n as b } from "../../rack-C76bUYRK.js";
6
+ import ee from "rehype-highlight";
7
+ import te, { defaultSchema as x } from "rehype-sanitize";
8
+ import ne from "rehype-stringify";
9
+ import re from "remark-gfm";
10
+ import ie from "remark-parse";
11
+ import S from "remark-rehype";
12
+ import { unified as C } from "unified";
13
+ import { parse as ae } from "parse5";
14
+ import { watch as oe } from "node:fs";
15
+ import { createServer as se } from "node:http";
16
+ import { tmpdir as ce } from "node:os";
17
+ import { gzipSync as le } from "node:zlib";
18
+ import ue from "mime-types";
19
19
  // src/domain/siteDataCodec.ts
20
- var fe = 260;
21
- function C(e) {
20
+ var de = 260;
21
+ function w(e) {
22
22
  let { sheets: t, editions: n, ...r } = e;
23
23
  return r;
24
24
  }
25
- function w(e, t) {
25
+ function T(e, t) {
26
26
  return {
27
27
  slug: e.slug,
28
28
  file: e.file,
@@ -32,7 +32,7 @@ function w(e, t) {
32
32
  ...e.author ? { author: e.author } : {},
33
33
  publishedAt: e.publishedAt,
34
34
  summary: e.summary,
35
- body: t ? e.body.slice(0, fe) : "",
35
+ body: t ? e.body.slice(0, de) : "",
36
36
  ...e.heroImage ? { heroImage: e.heroImage } : {},
37
37
  ...e.heroCaption ? { heroCaption: e.heroCaption } : {},
38
38
  ...e.editionId ? { editionId: e.editionId } : {},
@@ -40,7 +40,7 @@ function w(e, t) {
40
40
  ...e.tags && e.tags.length > 0 ? { tags: e.tags } : {}
41
41
  };
42
42
  }
43
- function T(e) {
43
+ function E(e) {
44
44
  return {
45
45
  id: e.id,
46
46
  kind: e.kind,
@@ -50,20 +50,20 @@ function T(e) {
50
50
  publishedAt: e.publishedAt,
51
51
  ...e.displayOnRack === void 0 ? {} : { displayOnRack: e.displayOnRack },
52
52
  sheets: [],
53
- leadArticle: e.leadArticle ? w(e.leadArticle, !0) : null,
53
+ leadArticle: e.leadArticle ? T(e.leadArticle, !0) : null,
54
54
  articleCount: e.articleCount
55
55
  };
56
56
  }
57
- function pe(e, t) {
57
+ function fe(e, t) {
58
58
  let n = e.publications.map((e) => {
59
- let t = e.latestEdition?.leadArticle?.slug, n = e.editions.map((e) => T(e)), r = e.latestEdition ? n.find((t) => t.id === e.latestEdition?.id) ?? T(e.latestEdition) : null;
59
+ let t = e.latestEdition?.leadArticle?.slug, n = e.editions.map((e) => E(e)), r = e.latestEdition ? n.find((t) => t.id === e.latestEdition?.id) ?? E(e.latestEdition) : null;
60
60
  return {
61
- config: C(e.config),
61
+ config: w(e.config),
62
62
  writingMode: e.writingMode,
63
63
  readingDirection: e.readingDirection,
64
64
  editions: n,
65
65
  latestEdition: r,
66
- allArticles: e.allArticles.map((e, n) => w(e, n === 0 || e.slug === t)),
66
+ allArticles: e.allArticles.map((e, n) => T(e, n === 0 || e.slug === t)),
67
67
  sheets: []
68
68
  };
69
69
  });
@@ -80,7 +80,11 @@ function pe(e, t) {
80
80
  editionRoutes: e.editionRoutes
81
81
  };
82
82
  }
83
- function E(e, t, n) {
83
+ function pe(e, t) {
84
+ let n = !1, r = {};
85
+ return t.title !== e.title && (r.title = t.title, n = !0), t.subtitle !== e.subtitle && (r.subtitle = t.subtitle ?? null, n = !0), t.heroImage !== e.heroImage && (r.heroImage = t.heroImage ?? null, n = !0), t.heroCaption !== e.heroCaption && (r.heroCaption = t.heroCaption ?? null, n = !0), t.body !== e.body && (r.body = t.body, n = !0), t.bodyHtml !== e.bodyHtml && (r.bodyHtml = t.bodyHtml, n = !0), n ? r : void 0;
86
+ }
87
+ function me(e, t, n) {
84
88
  let r = {}, i = (e) => (r[e.slug] || (r[e.slug] = e), e.slug), a = t.allArticles.map((e) => i(e)), o = t.editions.map((e) => {
85
89
  let t = e.leadArticle ? i(e.leadArticle) : null, n = e.sheets.map((e) => ({
86
90
  page: e.page,
@@ -89,10 +93,11 @@ function E(e, t, n) {
89
93
  ...e.columns === void 0 ? {} : { columns: e.columns },
90
94
  ...e.rows === void 0 ? {} : { rows: e.rows },
91
95
  blocks: e.blocks.map((e) => {
92
- let { article: t, ...n } = e;
96
+ let { article: t, ...n } = e, a = i(t), o = r[a], s = o ? pe(o, t) : void 0;
93
97
  return {
94
98
  ...n,
95
- articleSlug: i(t)
99
+ articleSlug: a,
100
+ ...s ? { articleOverride: s } : {}
96
101
  };
97
102
  })
98
103
  }));
@@ -121,7 +126,7 @@ function E(e, t, n) {
121
126
  routes: e.routes.filter((e) => e.publicationId === t.config.id),
122
127
  editionRoutes: e.editionRoutes.filter((e) => e.publicationId === t.config.id)
123
128
  },
124
- config: C(t.config),
129
+ config: w(t.config),
125
130
  writingMode: t.writingMode,
126
131
  readingDirection: t.readingDirection,
127
132
  articles: r,
@@ -136,18 +141,18 @@ var D = class extends Error {
136
141
  constructor(e, t) {
137
142
  super(`${e}: ${t}`), this.name = "MarkdownParseError", this.filePath = e;
138
143
  }
139
- }, me = {
140
- ...S,
144
+ }, he = {
145
+ ...x,
141
146
  attributes: {
142
- ...S.attributes,
143
- code: [...S.attributes?.code ?? [], [
147
+ ...x.attributes,
148
+ code: [...x.attributes?.code ?? [], [
144
149
  "className",
145
150
  /^language-./,
146
151
  /^hljs/
147
152
  ]],
148
- span: [...S.attributes?.span ?? [], ["className", /^hljs-/]],
149
- h2: [...S.attributes?.h2 ?? [], "id"],
150
- h3: [...S.attributes?.h3 ?? [], "id"],
153
+ span: [...x.attributes?.span ?? [], ["className", /^hljs-/]],
154
+ h2: [...x.attributes?.h2 ?? [], "id"],
155
+ h3: [...x.attributes?.h3 ?? [], "id"],
151
156
  figure: [
152
157
  "className",
153
158
  "dataFigureId",
@@ -157,7 +162,7 @@ var D = class extends Error {
157
162
  div: ["className", "dataMermaid"]
158
163
  },
159
164
  tagNames: [
160
- ...S.tagNames ?? [],
165
+ ...x.tagNames ?? [],
161
166
  "figure",
162
167
  "figcaption"
163
168
  ]
@@ -186,40 +191,40 @@ function O(e, t) {
186
191
  throw e instanceof D ? e : new D(t, `front matter の YAML 構文が不正です: ${e instanceof Error ? e.message : String(e)}`);
187
192
  }
188
193
  }
189
- async function he(e, t, n) {
190
- let { data: r, content: i } = O(e, n), a = _e(r.slug, t), { title: o, bodyWithoutH1: s } = ve(r.title, i, a), c = ae().use(re).use(ne).use(ie).use(x, {
194
+ async function ge(e, t, n) {
195
+ let { data: r, content: i } = O(e, n), a = ve(r.slug, t), { title: o, bodyWithoutH1: s } = ye(r.title, i, a), c = C().use(ie).use(re).use(S).use(ee, {
191
196
  detect: !1,
192
197
  ignoreMissing: !0
193
- }).use(ee, me).use(te), { html: l, headings: u, figures: d } = ge(String(await c.process(s))), f = A(r.summary) ?? A(r.description) ?? ye(s);
198
+ }).use(te, he).use(ne), { html: l, headings: u, figures: d } = _e(String(await c.process(s))), f = j(r.summary) ?? j(r.description) ?? k(s);
194
199
  return {
195
200
  slug: a,
196
201
  file: t,
197
202
  title: o,
198
- subtitle: A(r.subtitle),
199
- kicker: A(r.kicker),
200
- author: A(r.author),
201
- publishedAt: j(r.publishedAt ?? r.date) ?? "2026-11-28",
202
- updatedAt: j(r.updatedAt),
203
+ subtitle: j(r.subtitle),
204
+ kicker: j(r.kicker),
205
+ author: j(r.author),
206
+ publishedAt: M(r.publishedAt ?? r.date) ?? "2026-11-28",
207
+ updatedAt: M(r.updatedAt),
203
208
  summary: f,
204
209
  body: s.trim(),
205
210
  bodyHtml: l,
206
211
  headings: u,
207
212
  figures: d,
208
- heroImage: A(r.heroImage ?? r.image),
209
- heroCaption: A(r.heroCaption ?? r.imageCaption),
210
- pages: De(r.pages),
213
+ heroImage: j(r.heroImage ?? r.image),
214
+ heroCaption: j(r.heroCaption ?? r.imageCaption),
215
+ pages: Oe(r.pages),
211
216
  paginateBy: r.paginateBy === "h2" ? "h2" : r.paginateBy === "none" ? "none" : void 0,
212
- editionId: A(r.editionId),
213
- editionKind: M(r.editionKind),
217
+ editionId: j(r.editionId),
218
+ editionKind: N(r.editionKind),
214
219
  pinned: r.pinned === !0 || r.featured === !0,
215
- tags: N(r.tags),
216
- layout: Ee(r.layout)
220
+ tags: P(r.tags),
221
+ layout: De(r.layout)
217
222
  };
218
223
  }
219
- function ge(e) {
224
+ function _e(e) {
220
225
  let t = [], n = [], r = 0, i = 0, a = e.replace(/<(h[23])>([\s\S]*?)<\/\1>/g, (e, n, i) => {
221
226
  r += 1;
222
- let a = k(i).trim(), o = `sec-${r}`;
227
+ let a = A(i).trim(), o = `sec-${r}`;
223
228
  return t.push({
224
229
  id: o,
225
230
  level: n === "h2" ? 2 : 3,
@@ -261,10 +266,10 @@ function ge(e) {
261
266
  figures: n
262
267
  };
263
268
  }
264
- function _e(e, t) {
269
+ function ve(e, t) {
265
270
  return typeof e == "string" && e.trim().length > 0 ? e.trim() : t.replace(/\.md$/i, "").replace(/^\d+[-_]/, "").toLowerCase();
266
271
  }
267
- function ve(e, t, n) {
272
+ function ye(e, t, n) {
268
273
  let r = t.match(/^#\s+(.+)\n*/);
269
274
  if (typeof e == "string" && e.trim()) {
270
275
  let n = r ? t.slice(r[0].length) : t;
@@ -281,77 +286,77 @@ function ve(e, t, n) {
281
286
  bodyWithoutH1: t
282
287
  };
283
288
  }
284
- function ye(e) {
289
+ function k(e) {
285
290
  return (e.split("\n").map((e) => e.trim()).filter((e) => e.length > 0 && !e.startsWith("#") && !e.startsWith("```") && !e.startsWith("|") && !e.startsWith("!["))[0] ?? "").replace(/[*_`[\]()]/g, "").slice(0, 140);
286
291
  }
287
- function k(e) {
292
+ function A(e) {
288
293
  return e.replace(/<[^>]+>/g, "");
289
294
  }
290
- function A(e) {
295
+ function j(e) {
291
296
  if (typeof e != "string") return;
292
297
  let t = e.trim();
293
298
  return t.length > 0 ? t : void 0;
294
299
  }
295
- function j(e) {
296
- return e instanceof Date && !Number.isNaN(e.getTime()) ? e.toISOString().slice(0, 10) : A(e);
297
- }
298
300
  function M(e) {
299
- if (e === "regular" || e === "special" || e === "extra") return e;
301
+ return e instanceof Date && !Number.isNaN(e.getTime()) ? e.toISOString().slice(0, 10) : j(e);
300
302
  }
301
303
  function N(e) {
304
+ if (e === "regular" || e === "special" || e === "extra") return e;
305
+ }
306
+ function P(e) {
302
307
  if (!Array.isArray(e)) return;
303
308
  let t = e.filter((e) => typeof e == "string" && e.trim() !== "");
304
309
  return t.length > 0 ? t : void 0;
305
310
  }
306
- var P = /* @__PURE__ */ new Set([
311
+ var be = /* @__PURE__ */ new Set([
307
312
  "lead",
308
313
  "feature",
309
314
  "standard",
310
315
  "column-box"
311
- ]), be = /* @__PURE__ */ new Set([
316
+ ]), xe = /* @__PURE__ */ new Set([
312
317
  "plain",
313
318
  "solid",
314
319
  "ruled",
315
320
  "photo-overlay",
316
321
  "horizontal-banner"
317
- ]), xe = /* @__PURE__ */ new Set(["vertical", "horizontal"]), Se = /* @__PURE__ */ new Set([
322
+ ]), Se = /* @__PURE__ */ new Set(["vertical", "horizontal"]), Ce = /* @__PURE__ */ new Set([
318
323
  "right",
319
324
  "left",
320
325
  "top-ribbon"
321
- ]), Ce = /* @__PURE__ */ new Set([
326
+ ]), we = /* @__PURE__ */ new Set([
322
327
  "accent",
323
328
  "highlight",
324
329
  "sports-impact",
325
330
  "sports-yellow",
326
331
  "ink",
327
332
  "paper"
328
- ]), we = /* @__PURE__ */ new Set([
333
+ ]), Te = /* @__PURE__ */ new Set([
329
334
  "none",
330
335
  "framed",
331
336
  "double-frame",
332
337
  "tinted"
333
- ]), Te = /* @__PURE__ */ new Set([
338
+ ]), Ee = /* @__PURE__ */ new Set([
334
339
  "top",
335
340
  "side",
336
341
  "full-bleed",
337
342
  "none"
338
343
  ]);
339
- function Ee(e) {
344
+ function De(e) {
340
345
  if (!e || typeof e != "object" || Array.isArray(e)) return;
341
346
  let t = e, n = Array.isArray(t.span) && t.span.length === 2 && typeof t.span[0] == "number" && typeof t.span[1] == "number" ? t.span : void 0, r = typeof t.colSpan == "number" ? t.colSpan : n ? n[0] : void 0, i = typeof t.rowSpan == "number" ? t.rowSpan : n ? n[1] : void 0, a = {
342
- role: F(t.role, P),
347
+ role: F(t.role, be),
343
348
  colSpan: r,
344
349
  rowSpan: i,
345
350
  col: typeof t.col == "number" ? t.col : void 0,
346
351
  row: typeof t.row == "number" ? t.row : void 0,
347
352
  imageSpan: typeof t.imageSpan == "number" ? t.imageSpan : void 0,
348
- imagePlacement: F(t.imagePlacement, Te),
349
- headlineStyle: F(t.headlineStyle, be),
350
- headlineOrientation: F(t.headlineOrientation, xe),
351
- overlayPosition: F(t.overlayPosition, Se),
352
- overlayTone: F(t.overlayTone, Ce),
353
- overlayBadge: A(t.overlayBadge),
354
- boxStyle: F(t.boxStyle, we),
353
+ imagePlacement: F(t.imagePlacement, Ee),
354
+ headlineStyle: F(t.headlineStyle, xe),
355
+ headlineOrientation: F(t.headlineOrientation, Se),
356
+ overlayPosition: F(t.overlayPosition, Ce),
357
+ overlayTone: F(t.overlayTone, we),
358
+ overlayBadge: j(t.overlayBadge),
359
+ boxStyle: F(t.boxStyle, Te),
355
360
  tiers: typeof t.tiers == "number" && t.tiers >= 1 && t.tiers <= 4 ? Math.round(t.tiers) : void 0
356
361
  };
357
362
  return Object.values(a).some((e) => e !== void 0) ? a : void 0;
@@ -359,7 +364,7 @@ function Ee(e) {
359
364
  function F(e, t) {
360
365
  return typeof e == "string" && t.has(e) ? e : void 0;
361
366
  }
362
- function De(e) {
367
+ function Oe(e) {
363
368
  if (!Array.isArray(e)) return;
364
369
  let t = [];
365
370
  for (let n of e) if (typeof n == "string" && n.trim()) t.push({ src: n.trim() });
@@ -367,14 +372,14 @@ function De(e) {
367
372
  let e = n;
368
373
  typeof e.src == "string" && e.src.trim() && t.push({
369
374
  src: e.src.trim(),
370
- alt: A(e.alt),
371
- caption: A(e.caption)
375
+ alt: j(e.alt),
376
+ caption: j(e.caption)
372
377
  });
373
378
  }
374
379
  return t.length > 0 ? t : void 0;
375
380
  }
376
381
  // src/adapters/fs/loadArticlesDirectory.ts
377
- var Oe = /* @__PURE__ */ new Set([
382
+ var ke = /* @__PURE__ */ new Set([
378
383
  "classic",
379
384
  "bold",
380
385
  "ledger",
@@ -383,36 +388,36 @@ var Oe = /* @__PURE__ */ new Set([
383
388
  "sports",
384
389
  "economic",
385
390
  "culture"
386
- ]), ke = /* @__PURE__ */ new Set([
391
+ ]), Ae = /* @__PURE__ */ new Set([
387
392
  "classic-frame",
388
393
  "solid-banner",
389
394
  "minimal-rule"
390
- ]), Ae = /* @__PURE__ */ new Set([
395
+ ]), je = /* @__PURE__ */ new Set([
391
396
  "none",
392
397
  "diagonal",
393
398
  "dots",
394
399
  "lattice"
395
- ]), je = /* @__PURE__ */ new Set([
400
+ ]), Me = /* @__PURE__ */ new Set([
396
401
  "monochrome",
397
402
  "color",
398
403
  "warm"
399
- ]), I = /* @__PURE__ */ new Set(["serif", "sans"]), Me = /* @__PURE__ */ new Set([
404
+ ]), I = /* @__PURE__ */ new Set(["serif", "sans"]), Ne = /* @__PURE__ */ new Set([
400
405
  "broadsheet",
401
406
  "impact",
402
407
  "ledger"
403
- ]), Ne = /* @__PURE__ */ new Set(["vertical-rl", "horizontal-tb"]), Pe = /* @__PURE__ */ new Set(["rtl", "ltr"]), Fe = /* @__PURE__ */ new Set([
408
+ ]), Pe = /* @__PURE__ */ new Set(["vertical-rl", "horizontal-tb"]), Fe = /* @__PURE__ */ new Set(["rtl", "ltr"]), Ie = /* @__PURE__ */ new Set([
404
409
  "matte",
405
410
  "glossy",
406
411
  "uncoated"
407
- ]), Ie = /* @__PURE__ */ new Set(["perfect", "saddle"]), Le = /* @__PURE__ */ new Set([
412
+ ]), Le = /* @__PURE__ */ new Set(["perfect", "saddle"]), Re = /* @__PURE__ */ new Set([
408
413
  "bold-banner",
409
414
  "editorial-serif",
410
415
  "vertical-stamp"
411
- ]), Re = /* @__PURE__ */ new Set([
416
+ ]), ze = /* @__PURE__ */ new Set([
412
417
  "morning-table",
413
418
  "cafe-table",
414
419
  "night-desk"
415
- ]), ze = /* @__PURE__ */ new Set(["newspaper", "magazine"]), Be = /* @__PURE__ */ new Set([
420
+ ]), Be = /* @__PURE__ */ new Set(["newspaper", "magazine"]), Ve = /* @__PURE__ */ new Set([
416
421
  "lead",
417
422
  "feature",
418
423
  "standard",
@@ -427,7 +432,7 @@ async function L(t) {
427
432
  }
428
433
  let r = await a(n, "utf8"), i = v.parse(r);
429
434
  if (!i || typeof i != "object" || Array.isArray(i)) throw new D(n, "baiten.yml はキー・値のマップ形式で記述してください");
430
- let o = i, s = Ve(o.navigation, n);
435
+ let o = i, s = He(o.navigation, n);
431
436
  return {
432
437
  ...o,
433
438
  navigation: s
@@ -444,7 +449,7 @@ function R(e, t, n) {
444
449
  external: typeof r.external == "boolean" ? r.external : void 0
445
450
  };
446
451
  }
447
- function Ve(e, t) {
452
+ function He(e, t) {
448
453
  if (e == null) return;
449
454
  if (typeof e != "object" || Array.isArray(e)) throw new D(t, "navigation はオブジェクト形式で指定してください");
450
455
  let n = e, r = n.parentLink !== void 0 && n.parentLink !== null ? R(n.parentLink, t, "navigation.parentLink") : void 0, i = Array.isArray(n.headerLinks) ? n.headerLinks.map((e, n) => R(e, t, `navigation.headerLinks[${n}]`)) : void 0, a;
@@ -462,12 +467,12 @@ function Ve(e, t) {
462
467
  footer: a
463
468
  };
464
469
  }
465
- async function He(e, t = {}) {
466
- let n = g(e), r = (await Ue(n)).filter((e) => e.isDirectory() && !e.name.startsWith(".") && e.name !== "assets").sort((e, t) => e.name.localeCompare(t.name));
470
+ async function Ue(e, t = {}) {
471
+ let n = g(e), r = (await We(n)).filter((e) => e.isDirectory() && !e.name.startsWith(".") && e.name !== "assets").sort((e, t) => e.name.localeCompare(t.name));
467
472
  if (r.length === 0) throw Error(`新聞社ディレクトリが見つかりません: ${n}(例: articles/it-news/index.md を作成してください)`);
468
473
  let i = [], a = [];
469
474
  for (let e of r) {
470
- let t = e.name, { source: r, pubAssets: o } = await We(t, m(n, t));
475
+ let t = e.name, { source: r, pubAssets: o } = await Ge(t, m(n, t));
471
476
  i.push(r), a.push(...o);
472
477
  }
473
478
  return {
@@ -478,30 +483,30 @@ async function He(e, t = {}) {
478
483
  assets: a
479
484
  };
480
485
  }
481
- async function Ue(e) {
486
+ async function We(e) {
482
487
  try {
483
488
  return await o(e, { withFileTypes: !0 });
484
489
  } catch {
485
490
  throw Error(`記事ディレクトリを読み込めません: ${e}`);
486
491
  }
487
492
  }
488
- async function We(e, t) {
489
- let n = (await o(t, { withFileTypes: !0 })).filter((e) => e.isFile() && e.name.endsWith(".md")).map((e) => e.name).sort((e, t) => e.localeCompare(t)), r = n.includes("index.md") ? "index.md" : null, i = r ? await Ge(e, m(t, r)) : qe(e), s = n.filter((e) => e !== "index.md"), c = [], l = [], u = /* @__PURE__ */ new Set();
490
- if (i.cover?.heroImage && H(i.cover.heroImage)) {
493
+ async function Ge(e, t) {
494
+ let n = (await o(t, { withFileTypes: !0 })).filter((e) => e.isFile() && e.name.endsWith(".md")).map((e) => e.name).sort((e, t) => e.localeCompare(t)), r = n.includes("index.md") ? "index.md" : null, i = r ? await Ke(e, m(t, r)) : Ye(e), s = n.filter((e) => e !== "index.md"), c = [], l = [], u = /* @__PURE__ */ new Set();
495
+ if (i.cover?.heroImage && V(i.cover.heroImage)) {
491
496
  let n = g(t, i.cover.heroImage);
492
- await U(n, r ? m(t, r) : t, i.cover.heroImage), u.add(n), l.push({
497
+ await H(n, r ? m(t, r) : t, i.cover.heroImage), u.add(n), l.push({
493
498
  publicationId: e,
494
499
  relativePath: i.cover.heroImage.replace(/^\.\//, ""),
495
500
  absolutePath: n
496
501
  });
497
502
  }
498
503
  for (let n of s) {
499
- let r = m(t, n), i = await he(await a(r, "utf8"), n, r);
504
+ let r = m(t, n), i = await ge(await a(r, "utf8"), n, r);
500
505
  c.push(i);
501
- let o = Xe(i);
506
+ let o = Qe(i);
502
507
  for (let n of o) {
503
508
  let i = g(t, n);
504
- await U(i, r, n), u.has(i) || (u.add(i), l.push({
509
+ await H(i, r, n), u.has(i) || (u.add(i), l.push({
505
510
  publicationId: e,
506
511
  relativePath: n.replace(/^\.\//, ""),
507
512
  absolutePath: i
@@ -516,8 +521,8 @@ async function We(e, t) {
516
521
  pubAssets: l
517
522
  };
518
523
  }
519
- async function Ge(e, t) {
520
- let { data: n } = O(await a(t, "utf8"), t), r = B(n.format, ze, "newspaper", t, "format"), i = B(n.theme, Oe, "it-broadsheet", t, "theme"), o = B(n.scene, Re, "morning-table", t, "scene");
524
+ async function Ke(e, t) {
525
+ let { data: n } = O(await a(t, "utf8"), t), r = z(n.format, Be, "newspaper", t, "format"), i = z(n.theme, ke, "it-broadsheet", t, "theme"), o = z(n.scene, ze, "morning-table", t, "scene");
521
526
  return {
522
527
  id: e,
523
528
  title: typeof n.title == "string" && n.title.trim() ? n.title.trim() : e,
@@ -525,55 +530,55 @@ async function Ge(e, t) {
525
530
  format: r,
526
531
  theme: i,
527
532
  scene: o,
528
- writingMode: n.writingMode === void 0 ? void 0 : B(n.writingMode, Ne, "horizontal-tb", t, "writingMode"),
529
- readingDirection: n.readingDirection === void 0 ? void 0 : B(n.readingDirection, Pe, "ltr", t, "readingDirection"),
530
- paperFinish: n.paperFinish === void 0 ? void 0 : B(n.paperFinish, Fe, "matte", t, "paperFinish"),
531
- binding: n.binding === void 0 ? void 0 : B(n.binding, Ie, "perfect", t, "binding"),
532
- cover: z(n.cover, t),
533
+ writingMode: n.writingMode === void 0 ? void 0 : z(n.writingMode, Pe, "horizontal-tb", t, "writingMode"),
534
+ readingDirection: n.readingDirection === void 0 ? void 0 : z(n.readingDirection, Fe, "ltr", t, "readingDirection"),
535
+ paperFinish: n.paperFinish === void 0 ? void 0 : z(n.paperFinish, Ie, "matte", t, "paperFinish"),
536
+ binding: n.binding === void 0 ? void 0 : z(n.binding, Le, "perfect", t, "binding"),
537
+ cover: qe(n.cover, t),
533
538
  displayOnRack: typeof n.displayOnRack == "boolean" ? n.displayOnRack : void 0,
534
539
  order: typeof n.order == "number" ? n.order : void 0,
535
540
  description: typeof n.description == "string" ? n.description.trim() : void 0,
536
541
  accentColor: typeof n.accentColor == "string" ? n.accentColor.trim() : void 0,
537
542
  paperTint: typeof n.paperTint == "string" ? n.paperTint.trim() : void 0,
538
- masthead: Ke(n.masthead, t),
539
- photoTreatment: n.photoTreatment === void 0 ? void 0 : B(n.photoTreatment, je, "monochrome", t, "photoTreatment"),
540
- headlineFont: n.headlineFont === void 0 ? void 0 : B(n.headlineFont, I, "serif", t, "headlineFont"),
541
- kioskPreview: n.kioskPreview === void 0 ? void 0 : B(n.kioskPreview, Me, "broadsheet", t, "kioskPreview"),
543
+ masthead: Je(n.masthead, t),
544
+ photoTreatment: n.photoTreatment === void 0 ? void 0 : z(n.photoTreatment, Me, "monochrome", t, "photoTreatment"),
545
+ headlineFont: n.headlineFont === void 0 ? void 0 : z(n.headlineFont, I, "serif", t, "headlineFont"),
546
+ kioskPreview: n.kioskPreview === void 0 ? void 0 : z(n.kioskPreview, Ne, "broadsheet", t, "kioskPreview"),
542
547
  startingIssueNumber: typeof n.startingIssueNumber == "number" ? n.startingIssueNumber : void 0,
543
548
  articlesPerEdition: typeof n.articlesPerEdition == "number" ? n.articlesPerEdition : void 0,
544
- sheets: V(n.sheets, t),
545
- editions: Ye(n.editions, t)
549
+ sheets: B(n.sheets, t),
550
+ editions: Ze(n.editions, t)
546
551
  };
547
552
  }
548
- function z(e, t) {
553
+ function qe(e, t) {
549
554
  if (e == null) return;
550
555
  if (typeof e != "object" || Array.isArray(e)) throw new D(t, "cover はオブジェクト形式で記述してください");
551
556
  let n = e;
552
557
  return {
553
558
  heroImage: typeof n.image == "string" && n.image.trim() ? n.image.trim() : typeof n.heroImage == "string" && n.heroImage.trim() ? n.heroImage.trim() : void 0,
554
559
  overlay: typeof n.overlay == "boolean" ? n.overlay : void 0,
555
- logoStyle: n.logoStyle === void 0 ? void 0 : B(n.logoStyle, Le, "bold-banner", t, "cover.logoStyle"),
560
+ logoStyle: n.logoStyle === void 0 ? void 0 : z(n.logoStyle, Re, "bold-banner", t, "cover.logoStyle"),
556
561
  tagline: typeof n.tagline == "string" && n.tagline.trim() ? n.tagline.trim() : void 0,
557
562
  sublines: Array.isArray(n.sublines) ? n.sublines.filter((e) => typeof e == "string" && e.trim() !== "").map((e) => e.trim()) : void 0,
558
563
  badge: typeof n.badge == "string" && n.badge.trim() ? n.badge.trim() : void 0,
559
564
  overlayColor: typeof n.overlayColor == "string" && n.overlayColor.trim() ? n.overlayColor.trim() : void 0
560
565
  };
561
566
  }
562
- function Ke(e, t) {
567
+ function Je(e, t) {
563
568
  if (e == null) return;
564
569
  if (typeof e != "object" || Array.isArray(e)) throw new D(t, "masthead はオブジェクト形式で記述してください");
565
570
  let n = e;
566
571
  return {
567
- variant: n.variant === void 0 ? void 0 : B(n.variant, ke, "classic-frame", t, "masthead.variant"),
568
- pattern: n.pattern === void 0 ? void 0 : B(n.pattern, Ae, "none", t, "masthead.pattern"),
569
- font: n.font === void 0 ? void 0 : B(n.font, I, "serif", t, "masthead.font"),
572
+ variant: n.variant === void 0 ? void 0 : z(n.variant, Ae, "classic-frame", t, "masthead.variant"),
573
+ pattern: n.pattern === void 0 ? void 0 : z(n.pattern, je, "none", t, "masthead.pattern"),
574
+ font: n.font === void 0 ? void 0 : z(n.font, I, "serif", t, "masthead.font"),
570
575
  showPageLabel: typeof n.showPageLabel == "boolean" ? n.showPageLabel : void 0,
571
576
  backgroundColor: typeof n.backgroundColor == "string" ? n.backgroundColor.trim() : void 0,
572
577
  textColor: typeof n.textColor == "string" ? n.textColor.trim() : void 0,
573
578
  borderColor: typeof n.borderColor == "string" ? n.borderColor.trim() : void 0
574
579
  };
575
580
  }
576
- function qe(e) {
581
+ function Ye(e) {
577
582
  return {
578
583
  id: e,
579
584
  title: e,
@@ -583,17 +588,17 @@ function qe(e) {
583
588
  scene: "morning-table"
584
589
  };
585
590
  }
586
- function B(e, t, n, r, i) {
591
+ function z(e, t, n, r, i) {
587
592
  if (e == null) return n;
588
593
  if (typeof e == "string" && t.has(e)) return e;
589
594
  throw new D(r, `${i} の値が不正です: ${String(e)}(許可: ${Array.from(t).join(", ")})`);
590
595
  }
591
- function V(e, t) {
596
+ function B(e, t) {
592
597
  if (e != null) {
593
598
  if (!Array.isArray(e)) throw new D(t, "sheets は配列で指定してください");
594
599
  return e.map((e, n) => {
595
600
  if (!e || typeof e != "object") throw new D(t, `sheets[${n}] はオブジェクトで指定してください`);
596
- let r = e, i = typeof r.page == "number" ? r.page : n + 1, a = (Array.isArray(r.blocks) ? r.blocks : []).map((e, r) => Je(e, t, `sheets[${n}].blocks[${r}]`));
601
+ let r = e, i = typeof r.page == "number" ? r.page : n + 1, a = (Array.isArray(r.blocks) ? r.blocks : []).map((e, r) => Xe(e, t, `sheets[${n}].blocks[${r}]`));
597
602
  return {
598
603
  page: i,
599
604
  template: typeof r.template == "string" ? r.template : void 0,
@@ -605,11 +610,11 @@ function V(e, t) {
605
610
  });
606
611
  }
607
612
  }
608
- function Je(e, t, n) {
613
+ function Xe(e, t, n) {
609
614
  if (!e || typeof e != "object") throw new D(t, `${n} が不正です`);
610
615
  let r = e;
611
616
  if (typeof r.file != "string" || !r.file.trim()) throw new D(t, `${n}.file は必須です`);
612
- let i = r.role === void 0 || r.role === null ? void 0 : B(r.role, Be, "standard", t, `${n}.role`), a;
617
+ let i = r.role === void 0 || r.role === null ? void 0 : z(r.role, Ve, "standard", t, `${n}.role`), a;
613
618
  if (Array.isArray(r.span) && r.span.length === 2) {
614
619
  let [e, t] = r.span;
615
620
  typeof e == "number" && typeof t == "number" && (a = [e, t]);
@@ -634,7 +639,7 @@ function Je(e, t, n) {
634
639
  tiers: typeof r.tiers == "number" && r.tiers >= 1 && r.tiers <= 4 ? Math.round(r.tiers) : void 0
635
640
  };
636
641
  }
637
- function Ye(e, t) {
642
+ function Ze(e, t) {
638
643
  if (e != null) {
639
644
  if (!Array.isArray(e)) throw new D(t, "editions は配列で指定してください");
640
645
  return e.map((e, n) => {
@@ -648,22 +653,22 @@ function Ye(e, t) {
648
653
  publishedAt: typeof r.publishedAt == "string" ? r.publishedAt : "2026-11-28",
649
654
  displayOnRack: typeof r.displayOnRack == "boolean" ? r.displayOnRack : void 0,
650
655
  articles: Array.isArray(r.articles) ? r.articles.filter((e) => typeof e == "string") : void 0,
651
- sheets: V(r.sheets, t)
656
+ sheets: B(r.sheets, t)
652
657
  };
653
658
  });
654
659
  }
655
660
  }
656
- function Xe(e) {
661
+ function Qe(e) {
657
662
  let t = [];
658
- e.heroImage && H(e.heroImage) && t.push(e.heroImage);
659
- for (let n of e.pages ?? []) n.src && H(n.src) && t.push(n.src);
660
- for (let n of e.figures ?? []) n.src && H(n.src) && t.push(n.src);
663
+ e.heroImage && V(e.heroImage) && t.push(e.heroImage);
664
+ for (let n of e.pages ?? []) n.src && V(n.src) && t.push(n.src);
665
+ for (let n of e.figures ?? []) n.src && V(n.src) && t.push(n.src);
661
666
  return t;
662
667
  }
663
- function H(e) {
668
+ function V(e) {
664
669
  return !/^(https?:\/\/|data:|\/)/i.test(e);
665
670
  }
666
- async function U(t, n, r) {
671
+ async function H(t, n, r) {
667
672
  try {
668
673
  await e(t);
669
674
  } catch {
@@ -671,7 +676,7 @@ async function U(t, n, r) {
671
676
  }
672
677
  }
673
678
  // src/adapters/fs/readHeadFile.ts
674
- var Ze = /* @__PURE__ */ new Set([
679
+ var $e = /* @__PURE__ */ new Set([
675
680
  "author",
676
681
  "baiten-root",
677
682
  "description",
@@ -684,13 +689,13 @@ var Ze = /* @__PURE__ */ new Set([
684
689
  "og:url",
685
690
  "twitter:card",
686
691
  "viewport"
687
- ]), Qe = /* @__PURE__ */ new Set([
692
+ ]), et = /* @__PURE__ */ new Set([
688
693
  "link",
689
694
  "meta",
690
695
  "script",
691
696
  "style"
692
- ]), $e = "<!doctype html><html><head>\n";
693
- function et(e) {
697
+ ]), tt = "<!doctype html><html><head>\n";
698
+ function nt(e) {
694
699
  let t = Object.fromEntries(e.attrs.map(({ name: e, value: t }) => [e.toLowerCase(), t]));
695
700
  if (e.tagName === "title" || e.tagName === "base") return `<${e.tagName}>`;
696
701
  if (e.tagName === "link") {
@@ -703,12 +708,12 @@ function et(e) {
703
708
  if (t["http-equiv"]?.trim().toLowerCase() === "content-type") return "<meta http-equiv=\"content-type\">";
704
709
  for (let e of ["name", "property"]) {
705
710
  let n = t[e]?.trim().toLowerCase();
706
- if (n && Ze.has(n)) return `<meta ${e}="${n}">`;
711
+ if (n && $e.has(n)) return `<meta ${e}="${n}">`;
707
712
  }
708
713
  }
709
714
  }
710
- function tt(e, t) {
711
- let n = (e, n) => /* @__PURE__ */ Error(`${t}:${Math.max(1, e - 1)}: ${n}`), r = oe(`${$e}${e}</head><body></body></html>`, {
715
+ function rt(e, t) {
716
+ let n = (e, n) => /* @__PURE__ */ Error(`${t}:${Math.max(1, e - 1)}: ${n}`), r = ae(`${tt}${e}</head><body></body></html>`, {
712
717
  sourceCodeLocationInfo: !0,
713
718
  onParseError(e) {
714
719
  throw n(e.startLine, `Invalid HTML (${e.code}).`);
@@ -718,24 +723,24 @@ function tt(e, t) {
718
723
  for (let e of r.childNodes) {
719
724
  if (e.nodeName === "#comment" || e.nodeName === "#text" && "value" in e && !e.value.trim()) continue;
720
725
  if (!("tagName" in e)) throw n(e.sourceCodeLocation?.startLine ?? 2, "Expected a meta, link, script, or style tag.");
721
- let t = e.sourceCodeLocation?.startLine ?? 2, r = et(e);
726
+ let t = e.sourceCodeLocation?.startLine ?? 2, r = nt(e);
722
727
  if (r) throw n(t, `${r} is managed by Baiten3D. Use the existing site and article settings.`);
723
- if (!Qe.has(e.tagName)) throw n(t, "Expected a meta, link, script, or style tag.");
728
+ if (!et.has(e.tagName)) throw n(t, "Expected a meta, link, script, or style tag.");
724
729
  }
725
730
  }
726
- function W(e, t) {
731
+ function U(e, t) {
727
732
  let n = h(e, t);
728
733
  return !p(n) && n.split(_)[0] !== "..";
729
734
  }
730
- async function nt(e, t) {
735
+ async function it(e, t) {
731
736
  if (t === void 0) return "";
732
737
  if (typeof t != "string" || !t.trim() || p(t) || /^[a-z][a-z\d+.-]*:/i.test(t)) throw Error("baiten.yml: headFile must be a relative path within the project.");
733
738
  let n = `baiten.yml: headFile ${JSON.stringify(t)}`, r = await s(e), i = g(r, t), o = () => /* @__PURE__ */ Error(`${n}: Use a path within the project.`);
734
- if (!W(r, i)) throw o();
739
+ if (!U(r, i)) throw o();
735
740
  let c = (e) => Error(`${n}: Cannot read the HTML file. Check that it exists and is readable.`, { cause: e }), u = await s(i).catch((e) => {
736
741
  throw c(e);
737
742
  });
738
- if (!W(r, u)) throw o();
743
+ if (!U(r, u)) throw o();
739
744
  let d;
740
745
  try {
741
746
  if (!(await l(u)).isFile()) throw Error("Expected a file.");
@@ -743,12 +748,12 @@ async function nt(e, t) {
743
748
  } catch (e) {
744
749
  throw c(e);
745
750
  }
746
- return tt(d, n), d;
751
+ return rt(d, n), d;
747
752
  }
748
753
  // src/adapters/static/buildStaticSite.ts
749
- var rt = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><rect width=\"64\" height=\"64\" rx=\"12\" fill=\"#18191D\"/><rect x=\"11\" y=\"10\" width=\"42\" height=\"44\" rx=\"3\" fill=\"#EFECE4\"/><line x1=\"17\" y1=\"18\" x2=\"47\" y2=\"18\" stroke=\"#1C1B19\" stroke-width=\"2.5\"/><line x1=\"17\" y1=\"22\" x2=\"47\" y2=\"22\" stroke=\"#1C1B19\" stroke-width=\"1\"/><rect x=\"35\" y=\"27\" width=\"12\" height=\"21\" fill=\"#1C1B19\"/><line x1=\"17\" y1=\"29\" x2=\"31\" y2=\"29\" stroke=\"#1C1B19\" stroke-width=\"2\"/><line x1=\"17\" y1=\"36\" x2=\"31\" y2=\"36\" stroke=\"#1C1B19\" stroke-width=\"1.5\"/><line x1=\"17\" y1=\"43\" x2=\"31\" y2=\"43\" stroke=\"#1C1B19\" stroke-width=\"1.5\"/></svg>";
750
- async function G(e) {
751
- let n = g(e.projectDir), i = await L(n), a = g(n, e.articlesDir ?? i.articlesDir ?? "articles"), o = g(n, e.outDir ?? i.outDir ?? "dist"), s = pt(e.siteUrl ?? i.siteUrl), { site: l, assets: d } = await He(a, {
754
+ var at = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><rect width=\"64\" height=\"64\" rx=\"12\" fill=\"#18191D\"/><rect x=\"11\" y=\"10\" width=\"42\" height=\"44\" rx=\"3\" fill=\"#EFECE4\"/><line x1=\"17\" y1=\"18\" x2=\"47\" y2=\"18\" stroke=\"#1C1B19\" stroke-width=\"2.5\"/><line x1=\"17\" y1=\"22\" x2=\"47\" y2=\"22\" stroke=\"#1C1B19\" stroke-width=\"1\"/><rect x=\"35\" y=\"27\" width=\"12\" height=\"21\" fill=\"#1C1B19\"/><line x1=\"17\" y1=\"29\" x2=\"31\" y2=\"29\" stroke=\"#1C1B19\" stroke-width=\"2\"/><line x1=\"17\" y1=\"36\" x2=\"31\" y2=\"36\" stroke=\"#1C1B19\" stroke-width=\"1.5\"/><line x1=\"17\" y1=\"43\" x2=\"31\" y2=\"43\" stroke=\"#1C1B19\" stroke-width=\"1.5\"/></svg>";
755
+ async function W(e) {
756
+ let n = g(e.projectDir), i = await L(n), a = g(n, e.articlesDir ?? i.articlesDir ?? "articles"), o = g(n, e.outDir ?? i.outDir ?? "dist"), s = mt(e.siteUrl ?? i.siteUrl), { site: l, assets: d } = await Ue(a, {
752
757
  title: e.title ?? i.title ?? "本日の新聞",
753
758
  description: e.description ?? i.description,
754
759
  entryViewOverride: i.entryView,
@@ -759,54 +764,54 @@ async function G(e) {
759
764
  recursive: !0,
760
765
  force: !0
761
766
  }), await r(o, { recursive: !0 });
762
- let p = await dt(e.runtimeDistDir, o);
767
+ let p = await ft(e.runtimeDistDir, o);
763
768
  for (let e of d) {
764
769
  let n = m(o, e.publicationId, e.relativePath);
765
770
  await r(f(n), { recursive: !0 }), await t(e.absolutePath, n);
766
771
  }
767
- await u(m(o, "favicon.svg"), rt, "utf8");
768
- let h = lt(l);
772
+ await u(m(o, "favicon.svg"), at, "utf8");
773
+ let h = ut(l);
769
774
  await u(m(o, "search-index.json"), JSON.stringify(h), "utf8");
770
- let _ = pe(l, {
775
+ let _ = fe(l, {
771
776
  siteUrl: s ?? null,
772
777
  entryZoomAnimation: i.entryZoomAnimation ?? !1
773
778
  });
774
779
  await u(m(o, "kiosk-data.json"), JSON.stringify(_), "utf8");
775
780
  for (let e of l.publications) {
776
- let t = E(l, e, {
781
+ let t = me(l, e, {
777
782
  siteUrl: s ?? null,
778
783
  entryZoomAnimation: i.entryZoomAnimation ?? !1
779
784
  }), n = m(o, e.config.id, "pub-data.json");
780
785
  await r(f(n), { recursive: !0 }), await u(n, JSON.stringify(t), "utf8");
781
786
  }
782
- let v = e.skipHeadFile ? "" : await nt(n, e.headFile ?? i.headFile), y = [], b = {
787
+ let v = e.skipHeadFile ? "" : await it(n, e.headFile ?? i.headFile), y = [], b = {
783
788
  site: l,
784
789
  siteUrl: s,
785
790
  runtimeAssets: p,
786
791
  headMarkup: v,
787
792
  liveReload: !!e.liveReload
788
793
  };
789
- await Z(o, "/", l.entryView === "front-page" && l.publications[0] ? K(b, l.publications[0], "/") : it(b)), y.push("/");
794
+ await Z(o, "/", l.entryView === "front-page" && l.publications[0] ? G(b, l.publications[0], "/") : ot(b)), y.push("/");
790
795
  for (let e of l.publications) {
791
796
  let t = `/${e.config.id}/`;
792
- await Z(o, t, K(b, e, t)), y.push(t);
797
+ await Z(o, t, G(b, e, t)), y.push(t);
793
798
  let n = `/${e.config.id}/archive/`;
794
- await Z(o, n, J(b, e, n)), y.push(n);
799
+ await Z(o, n, q(b, e, n)), y.push(n);
795
800
  for (let n of e.editions) {
796
801
  let r = `/${e.config.id}/editions/${n.id}/`, i = e.latestEdition?.id === n.id;
797
- await Z(o, r, q(b, e, n, r, !1, i ? t : void 0)), i || y.push(r);
802
+ await Z(o, r, K(b, e, n, r, !1, i ? t : void 0)), i || y.push(r);
798
803
  }
799
804
  let r = /* @__PURE__ */ new Map();
800
805
  for (let t of l.routes) t.publicationId === e.config.id && r.set(t.articleSlug, t);
801
806
  for (let t of e.allArticles) {
802
807
  let n = r.get(t.slug);
803
808
  if (!n) continue;
804
- let i = at(b, e, e.editions.find((e) => e.id === n.editionId) ?? e.latestEdition, t, n);
809
+ let i = J(b, e, e.editions.find((e) => e.id === n.editionId) ?? e.latestEdition, t, n);
805
810
  await Z(o, n.canonicalPath, i), y.push(n.canonicalPath);
806
811
  }
807
812
  }
808
813
  if (s) {
809
- let e = ut(s, y);
814
+ let e = dt(s, y);
810
815
  await u(m(o, "sitemap.xml"), e, "utf8");
811
816
  }
812
817
  return {
@@ -817,7 +822,7 @@ async function G(e) {
817
822
  searchEntryCount: h.length
818
823
  };
819
824
  }
820
- function it(e) {
825
+ function ot(e) {
821
826
  let { site: t } = e, n = t.publications.map((e) => {
822
827
  let t = e.latestEdition?.leadArticle;
823
828
  return `<article class="baiten-ssr-pub" data-pub="${$(e.config.id)}" data-theme="${$(e.config.theme)}">
@@ -828,7 +833,7 @@ function it(e) {
828
833
  </a>
829
834
  <p class="baiten-ssr-archive-link"><a href="./${$(e.config.id)}/archive/">全記事アーカイブ</a></p>
830
835
  </article>`;
831
- }).join("\n"), r = t.navigation, i = [...r?.parentLink ? [r.parentLink] : [], ...r?.headerLinks ?? []], a = i.length > 0 ? `<nav class="baiten-ssr-nav">${i.map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : "", o = r?.footer?.text || (r?.footer?.links?.length ?? 0) > 0 ? `<footer class="baiten-ssr-footer">${r?.footer?.text ? `<p>${$(r.footer.text)}</p>` : ""}${(r?.footer?.links?.length ?? 0) > 0 ? `<nav>${(r?.footer?.links ?? []).map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : ""}</footer>` : "", s = ct(e), c = `<main class="baiten-ssr-stand">
836
+ }).join("\n"), r = t.navigation, i = [...r?.parentLink ? [r.parentLink] : [], ...r?.headerLinks ?? []], a = i.length > 0 ? `<nav class="baiten-ssr-nav">${i.map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : "", o = r?.footer?.text || (r?.footer?.links?.length ?? 0) > 0 ? `<footer class="baiten-ssr-footer">${r?.footer?.text ? `<p>${$(r.footer.text)}</p>` : ""}${(r?.footer?.links?.length ?? 0) > 0 ? `<nav>${(r?.footer?.links ?? []).map((e) => `<a href="${$(e.href)}">${$(e.label)}</a>`).join(" ")}</nav>` : ""}</footer>` : "", s = lt(e), c = `<main class="baiten-ssr-stand">
832
837
  <header>
833
838
  ${a}
834
839
  <h1>${$(t.title)}</h1>
@@ -849,26 +854,28 @@ function it(e) {
849
854
  body: c
850
855
  });
851
856
  }
852
- function K(e, t, n) {
857
+ function G(e, t, n) {
853
858
  let r = t.latestEdition;
854
- return r ? q(e, t, r, n, !0) : J(e, t, n);
859
+ return r ? K(e, t, r, n, !0) : q(e, t, n);
855
860
  }
856
- function q(e, t, n, r, i = !1, a) {
857
- let o = Q(r), s = n.sheets.map((e) => {
858
- let n = e.blocks.map((e) => {
859
- let n = `${o}${t.config.id}/${e.article.slug}/`, r = e.article.heroImage ? `<img src="${o}${$(t.config.id)}/${$(e.article.heroImage)}" alt="${$(e.article.heroCaption ?? e.article.title)}" loading="lazy" width="640" height="480">` : "";
860
- return `<article class="baiten-ssr-block" data-role="${$(e.role)}" data-col-span="${e.colSpan}" data-row-span="${e.rowSpan}">
861
- <h3><a href="${$(n)}">${$(e.article.title)}</a></h3>
862
- ${e.article.subtitle ? `<p class="baiten-ssr-subtitle">${$(e.article.subtitle)}</p>` : ""}
863
- ${r}
864
- <p class="baiten-ssr-summary">${$(e.article.summary)}</p>
861
+ function K(e, t, n, r, i = !1, a) {
862
+ let o = Q(r), s = /* @__PURE__ */ new Set(), c = n.sheets.map((e) => {
863
+ let n = e.blocks.map((n) => {
864
+ let r = s.has(n.article.slug);
865
+ s.add(n.article.slug);
866
+ let i = r ? `${o}${t.config.id}/${n.article.slug}/?p=${e.page}` : `${o}${t.config.id}/${n.article.slug}/`, a = n.article.heroImage ? `<img src="${o}${$(t.config.id)}/${$(n.article.heroImage)}" alt="${$(n.article.heroCaption ?? n.article.title)}" loading="lazy" width="640" height="480">` : "";
867
+ return `<article class="baiten-ssr-block" data-role="${$(n.role)}" data-col-span="${n.colSpan}" data-row-span="${n.rowSpan}">
868
+ <h3><a href="${$(i)}">${$(n.article.title)}</a></h3>
869
+ ${n.article.subtitle ? `<p class="baiten-ssr-subtitle">${$(n.article.subtitle)}</p>` : ""}
870
+ ${a}
871
+ <p class="baiten-ssr-summary">${$(n.article.summary)}</p>
865
872
  </article>`;
866
873
  }).join("\n");
867
874
  return `<section class="baiten-ssr-sheet" aria-label="${e.page}面">
868
875
  <h2>${e.page}面</h2>
869
876
  ${n}
870
877
  </section>`;
871
- }).join("\n"), c = t.editions.map((e) => `<li><a href="${o}${$(t.config.id)}/editions/${$(e.id)}/">${$(e.label)} — ${$(e.title)} (${$(e.publishedAt)})</a></li>`).join("\n"), l = i ? `${t.config.title} | ${e.site.title}` : `${t.config.title} ${n.label}(${n.title}) | ${e.site.title}`, u = t.config.description ?? n.leadArticle?.summary ?? `${t.config.title}の紙面`, d = `<main class="baiten-ssr-edition" data-pub="${$(t.config.id)}" data-theme="${$(t.config.theme)}" data-scene="${$(t.config.scene)}" dir="${t.readingDirection}">
878
+ }).join("\n"), l = t.editions.map((e) => `<li><a href="${o}${$(t.config.id)}/editions/${$(e.id)}/">${$(e.label)} — ${$(e.title)} (${$(e.publishedAt)})</a></li>`).join("\n"), u = i ? `${t.config.title} | ${e.site.title}` : `${t.config.title} ${n.label}(${n.title}) | ${e.site.title}`, d = t.config.description ?? n.leadArticle?.summary ?? `${t.config.title}の紙面`, f = `<main class="baiten-ssr-edition" data-pub="${$(t.config.id)}" data-theme="${$(t.config.theme)}" data-scene="${$(t.config.scene)}" dir="${t.readingDirection}">
872
879
  <header>
873
880
  <nav aria-label="紙面ナビゲーション">
874
881
  <a href="${o}">売店へ戻る</a>
@@ -877,20 +884,20 @@ function q(e, t, n, r, i = !1, a) {
877
884
  <h1>${$(t.config.title)} — ${$(n.label)}</h1>
878
885
  <p><time datetime="${$(n.publishedAt)}">${$(n.publishedAt)}</time></p>
879
886
  </header>
880
- ${s}
887
+ ${c}
881
888
  <aside aria-label="バックナンバー">
882
889
  <h2>バックナンバー</h2>
883
- <ul>${c}</ul>
890
+ <ul>${l}</ul>
884
891
  </aside>
885
- </main>`, f = a ?? r;
892
+ </main>`, p = a ?? r;
886
893
  return Y(e, {
887
- title: l,
888
- description: u,
894
+ title: u,
895
+ description: d,
889
896
  routePath: r,
890
- canonicalRoutePath: f,
897
+ canonicalRoutePath: p,
891
898
  ogType: "website",
892
899
  ogImage: n.leadArticle?.heroImage ? `${t.config.id}/${n.leadArticle.heroImage}` : void 0,
893
- jsonLd: [X(e, l, u, f)],
900
+ jsonLd: [X(e, u, d, p)],
894
901
  initialView: i ? {
895
902
  kind: "edition",
896
903
  publicationId: t.config.id
@@ -899,10 +906,10 @@ function q(e, t, n, r, i = !1, a) {
899
906
  publicationId: t.config.id,
900
907
  editionId: n.id
901
908
  },
902
- body: d
909
+ body: f
903
910
  });
904
911
  }
905
- function J(e, t, n) {
912
+ function q(e, t, n) {
906
913
  let r = Q(n), i = new Map(e.site.routes.filter((e) => e.publicationId === t.config.id).map((e) => [e.articleSlug, e])), a = new Map(t.editions.map((e) => [e.id, e])), o = t.allArticles.map((e) => {
907
914
  let n = i.get(e.slug), o = n ? a.get(n.editionId) : void 0, s = o?.label ?? "通常号";
908
915
  return `<li data-edition-kind="${$(o?.kind ?? "regular")}">
@@ -936,8 +943,8 @@ function J(e, t, n) {
936
943
  body: l
937
944
  });
938
945
  }
939
- function at(e, t, n, r, i) {
940
- let a = Q(i.canonicalPath), o = ft(r.bodyHtml ?? `<p>${$(r.body)}</p>`, `${a}${t.config.id}/`), s = r.heroImage ? `<figure class="baiten-figure baiten-figure--image"><img src="${a}${$(t.config.id)}/${$(r.heroImage)}" alt="${$(r.heroCaption ?? r.title)}" width="960" height="717">${r.heroCaption ? `<figcaption>${$(r.heroCaption)}</figcaption>` : ""}</figure>` : "", c = t.allArticles.filter((e) => e.slug !== r.slug).slice(0, 3).map((e) => `<li><a href="${a}${$(t.config.id)}/${$(e.slug)}/">${$(e.title)}</a> <time datetime="${$(e.publishedAt)}">${$(e.publishedAt)}</time></li>`).join("\n"), l = `${r.title} | ${t.config.title}`, u = r.summary || `${t.config.title}の記事`, d = `<main class="baiten-ssr-article" data-pub="${$(t.config.id)}" data-slug="${$(r.slug)}" data-theme="${$(t.config.theme)}" data-scene="${$(t.config.scene)}" dir="${t.readingDirection}">
946
+ function J(e, t, n, r, i) {
947
+ let a = Q(i.canonicalPath), o = pt(r.bodyHtml ?? `<p>${$(r.body)}</p>`, `${a}${t.config.id}/`), s = r.heroImage ? `<figure class="baiten-figure baiten-figure--image"><img src="${a}${$(t.config.id)}/${$(r.heroImage)}" alt="${$(r.heroCaption ?? r.title)}" width="960" height="717">${r.heroCaption ? `<figcaption>${$(r.heroCaption)}</figcaption>` : ""}</figure>` : "", c = t.allArticles.filter((e) => e.slug !== r.slug).slice(0, 3).map((e) => `<li><a href="${a}${$(t.config.id)}/${$(e.slug)}/">${$(e.title)}</a> <time datetime="${$(e.publishedAt)}">${$(e.publishedAt)}</time></li>`).join("\n"), l = `${r.title} | ${t.config.title}`, u = r.summary || `${t.config.title}の記事`, d = `<main class="baiten-ssr-article" data-pub="${$(t.config.id)}" data-slug="${$(r.slug)}" data-theme="${$(t.config.theme)}" data-scene="${$(t.config.scene)}" dir="${t.readingDirection}">
941
948
  <nav aria-label="パンくずリスト">
942
949
  <ol>
943
950
  <li><a href="${a}">売店</a></li>
@@ -961,7 +968,7 @@ function at(e, t, n, r, i) {
961
968
  <div class="baiten-ssr-body">${o}</div>
962
969
  </article>
963
970
  ${c ? `<aside aria-label="あわせて読む"><h2>あわせて読む</h2><ul>${c}</ul></aside>` : ""}
964
- </main>`, f = [ot(e, t, r, i), st(e, t, r, i)];
971
+ </main>`, f = [st(e, t, r, i), ct(e, t, r, i)];
965
972
  return Y(e, {
966
973
  title: l,
967
974
  description: u,
@@ -1023,7 +1030,7 @@ function Y(e, t) {
1023
1030
  </html>
1024
1031
  `;
1025
1032
  }
1026
- function ot(e, t, n, r) {
1033
+ function st(e, t, n, r) {
1027
1034
  let i = e.siteUrl ? new URL(r.canonicalPath.replace(/^\//, ""), e.siteUrl).href : r.canonicalPath, a = n.heroImage && e.siteUrl ? new URL(`${t.config.id}/${n.heroImage}`, e.siteUrl).href : void 0;
1028
1035
  return {
1029
1036
  "@context": "https://schema.org",
@@ -1049,7 +1056,7 @@ function ot(e, t, n, r) {
1049
1056
  }
1050
1057
  };
1051
1058
  }
1052
- function st(e, t, n, r) {
1059
+ function ct(e, t, n, r) {
1053
1060
  let i = (t) => e.siteUrl ? new URL(t.replace(/^\//, ""), e.siteUrl).href : t;
1054
1061
  return {
1055
1062
  "@context": "https://schema.org",
@@ -1076,7 +1083,7 @@ function st(e, t, n, r) {
1076
1083
  ]
1077
1084
  };
1078
1085
  }
1079
- function ct(e) {
1086
+ function lt(e) {
1080
1087
  return {
1081
1088
  "@context": "https://schema.org",
1082
1089
  "@type": "WebSite",
@@ -1096,7 +1103,7 @@ function X(e, t, n, r) {
1096
1103
  inLanguage: "ja"
1097
1104
  };
1098
1105
  }
1099
- function lt(e) {
1106
+ function ut(e) {
1100
1107
  let t = [], n = new Map(e.publications.map((e) => [e.config.id, e]));
1101
1108
  for (let r of e.routes) {
1102
1109
  let e = n.get(r.publicationId);
@@ -1122,14 +1129,14 @@ function lt(e) {
1122
1129
  }
1123
1130
  return t;
1124
1131
  }
1125
- function ut(e, t) {
1132
+ function dt(e, t) {
1126
1133
  return `<?xml version="1.0" encoding="UTF-8"?>
1127
1134
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
1128
1135
  ${Array.from(new Set(t)).sort((e, t) => e.localeCompare(t)).map((t) => ` <url><loc>${$(new URL(t.replace(/^\//, ""), e).href)}</loc></url>`).join("\n")}
1129
1136
  </urlset>
1130
1137
  `;
1131
1138
  }
1132
- async function dt(t, r) {
1139
+ async function ft(t, r) {
1133
1140
  if (!t) return {
1134
1141
  scripts: [],
1135
1142
  styles: []
@@ -1167,10 +1174,10 @@ function Q(e) {
1167
1174
  let t = e.replace(/^\/|\/$/g, "").split("/").filter(Boolean).length;
1168
1175
  return t === 0 ? "./" : "../".repeat(t);
1169
1176
  }
1170
- function ft(e, t) {
1177
+ function pt(e, t) {
1171
1178
  return e.replace(/(<img\s+[^>]*src=")(?!https?:\/\/|data:|\/)([^"]+)(")/gi, (e, n, r, i) => `${n}${t}${r.replace(/^\.\//, "")}${i}`);
1172
1179
  }
1173
- function pt(e) {
1180
+ function mt(e) {
1174
1181
  if (!e?.trim()) return;
1175
1182
  let t = e.trim();
1176
1183
  return t.endsWith("/") ? t : `${t}/`;
@@ -1185,9 +1192,9 @@ function $(e) {
1185
1192
  })[e] ?? e);
1186
1193
  }
1187
1194
  // src/adapters/static/serveStaticSite.ts
1188
- async function mt(e) {
1189
- let t = g(e.projectDir), n = await L(t), r = g(t, e.articlesDir ?? n.articlesDir ?? "articles"), a = e.outDir ?? await i(m(le(), "baiten3d-preview-")), o = !e.outDir;
1190
- await G({
1195
+ async function ht(e) {
1196
+ let t = g(e.projectDir), n = await L(t), r = g(t, e.articlesDir ?? n.articlesDir ?? "articles"), a = e.outDir ?? await i(m(ce(), "baiten3d-preview-")), o = !e.outDir;
1197
+ await W({
1191
1198
  ...e,
1192
1199
  projectDir: t,
1193
1200
  articlesDir: r,
@@ -1195,10 +1202,10 @@ async function mt(e) {
1195
1202
  skipHeadFile: !0,
1196
1203
  liveReload: e.watchFiles !== !1
1197
1204
  });
1198
- let s = /* @__PURE__ */ new Set(), l = null, u = e.watchFiles === !1 ? null : se(r, { recursive: !0 }, () => {
1205
+ let s = /* @__PURE__ */ new Set(), l = null, u = e.watchFiles === !1 ? null : oe(r, { recursive: !0 }, () => {
1199
1206
  l && clearTimeout(l), l = setTimeout(async () => {
1200
1207
  try {
1201
- await G({
1208
+ await W({
1202
1209
  ...e,
1203
1210
  projectDir: t,
1204
1211
  articlesDir: r,
@@ -1211,8 +1218,8 @@ async function mt(e) {
1211
1218
  console.error("[baiten3d] 再ビルドエラー:", e);
1212
1219
  }
1213
1220
  }, 150);
1214
- }), d = ce((e, t) => {
1215
- ht(e, t, a, s);
1221
+ }), d = se((e, t) => {
1222
+ gt(e, t, a, s);
1216
1223
  }), f = e.host ?? "127.0.0.1", p = e.port ?? 4173;
1217
1224
  await new Promise((e, t) => {
1218
1225
  d.once("error", t), d.listen(p, f, () => e());
@@ -1231,7 +1238,7 @@ async function mt(e) {
1231
1238
  }
1232
1239
  };
1233
1240
  }
1234
- async function ht(e, t, n, r) {
1241
+ async function gt(e, t, n, r) {
1235
1242
  let i = (e.url ?? "/").split("?")[0] ?? "/";
1236
1243
  if (i === "/__baiten_reload") {
1237
1244
  t.writeHead(200, {
@@ -1246,14 +1253,14 @@ async function ht(e, t, n, r) {
1246
1253
  t.writeHead(403), t.end("Forbidden");
1247
1254
  return;
1248
1255
  }
1249
- let c = await gt(s);
1256
+ let c = await _t(s);
1250
1257
  if (!c) {
1251
1258
  t.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" }), t.end("Not Found");
1252
1259
  return;
1253
1260
  }
1254
- let l = await a(c), u = de.contentType(d(c)) || "application/octet-stream", f = /\bgzip\b/.test(e.headers["accept-encoding"] ?? ""), p = /^(text\/|application\/(javascript|json|xml)|image\/svg\+xml)/.test(u);
1261
+ let l = await a(c), u = ue.contentType(d(c)) || "application/octet-stream", f = /\bgzip\b/.test(e.headers["accept-encoding"] ?? ""), p = /^(text\/|application\/(javascript|json|xml)|image\/svg\+xml)/.test(u);
1255
1262
  if (f && p) {
1256
- let e = ue(l);
1263
+ let e = le(l);
1257
1264
  t.writeHead(200, {
1258
1265
  "Content-Type": u,
1259
1266
  "Content-Encoding": "gzip",
@@ -1264,7 +1271,7 @@ async function ht(e, t, n, r) {
1264
1271
  "Cache-Control": "no-cache"
1265
1272
  }), t.end(l);
1266
1273
  }
1267
- async function gt(e) {
1274
+ async function _t(e) {
1268
1275
  try {
1269
1276
  let t = await l(e);
1270
1277
  if (t.isFile()) return e;
@@ -1277,4 +1284,4 @@ async function gt(e) {
1277
1284
  }
1278
1285
  return null;
1279
1286
  }
1280
- export { G as buildStaticSite, mt as serveStaticSite };
1287
+ export { W as buildStaticSite, ht as serveStaticSite };