draftboard 0.0.1__py3-none-any.whl
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.
- draftboard/__init__.py +41 -0
- draftboard/__main__.py +225 -0
- draftboard/agent.py +104 -0
- draftboard/api.py +901 -0
- draftboard/measure.py +225 -0
- draftboard/models.py +407 -0
- draftboard/pptx_export.py +479 -0
- draftboard/render.py +80 -0
- draftboard/static/404.html +1 -0
- draftboard/static/__next.__PAGE__.txt +27 -0
- draftboard/static/__next._full.txt +22 -0
- draftboard/static/__next._tree.txt +3 -0
- draftboard/static/_next/static/0t_Cdsf-nvbYcwqDy78ch/_buildManifest.js +11 -0
- draftboard/static/_next/static/0t_Cdsf-nvbYcwqDy78ch/_clientMiddlewareManifest.js +1 -0
- draftboard/static/_next/static/0t_Cdsf-nvbYcwqDy78ch/_ssgManifest.js +1 -0
- draftboard/static/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- draftboard/static/_next/static/chunks/0oheds1fsp9jx.js +1 -0
- draftboard/static/_next/static/chunks/1vsonpqt4u2rw.js +1 -0
- draftboard/static/_next/static/chunks/24xul4hawiu8l.js +1 -0
- draftboard/static/_next/static/chunks/2r7iycbt4s29o.js +22 -0
- draftboard/static/_next/static/chunks/2utugak-w5oge.css +1 -0
- draftboard/static/_next/static/chunks/39_j1bdzreq0m.js +1 -0
- draftboard/static/_next/static/chunks/3qfy96eoyh-ek.js +1 -0
- draftboard/static/_next/static/chunks/3u8gxd9uztfzl.js +4 -0
- draftboard/static/_next/static/chunks/3v_59l1qr_8dp.js +31 -0
- draftboard/static/_next/static/chunks/turbopack-2u1d16houkiyo.js +1 -0
- draftboard/static/_not-found/__next._full.txt +20 -0
- draftboard/static/_not-found/__next._not-found/__PAGE__.txt +26 -0
- draftboard/static/_not-found/__next._tree.txt +4 -0
- draftboard/static/_not-found.html +1 -0
- draftboard/static/_not-found.txt +20 -0
- draftboard/static/index.html +1 -0
- draftboard/static/index.txt +22 -0
- draftboard/static/p/__placeholder__/__next._full.txt +27 -0
- draftboard/static/p/__placeholder__/__next._tree.txt +5 -0
- draftboard/static/p/__placeholder__/__next.p/$d$id/__PAGE__.txt +34 -0
- draftboard/static/p/__placeholder__/preview/__next._full.txt +27 -0
- draftboard/static/p/__placeholder__/preview/__next._tree.txt +6 -0
- draftboard/static/p/__placeholder__/preview/__next.p/$d$id/preview/__PAGE__.txt +35 -0
- draftboard/static/p/__placeholder__/preview.html +1 -0
- draftboard/static/p/__placeholder__/preview.txt +27 -0
- draftboard/static/p/__placeholder__.html +1 -0
- draftboard/static/p/__placeholder__.txt +27 -0
- draftboard/storage.py +183 -0
- draftboard/tasks.py +464 -0
- draftboard/themes.py +213 -0
- draftboard/tools.py +723 -0
- draftboard-0.0.1.dist-info/METADATA +16 -0
- draftboard-0.0.1.dist-info/RECORD +51 -0
- draftboard-0.0.1.dist-info/WHEEL +4 -0
- draftboard-0.0.1.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Deterministic PPTX exporter (Step 2: Themes, Images, Speaker Notes & Auto-Fit).
|
|
3
|
+
|
|
4
|
+
All geometry is computed in points and converted to EMU only when writing.
|
|
5
|
+
Before writing, every text box is measured with the real font files
|
|
6
|
+
(draftboard.measure); any unrecoverable overflow, unbreakable word, missing
|
|
7
|
+
glyph, or missing image blocks the export with slide/element IDs.
|
|
8
|
+
Every text block is written as real, editable text (never a rendered image),
|
|
9
|
+
and uploaded image assets are embedded natively with aspect-ratio preservation.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import pathlib
|
|
13
|
+
import re
|
|
14
|
+
|
|
15
|
+
from PIL import Image
|
|
16
|
+
from pptx import Presentation
|
|
17
|
+
from pptx.dml.color import RGBColor
|
|
18
|
+
from pptx.enum.shapes import MSO_CONNECTOR
|
|
19
|
+
from pptx.enum.text import MSO_ANCHOR, MSO_AUTO_SIZE, PP_ALIGN
|
|
20
|
+
from pptx.oxml.ns import qn
|
|
21
|
+
from pptx.util import Pt
|
|
22
|
+
|
|
23
|
+
from draftboard.measure import FontPair, load_fonts, measure_box
|
|
24
|
+
from draftboard.models import Artifact, SlideLayout, validate_ir
|
|
25
|
+
from draftboard.themes import ThemeSpec, get_theme
|
|
26
|
+
|
|
27
|
+
CANVAS_W_PT = 960
|
|
28
|
+
CANVAS_H_PT = 540
|
|
29
|
+
|
|
30
|
+
FONT_LATIN = "Calibri"
|
|
31
|
+
FONT_EA = "Microsoft YaHei"
|
|
32
|
+
TEXT_COLOR = RGBColor(0x26, 0x26, 0x26)
|
|
33
|
+
|
|
34
|
+
# (x, y, w, h) in pt
|
|
35
|
+
BOX_TITLE = (48, 30, 864, 72)
|
|
36
|
+
BOX_BODY = (48, 120, 864, 360)
|
|
37
|
+
BOX_COLUMN_LEFT = (48, 120, 420, 360)
|
|
38
|
+
BOX_COLUMN_RIGHT = (492, 120, 420, 360)
|
|
39
|
+
BOX_TEXT_IMAGE_LEFT = (48, 120, 440, 360)
|
|
40
|
+
BOX_TEXT_IMAGE_RIGHT = (512, 120, 400, 360)
|
|
41
|
+
BOX_COVER_TITLE = (48, 190, 864, 92)
|
|
42
|
+
BOX_COVER_SUBTITLE = (48, 300, 864, 72)
|
|
43
|
+
BOX_CONCLUSION = (48, 180, 864, 180)
|
|
44
|
+
BOX_PAGE_NUMBER = (840, 504, 72, 22)
|
|
45
|
+
|
|
46
|
+
# role -> (font_size_pt, line_spacing_pt, space_after_pt)
|
|
47
|
+
STYLE_TITLE = (24, 29, 0)
|
|
48
|
+
STYLE_COVER_TITLE = (40, 46, 0)
|
|
49
|
+
STYLE_BODY = (18, 22, 8)
|
|
50
|
+
STYLE_BULLET = (18, 22, 6)
|
|
51
|
+
|
|
52
|
+
# Controlled auto-fit step-down ladders (PRD 8.4: body >= 14pt, title >= 24pt)
|
|
53
|
+
AUTO_FIT_COVER_TITLE = [(40, 46, 0), (34, 40, 0), (28, 34, 0)]
|
|
54
|
+
AUTO_FIT_TITLE = [(24, 29, 0)]
|
|
55
|
+
AUTO_FIT_BODY = [(18, 22, 8), (16, 20, 6), (14, 18, 5)]
|
|
56
|
+
AUTO_FIT_BULLET = [(18, 22, 6), (16, 20, 5), (14, 18, 4)]
|
|
57
|
+
|
|
58
|
+
PAD_X_PT = 8
|
|
59
|
+
PAD_Y_PT = 4
|
|
60
|
+
BULLET_INDENT_PT = 14
|
|
61
|
+
|
|
62
|
+
_IMAGE_STUB_RE = re.compile(r"^\[image:\s*(.+?)\s*\]$", re.IGNORECASE)
|
|
63
|
+
_IMAGE_EXTS = (".png", ".jpg", ".jpeg")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _box_for(layout: SlideLayout, role: str) -> tuple[int, int, int, int]:
|
|
67
|
+
if role == "title":
|
|
68
|
+
return BOX_COVER_TITLE if layout == SlideLayout.COVER else BOX_TITLE
|
|
69
|
+
if role == "subtitle":
|
|
70
|
+
return BOX_COVER_SUBTITLE
|
|
71
|
+
if role == "conclusion":
|
|
72
|
+
return BOX_CONCLUSION
|
|
73
|
+
if role == "column_left":
|
|
74
|
+
return BOX_COLUMN_LEFT
|
|
75
|
+
if role == "column_right":
|
|
76
|
+
return BOX_COLUMN_RIGHT
|
|
77
|
+
if layout == SlideLayout.TEXT_IMAGE:
|
|
78
|
+
if role == "image":
|
|
79
|
+
return BOX_TEXT_IMAGE_RIGHT
|
|
80
|
+
return BOX_TEXT_IMAGE_LEFT
|
|
81
|
+
return BOX_BODY
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _style_for(layout: SlideLayout, role: str) -> tuple[int, int, int]:
|
|
85
|
+
if role == "title":
|
|
86
|
+
return STYLE_COVER_TITLE if layout == SlideLayout.COVER else STYLE_TITLE
|
|
87
|
+
if role == "bullet":
|
|
88
|
+
return STYLE_BULLET
|
|
89
|
+
return STYLE_BODY
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _style_candidates(
|
|
93
|
+
layout: SlideLayout, role: str, auto_fit: bool
|
|
94
|
+
) -> list[tuple[int, int, int]]:
|
|
95
|
+
if not auto_fit:
|
|
96
|
+
return [_style_for(layout, role)]
|
|
97
|
+
if role == "title":
|
|
98
|
+
return AUTO_FIT_COVER_TITLE if layout == SlideLayout.COVER else AUTO_FIT_TITLE
|
|
99
|
+
if role == "bullet":
|
|
100
|
+
return AUTO_FIT_BULLET
|
|
101
|
+
return AUTO_FIT_BODY
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _resolve_image_path(
|
|
105
|
+
ref: str, assets_dir: pathlib.Path | None
|
|
106
|
+
) -> pathlib.Path | None:
|
|
107
|
+
"""Resolve an image reference (filename, asset stem, or [image: name] stub)."""
|
|
108
|
+
cleaned = ref.strip()
|
|
109
|
+
m = _IMAGE_STUB_RE.match(cleaned)
|
|
110
|
+
if m:
|
|
111
|
+
cleaned = m.group(1).strip()
|
|
112
|
+
if not cleaned:
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
direct = pathlib.Path(cleaned)
|
|
116
|
+
if direct.is_absolute() and direct.is_file():
|
|
117
|
+
return direct
|
|
118
|
+
|
|
119
|
+
if assets_dir is None or not assets_dir.is_dir():
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
# Prevent path traversal; only match direct filenames/stems inside assets_dir.
|
|
123
|
+
safe_name = pathlib.Path(cleaned).name
|
|
124
|
+
if not safe_name or safe_name != cleaned:
|
|
125
|
+
return None
|
|
126
|
+
|
|
127
|
+
exact = assets_dir / safe_name
|
|
128
|
+
if exact.is_file() and exact.suffix.lower() in _IMAGE_EXTS:
|
|
129
|
+
return exact
|
|
130
|
+
|
|
131
|
+
for ext in _IMAGE_EXTS:
|
|
132
|
+
candidate = assets_dir / f"{safe_name}{ext}"
|
|
133
|
+
if candidate.is_file():
|
|
134
|
+
return candidate
|
|
135
|
+
return None
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _set_ea_font(run) -> None:
|
|
139
|
+
rPr = run._r.get_or_add_rPr()
|
|
140
|
+
ea = rPr.find(qn("a:ea"))
|
|
141
|
+
if ea is None:
|
|
142
|
+
ea = rPr.makeelement(qn("a:ea"), {})
|
|
143
|
+
rPr.append(ea)
|
|
144
|
+
ea.set("typeface", FONT_EA)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _fill_paragraph(
|
|
148
|
+
paragraph,
|
|
149
|
+
text: str,
|
|
150
|
+
size_pt: int,
|
|
151
|
+
line_pt: int,
|
|
152
|
+
color_rgb: RGBColor,
|
|
153
|
+
bold: bool = False,
|
|
154
|
+
) -> None:
|
|
155
|
+
paragraph.line_spacing = Pt(line_pt)
|
|
156
|
+
lines = text.split("\n")
|
|
157
|
+
for i, line in enumerate(lines):
|
|
158
|
+
if i > 0:
|
|
159
|
+
paragraph.add_line_break()
|
|
160
|
+
run = paragraph.add_run()
|
|
161
|
+
run.text = line
|
|
162
|
+
run.font.size = Pt(size_pt)
|
|
163
|
+
run.font.name = FONT_LATIN
|
|
164
|
+
run.font.color.rgb = color_rgb
|
|
165
|
+
if bold:
|
|
166
|
+
run.font.bold = True
|
|
167
|
+
_set_ea_font(run)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _add_bullet_char(paragraph, accent_hex: str | None = None) -> None:
|
|
171
|
+
pPr = paragraph._p.get_or_add_pPr()
|
|
172
|
+
pPr.set("marL", str(int(Pt(BULLET_INDENT_PT))))
|
|
173
|
+
pPr.set("indent", str(-int(Pt(BULLET_INDENT_PT))))
|
|
174
|
+
if accent_hex:
|
|
175
|
+
bu_clr = pPr.makeelement(qn("a:buClr"), {})
|
|
176
|
+
srgb = pPr.makeelement(qn("a:srgbClr"), {"val": accent_hex.lstrip("#").upper()})
|
|
177
|
+
bu_clr.append(srgb)
|
|
178
|
+
pPr.append(bu_clr)
|
|
179
|
+
bu_char = pPr.makeelement(qn("a:buChar"), {"char": "•"})
|
|
180
|
+
pPr.append(bu_char)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _add_line(
|
|
184
|
+
pptx_slide,
|
|
185
|
+
x1_pt: float,
|
|
186
|
+
y1_pt: float,
|
|
187
|
+
x2_pt: float,
|
|
188
|
+
y2_pt: float,
|
|
189
|
+
color_rgb: RGBColor,
|
|
190
|
+
width_pt: float = 1.5,
|
|
191
|
+
) -> None:
|
|
192
|
+
"""Add a crisp, shadow-free connector line (has_text_frame is False)."""
|
|
193
|
+
line = pptx_slide.shapes.add_connector(
|
|
194
|
+
MSO_CONNECTOR.STRAIGHT, Pt(x1_pt), Pt(y1_pt), Pt(x2_pt), Pt(y2_pt)
|
|
195
|
+
)
|
|
196
|
+
line.line.color.rgb = color_rgb
|
|
197
|
+
line.line.width = Pt(width_pt)
|
|
198
|
+
line.shadow.inherit = False
|
|
199
|
+
# Strip default theme effectRef shadow on connector style if present
|
|
200
|
+
style_el = line._element.find(qn("p:style"))
|
|
201
|
+
if style_el is not None:
|
|
202
|
+
effect_ref = style_el.find(qn("a:effectRef"))
|
|
203
|
+
if effect_ref is not None:
|
|
204
|
+
effect_ref.set("idx", "0")
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _apply_theme_chrome(
|
|
208
|
+
pptx_slide,
|
|
209
|
+
layout: SlideLayout,
|
|
210
|
+
theme: ThemeSpec,
|
|
211
|
+
slide_index: int,
|
|
212
|
+
total_slides: int,
|
|
213
|
+
) -> None:
|
|
214
|
+
"""Apply restrained Apple Keynote / editorial background, hairlines, and page numbers."""
|
|
215
|
+
is_hero = layout in (SlideLayout.COVER, SlideLayout.CLOSING)
|
|
216
|
+
|
|
217
|
+
if theme.id != "default":
|
|
218
|
+
bg_fill = pptx_slide.background.fill
|
|
219
|
+
bg_fill.solid()
|
|
220
|
+
bg_fill.fore_color.rgb = theme.cover_bg_rgb if is_hero else theme.bg_rgb
|
|
221
|
+
|
|
222
|
+
if theme.decorative:
|
|
223
|
+
if layout == SlideLayout.COVER:
|
|
224
|
+
# Subtle short accent mark anchored cleanly at bottom-left
|
|
225
|
+
_add_line(pptx_slide, 48, 464, 96, 464, theme.accent_rgb, width_pt=3.0)
|
|
226
|
+
elif layout == SlideLayout.CLOSING:
|
|
227
|
+
# Centered minimal accent rule below closing title
|
|
228
|
+
_add_line(pptx_slide, 456, 108, 504, 108, theme.accent_rgb, width_pt=2.5)
|
|
229
|
+
else:
|
|
230
|
+
# Whisper-thin full-width hairline below content title
|
|
231
|
+
_add_line(pptx_slide, 48, 106, 912, 106, theme.divider_rgb, width_pt=1.0)
|
|
232
|
+
if layout == SlideLayout.TWO_COLUMN:
|
|
233
|
+
_add_line(pptx_slide, 480, 128, 480, 472, theme.divider_rgb, width_pt=1.0)
|
|
234
|
+
|
|
235
|
+
if theme.show_page_number and layout != SlideLayout.COVER:
|
|
236
|
+
x, y, w, h = BOX_PAGE_NUMBER
|
|
237
|
+
box = pptx_slide.shapes.add_textbox(Pt(x), Pt(y), Pt(w), Pt(h))
|
|
238
|
+
tf = box.text_frame
|
|
239
|
+
tf.word_wrap = False
|
|
240
|
+
tf.auto_size = MSO_AUTO_SIZE.NONE
|
|
241
|
+
tf.margin_left = Pt(0)
|
|
242
|
+
tf.margin_right = Pt(0)
|
|
243
|
+
tf.margin_top = Pt(0)
|
|
244
|
+
tf.margin_bottom = Pt(0)
|
|
245
|
+
p = tf.paragraphs[0]
|
|
246
|
+
p.alignment = PP_ALIGN.RIGHT
|
|
247
|
+
run = p.add_run()
|
|
248
|
+
run.text = f"{slide_index + 1:02d} / {total_slides:02d}"
|
|
249
|
+
run.font.size = Pt(10)
|
|
250
|
+
run.font.name = FONT_LATIN
|
|
251
|
+
run.font.color.rgb = theme.muted_rgb
|
|
252
|
+
_set_ea_font(run)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def _text_color_for(layout: SlideLayout, role: str, theme: ThemeSpec) -> RGBColor:
|
|
256
|
+
is_hero = layout in (SlideLayout.COVER, SlideLayout.CLOSING)
|
|
257
|
+
if role == "title":
|
|
258
|
+
return theme.cover_title_rgb if is_hero else theme.title_rgb
|
|
259
|
+
return theme.cover_body_rgb if is_hero else theme.body_rgb
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def _add_textbox(
|
|
263
|
+
pptx_slide,
|
|
264
|
+
layout: SlideLayout,
|
|
265
|
+
role: str,
|
|
266
|
+
texts: list[str],
|
|
267
|
+
style: tuple[int, int, int],
|
|
268
|
+
theme: ThemeSpec,
|
|
269
|
+
) -> None:
|
|
270
|
+
x, y, w, h = _box_for(layout, role)
|
|
271
|
+
size_pt, line_pt, space_after_pt = style
|
|
272
|
+
if layout == SlideLayout.COVER:
|
|
273
|
+
centered = not theme.left_aligned_cover
|
|
274
|
+
else:
|
|
275
|
+
centered = layout == SlideLayout.CLOSING
|
|
276
|
+
color_rgb = _text_color_for(layout, role, theme)
|
|
277
|
+
is_bold = role == "title" and theme.bold_title
|
|
278
|
+
|
|
279
|
+
box = pptx_slide.shapes.add_textbox(Pt(x), Pt(y), Pt(w), Pt(h))
|
|
280
|
+
tf = box.text_frame
|
|
281
|
+
tf.word_wrap = True
|
|
282
|
+
tf.auto_size = MSO_AUTO_SIZE.NONE
|
|
283
|
+
tf.vertical_anchor = MSO_ANCHOR.TOP
|
|
284
|
+
tf.margin_left = Pt(PAD_X_PT)
|
|
285
|
+
tf.margin_right = Pt(PAD_X_PT)
|
|
286
|
+
tf.margin_top = Pt(PAD_Y_PT)
|
|
287
|
+
tf.margin_bottom = Pt(PAD_Y_PT)
|
|
288
|
+
|
|
289
|
+
for i, text in enumerate(texts):
|
|
290
|
+
paragraph = tf.paragraphs[0] if i == 0 else tf.add_paragraph()
|
|
291
|
+
paragraph.alignment = PP_ALIGN.CENTER if centered else PP_ALIGN.LEFT
|
|
292
|
+
paragraph.space_after = Pt(space_after_pt)
|
|
293
|
+
_fill_paragraph(paragraph, text, size_pt, line_pt, color_rgb, bold=is_bold)
|
|
294
|
+
if role == "bullet":
|
|
295
|
+
_add_bullet_char(
|
|
296
|
+
paragraph,
|
|
297
|
+
accent_hex=theme.accent_hex if theme.decorative else None,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def _add_picture_contain(
|
|
302
|
+
pptx_slide,
|
|
303
|
+
img_path: pathlib.Path,
|
|
304
|
+
box_pt: tuple[int, int, int, int],
|
|
305
|
+
) -> None:
|
|
306
|
+
"""Place an image inside box_pt preserving its aspect ratio (contain)."""
|
|
307
|
+
bx, by, bw, bh = box_pt
|
|
308
|
+
with Image.open(img_path) as im:
|
|
309
|
+
img_w, img_h = im.size
|
|
310
|
+
if img_w <= 0 or img_h <= 0:
|
|
311
|
+
raise ValueError(f"Image '{img_path.name}' has invalid dimensions.")
|
|
312
|
+
scale = min(bw / img_w, bh / img_h)
|
|
313
|
+
draw_w = img_w * scale
|
|
314
|
+
draw_h = img_h * scale
|
|
315
|
+
left = bx + (bw - draw_w) / 2.0
|
|
316
|
+
top = by + (bh - draw_h) / 2.0
|
|
317
|
+
pptx_slide.shapes.add_picture(
|
|
318
|
+
str(img_path), Pt(left), Pt(top), width=Pt(draw_w), height=Pt(draw_h)
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def _group_boxes(slide) -> list[tuple[str, list[tuple[str, str]]]]:
|
|
323
|
+
"""Return (role, [(element_id, content)]) per box, in IR order."""
|
|
324
|
+
groups: dict[str, list[tuple[str, str]]] = {}
|
|
325
|
+
for el in slide.elements:
|
|
326
|
+
groups.setdefault(el.type, []).append((el.element_id, el.content))
|
|
327
|
+
return list(groups.items())
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
def _measure_and_resolve(
|
|
331
|
+
artifact: Artifact,
|
|
332
|
+
fonts: FontPair,
|
|
333
|
+
auto_fit: bool,
|
|
334
|
+
) -> tuple[dict[tuple[str, str], tuple[int, int, int]], list[str]]:
|
|
335
|
+
resolved: dict[tuple[str, str], tuple[int, int, int]] = {}
|
|
336
|
+
errors: list[str] = []
|
|
337
|
+
|
|
338
|
+
for slide in artifact.slides:
|
|
339
|
+
for role, items in _group_boxes(slide):
|
|
340
|
+
if role == "image":
|
|
341
|
+
continue
|
|
342
|
+
x, y, w, h = _box_for(slide.layout, role)
|
|
343
|
+
candidates = _style_candidates(slide.layout, role, auto_fit)
|
|
344
|
+
chosen_style = None
|
|
345
|
+
last_measurement = None
|
|
346
|
+
|
|
347
|
+
for candidate in candidates:
|
|
348
|
+
size_pt, line_pt, space_after_pt = candidate
|
|
349
|
+
m = measure_box(
|
|
350
|
+
[content for _, content in items],
|
|
351
|
+
fonts=fonts,
|
|
352
|
+
width_pt=w,
|
|
353
|
+
height_pt=h,
|
|
354
|
+
size_pt=size_pt,
|
|
355
|
+
line_pt=line_pt,
|
|
356
|
+
space_after_pt=space_after_pt,
|
|
357
|
+
pad_x_pt=PAD_X_PT,
|
|
358
|
+
pad_y_pt=PAD_Y_PT,
|
|
359
|
+
indent_pt=BULLET_INDENT_PT if role == "bullet" else 0,
|
|
360
|
+
)
|
|
361
|
+
last_measurement = m
|
|
362
|
+
if m.fits and not m.issues:
|
|
363
|
+
chosen_style = candidate
|
|
364
|
+
break
|
|
365
|
+
|
|
366
|
+
if chosen_style is not None:
|
|
367
|
+
resolved[(slide.slide_id, role)] = chosen_style
|
|
368
|
+
continue
|
|
369
|
+
|
|
370
|
+
# Report failure on the final (smallest allowed) step
|
|
371
|
+
assert last_measurement is not None
|
|
372
|
+
min_size_pt = candidates[-1][0]
|
|
373
|
+
for (element_id, _), para in zip(items, last_measurement.paragraphs):
|
|
374
|
+
for issue in para.issues:
|
|
375
|
+
errors.append(
|
|
376
|
+
f"Slide '{slide.slide_id}', element '{element_id}': "
|
|
377
|
+
f"[{issue.code}] {issue.message}"
|
|
378
|
+
)
|
|
379
|
+
if not last_measurement.fits:
|
|
380
|
+
suffix = f" (even at min {min_size_pt}pt)" if auto_fit and len(candidates) > 1 else ""
|
|
381
|
+
errors.append(
|
|
382
|
+
f"Slide '{slide.slide_id}', role '{role}' "
|
|
383
|
+
f"(elements: {', '.join(eid for eid, _ in items)}): "
|
|
384
|
+
f"[OVERFLOW] needs {last_measurement.required_height_pt:.1f}pt "
|
|
385
|
+
f"(+8% margin) but box height is {h}pt{suffix}."
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
return resolved, errors
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
def export_pptx(
|
|
392
|
+
artifact: Artifact,
|
|
393
|
+
output_path: pathlib.Path,
|
|
394
|
+
fonts: FontPair | None = None,
|
|
395
|
+
assets_dir: pathlib.Path | None = None,
|
|
396
|
+
auto_fit: bool | None = None,
|
|
397
|
+
) -> None:
|
|
398
|
+
"""Validate the IR, measure every block, resolve images, and write PPTX.
|
|
399
|
+
|
|
400
|
+
Raises ValueError on invalid IR, unsupported element types (shape, or
|
|
401
|
+
unresolved image), or any measurement issue (overflow, overlong word,
|
|
402
|
+
missing glyph). Nothing is written on failure.
|
|
403
|
+
"""
|
|
404
|
+
errors = validate_ir(artifact)
|
|
405
|
+
if errors:
|
|
406
|
+
raise ValueError("Invalid IR:\n" + "\n".join(errors))
|
|
407
|
+
|
|
408
|
+
resolved_images: dict[tuple[str, str], pathlib.Path] = {}
|
|
409
|
+
for slide in artifact.slides:
|
|
410
|
+
for el in slide.elements:
|
|
411
|
+
if el.type == "shape":
|
|
412
|
+
raise ValueError(
|
|
413
|
+
f"Element type 'shape' is not supported by the "
|
|
414
|
+
f"exporter yet (element '{el.element_id}', "
|
|
415
|
+
f"slide '{slide.slide_id}')."
|
|
416
|
+
)
|
|
417
|
+
if el.type == "image":
|
|
418
|
+
img_path = _resolve_image_path(el.content, assets_dir)
|
|
419
|
+
if img_path is None:
|
|
420
|
+
if assets_dir is None:
|
|
421
|
+
raise ValueError(
|
|
422
|
+
f"Element type 'image' is not supported without "
|
|
423
|
+
f"assets_dir (element '{el.element_id}', "
|
|
424
|
+
f"slide '{slide.slide_id}')."
|
|
425
|
+
)
|
|
426
|
+
raise ValueError(
|
|
427
|
+
f"Slide '{slide.slide_id}', element '{el.element_id}': "
|
|
428
|
+
f"[MISSING_IMAGE] Image asset '{el.content}' not found."
|
|
429
|
+
)
|
|
430
|
+
resolved_images[(slide.slide_id, el.element_id)] = img_path
|
|
431
|
+
|
|
432
|
+
if fonts is None:
|
|
433
|
+
fonts = load_fonts()
|
|
434
|
+
|
|
435
|
+
effective_auto_fit = artifact.auto_fit if auto_fit is None else auto_fit
|
|
436
|
+
resolved_styles, measure_errors = _measure_and_resolve(
|
|
437
|
+
artifact, fonts, auto_fit=effective_auto_fit
|
|
438
|
+
)
|
|
439
|
+
if measure_errors:
|
|
440
|
+
raise ValueError("Layout check failed:\n" + "\n".join(measure_errors))
|
|
441
|
+
|
|
442
|
+
theme = get_theme(artifact.template_id)
|
|
443
|
+
|
|
444
|
+
prs = Presentation()
|
|
445
|
+
prs.slide_width = Pt(CANVAS_W_PT)
|
|
446
|
+
prs.slide_height = Pt(CANVAS_H_PT)
|
|
447
|
+
blank_layout = prs.slide_layouts[6]
|
|
448
|
+
total_slides = len(artifact.slides)
|
|
449
|
+
|
|
450
|
+
for idx, slide in enumerate(artifact.slides):
|
|
451
|
+
pptx_slide = prs.slides.add_slide(blank_layout)
|
|
452
|
+
_apply_theme_chrome(pptx_slide, slide.layout, theme, idx, total_slides)
|
|
453
|
+
|
|
454
|
+
for role, items in _group_boxes(slide):
|
|
455
|
+
if role == "image":
|
|
456
|
+
# Embed the first image element in this slide's image slot
|
|
457
|
+
el_id, _ = items[0]
|
|
458
|
+
img_path = resolved_images[(slide.slide_id, el_id)]
|
|
459
|
+
_add_picture_contain(
|
|
460
|
+
pptx_slide, img_path, _box_for(slide.layout, "image")
|
|
461
|
+
)
|
|
462
|
+
else:
|
|
463
|
+
style = resolved_styles[(slide.slide_id, role)]
|
|
464
|
+
_add_textbox(
|
|
465
|
+
pptx_slide,
|
|
466
|
+
slide.layout,
|
|
467
|
+
role,
|
|
468
|
+
[content for _, content in items],
|
|
469
|
+
style,
|
|
470
|
+
theme,
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
if slide.speaker_notes and slide.speaker_notes.strip():
|
|
474
|
+
notes_slide = pptx_slide.notes_slide
|
|
475
|
+
notes_slide.notes_text_frame.text = slide.speaker_notes.strip()
|
|
476
|
+
|
|
477
|
+
output_path = pathlib.Path(output_path)
|
|
478
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
479
|
+
prs.save(str(output_path))
|
draftboard/render.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Per-page preview rendering: PPTX -> PDF (LibreOffice) -> PNG (pypdfium2).
|
|
3
|
+
|
|
4
|
+
Preview images always come from the same artifact/revision as the download.
|
|
5
|
+
They represent the LibreOffice rendering only — PowerPoint remains the
|
|
6
|
+
acceptance target, and the UI must say so.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import pathlib
|
|
11
|
+
import shutil
|
|
12
|
+
import subprocess
|
|
13
|
+
import tempfile
|
|
14
|
+
|
|
15
|
+
import pypdfium2 as pdfium
|
|
16
|
+
|
|
17
|
+
_SOFFICE_WINDOWS = pathlib.Path(r"C:\Program Files\LibreOffice\program\soffice.com")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _soffice() -> pathlib.Path:
|
|
21
|
+
override = os.environ.get("DRAFTBOARD_SOFFICE")
|
|
22
|
+
if override:
|
|
23
|
+
return pathlib.Path(override)
|
|
24
|
+
if _SOFFICE_WINDOWS.exists():
|
|
25
|
+
return _SOFFICE_WINDOWS
|
|
26
|
+
found = shutil.which("soffice")
|
|
27
|
+
if found:
|
|
28
|
+
return pathlib.Path(found)
|
|
29
|
+
raise FileNotFoundError(
|
|
30
|
+
"未找到 LibreOffice,无法渲染预览。PPTX 文件本身不受影响;"
|
|
31
|
+
"安装 LibreOffice 或设置 DRAFTBOARD_SOFFICE 后可重试。"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def render_preview(pptx_path: pathlib.Path, out_dir: pathlib.Path) -> list[pathlib.Path]:
|
|
36
|
+
"""Render a PPTX into per-page PNGs under out_dir.
|
|
37
|
+
|
|
38
|
+
Returns the sorted list of page image paths. Raises on any rendering
|
|
39
|
+
failure; callers decide whether that is fatal (it never invalidates
|
|
40
|
+
the already-written PPTX).
|
|
41
|
+
"""
|
|
42
|
+
soffice = _soffice()
|
|
43
|
+
out_dir.mkdir(parents=True, exist_ok=True)
|
|
44
|
+
# soffice.com is the console wrapper; soffice.exe (GUI subsystem) can
|
|
45
|
+
# hang without writing output. LO's profile and save-pipeline temp
|
|
46
|
+
# files nest deeply, so keep them in a short scratch directory —
|
|
47
|
+
# long paths (e.g. under pytest tmp) crash LO on Windows. TMP/TEMP
|
|
48
|
+
# must also stay inside a writable area for the save pipeline.
|
|
49
|
+
scratch_root = os.environ.get("DRAFTBOARD_LO_SCRATCH") or None
|
|
50
|
+
with tempfile.TemporaryDirectory(prefix="lo-", dir=scratch_root) as scratch:
|
|
51
|
+
scratch_path = pathlib.Path(scratch)
|
|
52
|
+
lo_tmp = scratch_path / "tmp"
|
|
53
|
+
lo_tmp.mkdir()
|
|
54
|
+
profile = scratch_path / "profile"
|
|
55
|
+
env = dict(os.environ, TMP=str(lo_tmp), TEMP=str(lo_tmp))
|
|
56
|
+
subprocess.run(
|
|
57
|
+
[
|
|
58
|
+
str(soffice),
|
|
59
|
+
f"-env:UserInstallation={profile.as_uri()}",
|
|
60
|
+
"--headless",
|
|
61
|
+
"--norestore",
|
|
62
|
+
"--nofirststartwizard",
|
|
63
|
+
"--convert-to", "pdf",
|
|
64
|
+
"--outdir", str(scratch_path), str(pptx_path),
|
|
65
|
+
],
|
|
66
|
+
check=True, capture_output=True, timeout=180, env=env,
|
|
67
|
+
)
|
|
68
|
+
pdf_path = scratch_path / (pptx_path.stem + ".pdf")
|
|
69
|
+
if not pdf_path.exists():
|
|
70
|
+
raise RuntimeError(f"LibreOffice 没有生成 PDF:{pptx_path.name}")
|
|
71
|
+
shutil.copy2(pdf_path, out_dir / "deck.pdf")
|
|
72
|
+
|
|
73
|
+
pages: list[pathlib.Path] = []
|
|
74
|
+
with pdfium.PdfDocument(str(pdf_path)) as pdf:
|
|
75
|
+
for index in range(len(pdf)):
|
|
76
|
+
bitmap = pdf[index].render(scale=1.5)
|
|
77
|
+
page_path = out_dir / f"page-{index + 1:03d}.png"
|
|
78
|
+
bitmap.to_pil().save(page_path)
|
|
79
|
+
pages.append(page_path)
|
|
80
|
+
return pages
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="zh-CN"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/2utugak-w5oge.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/3v_59l1qr_8dp.js"/><script src="/_next/static/chunks/2r7iycbt4s29o.js" async=""></script><script src="/_next/static/chunks/39_j1bdzreq0m.js" async=""></script><script src="/_next/static/chunks/turbopack-2u1d16houkiyo.js" async=""></script><script src="/_next/static/chunks/3qfy96eoyh-ek.js" async=""></script><meta name="robots" content="noindex"/><title>Draftboard · AI 演示文稿工作台</title><meta name="description" content="以原始材料为唯一依据,基于确定性排版引擎的 AI 演示文稿工作台"/><title>404: This page could not be found.</title><script src="/_next/static/chunks/0cz1d0mv5g_q7.js" noModule=""></script></head><body class="min-h-screen bg-[#f5f5f7] text-[#1d1d1f]"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script id="_R_">(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push({"otherChunks":["static/chunks/3v_59l1qr_8dp.js","static/chunks/2r7iycbt4s29o.js","static/chunks/39_j1bdzreq0m.js"],"runtimeModuleIds":[94553]});</script><script src="/_next/static/chunks/3v_59l1qr_8dp.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:\"/_next/static/chunks/3qfy96eoyh-ek.js\"\n3:I[39756,[\"$2\"],\"default\"]\n4:I[37457,[\"$2\"],\"default\"]\n8:I[97367,[\"$2\"],\"OutletBoundary\"]\n9:\"$Sreact.suspense\"\nb:\"ViewportBoundary\"\nc:I[97367,[\"$2\"],\"$b\"]\ne:\"MetadataBoundary\"\nf:I[97367,[\"$2\"],\"$e\"]\n11:I[68027,[\"$2\"],\"default\",1]\n:HL[\"/_next/static/chunks/2utugak-w5oge.css\",\"style\"]\n6:X\n7:[[\"children\",{\"s\":\"__PAGE__\",\"h\":512,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:t:t:d:r:props:children:1:props:children:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:t:t:d:r:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:t:t:d:r:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:t:t:d:r:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L8\",null,{\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@a\"}]}]]}],\"p\":false,\"v\":null}}]]\n5:[[\"children\",{\"s\":\"/_not-found\",\"h\":512,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],\"p\":false,\"v\":\"$6\"},\"c\":\"$Q7\"}]]\n0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"t\":{\"t\":{\"s\":\"\",\"h\":528,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/2utugak-w5oge.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/3qfy96eoyh-ek.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"zh-CN\",\"children\":[\"$\",\"body\",null,{\"className\":\"min-h-screen bg-[#f5f5f7] text-[#1d1d1f]\",\"children\":[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]]}],\"p\":false,\"v\":null},\"c\":\"$Q5\"},\"h\":{\"r\":[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$Lc\",null,{\"children\":\"$Ld\"}],[\"$\",\"$Lf\",null,{\"children\":[[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$9\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L10\"}]}],null]}],null]}],\"p\":false,\"v\":null}},\"m\":\"$undefined\",\"G\":[\"$11\",[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/2utugak-w5oge.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]]],\"S\":true,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"0t_Cdsf-nvbYcwqDy78ch\"}\n6:C\nd:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\na:null\n10:[[\"$\",\"title\",\"0\",{\"children\":\"Draftboard · AI 演示文稿工作台\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"以原始材料为唯一依据,基于确定性排版引擎的 AI 演示文稿工作台\"}]]\n"])</script></body></html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
1:"$Sreact.fragment"
|
|
2
|
+
2:"/_next/static/chunks/3qfy96eoyh-ek.js"
|
|
3
|
+
3:I[39756,["$2"],"default"]
|
|
4
|
+
4:I[37457,["$2"],"default"]
|
|
5
|
+
8:I[47257,["$2"],"ClientPageRoot"]
|
|
6
|
+
9:"/_next/static/chunks/0oheds1fsp9jx.js"
|
|
7
|
+
a:I[31713,["$2","$9"],"default"]
|
|
8
|
+
d:I[97367,["$2"],"OutletBoundary"]
|
|
9
|
+
e:"$Sreact.suspense"
|
|
10
|
+
11:"ViewportBoundary"
|
|
11
|
+
12:I[97367,["$2"],"$11"]
|
|
12
|
+
13:"MetadataBoundary"
|
|
13
|
+
14:I[97367,["$2"],"$13"]
|
|
14
|
+
:HL["/_next/static/chunks/2utugak-w5oge.css","style"]
|
|
15
|
+
6:X
|
|
16
|
+
7:[["children",{"s":"__PAGE__","h":160,"d":{"r":["$","$1","c",{"children":[["$","$L8",null,{"Component":"$a","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@b","$@c"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/0oheds1fsp9jx.js","async":true}]],["$","$Ld",null,{"children":["$","$e",null,{"name":"Next.MetadataOutlet","children":"$@f"}]}]]}],"p":"$@10","v":null,"s":"$6"}}]]
|
|
17
|
+
0:{"t":{"t":{"s":"","h":80,"d":{"r":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/2utugak-w5oge.css","precedence":"next"}],["$","script","script-0",{"src":"/_next/static/chunks/3qfy96eoyh-ek.js","async":true}]],["$","html",null,{"lang":"zh-CN","children":["$","body",null,{"className":"min-h-screen bg-[#f5f5f7] text-[#1d1d1f]","children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]]}],"p":"$@5","v":null,"s":"$6"},"c":"$Q7"},"h":{"r":["$","$1","h",{"children":[null,["$","$L12",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","$L14",null,{"children":[["$","div",null,{"hidden":true,"children":["$","$e",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"Draftboard · AI 演示文稿工作台"}],["$","meta","1",{"name":"description","content":"以原始材料为唯一依据,基于确定性排版引擎的 AI 演示文稿工作台"}]]}]}],null]}],null]}],"p":"$@15","v":null,"s":"$6"}},"a":"$@16","u":"$@17","b":"0t_Cdsf-nvbYcwqDy78ch"}
|
|
18
|
+
b:{}
|
|
19
|
+
c:"$7:0:1:d:r:props:children:0:props:serverProvidedParams:params"
|
|
20
|
+
f:null
|
|
21
|
+
6:300
|
|
22
|
+
17:true
|
|
23
|
+
6:C
|
|
24
|
+
16:0
|
|
25
|
+
5:"$undefined"
|
|
26
|
+
15:"$undefined"
|
|
27
|
+
10:"$undefined"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
1:"$Sreact.fragment"
|
|
2
|
+
2:"/_next/static/chunks/3qfy96eoyh-ek.js"
|
|
3
|
+
3:I[39756,["$2"],"default"]
|
|
4
|
+
4:I[37457,["$2"],"default"]
|
|
5
|
+
6:I[47257,["$2"],"ClientPageRoot"]
|
|
6
|
+
7:"/_next/static/chunks/0oheds1fsp9jx.js"
|
|
7
|
+
8:I[31713,["$2","$7"],"default"]
|
|
8
|
+
b:I[97367,["$2"],"OutletBoundary"]
|
|
9
|
+
c:"$Sreact.suspense"
|
|
10
|
+
e:"ViewportBoundary"
|
|
11
|
+
f:I[97367,["$2"],"$e"]
|
|
12
|
+
11:"MetadataBoundary"
|
|
13
|
+
12:I[97367,["$2"],"$11"]
|
|
14
|
+
14:I[68027,["$2"],"default",1]
|
|
15
|
+
:HL["/_next/static/chunks/2utugak-w5oge.css","style"]
|
|
16
|
+
5:[["children",{"s":"__PAGE__","h":512,"d":{"r":["$","$1","c",{"children":[["$","$L6",null,{"Component":"$8","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@9","$@a"]}}],[["$","script","script-0",{"src":"/_next/static/chunks/0oheds1fsp9jx.js","async":true,"nonce":"$undefined"}]],["$","$Lb",null,{"children":["$","$c",null,{"name":"Next.MetadataOutlet","children":"$@d"}]}]]}],"p":false,"v":null}}]]
|
|
17
|
+
0:{"P":null,"c":["",""],"q":"","i":false,"t":{"t":{"s":"","h":528,"d":{"r":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/2utugak-w5oge.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/3qfy96eoyh-ek.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"zh-CN","children":["$","body",null,{"className":"min-h-screen bg-[#f5f5f7] text-[#1d1d1f]","children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}],"p":false,"v":null},"c":"$Q5"},"h":{"r":["$","$1","h",{"children":[null,["$","$Lf",null,{"children":"$L10"}],["$","$L12",null,{"children":[["$","div",null,{"hidden":true,"children":["$","$c",null,{"name":"Next.Metadata","children":"$L13"}]}],null]}],null]}],"p":false,"v":null}},"m":"$undefined","G":["$14",[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/2utugak-w5oge.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]]],"S":true,"r":"$undefined","s":"$undefined","a":"$undefined","l":"$undefined","p":"$undefined","d":"$undefined","b":"0t_Cdsf-nvbYcwqDy78ch"}
|
|
18
|
+
9:{}
|
|
19
|
+
a:"$5:0:1:d:r:props:children:0:props:serverProvidedParams:params"
|
|
20
|
+
10:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
|
|
21
|
+
d:null
|
|
22
|
+
13:[["$","title","0",{"children":"Draftboard · AI 演示文稿工作台"}],["$","meta","1",{"name":"description","content":"以原始材料为唯一依据,基于确定性排版引擎的 AI 演示文稿工作台"}]]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.__MIDDLEWARE_MATCHERS = [];self.__MIDDLEWARE_MATCHERS_CB && self.__MIDDLEWARE_MATCHERS_CB()
|