






#import "InstallsActualViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+TiedWorld.h"
#import "NSString+AfterSpaTab.h"

@interface InstallsActualViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *cropTapsJobBinControl;
@property (nonatomic, strong) UIView * lossEscapeSexualSubGrow;
@property (nonatomic, strong) UIView * azimuthRoomManExchangeTexture;

@property (nonatomic, strong) UIScrollView * accountsBedView;

@end

@implementation InstallsActualViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tabTreeBagButton.hidden = YES;
    self.winSampleButton.hidden = YES;
    
    UISegmentedControl *tenBlurView = [[UISegmentedControl alloc] initWithItems:@[UserArtRoot.builtOwnSeeEar.hiddenAlwaysAlienAmbientStrokedBasal,UserArtRoot.builtOwnSeeEar.nonceRootUnwindingPrimariesDiscardIdle]];
    tenBlurView.layer.masksToBounds = YES; 
    tenBlurView.layer.cornerRadius = 2;    
    [tenBlurView setTitleTextAttributes:@{NSForegroundColorAttributeName:[UserArtRoot partBoostColor]} forState:UIControlStateSelected];
    [tenBlurView setTitleTextAttributes:@{NSForegroundColorAttributeName:[UserArtRoot partBoostColor]} forState:UIControlStateNormal];
    [self.view addSubview:tenBlurView];
    [tenBlurView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(UserArtRoot.wayAbortLove.binWorldYou);
    }];
    [tenBlurView addTarget:self action:@selector(cardForTopBed:) forControlEvents:UIControlEventValueChanged];
    self.cropTapsJobBinControl = tenBlurView;
    
    _accountsBedView = [[UIScrollView alloc]init];
    _accountsBedView.pagingEnabled = YES;
    _accountsBedView.delegate = self;
    [self.view addSubview:_accountsBedView];
    [_accountsBedView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(UserArtRoot.wayAbortLove.takePubLarge);
        make.right.equalTo(self.view).offset(-UserArtRoot.wayAbortLove.takePubLarge);
        make.top.equalTo(self.view).offset(UserArtRoot.wayAbortLove.supplyOrigin);
        make.bottom.equalTo(self.view).offset(-UserArtRoot.wayAbortLove.bitOffsetPan);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.accountsBedView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.accountsBedView);
        make.height.equalTo(_accountsBedView);
    }];
    
    UIView * sinkAssembly = [self howZipSwapView:[UserArtRoot listLigatureTooTwistSparse]];
    [containerView addSubview:sinkAssembly];
    [sinkAssembly mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.accountsBedView);
    }];
    self.lossEscapeSexualSubGrow = sinkAssembly;
    
    UIView * mayWarnCaret = [self howZipSwapView:[UserArtRoot oddAvailableIntegrateReportedBut]];
    [containerView addSubview:mayWarnCaret];
    [mayWarnCaret mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(sinkAssembly.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.accountsBedView);
    }];
    self.azimuthRoomManExchangeTexture = mayWarnCaret;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(mayWarnCaret.mas_right);
    }];
    
    if (![self.dublinChest boolValue]) {
        UIButton *trapDogButton = [UserArtRoot arrayAuditedDirectorRedoneLongestColor:UserArtRoot.builtOwnSeeEar.unknownPager];
        [trapDogButton setBackgroundImage:[UIImage solutionsLeaveColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [trapDogButton addTarget:self action:@selector(describesRemovesHisPetiteDecodingOff:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:trapDogButton];
        [trapDogButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-UserArtRoot.wayAbortLove.lossyAdverb);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(UserArtRoot.wayAbortLove.keepHelloPin);
        }];
    }
    
    UIButton *andThatButton =  [UserArtRoot arrayAuditedDirectorRedoneLongestColor:UserArtRoot.builtOwnSeeEar.helpersSex];
    [andThatButton addTarget:self action:@selector(truncateGrayFoodHostHundredsEditors:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:andThatButton];
    [andThatButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-UserArtRoot.wayAbortLove.lossyAdverb);
        make.centerX.equalTo(self.view).multipliedBy(![self.dublinChest boolValue]?1.35:1);
        make.height.mas_equalTo(UserArtRoot.wayAbortLove.keepHelloPin);
    }];
    
    tenBlurView.selectedSegmentIndex = 0;
    [self cardForTopBed:tenBlurView];
}

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

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

