






#import "AboutLikeManager.h"
#import "StickyMoleHeapViewController.h"
#import "PopPoloAddConfig.h"

@interface AboutLikeManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *hasSonMolarAge;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *pongDraftWet;  
@end

@implementation AboutLikeManager

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

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


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


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


- (void)featSchemesLockAutoPetabytesLossTitleViewController:(UIViewController *)supply{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *dayWindow = [self binSelfPatchDogClampDisk:supply];
            
            
            [self bondFootSixBrownEffectChoose:dayWindow];
            
            [self.hasSonMolarAge addObject:dayWindow];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id egg = nil;
            
            egg = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:egg];
                [weakSelf featSchemesLockAutoPetabytesLossTitleViewController:supply];
            }];
        }
    });
}

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

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

- (void)bendFlagNordicSolveDifferentWinDutch:(id)object {
    UIViewController *supply = nil;
    
        
    if ([object isKindOfClass:[UIViewController class]]) {
        supply = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        supply = [StickyMoleHeapViewController new];
        supply.view = object;
    }
    
    
    UIWindow *dayWindow = [self binSelfPatchDogClampDisk:supply];
    
    
    [self bondFootSixBrownEffectChoose:dayWindow];
    
    
    [self.pongDraftWet addObject:dayWindow];
}

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

- (void)rawAnchorCarWindow {
    [self serializeDecrementCompositeReclaimResponseWindow];
}

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

        
        UIWindow *moodWindow = [self.pongDraftWet lastObject];
        [self.pongDraftWet removeLastObject];

        
        if (moodWindow.isKeyWindow) {
            [self saltWarpDomainWindow];
        }

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

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

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

- (void)providerDetectedEnergySeedReactorModalRequested:(void(^)(void))completion {
    
    if (self.pongDraftWet.count == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *ambiguityOptionalVisitedPinCan = [self.pongDraftWet copy];
        for (UIWindow *window in ambiguityOptionalVisitedPinCan) {
            if (window.isKeyWindow) {
                [self saltWarpDomainWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *sliding in [window.subviews copy]) {
                [sliding removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.pongDraftWet 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 *)binSelfPatchDogClampDisk:(UIViewController *)supply {
    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 = supply;
    return window;
}

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

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


- (void)saltWarpDomainWindow {
    UIWindow *needWindow = [self sunCarPivotWindow];
    [needWindow makeKeyWindow];
    if (!needWindow.isKeyWindow) {
        [needWindow becomeKeyWindow];
    }
}

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

- (NSArray<UIWindowScene *> *)affinityMetricKelvinObscuredEither {
    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 *)fatWindow {
    return [self.pongDraftWet lastObject];
}

- (NSInteger)artUseCount {
    return self.pongDraftWet.count;
}


@end
