






#import "EarManExtrasCell.h"
#import "SubBondFour.h"
#import "Masonry.h"
#import "UIImage+GetImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+NonceBeen.h"

@interface EarManExtrasCell()


@property (nonatomic,strong) NSString * specificInfer;


@property (nonatomic,strong) UIImageView * modalTableView;


@property (nonatomic,strong) UILabel * squashRearLabel;


@property (nonatomic,strong) UILabel * leaseRainLabel;

@property (nonatomic, strong) UIButton * jobSawButton;

@end

@implementation EarManExtrasCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = SubBondFour.nodeFourteen.suchIdleEye;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.modalTableView = [UIImageView new];
        self.modalTableView.tintColor = [SubBondFour routeHeapColor];
        self.modalTableView.layer.cornerRadius = SubBondFour.nodeFourteen.makeSliceKey;
        [self.contentView addSubview:self.modalTableView];
        [self.modalTableView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(SubBondFour.nodeFourteen.tagWetTorch);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(SubBondFour.nodeFourteen.hexLemmaSlow);
        }];
        
        self.squashRearLabel = [UILabel new];
        self.squashRearLabel.font = [UIFont boldSystemFontOfSize:SubBondFour.nodeFourteen.tryBasalCert];
        self.squashRearLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.squashRearLabel];
        
        self.leaseRainLabel = [UILabel new];
        self.leaseRainLabel.font = [UIFont boldSystemFontOfSize:SubBondFour.nodeFourteen.digitButFull];
        self.leaseRainLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.leaseRainLabel];
        
        [self.squashRearLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.modalTableView.mas_right).offset(SubBondFour.nodeFourteen.potassiumTop);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.leaseRainLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.squashRearLabel);
            make.top.equalTo(self.squashRearLabel.mas_bottom).offset(SubBondFour.nodeFourteen.moduleTamil);
        }];
        
        self.jobSawButton = [[UIButton alloc] init];
        _jobSawButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage positionOwnMeteringSourcesBookName:SubBondFour.nodeFourteen.bigSobLateRedoneDescribe] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_jobSawButton setBackgroundImage:[UIImage positionOwnMeteringSourcesBookName:SubBondFour.nodeFourteen.reservedCloudyBoldArcadeNoise] forState: UIControlStateNormal];
        [_jobSawButton setBackgroundImage:image forState: UIControlStateSelected];
        _jobSawButton.tintColor = [SubBondFour routeHeapColor];
        [self.contentView addSubview:_jobSawButton];
        [_jobSawButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-SubBondFour.nodeFourteen.potassiumTop);
            make.size.mas_equalTo(CGSizeMake(SubBondFour.nodeFourteen.heartBedExec, SubBondFour.nodeFourteen.heartBedExec));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _jobSawButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [SubBondFour routeHeapColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = SubBondFour.nodeFourteen.tagWetTorch;
    frame.size.width -= SubBondFour.nodeFourteen.tryBasalCert;
    frame.origin.y += SubBondFour.nodeFourteen.tagWetTorch;
    frame.size.height -= SubBondFour.nodeFourteen.tagWetTorch;
    [super setFrame:frame];
}

-(void)setSpecificInfer:(NSString *)specificInfer {
    _specificInfer = specificInfer;
    [self.modalTableView sd_setImageWithURL:[NSURL URLWithString:specificInfer] placeholderImage:nil];
}

- (void)setNapRestRed:(ButtonsQualifiedCopticCancelingElementWho *)napRestRed {
    _napRestRed= napRestRed;
    self.specificInfer = napRestRed.immediate;
    self.squashRearLabel.text = napRestRed.ownerLazy;
    NSString *note = napRestRed.cellModel?:@"";
    if (note.barOwnership) {
        self.leaseRainLabel.hidden = YES;
        [self.squashRearLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.modalTableView.mas_right).offset(SubBondFour.nodeFourteen.potassiumTop);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.leaseRainLabel.hidden = NO;
        NSRange mostly = [note rangeOfString:SubBondFour.nodeFourteen.exceptionScopeIllegalRepeatLaunchGeometric];
        NSRange credit = [note rangeOfString:SubBondFour.nodeFourteen.ownerShiftAcceptedTipSamplerScroll];
        
        if (mostly.length == 0 && credit.length == 0) {
            self.leaseRainLabel.text = note;
            self.leaseRainLabel.font = [UIFont systemFontOfSize:SubBondFour.nodeFourteen.digitButFull];
            self.leaseRainLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange surgeWin = NSMakeRange(mostly.location+mostly.length, credit.location-(mostly.location+mostly.length));
            NSString *eleven = [note substringWithRange:surgeWin];
            NSString *runMore = [note stringByReplacingOccurrencesOfString:SubBondFour.nodeFourteen.exceptionScopeIllegalRepeatLaunchGeometric withString:@""];
            runMore = [runMore stringByReplacingOccurrencesOfString:SubBondFour.nodeFourteen.ownerShiftAcceptedTipSamplerScroll withString:@""];
            
            surgeWin = [runMore rangeOfString:eleven];
            NSMutableAttributedString *exitsNoneTry = [[NSMutableAttributedString alloc] initWithString:runMore];
            [exitsNoneTry addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, runMore.length)];
            [exitsNoneTry addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, runMore.length)];
            [exitsNoneTry addAttribute:NSForegroundColorAttributeName value:[SubBondFour routeHeapColor] range:surgeWin];
            [exitsNoneTry addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:surgeWin];
            
            self.leaseRainLabel.attributedText = exitsNoneTry;
        }
        
        [self.squashRearLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.modalTableView.mas_right).offset(SubBondFour.nodeFourteen.potassiumTop);
            make.top.equalTo(self.modalTableView).offset(SubBondFour.nodeFourteen.oldDoneHigh);
        }];
    }
}

@end
