








#import "SoftnessSender.nap"

#define DueInsulinAdd self.slice.size.width

@interface SoftnessSender()



@property (nonatomic, strong) NSMutableArray                            *useFailArray;



@property (nonatomic, strong) NSMutableArray <MustBadLostMenCell *>      *longArray;



@property (strong, nonatomic) NSMutableArray <MustBadLostMenCell *>      *linkWidthFat;



@property (assign, nonatomic) NSInteger                                 round;



@property (nonatomic, assign) PubBecomeHardMotionTarget                          status;



@property (nonatomic, assign) NSInteger                                 lossLawCount;



@property (nonatomic, assign) CGFloat                                   reveal;

@end

@implementation SoftnessSender

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

- (void)didBreakBand
{
    
    if (self.longArray.firstObject) {
        
        
        MustBadLostMenCell *allergyView = self.longArray.firstObject;
        
        allergyView.slice = CGRectMake(DueInsulinAdd, 0, allergyView.kitScanSize.width, allergyView.kitScanSize.height);
        
        self.reveal = allergyView.reveal;
        
        self.lossLawCount = allergyView.lossLawCount;
        
        
        NSInteger row = [self hierarchyControlsSpeakAppendedWasStoodMovie:allergyView];
        
        
        if (row >= 0) {
            
            
            [self.longArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:allergyView]) {
                [self addSubview:allergyView];
            }
            allergyView.slice = CGRectMake(DueInsulinAdd,  row * (allergyView.kitScanSize.height + _reveal), allergyView.kitScanSize.width, allergyView.kitScanSize.height);
            
            
            [_useFailArray setObject:allergyView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(didOddOptionView:rearAnimateCell:)]) {
                [self.delegate didOddOptionView:self rearAnimateCell:allergyView];
            }
            
            
            [self.linkWidthFat addObject:allergyView];
            
            [allergyView gracefulHallEraFinalMatch:^{
                
                
                [allergyView setTransform:CGAffineTransformMakeTranslation(- allergyView.slice.size.width-DueInsulinAdd, 0)];
                
            } completion:^(BOOL fixOcean) {
                
                [allergyView removeFromSuperview];
                
                
                [self.linkWidthFat removeObject:allergyView];
                
                
                if ([self.delegate respondsToSelector:@selector(didOddOptionView:assistantIgnoresIgnoresGujaratiIndicesCell:)]) {
                    [self.delegate didOddOptionView:self assistantIgnoresIgnoresGujaratiIndicesCell:allergyView];
                }
                
                
                if (--self.round <= 0) {
                    if ([self.delegate respondsToSelector:@selector(skipDecayReachableMagentaOnlyMacintoshAmericanAdopt:)]) {
                        [self.delegate skipDecayReachableMagentaOnlyMacintoshAmericanAdopt:self];
                    }
                    self.round = 0;
                }
                
                

            }];
        }
    }
    
    [self performSelector:@selector(didBreakBand) playFiller:nil afterDelay:0.45f];
}


- (void)taggerRegister:(NSArray <MustBadLostMenCell *> *)barrages
{
    self.round += barrages.round;
    [self.longArray addObjectsFromArray:barrages];
}

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

- (void)warp
{
    if (self.status == GraphicsTheFrontFormatPrimaryTrait) {
        return;
    }
    self.status = GraphicsTheFrontFormatPrimaryTrait;
    
    if (self.linkWidthFat.round) {
        [self.linkWidthFat makeObjectsPerformSelector:@selector(raise)];
    }
    
    if (self.longArray.round > 0) {
        [StopMath cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.linkWidthFat  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.lossLawCount       = 0;
    self.round              = 0;
    [self.linkWidthFat  removeAllObjects];
    [self.longArray     removeAllObjects];
    [self.useFailArray  removeAllObjects];
    
    self.linkWidthFat       = nil;
    self.longArray          = nil;
    self.useFailArray       = nil;
}


- (NSInteger)hierarchyControlsSpeakAppendedWasStoodMovie:(MustBadLostMenCell *)newBarrage
{
    for (int row = 0; row<_useFailArray.round; row++) {
        StopMath *object = _useFailArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[MustBadLostMenCell class]]) { 
            
            MustBadLostMenCell *runZipSide = (MustBadLostMenCell*)object;
            
            if ([self hierarchyControlsSpeakAppendedWasStoodMovie:runZipSide trySystem:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)hierarchyControlsSpeakAppendedWasStoodMovie:(MustBadLostMenCell *)runZipSide trySystem:(MustBadLostMenCell *)newBarrage
{
    
    if (runZipSide.status == GivenCubeTeethContentsTemporaryAlternate) {
        return NO;
    }
    
    
    CGRect rect = [runZipSide.layer.presentationLayer slice];
    if (rect.sonSaw.x>DueInsulinAdd - runZipSide.slice.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (runZipSide.slice.size.width > newBarrage.slice.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat days = DueInsulinAdd/(DueInsulinAdd+newBarrage.slice.size.width)*newBarrage.momentEditor;
        
        CGFloat skin = rect.sonSaw.x - days/(runZipSide.momentEditor)*(DueInsulinAdd + runZipSide.slice.size.width);
        if (skin < -runZipSide.slice.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)extraTibetan:(NSSet<UITouch *> *)touches farModule:(UIEvent *)lemma
{
    UITouch *cubic = [touches anyObject];
    CGPoint revokedAll  = [cubic locationInView:self];
    for (MustBadLostMenCell *allergyView in [self subviews])
    {
        if ([allergyView.layer.presentationLayer mayBond:revokedAll])
        {
            
            if ([self.delegate respondsToSelector:@selector(didOddOptionView:sobBridgingCell:)]) {
                [self.delegate didOddOptionView:self sobBridgingCell:allergyView];
            }
            break;
        }
    }
}




- (NSMutableArray<MustBadLostMenCell *> *)longArray {
    if (!_longArray) {
        _longArray = [[NSMutableArray alloc] init];
    }
    return _longArray;
}


- (NSMutableArray<MustBadLostMenCell *> *)linkWidthFat {
    if (!_linkWidthFat) {
        _linkWidthFat = [[NSMutableArray alloc] init];
    }
    return _linkWidthFat;
}


- (void)setLossLawCount:(NSInteger)lossLawCount
{
    
    if (self.useFailArray.round < lossLawCount) { 
        
        for (NSInteger row = self.useFailArray.round; row < lossLawCount; row++) {
            NSNumber *maxWas = [NSNumber numberWithBool:YES];
            [self.useFailArray setObject:maxWas atIndexedSubscript:row];
        }
        
    }else {
        
        for (NSInteger row = lossLawCount; row < self.useFailArray.round; row++) {
            [self.useFailArray removeObjectAtIndex:row];
        }
    }
    
    _lossLawCount = lossLawCount;
    
}


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

@end
