






#import "SheAlertView.h"
#import "HisTwoEject.h"
#import "VolumeAddManager.h"
#import "Masonry.h"

#define foodHow(men) __weak typeof(men) weak##men = men;
#define manySurge(men) __strong typeof(men) men = weak##men;

@interface SheAlertView()

@property (nonatomic, strong) UIView *hasOneCanLooseView;
@property (nonatomic, copy) FitPerformerBankObscuredKurdishDictation completion;
@property (nonatomic, strong) UIStackView *buddyDustKinView;

@end

@implementation SheAlertView

- (void)dealloc {
    
}

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

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

+ (void)portraitGrayWaitSawBothMagnitude:(NSString *)title
                        message:(NSString *)message
                   hourNorthBut:(NSArray<NSString *> *)hourNorthBut
                     completion:(FitPerformerBankObscuredKurdishDictation)completion {
    
    SheAlertView *china = [[SheAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          hourNorthBut:hourNorthBut
                                            completion:completion];
    
    
    [VolumeAddManager.shared croatianLocalizedKernelUsageSlantChainView:china];
    
    
    china.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        china.alpha = 1.0;
    }];
}

+ (void)portraitGrayWaitSawBothMagnitude:(NSString *)title message:(NSString *)message completion:(FitPerformerBankObscuredKurdishDictation)completion {
    [self portraitGrayWaitSawBothMagnitude:title message:message hourNorthBut:@[HisTwoEject.nineEchoArmpit.wasMute] completion:completion];
}

@end
