import { c as _c } from "react/compiler-runtime"; import React, { useCallback, useEffect, useRef } from 'react'; import { Box, Text } from '../ink.js'; import { isMaxSubscriber, isProSubscriber, isTeamSubscriber } from '../utils/auth.js'; import { getGlobalConfig, saveGlobalConfig } from '../utils/config.js'; import type { EffortLevel } from '../utils/effort.js'; import { convertEffortValueToLevel, getDefaultEffortForModel, getOpusDefaultEffortConfig, toPersistableEffort } from '../utils/effort.js'; import { parseUserSpecifiedModel } from '../utils/model/model.js'; import { updateSettingsForSource } from '../utils/settings/settings.js'; import type { OptionWithDescription } from './CustomSelect/select.js'; import { Select } from './CustomSelect/select.js'; import { effortLevelToSymbol } from './EffortIndicator.js'; import { PermissionDialog } from './permissions/PermissionDialog.js'; type EffortCalloutSelection = EffortLevel | undefined | 'dismiss'; type Props = { model: string; onDone: (selection: EffortCalloutSelection) => void; }; const AUTO_DISMISS_MS = 30_000; export function EffortCallout(t0) { const $ = _c(18); const { model, onDone } = t0; let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t1 = getOpusDefaultEffortConfig(); $[0] = t1; } else { t1 = $[0]; } const defaultEffortConfig = t1; const onDoneRef = useRef(onDone); let t2; if ($[1] !== onDone) { t2 = () => { onDoneRef.current = onDone; }; $[1] = onDone; $[2] = t2; } else { t2 = $[2]; } useEffect(t2); let t3; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { t3 = () => { onDoneRef.current("dismiss"); }; $[3] = t3; } else { t3 = $[3]; } const handleCancel = t3; let t4; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t4 = []; $[4] = t4; } else { t4 = $[4]; } useEffect(_temp, t4); let t5; let t6; if ($[5] === Symbol.for("react.memo_cache_sentinel")) { t5 = () => { const timeoutId = setTimeout(handleCancel, AUTO_DISMISS_MS); return () => clearTimeout(timeoutId); }; t6 = [handleCancel]; $[5] = t5; $[6] = t6; } else { t5 = $[5]; t6 = $[6]; } useEffect(t5, t6); let t7; if ($[7] !== model) { const defaultEffort = getDefaultEffortForModel(model); t7 = defaultEffort ? convertEffortValueToLevel(defaultEffort) : "high"; $[7] = model; $[8] = t7; } else { t7 = $[8]; } const defaultLevel = t7; let t8; if ($[9] !== defaultLevel) { t8 = value => { const effortLevel = value === defaultLevel ? undefined : value; updateSettingsForSource("userSettings", { effortLevel: toPersistableEffort(effortLevel) }); onDoneRef.current(value); }; $[9] = defaultLevel; $[10] = t8; } else { t8 = $[10]; } const handleSelect = t8; let t9; if ($[11] === Symbol.for("react.memo_cache_sentinel")) { t9 = [{ label: , value: "medium" }, { label: , value: "high" }, { label: , value: "low" }]; $[11] = t9; } else { t9 = $[11]; } const options = t9; let t10; if ($[12] === Symbol.for("react.memo_cache_sentinel")) { t10 = {defaultEffortConfig.dialogDescription}; $[12] = t10; } else { t10 = $[12]; } let t11; if ($[13] === Symbol.for("react.memo_cache_sentinel")) { t11 = ; $[13] = t11; } else { t11 = $[13]; } let t12; if ($[14] === Symbol.for("react.memo_cache_sentinel")) { t12 = ; $[14] = t12; } else { t12 = $[14]; } let t13; if ($[15] === Symbol.for("react.memo_cache_sentinel")) { t13 = {t11} low {"\xB7"}{" "}{t12} medium {"\xB7"}{" "} high; $[15] = t13; } else { t13 = $[15]; } let t14; if ($[16] !== handleSelect) { t14 = {t10}{t13}