/** * Preload Configuration * * Centralized configuration for asset preloading, priority weights, and queue settings. */ export const PRELOAD_CONFIG = { // Queue settings maxConcurrentDownloads: 3, maxRetries: 3, retryDelayMs: 1000, // Size thresholds largeFileThreshold: 5 * 1024 * 1024, // 5MB -> use IndexedDB videoChunkSize: 5 * 1024 * 1024, // 5MB chunks initialVideoBufferSeconds: 5, // Priority weights (higher = load first) priority: { currentPage: 1000, neighborBase: 500, assetType: { transition: 150, // Highest - needed immediately on navigation click image: 100, // Backgrounds load during transition playback audio: 50, video: 30, } as Record, variant: { thumbnail: 50, preview: 40, webp: 35, mp4_low: 20, mp4_high: 10, original: 5, } as Record, linkCountMultiplier: 10, maxLinkBonus: 50, }, // Storage storage: { warningPercent: 80, criticalPercent: 95, minFreeBuffer: 50 * 1024 * 1024, // 50MB }, // Auto-cleanup timeouts (from hoboken pattern) autoRemove: { completedMs: 3000, errorMs: 10000, }, // Neighbor graph traversal neighborGraph: { maxDepth: 1, // Only preload immediate neighbors (depth 2 was causing too many requests) constructorMaxDepth: 1, // Same as maxDepth for constructor preview }, // Reverse playback settings reversePlayback: { defaultFps: 25, // FPS for non-preloaded videos preloadedFps: 45, // FPS for preloaded videos (blob URLs) minFps: 15, // Minimum adaptive FPS maxConsecutiveSlowFrames: 3, // Frames before reducing FPS slowFrameThreshold: 1.3, // Multiplier of target frame time }, // Asset URL field names in element content_json (camelCase) assetFields: { // All asset URL fields for preloading extraction all: [ 'iconUrl', 'imageUrl', 'mediaUrl', 'videoUrl', 'audioUrl', 'transitionVideoUrl', 'backgroundImageUrl', 'reverseVideoUrl', 'carouselPrevIconUrl', 'carouselNextIconUrl', 'galleryHeaderImageUrl', 'galleryCarouselPrevIconUrl', 'galleryCarouselNextIconUrl', 'galleryCarouselBackIconUrl', 'src', 'url', 'poster', 'thumbnail', ] as const, // Image-only fields for decode before page switch images: [ 'iconUrl', 'imageUrl', 'backgroundImageUrl', 'carouselPrevIconUrl', 'carouselNextIconUrl', 'galleryHeaderImageUrl', 'galleryCarouselPrevIconUrl', 'galleryCarouselNextIconUrl', 'galleryCarouselBackIconUrl', 'src', ] as const, // Nested array fields containing assets nested: ['galleryCards', 'carouselSlides', 'galleryInfoSpans'] as const, // Fields within nested items that contain URLs nestedUrlFields: ['imageUrl', 'videoUrl', 'iconUrl'] as const, }, } as const; export type PreloadConfig = typeof PRELOAD_CONFIG;