








#import "LastBikeLinear.h"

#define TopContentLog self.frame.size.width

@interface LastBikeLinear()



@property (nonatomic, strong) NSMutableArray                            *mainBusArray;



@property (nonatomic, strong) NSMutableArray <SlovakDiskLazyCell *>      *bodyArray;



@property (strong, nonatomic) NSMutableArray <SlovakDiskLazyCell *>      *tapForStroke;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) CarDoneNothingPronounBeat                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   ownKin;

@end

@implementation LastBikeLinear

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

- (void)roundWinPast
{
    
    if (self.bodyArray.firstObject) {
        
        
        SlovakDiskLazyCell *muteEggView = self.bodyArray.firstObject;
        
        muteEggView.frame = CGRectMake(TopContentLog, 0, muteEggView.seekRetSize.width, muteEggView.seekRetSize.height);
        
        self.ownKin = muteEggView.ownKin;
        
        self.channelCount = muteEggView.channelCount;
        
        
        NSInteger row = [self sphericalEpisodeDictationFunEjectSexualCancels:muteEggView];
        
        
        if (row >= 0) {
            
            
            [self.bodyArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:muteEggView]) {
                [self addSubview:muteEggView];
            }
            muteEggView.frame = CGRectMake(TopContentLog,  row * (muteEggView.seekRetSize.height + _ownKin), muteEggView.seekRetSize.width, muteEggView.seekRetSize.height);
            
            
            [_mainBusArray setObject:muteEggView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(nonceRedFiveView:willDisplayCell:)]) {
                [self.delegate nonceRedFiveView:self willDisplayCell:muteEggView];
            }
            
            
            [self.tapForStroke addObject:muteEggView];
            
            [muteEggView bitsAppearHandleInvokeHas:^{
                
                
                [muteEggView setTransform:CGAffineTransformMakeTranslation(- muteEggView.frame.size.width-TopContentLog, 0)];
                
            } completion:^(BOOL finished) {
                
                [muteEggView removeFromSuperview];
                
                
                [self.tapForStroke removeObject:muteEggView];
                
                
                if ([self.delegate respondsToSelector:@selector(nonceRedFiveView:didEndDisplayingCell:)]) {
                    [self.delegate nonceRedFiveView:self didEndDisplayingCell:muteEggView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(sequencerInjectionFlagStylisticMultipleGraphicsCombiningCoalesce:)]) {
                        [self.delegate sequencerInjectionFlagStylisticMultipleGraphicsCombiningCoalesce:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)fractionGopher:(NSArray <SlovakDiskLazyCell *> *)barrages
{
    self.count += barrages.count;
    [self.bodyArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == OrdinalAudiogramButScrolledStepchildPan) {
        return;
    }
    self.status = OrdinalAudiogramButScrolledStepchildPan;
    
    if (self.tapForStroke.count) {
        [self.tapForStroke makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.bodyArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.tapForStroke  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.tapForStroke  removeAllObjects];
    [self.bodyArray     removeAllObjects];
    [self.mainBusArray  removeAllObjects];
    
    self.tapForStroke       = nil;
    self.bodyArray          = nil;
    self.mainBusArray       = nil;
}


- (NSInteger)sphericalEpisodeDictationFunEjectSexualCancels:(SlovakDiskLazyCell *)newBarrage
{
    for (int row = 0; row<_mainBusArray.count; row++) {
        NSObject *object = _mainBusArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[SlovakDiskLazyCell class]]) { 
            
            SlovakDiskLazyCell *echoGetYet = (SlovakDiskLazyCell*)object;
            
            if ([self sphericalEpisodeDictationFunEjectSexualCancels:echoGetYet widgetSix:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)sphericalEpisodeDictationFunEjectSexualCancels:(SlovakDiskLazyCell *)echoGetYet widgetSix:(SlovakDiskLazyCell *)newBarrage
{
    
    if (echoGetYet.status == ExternKitMultiplyUnboundedNumeratorImperial) {
        return NO;
    }
    
    
    CGRect rect = [echoGetYet.layer.presentationLayer frame];
    if (rect.origin.x>TopContentLog - echoGetYet.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (echoGetYet.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = TopContentLog/(TopContentLog+newBarrage.frame.size.width)*newBarrage.unsafeSignal;
        
        CGFloat golf = rect.origin.x - time/(echoGetYet.unsafeSignal)*(TopContentLog + echoGetYet.frame.size.width);
        if (golf < -echoGetYet.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint busLoseWas  = [touch locationInView:self];
    for (SlovakDiskLazyCell *muteEggView in [self subviews])
    {
        if ([muteEggView.layer.presentationLayer hitTest:busLoseWas])
        {
            
            if ([self.delegate respondsToSelector:@selector(nonceRedFiveView:swashesDrumCell:)]) {
                [self.delegate nonceRedFiveView:self swashesDrumCell:muteEggView];
            }
            break;
        }
    }
}




- (NSMutableArray<SlovakDiskLazyCell *> *)bodyArray {
    if (!_bodyArray) {
        _bodyArray = [[NSMutableArray alloc] init];
    }
    return _bodyArray;
}


- (NSMutableArray<SlovakDiskLazyCell *> *)tapForStroke {
    if (!_tapForStroke) {
        _tapForStroke = [[NSMutableArray alloc] init];
    }
    return _tapForStroke;
}


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


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

@end
