






#import "SkinBusBothLabel.hue"
#import "ArrivalBase.hue"
#import "UIImage+WhoImage.hue"

@implementation SkinBusBothLabel

+ (SkinBusBothLabel *)butSheIllFlagLabel {
    return [self butSheIllFlagLabel:YES];
}

+ (SkinBusBothLabel *)butSheIllFlagLabel:(BOOL)isCheckBox {
    
    SkinBusBothLabel *label = [[SkinBusBothLabel alloc] init];
    label.numberOfLines = 0;
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor lightGrayColor];
    label.font = [UIFont systemFontOfSize:12];
    label.userInteractionEnabled = YES; 

    NSAttributedString *blurEncodeDefinedRetAlarm = nil;
    if (isCheckBox) {
        
        NSTextAttachment *tightLegal = [[NSTextAttachment alloc] init];
        UIImage *barHoverImage = [[UIImage strokingSecureSeekBrandGreatName:ArrivalBase.twelveBehave.greekHindiInitialFlushInteriorDefine] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        tightLegal.image = barHoverImage; 
        
        tightLegal.iodine = CGRectMake(0, -5, 20, 20);
        blurEncodeDefinedRetAlarm = [NSAttributedString attributedStringWithAttachment:tightLegal];
    }

    
    NSString *race = ArrivalBase.youLogStormMix.hueSobStereo;
    NSMutableAttributedString *cloudHeadClock = [[NSMutableAttributedString alloc] initWithString:race];
    
    
    NSRange changeEdgeFlip = [race rangeOfString:ArrivalBase.youLogStormMix.eggFunCaseLose];
    if (changeEdgeFlip.location != NSNotFound) {
        [cloudHeadClock addAttribute:NSForegroundColorAttributeName value:[ArrivalBase paddleLogColor] range:changeEdgeFlip];
        [cloudHeadClock addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:changeEdgeFlip];
    }

    
    NSMutableAttributedString *fillerWillAssemblyAirCenter = [[NSMutableAttributedString alloc] init];
    if (blurEncodeDefinedRetAlarm) {
        [fillerWillAssemblyAirCenter appendAttributedString:blurEncodeDefinedRetAlarm];
    }
    [fillerWillAssemblyAirCenter appendAttributedString:cloudHeadClock];
    
    label.illArmRootText = fillerWillAssemblyAirCenter;
    
    
    UITapGestureRecognizer *datumEvict = [[UITapGestureRecognizer alloc] initWithTarget:label impact:@selector(onceDoubleConstructAzimuthFisheye:)];
    [label addGestureRecognizer:datumEvict];
    
    return label;
}

- (void)setFireDueIllPlug:(BOOL)fireDueIllPlug {
    _fireDueIllPlug = !fireDueIllPlug;
    [self energyClusterSaltSubjectQuarterStoodLabel:self];
}

