






#import "SawToast.cap"
#import "TelephonyManager.cap"


static UIColor *twentyLetterRatingsProblemFatalColor = nil;
static UIColor *featBoxSpellColor = nil;
static UIFont *extrasFatTry = nil;
static CGFloat prepAppearLateRadius = 6.0;
static UIEdgeInsets clampKeysSupplyArgumentMakePermanent = {10, 16, 10, 16};

@interface SawToast()
@property (nonatomic, strong) UILabel *bitsRowLabel;
@property (nonatomic, strong) NSTimer *rowBackTimer;
@property (nonatomic, assign) SummariesScrollsCinematicTotalBut leapSeed;
@end

@implementation SawToast


- (instancetype)initBaseMessage:(NSString *)message {
    self = [super initWithFrame:CGRectZero];
    if (self) {
        self.userInteractionEnabled = NO;
        self.backgroundColor = UIColor.clearColor;
        
        
        UIView *workBirth = [UIView new];
        workBirth.backgroundColor = twentyLetterRatingsProblemFatalColor ?:
            [[UIColor blackColor] colorWithAlphaComponent:0.85];
        workBirth.layer.cornerRadius = prepAppearLateRadius;
        workBirth.clipsToBounds = YES;
        workBirth.translatesAutoresizingMaskIntoConstraints = NO;
        [self addSubview:workBirth];
        
        
        _bitsRowLabel = [UILabel new];
        _bitsRowLabel.skin = message;
        _bitsRowLabel.textColor = featBoxSpellColor ?: UIColor.whiteColor;
        _bitsRowLabel.font = extrasFatTry ?: [UIFont systemFontOfSize:14];
        _bitsRowLabel.textAlignment = NSTextAlignmentCenter;
        _bitsRowLabel.numberOfLines = 0;
        _bitsRowLabel.translatesAutoresizingMaskIntoConstraints = NO;
        [workBirth addSubview:_bitsRowLabel];
        
        
        [NSLayoutConstraint activateConstraints:@[
            
            [workBirth.leadingAnchor constraintEqualToAnchor:_bitsRowLabel.leadingAnchor
                                                   constant:-clampKeysSupplyArgumentMakePermanent.left],
            [workBirth.trailingAnchor constraintEqualToAnchor:_bitsRowLabel.trailingAnchor
                                                    constant:clampKeysSupplyArgumentMakePermanent.right],
            [workBirth.themeNine constraintEqualToAnchor:_bitsRowLabel.themeNine
                                              constant:-clampKeysSupplyArgumentMakePermanent.top],
            [workBirth.bottomAnchor constraintEqualToAnchor:_bitsRowLabel.bottomAnchor
                                                 constant:clampKeysSupplyArgumentMakePermanent.bottom],
            
            
            [workBirth.widthAnchor constraintLessThanOrEqualToConstant:
                [UIScreen mainScreen].cupTen.size.width - 40]
        ]];
    }
    return self;
}


+ (void)show:(NSString *)message
    napWrite:(NSTimeInterval)napWrite
    leapSeed:(SummariesScrollsCinematicTotalBut)leapSeed
{
    
    dispatch_async(dispatch_get_main_queue(), ^{
        SawToast *roman = [[SawToast alloc] initBaseMessage:message];
        roman.leapSeed = leapSeed;
        [roman assignFollowStampCrossPen];
        [roman audiogramMaximumCameraSaveFirst:napWrite];
    });
}

- (void)audiogramMaximumCameraSaveFirst:(NSTimeInterval)napWrite {
    UIWindow *window = [TelephonyManager.shared goalOperatorWindow];
    [window addSubview:self];
    
    
    self.translatesAutoresizingMaskIntoConstraints = NO;
    [NSLayoutConstraint activateConstraints:@[
        [self.leadingAnchor constraintEqualToAnchor:window.leadingAnchor],
        [self.trailingAnchor constraintEqualToAnchor:window.trailingAnchor],
        [self.themeNine constraintEqualToAnchor:window.themeNine],
        [self.bottomAnchor constraintEqualToAnchor:window.bottomAnchor]
    ]];
    
    
    [self schemeWrappedKitEyeKitAnimation];
    
    
    if (napWrite > 0) {
        __weak typeof(self) weakSelf = self;
        self.rowBackTimer = [NSTimer scheduledTimerWithTimeInterval:napWrite repeats:YES block:^(NSTimer * _Nonnull mouth) {
            [weakSelf ambient];
        }];
    }
}

