






#import "UsageNotAnyBigViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+Aggregate.h"
#import "NSString+OutcomeTree.h"

@interface UsageNotAnyBigViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *rectangleRadixControl;
@property (nonatomic, strong) UIView * embeddedSixPullSumRevoked;
@property (nonatomic, strong) UIView * elapsedCreditSolveSpaVisited;

@property (nonatomic, strong) UIScrollView * farWhoCleanView;

@end

@implementation UsageNotAnyBigViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.adjustSuchButton.hidden = YES;
    self.wayEitherButton.hidden = YES;
    
    UISegmentedControl *stretchView = [[UISegmentedControl alloc] initWithItems:@[PrintFarFor.tempSockJobHas.paperImportantBasqueAngleOneBundle,PrintFarFor.tempSockJobHas.achievedRedProviderOverlayAssetChanged]];
    stretchView.layer.masksToBounds = YES; 
    stretchView.layer.cornerRadius = 2;    
    [stretchView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PrintFarFor expansionColor]} forState:UIControlStateSelected];
    [stretchView setTitleTextAttributes:@{NSForegroundColorAttributeName:[PrintFarFor expansionColor]} forState:UIControlStateNormal];
    [self.view addSubview:stretchView];
    [stretchView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(PrintFarFor.guideMaySelf.capCapsClip);
    }];
    [stretchView addTarget:self action:@selector(thatSaveReply:) forControlEvents:UIControlEventValueChanged];
    self.rectangleRadixControl = stretchView;
    
    _farWhoCleanView = [[UIScrollView alloc]init];
    _farWhoCleanView.pagingEnabled = YES;
    _farWhoCleanView.delegate = self;
    [self.view addSubview:_farWhoCleanView];
    [_farWhoCleanView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(PrintFarFor.guideMaySelf.mealGeometry);
        make.right.equalTo(self.view).offset(-PrintFarFor.guideMaySelf.mealGeometry);
        make.top.equalTo(self.view).offset(PrintFarFor.guideMaySelf.sliceBusStop);
        make.bottom.equalTo(self.view).offset(-PrintFarFor.guideMaySelf.tryBannerSob);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.farWhoCleanView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.farWhoCleanView);
        make.height.equalTo(_farWhoCleanView);
    }];
    
    UIView * loadRebusWin = [self datePopSunView:[PrintFarFor nineLargerStringWinRelated]];
    [containerView addSubview:loadRebusWin];
    [loadRebusWin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.farWhoCleanView);
    }];
    self.embeddedSixPullSumRevoked = loadRebusWin;
    
    UIView * curveTwoRule = [self datePopSunView:[PrintFarFor consumerOldDecryptUpscaleUniversal]];
    [containerView addSubview:curveTwoRule];
    [curveTwoRule mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(loadRebusWin.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.farWhoCleanView);
    }];
    self.elapsedCreditSolveSpaVisited = curveTwoRule;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(curveTwoRule.mas_right);
    }];
    
    if (![self.tryGreekEnd boolValue]) {
        UIButton *nominalButton = [PrintFarFor entityBlurDogBestDisablesColor:PrintFarFor.tempSockJobHas.upsideAttach];
        [nominalButton setBackgroundImage:[UIImage netEarlyPinArtColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [nominalButton addTarget:self action:@selector(marginsSongSelectedUsagePasswordTalk:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:nominalButton];
        
        [nominalButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-PrintFarFor.guideMaySelf.homeDelayed);
            make.left.equalTo(self.view).offset(PrintFarFor.guideMaySelf.mealGeometry);
            make.right.equalTo(self.view.mas_centerX).offset(-PrintFarFor.guideMaySelf.splatButPen);
            make.height.mas_equalTo(PrintFarFor.guideMaySelf.expandingIts);
        }];
    }

    UIButton *grayHerButton =  [PrintFarFor entityBlurDogBestDisablesColor:PrintFarFor.tempSockJobHas.hexPresent];
    [grayHerButton addTarget:self action:@selector(fallbackHashExecutionLandmarkWinMember:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:grayHerButton];
    BOOL planeButton = ![self.tryGreekEnd boolValue];
    [grayHerButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-PrintFarFor.guideMaySelf.homeDelayed);
        make.right.equalTo(self.view).offset(-PrintFarFor.guideMaySelf.mealGeometry);
        
        if (planeButton) {
            make.left.equalTo(self.view.mas_centerX).offset(PrintFarFor.guideMaySelf.splatButPen);
        } else {
            make.left.equalTo(self.view).offset(PrintFarFor.guideMaySelf.mealGeometry);
        }
        make.height.mas_equalTo(PrintFarFor.guideMaySelf.expandingIts);
    }];
    
    stretchView.selectedSegmentIndex = 0;
    [self thatSaveReply:stretchView];
}

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

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

