






#import "EraSawExitsBoxViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+TalkBound.h"
#import "NSString+LowMaterial.h"

@interface EraSawExitsBoxViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *ourJustAxesZipControl;
@property (nonatomic, strong) UIView * gramSourcesKeysRoomSon;
@property (nonatomic, strong) UIView * thatBayerSheSendPlus;

@property (nonatomic, strong) UIScrollView * bitsBlueZipView;

@end

@implementation EraSawExitsBoxViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.martialAreButton.hidden = YES;
    self.loudBuddyButton.hidden = YES;
    
    UISegmentedControl *maxAreaView = [[UISegmentedControl alloc] initWithItems:@[WinNeedHang.mapSonInputIll.sceneGuestPredicateMethodLemmaAnnotated,WinNeedHang.mapSonInputIll.tabFailurePersonalGenderMatrixTrigger]];
    maxAreaView.layer.masksToBounds = YES; 
    maxAreaView.layer.cornerRadius = 2;    
    [maxAreaView setTitleTextAttributes:@{NSForegroundColorAttributeName:[WinNeedHang suspendedColor]} forState:UIControlStateSelected];
    [maxAreaView setTitleTextAttributes:@{NSForegroundColorAttributeName:[WinNeedHang suspendedColor]} forState:UIControlStateNormal];
    [self.view addSubview:maxAreaView];
    [maxAreaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(WinNeedHang.chargePenSin.illReadTool);
    }];
    [maxAreaView addTarget:self action:@selector(replacedQueue:) forControlEvents:UIControlEventValueChanged];
    self.ourJustAxesZipControl = maxAreaView;
    
    _bitsBlueZipView = [[UIScrollView alloc]init];
    _bitsBlueZipView.pagingEnabled = YES;
    _bitsBlueZipView.delegate = self;
    [self.view addSubview:_bitsBlueZipView];
    [_bitsBlueZipView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(WinNeedHang.chargePenSin.datumMayBook);
        make.right.equalTo(self.view).offset(-WinNeedHang.chargePenSin.datumMayBook);
        make.top.equalTo(self.view).offset(WinNeedHang.chargePenSin.accountsBack);
        make.bottom.equalTo(self.view).offset(-WinNeedHang.chargePenSin.tenGuestFair);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.bitsBlueZipView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.bitsBlueZipView);
        make.height.equalTo(_bitsBlueZipView);
    }];
    
    UIView * borderedZoom = [self runCupBandView:[WinNeedHang dolbyMuteAspectBottomDecipher]];
    [containerView addSubview:borderedZoom];
    [borderedZoom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.bitsBlueZipView);
    }];
    self.gramSourcesKeysRoomSon = borderedZoom;
    
    UIView * anyOptRevert = [self runCupBandView:[WinNeedHang rearrangeReachableOrderedHisAscent]];
    [containerView addSubview:anyOptRevert];
    [anyOptRevert mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(borderedZoom.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.bitsBlueZipView);
    }];
    self.thatBayerSheSendPlus = anyOptRevert;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(anyOptRevert.mas_right);
    }];
    
    if (![self.workflowWay boolValue]) {
        UIButton *selfKitButton = [WinNeedHang slidingUrgencyLocalizesLandmarkInventoryColor:WinNeedHang.mapSonInputIll.butBasicFair];
        [selfKitButton setBackgroundImage:[UIImage capMidDelayAirColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [selfKitButton addTarget:self action:@selector(smoothPopDesignWideCacheLow:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:selfKitButton];
        [selfKitButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-WinNeedHang.chargePenSin.butCropFoot);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(WinNeedHang.chargePenSin.tooCousinPin);
        }];
    }
    
    UIButton *boxKeysButton =  [WinNeedHang slidingUrgencyLocalizesLandmarkInventoryColor:WinNeedHang.mapSonInputIll.areHourArm];
    [boxKeysButton addTarget:self action:@selector(carVowelElectricBeforeLigaturePressure:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:boxKeysButton];
    [boxKeysButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-WinNeedHang.chargePenSin.butCropFoot);
        make.centerX.equalTo(self.view).multipliedBy(![self.workflowWay boolValue]?1.35:1);
        make.height.mas_equalTo(WinNeedHang.chargePenSin.tooCousinPin);
    }];
    
    maxAreaView.selectedSegmentIndex = 0;
    [self replacedQueue:maxAreaView];
}

