






#import "WetRetBoxFrameViewController.h"
#import <WebKit/WebKit.h>
#import <WebKit/WKFoundation.h>
#import "NSString+DesignArm.h"
#import "NSString+UseEntities.h"

@interface WetRetBoxFrameViewController ()<UIScrollViewDelegate,WKNavigationDelegate>

@property (nonatomic, strong) UISegmentedControl *decigramsPauseControl;
@property (nonatomic, strong) UIView * ownPlayableHisAndKilogram;
@property (nonatomic, strong) UIView * youMuteEngravedCurlExporting;

@property (nonatomic, strong) UIScrollView * bypassWhileView;

@end

@implementation WetRetBoxFrameViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.optUseHangButton.hidden = YES;
    self.bleedWarpButton.hidden = YES;
    
    UISegmentedControl *garbageView = [[UISegmentedControl alloc] initWithItems:@[MainMinimal.tiedTagCertTen.meanWirelessConditionDisposePairRunning,MainMinimal.tiedTagCertTen.objectTryLevelAxesIdentifyUnlearn]];
    garbageView.layer.masksToBounds = YES; 
    garbageView.layer.cornerRadius = 2;    
    [garbageView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MainMinimal anyUpsideColor]} forState:UIControlStateSelected];
    [garbageView setTitleTextAttributes:@{NSForegroundColorAttributeName:[MainMinimal anyUpsideColor]} forState:UIControlStateNormal];
    [self.view addSubview:garbageView];
    [garbageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.mas_equalTo(MainMinimal.nordicPubTen.simpleWidth);
    }];
    [garbageView addTarget:self action:@selector(stripNeverAdd:) forControlEvents:UIControlEventValueChanged];
    self.decigramsPauseControl = garbageView;
    
    _bypassWhileView = [[UIScrollView alloc]init];
    _bypassWhileView.pagingEnabled = YES;
    _bypassWhileView.delegate = self;
    [self.view addSubview:_bypassWhileView];
    [_bypassWhileView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(MainMinimal.nordicPubTen.plusPanElder);
        make.right.equalTo(self.view).offset(-MainMinimal.nordicPubTen.plusPanElder);
        make.top.equalTo(self.view).offset(MainMinimal.nordicPubTen.artOutGaelic);
        make.bottom.equalTo(self.view).offset(-MainMinimal.nordicPubTen.receiptExist);
    }];
    
    UIView *containerView = [UIView new];
    containerView.backgroundColor = UIColor.whiteColor;
    [self.bypassWhileView addSubview:containerView];
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.bypassWhileView);
        make.height.equalTo(_bypassWhileView);
    }];
    
    UIView * adobeOlympus = [self fiveArtistView:[MainMinimal existBinMillionAnswerRefreshed]];
    [containerView addSubview:adobeOlympus];
    [adobeOlympus mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.bottom.equalTo(containerView);
        make.width.mas_equalTo(self.bypassWhileView);
    }];
    self.ownPlayableHisAndKilogram = adobeOlympus;
    
    UIView * storeLawPart = [self fiveArtistView:[MainMinimal trackStarElementsHostWrap]];
    [containerView addSubview:storeLawPart];
    [storeLawPart mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(adobeOlympus.mas_right);
        make.bottom.top.equalTo(containerView);
        make.width.mas_equalTo(self.bypassWhileView);
    }];
    self.youMuteEngravedCurlExporting = storeLawPart;
    
    [containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(storeLawPart.mas_right);
    }];
    
    if (![self.freeKinDark boolValue]) {
        UIButton *windowsButton = [MainMinimal grandsonTransportQuarterSchedulerTowerColor:MainMinimal.tiedTagCertTen.spectralCall];
        [windowsButton setBackgroundImage:[UIImage blackAnonymousColor:[[UIColor lightGrayColor] colorWithAlphaComponent:0.5f]] forState:UIControlStateNormal];
        [windowsButton addTarget:self action:@selector(revisionsAppendBusRequiringCancelingSun:) forControlEvents:(UIControlEventTouchUpInside)];
        [self.view addSubview:windowsButton];
        [windowsButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.view).offset(-MainMinimal.nordicPubTen.presetRoute);
            make.centerX.equalTo(self.view).multipliedBy(.65);
            make.height.mas_equalTo(MainMinimal.nordicPubTen.trustBurmese);
        }];
    }
    
    UIButton *tipIronButton =  [MainMinimal grandsonTransportQuarterSchedulerTowerColor:MainMinimal.tiedTagCertTen.makeCatWax];
    [tipIronButton addTarget:self action:@selector(tapWateryDryBandSnapshotEra:) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:tipIronButton];
    [tipIronButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-MainMinimal.nordicPubTen.presetRoute);
        make.centerX.equalTo(self.view).multipliedBy(![self.freeKinDark boolValue]?1.35:1);
        make.height.mas_equalTo(MainMinimal.nordicPubTen.trustBurmese);
    }];
    
    garbageView.selectedSegmentIndex = 0;
    [self stripNeverAdd:garbageView];
}

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

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

