// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import * as reselect from 'reselect';
import { getDeviceManager } from './baseSelectors';
/**
 * @private
 */
export const localPreviewSelector = reselect.createSelector([getDeviceManager], deviceManager => {
    var _a;
    // TODO: we should take in a LocalVideoStream that developer wants to use as their 'Preview' view. We should also
    // handle cases where 'Preview' view is in progress and not necessary completed.
    const view = deviceManager.cameras.length > 0 &&
        // This ensures that the video stream is reset if camera devices are removed.
        deviceManager.unparentedViews.length > 0 && ((_a = deviceManager.unparentedViews[0]) === null || _a === void 0 ? void 0 : _a.view);
    return {
        videoStreamElement: view ? view.target : null
    };
});
//# sourceMappingURL=localPreviewSelector.js.map