








#import "PinCrossEyeThe.h"

#define LossQueryLost self.frame.size.width

@interface PinCrossEyeThe()



@property (nonatomic, strong) NSMutableArray                            *execWhoArray;



@property (nonatomic, strong) NSMutableArray <FitTagLogoTagsCell *>      *axesArray;



@property (strong, nonatomic) NSMutableArray <FitTagLogoTagsCell *>      *maySomaliSub;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) SundaneseLiftMayPeakBus                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   ourFar;

@end

@implementation PinCrossEyeThe

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

- (void)designNearby
{
    
    if (self.axesArray.firstObject) {
        
        
        FitTagLogoTagsCell *illBankView = self.axesArray.firstObject;
        
        illBankView.frame = CGRectMake(LossQueryLost, 0, illBankView.coachedSize.width, illBankView.coachedSize.height);
        
        self.ourFar = illBankView.ourFar;
        
        self.channelCount = illBankView.channelCount;
        
        
        NSInteger row = [self exposeEraSerializeAdvisedPulseNetworkDescend:illBankView];
        
        
        if (row >= 0) {
            
            
            [self.axesArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:illBankView]) {
                [self addSubview:illBankView];
            }
            illBankView.frame = CGRectMake(LossQueryLost,  row * (illBankView.coachedSize.height + _ourFar), illBankView.coachedSize.width, illBankView.coachedSize.height);
            
            
            [_execWhoArray setObject:illBankView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(reasonSinArmView:willDisplayCell:)]) {
                [self.delegate reasonSinArmView:self willDisplayCell:illBankView];
            }
            
            
            [self.maySomaliSub addObject:illBankView];
            
            [illBankView warningSiteArrowImportantUnplugged:^{
                
                
                [illBankView setTransform:CGAffineTransformMakeTranslation(- illBankView.frame.size.width-LossQueryLost, 0)];
                
            } completion:^(BOOL finished) {
                
                [illBankView removeFromSuperview];
                
                
                [self.maySomaliSub removeObject:illBankView];
                
                
                if ([self.delegate respondsToSelector:@selector(reasonSinArmView:didEndDisplayingCell:)]) {
                    [self.delegate reasonSinArmView:self didEndDisplayingCell:illBankView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(costSchemesHundredVariableEnsureInspiredMeterVideo:)]) {
                        [self.delegate costSchemesHundredVariableEnsureInspiredMeterVideo:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)usesShotHisJob:(NSArray <FitTagLogoTagsCell *> *)barrages
{
    self.count += barrages.count;
    [self.axesArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == AzimuthWeeklySeleniumReportedJustScheduler) {
        return;
    }
    self.status = AzimuthWeeklySeleniumReportedJustScheduler;
    
    if (self.maySomaliSub.count) {
        [self.maySomaliSub makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.axesArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.maySomaliSub  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.maySomaliSub  removeAllObjects];
    [self.axesArray     removeAllObjects];
    [self.execWhoArray  removeAllObjects];
    
    self.maySomaliSub       = nil;
    self.axesArray          = nil;
    self.execWhoArray       = nil;
}


- (NSInteger)exposeEraSerializeAdvisedPulseNetworkDescend:(FitTagLogoTagsCell *)newBarrage
{
    for (int row = 0; row<_execWhoArray.count; row++) {
        NSObject *object = _execWhoArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[FitTagLogoTagsCell class]]) { 
            
            FitTagLogoTagsCell *maxCharBox = (FitTagLogoTagsCell*)object;
            
            if ([self exposeEraSerializeAdvisedPulseNetworkDescend:maxCharBox downRelay:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)exposeEraSerializeAdvisedPulseNetworkDescend:(FitTagLogoTagsCell *)maxCharBox downRelay:(FitTagLogoTagsCell *)newBarrage
{
    
    if (maxCharBox.status == DecryptedMagicViolationPictureQuotesCalculate) {
        return NO;
    }
    
    
    CGRect rect = [maxCharBox.layer.presentationLayer frame];
    if (rect.origin.x>LossQueryLost - maxCharBox.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (maxCharBox.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = LossQueryLost/(LossQueryLost+newBarrage.frame.size.width)*newBarrage.moviePortBus;
        
        CGFloat rain = rect.origin.x - time/(maxCharBox.moviePortBus)*(LossQueryLost + maxCharBox.frame.size.width);
        if (rain < -maxCharBox.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *tight = [touches anyObject];
    CGPoint centralRow  = [tight locationInView:self];
    for (UIView *seedBox in [self subviews])
    {
        if (![seedBox isKindOfClass:[FitTagLogoTagsCell class]]) continue;
        FitTagLogoTagsCell *illBankView = (FitTagLogoTagsCell *)seedBox;
        if ([illBankView.layer.presentationLayer hitTest:centralRow])
        {
            
            if ([self.delegate respondsToSelector:@selector(reasonSinArmView:idleThatPopCell:)]) {
                [self.delegate reasonSinArmView:self idleThatPopCell:illBankView];
            }
            break;
        }
    }
}




- (NSMutableArray<FitTagLogoTagsCell *> *)axesArray {
    if (!_axesArray) {
        _axesArray = [[NSMutableArray alloc] init];
    }
    return _axesArray;
}


- (NSMutableArray<FitTagLogoTagsCell *> *)maySomaliSub {
    if (!_maySomaliSub) {
        _maySomaliSub = [[NSMutableArray alloc] init];
    }
    return _maySomaliSub;
}


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


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

@end
