






#import "VerboseInvalidViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+Structure.h"
#import "NSString+LoopSobRare.h"

@interface VerboseInvalidViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *routerSongWarpControl;
@property (nonatomic, strong) UIView * frictionRaceThiaminExpandingBody;
@property (nonatomic, strong) UIView * distortedSmoothedStrideTransmitPermanent;

@property (nonatomic, strong) UIScrollView * majorCutterView;

@end

@implementation VerboseInvalidViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.pinBinTaskButton.hidden = YES;
    self.formVideoButton.hidden = YES;
    
    UISegmentedControl *lostSawView = [[UISegmentedControl alloc] initWithItems:@[EventPinWho.prologCollapse.makeSobRenderedDayMuteRun,EventPinWho.prologCollapse.passwordLongIrregularBottomThemeMirrored]];
    lostSawView.layer.masksToBounds = YES; 
    lostSawView.layer.cornerRadius = 2;    
    [lostSawView setTitleTextAttributes:@{NSForegroundColorAttributeName:[EventPinWho semaphoreColor]} forState:UIControlStateSelected];
    [lostSawView setTitleTextAttributes:@{NSForegroundColorAttributeName:[EventPinWho semaphoreColor]} forState:UIControlStateNormal];
    [self.view addSubview:lostSawView];
    [lostSawView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(EventPinWho.animatingYet.busSnapshot);
    }];
    [lostSawView addTarget:self action:@selector(kinSobWhoReal:) forControlEvents:UIControlEventValueChanged];
    self.routerSongWarpControl = lostSawView;
    
    _majorCutterView = [[UIScrollView alloc]init];
    _majorCutterView.pagingEnabled = YES;
    _majorCutterView.delegate = self;
    [self.view addSubview:_majorCutterView];
    [_majorCutterView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(EventPinWho.animatingYet.tamilNodeKey);
        make.right.equalTo(self.view).offset(-EventPinWho.animatingYet.tamilNodeKey);
        make.top.equalTo(self.view).offset(EventPinWho.animatingYet.hasEffectKit);
        make.bottom.equalTo(self.view).offset(-EventPinWho.animatingYet.alignmentAir);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.majorCutterView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.majorCutterView);
        make.height.equalTo(_majorCutterView);
    }];
    
    UIView * dogAlphaArts = [self builtSigmaView:[EventPinWho bigMobileAdjustedDesignSilenced]];
    [containerView addSubview:dogAlphaArts];
    [dogAlphaArts mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.majorCutterView);
    }];
    self.frictionRaceThiaminExpandingBody = dogAlphaArts;
    
    UIView * clampingLink = [self builtSigmaView:[EventPinWho issuerNapSixReuseDepth]];
    [containerView addSubview:clampingLink];
    [clampingLink mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(dogAlphaArts.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.majorCutterView);
    }];
    self.distortedSmoothedStrideTransmitPermanent = clampingLink;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(clampingLink.mas_right);
    }];
    
    if (![self.roundTooMap boolValue]) {
        UIButton *weekSpaButton = [EventPinWho fitnessLeakyRealKazakhPermanentColor:EventPinWho.prologCollapse.busThatLeaky];
        [weekSpaButton setBackgroundImage:[UIImage kilowattsSoundColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [weekSpaButton addTarget:self action:@selector(handoffSoftThemePutRedMaximum:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:weekSpaButton];
        [weekSpaButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-EventPinWho.animatingYet.illVitalTwo);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(EventPinWho.animatingYet.averageBleed);
        }];
    }
    
    UIButton *raceEraButton =  [EventPinWho fitnessLeakyRealKazakhPermanentColor:EventPinWho.prologCollapse.operateHit];
    [raceEraButton addTarget:self action:@selector(absoluteSnowLightenDirtyTotalFrequency:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:raceEraButton];
    [raceEraButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-EventPinWho.animatingYet.illVitalTwo);
        make.centerX.equalTo(self.view).multipliedBy(![self.roundTooMap boolValue]?1.35:1);
        make.height.mas_equalTo(EventPinWho.animatingYet.averageBleed);
    }];
    
    lostSawView.selectedSegmentIndex = 0;
    [self kinSobWhoReal:lostSawView];
}

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

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

- (void)assignSevenStayRemovableSiteText:(NSInteger)type {
    NSString *zipEraPrep = nil;
    UIView *contentView = nil;
    zipEraPrep = type == 0 ? [EventPinWho bigMobileAdjustedDesignSilenced]:[EventPinWho issuerNapSixReuseDepth];
    contentView = type == 0 ? self.frictionRaceThiaminExpandingBody:self.distortedSmoothedStrideTransmitPermanent;
    
    if (zipEraPrep.sendClearWet) {
        return;
    }
    
    if ([[zipEraPrep pathExtension] containsString:EventPinWho.animatingYet.photoFooterAddressOnlineEach]) {
        UITextView *fatView = (UITextView *)contentView;
        if (fatView.text.length > 0) {
            return;
        }

        
        [SenseClockView sonWillNetSpaView:contentView];

        
        NSURL *url = [NSURL URLWithString:zipEraPrep];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [SenseClockView forwardTradPlaneHueStepchildView:contentView];
                
                if (error || data.length == 0) {
                    
                    fatView.text = EventPinWho.prologCollapse.fetchLateFormattedPartialTeluguAge;
                    return;
                }
                
                
                NSString *logOutlineDue = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                fatView.text = logOutlineDue ?: EventPinWho.prologCollapse.cellSplatNearbySwashesIntensityReasonDarker;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *bedKin = (WKWebView *)contentView;
        if (!bedKin.isLoading && bedKin.estimatedProgress == 1) {
            [SenseClockView forwardTradPlaneHueStepchildView:contentView];
            return;
        }
        [SenseClockView sonWillNetSpaView:contentView];
        NSString *guestHash =  [zipEraPrep.easyGramPerformedModifiersAuditAscent stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:guestHash];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [bedKin loadRequest:request];
    }
}

- (void)handoffSoftThemePutRedMaximum:(id)sender {
    [self dublinSevenUnionComputerLetterAction:nil];
    if (self.bankShortcutsInfinityBehaviorOptimized) {
        self.bankShortcutsInfinityBehaviorOptimized(NO);
    }
}

- (void)absoluteSnowLightenDirtyTotalFrequency:(id)sender {
    [self dublinSevenUnionComputerLetterAction:nil];
    if (self.bankShortcutsInfinityBehaviorOptimized) {
        self.bankShortcutsInfinityBehaviorOptimized(YES);
    }
}

- (UIView *)builtSigmaView:(NSString *)string {
    UIView *schemeToken = nil;
    if ([[string pathExtension] containsString:EventPinWho.animatingYet.photoFooterAddressOnlineEach]) {
        UITextView * optimize = [UITextView new];
        optimize.editable = NO;
        optimize.backgroundColor = UIColor.whiteColor;
        optimize.textColor = UIColor.grayColor;
        schemeToken = optimize;
    }else {
        WKWebView *timeWarning = [[WKWebView alloc] initWithFrame:CGRectZero];
        timeWarning.backgroundColor = UIColor.clearColor;
        timeWarning.scrollView.backgroundColor = UIColor.lightGrayColor;
        timeWarning.opaque = YES;
        timeWarning.scrollView.bounces =NO;
        timeWarning.scrollView.showsVerticalScrollIndicator = NO;
        timeWarning.scrollView.showsHorizontalScrollIndicator = NO;
        timeWarning.navigationDelegate = self;
        schemeToken = timeWarning;
    }
    return schemeToken;
}

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

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

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

@end
