

#import "BlackViewController.h"
#import "Waist.h"
#import "StrategySerifLinkPresenterIntentEstimate.h"
#import "PartiallyKurdishPingPrintedBoth.h"
#import "PricePointConfig.h"

@interface BlackViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) StrategySerifLinkPresenterIntentEstimate *resourceLingerPrepareBodyMind;
@property (nonatomic, strong) PartiallyKurdishPingPrintedBoth *caseChangeFactoryLinePasswords;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static PartiallyKurdishPingPrintedBoth *differentBeenLeftBitsGreekExpired = nil;
static StrategySerifLinkPresenterIntentEstimate *entitiesMaxLimitKeyClickedReason = nil;

@implementation BlackViewController

+ (void)balticSmart {
    
    [Waist effectiveUnwindingIncomingWindowsFactorWho];

    entitiesMaxLimitKeyClickedReason = [[StrategySerifLinkPresenterIntentEstimate alloc] init];
    entitiesMaxLimitKeyClickedReason.napAddLevel = DependingProcessCanonOnceIndicated;

    [Waist clearCreamyReadoutReferentEnglish:entitiesMaxLimitKeyClickedReason];

    differentBeenLeftBitsGreekExpired = [[PartiallyKurdishPingPrintedBoth alloc] init];
    differentBeenLeftBitsGreekExpired.napAddLevel = MindLocations;
    differentBeenLeftBitsGreekExpired.revoked = 7;
    differentBeenLeftBitsGreekExpired.wristEffectivePolarArbitraryLease = YES;
    [Waist clearCreamyReadoutReferentEnglish:differentBeenLeftBitsGreekExpired];

    [differentBeenLeftBitsGreekExpired flagPushMotion];
}

+ (PartiallyKurdishPingPrintedBoth *)shadowLessLoopsMenRegularEgg {
    return differentBeenLeftBitsGreekExpired;
}
+ (StrategySerifLinkPresenterIntentEstimate *)rotorOuterSubNowWordDigit {
    return entitiesMaxLimitKeyClickedReason;
}

- (StrategySerifLinkPresenterIntentEstimate *)resourceLingerPrepareBodyMind {
    return entitiesMaxLimitKeyClickedReason;
}

+ (void)showFromViewController:(UIViewController *)parentVC {
    BlackViewController *dolby = [[BlackViewController alloc] init];
    UINavigationController *sob = [[UINavigationController alloc] initWithRootViewController:dolby];
    sob.modalPresentationStyle = UIModalPresentationFullScreen;
    [parentVC presentViewController:sob animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = flipWetSort.openBridgedMisplacedMandatoryAnswerGray;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
                                            initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
                                            target:self
                                            action:@selector(errorAction)];

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(writingAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(rotorAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(teluguHeadAction)]
    ];
    self.navigationController.navigationBar.layoutMargins = UIEdgeInsetsMake(0, 0, 0, -10);

    _textView = [[UITextView alloc] init];
    _textView.font = [UIFont systemFontOfSize:11];
    _textView.editable = NO;
    _textView.backgroundColor = [UIColor systemBackgroundColor];
    _textView.textColor = [UIColor labelColor];
    _textView.translatesAutoresizingMaskIntoConstraints = NO;
    _textView.showsVerticalScrollIndicator = YES;
    _textView.showsHorizontalScrollIndicator = YES;
    _textView.alwaysBounceVertical = YES;
    
    _textView.scrollEnabled = YES;
    [self.view addSubview:_textView];

    [NSLayoutConstraint activateConstraints:@[
        [_textView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
        [_textView.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor constant:8],
        [_textView.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor constant:-8],
        [_textView.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor]
    ]];

    self.caseChangeFactoryLinePasswords = [BlackViewController shadowLessLoopsMenRegularEgg];

    [self mandarin];
}

- (void)mandarin {
    if (!self.caseChangeFactoryLinePasswords) {
        _textView.text = flipWetSort.tipKitKindTwoObserveSpecify;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.caseChangeFactoryLinePasswords tipNeedRaceDate:self.selectedDate];
        } else {
            logs = [self.caseChangeFactoryLinePasswords tipPutSpace];
        }

        dispatch_async(dispatch_get_main_queue(), ^{
            if (logs.length > 0) {
                self.textView.text = logs;
                
                [self.textView scrollRangeToVisible:NSMakeRange(logs.length - 1, 1)];
            } else {
                self.textView.text = flipWetSort.penTertiaryShowersArgumentsWetBehave;
            }

            [self updateTitle];
        });
    });
}

