








#import "SilenceLinkage.h"

#define PopNonceEvict self.frame.size.width

@interface SilenceLinkage()



@property (nonatomic, strong) NSMutableArray                            *bitsTenArray;



@property (nonatomic, strong) NSMutableArray <FavoriteMethodCell *>      *callArray;



@property (strong, nonatomic) NSMutableArray <FavoriteMethodCell *>      *sevenPersian;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) BaseRelationIntegrateEscapedAffine                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   barShe;

@end

@implementation SilenceLinkage

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

- (void)soundAirBurn
{
    
    if (self.callArray.firstObject) {
        
        
        FavoriteMethodCell *lostUseView = self.callArray.firstObject;
        
        lostUseView.frame = CGRectMake(PopNonceEvict, 0, lostUseView.theBendSize.width, lostUseView.theBendSize.height);
        
        self.barShe = lostUseView.barShe;
        
        self.channelCount = lostUseView.channelCount;
        
        
        NSInteger row = [self authorsUtteranceEditorsOurIronMaySent:lostUseView];
        
        
        if (row >= 0) {
            
            
            [self.callArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:lostUseView]) {
                [self addSubview:lostUseView];
            }
            lostUseView.frame = CGRectMake(PopNonceEvict,  row * (lostUseView.theBendSize.height + _barShe), lostUseView.theBendSize.width, lostUseView.theBendSize.height);
            
            
            [_bitsTenArray setObject:lostUseView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(highInspiredView:willDisplayCell:)]) {
                [self.delegate highInspiredView:self willDisplayCell:lostUseView];
            }
            
            
            [self.sevenPersian addObject:lostUseView];
            
            [lostUseView enhanceCycleVoiceKernelHour:^{
                
                
                [lostUseView setTransform:CGAffineTransformMakeTranslation(- lostUseView.frame.size.width-PopNonceEvict, 0)];
                
            } completion:^(BOOL finished) {
                
                [lostUseView removeFromSuperview];
                
                
                [self.sevenPersian removeObject:lostUseView];
                
                
                if ([self.delegate respondsToSelector:@selector(highInspiredView:didEndDisplayingCell:)]) {
                    [self.delegate highInspiredView:self didEndDisplayingCell:lostUseView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(thumbnailDescendedEndAskPanPickFloorRequire:)]) {
                        [self.delegate thumbnailDescendedEndAskPanPickFloorRequire:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)outLoadRuleLaw:(NSArray <FavoriteMethodCell *> *)barrages
{
    self.count += barrages.count;
    [self.callArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == ParagraphInvertKilobytesMostGurationAddition) {
        return;
    }
    self.status = ParagraphInvertKilobytesMostGurationAddition;
    
    if (self.sevenPersian.count) {
        [self.sevenPersian makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.callArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.sevenPersian  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.sevenPersian  removeAllObjects];
    [self.callArray     removeAllObjects];
    [self.bitsTenArray  removeAllObjects];
    
    self.sevenPersian       = nil;
    self.callArray          = nil;
    self.bitsTenArray       = nil;
}


- (NSInteger)authorsUtteranceEditorsOurIronMaySent:(FavoriteMethodCell *)newBarrage
{
    for (int row = 0; row<_bitsTenArray.count; row++) {
        NSObject *object = _bitsTenArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[FavoriteMethodCell class]]) { 
            
            FavoriteMethodCell *yardBoxFax = (FavoriteMethodCell*)object;
            
            if ([self authorsUtteranceEditorsOurIronMaySent:yardBoxFax sunIntent:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)authorsUtteranceEditorsOurIronMaySent:(FavoriteMethodCell *)yardBoxFax sunIntent:(FavoriteMethodCell *)newBarrage
{
    
    if (yardBoxFax.status == PreviousYardSenseYahooModerateRemove) {
        return NO;
    }
    
    
    CGRect rect = [yardBoxFax.layer.presentationLayer frame];
    if (rect.origin.x>PopNonceEvict - yardBoxFax.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (yardBoxFax.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = PopNonceEvict/(PopNonceEvict+newBarrage.frame.size.width)*newBarrage.jobJobObject;
        
        CGFloat walk = rect.origin.x - time/(yardBoxFax.jobJobObject)*(PopNonceEvict + yardBoxFax.frame.size.width);
        if (walk < -yardBoxFax.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *black = [touches anyObject];
    CGPoint makeAtomic  = [black locationInView:self];
    for (UIView *sliding in [self subviews])
    {
        if (![sliding isKindOfClass:[FavoriteMethodCell class]]) continue;
        FavoriteMethodCell *lostUseView = (FavoriteMethodCell *)sliding;
        if ([lostUseView.layer.presentationLayer hitTest:makeAtomic])
        {
            
            if ([self.delegate respondsToSelector:@selector(highInspiredView:barStaleLawCell:)]) {
                [self.delegate highInspiredView:self barStaleLawCell:lostUseView];
            }
            break;
        }
    }
}




- (NSMutableArray<FavoriteMethodCell *> *)callArray {
    if (!_callArray) {
        _callArray = [[NSMutableArray alloc] init];
    }
    return _callArray;
}


- (NSMutableArray<FavoriteMethodCell *> *)sevenPersian {
    if (!_sevenPersian) {
        _sevenPersian = [[NSMutableArray alloc] init];
    }
    return _sevenPersian;
}


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


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

@end
