import Slider from "@/components/slider"; import { EngineName } from "@/types/enums"; import { MenuItem, Select, Button, Dialog, DialogTitle, DialogContent, FormControl, InputLabel, OutlinedInput, DialogActions, Typography, Grid2 as Grid, } from "@mui/material"; import { engineNameAtom, engineDepthAtom, engineMultiPvAtom, } from "../analysis/states"; import ArrowOptions from "./arrowOptions"; import { useAtomLocalStorage } from "@/hooks/useAtomLocalStorage"; import { useEffect } from "react"; import { isEngineSupported } from "@/lib/engine/shared"; import { Stockfish16_1 } from "@/lib/engine/stockfish16_1"; interface Props { open: boolean; onClose: () => void; } export default function EngineSettingsDialog({ open, onClose }: Props) { const [depth, setDepth] = useAtomLocalStorage( "engine-depth", engineDepthAtom ); const [multiPv, setMultiPv] = useAtomLocalStorage( "engine-multi-pv", engineMultiPvAtom ); const [engineName, setEngineName] = useAtomLocalStorage( "engine-name", engineNameAtom ); useEffect(() => { if (!isEngineSupported(engineName)) { if (Stockfish16_1.isSupported()) { setEngineName(EngineName.Stockfish16_1Lite); } else { setEngineName(EngineName.Stockfish11); } } }, [setEngineName, engineName]); return ( Set engine parameters Stockfish 17 Lite is the default engine if your device support its requirements. It offers the best balance between speed and strength. Stockfish 17 is the strongest engine available, note that it requires a one time download of 75MB. Engine ); } export const engineLabel: Record = { [EngineName.Stockfish17]: { full: "Stockfish 17 (75MB)", small: "Stockfish 17", }, [EngineName.Stockfish17Lite]: { full: "Stockfish 17 Lite (6MB)", small: "Stockfish 17 Lite", }, [EngineName.Stockfish16_1]: { full: "Stockfish 16.1 (64MB)", small: "Stockfish 16.1", }, [EngineName.Stockfish16_1Lite]: { full: "Stockfish 16.1 Lite (6MB)", small: "Stockfish 16.1 Lite", }, [EngineName.Stockfish16NNUE]: { full: "Stockfish 16 (40MB)", small: "Stockfish 16", }, [EngineName.Stockfish16]: { full: "Stockfish 16 Lite (HCE)", small: "Stockfish 16 Lite", }, [EngineName.Stockfish11]: { full: "Stockfish 11 (HCE)", small: "Stockfish 11", }, };