






#import "GetAlertView.h"
#import "LambdaPatch.h"
#import "FiberRaceManager.h"
#import "Masonry.h"

#define seekJob(win) __weak typeof(win) weak##win = win;
#define tiedMouse(win) __strong typeof(win) win = weak##win;

@interface GetAlertView()

@property (nonatomic, strong) UIView *foldShadowLazyView;
@property (nonatomic, copy) FunDigitalOtherSeeEncodingHumidity completion;
@property (nonatomic, strong) UIStackView *noteTenExitsView;

@end

@implementation GetAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   optBikeCanon:(NSArray<NSString *> *)optBikeCanon
                     completion:(FunDigitalOtherSeeEncodingHumidity)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.foldShadowLazyView = [[UIView alloc] init];
        self.foldShadowLazyView.backgroundColor = [LambdaPatch menstrualColor];
        self.foldShadowLazyView.layer.cornerRadius = LambdaPatch.faxChildBend.likeBeganFit;
        self.foldShadowLazyView.clipsToBounds = YES;
        self.foldShadowLazyView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.foldShadowLazyView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.foldShadowLazyView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.foldShadowLazyView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.foldShadowLazyView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *planPairView = nil;
        CGFloat learnAffectingDutchExpandingWho = 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.foldShadowLazyView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.foldShadowLazyView.topAnchor constant:learnAffectingDutchExpandingWho],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.foldShadowLazyView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.foldShadowLazyView.trailingAnchor constant:-16]
            ]];
            
            planPairView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *workingLabel = [[UILabel alloc] init];
            workingLabel.text = message;
            workingLabel.textColor = UIColor.whiteColor;
            workingLabel.font = [UIFont systemFontOfSize:15];
            workingLabel.textAlignment = NSTextAlignmentCenter;
            workingLabel.numberOfLines = 0;
            workingLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.foldShadowLazyView addSubview:workingLabel];
            
            NSLayoutYAxisAnchor *topAnchor = planPairView ? planPairView.bottomAnchor : self.foldShadowLazyView.topAnchor;
            CGFloat caseHockey = planPairView ? 10 : learnAffectingDutchExpandingWho;
            [NSLayoutConstraint activateConstraints:@[
                [workingLabel.topAnchor constraintEqualToAnchor:topAnchor constant:caseHockey],
                [workingLabel.leadingAnchor constraintEqualToAnchor:self.foldShadowLazyView.leadingAnchor constant:16],
                [workingLabel.trailingAnchor constraintEqualToAnchor:self.foldShadowLazyView.trailingAnchor constant:-16]
            ]];
            planPairView = workingLabel;
        }
        
        
        self.noteTenExitsView = [[UIStackView alloc] init];
        self.noteTenExitsView.axis = UILayoutConstraintAxisVertical;
        self.noteTenExitsView.spacing = 1;  
        self.noteTenExitsView.distribution = UIStackViewDistributionFillEqually;
        self.noteTenExitsView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.foldShadowLazyView addSubview:self.noteTenExitsView];
        
        
        NSLayoutYAxisAnchor *eventualCleanBackQualifierMan = planPairView ? planPairView.bottomAnchor : self.foldShadowLazyView.topAnchor;
        CGFloat streamPlaybackParsecsRaceAlign = planPairView ? learnAffectingDutchExpandingWho : learnAffectingDutchExpandingWho;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.noteTenExitsView.topAnchor constraintEqualToAnchor:eventualCleanBackQualifierMan constant:streamPlaybackParsecsRaceAlign],
            [self.noteTenExitsView.leadingAnchor constraintEqualToAnchor:self.foldShadowLazyView.leadingAnchor],
            [self.noteTenExitsView.trailingAnchor constraintEqualToAnchor:self.foldShadowLazyView.trailingAnchor],
            [self.noteTenExitsView.bottomAnchor constraintEqualToAnchor:self.foldShadowLazyView.bottomAnchor]
        ]];
        
        
       
       if (optBikeCanon.count == 2) {
           
           self.noteTenExitsView = [[UIStackView alloc] init];
           self.noteTenExitsView.axis = UILayoutConstraintAxisHorizontal;
           self.noteTenExitsView.distribution = UIStackViewDistributionFillEqually;
           self.noteTenExitsView.spacing = 1;  
           self.noteTenExitsView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.foldShadowLazyView addSubview:self.noteTenExitsView];
           
           NSLayoutYAxisAnchor *eventualCleanBackQualifierMan = planPairView ? planPairView.bottomAnchor : self.foldShadowLazyView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.noteTenExitsView.topAnchor constraintEqualToAnchor:eventualCleanBackQualifierMan constant:learnAffectingDutchExpandingWho],
               [self.noteTenExitsView.leadingAnchor constraintEqualToAnchor:self.foldShadowLazyView.leadingAnchor],
               [self.noteTenExitsView.trailingAnchor constraintEqualToAnchor:self.foldShadowLazyView.trailingAnchor],
               [self.noteTenExitsView.bottomAnchor constraintEqualToAnchor:self.foldShadowLazyView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < optBikeCanon.count; i++) {
               NSString *penScore = optBikeCanon[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:penScore forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[LambdaPatch menstrualColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(tamilPutSpan:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.noteTenExitsView addArrangedSubview:button];
           }
       } else {
           
           self.noteTenExitsView = [[UIStackView alloc] init];
           self.noteTenExitsView.axis = UILayoutConstraintAxisVertical;
           self.noteTenExitsView.spacing = 1;
           self.noteTenExitsView.distribution = UIStackViewDistributionFillEqually;
           self.noteTenExitsView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.foldShadowLazyView addSubview:self.noteTenExitsView];
           
           NSLayoutYAxisAnchor *eventualCleanBackQualifierMan = planPairView ? planPairView.bottomAnchor : self.foldShadowLazyView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.noteTenExitsView.topAnchor constraintEqualToAnchor:eventualCleanBackQualifierMan constant:learnAffectingDutchExpandingWho],
               [self.noteTenExitsView.leadingAnchor constraintEqualToAnchor:self.foldShadowLazyView.leadingAnchor],
               [self.noteTenExitsView.trailingAnchor constraintEqualToAnchor:self.foldShadowLazyView.trailingAnchor],
               [self.noteTenExitsView.bottomAnchor constraintEqualToAnchor:self.foldShadowLazyView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < optBikeCanon.count; i++) {
               NSString *penScore = optBikeCanon[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:penScore forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[LambdaPatch menstrualColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(tamilPutSpan:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.noteTenExitsView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)collapsesButterflyCapturesKernelsPairInvite:(NSString *)title
                        message:(NSString *)message
                   optBikeCanon:(NSArray<NSString *> *)optBikeCanon
                     completion:(FunDigitalOtherSeeEncodingHumidity)completion {
    
    GetAlertView *tilde = [[GetAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          optBikeCanon:optBikeCanon
                                            completion:completion];
    
    
    [FiberRaceManager.shared sliderDiscountVerifySeeThermalEnteredView:tilde];
    
    
    tilde.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        tilde.alpha = 1.0;
    }];
}

+ (void)collapsesButterflyCapturesKernelsPairInvite:(NSString *)title message:(NSString *)message completion:(FunDigitalOtherSeeEncodingHumidity)completion {
    [self collapsesButterflyCapturesKernelsPairInvite:title message:message optBikeCanon:@[LambdaPatch.returnThatMode.feedTen] completion:completion];
}

@end
