






#import "TipAlertView.h"
#import "PartialBest.h"
#import "HelloFormManager.h"
#import "Masonry.h"

#define revoked(car) __weak typeof(car) weak##car = car;
#define pageChild(car) __strong typeof(car) car = weak##car;

@interface TipAlertView()

@property (nonatomic, strong) UIView *serialSortLoopView;
@property (nonatomic, copy) ExtraFixDrawCoverSixChecking completion;
@property (nonatomic, strong) UIStackView *rootExactYetView;

@end

@implementation TipAlertView

- (void)dealloc {
    
}

- (instancetype)initWithFrame:(CGRect)frame
                          title:(NSString *)title
                        message:(NSString *)message
                   eggNoteRadix:(NSArray<NSString *> *)eggNoteRadix
                     completion:(ExtraFixDrawCoverSixChecking)completion {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
        self.completion = completion;
        
        
        self.serialSortLoopView = [[UIView alloc] init];
        self.serialSortLoopView.backgroundColor = [PartialBest turnOtherColor];
        self.serialSortLoopView.layer.cornerRadius = PartialBest.mouseEarlier.barSceneEasy;
        self.serialSortLoopView.clipsToBounds = YES;
        self.serialSortLoopView.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:self.serialSortLoopView];
        
        
        [NSLayoutConstraint activateConstraints:@[
            [self.serialSortLoopView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
            [self.serialSortLoopView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor],
            [self.serialSortLoopView.widthAnchor constraintEqualToConstant:270]
        ]];
        
        
        UIView *sinkSideView = nil;
        CGFloat renderCervicalNumbersSubtitlesUbiquity = 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.serialSortLoopView addSubview:titleLabel];
            
            [NSLayoutConstraint activateConstraints:@[
                [titleLabel.topAnchor constraintEqualToAnchor:self.serialSortLoopView.topAnchor constant:renderCervicalNumbersSubtitlesUbiquity],
                [titleLabel.leadingAnchor constraintEqualToAnchor:self.serialSortLoopView.leadingAnchor constant:16],
                [titleLabel.trailingAnchor constraintEqualToAnchor:self.serialSortLoopView.trailingAnchor constant:-16]
            ]];
            
            sinkSideView = titleLabel;
        }
        
        
        if (message.length > 0) {
            UILabel *rebuildLabel = [[UILabel alloc] init];
            rebuildLabel.text = message;
            rebuildLabel.textColor = UIColor.whiteColor;
            rebuildLabel.font = [UIFont systemFontOfSize:15];
            rebuildLabel.textAlignment = NSTextAlignmentCenter;
            rebuildLabel.numberOfLines = 0;
            rebuildLabel.translatesAutoresizingMaskIntoConstraints = NO;
            [self.serialSortLoopView addSubview:rebuildLabel];
            
            NSLayoutYAxisAnchor *topAnchor = sinkSideView ? sinkSideView.bottomAnchor : self.serialSortLoopView.topAnchor;
            CGFloat flowEyeMix = sinkSideView ? 10 : renderCervicalNumbersSubtitlesUbiquity;
            [NSLayoutConstraint activateConstraints:@[
                [rebuildLabel.topAnchor constraintEqualToAnchor:topAnchor constant:flowEyeMix],
                [rebuildLabel.leadingAnchor constraintEqualToAnchor:self.serialSortLoopView.leadingAnchor constant:16],
                [rebuildLabel.trailingAnchor constraintEqualToAnchor:self.serialSortLoopView.trailingAnchor constant:-16]
            ]];
            sinkSideView = rebuildLabel;
        }
        
        
        self.rootExactYetView = [[UIStackView alloc] init];
        self.rootExactYetView.axis = UILayoutConstraintAxisVertical;
        self.rootExactYetView.spacing = 1;  
        self.rootExactYetView.distribution = UIStackViewDistributionFillEqually;
        self.rootExactYetView.translatesAutoresizingMaskIntoConstraints = NO;
        [self.serialSortLoopView addSubview:self.rootExactYetView];
        
        
        NSLayoutYAxisAnchor *nodeEyeDelayedDecryptedPen = sinkSideView ? sinkSideView.bottomAnchor : self.serialSortLoopView.topAnchor;
        CGFloat oldCreateRetrieveBufferingMargins = sinkSideView ? renderCervicalNumbersSubtitlesUbiquity : renderCervicalNumbersSubtitlesUbiquity;
        
        [NSLayoutConstraint activateConstraints:@[
            [self.rootExactYetView.topAnchor constraintEqualToAnchor:nodeEyeDelayedDecryptedPen constant:oldCreateRetrieveBufferingMargins],
            [self.rootExactYetView.leadingAnchor constraintEqualToAnchor:self.serialSortLoopView.leadingAnchor],
            [self.rootExactYetView.trailingAnchor constraintEqualToAnchor:self.serialSortLoopView.trailingAnchor],
            [self.rootExactYetView.bottomAnchor constraintEqualToAnchor:self.serialSortLoopView.bottomAnchor]
        ]];
        
        
       
       if (eggNoteRadix.count == 2) {
           
           self.rootExactYetView = [[UIStackView alloc] init];
           self.rootExactYetView.axis = UILayoutConstraintAxisHorizontal;
           self.rootExactYetView.distribution = UIStackViewDistributionFillEqually;
           self.rootExactYetView.spacing = 1;  
           self.rootExactYetView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.serialSortLoopView addSubview:self.rootExactYetView];
           
           NSLayoutYAxisAnchor *nodeEyeDelayedDecryptedPen = sinkSideView ? sinkSideView.bottomAnchor : self.serialSortLoopView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.rootExactYetView.topAnchor constraintEqualToAnchor:nodeEyeDelayedDecryptedPen constant:renderCervicalNumbersSubtitlesUbiquity],
               [self.rootExactYetView.leadingAnchor constraintEqualToAnchor:self.serialSortLoopView.leadingAnchor],
               [self.rootExactYetView.trailingAnchor constraintEqualToAnchor:self.serialSortLoopView.trailingAnchor],
               [self.rootExactYetView.bottomAnchor constraintEqualToAnchor:self.serialSortLoopView.bottomAnchor]
           ]];
           
           
           for (NSInteger i = 0; i < eggNoteRadix.count; i++) {
               NSString *collapse = eggNoteRadix[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:collapse forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PartialBest turnOtherColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(catInterrupt:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.rootExactYetView addArrangedSubview:button];
           }
       } else {
           
           self.rootExactYetView = [[UIStackView alloc] init];
           self.rootExactYetView.axis = UILayoutConstraintAxisVertical;
           self.rootExactYetView.spacing = 1;
           self.rootExactYetView.distribution = UIStackViewDistributionFillEqually;
           self.rootExactYetView.translatesAutoresizingMaskIntoConstraints = NO;
           [self.serialSortLoopView addSubview:self.rootExactYetView];
           
           NSLayoutYAxisAnchor *nodeEyeDelayedDecryptedPen = sinkSideView ? sinkSideView.bottomAnchor : self.serialSortLoopView.topAnchor;
           [NSLayoutConstraint activateConstraints:@[
               [self.rootExactYetView.topAnchor constraintEqualToAnchor:nodeEyeDelayedDecryptedPen constant:renderCervicalNumbersSubtitlesUbiquity],
               [self.rootExactYetView.leadingAnchor constraintEqualToAnchor:self.serialSortLoopView.leadingAnchor],
               [self.rootExactYetView.trailingAnchor constraintEqualToAnchor:self.serialSortLoopView.trailingAnchor],
               [self.rootExactYetView.bottomAnchor constraintEqualToAnchor:self.serialSortLoopView.bottomAnchor]
           ]];
           
           for (NSInteger i = 0; i < eggNoteRadix.count; i++) {
               NSString *collapse = eggNoteRadix[i];
               UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
               [button setTitle:collapse forState:UIControlStateNormal];
               button.titleLabel.font = [UIFont systemFontOfSize:17];
               [button setTitleColor:[PartialBest turnOtherColor] forState:UIControlStateNormal];
               [button setTitleColor:UIColor.lightGrayColor forState:UIControlStateHighlighted];
               button.backgroundColor = [UIColor whiteColor];
               button.tag = i;
               [button addTarget:self action:@selector(catInterrupt:) forControlEvents:UIControlEventTouchUpInside];
               button.translatesAutoresizingMaskIntoConstraints = NO;
               [button.heightAnchor constraintEqualToConstant:40].active = YES;
               [self.rootExactYetView addArrangedSubview:button];
           }
       }
    }
    return self;
}

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

+ (void)tightRightPrefixedKilohertzDeletingUppercase:(NSString *)title
                        message:(NSString *)message
                   eggNoteRadix:(NSArray<NSString *> *)eggNoteRadix
                     completion:(ExtraFixDrawCoverSixChecking)completion {
    
    TipAlertView *proxy = [[TipAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          eggNoteRadix:eggNoteRadix
                                            completion:completion];
    
    
    [HelloFormManager.shared wideRatingsMaxLooseFinishedMayView:proxy];
    
    
    proxy.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        proxy.alpha = 1.0;
    }];
}

+ (void)tightRightPrefixedKilohertzDeletingUppercase:(NSString *)title message:(NSString *)message completion:(ExtraFixDrawCoverSixChecking)completion {
    [self tightRightPrefixedKilohertzDeletingUppercase:title message:message eggNoteRadix:@[PartialBest.itsOneFlowEasy.carWarp] completion:completion];
}

@end
