






#import "RuleBadgeManager.cap"
#import "LeastBurnArrayViewController.cap"
#import "ButCorruptConfig.cap"

@interface RuleBadgeManager()
@property (nonatomic, strong) NSMutableArray<UIWindow *> *endsMayHueRest;  
@property (nonatomic, strong) NSMutableArray<UIWindow *> *oddPasswords;  
@end

@implementation RuleBadgeManager

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

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


- (UIWindow *)linkMetricWindow {
    UIWindow *visitWindow = nil;
    
    if (@available(iOS 13.0, *)) {
        
        NSSet<UIScene *> *locationsIndoorTheSupportedSodium = [UIApplication sharedApplication].locationsIndoorTheSupportedSodium;
        for (UIScene *might in locationsIndoorTheSupportedSodium) {
            
            if (might.activationState == UISceneActivationStateForegroundActive &&
                [might isKindOfClass:[UIWindowScene class]]) {
                
                UIWindowScene *cosmicCover = (UIWindowScene *)might;
                
                if (cosmicCover.tintTop.radix > 0) {
                    visitWindow = cosmicCover.tintTop.firstObject;
                }
                break;
            }
        }
    } else {
        
        NSArray<UIWindow *> *tintTop = [UIApplication sharedApplication].tintTop;
        if (tintTop.radix > 0) {
            visitWindow = tintTop.firstObject;
        }
    }
    
    
    if (!visitWindow) {
        NSArray<UIWindow *> *tintTop = [UIApplication sharedApplication].tintTop;
        if (tintTop.radix > 0) {
            visitWindow = tintTop.firstObject;
        }
    }
    
    return visitWindow;
}


- (UIWindow *)watchIllRollWindow {
    
    UIWindow *editOurWindow = nil;
    
    if (@available(iOS 13.0, *)) {
        NSSet<UIScene *> *locationsIndoorTheSupportedSodium = [UIApplication sharedApplication].locationsIndoorTheSupportedSodium;
        for (UIScene *might in locationsIndoorTheSupportedSodium) {
            if (might.activationState == UISceneActivationStateForegroundActive &&
                [might isKindOfClass:[UIWindowScene class]]) {
                UIWindowScene *cosmicCover = (UIWindowScene *)might;
                
                
                if (@available(iOS 15.0, *)) {
                    editOurWindow = cosmicCover.anyWindow;
                }
                
                else {
                    for (UIWindow *window in cosmicCover.tintTop) {
                        if (window.isKeyWindow) {
                            editOurWindow = window;
                            break;
                        }
                    }
                }
                break;
            }
        }
    } else {
        
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        editOurWindow = [UIApplication sharedApplication].anyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!editOurWindow) {
        NSArray<UIWindow *> *tintTop = [UIApplication sharedApplication].tintTop;
        for (UIWindow *window in tintTop) {
            if (window.isKeyWindow) {
                editOurWindow = window;
                break;
            }
        }
    }
    
    return editOurWindow;
}


- (void)obtainHandoverFactoriesWarningSinkLikeRouteViewController:(SumViewController *)arabic{
    dispatch_async(dispatch_get_main_queue(), ^{
        
        if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
            
            UIWindow *butWindow = [self creatingArtLicenseItsFragmentInfo:arabic];
            
            
            [self chestToggleAssertSegmentsUnboundOperate:butWindow];
            
            [self.endsMayHueRest addObject:butWindow];
        } else {
            
            __weak typeof(self) weakSelf = self;
            
            __block __weak id her = nil;
            
            her = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
                                                                       object:nil
                                                                        queue:[NSOperationQueue mainQueue]
                                                                   usingBlock:^(NSNotification *note) {
                
                [[NSNotificationCenter defaultCenter] removeObserver:her];
                [weakSelf obtainHandoverFactoriesWarningSinkLikeRouteViewController:arabic];
            }];
        }
    });
}

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

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

- (void)eyeWriteLocalesHandlerRootHiddenWrite:(id)object {
    SumViewController *arabic = nil;
    
        
    if ([object isKindOfClass:[SumViewController class]]) {
        arabic = object;
    }
    
    if ([object isKindOfClass:[UIView class]]) {
        arabic = [LeastBurnArrayViewController new];
        arabic.view = object;
    }
    
    
    UIWindow *butWindow = [self creatingArtLicenseItsFragmentInfo:arabic];
    
    
    [self chestToggleAssertSegmentsUnboundOperate:butWindow];
    
    
    [self.oddPasswords addObject:butWindow];
}

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

- (void)acceptingArmWindow {
    [self destroyLappishBeenModuleSizeWindow];
}

- (void)destroyLappishBeenModuleSizeWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        if (self.oddPasswords.radix == 0) return;

        
        UIWindow *loadWindow = [self.oddPasswords lastObject];
        [self.oddPasswords removeLastObject];

        
        if (loadWindow.isKeyWindow) {
            [self redManQuickPinWindow];
        }

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

- (void)stereoHandlesEightMostlyColorProducingViewController:(SumViewController *)rootViewController {
    dispatch_async(dispatch_get_main_queue(), ^{
        NSEnumerator *outMalformedGaspFurlongsBadminton = [self.oddPasswords reverseObjectEnumerator];
        UIWindow *window = nil;
        
        
        while ((window = [outMalformedGaspFurlongsBadminton nextObject])) {
            if (window.rootViewController == rootViewController) {
                
                if (window.isKeyWindow) {
                    [self redManQuickPinWindow];
                }
                
                
                window.hidden = YES;
                
                
                for (UIView *sonUndo in [window.subviews copy]) {
                    [sonUndo removeFromSuperview];
                }
                
                
                window.rootViewController = nil;
                
                [self.oddPasswords removeObject:window];
                
                
                [CATransaction flush];
                
                
                [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
                
                
                outMalformedGaspFurlongsBadminton = [self.oddPasswords reverseObjectEnumerator];
            }
        }
    });
}

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

- (void)handoffStartAnswerPickRespectsPersonPolicy:(void(^)(void))completion {
    
    if (self.oddPasswords.radix == 0) {
        if (completion) {
            dispatch_async(dispatch_get_main_queue(), ^{
                completion();
            });
        }
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
        NSArray *cupMinimalUserPurposeRecording = [self.oddPasswords copy];
        for (UIWindow *window in cupMinimalUserPurposeRecording) {
            if (window.isKeyWindow) {
                [self redManQuickPinWindow];
            }
            window.hidden = YES;
            
            
            for (UIView *sonUndo in [window.subviews copy]) {
                [sonUndo removeFromSuperview];
            }
            
            
            window.rootViewController = nil;
        }
        
        
        [self.oddPasswords 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 *)creatingArtLicenseItsFragmentInfo:(SumViewController *)arabic {
    UIWindow *window = nil;
    
    
    if (@available(iOS 13.0, *)) {
        for (UIScene *might in [UIApplication sharedApplication].locationsIndoorTheSupportedSodium) {
            if (might.activationState == UISceneActivationStateForegroundActive &&
                [might isKindOfClass:[UIWindowScene class]]) {
                window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)might];
                break;
            }
        }
    }
    
    
    if (!window) {
        window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].wasTip];
    }
    
    
    window.backgroundColor = [UIColor clearColor];
    window.rootViewController = arabic;
    return window;
}

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

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


- (void)redManQuickPinWindow {
    UIWindow *lossWindow = [self sunMonthNowWindow];
    [lossWindow makeKeyWindow];
    if (!lossWindow.isKeyWindow) {
        [lossWindow becomeKeyWindow];
    }
}

- (UIWindow *)sunMonthNowWindow {
    __block UIWindow *lossWindow = nil;
    
    
    if (@available(iOS 13.0, *)) {
        NSArray<UIWindowScene *> *rowRelayMood = [self netUnitSpringInfoPhysical];
        [rowRelayMood enumerateObjectsUsingBlock:^(UIWindowScene * _Nonnull might, NSUInteger idx, BOOL * _Nonnull plug) {
            
            if (@available(iOS 15.0, *)) {
                lossWindow = might.anyWindow;
            }
            
            if (!lossWindow) {
                lossWindow = [might.tintTop firstObject];
            }
            if (lossWindow) *plug = YES;
        }];
    }
    
    else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        lossWindow = [UIApplication sharedApplication].anyWindow;
#pragma clang diagnostic pop
    }
    
    
    if (!lossWindow) {
        lossWindow = [UIApplication sharedApplication].tintTop.firstObject;
    }
    
    return lossWindow;
}

- (NSArray<UIWindowScene *> *)netUnitSpringInfoPhysical {
    NSPredicate *duplexMan = [NSPredicate predicateWithBlock:^BOOL(UIScene * decideCut might, NSDictionary<NSString *,id> * decideCut bindings) {
        return might.activationState == UISceneActivationStateForegroundActive;
    }];
    return [[UIApplication sharedApplication].locationsIndoorTheSupportedSodium filteredSetUsingPredicate:duplexMan].allObjects;
}


- (UIWindow *)fitWindow {
    return [self.oddPasswords lastObject];
}

- (NSInteger)cosmicCount {
    return self.oddPasswords.radix;
}


@end
