import { g as ScenePage, B as Bounds } from './model-BBwyOuWG.js';

/**
 * Page size presets, channel-size output presets, and export math for the
 * design canvas.
 *
 * Size presets (SizePreset / SIZE_PRESETS) describe page dimensions for the
 * new-page dialog. Export presets (ExportPreset / EXPORT_PRESETS) pin pixel
 * ratio, output dimensions, bleed, and format for the export dialog and the
 * MCP export tool. Channel presets (ChannelPreset / CHANNEL_PRESETS) are the
 * fixed output resolutions the export UI offers; `scaleForPreset` + the
 * letterbox helper derive Konva stage parameters from them.
 *
 * All dimensions are CSS pixels at 96 DPI unless noted otherwise.
 */

interface SizePreset {
    id: string;
    label: string;
    category: 'social' | 'print' | 'presentation' | 'custom';
    width: number;
    height: number;
}
declare const SIZE_PRESETS: readonly SizePreset[];
declare function findPreset(id: string): SizePreset | null;
/** Match a (width, height) pair against the preset table. Returns the first
 *  exact match or null — used to drive the dropdown selection indicator. */
declare function matchPreset(width: number, height: number): SizePreset | null;
type ExportFormat = 'png' | 'jpeg';
/**
 * Export quality preset — pins pixel density, optional output dimensions,
 * bleed inclusion, and raster format so callers pass a preset id rather than
 * a full parameter bag.
 *
 * `outputWidth` / `outputHeight`: when non-null, the pixel ratio is derived
 * from the crop rect width (see `scaleForPreset`) so the output is exactly
 * this many pixels wide. When null, `pixelRatio` applies directly.
 */
interface ExportPreset {
    name: string;
    /** Target pixels-per-document-px for stage.toDataURL. */
    pixelRatio: number;
    outputWidth: number | null;
    outputHeight: number | null;
    /** Whether bleed margins are included in the crop rect. */
    includeBleed: boolean;
    format: ExportFormat;
}
declare const EXPORT_PRESETS: Record<string, ExportPreset>;
interface ExportCropRect {
    /** Page-coordinate origin. Negative when bleed extends outside page bounds. */
    x: number;
    y: number;
    width: number;
    height: number;
}
/**
 * Crop rectangle in page coordinates for a given page, optionally expanded to
 * include bleed margins. Bleed extends OUTSIDE the page bounds, so the origin
 * goes negative when bleed is included.
 *
 * When `includeBleed` is true but `page.bleed` is null, the page rect is
 * returned unchanged — the caller must not assume symmetric expansion.
 */
declare function bleedAwareExportBounds(page: ScenePage, includeBleed: boolean): ExportCropRect;
/**
 * Pixel ratio for stage.toDataURL given a crop rect and an export preset.
 *
 * When the preset pins `outputWidth`, the ratio is derived from the crop rect
 * width so the final raster is exactly that many pixels wide. When there is no
 * output pin, the preset's declared `pixelRatio` is returned directly.
 *
 * The crop rect must already account for bleed inclusion before this call.
 */
declare function scaleForPreset(preset: ExportPreset, cropRect: ExportCropRect): number;
interface ChannelPreset {
    id: string;
    label: string;
    width: number;
    height: number;
}
/**
 * Fixed output resolution presets for the channel/platform export dialog.
 * Width × height are OUTPUT pixels (the raster the export produces), not page
 * CSS px — they describe the target delivery format, not the canvas layout.
 * The a4_print_2480x3508 preset corresponds to A4 at 300 dpi.
 */
declare const CHANNEL_PRESETS: readonly ChannelPreset[];
type ChannelPresetId = (typeof CHANNEL_PRESETS)[number]['id'];
/** Throws when the id is unknown — callers should only pass ids sourced from
 *  `CHANNEL_PRESETS`. */
declare function requireChannelPreset(id: string): ChannelPreset;
interface ChannelScaleResult {
    /**
     * Konva stage pixelRatio: the stage logical size stays at page dimensions;
     * the backing canvas renders at `pixelRatio × page` px. Setting Konva's
     * pixelRatio to this value yields an output canvas exactly
     * `channelPreset.width × channelPreset.height` pixels.
     */
    pixelRatio: number;
    /**
     * Horizontal letterbox offset in PAGE-coordinate px. Add to the stage x
     * translation so the page is centered horizontally in the output frame.
     * Zero when the page fills the full width after scaling.
     */
    offsetX: number;
    /**
     * Vertical letterbox offset in PAGE-coordinate px. Add to the stage y
     * translation. Zero when the page fills the full height.
     */
    offsetY: number;
    fit: 'contain';
}
/**
 * Computes the Konva stage parameters to render `page` centered inside
 * `channelPreset` without cropping (contain / letterbox).
 *
 * Exact-ratio fast path: when page and preset share the same aspect ratio
 * (within 1e-9 floating-point tolerance) both offsets are 0 and pixelRatio
 * is exact.
 *
 * Example — 1080×1080 page into 1920×1080 preset:
 *   scaleX = 1920/1080 ≈ 1.7778, scaleY = 1080/1080 = 1.0
 *   pixelRatio = 1.0, rendered page = 1080×1080 px
 *   offsetX = (1920 − 1080) / 2 / 1.0 = 420 page-px, offsetY = 0
 */
declare function scalePageForChannelPreset(page: Pick<ScenePage, 'width' | 'height'>, channelPreset: ChannelPreset): ChannelScaleResult;
/**
 * Export rectangle in page coordinates that includes bleed margins when
 * present. When `page.bleed` is null, returns the trim rectangle (origin 0,0;
 * size = page dimensions).
 *
 * The bleed rectangle extends OUTSIDE the page: x and y are negative (bleed
 * bleeds off the left/top edge), width and height exceed the page by the
 * combined bleed on each axis. Pass into Konva's clip/export bounds to
 * include the bleed zone in the render.
 *
 * Named `bleedAwareExportRect` to avoid collision with the two-arg
 * `bleedAwareExportBounds(page, includeBleed)` above.
 */
declare function bleedAwareExportRect(page: Pick<ScenePage, 'width' | 'height' | 'bleed'>): Bounds;

export { CHANNEL_PRESETS as C, EXPORT_PRESETS as E, SIZE_PRESETS as S, type ChannelPreset as a, type ChannelPresetId as b, type ChannelScaleResult as c, type ExportCropRect as d, type ExportFormat as e, type ExportPreset as f, type SizePreset as g, bleedAwareExportBounds as h, bleedAwareExportRect as i, findPreset as j, scalePageForChannelPreset as k, matchPreset as m, requireChannelPreset as r, scaleForPreset as s };
