






#import "PedometerSeparatorCanceledPaymentsSunPencilViewController.h"
#import "MenTintSave.h"

@interface PedometerSeparatorCanceledPaymentsSunPencilViewController () <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
@property (nonatomic, strong) UITableView *spineWaistView;
@property (nonatomic, strong) UISearchBar *likeStalledBar;
@property (nonatomic, strong) NSArray<OurDoneTap *> *mapBloodBundleSquaresArbiter;     
@property (nonatomic, strong) NSArray<OurDoneTap *> *dogMusicRenamingAnswerDeparturePlate; 
@end

@implementation PedometerSeparatorCanceledPaymentsSunPencilViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self loopWithAvailablePivotSheData];
    [self maxSquashAdvisedForCleared];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [super touchesBegan:touches withEvent:event];
    [self.view endEditing:YES];
}



- (void)loopWithAvailablePivotSheData {
    NSArray *mandatory = [OutletCupFoggyGroupingSeven procedureImageOldAnyExported:[OurDoneTap class]];
    
    
    self.mapBloodBundleSquaresArbiter = [mandatory sortedArrayUsingComparator:^NSComparisonResult(OurDoneTap *c1, OurDoneTap *c2) {
        return [c1.hurricane compare:c2.hurricane options:NSCaseInsensitiveSearch];
    }];
    
    self.dogMusicRenamingAnswerDeparturePlate = self.mapBloodBundleSquaresArbiter;
    
    
    NSString *historyDetailsCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
    
    
    __block OurDoneTap *flatSizeMixTap = nil;
    __block NSUInteger gainNotIndex = NSNotFound;
    [self.mapBloodBundleSquaresArbiter enumerateObjectsUsingBlock:^(OurDoneTap *country, NSUInteger idx, BOOL *stop) {
        if ([country.refreshGuideCode caseInsensitiveCompare:historyDetailsCode] == NSOrderedSame) {
            flatSizeMixTap = country;
            gainNotIndex = idx;
            *stop = YES; 
        }
    }];
    
    
    if (flatSizeMixTap) {
        
        
        
        NSMutableArray *necessaryBrokenServicesSubmitEviction = [self.mapBloodBundleSquaresArbiter mutableCopy];
        [necessaryBrokenServicesSubmitEviction removeObjectAtIndex:gainNotIndex];    
        [necessaryBrokenServicesSubmitEviction insertObject:flatSizeMixTap atIndex:0]; 
        
        
        self.mapBloodBundleSquaresArbiter = [necessaryBrokenServicesSubmitEviction copy];
        self.dogMusicRenamingAnswerDeparturePlate = self.mapBloodBundleSquaresArbiter; 
    }
}



- (void)maxSquashAdvisedForCleared {
    self.view.clipsToBounds = YES;
    
    
    self.likeStalledBar = [[UISearchBar alloc] init];
    self.likeStalledBar.delegate = self;
    self.likeStalledBar.placeholder = MenTintSave.mixerRetDogPub.armpitBroadcastOffAttachCollapseGoogleEntries;
    self.likeStalledBar.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:self.likeStalledBar];
    
    
    self.spineWaistView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    self.spineWaistView.delegate = self;
    self.spineWaistView.dataSource = self;
    self.spineWaistView.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:self.spineWaistView];
    
    
    UILayoutGuide *moire = self.view.safeAreaLayoutGuide;
    UILayoutGuide *kitEnd = self.pastFlashButton.safeAreaLayoutGuide;
    UILayoutGuide *arcade = self.browseWorkButton.safeAreaLayoutGuide;
    [NSLayoutConstraint activateConstraints:@[
        [self.likeStalledBar.topAnchor constraintEqualToAnchor:moire.topAnchor],
        [self.likeStalledBar.leadingAnchor constraintEqualToAnchor:kitEnd.trailingAnchor],
        [self.likeStalledBar.trailingAnchor constraintEqualToAnchor:arcade.leadingAnchor],
        
        [self.spineWaistView.topAnchor constraintEqualToAnchor:self.likeStalledBar.bottomAnchor],
        [self.spineWaistView.leadingAnchor constraintEqualToAnchor:moire.leadingAnchor],
        [self.spineWaistView.trailingAnchor constraintEqualToAnchor:moire.trailingAnchor],
        [self.spineWaistView.bottomAnchor constraintEqualToAnchor:moire.bottomAnchor]
    ]];
}

- (void)datumChangeAction {
    [self dismissViewControllerAnimated:YES completion:nil];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dogMusicRenamingAnswerDeparturePlate.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *mill = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self.class)];
    if (!mill) {
        mill = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass(self.class)];
    }
    OurDoneTap *country = self.dogMusicRenamingAnswerDeparturePlate[indexPath.row];
    mill.textLabel.text = [NSString stringWithFormat:@"%@ %@", [self loopsTenMoodYearRingPathCode:country.refreshGuideCode],country.hurricane];
    mill.detailTextLabel.text = [NSString stringWithFormat:@"%@ %@",MenTintSave.ironRouteMix.trustSeeModal,country.panListenCode];
    return mill;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    OurDoneTap *leftReplyInheritedNetConfirm = self.dogMusicRenamingAnswerDeparturePlate[indexPath.row];
    if ([self.binDegreeDelegate respondsToSelector:@selector(mildEdgaModalSoftLengthsCrossLightAsk:)]) {
        [self.binDegreeDelegate mildEdgaModalSoftLengthsCrossLightAsk:leftReplyInheritedNetConfirm];
    }
    [self tagsMegahertzRhythmDependingHardAction:nil];
}


- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
    if (searchText.length == 0) {
        self.dogMusicRenamingAnswerDeparturePlate = self.mapBloodBundleSquaresArbiter;
    } else {
        NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(OurDoneTap *evaluatedObject, NSDictionary *bindings) {
            BOOL law = [evaluatedObject.hurricane rangeOfString:searchText options:NSCaseInsensitiveSearch].location != NSNotFound;
            BOOL are = [evaluatedObject.panListenCode rangeOfString:searchText options:NSCaseInsensitiveSearch].location != NSNotFound;
            return law || are;
        }];
        self.dogMusicRenamingAnswerDeparturePlate = [self.mapBloodBundleSquaresArbiter filteredArrayUsingPredicate:predicate];
    }
    [self.spineWaistView reloadData];
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
    [self.view endEditing:YES];
}

- (NSString *)loopsTenMoodYearRingPathCode:(NSString *)countryCode {
    
    if(![countryCode isKindOfClass:[NSString class]] || countryCode.length != 2 || [countryCode isEqualToString:@"TW"]) return @"";
    int base = 127397;
    
    wchar_t bytes[2] = {
        base +[countryCode characterAtIndex:0],
        base +[countryCode characterAtIndex:1]
    };
    
    return [[NSString alloc] initWithBytes:bytes
                                    length:countryCode.length *sizeof(wchar_t)
                                  encoding:NSUTF32LittleEndianStringEncoding];
}

- (void)dealloc {
    
}
@end
