import { c as _c } from "react/compiler-runtime"; import React, { useEffect, useState } from 'react'; import { type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, logEvent } from 'src/services/analytics/index.js'; import { Box, Link, Text, useInput } from '../../ink.js'; import { type AccountSettings, calculateShouldShowGrove, type GroveConfig, getGroveNoticeConfig, getGroveSettings, markGroveNoticeViewed, updateGroveSettings } from '../../services/api/grove.js'; import { Select } from '../CustomSelect/index.js'; import { Byline } from '../design-system/Byline.js'; import { Dialog } from '../design-system/Dialog.js'; import { KeyboardShortcutHint } from '../design-system/KeyboardShortcutHint.js'; export type GroveDecision = 'accept_opt_in' | 'accept_opt_out' | 'defer' | 'escape' | 'skip_rendering'; type Props = { showIfAlreadyViewed: boolean; location: 'settings' | 'policy_update_modal' | 'onboarding'; onDone(decision: GroveDecision): void; }; const NEW_TERMS_ASCII = ` _____________ | \\ \\ | NEW TERMS \\__\\ | | | ---------- | | ---------- | | ---------- | | ---------- | | ---------- | | | |______________|`; function GracePeriodContentBody() { const $ = _c(9); let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t0 = An update to our Consumer Terms and Privacy Policy will take effect on{" "}October 8, 2025. You can accept the updated terms today.; $[0] = t0; } else { t0 = $[0]; } let t1; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { t1 = What's changing?; $[1] = t1; } else { t1 = $[1]; } let t2; let t3; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { t2 = · ; t3 = You can help improve Claude ; $[2] = t2; $[3] = t3; } else { t2 = $[2]; t3 = $[3]; } let t4; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t4 = {t2}{t3}— Allow the use of your chats and coding sessions to train and improve Anthropic AI models. Change anytime in your Privacy Settings ().; $[4] = t4; } else { t4 = $[4]; } let t5; if ($[5] === Symbol.for("react.memo_cache_sentinel")) { t5 = {t1}{t4}· Updates to data retention — To help us improve our AI models and safety protections, we're extending data retention to 5 years.; $[5] = t5; } else { t5 = $[5]; } let t6; if ($[6] === Symbol.for("react.memo_cache_sentinel")) { t6 = ; $[6] = t6; } else { t6 = $[6]; } let t7; if ($[7] === Symbol.for("react.memo_cache_sentinel")) { t7 = ; $[7] = t7; } else { t7 = $[7]; } let t8; if ($[8] === Symbol.for("react.memo_cache_sentinel")) { t8 = <>{t0}{t5}Learn more ({t6}) or read the updated Consumer Terms ({t7}) and Privacy Policy (); $[8] = t8; } else { t8 = $[8]; } return t8; } function PostGracePeriodContentBody() { const $ = _c(7); let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t0 = We've updated our Consumer Terms and Privacy Policy.; $[0] = t0; } else { t0 = $[0]; } let t1; if ($[1] === Symbol.for("react.memo_cache_sentinel")) { t1 = What's changing?; $[1] = t1; } else { t1 = $[1]; } let t2; if ($[2] === Symbol.for("react.memo_cache_sentinel")) { t2 = Help improve ClaudeAllow the use of your chats and coding sessions to train and improve Anthropic AI models. You can change this anytime in Privacy Settings; $[2] = t2; } else { t2 = $[2]; } let t3; if ($[3] === Symbol.for("react.memo_cache_sentinel")) { t3 = {t1}{t2}How this affects data retentionTurning ON the improve Claude setting extends data retention from 30 days to 5 years. Turning it OFF keeps the default 30-day data retention. Delete data anytime.; $[3] = t3; } else { t3 = $[3]; } let t4; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t4 = ; $[4] = t4; } else { t4 = $[4]; } let t5; if ($[5] === Symbol.for("react.memo_cache_sentinel")) { t5 = ; $[5] = t5; } else { t5 = $[5]; } let t6; if ($[6] === Symbol.for("react.memo_cache_sentinel")) { t6 = <>{t0}{t3}Learn more ({t4}) or read the updated Consumer Terms ({t5}) and Privacy Policy (); $[6] = t6; } else { t6 = $[6]; } return t6; } export function GroveDialog(t0) { const $ = _c(34); const { showIfAlreadyViewed, location, onDone } = t0; const [shouldShowDialog, setShouldShowDialog] = useState(null); const [groveConfig, setGroveConfig] = useState(null); let t1; let t2; if ($[0] !== location || $[1] !== onDone || $[2] !== showIfAlreadyViewed) { t1 = () => { const checkGroveSettings = async function checkGroveSettings() { const [settingsResult, configResult] = await Promise.all([getGroveSettings(), getGroveNoticeConfig()]); const config = configResult.success ? configResult.data : null; setGroveConfig(config); const shouldShow = calculateShouldShowGrove(settingsResult, configResult, showIfAlreadyViewed); setShouldShowDialog(shouldShow); if (!shouldShow) { onDone("skip_rendering"); return; } markGroveNoticeViewed(); logEvent("tengu_grove_policy_viewed", { location: location as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, dismissable: config?.notice_is_grace_period as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS }); }; checkGroveSettings(); }; t2 = [showIfAlreadyViewed, location, onDone]; $[0] = location; $[1] = onDone; $[2] = showIfAlreadyViewed; $[3] = t1; $[4] = t2; } else { t1 = $[3]; t2 = $[4]; } useEffect(t1, t2); if (shouldShowDialog === null) { return null; } if (!shouldShowDialog) { return null; } let t3; if ($[5] !== groveConfig?.notice_is_grace_period || $[6] !== onDone) { t3 = async function onChange(value) { bb21: switch (value) { case "accept_opt_in": { await updateGroveSettings(true); logEvent("tengu_grove_policy_submitted", { state: true, dismissable: groveConfig?.notice_is_grace_period as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS }); break bb21; } case "accept_opt_out": { await updateGroveSettings(false); logEvent("tengu_grove_policy_submitted", { state: false, dismissable: groveConfig?.notice_is_grace_period as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS }); break bb21; } case "defer": { logEvent("tengu_grove_policy_dismissed", { state: true }); break bb21; } case "escape": { logEvent("tengu_grove_policy_escaped", {}); } } onDone(value); }; $[5] = groveConfig?.notice_is_grace_period; $[6] = onDone; $[7] = t3; } else { t3 = $[7]; } const onChange = t3; let t4; if ($[8] !== groveConfig?.domain_excluded) { t4 = groveConfig?.domain_excluded ? [{ label: "Accept terms \xB7 Help improve Claude: OFF (for emails with your domain)", value: "accept_opt_out" }] : [{ label: "Accept terms \xB7 Help improve Claude: ON", value: "accept_opt_in" }, { label: "Accept terms \xB7 Help improve Claude: OFF", value: "accept_opt_out" }]; $[8] = groveConfig?.domain_excluded; $[9] = t4; } else { t4 = $[9]; } const acceptOptions = t4; let t5; if ($[10] !== groveConfig?.notice_is_grace_period || $[11] !== onChange) { t5 = function handleCancel() { if (groveConfig?.notice_is_grace_period) { onChange("defer"); return; } onChange("escape"); }; $[10] = groveConfig?.notice_is_grace_period; $[11] = onChange; $[12] = t5; } else { t5 = $[12]; } const handleCancel = t5; let t6; if ($[13] !== groveConfig?.notice_is_grace_period) { t6 = {groveConfig?.notice_is_grace_period ? : }; $[13] = groveConfig?.notice_is_grace_period; $[14] = t6; } else { t6 = $[14]; } let t7; if ($[15] === Symbol.for("react.memo_cache_sentinel")) { t7 = {NEW_TERMS_ASCII}; $[15] = t7; } else { t7 = $[15]; } let t8; if ($[16] !== t6) { t8 = {t6}{t7}; $[16] = t6; $[17] = t8; } else { t8 = $[17]; } let t9; if ($[18] === Symbol.for("react.memo_cache_sentinel")) { t9 = Please select how you'd like to continueYour choice takes effect immediately upon confirmation.; $[18] = t9; } else { t9 = $[18]; } let t10; if ($[19] !== groveConfig?.notice_is_grace_period) { t10 = groveConfig?.notice_is_grace_period ? [{ label: "Not now", value: "defer" }] : []; $[19] = groveConfig?.notice_is_grace_period; $[20] = t10; } else { t10 = $[20]; } let t11; if ($[21] !== acceptOptions || $[22] !== t10) { t11 = [...acceptOptions, ...t10]; $[21] = acceptOptions; $[22] = t10; $[23] = t11; } else { t11 = $[23]; } let t12; if ($[24] !== onChange) { t12 = value_0 => onChange(value_0 as 'accept_opt_in' | 'accept_opt_out' | 'defer'); $[24] = onChange; $[25] = t12; } else { t12 = $[25]; } let t13; if ($[26] !== handleCancel || $[27] !== t11 || $[28] !== t12) { t13 = {t9}