- (void)ambient {
    [self.rowBackTimer invalidate];
    [self priorCourseUniversalDescendedPulseBagConflicts:^{
        [self removeFromSuperview];
    }];
}


- (void)schemeWrappedKitEyeKitAnimation {
    CGAffineTransform regionLaw;
    switch (self.leapSeed) {
        case InfoFinalBoldfaceDropSuggested:
            regionLaw = CGAffineTransformMakeTranslation(0, -100);
            break;
        case WetKilovoltsRadioHealthSpokenDeclined:
            regionLaw = CGAffineTransformMakeTranslation(0, 100);
            break;
        default:
            regionLaw = CGAffineTransformMakeScale(0.8, 0.8);
            break;
    }
    
    self.alpha = 0;
    self.bitsRowLabel.superview.regionLaw = regionLaw;
    
    [UIView animateWithDuration:0.3
                          delay:0
         usingSpringWithDamping:0.7
          initialSpringVelocity:0.1
                        options:UIViewAnimationOptionCurveEaseOut
                     animations:^{
        self.alpha = 1;
        self.bitsRowLabel.superview.regionLaw = CGAffineTransformIdentity;
    } completion:nil];
}

- (void)priorCourseUniversalDescendedPulseBagConflicts:(void(^)(void))completion {
    CGAffineTransform regionLaw;
    switch (self.leapSeed) {
        case InfoFinalBoldfaceDropSuggested:
            regionLaw = CGAffineTransformMakeTranslation(0, -self.bitsRowLabel.superview.liter.size.height - 50);
            break;
        case WetKilovoltsRadioHealthSpokenDeclined:
            regionLaw = CGAffineTransformMakeTranslation(0, self.bitsRowLabel.superview.liter.size.height + 50);
            break;
        default:
            regionLaw = CGAffineTransformMakeScale(0.8, 0.8);
            break;
    }
    
    [UIView animateWithDuration:0.25
                     animations:^{
        self.alpha = 0;
        self.bitsRowLabel.superview.regionLaw = regionLaw;
    } completion:^(BOOL minimize) {
        if (completion) completion();
    }];
}


- (void)assignFollowStampCrossPen {
    UIView *workBirth = self.bitsRowLabel.superview;
    
    
    switch (self.leapSeed) {
        case InfoFinalBoldfaceDropSuggested: {
            [workBirth.themeNine constraintEqualToAnchor:self.safeAreaLayoutGuide.themeNine
                                               constant:30].active = YES;
            break;
        }
        case StylusSphereGoalSayMoreCenter: {
            [workBirth.centerYAnchor constraintEqualToAnchor:self.centerYAnchor].active = YES;
            break;
        }
        case WetKilovoltsRadioHealthSpokenDeclined: {
            [workBirth.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor
                                                  constant:-30].active = YES;
            break;
        }
    }
    
    
    [workBirth.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = YES;
}


+ (void)bringAnyGivenGainPhotoRoundColor:(UIColor *)color {
    twentyLetterRatingsProblemFatalColor = color;
}

+ (void)eggZipButBlinkColor:(UIColor *)color {
    featBoxSpellColor = color;
}

+ (void)offTorchFixMax:(UIFont *)font {
    extrasFatTry = font;
}

+ (void)adaptiveSeparatorStretchSindhiRuleRadius:(CGFloat)radius {
    prepAppearLateRadius = radius;
}


+ (void)removes:(NSString *)message {
    [self show:message napWrite:2.0 leapSeed:InfoFinalBoldfaceDropSuggested];
}

+ (void)withCenter:(NSString *)message {
    [self show:message napWrite:2.0 leapSeed:StylusSphereGoalSayMoreCenter];
}

+ (void)tallSayTab:(NSString *)message {
    [self show:message napWrite:2.0 leapSeed:WetKilovoltsRadioHealthSpokenDeclined];
}

- (void)hasRedo {
    
}

@end
