






#import "BeaconsEggView.h"
#import "DeltaWarpManager.h"
#import "WinNeedHang.h"
#import "Masonry.h"

@interface BeaconsEggView ()

@property (nonatomic, strong) UIView *takeOptAudioBackgroundView;
@property (nonatomic, strong) UIActivityIndicatorView *arcadeLetterPointAssameseSwahili;
@property (nonatomic, strong) UILabel *manMustLabel;
@end

@implementation BeaconsEggView


static BeaconsEggView *certLoveValueView = nil;



- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self existView];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self existView];
    }
    return self;
}
- (void)existView {
    
    
    self.takeOptAudioBackgroundView = [UIView new];
    self.takeOptAudioBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    self.takeOptAudioBackgroundView.layer.cornerRadius = 2.0;
    self.takeOptAudioBackgroundView.clipsToBounds = YES;
    [self addSubview:self.takeOptAudioBackgroundView];
    
    
    self.arcadeLetterPointAssameseSwahili = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
    self.arcadeLetterPointAssameseSwahili.color = WinNeedHang.suspendedColor;
    [self.takeOptAudioBackgroundView addSubview:self.arcadeLetterPointAssameseSwahili];
    
    
    self.manMustLabel = [[UILabel alloc] init];
    self.manMustLabel.text = WinNeedHang.mapSonInputIll.cutoffBadFax;
    self.manMustLabel.textColor = [UIColor whiteColor];
    self.manMustLabel.font = [UIFont systemFontOfSize:14];
    self.manMustLabel.numberOfLines = 0;
    self.manMustLabel.textAlignment = NSTextAlignmentCenter;
    [self.takeOptAudioBackgroundView addSubview:self.manMustLabel];
    
    
    [self.takeOptAudioBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(WinNeedHang.chargePenSin.allHardOptWin, WinNeedHang.chargePenSin.allHardOptWin));
        make.center.equalTo(self);
    }];
    
    [self.arcadeLetterPointAssameseSwahili mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(WinNeedHang.chargePenSin.chromeWeekly);
        make.centerX.equalTo(self.takeOptAudioBackgroundView.mas_centerX);
    }];
    
    [self.manMustLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.arcadeLetterPointAssameseSwahili.mas_bottom).offset(WinNeedHang.chargePenSin.chromeWeekly);
        make.centerX.equalTo(self.takeOptAudioBackgroundView.mas_centerX);
        make.left.equalTo(self.takeOptAudioBackgroundView.mas_left).offset(WinNeedHang.chargePenSin.useMayPrime);
        make.right.equalTo(self.takeOptAudioBackgroundView.mas_right).offset(-WinNeedHang.chargePenSin.useMayPrime);
    }];
    
    
    self.hidden = YES;
}



- (void)startAnimating {
    self.hidden = NO;
    [self.arcadeLetterPointAssameseSwahili startAnimating];
}

- (void)stopAnimating {
    [self.arcadeLetterPointAssameseSwahili stopAnimating];
    self.hidden = YES;
}

- (void)safariSpanText:(NSString *)text {
    self.manMustLabel.text = text;
    
    
    CGFloat pathWidth = [text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:@{NSFontAttributeName: self.manMustLabel.font}
                                          context:nil].size.width;
    UIWindow *window = [[DeltaWarpManager shared] inferiorsWaxWindow];
    CGFloat regionsWidth = MIN(MAX(120, pathWidth + 2 * 8), window.bounds.size.width);
    [self.takeOptAudioBackgroundView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(regionsWidth);
    }];
    
    [self layoutIfNeeded];
}


+ (void)fixNonceTowerWindow {
    [self installsZipMapTagThousandPermuteText:WinNeedHang.mapSonInputIll.cutoffBadFax];
}

+ (void)installsZipMapTagThousandPermuteText:(NSString *)text {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIWindow *window = [[DeltaWarpManager shared] inferiorsWaxWindow];
        
        if (!certLoveValueView) {
            CGSize size = UIScreen.mainScreen.bounds.size;
            certLoveValueView = [[BeaconsEggView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            certLoveValueView.center = window.center;
        }
        if (!certLoveValueView.superview) {
            [window addSubview:certLoveValueView];
        }
        [certLoveValueView safariSpanText:text];
        [certLoveValueView startAnimating];
    });
}

+ (void)menPostRelationsClipDisallowWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        [certLoveValueView stopAnimating];
        [certLoveValueView removeFromSuperview];
        certLoveValueView = nil;
    });
}


+ (BeaconsEggView *)waxBedHashHerView:(UIView *)view {
    return [self waxBedHashHerView:view withText:WinNeedHang.mapSonInputIll.cutoffBadFax];
}

+ (BeaconsEggView *)waxBedHashHerView:(UIView *)view withText:(NSString *)text {
    __block BeaconsEggView *loadingView = nil;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        loadingView = [[BeaconsEggView alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)];
        loadingView.center = CGPointMake(CGRectGetMidX(view.bounds), CGRectGetMidY(view.bounds));
        [loadingView safariSpanText:text];
        [loadingView startAnimating];
        [view addSubview:loadingView];
    });
    return loadingView;
}

+ (void)bracketedWateryDiscountMetricsWaitView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIView *closest in view.subviews) {
            if ([closest isKindOfClass:[BeaconsEggView class]]) {
                [(BeaconsEggView *)closest stopAnimating];
                [closest removeFromSuperview];
            }
        }
    });
}

@end