- (void)legacyHigherBordersSortingSlashText:(NSInteger)type {
    NSString *homeHowSob = nil;
    UIView *contentView = nil;
    homeHowSob = type == 0 ? [PrintFarFor nineLargerStringWinRelated]:[PrintFarFor consumerOldDecryptUpscaleUniversal];
    contentView = type == 0 ? self.embeddedSixPullSumRevoked:self.elapsedCreditSolveSpaVisited;
    
    if (homeHowSob.bodyAfterBox) {
        return;
    }
    
    if ([[homeHowSob pathExtension] containsString:PrintFarFor.guideMaySelf.featuresFragmentsTreeAllocatedTone]) {
        UITextView *mixView = (UITextView *)contentView;
        if (mixView.text.length > 0) {
            return;
        }

        
        [FireResizeView marathiLinearView:contentView];

        
        NSURL *url = [NSURL URLWithString:homeHowSob];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [FireResizeView hexAirBlobHigherDelayedView:contentView];
                
                if (error || data.length == 0) {
                    
                    mixView.text = PrintFarFor.tempSockJobHas.maleEquallyTenFrictionLegacyCursors;
                    return;
                }
                
                
                NSString *buildQuitRope = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                mixView.text = buildQuitRope ?: PrintFarFor.tempSockJobHas.headlineGlucoseSameEventPrefixCatalogDraw;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *fitIll = (WKWebView *)contentView;
        if (!fitIll.isLoading && fitIll.estimatedProgress == 1) {
            [FireResizeView hexAirBlobHigherDelayedView:contentView];
            return;
        }
        [FireResizeView marathiLinearView:contentView];
        NSString *fiberEdit =  [homeHowSob.cacheTempDragReplyMirroredExposures stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:fiberEdit];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [fitIll loadRequest:request];
    }
}

- (void)marginsSongSelectedUsagePasswordTalk:(id)sender {
    [self capturingDidLookupYetEphemeralAction:nil];
    if (self.kilogramsStairProminentDisappearChain) {
        self.kilogramsStairProminentDisappearChain(NO);
    }
}

- (void)fallbackHashExecutionLandmarkWinMember:(id)sender {
    [self capturingDidLookupYetEphemeralAction:nil];
    if (self.kilogramsStairProminentDisappearChain) {
        self.kilogramsStairProminentDisappearChain(YES);
    }
}

- (UIView *)datePopSunView:(NSString *)string {
    UIView *plugDrawing = nil;
    if ([[string pathExtension] containsString:PrintFarFor.guideMaySelf.featuresFragmentsTreeAllocatedTone]) {
        UITextView * bigSegue = [UITextView new];
        bigSegue.editable = NO;
        bigSegue.backgroundColor = UIColor.whiteColor;
        bigSegue.textColor = UIColor.grayColor;
        plugDrawing = bigSegue;
    }else {
        WKWebView *taskWarnBox = [[WKWebView alloc] initWithFrame:CGRectZero];
        taskWarnBox.backgroundColor = UIColor.clearColor;
        taskWarnBox.scrollView.backgroundColor = UIColor.lightGrayColor;
        taskWarnBox.opaque = YES;
        taskWarnBox.scrollView.bounces =NO;
        taskWarnBox.scrollView.showsVerticalScrollIndicator = NO;
        taskWarnBox.scrollView.showsHorizontalScrollIndicator = NO;
        taskWarnBox.navigationDelegate = self;
        plugDrawing = taskWarnBox;
    }
    return plugDrawing;
}

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

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

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

@end
