






#import "BeaconAskManager.h"
#import "LevelDisappearViewController.h"
#import "LeftFutureConfig.h"

@interface BeaconAskManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *dogSeeMoleInfo;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *airTintMajor;  
@end

@implementation BeaconAskManager

- (instancetype)init {
    self = [super init];
    if (self) {
        _dogSeeMoleInfo = [NSMutableArray array];
        _airTintMajor = [NSMutableArray array];
    }
    return self;
}

+ (instancetype)shared {
    static id shared = nil;
    static dispatch_once_t toneToken;
    dispatch_once(&toneToken, ^{
        shared = [[super alloc] init];
    });
    return shared;
}


- (UIWindow *)shakeLocalWindow {
    UIWindow *basicWindow = nil;
    
    if (@available(iOS 13.0, *)) {
        
        NSSet<UIScene *> *connectedScenes = [UIApplication sharedApplication].connectedScenes;
        for (UIScene *scene in connectedScenes) {
            
            if (scene.activationState == UISceneActivationStateForegroundActive &&
                [scene isKindOfClass:[UIWindowScene class]]) {
                
                UIWindowScene *windowScene = (UIWindowScene *)scene;
                
                if (windowScene.windows.count > 0) {
                    basicWindow = windowScene.windows.firstObject;
                }
                break;
            }
        }
    } else {
        
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            basicWindow = windows.firstObject;
        }
    }
    
    
    if (!basicWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            basicWindow = windows.firstObject;
        }
    }
    
    return basicWindow;
}


- (UIWindow *)detachCreditWindow {
    
    UIWindow *twoFaceWindow = nil;
    
    if (@available(iOS 13.0, *)) {
        NSSet<UIScene *> *connectedScenes = [UIApplication sharedApplication].connectedScenes;
        for (UIScene *scene in connectedScenes) {
            if (scene.activationState == UISceneActivationStateForegroundActive &&
                [scene isKindOfClass:[UIWindowScene class]]) {
                UIWindowScene *windowScene = (UIWindowScene *)scene;
                
                
                if (@available(iOS 15.0, *)) {
                    twoFaceWindow = windowScene.keyWindow;
                }
                
                else {
                    for (UIWindow *window in windowScene.windows) {
                        if (window.isKeyWindow) {
                            twoFaceWindow = window;
                            break;
                        }
                    }
                }
                break;
            }
        }
    } else {
        
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        twoFaceWindow = [UIApplication sharedApplication].keyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!twoFaceWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        for (UIWindow *window in windows) {
            if (window.isKeyWindow) {
                twoFaceWindow = window;
                break;
            }
        }
    }
    
    return twoFaceWindow;
}


- (void)potentialBaseOddLooperInvalidVignetteTagViewController:(UIViewController *)school{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *hexWindow = [self resourceCoercionExerciseResultsStaticDebugging:school];
            
            
            [self youngerEmbeddingTruncatesOverhangDrivenMath:hexWindow];
            
            [self.dogSeeMoleInfo addObject:hexWindow];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id are = nil;
            
            are = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:are];
                [weakSelf potentialBaseOddLooperInvalidVignetteTagViewController:school];
            }];
        }
    });
}

- (void)removablePassivelyCardAdoptSonObscuresViewController:(UIViewController *)school {
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            [self mutationsCustodianFarsiSceneStakeSwappedTraining:school];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id are = nil;
            
            are = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:are];
                
                [weakSelf mutationsCustodianFarsiSceneStakeSwappedTraining:school];
            }];
        }
    });
}

- (void)behaviorsCutRepeatDetectsFootballPreservesView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            [self mutationsCustodianFarsiSceneStakeSwappedTraining:view];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id are = nil;
            
            are = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:are];
                
                [weakSelf mutationsCustodianFarsiSceneStakeSwappedTraining:view];
            }];
        }
    });
}

- (void)mutationsCustodianFarsiSceneStakeSwappedTraining:(id)object {
    UIViewController *school = nil;
    
        
    if ([object isKindOfClass:[UIViewController class]]) {
        school = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        school = [LevelDisappearViewController new];
        school.view = object;
    }
    
    
    UIWindow *hexWindow = [self resourceCoercionExerciseResultsStaticDebugging:school];
    
    
    [self youngerEmbeddingTruncatesOverhangDrivenMath:hexWindow];
    
    
    [self.airTintMajor addObject:hexWindow];
}

- (void)sortingSelectorsMaskDisappearFoundService:(NSNotification *)note {
    
    [[NSNotificationCenter defaultCenter] removeObserver:self
                                                    name:UIApplicationDidBecomeActiveNotification
                                                  object:nil];
    [self behaviorsCutRepeatDetectsFootballPreservesView:note.object];
}

- (void)manyYearsKeyWindow {
    [self voiceMalteseMalteseCapContactWindow];
}

- (void)voiceMalteseMalteseCapContactWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        if (self.airTintMajor.count == 0) return;

        
        UIWindow *pastWindow = [self.airTintMajor lastObject];
        [self.airTintMajor removeLastObject];

        
        if (pastWindow.isKeyWindow) {
            [self onceFlipActionWindow];
        }

        
        pastWindow.hidden = YES;
        
        
        for (UIView *eyeZone in [pastWindow.subviews copy]) {
            [eyeZone removeFromSuperview];
        }
        
        
        pastWindow.rootViewController = nil;
        
        
        [CATransaction flush];
        
        
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
    });
}

- (void)fixProcessedNoiseAngleExistingFoundViewController:(UIViewController *)rootViewController {
    dispatch_async(dispatch_get_main_queue(), ^{
        NSEnumerator *processesHelloEnergyCanonicalFill = [self.airTintMajor reverseObjectEnumerator];
        UIWindow *window = nil;
        
        
        while ((window = [processesHelloEnergyCanonicalFill nextObject])) {
            if (window.rootViewController == rootViewController) {
                
                if (window.isKeyWindow) {
                    [self onceFlipActionWindow];
                }
                
                
                window.hidden = YES;
                
                
                for (UIView *eyeZone in [window.subviews copy]) {
                    [eyeZone removeFromSuperview];
                }
                
                
                window.rootViewController = nil;
                
                [self.airTintMajor removeObject:window];
                
                
                [CATransaction flush];
                
                
                [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
                
                
                processesHelloEnergyCanonicalFill = [self.airTintMajor reverseObjectEnumerator];
            }
        }
    });
}

- (void)devicesWillExceptionCurlBehaveResign {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIWindow *window in [self.airTintMajor reverseObjectEnumerator]) {
            if (window.isKeyWindow) {
                [self onceFlipActionWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *eyeZone in [window.subviews copy]) {
                [eyeZone removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.airTintMajor removeAllObjects];
        
        
        [CATransaction flush];
        
        
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
    });
}

- (void)terahertzIndicatedArtSyntaxRedoLanguagePreset:(void(^)(void))completion {
    
    if (self.airTintMajor.count == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *alignBorderQuechuaOcclusionDeny = [self.airTintMajor copy];
        for (UIWindow *window in alignBorderQuechuaOcclusionDeny) {
            if (window.isKeyWindow) {
                [self onceFlipActionWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *eyeZone in [window.subviews copy]) {
                [eyeZone removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.airTintMajor removeAllObjects];
        
        
        [CATransaction flush];
        
        
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
        
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            if (completion) {
                completion();
            }
        });
    });
}


- (UIWindow *)resourceCoercionExerciseResultsStaticDebugging:(UIViewController *)school {
    UIWindow *window = nil;
    
    
    if (@available(iOS 13.0, *)) {
        for (UIScene *scene in [UIApplication sharedApplication].connectedScenes) {
            if (scene.activationState == UISceneActivationStateForegroundActive &&
                [scene isKindOfClass:[UIWindowScene class]]) {
                window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
                break;
            }
        }
    }
    
    
    if (!window) {
        window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    }
    
    
    window.backgroundColor = [UIColor clearColor];
    window.rootViewController = school;
    return window;
}

- (void)youngerEmbeddingTruncatesOverhangDrivenMath:(UIWindow *)window {
    

    window.windowLevel = UIWindowLevelStatusBar + 100;
    [window makeKeyAndVisible];
}


- (void)onceFlipActionWindow {
    UIWindow *feedWindow = [self bloodScreenWindow];
    [feedWindow makeKeyWindow];
    if (!feedWindow.isKeyWindow) {
        [feedWindow becomeKeyWindow];
    }
}

- (UIWindow *)bloodScreenWindow {
    __block UIWindow *feedWindow = nil;
    
    
    if (@available(iOS 13.0, *)) {
        NSArray<UIWindowScene *> *ourSuddenNet = [self boxDirectoryEmailVerticalCrop];
        [ourSuddenNet enumerateObjectsUsingBlock:^(UIWindowScene * _Nonnull scene, NSUInteger idx, BOOL * _Nonnull stop) {
            
            if (@available(iOS 15.0, *)) {
                feedWindow = scene.keyWindow;
            }
            
            if (!feedWindow) {
                feedWindow = [scene.windows firstObject];
            }
            if (feedWindow) *stop = YES;
        }];
    }
    
    else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        feedWindow = [UIApplication sharedApplication].keyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!feedWindow) {
        feedWindow = [UIApplication sharedApplication].windows.firstObject;
    }
    
    return feedWindow;
}

- (NSArray<UIWindowScene *> *)boxDirectoryEmailVerticalCrop {
    NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(UIScene * _Nullable scene, NSDictionary<NSString *,id> * _Nullable bindings) {
        return scene.activationState == UISceneActivationStateForegroundActive;
    }];
    return [[UIApplication sharedApplication].connectedScenes filteredSetUsingPredicate:predicate].allObjects;
}


- (UIWindow *)jobWindow {
    return [self.airTintMajor lastObject];
}

- (NSInteger)sparseCount {
    return self.airTintMajor.count;
}


@end
