






#import "ArtAlertView.h"
#import "LearnWeekly.h"
#import "HockeySeeManager.h"
#import "Masonry.h"

#define logRole(bin) __weak typeof(bin) weak##bin = bin;
#define inferPink(bin) __strong typeof(bin) bin = weak##bin;

@interface ArtAlertView()

@property (nonatomic, strong) UIView *daySeedUnitEyeView;
@property (nonatomic, copy) BendBufferingParseLiteralStopUrgency completion;
@property (nonatomic, strong) UIStackView *languagePoloView;

@end

@implementation ArtAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   dogAccessory:(NSArray<NSString *> *)dogAccessory
                     completion:(BendBufferingParseLiteralStopUrgency)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.daySeedUnitEyeView = [[UIView alloc] init];
        self.daySeedUnitEyeView.backgroundColor = [LearnWeekly youBorderColor];
        self.daySeedUnitEyeView.layer.cornerRadius = LearnWeekly.reuseRenewal.fatExpectDue;
        self.daySeedUnitEyeView.clipsToBounds = YES;
        self.daySeedUnitEyeView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.daySeedUnitEyeView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.daySeedUnitEyeView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.daySeedUnitEyeView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.daySeedUnitEyeView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *topSpineView = nil;
        CGFloat escapedVitaminLacrosseBuddhistSob = 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.daySeedUnitEyeView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.topAnchor constant:escapedVitaminLacrosseBuddhistSob],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.trailingAnchor constant:-16]
            ]];
            
            topSpineView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *tabFlagLabel = [[UILabel alloc] init];
            tabFlagLabel.text = message;
            tabFlagLabel.textColor = UIColor.whiteColor;
            tabFlagLabel.font = [UIFont systemFontOfSize:15];
            tabFlagLabel.textAlignment = NSTextAlignmentCenter;
            tabFlagLabel.numberOfLines = 0;
            tabFlagLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.daySeedUnitEyeView addSubview:tabFlagLabel];
            
            NSLayoutYAxisAnchor *topAnchor = topSpineView ? topSpineView.bottomAnchor : self.daySeedUnitEyeView.topAnchor;
            CGFloat pullTryOld = topSpineView ? 10 : escapedVitaminLacrosseBuddhistSob;
            [NSLayoutConstraint activateConstraints:@[
                [tabFlagLabel.topAnchor constraintEqualToAnchor:topAnchor constant:pullTryOld],
                [tabFlagLabel.leadingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.leadingAnchor constant:16],
                [tabFlagLabel.trailingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.trailingAnchor constant:-16]
            ]];
            topSpineView = tabFlagLabel;
        }
        
        
        self.languagePoloView = [[UIStackView alloc] init];
        self.languagePoloView.axis = UILayoutConstraintAxisVertical;
        self.languagePoloView.spacing = 1;  
        self.languagePoloView.distribution = UIStackViewDistributionFillEqually;
        self.languagePoloView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.daySeedUnitEyeView addSubview:self.languagePoloView];
        
        
        NSLayoutYAxisAnchor *unionEyeNameSongRequire = topSpineView ? topSpineView.bottomAnchor : self.daySeedUnitEyeView.topAnchor;
        CGFloat streamedEyeMillionPubShow = topSpineView ? escapedVitaminLacrosseBuddhistSob : escapedVitaminLacrosseBuddhistSob;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.languagePoloView.topAnchor constraintEqualToAnchor:unionEyeNameSongRequire constant:streamedEyeMillionPubShow],
            [self.languagePoloView.leadingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.leadingAnchor],
            [self.languagePoloView.trailingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.trailingAnchor],
            [self.languagePoloView.bottomAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.bottomAnchor]
        ]];
        
        
       
       if (dogAccessory.count == 2) {
           
           self.languagePoloView = [[UIStackView alloc] init];
           self.languagePoloView.axis = UILayoutConstraintAxisHorizontal;
           self.languagePoloView.distribution = UIStackViewDistributionFillEqually;
           self.languagePoloView.spacing = 1;  
           self.languagePoloView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.daySeedUnitEyeView addSubview:self.languagePoloView];
           
           NSLayoutYAxisAnchor *unionEyeNameSongRequire = topSpineView ? topSpineView.bottomAnchor : self.daySeedUnitEyeView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.languagePoloView.topAnchor constraintEqualToAnchor:unionEyeNameSongRequire constant:escapedVitaminLacrosseBuddhistSob],
               [self.languagePoloView.leadingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.leadingAnchor],
               [self.languagePoloView.trailingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.trailingAnchor],
               [self.languagePoloView.bottomAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < dogAccessory.count; i++) {
               NSString *onceTone = dogAccessory[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:onceTone forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[LearnWeekly youBorderColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(watchCenters:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.languagePoloView addArrangedSubview:button];
           }
       } else {
           
           self.languagePoloView = [[UIStackView alloc] init];
           self.languagePoloView.axis = UILayoutConstraintAxisVertical;
           self.languagePoloView.spacing = 1;
           self.languagePoloView.distribution = UIStackViewDistributionFillEqually;
           self.languagePoloView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.daySeedUnitEyeView addSubview:self.languagePoloView];
           
           NSLayoutYAxisAnchor *unionEyeNameSongRequire = topSpineView ? topSpineView.bottomAnchor : self.daySeedUnitEyeView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.languagePoloView.topAnchor constraintEqualToAnchor:unionEyeNameSongRequire constant:escapedVitaminLacrosseBuddhistSob],
               [self.languagePoloView.leadingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.leadingAnchor],
               [self.languagePoloView.trailingAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.trailingAnchor],
               [self.languagePoloView.bottomAnchor constraintEqualToAnchor:self.daySeedUnitEyeView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < dogAccessory.count; i++) {
               NSString *onceTone = dogAccessory[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:onceTone forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[LearnWeekly youBorderColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(watchCenters:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.languagePoloView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)latencySawBlindingRankedPolarMean:(NSString *)title
                        message:(NSString *)message
                   dogAccessory:(NSArray<NSString *> *)dogAccessory
                     completion:(BendBufferingParseLiteralStopUrgency)completion {
    
    ArtAlertView *split = [[ArtAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          dogAccessory:dogAccessory
                                            completion:completion];
    
    
    [HockeySeeManager.shared spanChatterGraphicsPlanarBehaveSectionView:split];
    
    
    split.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        split.alpha = 1.0;
    }];
}

+ (void)latencySawBlindingRankedPolarMean:(NSString *)title message:(NSString *)message completion:(BendBufferingParseLiteralStopUrgency)completion {
    [self latencySawBlindingRankedPolarMean:title message:message dogAccessory:@[LearnWeekly.estonianBanner.nominal] completion:completion];
}

@end
