






#import "NineResumeViewController.h"
#import "PinDueListConfig.h"
#import "NSObject+BigModel.h"
#import "UIColor+HueColor.h"
#import "ManToast.h"

@interface NineResumeViewController ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *bitsAppleCertCervicalChain; 
@property (nonatomic, strong) NSArray<NSArray<NSString *> *> *fadeYearsAngle; 
@property (nonatomic, strong) NSMutableArray<NSString *> *sectionTitles; 

@end

@implementation NineResumeViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    _bitsAppleCertCervicalChain = [NSMutableArray array];
    _fadeYearsAngle = @[];
    _sectionTitles = [NSMutableArray array];
    
    [self sunKernelsView];
}

- (void)viewWillAppear:(BOOL)animated {
    
    UIEdgeInsets dynamicMay = [[ExtendingManager shared] startupBadgeWindow].safeAreaInsets;
    
    dynamicMay.top    += 10;
    dynamicMay.left   += 10;
    dynamicMay.bottom += 10;
    dynamicMay.right  += 10;

    [self.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(dynamicMay);
    }];
}


- (void)sunKernelsView {
    _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:_tableView];
    [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.formatIllButton.mas_bottom);
        make.left.right.bottom.equalTo(self.view);
    }];
    
    
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass(self.class)];
}


- (NSArray<NSString *> *)startNeedInnerDictionary:(NSDictionary *)hang {
    return [[hang allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
}

- (void)manFixIcySameInfo:(NSDictionary *)info withTitle:(NSString *)title {
    if (!info || ![info isKindOfClass:[NSDictionary class]]) {
        return;
    }
    
    
    dispatch_async(dispatch_get_main_queue(), ^{
        @synchronized (self) {
            
            [self->_bitsAppleCertCervicalChain addObject:[info copy]];
            NSArray *offAreList = [self startNeedInnerDictionary:info];
            self->_fadeYearsAngle = [self->_fadeYearsAngle arrayByAddingObject:offAreList];
            [self->_sectionTitles addObject:title];
            
            
            [self.tableView reloadData];
        }
    });
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return _bitsAppleCertCervicalChain.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _fadeYearsAngle[section].count;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    return _sectionTitles[section];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self.class) forIndexPath:indexPath];
    
    NSString *key;
    id value;
    NSInteger pointerIndex = indexPath.section;
    key = _fadeYearsAngle[pointerIndex][indexPath.row];
    value = _bitsAppleCertCervicalChain[pointerIndex][key];
    BOOL solidMen = [value isKindOfClass:[NSDictionary class]] || [value isKindOfClass:[NSArray class]];
    cell.backgroundColor = [UIColor clearColor];
    
    
    for (UIView *workSay in cell.contentView.subviews) {
        [workSay removeFromSuperview];
    }
    
    
    UILabel *areLabel = [[UILabel alloc] init];
    areLabel.font = [UIFont monospacedSystemFontOfSize:14 weight:UIFontWeightMedium];
    areLabel.textColor = [UIColor darkGrayColor];
    areLabel.text = key;
    areLabel.numberOfLines = 0;
    [cell.contentView addSubview:areLabel];
    
    
    UILabel *errorLabel = [[UILabel alloc] init];
    errorLabel.font = [UIFont monospacedSystemFontOfSize:14 weight:UIFontWeightRegular];
    errorLabel.textColor = [UIColor blackColor];
    errorLabel.numberOfLines = 0;
    errorLabel.textAlignment = NSTextAlignmentRight;
    [cell.contentView addSubview:errorLabel];
    
    
    [areLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(cell.contentView).offset(TopMergeNap.yetChromaUse.dogIterative);
        make.top.equalTo(cell.contentView).offset(TopMergeNap.yetChromaUse.shareKinMenu);
        make.bottom.equalTo(cell.contentView).offset(-TopMergeNap.yetChromaUse.shareKinMenu);
        make.width.equalTo(cell.contentView.mas_width).multipliedBy(solidMen?TopMergeNap.yetChromaUse.lateCupClamp:TopMergeNap.yetChromaUse.accuracyDense);
    }];
    
    [errorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(cell.contentView).offset(-TopMergeNap.yetChromaUse.dogIterative);
        make.top.equalTo(cell.contentView).offset(TopMergeNap.yetChromaUse.shareKinMenu);
        make.bottom.equalTo(cell.contentView).offset(-TopMergeNap.yetChromaUse.shareKinMenu);
        make.left.equalTo(areLabel.mas_right).offset(TopMergeNap.yetChromaUse.shareKinMenu);
    }];
    
    
    if (solidMen) {
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    } else {
        errorLabel.text = [value description];
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    id value;
    NSString *key;
    
    NSInteger pointerIndex = indexPath.section;
    key = _fadeYearsAngle[pointerIndex][indexPath.row];
    value = _bitsAppleCertCervicalChain[pointerIndex][key];
    
    
    if ([value isKindOfClass:[NSDictionary class]]) {
        [self offDragWasDictionary:value withTitle:key];
    } else if ([value isKindOfClass:[NSArray class]]) {
        [self blobCanEraArray:value withTitle:key];
    } else {
        
        UIPasteboard *twelveFade = [UIPasteboard generalPasteboard];
        [twelveFade setString:[value description]];
        [ManToast capDrum:TopMergeNap.yetChromaUse.sensorMirroredEstimatedNetSexLiner];
    }
}


- (void)offDragWasDictionary:(NSDictionary *)hang withTitle:(NSString *)title {
    NineResumeViewController *bigClock = [[NineResumeViewController alloc] init];
    [self.navigationController pushViewController:bigClock animated:NO];
    [bigClock manFixIcySameInfo:hang withTitle:title];
}

- (void)blobCanEraArray:(NSArray *)array withTitle:(NSString *)title {
    
    NSMutableDictionary *helloDict = [NSMutableDictionary dictionary];
    for (NSInteger i = 0; i < array.count; i++) {
        helloDict[[NSString stringWithFormat:@"[%ld]", (long)i]] = array[i];
    }
    
    NineResumeViewController *bigClock = [[NineResumeViewController alloc] init];
    [self.navigationController pushViewController:bigClock animated:NO];
    [bigClock manFixIcySameInfo:helloDict withTitle:[NSString stringWithFormat:@"%@ (Array)", title]];
}

@end
