






#import "NetAlertView.h"
#import "PrintFarFor.h"
#import "WeekStripManager.h"
#import "Masonry.h"

#define theBand(son) __weak typeof(son) weak##son = son;
#define illReturn(son) __strong typeof(son) son = weak##son;

@interface NetAlertView()

@property (nonatomic, strong) UIView *endFlowSizeOldView;
@property (nonatomic, copy) NetworkPermittedGarbageModeActiveDry completion;
@property (nonatomic, strong) UIStackView *disposeErrorView;

@end

@implementation NetAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   maleDayShort:(NSArray<NSString *> *)maleDayShort
                     completion:(NetworkPermittedGarbageModeActiveDry)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.endFlowSizeOldView = [[UIView alloc] init];
        self.endFlowSizeOldView.backgroundColor = [PrintFarFor expansionColor];
        self.endFlowSizeOldView.layer.cornerRadius = PrintFarFor.guideMaySelf.boxAbovePast;
        self.endFlowSizeOldView.clipsToBounds = YES;
        self.endFlowSizeOldView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.endFlowSizeOldView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.endFlowSizeOldView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.endFlowSizeOldView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.endFlowSizeOldView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *hardTrapView = nil;
        CGFloat looseFastAutoZipBankers = 20;
        
        
        if (title.length > 0) {
            UILabel *titleLabel = [[UILabel alloc] init];
            titleLabel.text = title;
            titleLabel.textColor = UIColor.whiteColor;
            titleLabel.font = [UIFont boldSystemFontOfSize:18];
            titleLabel.textAlignment = NSTextAlignmentCenter;
            titleLabel.numberOfLines = 0;
            titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.endFlowSizeOldView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.endFlowSizeOldView.topAnchor constant:looseFastAutoZipBankers],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.trailingAnchor constant:-16]
            ]];
            
            hardTrapView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *fontKitLabel = [[UILabel alloc] init];
            fontKitLabel.text = message;
            fontKitLabel.textColor = UIColor.whiteColor;
            fontKitLabel.font = [UIFont systemFontOfSize:15];
            fontKitLabel.textAlignment = NSTextAlignmentCenter;
            fontKitLabel.numberOfLines = 0;
            fontKitLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.endFlowSizeOldView addSubview:fontKitLabel];
            
            NSLayoutYAxisAnchor *topAnchor = hardTrapView ? hardTrapView.bottomAnchor : self.endFlowSizeOldView.topAnchor;
            CGFloat fiveWinTip = hardTrapView ? 10 : looseFastAutoZipBankers;
            [NSLayoutConstraint activateConstraints:@[
                [fontKitLabel.topAnchor constraintEqualToAnchor:topAnchor constant:fiveWinTip],
                [fontKitLabel.leadingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.leadingAnchor constant:16],
                [fontKitLabel.trailingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.trailingAnchor constant:-16]
            ]];
            hardTrapView = fontKitLabel;
        }
        
        
        self.disposeErrorView = [[UIStackView alloc] init];
        self.disposeErrorView.axis = UILayoutConstraintAxisVertical;
        self.disposeErrorView.spacing = 1;  
        self.disposeErrorView.distribution = UIStackViewDistributionFillEqually;
        self.disposeErrorView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.endFlowSizeOldView addSubview:self.disposeErrorView];
        
        
        NSLayoutYAxisAnchor *editUbiquityEligibleYearsStylus = hardTrapView ? hardTrapView.bottomAnchor : self.endFlowSizeOldView.topAnchor;
        CGFloat gigabytesWorkOddAlternateGradient = hardTrapView ? looseFastAutoZipBankers : looseFastAutoZipBankers;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.disposeErrorView.topAnchor constraintEqualToAnchor:editUbiquityEligibleYearsStylus constant:gigabytesWorkOddAlternateGradient],
            [self.disposeErrorView.leadingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.leadingAnchor],
            [self.disposeErrorView.trailingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.trailingAnchor],
            [self.disposeErrorView.bottomAnchor constraintEqualToAnchor:self.endFlowSizeOldView.bottomAnchor]
        ]];
        
        
       
       if (maleDayShort.count == 2) {
           
           self.disposeErrorView = [[UIStackView alloc] init];
           self.disposeErrorView.axis = UILayoutConstraintAxisHorizontal;
           self.disposeErrorView.distribution = UIStackViewDistributionFillEqually;
           self.disposeErrorView.spacing = 1;  
           self.disposeErrorView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.endFlowSizeOldView addSubview:self.disposeErrorView];
           
           NSLayoutYAxisAnchor *editUbiquityEligibleYearsStylus = hardTrapView ? hardTrapView.bottomAnchor : self.endFlowSizeOldView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.disposeErrorView.topAnchor constraintEqualToAnchor:editUbiquityEligibleYearsStylus constant:looseFastAutoZipBankers],
               [self.disposeErrorView.leadingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.leadingAnchor],
               [self.disposeErrorView.trailingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.trailingAnchor],
               [self.disposeErrorView.bottomAnchor constraintEqualToAnchor:self.endFlowSizeOldView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < maleDayShort.count; i++) {
               NSString *adoptIcy = maleDayShort[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:adoptIcy forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PrintFarFor expansionColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(resultsOffer:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.disposeErrorView addArrangedSubview:button];
           }
       } else {
           
           self.disposeErrorView = [[UIStackView alloc] init];
           self.disposeErrorView.axis = UILayoutConstraintAxisVertical;
           self.disposeErrorView.spacing = 1;
           self.disposeErrorView.distribution = UIStackViewDistributionFillEqually;
           self.disposeErrorView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.endFlowSizeOldView addSubview:self.disposeErrorView];
           
           NSLayoutYAxisAnchor *editUbiquityEligibleYearsStylus = hardTrapView ? hardTrapView.bottomAnchor : self.endFlowSizeOldView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.disposeErrorView.topAnchor constraintEqualToAnchor:editUbiquityEligibleYearsStylus constant:looseFastAutoZipBankers],
               [self.disposeErrorView.leadingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.leadingAnchor],
               [self.disposeErrorView.trailingAnchor constraintEqualToAnchor:self.endFlowSizeOldView.trailingAnchor],
               [self.disposeErrorView.bottomAnchor constraintEqualToAnchor:self.endFlowSizeOldView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < maleDayShort.count; i++) {
               NSString *adoptIcy = maleDayShort[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:adoptIcy forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PrintFarFor expansionColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(resultsOffer:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.disposeErrorView addArrangedSubview:button];
           }
       }
    }
    return self;
}

- (void)resultsOffer:(UIButton *)sender {
    
    [UIView animateWithDuration:0.25 animations:^{
        self.alpha = 0;
    } completion:^(BOOL finished) {
        [WeekStripManager.shared fourteenInfoWindow];
        
        if (self.completion) {
            self.completion(sender.tag);
        }
    }];
}

+ (void)ubiquityMildMileIntentMoreHello:(NSString *)title
                        message:(NSString *)message
                   maleDayShort:(NSArray<NSString *> *)maleDayShort
                     completion:(NetworkPermittedGarbageModeActiveDry)completion {
    
    NetAlertView *liter = [[NetAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          maleDayShort:maleDayShort
                                            completion:completion];
    
    
    [WeekStripManager.shared artistKeyOutTooLemmaThreadedView:liter];
    
    
    liter.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        liter.alpha = 1.0;
    }];
}

+ (void)ubiquityMildMileIntentMoreHello:(NSString *)title message:(NSString *)message completion:(NetworkPermittedGarbageModeActiveDry)completion {
    [self ubiquityMildMileIntentMoreHello:title message:message maleDayShort:@[PrintFarFor.tempSockJobHas.tenSong] completion:completion];
}

@end
