/**
* Refcounted hiding of the whole overlay (the shadow-DOM host) so that
* screenshots never contain the plugin's own UI. The background hides the
* overlay around every captureVisibleTab call; the region selector keeps it
* hidden for the whole full-page stitch. With the counter, nested hides
* (region selector + per-tile capture) never unhide early.
*/
let hideCount = 0;
function hostElement(): HTMLElement | null {
return document.getElementById("ltt-overlay-host");
}
function sync(): void {
const host = hostElement();
if (host) host.style.display = hideCount > 0 ? "none" : "";
}
/** Hides all overlay UI until the matching popUiHidden(). */
export function pushUiHidden(): void {
hideCount++;
sync();
}
/** Undoes one pushUiHidden(); the overlay reappears at zero. */
export function popUiHidden(): void {
hideCount = Math.max(0, hideCount - 1);
sync();
}