'use strict'; (function exposeRendererController(globalScope) { function shouldShowPairingOnboarding({ paired = false, secretVisible = false, connected = false, manuallyOpen = false, } = {}) { return manuallyOpen || !paired || (secretVisible && !connected); } function createRendererController({ disconnect, renderConnectionState, clearDisconnectedState, showConnectionStatus, } = {}) { if ( typeof disconnect !== 'function' || typeof renderConnectionState !== 'function' || typeof clearDisconnectedState !== 'function' || typeof showConnectionStatus !== 'function' ) { throw new TypeError('Renderer controller dependencies are invalid.'); } return Object.freeze({ async disconnect() { const result = await disconnect(); if (!result || result.success !== true) { const message = result && typeof result.message === 'string' ? result.message : 'Failed to disconnect from Alta. The current connection remains active.'; showConnectionStatus(message, 'error'); return result; } renderConnectionState(result); clearDisconnectedState(); showConnectionStatus('Disconnected from Alta.', 'info'); return result; }, }); } const api = Object.freeze({ createRendererController, shouldShowPairingOnboarding }); if (typeof module !== 'undefined' && module.exports) module.exports = api; if (globalScope) globalScope.AptRendererController = api; }(typeof window !== 'undefined' ? window : undefined));