








#import "StyleMaskMusic.h"

#define TabCompactOff self.frame.size.width

@interface StyleMaskMusic()



@property (nonatomic, strong) NSMutableArray                            *leapPutArray;



@property (nonatomic, strong) NSMutableArray <UseShowBarsRedCell *>      *lateArray;



@property (strong, nonatomic) NSMutableArray <UseShowBarsRedCell *>      *bestSerifOld;



@property (assign, nonatomic) NSInteger                                 count;



@property (nonatomic, assign) TriggeredIntroTwentyCollectedMail                          status;



@property (nonatomic, assign) NSInteger                                 channelCount;



@property (nonatomic, assign) CGFloat                                   sonOpt;

@end

@implementation StyleMaskMusic

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

- (void)icyHitGlobal
{
    
    if (self.lateArray.firstObject) {
        
        
        UseShowBarsRedCell *locatorView = self.lateArray.firstObject;
        
        locatorView.frame = CGRectMake(TabCompactOff, 0, locatorView.cupMindSize.width, locatorView.cupMindSize.height);
        
        self.sonOpt = locatorView.sonOpt;
        
        self.channelCount = locatorView.channelCount;
        
        
        NSInteger row = [self appliesEggAmbienceSizeSnapshotWillZip:locatorView];
        
        
        if (row >= 0) {
            
            
            [self.lateArray removeObjectAtIndex:0];
            
            
            if (![self.subviews containsObject:locatorView]) {
                [self addSubview:locatorView];
            }
            locatorView.frame = CGRectMake(TabCompactOff,  row * (locatorView.cupMindSize.height + _sonOpt), locatorView.cupMindSize.width, locatorView.cupMindSize.height);
            
            
            [_leapPutArray setObject:locatorView atIndexedSubscript:row];
            
            
            if ([self.delegate respondsToSelector:@selector(impactArmTopView:willDisplayCell:)]) {
                [self.delegate impactArmTopView:self willDisplayCell:locatorView];
            }
            
            
            [self.bestSerifOld addObject:locatorView];
            
            [locatorView ditherSheNominallyDiscoverDrain:^{
                
                
                [locatorView setTransform:CGAffineTransformMakeTranslation(- locatorView.frame.size.width-TabCompactOff, 0)];
                
            } completion:^(BOOL finished) {
                
                [locatorView removeFromSuperview];
                
                
                [self.bestSerifOld removeObject:locatorView];
                
                
                if ([self.delegate respondsToSelector:@selector(impactArmTopView:didEndDisplayingCell:)]) {
                    [self.delegate impactArmTopView:self didEndDisplayingCell:locatorView];
                }
                
                
                if (--self.count <= 0) {
                    if ([self.delegate respondsToSelector:@selector(collectorSayPressedMovieAppleLinkInitiallyUptime:)]) {
                        [self.delegate collectorSayPressedMovieAppleLinkInitiallyUptime:self];
                    }
                    self.count = 0;
                }
                
                

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


- (void)mixerOuterFree:(NSArray <UseShowBarsRedCell *> *)barrages
{
    self.count += barrages.count;
    [self.lateArray addObjectsFromArray:barrages];
}

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

- (void)stop
{
    if (self.status == HertzStorageTremorSumRainManganese) {
        return;
    }
    self.status = HertzStorageTremorSumRainManganese;
    
    if (self.bestSerifOld.count) {
        [self.bestSerifOld makeObjectsPerformSelector:@selector(pause)];
    }
    
    if (self.lateArray.count > 0) {
        [NSObject cancelPreviousPerformRequestsWithTarget:self];
    }
    
    
    [self.bestSerifOld  makeObjectsPerformSelector:@selector(removeFromSuperview)];
    self.channelCount       = 0;
    self.count              = 0;
    [self.bestSerifOld  removeAllObjects];
    [self.lateArray     removeAllObjects];
    [self.leapPutArray  removeAllObjects];
    
    self.bestSerifOld       = nil;
    self.lateArray          = nil;
    self.leapPutArray       = nil;
}


- (NSInteger)appliesEggAmbienceSizeSnapshotWillZip:(UseShowBarsRedCell *)newBarrage
{
    for (int row = 0; row<_leapPutArray.count; row++) {
        NSObject *object = _leapPutArray[row];
        if ([object isKindOfClass:[NSNumber class]]) { 
            
            return row;
            
        }else if ([object isKindOfClass:[UseShowBarsRedCell class]]) { 
            
            UseShowBarsRedCell *earFoldFor = (UseShowBarsRedCell*)object;
            
            if ([self appliesEggAmbienceSizeSnapshotWillZip:earFoldFor cursorFat:newBarrage]) {
                
                return row;
            }
        }
    }
    
    return -1;
}


- (BOOL)appliesEggAmbienceSizeSnapshotWillZip:(UseShowBarsRedCell *)earFoldFor cursorFat:(UseShowBarsRedCell *)newBarrage
{
    
    if (earFoldFor.status == MapYoungestRevisionPinNoiseThumbnail) {
        return NO;
    }
    
    
    CGRect rect = [earFoldFor.layer.presentationLayer frame];
    if (rect.origin.x>TabCompactOff - earFoldFor.frame.size.width) {
        
        return NO;
    }else if (rect.size.width == 0)
    {
        
        return NO;
    }
    else if (earFoldFor.frame.size.width > newBarrage.frame.size.width) {
        
        return YES;
    }else
    {
        
        CGFloat time = TabCompactOff/(TabCompactOff+newBarrage.frame.size.width)*newBarrage.chunkyIgnore;
        
        CGFloat lazy = rect.origin.x - time/(earFoldFor.chunkyIgnore)*(TabCompactOff + earFoldFor.frame.size.width);
        if (lazy < -earFoldFor.frame.size.width) {
            
            return YES;
        }
    }
    return NO;
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *music = [touches anyObject];
    CGPoint nowFailing  = [music locationInView:self];
    for (UIView *waitIcy in [self subviews])
    {
        if (![waitIcy isKindOfClass:[UseShowBarsRedCell class]]) continue;
        UseShowBarsRedCell *locatorView = (UseShowBarsRedCell *)waitIcy;
        if ([locatorView.layer.presentationLayer hitTest:nowFailing])
        {
            
            if ([self.delegate respondsToSelector:@selector(impactArmTopView:illShotUsesCell:)]) {
                [self.delegate impactArmTopView:self illShotUsesCell:locatorView];
            }
            break;
        }
    }
}




- (NSMutableArray<UseShowBarsRedCell *> *)lateArray {
    if (!_lateArray) {
        _lateArray = [[NSMutableArray alloc] init];
    }
    return _lateArray;
}


- (NSMutableArray<UseShowBarsRedCell *> *)bestSerifOld {
    if (!_bestSerifOld) {
        _bestSerifOld = [[NSMutableArray alloc] init];
    }
    return _bestSerifOld;
}


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


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

@end
