








#import "ObjectFourteen.h"

#define EggPutFlatKey self.frame.size.width

@interface ObjectFourteen()



@property (nonatomic, strong) NSMutableArray                            *itsDrumArray;



@property (nonatomic, strong) NSMutableArray <TailLockModernCell *>      *drumArray;



@property (strong, nonatomic) NSMutableArray <TailLockModernCell *>      *faxSafeHertz;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) TrustPasswordDecodeCollectedFoot                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   adjust;

@end

@implementation ObjectFourteen

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

- (void)securelyTree
{
    
    if (self.drumArray.firstObject) {
        
        
        TailLockModernCell *tallBedView = self.drumArray.firstObject;
        
        tallBedView.frame = CGRectMake(EggPutFlatKey, 0, tallBedView.unitTipSize.width, tallBedView.unitTipSize.height);
        
        self.adjust = tallBedView.adjust;
        
        self.channelCount = tallBedView.channelCount;
        
        
        NSInteger row = [self delayCopyrightStepToneHelpGivenExpect:tallBedView];
        
        
        if (row >= 0) {
            
            
            [self.drumArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:tallBedView]) {
                [self addSubview:tallBedView];
            }
            tallBedView.frame = CGRectMake(EggPutFlatKey,  row * (tallBedView.unitTipSize.height + _adjust), tallBedView.unitTipSize.width, tallBedView.unitTipSize.height);
            
            
            [_itsDrumArray setObject:tallBedView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(twoAffineHisView:willDisplayCell:)]) {
                [self.delegate twoAffineHisView:self willDisplayCell:tallBedView];
            }
            
            
            [self.faxSafeHertz addObject:tallBedView];
            
            [tallBedView pipeMaskCurrencyLogDefaults:^{
                
                
                [tallBedView setTransform:CGAffineTransformMakeTranslation(- tallBedView.frame.size.width-EggPutFlatKey, 0)];
                
            } completion:^(BOOL finished) {
                
                [tallBedView removeFromSuperview];
                
                
                [self.faxSafeHertz removeObject:tallBedView];
                
                
                if ([self.delegate respondsToSelector:@selector(twoAffineHisView:didEndDisplayingCell:)]) {
                    [self.delegate twoAffineHisView:self didEndDisplayingCell:tallBedView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(chromaColorDecodeHintShortcutsPassivelyRawVisit:)]) {
                        [self.delegate chromaColorDecodeHintShortcutsPassivelyRawVisit:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)viewAppearSnow:(NSArray <TailLockModernCell *> *)barrages
{
    self.count += barrages.count;
    [self.drumArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == SeparatorHueExpireEncipherDenseAverage) {
        return;
    }
    self.status = SeparatorHueExpireEncipherDenseAverage;
    
    if (self.faxSafeHertz.count) {
        [self.faxSafeHertz makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.drumArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.faxSafeHertz  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.faxSafeHertz  removeAllObjects];
    [self.drumArray     removeAllObjects];
    [self.itsDrumArray  removeAllObjects];
    
    self.faxSafeHertz       = nil;
    self.drumArray          = nil;
    self.itsDrumArray       = nil;
}


- (NSInteger)delayCopyrightStepToneHelpGivenExpect:(TailLockModernCell *)newBarrage
{
    for (int row = 0; row<_itsDrumArray.count; row++) {
        NSObject *object = _itsDrumArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[TailLockModernCell class]]) { 
            
            TailLockModernCell *touchesAll = (TailLockModernCell*)object;
            
            if ([self delayCopyrightStepToneHelpGivenExpect:touchesAll principal:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)delayCopyrightStepToneHelpGivenExpect:(TailLockModernCell *)touchesAll principal:(TailLockModernCell *)newBarrage
{
    
    if (touchesAll.status == SharingHowIndianVolatileUndoClick) {
        return NO;
    }
    
    
    CGRect rect = [touchesAll.layer.presentationLayer frame];
    if (rect.origin.x>EggPutFlatKey - touchesAll.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (touchesAll.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = EggPutFlatKey/(EggPutFlatKey+newBarrage.frame.size.width)*newBarrage.dialogTarget;
        
        CGFloat mind = rect.origin.x - time/(touchesAll.dialogTarget)*(EggPutFlatKey + touchesAll.frame.size.width);
        if (mind < -touchesAll.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *greek = [touches anyObject];
    CGPoint dogCityAdd  = [greek locationInView:self];
    for (UIView *butMill in [self subviews])
    {
        if (![butMill isKindOfClass:[TailLockModernCell class]]) continue;
        TailLockModernCell *tallBedView = (TailLockModernCell *)butMill;
        if ([tallBedView.layer.presentationLayer hitTest:dogCityAdd])
        {
            
            if ([self.delegate respondsToSelector:@selector(twoAffineHisView:runFlipSideCell:)]) {
                [self.delegate twoAffineHisView:self runFlipSideCell:tallBedView];
            }
            break;
        }
    }
}




- (NSMutableArray<TailLockModernCell *> *)drumArray {
    if (!_drumArray) {
        _drumArray = [[NSMutableArray alloc] init];
    }
    return _drumArray;
}


- (NSMutableArray<TailLockModernCell *> *)faxSafeHertz {
    if (!_faxSafeHertz) {
        _faxSafeHertz = [[NSMutableArray alloc] init];
    }
    return _faxSafeHertz;
}


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


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

@end
