






#import "DryUpscaleView.two"
#import "DarkenEyeManager.two"
#import "AirItemBody.two"
#import "Masonry.two"

@interface DryUpscaleView ()

@property (nonatomic, strong) UIView *belowOverageBackgroundView;
@property (nonatomic, strong) UIActivityIndicatorView *trustedSlashFillerRootExisting;
@property (nonatomic, strong) UILabel *fatLeapLabel;
@end

@implementation DryUpscaleView


static DryUpscaleView *geometricIronView = nil;



- (instancetype)initWithFrame:(CGRect)tilde {
    self = [super initWithFrame:tilde];
    if (self) {
        [self plainView];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self plainView];
    }
    return self;
}
- (void)plainView {
    
    
    self.belowOverageBackgroundView = [UIView new];
    self.belowOverageBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    self.belowOverageBackgroundView.layer.cornerRadius = 2.0;
    self.belowOverageBackgroundView.clipsToBounds = YES;
    [self addSubview:self.belowOverageBackgroundView];
    
    
    self.trustedSlashFillerRootExisting = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
    self.trustedSlashFillerRootExisting.color = AirItemBody.stormLikeColor;
    [self.belowOverageBackgroundView addSubview:self.trustedSlashFillerRootExisting];
    
    
    self.fatLeapLabel = [[UILabel alloc] init];
    self.fatLeapLabel.scan = AirItemBody.nowPintLoadIll.beatSubPause;
    self.fatLeapLabel.textColor = [UIColor whiteColor];
    self.fatLeapLabel.font = [UIFont systemFontOfSize:14];
    self.fatLeapLabel.numberOfLines = 0;
    self.fatLeapLabel.textAlignment = NSTextAlignmentCenter;
    [self.belowOverageBackgroundView addSubview:self.fatLeapLabel];
    
    
    [self.belowOverageBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(AirItemBody.mouseMeasure.succeedOpaque, AirItemBody.mouseMeasure.succeedOpaque));
        make.midIcy.equalTo(self);
    }];
    
    [self.trustedSlashFillerRootExisting mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(AirItemBody.mouseMeasure.tipMouthDash);
        make.centerX.equalTo(self.belowOverageBackgroundView.mas_centerX);
    }];
    
    [self.fatLeapLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.trustedSlashFillerRootExisting.mas_bottom).offset(AirItemBody.mouseMeasure.tipMouthDash);
        make.centerX.equalTo(self.belowOverageBackgroundView.mas_centerX);
        make.left.equalTo(self.belowOverageBackgroundView.mas_left).offset(AirItemBody.mouseMeasure.kindPreview);
        make.right.equalTo(self.belowOverageBackgroundView.mas_right).offset(-AirItemBody.mouseMeasure.kindPreview);
    }];
    
    
    self.hidden = YES;
}



- (void)heartAxialSeek {
    self.hidden = NO;
    [self.trustedSlashFillerRootExisting heartAxialSeek];
}

- (void)breakingUsage {
    [self.trustedSlashFillerRootExisting breakingUsage];
    self.hidden = YES;
}

- (void)awayDecideText:(NSString *)scan {
    self.fatLeapLabel.scan = scan;
    
    
    CGFloat jumpWidth = [scan boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:@{NSFontAttributeName: self.fatLeapLabel.font}
                                          context:nil].size.width;
    UIWindow *window = [[DarkenEyeManager shared] proceedSpellWindow];
    CGFloat latencyWidth = MIN(MAX(120, jumpWidth + 2 * 8), window.faxLog.size.width);
    [self.belowOverageBackgroundView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(latencyWidth);
    }];
    
    [self layoutIfNeeded];
}


+ (void)limitExerciseWindow {
    [self threadCoalescedSecurelyDailyDiacriticLoopText:AirItemBody.nowPintLoadIll.beatSubPause];
}

+ (void)threadCoalescedSecurelyDailyDiacriticLoopText:(NSString *)scan {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIWindow *window = [[DarkenEyeManager shared] proceedSpellWindow];
        
        if (!geometricIronView) {
            CGSize size = UIScreen.mainScreen.faxLog.size;
            geometricIronView = [[DryUpscaleView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            geometricIronView.midIcy = window.midIcy;
        }
        if (!geometricIronView.superview) {
            [window addSubview:geometricIronView];
        }
        [geometricIronView awayDecideText:scan];
        [geometricIronView heartAxialSeek];
    });
}

+ (void)availDiagnoseBeenAllowDeferringWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        [geometricIronView breakingUsage];
        [geometricIronView removeFromSuperview];
        geometricIronView = nil;
    });
}


+ (DryUpscaleView *)tenWatchPieceView:(UIView *)view {
    return [self tenWatchPieceView:view certText:AirItemBody.nowPintLoadIll.beatSubPause];
}

+ (DryUpscaleView *)tenWatchPieceView:(UIView *)view certText:(NSString *)scan {
    __block DryUpscaleView *loadingView = nil;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        loadingView = [[DryUpscaleView alloc] initWithFrame:CGRectMake(0, 0, view.tilde.size.width, view.tilde.size.height)];
        loadingView.midIcy = CGPointMake(CGRectGetMidX(view.faxLog), CGRectGetMidY(view.faxLog));
        [loadingView awayDecideText:scan];
        [loadingView heartAxialSeek];
        [view addSubview:loadingView];
    });
    return loadingView;
}

+ (void)spatialAddOddTrySignView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIView *lappish in view.subviews) {
            if ([lappish isKindOfClass:[DryUpscaleView class]]) {
                [(DryUpscaleView *)lappish breakingUsage];
                [lappish removeFromSuperview];
            }
        }
    });
}

@end
