






#import "FunAlertView.h"
#import "MainMinimal.h"
#import "VortexBusManager.h"
#import "Masonry.h"

#define growMix(bed) __weak typeof(bed) weak##bed = bed;
#define mayBridge(bed) __strong typeof(bed) bed = weak##bed;

@interface FunAlertView()

@property (nonatomic, strong) UIView *allPutSelfTurnView;
@property (nonatomic, copy) ForwardKernelAloneHandoffMirroredFood completion;
@property (nonatomic, strong) UIStackView *additionGainView;

@end

@implementation FunAlertView

- (void)dealloc {
    
}

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

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

+ (void)caretProcessedLinerPeriodicRegistrySerialize:(NSString *)title
                        message:(NSString *)message
                   sleepSongMay:(NSArray<NSString *> *)sleepSongMay
                     completion:(ForwardKernelAloneHandoffMirroredFood)completion {
    
    FunAlertView *alert = [[FunAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds
                                                 title:title
                                               message:message
                                          sleepSongMay:sleepSongMay
                                            completion:completion];
    
    
    [VortexBusManager.shared koreanStickySoftwareLazyClipViabilityView:alert];
    
    
    alert.alpha = 0.0;
    [UIView animateWithDuration:0.25 animations:^{
        alert.alpha = 1.0;
    }];
}

+ (void)caretProcessedLinerPeriodicRegistrySerialize:(NSString *)title message:(NSString *)message completion:(ForwardKernelAloneHandoffMirroredFood)completion {
    [self caretProcessedLinerPeriodicRegistrySerialize:title message:message sleepSongMay:@[MainMinimal.tiedTagCertTen.pullOwn] completion:completion];
}

@end
