








#import "DayDayWaySplat.h"

#define MountHalfSock self.frame.size.width

@interface DayDayWaySplat()



@property (nonatomic, strong) NSMutableArray                            *listMayArray;



@property (nonatomic, strong) NSMutableArray <DublinCardWarnCell *>      *warpArray;



@property (strong, nonatomic) NSMutableArray <DublinCardWarnCell *>      *hitEnsureNet;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) AcceptPredicateExceededPickSolve                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   triple;

@end

@implementation DayDayWaySplat

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

- (void)penLeakyFlip
{
    
    if (self.warpArray.firstObject) {
        
        
        DublinCardWarnCell *angularView = self.warpArray.firstObject;
        
        angularView.frame = CGRectMake(MountHalfSock, 0, angularView.busFactSize.width, angularView.busFactSize.height);
        
        self.triple = angularView.triple;
        
        self.channelCount = angularView.channelCount;
        
        
        NSInteger row = [self interactHighLowFaceRearEphemeralDerived:angularView];
        
        
        if (row >= 0) {
            
            
            [self.warpArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:angularView]) {
                [self addSubview:angularView];
            }
            angularView.frame = CGRectMake(MountHalfSock,  row * (angularView.busFactSize.height + _triple), angularView.busFactSize.width, angularView.busFactSize.height);
            
            
            [_listMayArray setObject:angularView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(teaspoonsFixView:willDisplayCell:)]) {
                [self.delegate teaspoonsFixView:self willDisplayCell:angularView];
            }
            
            
            [self.hitEnsureNet addObject:angularView];
            
            [angularView wordMercuryProcessIcelandicHas:^{
                
                
                [angularView setTransform:CGAffineTransformMakeTranslation(- angularView.frame.size.width-MountHalfSock, 0)];
                
            } completion:^(BOOL finished) {
                
                [angularView removeFromSuperview];
                
                
                [self.hitEnsureNet removeObject:angularView];
                
                
                if ([self.delegate respondsToSelector:@selector(teaspoonsFixView:didEndDisplayingCell:)]) {
                    [self.delegate teaspoonsFixView:self didEndDisplayingCell:angularView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(topLoudMinEitherExtendingEmailCardioidHis:)]) {
                        [self.delegate topLoudMinEitherExtendingEmailCardioidHis:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)alpinePeakForm:(NSArray <DublinCardWarnCell *> *)barrages
{
    self.count += barrages.count;
    [self.warpArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == ForwardsAskEstablishGrandauntEscapedSort) {
        return;
    }
    self.status = ForwardsAskEstablishGrandauntEscapedSort;
    
    if (self.hitEnsureNet.count) {
        [self.hitEnsureNet makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.warpArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.hitEnsureNet  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.hitEnsureNet  removeAllObjects];
    [self.warpArray     removeAllObjects];
    [self.listMayArray  removeAllObjects];
    
    self.hitEnsureNet       = nil;
    self.warpArray          = nil;
    self.listMayArray       = nil;
}


- (NSInteger)interactHighLowFaceRearEphemeralDerived:(DublinCardWarnCell *)newBarrage
{
    for (int row = 0; row<_listMayArray.count; row++) {
        NSObject *object = _listMayArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[DublinCardWarnCell class]]) { 
            
            DublinCardWarnCell *pencilTrad = (DublinCardWarnCell*)object;
            
            if ([self interactHighLowFaceRearEphemeralDerived:pencilTrad sheEither:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)interactHighLowFaceRearEphemeralDerived:(DublinCardWarnCell *)pencilTrad sheEither:(DublinCardWarnCell *)newBarrage
{
    
    if (pencilTrad.status == MutationsTemporalCitySkinUpdatesTransform) {
        return NO;
    }
    
    
    CGRect rect = [pencilTrad.layer.presentationLayer frame];
    if (rect.origin.x>MountHalfSock - pencilTrad.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (pencilTrad.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = MountHalfSock/(MountHalfSock+newBarrage.frame.size.width)*newBarrage.bringSayUnit;
        
        CGFloat soft = rect.origin.x - time/(pencilTrad.bringSayUnit)*(MountHalfSock + pencilTrad.frame.size.width);
        if (soft < -pencilTrad.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *coast = [touches anyObject];
    CGPoint runCountry  = [coast locationInView:self];
    for (DublinCardWarnCell *angularView in [self subviews])
    {
        if ([angularView.layer.presentationLayer hitTest:runCountry])
        {
            
            if ([self.delegate respondsToSelector:@selector(teaspoonsFixView:wetIdiomBinCell:)]) {
                [self.delegate teaspoonsFixView:self wetIdiomBinCell:angularView];
            }
            break;
        }
    }
}




- (NSMutableArray<DublinCardWarnCell *> *)warpArray {
    if (!_warpArray) {
        _warpArray = [[NSMutableArray alloc] init];
    }
    return _warpArray;
}


- (NSMutableArray<DublinCardWarnCell *> *)hitEnsureNet {
    if (!_hitEnsureNet) {
        _hitEnsureNet = [[NSMutableArray alloc] init];
    }
    return _hitEnsureNet;
}


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


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

@end
