import Notice from "@/components/Notice";
import Card, { CardContent, CardHeader } from "@/components/Card";
import ExternalLink from "@/common/ExternalLink";
import ControlsGroup from "@/pages/settings/controls/ControlsGroup";
import PageContent from "@/layout/PageContent";
import { useSettingsStore } from "@/store/optionsStore";
import { __ } from "@wordpress/i18n";
import { InfoIcon } from "lucide-react";
import { ImageOptimization } from "./ImageOptimization";
const Media = () => {
const { i18n, isPro } = window.SPCDash;
const { pageCacheOn, isToggleOn, isValueSelected,updateSetting } = useSettingsStore();
const controls = [
{
id: 'cf_native_lazy_loading',
type: 'toggle',
label: __('Native Lazy Load', 'wp-cloudflare-page-cache'),
description: <>
{__('Uses the browser\'s built-in lazy loading attribute to defer offscreen images without any custom JavaScript.', 'wp-cloudflare-page-cache')}
{' '}
{__('This feature is only available in the Pro version.', 'wp-cloudflare-page-cache')}
)} > )} >, options: [ { label: __('Lazy load all images', 'wp-cloudflare-page-cache'), value: 'all' }, { label: __('Skip Lazy Loading for First Images', 'wp-cloudflare-page-cache'), value: 'fixed' }, { label: (!isPro ? '[PRO]' :'' ) + ' ' + __('Skip Lazy Loading for Initial Viewport', 'wp-cloudflare-page-cache') , value: 'viewport' }, ], hide: !isToggleOn('cf_lazy_loading') }, { id: 'cf_lazy_load_skip_images', type: 'number', label: __('Skip Lazy Loading for First Images', 'wp-cloudflare-page-cache'), min: 0, description: i18n.bypassLazyLoadDescription, hide: !isToggleOn('cf_lazy_loading') || !isValueSelected('cf_lazy_load_behaviour', 'fixed') }, { id: 'cf_lazy_load_video_iframe', type: 'toggle', label: __('Lazy load videos and iframes', 'wp-cloudflare-page-cache'), description: __('By default, lazy loading does not work for embedded videos and iframes. Enable this option to activate the lazy-load on these elements.', 'wp-cloudflare-page-cache'), hide: !isToggleOn('cf_lazy_loading') }, { id: 'cf_lazy_load_excluded', type: 'textarea', placeholder: 'logo.jpg\nexcluded-class', label: __('Media Lazy Load Exclusions', 'wp-cloudflare-page-cache'), description: __('Enter one keyword per line to exclude items from lazy loading by checking if URLs, class names, or data attributes contain these keywords.', 'wp-cloudflare-page-cache'), hide: !isToggleOn('cf_lazy_loading') }, { id: 'cf_lazy_load_bg', type: 'toggle', label: __('Background images lazy load', 'wp-cloudflare-page-cache'), hide: !isToggleOn('cf_lazy_loading') }, { id: 'cf_lazy_load_bg_selectors', type: 'textarea', placeholder: '.bg-selector\nbody > .container', label: __('Background Images Lazy Load Exclusions', 'wp-cloudflare-page-cache'), description: __('Enter CSS selectors for any background images not covered by the default lazy loading. This ensures those images also benefit from the optimized loading process.', 'wp-cloudflare-page-cache'), hide: !(isToggleOn('cf_lazy_load_bg') && isToggleOn('cf_lazy_loading')) } ] return (