








#import "PointBadLogAsk.h"

#define SameEggAnyShe self.frame.size.width

@interface PointBadLogAsk()



@property (nonatomic, strong) NSMutableArray                            *tenSortArray;



@property (nonatomic, strong) NSMutableArray <AtomToneSquareCell *>      *willArray;



@property (strong, nonatomic) NSMutableArray <AtomToneSquareCell *>      *polarBothFar;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) ExternFaxFailOxygenDrum                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   notFun;

@end

@implementation PointBadLogAsk

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

- (void)folderKinSpa
{
    
    if (self.willArray.firstObject) {
        
        
        AtomToneSquareCell *generalView = self.willArray.firstObject;
        
        generalView.frame = CGRectMake(SameEggAnyShe, 0, generalView.lenientSize.width, generalView.lenientSize.height);
        
        self.notFun = generalView.notFun;
        
        self.channelCount = generalView.channelCount;
        
        
        NSInteger row = [self deciliterBridgedDispatchOutlineRolePaperHard:generalView];
        
        
        if (row >= 0) {
            
            
            [self.willArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:generalView]) {
                [self addSubview:generalView];
            }
            generalView.frame = CGRectMake(SameEggAnyShe,  row * (generalView.lenientSize.height + _notFun), generalView.lenientSize.width, generalView.lenientSize.height);
            
            
            [_tenSortArray setObject:generalView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(consumedYardView:willDisplayCell:)]) {
                [self.delegate consumedYardView:self willDisplayCell:generalView];
            }
            
            
            [self.polarBothFar addObject:generalView];
            
            [generalView reorderPreventedPrematureClangCar:^{
                
                
                [generalView setTransform:CGAffineTransformMakeTranslation(- generalView.frame.size.width-SameEggAnyShe, 0)];
                
            } completion:^(BOOL finished) {
                
                [generalView removeFromSuperview];
                
                
                [self.polarBothFar removeObject:generalView];
                
                
                if ([self.delegate respondsToSelector:@selector(consumedYardView:didEndDisplayingCell:)]) {
                    [self.delegate consumedYardView:self didEndDisplayingCell:generalView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(kitArmOcclusionSamplesBandHasMinderUnfocused:)]) {
                        [self.delegate kitArmOcclusionSamplesBandHasMinderUnfocused:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)lossEdgaHealth:(NSArray <AtomToneSquareCell *> *)barrages
{
    self.count += barrages.count;
    [self.willArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == BedCropOwnerAirTruncatedBack) {
        return;
    }
    self.status = BedCropOwnerAirTruncatedBack;
    
    if (self.polarBothFar.count) {
        [self.polarBothFar makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.willArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.polarBothFar  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.polarBothFar  removeAllObjects];
    [self.willArray     removeAllObjects];
    [self.tenSortArray  removeAllObjects];
    
    self.polarBothFar       = nil;
    self.willArray          = nil;
    self.tenSortArray       = nil;
}


- (NSInteger)deciliterBridgedDispatchOutlineRolePaperHard:(AtomToneSquareCell *)newBarrage
{
    for (int row = 0; row<_tenSortArray.count; row++) {
        NSObject *object = _tenSortArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[AtomToneSquareCell class]]) { 
            
            AtomToneSquareCell *tagClients = (AtomToneSquareCell*)object;
            
            if ([self deciliterBridgedDispatchOutlineRolePaperHard:tagClients roleWaist:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)deciliterBridgedDispatchOutlineRolePaperHard:(AtomToneSquareCell *)tagClients roleWaist:(AtomToneSquareCell *)newBarrage
{
    
    if (tagClients.status == PrettyTrainerAllowSurgeCollapsesHall) {
        return NO;
    }
    
    
    CGRect rect = [tagClients.layer.presentationLayer frame];
    if (rect.origin.x>SameEggAnyShe - tagClients.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (tagClients.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = SameEggAnyShe/(SameEggAnyShe+newBarrage.frame.size.width)*newBarrage.moireIndices;
        
        CGFloat atom = rect.origin.x - time/(tagClients.moireIndices)*(SameEggAnyShe + tagClients.frame.size.width);
        if (atom < -tagClients.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *brief = [touches anyObject];
    CGPoint lossyCurve  = [brief locationInView:self];
    for (UIView *friends in [self subviews])
    {
        if (![friends isKindOfClass:[AtomToneSquareCell class]]) continue;
        AtomToneSquareCell *generalView = (AtomToneSquareCell *)friends;
        if ([generalView.layer.presentationLayer hitTest:lossyCurve])
        {
            
            if ([self.delegate respondsToSelector:@selector(consumedYardView:dashRetWrapCell:)]) {
                [self.delegate consumedYardView:self dashRetWrapCell:generalView];
            }
            break;
        }
    }
}




- (NSMutableArray<AtomToneSquareCell *> *)willArray {
    if (!_willArray) {
        _willArray = [[NSMutableArray alloc] init];
    }
    return _willArray;
}


- (NSMutableArray<AtomToneSquareCell *> *)polarBothFar {
    if (!_polarBothFar) {
        _polarBothFar = [[NSMutableArray alloc] init];
    }
    return _polarBothFar;
}


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


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

@end
