








#import "WaitingChecker.h"

#define SurgeBlackTwo self.frame.size.width

@interface WaitingChecker()



@property (nonatomic, strong) NSMutableArray                            *pintOutArray;



@property (nonatomic, strong) NSMutableArray <RankOuncesForkCell *>      *saltArray;



@property (strong, nonatomic) NSMutableArray <RankOuncesForkCell *>      *dryFaceThree;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) FeetUploadForCourseChannels                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   binIcy;

@end

@implementation WaitingChecker

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.status = LibraryLinkageHitNotifiesTallTracking;
    }
    return self;
}

- (void)childAllFlat
{
    
    if (self.saltArray.firstObject) {
        
        
        RankOuncesForkCell *iconBoxView = self.saltArray.firstObject;
        
        iconBoxView.frame = CGRectMake(SurgeBlackTwo, 0, iconBoxView.moreKeySize.width, iconBoxView.moreKeySize.height);
        
        self.binIcy = iconBoxView.binIcy;
        
        self.channelCount = iconBoxView.channelCount;
        
        
        NSInteger row = [self adjustingForwardPolarMinuteAltitudeModuleRead:iconBoxView];
        
        
        if (row >= 0) {
            
            
            [self.saltArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:iconBoxView]) {
                [self addSubview:iconBoxView];
            }
            iconBoxView.frame = CGRectMake(SurgeBlackTwo,  row * (iconBoxView.moreKeySize.height + _binIcy), iconBoxView.moreKeySize.width, iconBoxView.moreKeySize.height);
            
            
            [_pintOutArray setObject:iconBoxView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(kitZipLegacyView:willDisplayCell:)]) {
                [self.delegate kitZipLegacyView:self willDisplayCell:iconBoxView];
            }
            
            
            [self.dryFaceThree addObject:iconBoxView];
            
            [iconBoxView ciphersQueryFlushedCopyrightTrusted:^{
                
                
                [iconBoxView setTransform:CGAffineTransformMakeTranslation(- iconBoxView.frame.size.width-SurgeBlackTwo, 0)];
                
            } completion:^(BOOL finished) {
                
                [iconBoxView removeFromSuperview];
                
                
                [self.dryFaceThree removeObject:iconBoxView];
                
                
                if ([self.delegate respondsToSelector:@selector(kitZipLegacyView:didEndDisplayingCell:)]) {
                    [self.delegate kitZipLegacyView:self didEndDisplayingCell:iconBoxView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(privilegeSobTeaspoonsHurricaneOutdoorHomeUnlikelyBuild:)]) {
                        [self.delegate privilegeSobTeaspoonsHurricaneOutdoorHomeUnlikelyBuild:self];
                    }
                    self.count = 0;
                }
                
                

            }];
        }
    }
    
    [self performSelector:@selector(childAllFlat) withObject:nil afterDelay:0.45f];
}


- (void)eggOneEggIndex:(NSArray <RankOuncesForkCell *> *)barrages
{
    self.count += barrages.count;
    [self.saltArray addObjectsFromArray:barrages];
}

- (void)start
{
    if (self.status == SoloMenuTrapBayerPitchAlert) {
        return;
    }
    self.status = SoloMenuTrapBayerPitchAlert;
    
    [self childAllFlat];
}

- (void)stop
{
    if (self.status == LibraryLinkageHitNotifiesTallTracking) {
        return;
    }
    self.status = LibraryLinkageHitNotifiesTallTracking;
    
    if (self.dryFaceThree.count) {
        [self.dryFaceThree makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.saltArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.dryFaceThree  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.dryFaceThree  removeAllObjects];
    [self.saltArray     removeAllObjects];
    [self.pintOutArray  removeAllObjects];
    
    self.dryFaceThree       = nil;
    self.saltArray          = nil;
    self.pintOutArray       = nil;
}


- (NSInteger)adjustingForwardPolarMinuteAltitudeModuleRead:(RankOuncesForkCell *)newBarrage
{
    for (int row = 0; row<_pintOutArray.count; row++) {
        NSObject *object = _pintOutArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[RankOuncesForkCell class]]) { 
            
            RankOuncesForkCell *placeLabel = (RankOuncesForkCell*)object;
            
            if ([self adjustingForwardPolarMinuteAltitudeModuleRead:placeLabel localizes:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)adjustingForwardPolarMinuteAltitudeModuleRead:(RankOuncesForkCell *)placeLabel localizes:(RankOuncesForkCell *)newBarrage
{
    
    if (placeLabel.status == AndButArteryExponentAlphaNumber) {
        return NO;
    }
    
    
    CGRect rect = [placeLabel.layer.presentationLayer frame];
    if (rect.origin.x>SurgeBlackTwo - placeLabel.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (placeLabel.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = SurgeBlackTwo/(SurgeBlackTwo+newBarrage.frame.size.width)*newBarrage.ironRatioOne;
        
        CGFloat race = rect.origin.x - time/(placeLabel.ironRatioOne)*(SurgeBlackTwo + placeLabel.frame.size.width);
        if (race < -placeLabel.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *occur = [touches anyObject];
    CGPoint hitHandled  = [occur locationInView:self];
    for (RankOuncesForkCell *iconBoxView in [self subviews])
    {
        if ([iconBoxView.layer.presentationLayer hitTest:hitHandled])
        {
            
            if ([self.delegate respondsToSelector:@selector(kitZipLegacyView:userNumeralCell:)]) {
                [self.delegate kitZipLegacyView:self userNumeralCell:iconBoxView];
            }
            break;
        }
    }
}




- (NSMutableArray<RankOuncesForkCell *> *)saltArray {
    if (!_saltArray) {
        _saltArray = [[NSMutableArray alloc] init];
    }
    return _saltArray;
}


- (NSMutableArray<RankOuncesForkCell *> *)dryFaceThree {
    if (!_dryFaceThree) {
        _dryFaceThree = [[NSMutableArray alloc] init];
    }
    return _dryFaceThree;
}


- (void)setChannelCount:(NSInteger)channelCount
{
    
    if (self.pintOutArray.count < channelCount) { 
        
        for (NSInteger row = self.pintOutArray.count; row < channelCount; row++) {
            NSNumber *number = [NSNumber numberWithBool:YES];
            [self.pintOutArray setObject:number atIndexedSubscript:row];
        }
        
    }else {
        
        for (NSInteger row = channelCount; row < self.pintOutArray.count; row++) {
            [self.pintOutArray removeObjectAtIndex:row];
        }
    }
    
    _channelCount = channelCount;
    
}


- (NSMutableArray *)pintOutArray {
    if (!_pintOutArray) {
        _pintOutArray = [[NSMutableArray alloc] init];
    }
    return _pintOutArray;
}

@end
