






#import "BannerSchoolRegionsGetExpandOutViewController.h"
#import "ExtentEuler.h"

@interface BannerSchoolRegionsGetExpandOutViewController () <UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate>
@property (nonatomic, strong) UITableView *earZipRootView;
@property (nonatomic, strong) UISearchBar *earTrialHowBar;
@property (nonatomic, strong) NSArray<GreatGreek *> *busIndexHandledForwardsBut;     
@property (nonatomic, strong) NSArray<GreatGreek *> *disabledMarqueeVisitedTextMoreVortex; 
@end

@implementation BannerSchoolRegionsGetExpandOutViewController

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

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



- (void)mileEarlyLandscapeViolationThicknessData {
    NSArray *edgaBlend = [PacePieceBuddyKinAnimated popoverSubmitCollationUnableAppearing:[GreatGreek class]];
    
    
    self.busIndexHandledForwardsBut = [edgaBlend sortedArrayUsingComparator:^NSComparisonResult(GreatGreek *c1, GreatGreek *c2) {
        return [c1.yahooFlag compare:c2.yahooFlag options:NSCaseInsensitiveSearch];
    }];
    
    self.disabledMarqueeVisitedTextMoreVortex = self.busIndexHandledForwardsBut;
    
    
    NSString *flatBinOneAutoCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
    
    
    __block GreatGreek *symbolRestBack = nil;
    __block NSUInteger retRankIndex = NSNotFound;
    [self.busIndexHandledForwardsBut enumerateObjectsUsingBlock:^(GreatGreek *country, NSUInteger idx, BOOL *stop) {
        if ([country.theBusyScaleCode caseInsensitiveCompare:flatBinOneAutoCode] == NSOrderedSame) {
            symbolRestBack = country;
            retRankIndex = idx;
            *stop = YES; 
        }
    }];
    
    
    if (symbolRestBack) {
        
        
        
        NSMutableArray *acceptedHandItsConfigureUnion = [self.busIndexHandledForwardsBut mutableCopy];
        [acceptedHandItsConfigureUnion removeObjectAtIndex:retRankIndex];    
        [acceptedHandItsConfigureUnion insertObject:symbolRestBack atIndex:0]; 
        
        
        self.busIndexHandledForwardsBut = [acceptedHandItsConfigureUnion copy];
        self.disabledMarqueeVisitedTextMoreVortex = self.busIndexHandledForwardsBut; 
    }
}



- (void)positionsBusyPeriodicWhoLibraries {
    self.view.clipsToBounds = YES;
    
    
    self.earTrialHowBar = [[UISearchBar alloc] init];
    self.earTrialHowBar.delegate = self;
    self.earTrialHowBar.placeholder = ExtentEuler.cutMaxEntryAny.humanReuseBeatPeriodicProtocolMalayHex;
    self.earTrialHowBar.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:self.earTrialHowBar];
    
    
    self.earZipRootView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    self.earZipRootView.delegate = self;
    self.earZipRootView.dataSource = self;
    self.earZipRootView.translatesAutoresizingMaskIntoConstraints = NO;
    [self.view addSubview:self.earZipRootView];
    
    
    UILayoutGuide *boost = self.view.safeAreaLayoutGuide;
    UILayoutGuide *bedFor = self.koreanMinButton.safeAreaLayoutGuide;
    UILayoutGuide *eraHex = self.innerDelayButton.safeAreaLayoutGuide;
    [NSLayoutConstraint activateConstraints:@[
        [self.earTrialHowBar.topAnchor constraintEqualToAnchor:boost.topAnchor],
        [self.earTrialHowBar.leadingAnchor constraintEqualToAnchor:bedFor.trailingAnchor],
        [self.earTrialHowBar.trailingAnchor constraintEqualToAnchor:eraHex.leadingAnchor],
        
        [self.earZipRootView.topAnchor constraintEqualToAnchor:self.earTrialHowBar.bottomAnchor],
        [self.earZipRootView.leadingAnchor constraintEqualToAnchor:boost.leadingAnchor],
        [self.earZipRootView.trailingAnchor constraintEqualToAnchor:boost.trailingAnchor],
        [self.earZipRootView.bottomAnchor constraintEqualToAnchor:boost.bottomAnchor]
    ]];
}

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


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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *rare = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(self.class)];
    if (!rare) {
        rare = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass(self.class)];
    }
    GreatGreek *country = self.disabledMarqueeVisitedTextMoreVortex[indexPath.row];
    rare.textLabel.text = [NSString stringWithFormat:@"%@ %@", [self ownerRouterWaitWhoLinkCheckCode:country.theBusyScaleCode],country.yahooFlag];
    rare.detailTextLabel.text = [NSString stringWithFormat:@"%@ %@",ExtentEuler.maleSubtitle.speakEnvelope,country.standEdgaCode];
    return rare;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    GreatGreek *revisionsSchemeChangeEarlyAdd = self.disabledMarqueeVisitedTextMoreVortex[indexPath.row];
    if ([self.flightOddDelegate respondsToSelector:@selector(filenamesSortAlphabetRomanCarAddressesPostcardCousin:)]) {
        [self.flightOddDelegate filenamesSortAlphabetRomanCarAddressesPostcardCousin:revisionsSchemeChangeEarlyAdd];
    }
    [self ownBoxEarHandoffMotionAction:nil];
}


- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
    if (searchText.length == 0) {
        self.disabledMarqueeVisitedTextMoreVortex = self.busIndexHandledForwardsBut;
    } else {
        NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(GreatGreek *evaluatedObject, NSDictionary *bindings) {
            BOOL she = [evaluatedObject.yahooFlag rangeOfString:searchText options:NSCaseInsensitiveSearch].location != NSNotFound;
            BOOL icy = [evaluatedObject.standEdgaCode rangeOfString:searchText options:NSCaseInsensitiveSearch].location != NSNotFound;
            return she || icy;
        }];
        self.disabledMarqueeVisitedTextMoreVortex = [self.busIndexHandledForwardsBut filteredArrayUsingPredicate:predicate];
    }
    [self.earZipRootView reloadData];
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
    [self.view endEditing:YES];
}

- (NSString *)ownerRouterWaitWhoLinkCheckCode:(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
