/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@loloof64/react-native-stockfish@0.3.3/lib/module/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";import ReactNativeStockfish,{_subscribeToStockfishOutput,_subscribeToStockfishError}from"./NativeReactNativeStockfish.js";import{useRef,useCallback,useEffect}from"react";export function useStockfish({onOutput:t,onError:o}){const s=useRef(!1),c=useCallback((()=>{s.current||(s.current=!0,ReactNativeStockfish.stockfishLoop())}),[]),e=useCallback((()=>{s.current&&(ReactNativeStockfish.stopStockfish(),s.current=!1)}),[]),r=useCallback((t=>{s.current?ReactNativeStockfish.sendCommandToStockfish(t):console.warn("Stockfish is not running. Cannot send command.")}),[]);return useEffect((()=>{const c=_subscribeToStockfishOutput((o=>{s.current&&t&&t(o)})),r=_subscribeToStockfishError((t=>{s.current&&o&&o(t)}));return()=>{c(),r(),e()}}),[t,o,e]),{stockfishLoop:c,stopStockfish:e,sendCommandToStockfish:r}}
//# sourceMappingURL=/sm/c7db62f195c84b9b2d004d9ee0c3c18fc29cdd360b946a82591b5c4442e1639b.map