

#import "MixerViewController.h"
#import "Point.h"
#import "EarDiphthongRenamingRecordEachCurrently.h"
#import "SceneLogMartialTooEmail.h"
#import "PanUserAndConfig.h"

@interface MixerViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) EarDiphthongRenamingRecordEachCurrently *zoomTransformTabOnlineEcho;
@property (nonatomic, strong) SceneLogMartialTooEmail *providedBetweenEighteenKilohertzSave;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static SceneLogMartialTooEmail *molarAcuteCombinedFastestBlueAdvisory = nil;
static EarDiphthongRenamingRecordEachCurrently *pausePatchCompressDependingEntropyVisual = nil;

@implementation MixerViewController

+ (void)askAngleWet {
    
    [Point packetsTwoInferEnterAssumeMobile];

    pausePatchCompressDependingEntropyVisual = [[EarDiphthongRenamingRecordEachCurrently alloc] init];
    pausePatchCompressDependingEntropyVisual.popSpaLevel = ScrolledEditGetFoodIndoor;

    [Point eachWeeklyDownLenientGuide:pausePatchCompressDependingEntropyVisual];

    molarAcuteCombinedFastestBlueAdvisory = [[SceneLogMartialTooEmail alloc] init];
    molarAcuteCombinedFastestBlueAdvisory.popSpaLevel = SecondsBetter;
    molarAcuteCombinedFastestBlueAdvisory.ageFork = 7;
    molarAcuteCombinedFastestBlueAdvisory.closureDuplicateFiltersComposeThick = YES;
    [Point eachWeeklyDownLenientGuide:molarAcuteCombinedFastestBlueAdvisory];

    [molarAcuteCombinedFastestBlueAdvisory offAloneOutOwn];
}

+ (SceneLogMartialTooEmail *)reflectEmailOrdinalsSmilePlanYear {
    return molarAcuteCombinedFastestBlueAdvisory;
}
+ (EarDiphthongRenamingRecordEachCurrently *)logoBodyLocalesSelectorsGopherTrack {
    return pausePatchCompressDependingEntropyVisual;
}

- (EarDiphthongRenamingRecordEachCurrently *)zoomTransformTabOnlineEcho {
    return pausePatchCompressDependingEntropyVisual;
}

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

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = commitChest.misplacedLandmarkAssertWorldWithinAcquire;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(forSelfAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(northAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(offHandlesAction)]
    ];
    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.providedBetweenEighteenKilohertzSave = [MixerViewController reflectEmailOrdinalsSmilePlanYear];

    [self sentHail];
}

- (void)sentHail {
    if (!self.providedBetweenEighteenKilohertzSave) {
        _textView.text = commitChest.incrementFullExportingMetadataFunDimension;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.providedBetweenEighteenKilohertzSave thinStylizeDate:self.selectedDate];
        } else {
            logs = [self.providedBetweenEighteenKilohertzSave waterKernel];
        }

        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 = commitChest.itsTrapYoungestUnorderedIndentHello;
            }

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

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

- (void)forSelfAction {
    [self sentHail];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *conflicts = [[NSDateFormatter alloc] init];
        conflicts.dateFormat = commitChest.wetReorderLittleSplatVisionHertzAvailable;
        NSString *menUserTwo = [conflicts stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = commitChest.veryGaelicScopeGigahertzEmailBrowse;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = commitChest.breakProducesMiddleDidShowingCleanBest;
        } else {
            self.title = menUserTwo;
        }
    } else {
        self.title = commitChest.versionHardSwimmingFreestyleSixteenForce;
    }
}

- (void)offHandlesAction {
    if (!self.providedBetweenEighteenKilohertzSave) {
        return;
    }

    NSArray<NSDate *> *sugarFoodIssue = [self.providedBetweenEighteenKilohertzSave thirdSubShe];
    if (sugarFoodIssue.count == 0) {
        UIAlertController *dance = [UIAlertController alertControllerWithTitle:commitChest.desiredScopeBypassDialogBayerBound
                                                                       message:commitChest.itsTrapYoungestUnorderedIndentHello
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [dance addAction:[UIAlertAction actionWithTitle:commitChest.dueExecuteClimbingSyntheticExecutionSeed style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:dance animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:commitChest.tipCombiningRussianOldRateRollMalformed
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:commitChest.versionHardSwimmingFreestyleSixteenForce
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self sentHail];
    }]];

    NSDateFormatter *conflicts = [[NSDateFormatter alloc] init];
    conflicts.dateFormat = commitChest.wetReorderLittleSplatVisionHertzAvailable;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in sugarFoodIssue) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = commitChest.veryGaelicScopeGigahertzEmailBrowse;
        } else if ([calendar isDateInYesterday:date]) {
            title = commitChest.breakProducesMiddleDidShowingCleanBest;
        } else {
            title = [conflicts stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:commitChest.obtainCelsiusJustFairBlockSense style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)northAction {
    if (!self.providedBetweenEighteenKilohertzSave) {
        return;
    }

    NSArray *hueLearn = [self.providedBetweenEighteenKilohertzSave notHisHover];
    if (hueLearn.count == 0) {
        UIAlertController *dance = [UIAlertController alertControllerWithTitle:commitChest.desiredScopeBypassDialogBayerBound
                                                                       message:commitChest.netNonceShowersPackSmoothZip
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [dance addAction:[UIAlertAction actionWithTitle:commitChest.dueExecuteClimbingSyntheticExecutionSeed style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:dance animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:commitChest.allowableBasalFunkPlatformCaloriesPresetShot
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:commitChest.animatingCapacityIterativeMotionNibblesLacrosseFiller
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self foundNineRaw];
    }]];

    for (NSURL *fileURL in hueLearn) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:commitChest.cautionFlatnessClangBurstSlovakPutThat, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self vowelNotFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:commitChest.obtainCelsiusJustFairBlockSense style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)foundNineRaw {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *squares = [self.providedBetweenEighteenKilohertzSave endWasTailFood];

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

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

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

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

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

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

@end
