






#import "ClipGrantingCell.h"
#import "HisTwoEject.h"
#import "Masonry.h"
#import "UIImage+EyeImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+BankDrive.h"

@interface ClipGrantingCell()


@property (nonatomic,strong) NSString * airRootEyeMid;


@property (nonatomic,strong) UIImageView * curlTagSixView;


@property (nonatomic,strong) UILabel * feedLawNotLabel;


@property (nonatomic,strong) UILabel * allocatorLabel;

@property (nonatomic, strong) UIButton * celticButton;

@end

@implementation ClipGrantingCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = HisTwoEject.mildVitalEar.eldestBring;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.curlTagSixView = [UIImageView new];
        self.curlTagSixView.tintColor = [HisTwoEject darkMinorColor];
        self.curlTagSixView.layer.cornerRadius = HisTwoEject.mildVitalEar.strokedEight;
        [self.contentView addSubview:self.curlTagSixView];
        [self.curlTagSixView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(HisTwoEject.mildVitalEar.disablesDid);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(HisTwoEject.mildVitalEar.queryEarFunk);
        }];
        
        self.feedLawNotLabel = [UILabel new];
        self.feedLawNotLabel.font = [UIFont boldSystemFontOfSize:HisTwoEject.mildVitalEar.wetCopperCut];
        self.feedLawNotLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.feedLawNotLabel];
        
        self.allocatorLabel = [UILabel new];
        self.allocatorLabel.font = [UIFont boldSystemFontOfSize:HisTwoEject.mildVitalEar.germanObject];
        self.allocatorLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.allocatorLabel];
        
        [self.feedLawNotLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.curlTagSixView.mas_right).offset(HisTwoEject.mildVitalEar.greaterMedia);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.allocatorLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.feedLawNotLabel);
            make.top.equalTo(self.feedLawNotLabel.mas_bottom).offset(HisTwoEject.mildVitalEar.mutationFax);
        }];
        
        self.celticButton = [[UIButton alloc] init];
        _celticButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage undoneWasCallContainsRelevanceName:HisTwoEject.mildVitalEar.matrixArtDrizzleBannerIgnored] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_celticButton setBackgroundImage:[UIImage undoneWasCallContainsRelevanceName:HisTwoEject.mildVitalEar.slabDeclineInsideEditorialUnder] forState: UIControlStateNormal];
        [_celticButton setBackgroundImage:image forState: UIControlStateSelected];
        _celticButton.tintColor = [HisTwoEject darkMinorColor];
        [self.contentView addSubview:_celticButton];
        [_celticButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-HisTwoEject.mildVitalEar.greaterMedia);
            make.size.mas_equalTo(CGSizeMake(HisTwoEject.mildVitalEar.forYouFamily, HisTwoEject.mildVitalEar.forYouFamily));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _celticButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [HisTwoEject darkMinorColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = HisTwoEject.mildVitalEar.disablesDid;
    frame.size.width -= HisTwoEject.mildVitalEar.wetCopperCut;
    frame.origin.y += HisTwoEject.mildVitalEar.disablesDid;
    frame.size.height -= HisTwoEject.mildVitalEar.disablesDid;
    [super setFrame:frame];
}

-(void)setAirRootEyeMid:(NSString *)airRootEyeMid {
    _airRootEyeMid = airRootEyeMid;
    [self.curlTagSixView sd_setImageWithURL:[NSURL URLWithString:airRootEyeMid] placeholderImage:nil];
}

- (void)setSubDegrees:(AlignRhythmDisappearDutchClampBin *)subDegrees {
    _subDegrees= subDegrees;
    self.airRootEyeMid = subDegrees.heavyTemp;
    self.feedLawNotLabel.text = subDegrees.delivered;
    NSString *note = subDegrees.rowIndigo?:@"";
    if (note.onceSubWaist) {
        self.allocatorLabel.hidden = YES;
        [self.feedLawNotLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.curlTagSixView.mas_right).offset(HisTwoEject.mildVitalEar.greaterMedia);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.allocatorLabel.hidden = NO;
        NSRange driven = [note rangeOfString:HisTwoEject.mildVitalEar.compactHexPointersBridgingLighterHeadphone];
        NSRange markup = [note rangeOfString:HisTwoEject.mildVitalEar.driveKilovoltsItsFaxOutDefault];
        
        if (driven.length == 0 && markup.length == 0) {
            self.allocatorLabel.text = note;
            self.allocatorLabel.font = [UIFont systemFontOfSize:HisTwoEject.mildVitalEar.germanObject];
            self.allocatorLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange anyAudit = NSMakeRange(driven.location+driven.length, markup.location-(driven.location+driven.length));
            NSString *waxIcy = [note substringWithRange:anyAudit];
            NSString *burnDog = [note stringByReplacingOccurrencesOfString:HisTwoEject.mildVitalEar.compactHexPointersBridgingLighterHeadphone withString:@""];
            burnDog = [burnDog stringByReplacingOccurrencesOfString:HisTwoEject.mildVitalEar.driveKilovoltsItsFaxOutDefault withString:@""];
            
            anyAudit = [burnDog rangeOfString:waxIcy];
            NSMutableAttributedString *searchFactor = [[NSMutableAttributedString alloc] initWithString:burnDog];
            [searchFactor addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, burnDog.length)];
            [searchFactor addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, burnDog.length)];
            [searchFactor addAttribute:NSForegroundColorAttributeName value:[HisTwoEject darkMinorColor] range:anyAudit];
            [searchFactor addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:anyAudit];
            
            self.allocatorLabel.attributedText = searchFactor;
        }
        
        [self.feedLawNotLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.curlTagSixView.mas_right).offset(HisTwoEject.mildVitalEar.greaterMedia);
            make.top.equalTo(self.curlTagSixView).offset(HisTwoEject.mildVitalEar.monthFolder);
        }];
    }
}

@end
