






#import "UseAlertView.h"
#import "PintResting.h"
#import "IllBundleManager.h"
#import "Masonry.h"

#define eggWeek(kit) __weak typeof(kit) weak##kit = kit;
#define queryBlue(kit) __strong typeof(kit) kit = weak##kit;

@interface UseAlertView()

@property (nonatomic, strong) UIView *idleWinSeedTabView;
@property (nonatomic, copy) CaretSinSentencesLooperDismissSin completion;
@property (nonatomic, strong) UIStackView *cupAfterHardView;

@end

@implementation UseAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   auditHalfFix:(NSArray<NSString *> *)auditHalfFix
                     completion:(CaretSinSentencesLooperDismissSin)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.idleWinSeedTabView = [[UIView alloc] init];
        self.idleWinSeedTabView.backgroundColor = [PintResting armHelperColor];
        self.idleWinSeedTabView.layer.cornerRadius = PintResting.findClickCat.tomorrowCase;
        self.idleWinSeedTabView.clipsToBounds = YES;
        self.idleWinSeedTabView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.idleWinSeedTabView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.idleWinSeedTabView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.idleWinSeedTabView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.idleWinSeedTabView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *turnToolView = nil;
        CGFloat modelArraySindhiSpecifyAddition = 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.idleWinSeedTabView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.idleWinSeedTabView.topAnchor constant:modelArraySindhiSpecifyAddition],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.trailingAnchor constant:-16]
            ]];
            
            turnToolView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *faxPassLabel = [[UILabel alloc] init];
            faxPassLabel.text = message;
            faxPassLabel.textColor = UIColor.whiteColor;
            faxPassLabel.font = [UIFont systemFontOfSize:15];
            faxPassLabel.textAlignment = NSTextAlignmentCenter;
            faxPassLabel.numberOfLines = 0;
            faxPassLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.idleWinSeedTabView addSubview:faxPassLabel];
            
            NSLayoutYAxisAnchor *topAnchor = turnToolView ? turnToolView.bottomAnchor : self.idleWinSeedTabView.topAnchor;
            CGFloat agentHertz = turnToolView ? 10 : modelArraySindhiSpecifyAddition;
            [NSLayoutConstraint activateConstraints:@[
                [faxPassLabel.topAnchor constraintEqualToAnchor:topAnchor constant:agentHertz],
                [faxPassLabel.leadingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.leadingAnchor constant:16],
                [faxPassLabel.trailingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.trailingAnchor constant:-16]
            ]];
            turnToolView = faxPassLabel;
        }
        
        
        self.cupAfterHardView = [[UIStackView alloc] init];
        self.cupAfterHardView.axis = UILayoutConstraintAxisVertical;
        self.cupAfterHardView.spacing = 1;  
        self.cupAfterHardView.distribution = UIStackViewDistributionFillEqually;
        self.cupAfterHardView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.idleWinSeedTabView addSubview:self.cupAfterHardView];
        
        
        NSLayoutYAxisAnchor *affineDividingFrictionRelayDivide = turnToolView ? turnToolView.bottomAnchor : self.idleWinSeedTabView.topAnchor;
        CGFloat checkGreenRomanianTriggerDemand = turnToolView ? modelArraySindhiSpecifyAddition : modelArraySindhiSpecifyAddition;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.cupAfterHardView.topAnchor constraintEqualToAnchor:affineDividingFrictionRelayDivide constant:checkGreenRomanianTriggerDemand],
            [self.cupAfterHardView.leadingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.leadingAnchor],
            [self.cupAfterHardView.trailingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.trailingAnchor],
            [self.cupAfterHardView.bottomAnchor constraintEqualToAnchor:self.idleWinSeedTabView.bottomAnchor]
        ]];
        
        
       
       if (auditHalfFix.count == 2) {
           
           self.cupAfterHardView = [[UIStackView alloc] init];
           self.cupAfterHardView.axis = UILayoutConstraintAxisHorizontal;
           self.cupAfterHardView.distribution = UIStackViewDistributionFillEqually;
           self.cupAfterHardView.spacing = 1;  
           self.cupAfterHardView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.idleWinSeedTabView addSubview:self.cupAfterHardView];
           
           NSLayoutYAxisAnchor *affineDividingFrictionRelayDivide = turnToolView ? turnToolView.bottomAnchor : self.idleWinSeedTabView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.cupAfterHardView.topAnchor constraintEqualToAnchor:affineDividingFrictionRelayDivide constant:modelArraySindhiSpecifyAddition],
               [self.cupAfterHardView.leadingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.leadingAnchor],
               [self.cupAfterHardView.trailingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.trailingAnchor],
               [self.cupAfterHardView.bottomAnchor constraintEqualToAnchor:self.idleWinSeedTabView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < auditHalfFix.count; i++) {
               NSString *rankMust = auditHalfFix[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:rankMust forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PintResting armHelperColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(launchingDog:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.cupAfterHardView addArrangedSubview:button];
           }
       } else {
           
           self.cupAfterHardView = [[UIStackView alloc] init];
           self.cupAfterHardView.axis = UILayoutConstraintAxisVertical;
           self.cupAfterHardView.spacing = 1;
           self.cupAfterHardView.distribution = UIStackViewDistributionFillEqually;
           self.cupAfterHardView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.idleWinSeedTabView addSubview:self.cupAfterHardView];
           
           NSLayoutYAxisAnchor *affineDividingFrictionRelayDivide = turnToolView ? turnToolView.bottomAnchor : self.idleWinSeedTabView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.cupAfterHardView.topAnchor constraintEqualToAnchor:affineDividingFrictionRelayDivide constant:modelArraySindhiSpecifyAddition],
               [self.cupAfterHardView.leadingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.leadingAnchor],
               [self.cupAfterHardView.trailingAnchor constraintEqualToAnchor:self.idleWinSeedTabView.trailingAnchor],
               [self.cupAfterHardView.bottomAnchor constraintEqualToAnchor:self.idleWinSeedTabView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < auditHalfFix.count; i++) {
               NSString *rankMust = auditHalfFix[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:rankMust forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PintResting armHelperColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(launchingDog:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.cupAfterHardView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)succeededTopPoolClipDanceQuerying:(NSString *)title
                        message:(NSString *)message
                   auditHalfFix:(NSArray<NSString *> *)auditHalfFix
                     completion:(CaretSinSentencesLooperDismissSin)completion {
    
    UseAlertView *smile = [[UseAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          auditHalfFix:auditHalfFix
                                            completion:completion];
    
    
    [IllBundleManager.shared intensityKeepStillSplitAreRespondsView:smile];
    
    
    smile.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        smile.alpha = 1.0;
    }];
}

+ (void)succeededTopPoolClipDanceQuerying:(NSString *)title message:(NSString *)message completion:(CaretSinSentencesLooperDismissSin)completion {
    [self succeededTopPoolClipDanceQuerying:title message:message auditHalfFix:@[PintResting.exposeLeapAuto.checker] completion:completion];
}

@end
