






#import "DryAlertView.h"
#import "MusicLowPen.h"
#import "BigCustomManager.h"
#import "Masonry.h"

#define failing(obj) __weak typeof(obj) weak##obj = obj;
#define stereoAge(obj) __strong typeof(obj) obj = weak##obj;

@interface DryAlertView()

@property (nonatomic, strong) UIView *hueAgeTabTightView;
@property (nonatomic, copy) HumanMatrixChineseProfileSheBounding completion;
@property (nonatomic, strong) UIStackView *smartArmMaleView;

@end

@implementation DryAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   boxFlatLossy:(NSArray<NSString *> *)boxFlatLossy
                     completion:(HumanMatrixChineseProfileSheBounding)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.hueAgeTabTightView = [[UIView alloc] init];
        self.hueAgeTabTightView.backgroundColor = [MusicLowPen markupOddColor];
        self.hueAgeTabTightView.layer.cornerRadius = 8.0;
        self.hueAgeTabTightView.clipsToBounds = YES;
        self.hueAgeTabTightView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.hueAgeTabTightView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.hueAgeTabTightView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.hueAgeTabTightView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.hueAgeTabTightView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *artCanonView = nil;
        CGFloat floatIgnoresGreatIndicatorHuman = 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.hueAgeTabTightView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.hueAgeTabTightView.topAnchor constant:floatIgnoresGreatIndicatorHuman],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.trailingAnchor constant:-16]
            ]];
            
            artCanonView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *howGrowLabel = [[UILabel alloc] init];
            howGrowLabel.text = message;
            howGrowLabel.textColor = UIColor.whiteColor;
            howGrowLabel.font = [UIFont systemFontOfSize:15];
            howGrowLabel.textAlignment = NSTextAlignmentCenter;
            howGrowLabel.numberOfLines = 0;
            howGrowLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.hueAgeTabTightView addSubview:howGrowLabel];
            
            NSLayoutYAxisAnchor *topAnchor = artCanonView ? artCanonView.bottomAnchor : self.hueAgeTabTightView.topAnchor;
            CGFloat yetTouches = artCanonView ? 10 : floatIgnoresGreatIndicatorHuman;
            [NSLayoutConstraint activateConstraints:@[
                [howGrowLabel.topAnchor constraintEqualToAnchor:topAnchor constant:yetTouches],
                [howGrowLabel.leadingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.leadingAnchor constant:16],
                [howGrowLabel.trailingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.trailingAnchor constant:-16]
            ]];
            artCanonView = howGrowLabel;
        }
        
        
        self.smartArmMaleView = [[UIStackView alloc] init];
        self.smartArmMaleView.axis = UILayoutConstraintAxisVertical;
        self.smartArmMaleView.spacing = 1;  
        self.smartArmMaleView.distribution = UIStackViewDistributionFillEqually;
        self.smartArmMaleView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.hueAgeTabTightView addSubview:self.smartArmMaleView];
        
        
        NSLayoutYAxisAnchor *takeScopeSidePaddleNegative = artCanonView ? artCanonView.bottomAnchor : self.hueAgeTabTightView.topAnchor;
        CGFloat limitedSortFullHandballLibraries = artCanonView ? floatIgnoresGreatIndicatorHuman : floatIgnoresGreatIndicatorHuman;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.smartArmMaleView.topAnchor constraintEqualToAnchor:takeScopeSidePaddleNegative constant:limitedSortFullHandballLibraries],
            [self.smartArmMaleView.leadingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.leadingAnchor],
            [self.smartArmMaleView.trailingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.trailingAnchor],
            [self.smartArmMaleView.bottomAnchor constraintEqualToAnchor:self.hueAgeTabTightView.bottomAnchor]
        ]];
        
        
       
       if (boxFlatLossy.count == 2) {
           
           self.smartArmMaleView = [[UIStackView alloc] init];
           self.smartArmMaleView.axis = UILayoutConstraintAxisHorizontal;
           self.smartArmMaleView.distribution = UIStackViewDistributionFillEqually;
           self.smartArmMaleView.spacing = 1;  
           self.smartArmMaleView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.hueAgeTabTightView addSubview:self.smartArmMaleView];
           
           NSLayoutYAxisAnchor *takeScopeSidePaddleNegative = artCanonView ? artCanonView.bottomAnchor : self.hueAgeTabTightView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.smartArmMaleView.topAnchor constraintEqualToAnchor:takeScopeSidePaddleNegative constant:floatIgnoresGreatIndicatorHuman],
               [self.smartArmMaleView.leadingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.leadingAnchor],
               [self.smartArmMaleView.trailingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.trailingAnchor],
               [self.smartArmMaleView.bottomAnchor constraintEqualToAnchor:self.hueAgeTabTightView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < boxFlatLossy.count; i++) {
               NSString *quietMid = boxFlatLossy[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:quietMid forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[MusicLowPen markupOddColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(unwrapWayHer:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.smartArmMaleView addArrangedSubview:button];
           }
       } else {
           
           self.smartArmMaleView = [[UIStackView alloc] init];
           self.smartArmMaleView.axis = UILayoutConstraintAxisVertical;
           self.smartArmMaleView.spacing = 1;
           self.smartArmMaleView.distribution = UIStackViewDistributionFillEqually;
           self.smartArmMaleView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.hueAgeTabTightView addSubview:self.smartArmMaleView];
           
           NSLayoutYAxisAnchor *takeScopeSidePaddleNegative = artCanonView ? artCanonView.bottomAnchor : self.hueAgeTabTightView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.smartArmMaleView.topAnchor constraintEqualToAnchor:takeScopeSidePaddleNegative constant:floatIgnoresGreatIndicatorHuman],
               [self.smartArmMaleView.leadingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.leadingAnchor],
               [self.smartArmMaleView.trailingAnchor constraintEqualToAnchor:self.hueAgeTabTightView.trailingAnchor],
               [self.smartArmMaleView.bottomAnchor constraintEqualToAnchor:self.hueAgeTabTightView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < boxFlatLossy.count; i++) {
               NSString *quietMid = boxFlatLossy[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:quietMid forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[MusicLowPen markupOddColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(unwrapWayHer:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.smartArmMaleView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)tightRelayPromptFixingSetupTruncated:(NSString *)title
                        message:(NSString *)message
                   boxFlatLossy:(NSArray<NSString *> *)boxFlatLossy
                     completion:(HumanMatrixChineseProfileSheBounding)completion {
    
    DryAlertView *inter = [[DryAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          boxFlatLossy:boxFlatLossy
                                            completion:completion];
    
    
    [BigCustomManager.shared featuresIrishAdditionsButArmenianMaskView:inter];
    
    
    inter.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        inter.alpha = 1.0;
    }];
}

+ (void)tightRelayPromptFixingSetupTruncated:(NSString *)title message:(NSString *)message completion:(HumanMatrixChineseProfileSheBounding)completion {
    [self tightRelayPromptFixingSetupTruncated:title message:message boxFlatLossy:@[MusicLowPen.mailCanSkinMid.dryTail] completion:completion];
}

@end
