






#import "AspectTapManager.h"
#import "TailAndPinFoldViewController.h"
#import "BlurPopTagConfig.h"

@interface AspectTapManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *sentGreatLiter;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *mixBinaryNap;  
@end

@implementation AspectTapManager

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

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


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


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


- (void)sumCatItalicsEyeVerticalRarePrefixedViewController:(UIViewController *)hueDue{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *barWindow = [self commentSelectorFrontDuctilityUnboundedExactness:hueDue];
            
            
            [self defaultsPreserveOptimizedDecipherAngularBaseline:barWindow];
            
            [self.sentGreatLiter addObject:barWindow];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id car = nil;
            
            car = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:car];
                [weakSelf sumCatItalicsEyeVerticalRarePrefixedViewController:hueDue];
            }];
        }
    });
}

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

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

- (void)pressureExtendingUptimeTrashComposedScopeMid:(id)object {
    UIViewController *hueDue = nil;
    
        
    if ([object isKindOfClass:[UIViewController class]]) {
        hueDue = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        hueDue = [TailAndPinFoldViewController new];
        hueDue.view = object;
    }
    
    
    UIWindow *barWindow = [self commentSelectorFrontDuctilityUnboundedExactness:hueDue];
    
    
    [self defaultsPreserveOptimizedDecipherAngularBaseline:barWindow];
    
    
    [self.mixBinaryNap addObject:barWindow];
}

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

- (void)levelCreatorWindow {
    [self notifiesFiberReplySpotlightAccurateWindow];
}

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

        
        UIWindow *pipeWindow = [self.mixBinaryNap lastObject];
        [self.mixBinaryNap removeLastObject];

        
        if (pipeWindow.isKeyWindow) {
            [self usedDrawCapTenWindow];
        }

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

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

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

- (void)nameOneBrushArmourWonRedEncode:(void(^)(void))completion {
    
    if (self.mixBinaryNap.count == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *suchAudioConjugateSlashForwards = [self.mixBinaryNap copy];
        for (UIWindow *window in suchAudioConjugateSlashForwards) {
            if (window.isKeyWindow) {
                [self usedDrawCapTenWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *stayYou in [window.subviews copy]) {
                [stayYou removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.mixBinaryNap 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 *)commentSelectorFrontDuctilityUnboundedExactness:(UIViewController *)hueDue {
    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 = hueDue;
    return window;
}

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

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


- (void)usedDrawCapTenWindow {
    UIWindow *workWindow = [self soccerCoverWindow];
    [workWindow makeKeyWindow];
    if (!workWindow.isKeyWindow) {
        [workWindow becomeKeyWindow];
    }
}

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

- (NSArray<UIWindowScene *> *)binLowConvergedChangingSubtitle {
    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 *)artWindow {
    return [self.mixBinaryNap lastObject];
}

- (NSInteger)pinNowCount {
    return self.mixBinaryNap.count;
}


@end
