






#import "VolumeAddManager.h"
#import "BeenJobTipNearViewController.h"
#import "HisCapForkConfig.h"

@interface VolumeAddManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *pinkBigEggCard;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *selectEraPop;  
@end

@implementation VolumeAddManager

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

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


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


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


- (void)localityNowWaitFavoriteAgeKnowAlongViewController:(UIViewController *)arabic{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *dogWindow = [self cloudPersonalSampleTranslateMegabitsAdjusts:arabic];
            
            
            [self wayMultipleCoverLifetimeRoomSerial:dogWindow];
            
            [self.pinkBigEggCard addObject:dogWindow];
        } 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 localityNowWaitFavoriteAgeKnowAlongViewController:arabic];
            }];
        }
    });
}

- (void)dogChatCatHelpBaselineExporterViewController:(UIViewController *)arabic {
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            [self shipmentPaddleRegularListenerFarInlandEnvelope:arabic];
        } 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 shipmentPaddleRegularListenerFarInlandEnvelope:arabic];
            }];
        }
    });
}

- (void)croatianLocalizedKernelUsageSlantChainView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            [self shipmentPaddleRegularListenerFarInlandEnvelope: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 shipmentPaddleRegularListenerFarInlandEnvelope:view];
            }];
        }
    });
}

- (void)shipmentPaddleRegularListenerFarInlandEnvelope:(id)object {
    UIViewController *arabic = nil;
    
        
    if ([object isKindOfClass:[UIViewController class]]) {
        arabic = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        arabic = [BeenJobTipNearViewController new];
        arabic.view = object;
    }
    
    
    UIWindow *dogWindow = [self cloudPersonalSampleTranslateMegabitsAdjusts:arabic];
    
    
    [self wayMultipleCoverLifetimeRoomSerial:dogWindow];
    
    
    [self.selectEraPop addObject:dogWindow];
}

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

- (void)areAreAbsentWindow {
    [self blurFloaterShutdownHexExecuteWindow];
}

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

        
        UIWindow *softWindow = [self.selectEraPop lastObject];
        [self.selectEraPop removeLastObject];

        
        if (softWindow.isKeyWindow) {
            [self chunkyNamePoloWindow];
        }

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

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

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

- (void)walkAllOncePhoneEquallyTraveledComponent:(void(^)(void))completion {
    
    if (self.selectEraPop.count == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *formatYearHindiOrdinaryDecay = [self.selectEraPop copy];
        for (UIWindow *window in formatYearHindiOrdinaryDecay) {
            if (window.isKeyWindow) {
                [self chunkyNamePoloWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *noneTwo in [window.subviews copy]) {
                [noneTwo removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.selectEraPop 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 *)cloudPersonalSampleTranslateMegabitsAdjusts:(UIViewController *)arabic {
    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 = arabic;
    return window;
}

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

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


- (void)chunkyNamePoloWindow {
    UIWindow *loveWindow = [self drainUptimeWindow];
    [loveWindow makeKeyWindow];
    if (!loveWindow.isKeyWindow) {
        [loveWindow becomeKeyWindow];
    }
}

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

- (NSArray<UIWindowScene *> *)rootBadgeGetUndoneReload {
    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 *)penWindow {
    return [self.selectEraPop lastObject];
}

- (NSInteger)armourCount {
    return self.selectEraPop.count;
}


@end
