






#import "RenderReadCubeViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+SubBiotin.h"
#import "NSString+AskPhysical.h"

@interface RenderReadCubeViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *hoverContinuedControl;
@property (nonatomic, strong) UIView * manySampleLongHusbandIntegral;
@property (nonatomic, strong) UIView * kernelRawRatingsSpecifierDeep;

@property (nonatomic, strong) UIScrollView * decayUpdateView;

@end

@implementation RenderReadCubeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.volumesIllButton.hidden = YES;
    self.waterWarpButton.hidden = YES;
    
    UISegmentedControl *execOldView = [[UISegmentedControl alloc] initWithItems:@[DiscardsOld.forceParameter.portMagicArmNextPeopleDivider,DiscardsOld.forceParameter.closureIntersectSpeakTableFaxAre]];
    execOldView.layer.masksToBounds = YES; 
    execOldView.layer.cornerRadius = 2;    
    [execOldView setTitleTextAttributes:@{NSForegroundColorAttributeName:[DiscardsOld celticBusColor]} forState:UIControlStateSelected];
    [execOldView setTitleTextAttributes:@{NSForegroundColorAttributeName:[DiscardsOld celticBusColor]} forState:UIControlStateNormal];
    [self.view addSubview:execOldView];
    [execOldView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(DiscardsOld.dogPongRoman.wetFunkSide);
    }];
    [execOldView addTarget:self action:@selector(depthCallback:) forControlEvents:UIControlEventValueChanged];
    self.hoverContinuedControl = execOldView;
    
    _decayUpdateView = [[UIScrollView alloc]init];
    _decayUpdateView.pagingEnabled = YES;
    _decayUpdateView.delegate = self;
    [self.view addSubview:_decayUpdateView];
    [_decayUpdateView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(DiscardsOld.dogPongRoman.dueFreeStair);
        make.right.equalTo(self.view).offset(-DiscardsOld.dogPongRoman.dueFreeStair);
        make.top.equalTo(self.view).offset(DiscardsOld.dogPongRoman.memberUpload);
        make.bottom.equalTo(self.view).offset(-DiscardsOld.dogPongRoman.dynamicPhone);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.decayUpdateView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.decayUpdateView);
        make.height.equalTo(_decayUpdateView);
    }];
    
    UIView * securityChar = [self zoneForNotView:[DiscardsOld dividingProxyDarkReceiveLock]];
    [containerView addSubview:securityChar];
    [securityChar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.decayUpdateView);
    }];
    self.manySampleLongHusbandIntegral = securityChar;
    
    UIView * lemmaSavePop = [self zoneForNotView:[DiscardsOld emergencySlopeEnsureExposeShortcut]];
    [containerView addSubview:lemmaSavePop];
    [lemmaSavePop mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(securityChar.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.decayUpdateView);
    }];
    self.kernelRawRatingsSpecifierDeep = lemmaSavePop;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(lemmaSavePop.mas_right);
    }];
    
    if (![self.purpleNonce boolValue]) {
        UIButton *moodDryButton = [DiscardsOld separateYahooSlideCompositeIllColor:DiscardsOld.forceParameter.mountReorder];
        [moodDryButton setBackgroundImage:[UIImage flagFastTipRedColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [moodDryButton addTarget:self action:@selector(swashesMalayalamLoadDisablingNorthPrep:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:moodDryButton];
        
        [moodDryButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-DiscardsOld.dogPongRoman.italicHindi);
            make.left.equalTo(self.view).offset(DiscardsOld.dogPongRoman.dueFreeStair);
            make.right.equalTo(self.view.mas_centerX).offset(-DiscardsOld.dogPongRoman.filterSlope);
            make.height.mas_equalTo(DiscardsOld.dogPongRoman.strongAspect);
        }];
    }

    UIButton *bedFailButton =  [DiscardsOld separateYahooSlideCompositeIllColor:DiscardsOld.forceParameter.twistMetal];
    [bedFailButton addTarget:self action:@selector(smileSwedishFitMediumSparseTone:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:bedFailButton];
    BOOL slashButton = ![self.purpleNonce boolValue];
    [bedFailButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-DiscardsOld.dogPongRoman.italicHindi);
        make.right.equalTo(self.view).offset(-DiscardsOld.dogPongRoman.dueFreeStair);
        
        if (slashButton) {
            make.left.equalTo(self.view.mas_centerX).offset(DiscardsOld.dogPongRoman.filterSlope);
        } else {
            make.left.equalTo(self.view).offset(DiscardsOld.dogPongRoman.dueFreeStair);
        }
        make.height.mas_equalTo(DiscardsOld.dogPongRoman.strongAspect);
    }];
    
    execOldView.selectedSegmentIndex = 0;
    [self depthCallback:execOldView];
}

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

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

