// This is a fork of https://github.com/hupe1980/react-script-hook // We originally started with patch-package, but with React 19 we also needed // to update its dependency versions, so (given the size) we just forked it. import { useState, useEffect } from 'react'; interface ScriptProps { src: HTMLScriptElement['src'] | null; checkForExisting?: boolean; [key: string]: any; } type ErrorState = ErrorEvent | null; type ScriptStatus = { loading: boolean; error: ErrorState; scriptEl: HTMLScriptElement; }; type ScriptStatusMap = { [key: string]: ScriptStatus; }; // Previously loading/loaded scripts and their current status export const scripts: ScriptStatusMap = {}; // Check for existing