(t0)
| 70 | return t6; |
| 71 | } |
| 72 | function ToggleTagAndClose(t0) { |
| 73 | const $ = _c(17); |
| 74 | const { |
| 75 | tagName, |
| 76 | onDone |
| 77 | } = t0; |
| 78 | const [showConfirm, setShowConfirm] = React.useState(false); |
| 79 | const [sessionId, setSessionId] = React.useState(null); |
| 80 | let t1; |
| 81 | if ($[0] !== tagName) { |
| 82 | t1 = recursivelySanitizeUnicode(tagName).trim(); |
| 83 | $[0] = tagName; |
| 84 | $[1] = t1; |
| 85 | } else { |
| 86 | t1 = $[1]; |
| 87 | } |
| 88 | const normalizedTag = t1; |
| 89 | let t2; |
| 90 | let t3; |
| 91 | if ($[2] !== normalizedTag || $[3] !== onDone) { |
| 92 | t2 = () => { |
| 93 | const id = getSessionId() as UUID; |
| 94 | if (!id) { |
| 95 | onDone("No active session to tag", { |
| 96 | display: "system" |
| 97 | }); |
| 98 | return; |
| 99 | } |
| 100 | if (!normalizedTag) { |
| 101 | onDone("Tag name cannot be empty", { |
| 102 | display: "system" |
| 103 | }); |
| 104 | return; |
| 105 | } |
| 106 | setSessionId(id); |
| 107 | const currentTag = getCurrentSessionTag(id); |
| 108 | if (currentTag === normalizedTag) { |
| 109 | logEvent("tengu_tag_command_remove_prompt", {}); |
| 110 | setShowConfirm(true); |
| 111 | } else { |
| 112 | const isReplacing = !!currentTag; |
| 113 | logEvent("tengu_tag_command_add", { |
| 114 | is_replacing: isReplacing |
| 115 | }); |
| 116 | (async () => { |
| 117 | const fullPath = getTranscriptPath(); |
| 118 | await saveTag(id, normalizedTag, fullPath); |
| 119 | onDone(`Tagged session with ${chalk.cyan(`#${normalizedTag}`)}`, { |
| 120 | display: "system" |
| 121 | }); |
| 122 | })(); |
| 123 | } |
| 124 | }; |
| 125 | t3 = [normalizedTag, onDone]; |
| 126 | $[2] = normalizedTag; |
| 127 | $[3] = onDone; |
| 128 | $[4] = t2; |
| 129 | $[5] = t3; |
nothing calls this directly
no test coverage detected