- (void)audiencesEarAffectingEasyCombineText:(NSInteger)type {
    NSString *leaseReset = nil;
    UIView *contentView = nil;
    leaseReset = type == 0 ? [UserArtRoot listLigatureTooTwistSparse]:[UserArtRoot oddAvailableIntegrateReportedBut];
    contentView = type == 0 ? self.lossEscapeSexualSubGrow:self.azimuthRoomManExchangeTexture;
    
    if (leaseReset.capCovariant) {
        return;
    }
    
    if ([[leaseReset pathExtension] containsString:UserArtRoot.wayAbortLove.finnishTalkLeapBlackVideo]) {
        UITextView *armView = (UITextView *)contentView;
        if (armView.text.length > 0) {
            return;
        }

        
        [ActualSkipView notWakeOddMaxView:contentView];

        
        NSURL *url = [NSURL URLWithString:leaseReset];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [ActualSkipView scrollCanManagerPreviewChargeView:contentView];
                
                if (error || data.length == 0) {
                    
                    armView.text = UserArtRoot.builtOwnSeeEar.altimeterHandleBlackRoundOnlineReports;
                    return;
                }
                
                
                NSString *barBusEarHail = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                armView.text = barBusEarHail ?: UserArtRoot.builtOwnSeeEar.measuredFunctionBandCaffeinePostcardNibblesTomorrow;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *mixFit = (WKWebView *)contentView;
        if (!mixFit.isLoading && mixFit.estimatedProgress == 1) {
            [ActualSkipView scrollCanManagerPreviewChargeView:contentView];
            return;
        }
        [ActualSkipView notWakeOddMaxView:contentView];
        NSString *beaconCap =  [leaseReset.leftAlongsideWorkspaceSleepAbortForbid stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:beaconCap];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [mixFit loadRequest:request];
    }
}

- (void)describesRemovesHisPetiteDecodingOff:(id)sender {
    [self snapBadTempStrengthOddAction:nil];
    if (self.locallyBackupExclusionPopAngular) {
        self.locallyBackupExclusionPopAngular(NO);
    }
}

- (void)truncateGrayFoodHostHundredsEditors:(id)sender {
    [self snapBadTempStrengthOddAction:nil];
    if (self.locallyBackupExclusionPopAngular) {
        self.locallyBackupExclusionPopAngular(YES);
    }
}

- (UIView *)howZipSwapView:(NSString *)string {
    UIView *partRareWay = nil;
    if ([[string pathExtension] containsString:UserArtRoot.wayAbortLove.finnishTalkLeapBlackVideo]) {
        UITextView * clamping = [UITextView new];
        clamping.editable = NO;
        clamping.backgroundColor = UIColor.whiteColor;
        clamping.textColor = UIColor.grayColor;
        partRareWay = clamping;
    }else {
        WKWebView *twoCapCycle = [[WKWebView alloc] initWithFrame:CGRectZero];
        twoCapCycle.backgroundColor = UIColor.clearColor;
        twoCapCycle.scrollView.backgroundColor = UIColor.lightGrayColor;
        twoCapCycle.opaque = YES;
        twoCapCycle.scrollView.bounces =NO;
        twoCapCycle.scrollView.showsVerticalScrollIndicator = NO;
        twoCapCycle.scrollView.showsHorizontalScrollIndicator = NO;
        twoCapCycle.navigationDelegate = self;
        partRareWay = twoCapCycle;
    }
    return partRareWay;
}

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

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

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

@end
