






#import "TenAlertView.h"
#import "BounceBrief.h"
#import "RecordingManager.h"
#import "Masonry.h"

#define packets(did) __weak typeof(did) weak##did = did;
#define insideCap(did) __strong typeof(did) did = weak##did;

@interface TenAlertView()

@property (nonatomic, strong) UIView *useBelowLawFarView;
@property (nonatomic, copy) AnySquaredStepInstancesExecFriend completion;
@property (nonatomic, strong) UIStackView *nameSmallFaxView;

@end

@implementation TenAlertView

- (void)dealloc {
    
}

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

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

+ (void)hisUndefinedInsertBehaviorsGeneralAccessed:(NSString *)title
                        message:(NSString *)message
                   angleDensity:(NSArray<NSString *> *)angleDensity
                     completion:(AnySquaredStepInstancesExecFriend)completion {
    
    TenAlertView *inset = [[TenAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          angleDensity:angleDensity
                                            completion:completion];
    
    
    [RecordingManager.shared hindiPlanOperatingSeedCupNativeView:inset];
    
    
    inset.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        inset.alpha = 1.0;
    }];
}

+ (void)hisUndefinedInsertBehaviorsGeneralAccessed:(NSString *)title message:(NSString *)message completion:(AnySquaredStepInstancesExecFriend)completion {
    [self hisUndefinedInsertBehaviorsGeneralAccessed:title message:message angleDensity:@[BounceBrief.airDigitSobSee.sheMole] completion:completion];
}

@end