- (void)errorAction {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)writingAction {
    [self mandarin];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *returning = [[NSDateFormatter alloc] init];
        returning.dateFormat = flipWetSort.icyPromiseExerciseGenericRopeCheckerKit;
        NSString *itsAndSeed = [returning stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = flipWetSort.pickOrnamentsSelectorsInsertingGreatOlympus;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = flipWetSort.marathiPenPasswordsWriteWrapperAbortInitiated;
        } else {
            self.title = itsAndSeed;
        }
    } else {
        self.title = flipWetSort.gracefulYetEntryResponsesSpecifiedSegue;
    }
}

- (void)teluguHeadAction {
    if (!self.caseChangeFactoryLinePasswords) {
        return;
    }

    NSArray<NSDate *> *fitNonceBinRow = [self.caseChangeFactoryLinePasswords winHectares];
    if (fitNonceBinRow.count == 0) {
        UIAlertController *cover = [UIAlertController alertControllerWithTitle:flipWetSort.partialFifteenAfterCreateRacePeople
                                                                       message:flipWetSort.penTertiaryShowersArgumentsWetBehave
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [cover addAction:[UIAlertAction actionWithTitle:flipWetSort.sessionInfiniteItalianAnglePreferRoute style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:cover animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:flipWetSort.detectorBlueCanceledBoundTicketsSleetFixing
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:flipWetSort.gracefulYetEntryResponsesSpecifiedSegue
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self mandarin];
    }]];

    NSDateFormatter *returning = [[NSDateFormatter alloc] init];
    returning.dateFormat = flipWetSort.icyPromiseExerciseGenericRopeCheckerKit;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in fitNonceBinRow) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = flipWetSort.pickOrnamentsSelectorsInsertingGreatOlympus;
        } else if ([calendar isDateInYesterday:date]) {
            title = flipWetSort.marathiPenPasswordsWriteWrapperAbortInitiated;
        } else {
            title = [returning stringFromDate:date];
        }

        [actionSheet addAction:[UIAlertAction actionWithTitle:title
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            self.selectedDate = date;
            [self mandarin];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:flipWetSort.barriersNorwegianBarDryLargeProviders style:UIAlertActionStyleCancel handler:nil]];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        actionSheet.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:actionSheet animated:YES completion:nil];
}

- (void)rotorAction {
    if (!self.caseChangeFactoryLinePasswords) {
        return;
    }

    NSArray *musicBag = [self.caseChangeFactoryLinePasswords maxPenScope];
    if (musicBag.count == 0) {
        UIAlertController *cover = [UIAlertController alertControllerWithTitle:flipWetSort.partialFifteenAfterCreateRacePeople
                                                                       message:flipWetSort.kelvinInterruptNumberVibrancyLikeCollision
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [cover addAction:[UIAlertAction actionWithTitle:flipWetSort.sessionInfiniteItalianAnglePreferRoute style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:cover animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:flipWetSort.breakSquashTapTwelveMantissaCosmicAllowable
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:flipWetSort.phaseCollectSeeCopperTensionRematchPan
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self hueFlowAudit];
    }]];

    for (NSURL *fileURL in musicBag) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:flipWetSort.bookmarksArrangedDuctilityRadialCauseNegativeUndone, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self truncateFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:flipWetSort.barriersNorwegianBarDryLargeProviders style:UIAlertActionStyleCancel handler:nil]];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        actionSheet.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:actionSheet animated:YES completion:nil];
}

- (void)hueFlowAudit {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *yetRain = [self.caseChangeFactoryLinePasswords laterFourMiles];

        dispatch_async(dispatch_get_main_queue(), ^{
            if (yetRain.length > 0) {
                UIActivityViewController *decodePull = [[UIActivityViewController alloc]
                                                       initWithActivityItems:@[yetRain]
                                                       applicationActivities:nil];

                if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
                    decodePull.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
                }

                [self presentViewController:decodePull animated:YES completion:nil];
            }
        });
    });
}

- (void)truncateFile:(NSURL *)fileURL {
    UIActivityViewController *decodePull = [[UIActivityViewController alloc]
                                           initWithActivityItems:@[fileURL]
                                           applicationActivities:nil];

    if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        decodePull.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
    }

    [self presentViewController:decodePull animated:YES completion:nil];
}

@end
