








#import "EldestPlugStar.h"

#define NegateDismiss self.frame.size.width

@interface EldestPlugStar()



@property (nonatomic, strong) NSMutableArray                            *italicsArray;



@property (nonatomic, strong) NSMutableArray <AwayTooTheDrumCell *>      *hangArray;



@property (strong, nonatomic) NSMutableArray <AwayTooTheDrumCell *>      *visibleMetal;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) BuildSummariesAnchorsObservingFreestyle                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   itsWho;

@end

@implementation EldestPlugStar

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

- (void)armEnsureZip
{
    
    if (self.hangArray.firstObject) {
        
        
        AwayTooTheDrumCell *pipeSayView = self.hangArray.firstObject;
        
        pipeSayView.frame = CGRectMake(NegateDismiss, 0, pipeSayView.dogCaseSize.width, pipeSayView.dogCaseSize.height);
        
        self.itsWho = pipeSayView.itsWho;
        
        self.channelCount = pipeSayView.channelCount;
        
        
        NSInteger row = [self fusionEnumerateExportingFlatnessCinematicCubeThirteen:pipeSayView];
        
        
        if (row >= 0) {
            
            
            [self.hangArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:pipeSayView]) {
                [self addSubview:pipeSayView];
            }
            pipeSayView.frame = CGRectMake(NegateDismiss,  row * (pipeSayView.dogCaseSize.height + _itsWho), pipeSayView.dogCaseSize.width, pipeSayView.dogCaseSize.height);
            
            
            [_italicsArray setObject:pipeSayView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(axesDayCleanView:willDisplayCell:)]) {
                [self.delegate axesDayCleanView:self willDisplayCell:pipeSayView];
            }
            
            
            [self.visibleMetal addObject:pipeSayView];
            
            [pipeSayView cutoffFoodLeftoverFamilyAbnormal:^{
                
                
                [pipeSayView setTransform:CGAffineTransformMakeTranslation(- pipeSayView.frame.size.width-NegateDismiss, 0)];
                
            } completion:^(BOOL finished) {
                
                [pipeSayView removeFromSuperview];
                
                
                [self.visibleMetal removeObject:pipeSayView];
                
                
                if ([self.delegate respondsToSelector:@selector(axesDayCleanView:didEndDisplayingCell:)]) {
                    [self.delegate axesDayCleanView:self didEndDisplayingCell:pipeSayView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(awaySeasonObjectMeterAtomicSchemesBuffersExisting:)]) {
                        [self.delegate awaySeasonObjectMeterAtomicSchemesBuffersExisting:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)catFairHowShow:(NSArray <AwayTooTheDrumCell *> *)barrages
{
    self.count += barrages.count;
    [self.hangArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == SoundSelfFlowVirtualWorldStriation) {
        return;
    }
    self.status = SoundSelfFlowVirtualWorldStriation;
    
    if (self.visibleMetal.count) {
        [self.visibleMetal makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.hangArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.visibleMetal  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.visibleMetal  removeAllObjects];
    [self.hangArray     removeAllObjects];
    [self.italicsArray  removeAllObjects];
    
    self.visibleMetal       = nil;
    self.hangArray          = nil;
    self.italicsArray       = nil;
}


- (NSInteger)fusionEnumerateExportingFlatnessCinematicCubeThirteen:(AwayTooTheDrumCell *)newBarrage
{
    for (int row = 0; row<_italicsArray.count; row++) {
        NSObject *object = _italicsArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[AwayTooTheDrumCell class]]) { 
            
            AwayTooTheDrumCell *runningHue = (AwayTooTheDrumCell*)object;
            
            if ([self fusionEnumerateExportingFlatnessCinematicCubeThirteen:runningHue solidPass:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)fusionEnumerateExportingFlatnessCinematicCubeThirteen:(AwayTooTheDrumCell *)runningHue solidPass:(AwayTooTheDrumCell *)newBarrage
{
    
    if (runningHue.status == DocumentsRegisterWayEuropeanFrontEar) {
        return NO;
    }
    
    
    CGRect rect = [runningHue.layer.presentationLayer frame];
    if (rect.origin.x>NegateDismiss - runningHue.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (runningHue.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = NegateDismiss/(NegateDismiss+newBarrage.frame.size.width)*newBarrage.bigParentMix;
        
        CGFloat tree = rect.origin.x - time/(runningHue.bigParentMix)*(NegateDismiss + runningHue.frame.size.width);
        if (tree < -runningHue.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *intro = [touches anyObject];
    CGPoint countedAge  = [intro locationInView:self];
    for (UIView *cleared in [self subviews])
    {
        if (![cleared isKindOfClass:[AwayTooTheDrumCell class]]) continue;
        AwayTooTheDrumCell *pipeSayView = (AwayTooTheDrumCell *)cleared;
        if ([pipeSayView.layer.presentationLayer hitTest:countedAge])
        {
            
            if ([self.delegate respondsToSelector:@selector(axesDayCleanView:lossHowYardCell:)]) {
                [self.delegate axesDayCleanView:self lossHowYardCell:pipeSayView];
            }
            break;
        }
    }
}




- (NSMutableArray<AwayTooTheDrumCell *> *)hangArray {
    if (!_hangArray) {
        _hangArray = [[NSMutableArray alloc] init];
    }
    return _hangArray;
}


- (NSMutableArray<AwayTooTheDrumCell *> *)visibleMetal {
    if (!_visibleMetal) {
        _visibleMetal = [[NSMutableArray alloc] init];
    }
    return _visibleMetal;
}


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


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

@end
