/**
* Approval-panel collapse button.
*
* Pure DOM helpers, no framework imports — unit-testable in jsdom. The
* harness ApprovalPanel body (`[data-approval-scroll]`: the red/green diff
* headline plus the optional command line) can be hundreds of lines tall and
* hides the agent's output behind the composer. This module installs a
* disclosure button at the strip's right end (the card's top-right corner)
* that toggles the body visibility via a card class — CSS-only show/hide,
* the diff DOM stays intact, so expanding restores the exact same view with
* no re-render.
*
* @module dsh-edit-approval/client/collapse
*/
/** Card class toggled by the collapse button (the body-hiding rule lives in {@link COLLAPSE_STYLE}). */
export const COLLAPSED_CLASS = 'dsh-ea-collapsed'
/** Class of the injected disclosure button. */
export const COLLAPSE_BUTTON_CLASS = 'dsh-ea-collapse-btn'
/** Per-panel `aria-controls` id prefix for the scrollable body. */
const BODY_ID_PREFIX = 'dsh-ea-body-'
/** The scrollable body seat (the same structural anchor the diff rendering uses). */
const BODY_SELECTOR = '[data-approval-scroll]'
/** Counter fallback when a panel carries no usable `data-approval-key`. */
let autoBodyId = 0
/**
* The harness `IconChevronDownOutline14` path (14×14, `fill: currentColor`),
* inlined so the injected button matches the native icon style. The raw icon
* points down, matching the harness disclosure convention (open rows show
* the down chevron): expanded shows it unrotated (▾), collapsed rotates it
* 180° (▴).
*/
const CHEVRON_DOWN_PATH =
'M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5Z'
/** Inline chevron-down SVG (presentational; the button carries the accessible label). */
const CHEVRON_SVG = [
'',
].join('')
/**
* Collapse-button styling plus the body-hiding rule. Scoped by the panel
* root anchor and the card class, so it never leaks outside an approval
* panel. Merged into the plugin's injected `