- (void)negotiateAddressesStateMostMethodText:(NSInteger)type {
    NSString *effectLess = nil;
    UIView *contentView = nil;
    effectLess = type == 0 ? [MainMinimal existBinMillionAnswerRefreshed]:[MainMinimal trackStarElementsHostWrap];
    contentView = type == 0 ? self.ownPlayableHisAndKilogram:self.youMuteEngravedCurlExporting;
    
    if (effectLess.swappedSmile) {
        return;
    }
    
    if ([[effectLess pathExtension] containsString:MainMinimal.nordicPubTen.vibrancyGrandauntAscenderIntervalsSay]) {
        UITextView *capView = (UITextView *)contentView;
        if (capView.text.length > 0) {
            return;
        }

        
        [TooRespondView tenWhoRetSoloView:contentView];

        
        NSURL *url = [NSURL URLWithString:effectLess];
        NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
                                                                 completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            
            dispatch_async(dispatch_get_main_queue(), ^{
                
                [TooRespondView useLocatorStrongestCostFormatView:contentView];
                
                if (error || data.length == 0) {
                    
                    capView.text = MainMinimal.tiedTagCertTen.notWalkNearestLandmarkHashSentences;
                    return;
                }
                
                
                NSString *menBagZipShot = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                capView.text = menBagZipShot ?: MainMinimal.tiedTagCertTen.requireFeaturesItsKitAccessingTransportLock;
            });
        }];
        
        [task resume];

    }else {
        WKWebView *farPin = (WKWebView *)contentView;
        if (!farPin.isLoading && farPin.estimatedProgress == 1) {
            [TooRespondView useLocatorStrongestCostFormatView:contentView];
            return;
        }
        [TooRespondView tenWhoRetSoloView:contentView];
        NSString *getRectum =  [effectLess.minWhiteVowelAlienCommittedTap stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
        NSURL *url = [NSURL URLWithString:getRectum];
        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
        [farPin loadRequest:request];
    }
}

- (void)revisionsAppendBusRequiringCancelingSun:(id)sender {
    [self preparingFriendPrinterVolatileGroupingAction:nil];
    if (self.armourEarTapSlopeDistinct) {
        self.armourEarTapSlopeDistinct(NO);
    }
}

- (void)tapWateryDryBandSnapshotEra:(id)sender {
    [self preparingFriendPrinterVolatileGroupingAction:nil];
    if (self.armourEarTapSlopeDistinct) {
        self.armourEarTapSlopeDistinct(YES);
    }
}

- (UIView *)fiveArtistView:(NSString *)string {
    UIView *themeKeyPub = nil;
    if ([[string pathExtension] containsString:MainMinimal.nordicPubTen.vibrancyGrandauntAscenderIntervalsSay]) {
        UITextView * beginOpt = [UITextView new];
        beginOpt.editable = NO;
        beginOpt.backgroundColor = UIColor.whiteColor;
        beginOpt.textColor = UIColor.grayColor;
        themeKeyPub = beginOpt;
    }else {
        WKWebView *lossBoxChat = [[WKWebView alloc] initWithFrame:CGRectZero];
        lossBoxChat.backgroundColor = UIColor.clearColor;
        lossBoxChat.scrollView.backgroundColor = UIColor.lightGrayColor;
        lossBoxChat.opaque = YES;
        lossBoxChat.scrollView.bounces =NO;
        lossBoxChat.scrollView.showsVerticalScrollIndicator = NO;
        lossBoxChat.scrollView.showsHorizontalScrollIndicator = NO;
        lossBoxChat.navigationDelegate = self;
        themeKeyPub = lossBoxChat;
    }
    return themeKeyPub;
}

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

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

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

@end
