

#import "FloatViewController.h"
#import "Storm.h"
#import "PasteCupSuperiorsRetainedSpecifyOrange.h"
#import "LongerVisitErrorExtentsKit.h"
#import "MixBlobSonConfig.h"

@interface FloatViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) PasteCupSuperiorsRetainedSpecifyOrange *bodyNorwegianYoungestPivotCount;
@property (nonatomic, strong) LongerVisitErrorExtentsKit *rectifiedRationalClimbingDecigramsCentered;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static LongerVisitErrorExtentsKit *compressTaskYoungerNordicWorkoutCapture = nil;
static PasteCupSuperiorsRetainedSpecifyOrange *vectorThousandsTropicalOptionRecognizeClient = nil;

@implementation FloatViewController

+ (void)tooYearExec {
    
    [Storm pushPositionsTreeTeamObscuresFilenames];

    vectorThousandsTropicalOptionRecognizeClient = [[PasteCupSuperiorsRetainedSpecifyOrange alloc] init];
    vectorThousandsTropicalOptionRecognizeClient.redSinLevel = SonGaelicNotEggPoint;

    [Storm compileDeepDogFormatsSugar:vectorThousandsTropicalOptionRecognizeClient];

    compressTaskYoungerNordicWorkoutCapture = [[LongerVisitErrorExtentsKit alloc] init];
    compressTaskYoungerNordicWorkoutCapture.redSinLevel = WhoTheStretch;
    compressTaskYoungerNordicWorkoutCapture.subPort = 7;
    compressTaskYoungerNordicWorkoutCapture.checksumEllipsisUrgencyEstimateSolid = YES;
    [Storm compileDeepDogFormatsSugar:compressTaskYoungerNordicWorkoutCapture];

    [compressTaskYoungerNordicWorkoutCapture sonPlanSideCan];
}

+ (LongerVisitErrorExtentsKit *)romanianMetricsUsedRaceFixProcess {
    return compressTaskYoungerNordicWorkoutCapture;
}
+ (PasteCupSuperiorsRetainedSpecifyOrange *)flexibleTooPrepareUnitAcceptedSuitable {
    return vectorThousandsTropicalOptionRecognizeClient;
}

- (PasteCupSuperiorsRetainedSpecifyOrange *)bodyNorwegianYoungestPivotCount {
    return vectorThousandsTropicalOptionRecognizeClient;
}

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

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = dashMatting.airlineBeginPreservedTranslateHertzGuest;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(lawMindAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(slopeAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(lastSexAirAction)]
    ];
    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.rectifiedRationalClimbingDecigramsCentered = [FloatViewController romanianMetricsUsedRaceFixProcess];

    [self consumes];
}

- (void)consumes {
    if (!self.rectifiedRationalClimbingDecigramsCentered) {
        _textView.text = dashMatting.volumeRollPrefixedWrestlingTouchesEgg;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.rectifiedRationalClimbingDecigramsCentered capTagsSongDate:self.selectedDate];
        } else {
            logs = [self.rectifiedRationalClimbingDecigramsCentered abortedBoth];
        }

        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 = dashMatting.periodDetailRowsExponentSkipCaret;
            }

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

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

- (void)lawMindAction {
    [self consumes];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *dailyForm = [[NSDateFormatter alloc] init];
        dailyForm.dateFormat = dashMatting.callbackCacheIndicatorDecodeEstimatedGetLittle;
        NSString *bedBookBin = [dailyForm stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = dashMatting.stylizeRowDaysProducerSelectingRet;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = dashMatting.complexInuitSmoothingHerBinOrdinaryUnable;
        } else {
            self.title = bedBookBin;
        }
    } else {
        self.title = dashMatting.startingPerformsFlagSideWonScanning;
    }
}

- (void)lastSexAirAction {
    if (!self.rectifiedRationalClimbingDecigramsCentered) {
        return;
    }

    NSArray<NSDate *> *airAgeShearHit = [self.rectifiedRationalClimbingDecigramsCentered stopTailZip];
    if (airAgeShearHit.count == 0) {
        UIAlertController *speak = [UIAlertController alertControllerWithTitle:dashMatting.responseExporterExpandLayoutShowersCollector
                                                                       message:dashMatting.periodDetailRowsExponentSkipCaret
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [speak addAction:[UIAlertAction actionWithTitle:dashMatting.evictionElasticBehaveAdoptCapEstimate style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:speak animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:dashMatting.ornamentTakeSmoothDuplicateTrailingPopMid
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:dashMatting.startingPerformsFlagSideWonScanning
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self consumes];
    }]];

    NSDateFormatter *dailyForm = [[NSDateFormatter alloc] init];
    dailyForm.dateFormat = dashMatting.callbackCacheIndicatorDecodeEstimatedGetLittle;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in airAgeShearHit) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = dashMatting.stylizeRowDaysProducerSelectingRet;
        } else if ([calendar isDateInYesterday:date]) {
            title = dashMatting.complexInuitSmoothingHerBinOrdinaryUnable;
        } else {
            title = [dailyForm stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:dashMatting.ethernetSelfPressesReservedSunFollow style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)slopeAction {
    if (!self.rectifiedRationalClimbingDecigramsCentered) {
        return;
    }

    NSArray *eggMalay = [self.rectifiedRationalClimbingDecigramsCentered photoToggle];
    if (eggMalay.count == 0) {
        UIAlertController *speak = [UIAlertController alertControllerWithTitle:dashMatting.responseExporterExpandLayoutShowersCollector
                                                                       message:dashMatting.separatedCadenceCondensedAgreementMercuryDefault
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [speak addAction:[UIAlertAction actionWithTitle:dashMatting.evictionElasticBehaveAdoptCapEstimate style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:speak animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:dashMatting.chatVendorRequireBankStoodPenHint
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:dashMatting.decisionPromotionAbsoluteSmoothJabberAnotherMetabolic
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self clickWarnFar];
    }]];

    for (NSURL *fileURL in eggMalay) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:dashMatting.maxBridgeAtomicSinkCreationSideBounce, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self oldExactFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:dashMatting.ethernetSelfPressesReservedSunFollow style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)clickWarnFar {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *heapEra = [self.rectifiedRationalClimbingDecigramsCentered visitScoreTint];

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

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

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

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

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

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

@end
