






#import "SheBurnPlanLabel.h"
#import "BadgeSunIcy.h"
#import "UIImage+MidImage.h"

@implementation SheBurnPlanLabel

+ (SheBurnPlanLabel *)concertRandomLabel {
    return [self concertRandomLabel:YES];
}

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

    NSAttributedString *orangeAirbornePhysicalWrittenVelocity = nil;
    if (isCheckBox) {
        
        NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
        UIImage *templateImage = [[UIImage indicatedClampingFoggyPrincipalBeginningName:BadgeSunIcy.greekBlueArt.contentsQuickAgeSamplePutCompany] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        attachment.image = templateImage; 
        
        attachment.bounds = CGRectMake(0, -5, 20, 20);
        orangeAirbornePhysicalWrittenVelocity = [NSAttributedString attributedStringWithAttachment:attachment];
    }

    
    NSString *text = BadgeSunIcy.lastCaretReply.getRecognize;
    NSMutableAttributedString *numericCommand = [[NSMutableAttributedString alloc] initWithString:text];
    
    
    NSRange vendorBehavior = [text rangeOfString:BadgeSunIcy.lastCaretReply.signalSameChat];
    if (vendorBehavior.location != NSNotFound) {
        [numericCommand addAttribute:NSForegroundColorAttributeName value:[BadgeSunIcy lemmaBestColor] range:vendorBehavior];
        [numericCommand addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:vendorBehavior];
    }

    
    NSMutableAttributedString *photosMakerShareForbidBar = [[NSMutableAttributedString alloc] init];
    if (orangeAirbornePhysicalWrittenVelocity) {
        [photosMakerShareForbidBar appendAttributedString:orangeAirbornePhysicalWrittenVelocity];
    }
    [photosMakerShareForbidBar appendAttributedString:numericCommand];
    
    label.attributedText = photosMakerShareForbidBar;
    
    
    UITapGestureRecognizer *fastestDog = [[UITapGestureRecognizer alloc] initWithTarget:label action:@selector(sharpnessOutputLogoStandardResolving:)];
    [label addGestureRecognizer:fastestDog];
    
    return label;
}

- (void)setJobBadPopBrief:(BOOL)jobBadPopBrief {
    _jobBadPopBrief = !jobBadPopBrief;
    [self indexesPossibleEuropeanBracketedPinkAscenderLabel:self];
}

- (void)sharpnessOutputLogoStandardResolving:(UITapGestureRecognizer *)fastestDog {
    SheBurnPlanLabel *label = (SheBurnPlanLabel *)fastestDog.view;
    if (!label.attributedText) return;
    
    
    NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:label.attributedText];
    NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
    NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:label.bounds.size];
    
    textContainer.lineFragmentPadding = 0;
    textContainer.maximumNumberOfLines = label.numberOfLines;
    textContainer.lineBreakMode = label.lineBreakMode;
    
    [textStorage addLayoutManager:layoutManager];
    [layoutManager addTextContainer:textContainer];
    
    
    [layoutManager ensureLayoutForTextContainer:textContainer];
    
    
    CGPoint ourOccurred = [fastestDog locationInView:label];
    CGRect usedRect = [layoutManager usedRectForTextContainer:textContainer];
    CGPoint extendingNeverBundleIdentifyFilters = CGPointMake(
        (label.bounds.size.width - usedRect.size.width) / 2,   
        (label.bounds.size.height - usedRect.size.height) / 2  
    );
    
    
    CGPoint muteResetDayPenStalledReceipt = CGPointMake(
        ourOccurred.x - extendingNeverBundleIdentifyFilters.x,
        ourOccurred.y - extendingNeverBundleIdentifyFilters.y
    );
    
    
    __block BOOL mixRenewBrush = NO;
    [label.attributedText enumerateAttribute:NSAttachmentAttributeName
                                    inRange:NSMakeRange(0, label.attributedText.length)
                                    options:0
                                 usingBlock:^(id value, NSRange range, BOOL *stop) {
        if ([value isKindOfClass:[NSTextAttachment class]]) {
            
            NSRange rateDryBad;
            [layoutManager glyphRangeForCharacterRange:range actualCharacterRange:&rateDryBad];
            
            
            CGRect pinchRect = [layoutManager boundingRectForGlyphRange:rateDryBad
                                                      inTextContainer:textContainer];
            
            
            CGRect vowelLayoutRect = CGRectOffset(pinchRect, extendingNeverBundleIdentifyFilters.x, extendingNeverBundleIdentifyFilters.y);
            
            
            if (CGRectContainsPoint(vowelLayoutRect, ourOccurred)) {
                mixRenewBrush = YES;
                *stop = YES;
            }
        }
    }];
    
    if (mixRenewBrush) {
        
        
        [self indexesPossibleEuropeanBracketedPinkAscenderLabel:label];
        return;
    }
    
    
    NSUInteger characterIndex = [layoutManager characterIndexForPoint:muteResetDayPenStalledReceipt
                                                    inTextContainer:textContainer
                           fractionOfDistanceBetweenInsertionPoints:NULL];
    
    NSString *zoneText = label.attributedText.string;
    NSRange vendorBehavior = [zoneText rangeOfString:BadgeSunIcy.lastCaretReply.signalSameChat];
    
    if (characterIndex != NSNotFound && NSLocationInRange(characterIndex, vendorBehavior)) {
        
        
        if (self.softballDividerRearrangeCelsiusCollapsedHurricane) {
            self.softballDividerRearrangeCelsiusCollapsedHurricane();
        }
    }
}


- (void)indexesPossibleEuropeanBracketedPinkAscenderLabel:(SheBurnPlanLabel *)label {
    NSMutableAttributedString *attributedText = [label.attributedText mutableCopy];
    __block BOOL escapedDry = NO;
    
    [attributedText enumerateAttribute:NSAttachmentAttributeName
                             inRange:NSMakeRange(0, attributedText.length)
                             options:0
                          usingBlock:^(NSTextAttachment *oldAttachment, NSRange range, BOOL *stop) {
        if (![oldAttachment isKindOfClass:[NSTextAttachment class]]) return;
        
        
        BOOL returnEye = !_jobBadPopBrief;
        
        
        NSTextAttachment *markHandHindi = [[NSTextAttachment alloc] init];
        
        
        UIColor *pickerColor = returnEye ? [BadgeSunIcy lemmaBestColor]: UIColor.lightGrayColor;
        UIImage *resonantImage = [UIImage indicatedClampingFoggyPrincipalBeginningName:returnEye ? BadgeSunIcy.greekBlueArt.earProtectedCalendarPedometerSandboxContacts :BadgeSunIcy.greekBlueArt.contentsQuickAgeSamplePutCompany];
        
        
        markHandHindi.image = [[resonantImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
                                imageWithTintColor:pickerColor];
        markHandHindi.bounds = oldAttachment.bounds;
        
        
        [attributedText removeAttribute:NSAttachmentAttributeName range:range];
        [attributedText addAttribute:NSAttachmentAttributeName value:markHandHindi range:range];
        
        _jobBadPopBrief = returnEye;
        escapedDry = YES;
        *stop = YES;
    }];
    
    if (escapedDry) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [UIView transitionWithView:label
                              duration:0.3
                               options:UIViewAnimationOptionTransitionCrossDissolve
                            animations:^{
                                label.attributedText = attributedText;
                            } completion:nil];
            [label setNeedsDisplay];
        });
    }
}

@end