-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    [self.ourJustAxesZipControl setSelectedSegmentIndex:scrollView.contentOffset.x/self.view.frame.size.width ==0?0:1];
    [self collectLiteralMovementImmediateExpansionText:scrollView.contentOffset.x/self.view.frame.size.width ==0?0:1];
}

- (void)replacedQueue:(UISegmentedControl *)sender {
    [self collectLiteralMovementImmediateExpansionText:sender.selectedSegmentIndex == 0?0:1];
    [self.bitsBlueZipView setContentOffset:CGPointMake(sender.selectedSegmentIndex == 0?0:self.bitsBlueZipView.frame.size.width, 0) animated:YES];
}

- (void)collectLiteralMovementImmediateExpansionText:(NSInteger)type {
    NSString *rowHourAnd = nil;
    UIView *contentView = nil;
    rowHourAnd = type == 0 ? [WinNeedHang dolbyMuteAspectBottomDecipher]:[WinNeedHang rearrangeReachableOrderedHisAscent];
    contentView = type == 0 ? self.gramSourcesKeysRoomSon:self.thatBayerSheSendPlus;
    
    if (rowHourAnd.consumesCase) {
        return;
    }
    
    if ([[rowHourAnd pathExtension] containsString:WinNeedHang.chargePenSin.allergyAttachedGrammarRegisterPreserves]) {
        UITextView *popView = (UITextView *)contentView;
        if (popView.text.length > 0) {
            return;
        }

        
        [BeaconsEggView waxBedHashHerView:contentView];

        
        NSURL *url = [NSURL URLWithString:rowHourAnd];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [BeaconsEggView bracketedWateryDiscountMetricsWaitView:contentView];
                
                if (error || data.length == 0) {
                    
                    popView.text = WinNeedHang.mapSonInputIll.proxyElevatedItalicExporterBinViability;
                    return;
                }
                
                
                NSString *cityReporting = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                popView.text = cityReporting ?: WinNeedHang.mapSonInputIll.scalarIrregularSeparateDiscountResonantPrimeSecurity;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *subRun = (WKWebView *)contentView;
        if (!subRun.isLoading && subRun.estimatedProgress == 1) {
            [BeaconsEggView bracketedWateryDiscountMetricsWaitView:contentView];
            return;
        }
        [BeaconsEggView waxBedHashHerView:contentView];
        NSString *youButton =  [rowHourAnd.declineCellphoneAreaOurGenreInterior stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:youButton];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [subRun loadRequest:request];
    }
}

- (void)smoothPopDesignWideCacheLow:(id)sender {
    [self neutralBayerChromiumHomepageDisplayAction:nil];
    if (self.trustedIconAssignAlpineGlobally) {
        self.trustedIconAssignAlpineGlobally(NO);
    }
}

- (void)carVowelElectricBeforeLigaturePressure:(id)sender {
    [self neutralBayerChromiumHomepageDisplayAction:nil];
    if (self.trustedIconAssignAlpineGlobally) {
        self.trustedIconAssignAlpineGlobally(YES);
    }
}

- (UIView *)runCupBandView:(NSString *)string {
    UIView *netCutMouth = nil;
    if ([[string pathExtension] containsString:WinNeedHang.chargePenSin.allergyAttachedGrammarRegisterPreserves]) {
        UITextView * modalHue = [UITextView new];
        modalHue.editable = NO;
        modalHue.backgroundColor = UIColor.whiteColor;
        modalHue.textColor = UIColor.grayColor;
        netCutMouth = modalHue;
    }else {
        WKWebView *peerSeekToo = [[WKWebView alloc] initWithFrame:CGRectZero];
        peerSeekToo.backgroundColor = UIColor.clearColor;
        peerSeekToo.scrollView.backgroundColor = UIColor.lightGrayColor;
        peerSeekToo.opaque = YES;
        peerSeekToo.scrollView.bounces =NO;
        peerSeekToo.scrollView.showsVerticalScrollIndicator = NO;
        peerSeekToo.scrollView.showsHorizontalScrollIndicator = NO;
        peerSeekToo.navigationDelegate = self;
        netCutMouth = peerSeekToo;
    }
    return netCutMouth;
}

- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
    [BeaconsEggView bracketedWateryDiscountMetricsWaitView:webView];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    UIEdgeInsets contactNow = [[DeltaWarpManager shared] inferiorsWaxWindow].safeAreaInsets;
    contactNow.top    += 10;
    contactNow.left   += 10;
    contactNow.bottom += 10;
    contactNow.right  += 10;

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

@end
