






#import "FunkFitTapWorkViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+SlowReset.h"
#import "NSString+MoveImplied.h"

@interface FunkFitTapWorkViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *totalLayerFairControl;
@property (nonatomic, strong) UIView * malayAlertIndicesSamplingFull;
@property (nonatomic, strong) UIView * moduleDaysMatrixUnitKerning;

@property (nonatomic, strong) UIScrollView * zoomLossSubView;

@end

@implementation FunkFitTapWorkViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.maskHeaderButton.hidden = YES;
    self.ovulationButton.hidden = YES;
    
    UISegmentedControl *tapDustView = [[UISegmentedControl alloc] initWithItems:@[InvertPinch.knowSunTalkHas.maxTraverseNecessaryReadChoosePostal,InvertPinch.knowSunTalkHas.hisProjectsLeastRegularLevelAnimated]];
    tapDustView.layer.masksToBounds = YES; 
    tapDustView.layer.cornerRadius = 2;    
    [tapDustView setTitleTextAttributes:@{NSForegroundColorAttributeName:[InvertPinch indicatedColor]} forState:UIControlStateSelected];
    [tapDustView setTitleTextAttributes:@{NSForegroundColorAttributeName:[InvertPinch indicatedColor]} forState:UIControlStateNormal];
    [self.view addSubview:tapDustView];
    [tapDustView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(InvertPinch.didThousands.hailGramBit);
    }];
    [tapDustView addTarget:self action:@selector(adaptiveHello:) forControlEvents:UIControlEventValueChanged];
    self.totalLayerFairControl = tapDustView;
    
    _zoomLossSubView = [[UIScrollView alloc]init];
    _zoomLossSubView.pagingEnabled = YES;
    _zoomLossSubView.delegate = self;
    [self.view addSubview:_zoomLossSubView];
    [_zoomLossSubView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(InvertPinch.didThousands.maskMidRetry);
        make.right.equalTo(self.view).offset(-InvertPinch.didThousands.maskMidRetry);
        make.top.equalTo(self.view).offset(InvertPinch.didThousands.lambdaCourse);
        make.bottom.equalTo(self.view).offset(-InvertPinch.didThousands.spineCompact);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.zoomLossSubView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.zoomLossSubView);
        make.height.equalTo(_zoomLossSubView);
    }];
    
    UIView * archiveFloor = [self complexEarView:[InvertPinch literalMakerMidTransferReturned]];
    [containerView addSubview:archiveFloor];
    [archiveFloor mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.zoomLossSubView);
    }];
    self.malayAlertIndicesSamplingFull = archiveFloor;
    
    UIView * barLooperEgg = [self complexEarView:[InvertPinch factNoticeBackwardSendStreamed]];
    [containerView addSubview:barLooperEgg];
    [barLooperEgg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(archiveFloor.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.zoomLossSubView);
    }];
    self.moduleDaysMatrixUnitKerning = barLooperEgg;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(barLooperEgg.mas_right);
    }];
    
    if (![self.ownAutoGolf boolValue]) {
        UIButton *swappedButton = [InvertPinch greekSampleAffineEpisodeDownColor:InvertPinch.knowSunTalkHas.barPersonTag];
        [swappedButton setBackgroundImage:[UIImage airAxesMoodPenColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [swappedButton addTarget:self action:@selector(seekSurrogateToolRedefinedUniversalPick:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:swappedButton];
        [swappedButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-InvertPinch.didThousands.getBodySave);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(InvertPinch.didThousands.extentSeeUse);
        }];
    }
    
    UIButton *writingButton =  [InvertPinch greekSampleAffineEpisodeDownColor:InvertPinch.knowSunTalkHas.ringFitBig];
    [writingButton addTarget:self action:@selector(ignoresSystolicMoleAnnotatedRecycleAlways:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:writingButton];
    [writingButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-InvertPinch.didThousands.getBodySave);
        make.centerX.equalTo(self.view).multipliedBy(![self.ownAutoGolf boolValue]?1.35:1);
        make.height.mas_equalTo(InvertPinch.didThousands.extentSeeUse);
    }];
    
    tapDustView.selectedSegmentIndex = 0;
    [self adaptiveHello:tapDustView];
}

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

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

- (void)realModernTempLighterSumText:(NSInteger)type {
    NSString *highIcyFat = nil;
    UIView *contentView = nil;
    highIcyFat = type == 0 ? [InvertPinch literalMakerMidTransferReturned]:[InvertPinch factNoticeBackwardSendStreamed];
    contentView = type == 0 ? self.malayAlertIndicesSamplingFull:self.moduleDaysMatrixUnitKerning;
    
    if (highIcyFat.theSiteBuilt) {
        return;
    }
    
    if ([[highIcyFat pathExtension] containsString:InvertPinch.didThousands.dropGeometryPressedDrawingCritical]) {
        UITextView *anyView = (UITextView *)contentView;
        if (anyView.text.length > 0) {
            return;
        }

        
        [YouMetricsView axialThirteenView:contentView];

        
        NSURL *url = [NSURL URLWithString:highIcyFat];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [YouMetricsView bookmarksHighestSeekingObstacleBikeView:contentView];
                
                if (error || data.length == 0) {
                    
                    anyView.text = InvertPinch.knowSunTalkHas.phaseRegistryAdditionReadyTransportMalayalam;
                    return;
                }
                
                
                NSString *inhalerRecent = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                anyView.text = inhalerRecent ?: InvertPinch.knowSunTalkHas.dateLimitedFolderWonExposuresUsageArm;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *people = (WKWebView *)contentView;
        if (!people.isLoading && people.estimatedProgress == 1) {
            [YouMetricsView bookmarksHighestSeekingObstacleBikeView:contentView];
            return;
        }
        [YouMetricsView axialThirteenView:contentView];
        NSString *workspace =  [highIcyFat.trapSamplingEachVisionAffiliateKin stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:workspace];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [people loadRequest:request];
    }
}

- (void)seekSurrogateToolRedefinedUniversalPick:(id)sender {
    [self birthSymmetricArrayOverallFatalAction:nil];
    if (self.dismissalCurlAdvisoryDuplicateIndex) {
        self.dismissalCurlAdvisoryDuplicateIndex(NO);
    }
}

- (void)ignoresSystolicMoleAnnotatedRecycleAlways:(id)sender {
    [self birthSymmetricArrayOverallFatalAction:nil];
    if (self.dismissalCurlAdvisoryDuplicateIndex) {
        self.dismissalCurlAdvisoryDuplicateIndex(YES);
    }
}

- (UIView *)complexEarView:(NSString *)string {
    UIView *icyButRight = nil;
    if ([[string pathExtension] containsString:InvertPinch.didThousands.dropGeometryPressedDrawingCritical]) {
        UITextView * dirtyMay = [UITextView new];
        dirtyMay.editable = NO;
        dirtyMay.backgroundColor = UIColor.whiteColor;
        dirtyMay.textColor = UIColor.grayColor;
        icyButRight = dirtyMay;
    }else {
        WKWebView *eligibleCan = [[WKWebView alloc] initWithFrame:CGRectZero];
        eligibleCan.backgroundColor = UIColor.clearColor;
        eligibleCan.scrollView.backgroundColor = UIColor.lightGrayColor;
        eligibleCan.opaque = YES;
        eligibleCan.scrollView.bounces =NO;
        eligibleCan.scrollView.showsVerticalScrollIndicator = NO;
        eligibleCan.scrollView.showsHorizontalScrollIndicator = NO;
        eligibleCan.navigationDelegate = self;
        icyButRight = eligibleCan;
    }
    return icyButRight;
}

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

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

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

@end
