








#import "CubicExistSink.h"

#define SpaKitYetMenu self.frame.size.width

@interface CubicExistSink()



@property (nonatomic, strong) NSMutableArray                            *specialArray;



@property (nonatomic, strong) NSMutableArray <AnyGolfNotHandCell *>      *diskArray;



@property (strong, nonatomic) NSMutableArray <AnyGolfNotHandCell *>      *sexEggAmpere;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) UnfocusedBounceDigitizedVitalRelay                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   sinEye;

@end

@implementation CubicExistSink

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

- (void)appendingIll
{
    
    if (self.diskArray.firstObject) {
        
        
        AnyGolfNotHandCell *capTeamView = self.diskArray.firstObject;
        
        capTeamView.frame = CGRectMake(SpaKitYetMenu, 0, capTeamView.lastWonSize.width, capTeamView.lastWonSize.height);
        
        self.sinEye = capTeamView.sinEye;
        
        self.channelCount = capTeamView.channelCount;
        
        
        NSInteger row = [self squaredGrantedInspiredMeanSynthesisKilobytesMap:capTeamView];
        
        
        if (row >= 0) {
            
            
            [self.diskArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:capTeamView]) {
                [self addSubview:capTeamView];
            }
            capTeamView.frame = CGRectMake(SpaKitYetMenu,  row * (capTeamView.lastWonSize.height + _sinEye), capTeamView.lastWonSize.width, capTeamView.lastWonSize.height);
            
            
            [_specialArray setObject:capTeamView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(topRainEntryView:willDisplayCell:)]) {
                [self.delegate topRainEntryView:self willDisplayCell:capTeamView];
            }
            
            
            [self.sexEggAmpere addObject:capTeamView];
            
            [capTeamView transposeOverlayExtensionGlucoseToday:^{
                
                
                [capTeamView setTransform:CGAffineTransformMakeTranslation(- capTeamView.frame.size.width-SpaKitYetMenu, 0)];
                
            } completion:^(BOOL finished) {
                
                [capTeamView removeFromSuperview];
                
                
                [self.sexEggAmpere removeObject:capTeamView];
                
                
                if ([self.delegate respondsToSelector:@selector(topRainEntryView:didEndDisplayingCell:)]) {
                    [self.delegate topRainEntryView:self didEndDisplayingCell:capTeamView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(boldDrumContextRadioDepthGreatShotHome:)]) {
                        [self.delegate boldDrumContextRadioDepthGreatShotHome:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)raceChatWinOpt:(NSArray <AnyGolfNotHandCell *> *)barrages
{
    self.count += barrages.count;
    [self.diskArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == PanFormatsBusyDigitCatDescend) {
        return;
    }
    self.status = PanFormatsBusyDigitCatDescend;
    
    if (self.sexEggAmpere.count) {
        [self.sexEggAmpere makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.diskArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.sexEggAmpere  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.sexEggAmpere  removeAllObjects];
    [self.diskArray     removeAllObjects];
    [self.specialArray  removeAllObjects];
    
    self.sexEggAmpere       = nil;
    self.diskArray          = nil;
    self.specialArray       = nil;
}


- (NSInteger)squaredGrantedInspiredMeanSynthesisKilobytesMap:(AnyGolfNotHandCell *)newBarrage
{
    for (int row = 0; row<_specialArray.count; row++) {
        NSObject *object = _specialArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[AnyGolfNotHandCell class]]) { 
            
            AnyGolfNotHandCell *tipReplies = (AnyGolfNotHandCell*)object;
            
            if ([self squaredGrantedInspiredMeanSynthesisKilobytesMap:tipReplies calculate:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)squaredGrantedInspiredMeanSynthesisKilobytesMap:(AnyGolfNotHandCell *)tipReplies calculate:(AnyGolfNotHandCell *)newBarrage
{
    
    if (tipReplies.status == PrepPromotionDogOvulationKeyCutter) {
        return NO;
    }
    
    
    CGRect rect = [tipReplies.layer.presentationLayer frame];
    if (rect.origin.x>SpaKitYetMenu - tipReplies.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (tipReplies.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = SpaKitYetMenu/(SpaKitYetMenu+newBarrage.frame.size.width)*newBarrage.eggAdoptLose;
        
        CGFloat gray = rect.origin.x - time/(tipReplies.eggAdoptLose)*(SpaKitYetMenu + tipReplies.frame.size.width);
        if (gray < -tipReplies.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *elder = [touches anyObject];
    CGPoint bridgeAuto  = [elder locationInView:self];
    for (AnyGolfNotHandCell *capTeamView in [self subviews])
    {
        if ([capTeamView.layer.presentationLayer hitTest:bridgeAuto])
        {
            
            if ([self.delegate respondsToSelector:@selector(topRainEntryView:mandarinHasCell:)]) {
                [self.delegate topRainEntryView:self mandarinHasCell:capTeamView];
            }
            break;
        }
    }
}




- (NSMutableArray<AnyGolfNotHandCell *> *)diskArray {
    if (!_diskArray) {
        _diskArray = [[NSMutableArray alloc] init];
    }
    return _diskArray;
}


- (NSMutableArray<AnyGolfNotHandCell *> *)sexEggAmpere {
    if (!_sexEggAmpere) {
        _sexEggAmpere = [[NSMutableArray alloc] init];
    }
    return _sexEggAmpere;
}


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


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

@end