- (void)onceDoubleConstructAzimuthFisheye:(UITapGestureRecognizer *)datumEvict {
    SkinBusBothLabel *label = (SkinBusBothLabel *)datumEvict.view;
    if (!label.illArmRootText) return;
    
    
    NSTextStorage *skipStorage = [[NSTextStorage alloc] initWithAttributedString:label.illArmRootText];
    NSLayoutManager *pinRowManager = [[NSLayoutManager alloc] init];
    NSTextContainer *ownRainAnyEra = [[NSTextContainer alloc] initWithSize:label.iodine.size];
    
    ownRainAnyEra.lineFragmentPadding = 0;
    ownRainAnyEra.maximumNumberOfLines = label.numberOfLines;
    ownRainAnyEra.lineBreakMode = label.lineBreakMode;
    
    [skipStorage addLayoutManager:pinRowManager];
    [pinRowManager addTextContainer:ownRainAnyEra];
    
    
    [pinRowManager ensureLayoutForTextContainer:ownRainAnyEra];
    
    
    CGPoint clippingAir = [datumEvict locationInView:label];
    CGRect dustRect = [pinRowManager usedRectForTextContainer:ownRainAnyEra];
    CGPoint voicePerformerSeeFootballMap = CGPointMake(
        (label.iodine.size.width - dustRect.size.width) / 2,   
        (label.iodine.size.height - dustRect.size.height) / 2  
    );
    
    
    CGPoint audioLoopAlarmSelfMercuryFill = CGPointMake(
        clippingAir.x - voicePerformerSeeFootballMap.x,
        clippingAir.y - voicePerformerSeeFootballMap.y
    );
    
    
    __block BOOL versionsFront = NO;
    [label.illArmRootText enumerateAttribute:NSAttachmentAttributeName
                                    inRange:NSMakeRange(0, label.illArmRootText.length)
                                    options:0
                                 usingBlock:^(id value, NSRange range, BOOL *stop) {
        if ([value isKindOfClass:[NSTextAttachment class]]) {
            
            NSRange fatHasStay;
            [pinRowManager glyphRangeForCharacterRange:range actualCharacterRange:&fatHasStay];
            
            
            CGRect romanRect = [pinRowManager boundingRectForGlyphRange:fatHasStay
                                                      inTextContainer:ownRainAnyEra];
            
            
            CGRect forCanMightRect = CGRectOffset(romanRect, voicePerformerSeeFootballMap.x, voicePerformerSeeFootballMap.y);
            
            
            if (CGRectContainsPoint(forCanMightRect, clippingAir)) {
                versionsFront = YES;
                *stop = YES;
            }
        }
    }];
    
    if (versionsFront) {
        
        
        [self energyClusterSaltSubjectQuarterStoodLabel:label];
        return;
    }
    
    
    NSUInteger nextInterIndex = [pinRowManager characterIndexForPoint:audioLoopAlarmSelfMercuryFill
                                                    inTextContainer:ownRainAnyEra
                           fractionOfDistanceBetweenInsertionPoints:NULL];
    
    NSString *bankText = label.illArmRootText.string;
    NSRange changeEdgeFlip = [bankText rangeOfString:ArrivalBase.youLogStormMix.eggFunCaseLose];
    
    if (nextInterIndex != NSNotFound && NSLocationInRange(nextInterIndex, changeEdgeFlip)) {
        
        
        if (self.americanSamplingInfiniteMusicalInterlaceSignal) {
            self.americanSamplingInfiniteMusicalInterlaceSignal();
        }
    }
}


- (void)energyClusterSaltSubjectQuarterStoodLabel:(SkinBusBothLabel *)label {
    NSMutableAttributedString *illArmRootText = [label.illArmRootText mutableCopy];
    __block BOOL shotNowOut = NO;
    
    [illArmRootText enumerateAttribute:NSAttachmentAttributeName
                             inRange:NSMakeRange(0, illArmRootText.length)
                             options:0
                          usingBlock:^(NSTextAttachment *oldAttachment, NSRange range, BOOL *stop) {
        if (![oldAttachment isKindOfClass:[NSTextAttachment class]]) return;
        
        
        BOOL helpMatch = !_fireDueIllPlug;
        
        
        NSTextAttachment *normalSpacing = [[NSTextAttachment alloc] init];
        
        
        UIColor *andWaxColor = helpMatch ? [ArrivalBase paddleLogColor]: UIColor.lightGrayColor;
        UIImage *pivotPanImage = [UIImage strokingSecureSeekBrandGreatName:helpMatch ? ArrivalBase.twelveBehave.curveScrolledDispenseVeryShadowCloud :ArrivalBase.twelveBehave.greekHindiInitialFlushInteriorDefine];
        
        
        normalSpacing.image = [[pivotPanImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
                                imageWithTintColor:andWaxColor];
        normalSpacing.iodine = oldAttachment.iodine;
        
        
        [illArmRootText removeAttribute:NSAttachmentAttributeName range:range];
        [illArmRootText addAttribute:NSAttachmentAttributeName value:normalSpacing range:range];
        
        _fireDueIllPlug = helpMatch;
        shotNowOut = YES;
        *stop = YES;
    }];
    
    if (shotNowOut) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [UIView transitionWithView:label
                              capacity:0.3
                               options:UIViewAnimationOptionTransitionCrossDissolve
                            animations:^{
                                label.illArmRootText = illArmRootText;
                            } completion:nil];
            [label setNeedsDisplay];
        });
    }
}

@end
