






#import "KinAlertView.h"
#import "UserArtRoot.h"
#import "MatchMenuManager.h"
#import "Masonry.h"

#define overdue(ear) __weak typeof(ear) weak##ear = ear;
#define thumbMask(ear) __strong typeof(ear) ear = weak##ear;

@interface KinAlertView()

@property (nonatomic, strong) UIView *flagColorAudioView;
@property (nonatomic, copy) AdjectiveTopArtworkActiveMixerDither completion;
@property (nonatomic, strong) UIStackView *visitHallFarView;

@end

@implementation KinAlertView

- (void)dealloc {
    
}

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

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

+ (void)solidFixMaxCookieFloorBecome:(NSString *)title
                        message:(NSString *)message
                   wasGlyphLazy:(NSArray<NSString *> *)wasGlyphLazy
                     completion:(AdjectiveTopArtworkActiveMixerDither)completion {
    
    KinAlertView *claim = [[KinAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          wasGlyphLazy:wasGlyphLazy
                                            completion:completion];
    
    
    [MatchMenuManager.shared offMinAtomWarpPressedMissingView:claim];
    
    
    claim.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        claim.alpha = 1.0;
    }];
}

+ (void)solidFixMaxCookieFloorBecome:(NSString *)title message:(NSString *)message completion:(AdjectiveTopArtworkActiveMixerDither)completion {
    [self solidFixMaxCookieFloorBecome:title message:message wasGlyphLazy:@[UserArtRoot.builtOwnSeeEar.gramToo] completion:completion];
}

@end