- (void)evaluateDarkerForbiddenModeItsText:(NSInteger)type {
    NSString *tenPressed = nil;
    UIView *contentView = nil;
    tenPressed = type == 0 ? [DiscardsOld dividingProxyDarkReceiveLock]:[DiscardsOld emergencySlopeEnsureExposeShortcut];
    contentView = type == 0 ? self.manySampleLongHusbandIntegral:self.kernelRawRatingsSpecifierDeep;
    
    if (tenPressed.moleBigArrow) {
        return;
    }
    
    if ([[tenPressed pathExtension] containsString:DiscardsOld.dogPongRoman.expireShowVitaminSlideProblem]) {
        UITextView *butView = (UITextView *)contentView;
        if (butView.text.length > 0) {
            return;
        }

        
        [RenewSolveView causeSobAboutView:contentView];

        
        NSURL *url = [NSURL URLWithString:tenPressed];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [RenewSolveView fifteenScanningMidGeometricSubstringView:contentView];
                
                if (error || data.length == 0) {
                    
                    butView.text = DiscardsOld.forceParameter.sentAttachStationRunMalformedSeconds;
                    return;
                }
                
                
                NSString *priceThatShot = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                butView.text = priceThatShot ?: DiscardsOld.forceParameter.strideFatJouleFinishingIncorrectColorItalian;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *tryDog = (WKWebView *)contentView;
        if (!tryDog.isLoading && tryDog.estimatedProgress == 1) {
            [RenewSolveView fifteenScanningMidGeometricSubstringView:contentView];
            return;
        }
        [RenewSolveView causeSobAboutView:contentView];
        NSString *napServer =  [tenPressed.netExactHeartDominantNiacinIdiom stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:napServer];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [tryDog loadRequest:request];
    }
}

- (void)swashesMalayalamLoadDisablingNorthPrep:(id)sender {
    [self blockerClearedSpacingApertureCookieAction:nil];
    if (self.reactorIrishButSpeakingEast) {
        self.reactorIrishButSpeakingEast(NO);
    }
}

- (void)smileSwedishFitMediumSparseTone:(id)sender {
    [self blockerClearedSpacingApertureCookieAction:nil];
    if (self.reactorIrishButSpeakingEast) {
        self.reactorIrishButSpeakingEast(YES);
    }
}

- (UIView *)zoneForNotView:(NSString *)string {
    UIView *swapSideFax = nil;
    if ([[string pathExtension] containsString:DiscardsOld.dogPongRoman.expireShowVitaminSlideProblem]) {
        UITextView * endsStar = [UITextView new];
        endsStar.editable = NO;
        endsStar.backgroundColor = UIColor.whiteColor;
        endsStar.textColor = UIColor.grayColor;
        swapSideFax = endsStar;
    }else {
        WKWebView *invalidRest = [[WKWebView alloc] initWithFrame:CGRectZero];
        invalidRest.backgroundColor = UIColor.clearColor;
        invalidRest.scrollView.backgroundColor = UIColor.lightGrayColor;
        invalidRest.opaque = YES;
        invalidRest.scrollView.bounces =NO;
        invalidRest.scrollView.showsVerticalScrollIndicator = NO;
        invalidRest.scrollView.showsHorizontalScrollIndicator = NO;
        invalidRest.navigationDelegate = self;
        swapSideFax = invalidRest;
    }
    return swapSideFax;
}

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

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

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

@end
