






#import "CapUniqueManager.h"
#import "BitShotWayPrepViewController.h"
#import "BinForRollConfig.h"

@interface CapUniqueManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *listenersSlash;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *indoorDueWho;  
@end

@implementation CapUniqueManager

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

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


- (UIWindow *)armInstantWindow {
    UIWindow *thirdWindow = 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) {
                    thirdWindow = windowScene.windows.firstObject;
                }
                break;
            }
        }
    } else {
        
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            thirdWindow = windows.firstObject;
        }
    }
    
    
    if (!thirdWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            thirdWindow = windows.firstObject;
        }
    }
    
    return thirdWindow;
}


- (UIWindow *)leaveRedBestWindow {
    
    UIWindow *allFadeWindow = 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, *)) {
                    allFadeWindow = windowScene.keyWindow;
                }
                
                else {
                    for (UIWindow *window in windowScene.windows) {
                        if (window.isKeyWindow) {
                            allFadeWindow = window;
                            break;
                        }
                    }
                }
                break;
            }
        }
    } else {
        
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        allFadeWindow = [UIApplication sharedApplication].keyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!allFadeWindow) {
        NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
        for (UIWindow *window in windows) {
            if (window.isKeyWindow) {
                allFadeWindow = window;
                break;
            }
        }
    }
    
    return allFadeWindow;
}


- (void)megabytesTerabytesOldestPipeUnwindingMakerInfinityViewController:(UIViewController *)sixDid{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *itsWindow = [self tallTrademarkDiscoverAnimatorSigningEvery:sixDid];
            
            
            [self pastAnyQuickSongProcedureHis:itsWindow];
            
            [self.listenersSlash addObject:itsWindow];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id ill = nil;
            
            ill = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:ill];
                [weakSelf megabytesTerabytesOldestPipeUnwindingMakerInfinityViewController:sixDid];
            }];
        }
    });
}

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

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

- (void)ampereIdenticalMapSecureHomeFlippedMetric:(id)object {
    UIViewController *sixDid = nil;
    
        
    if ([object isKindOfClass:[UIViewController class]]) {
        sixDid = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        sixDid = [BitShotWayPrepViewController new];
        sixDid.view = object;
    }
    
    
    UIWindow *itsWindow = [self tallTrademarkDiscoverAnimatorSigningEvery:sixDid];
    
    
    [self pastAnyQuickSongProcedureHis:itsWindow];
    
    
    [self.indoorDueWho addObject:itsWindow];
}

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

- (void)scanCroatianWindow {
    [self redefinedFourthPeriodRecipientFrictionWindow];
}

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

        
        UIWindow *moreWindow = [self.indoorDueWho lastObject];
        [self.indoorDueWho removeLastObject];

        
        if (moreWindow.isKeyWindow) {
            [self barsArmHandHasWindow];
        }

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

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

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

- (void)texturedCursorInferSimulatesPartlyHandledHit:(void(^)(void))completion {
    
    if (self.indoorDueWho.count == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *mapCropTraverseFeatMegahertz = [self.indoorDueWho copy];
        for (UIWindow *window in mapCropTraverseFeatMegahertz) {
            if (window.isKeyWindow) {
                [self barsArmHandHasWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *stroked in [window.subviews copy]) {
                [stroked removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.indoorDueWho 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 *)tallTrademarkDiscoverAnimatorSigningEvery:(UIViewController *)sixDid {
    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 = sixDid;
    return window;
}

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

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


- (void)barsArmHandHasWindow {
    UIWindow *charWindow = [self kannadaWrapWindow];
    [charWindow makeKeyWindow];
    if (!charWindow.isKeyWindow) {
        [charWindow becomeKeyWindow];
    }
}

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

- (NSArray<UIWindowScene *> *)returnsJobUseEngravedAlbum {
    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 *)hisWindow {
    return [self.indoorDueWho lastObject];
}

- (NSInteger)lawKitCount {
    return self.indoorDueWho.count;
}


@end
