import type { PageData } from "@/pages/viewer/types"; export type PageBackgroundDefaults = { backgroundType?: "color" | "gradient" | "image" | "video"; backgroundColor?: string; backgroundGradient?: { from: string; to: string; angle: number }; backgroundImageUrl?: string; backgroundVideoUrl?: string; }; /** ترکیب پس‌زمینهٔ اختصاصی صفحه با مقادیر پیش‌فرض سند (همان قاعدهٔ استفاده‌شده در BookViewer) */ export function resolvePageBackground(page: PageData, defaults: PageBackgroundDefaults): Required { return { backgroundType: page.backgroundType ?? defaults.backgroundType ?? "color", backgroundColor: page.backgroundColor ?? defaults.backgroundColor ?? "#ffffff", backgroundGradient: page.backgroundGradient ?? defaults.backgroundGradient ?? { from: "#ffffff", to: "#ffffff", angle: 0 }, backgroundImageUrl: page.backgroundImageUrl ?? defaults.backgroundImageUrl ?? "", backgroundVideoUrl: page.backgroundVideoUrl ?? defaults.backgroundVideoUrl ?? "", }; }