import { useState, useEffect, useMemo } from 'react'; import { useParams, useNavigate, Link } from 'react-router-dom'; import { ChevronDown, RefreshCw, Save, ArrowLeft, AlertCircle, KeyRound } from 'lucide-react'; import { connectivityAPI } from '../../services/api'; import { Toast, useToasts, toastEvent, apiError, typeMeta, GROUP_TYPES, TypeIcon, } from './shared'; const inputCls = 'w-full rounded-md border border-gray-300 px-3 py-2 text-sm text-gray-800 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500'; const monoCls = 'w-full rounded-md border border-gray-300 px-3 py-2 font-mono text-xs text-gray-800 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 resize-y'; function FieldRow({ label, required, hint, children, error }) { return (
{children} {error &&

{error}

} {hint && !error &&

{hint}

}
); } // A write-only secret control: on a new connection it's a plain editable field; // on edit it shows "•••• set" with a Replace button that reveals the input. function SecretField({ label, required, hint, isEdit, hasExisting, value, onChange, multiline, placeholder }) { const [replacing, setReplacing] = useState(!isEdit || !hasExisting); if (isEdit && hasExisting && !replacing) { return (
•••• set
); } return ( {multiline ? (