

#import "PriceViewController.h"
#import "Farsi.h"
#import "CapturesSubComposeArrowLambdaBordered.h"
#import "TeethPanelShearLibrariesHash.h"
#import "OnePopSongConfig.h"

@interface PriceViewController ()
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) CapturesSubComposeArrowLambdaBordered *flatnessPeopleInternetBarDelta;
@property (nonatomic, strong) TeethPanelShearLibrariesHash *lettishPeriodDissolveEarEditors;
@property (nonatomic, strong) NSDate *selectedDate; 
@end

static TeethPanelShearLibrariesHash *backupListCriticalBrokenFlashTamil = nil;
static CapturesSubComposeArrowLambdaBordered *sawRainSecurityCreateFirmwareOxygen = nil;

@implementation PriceViewController

+ (void)archerySelf {
    
    [Farsi replacedTeethRefreshToleranceSobUploaded];

    sawRainSecurityCreateFirmwareOxygen = [[CapturesSubComposeArrowLambdaBordered alloc] init];
    sawRainSecurityCreateFirmwareOxygen.weeklyLevel = CapturedDiscardHitAvailConsole;

    [Farsi beaconsMediaLacrosseTapEgg:sawRainSecurityCreateFirmwareOxygen];

    backupListCriticalBrokenFlashTamil = [[TeethPanelShearLibrariesHash alloc] init];
    backupListCriticalBrokenFlashTamil.weeklyLevel = StopBaselines;
    backupListCriticalBrokenFlashTamil.sideNet = 7;
    backupListCriticalBrokenFlashTamil.prepTargetLowerFairAccepted = YES;
    [Farsi beaconsMediaLacrosseTapEgg:backupListCriticalBrokenFlashTamil];

    [backupListCriticalBrokenFlashTamil vibrancyUndone];
}

+ (TeethPanelShearLibrariesHash *)putPubMergeIncomingCoercionSeven {
    return backupListCriticalBrokenFlashTamil;
}
+ (CapturesSubComposeArrowLambdaBordered *)tapDraftCloudyProfilesUpsideWrist {
    return sawRainSecurityCreateFirmwareOxygen;
}

- (CapturesSubComposeArrowLambdaBordered *)flatnessPeopleInternetBarDelta {
    return sawRainSecurityCreateFirmwareOxygen;
}

+ (void)printDayViewController:(UIViewController *)parentVC {
    PriceViewController *press = [[PriceViewController alloc] init];
    UINavigationController *how = [[UINavigationController alloc] initWithRootViewController:press];
    how.modalPresentationStyle = UIModalPresentationFullScreen;
    [parentVC presentViewController:how animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = eggBeatWork.fitFocusesDiscoverSnapRequestedTone;
    self.view.backgroundColor = [UIColor systemBackgroundColor];

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

    self.navigationItem.rightBarButtonItems = @[
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
                                                      target:self
                                                      action:@selector(sendOddAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction
                                                      target:self
                                                      action:@selector(bleedAction)],
        [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks
                                                      target:self
                                                      action:@selector(beforeMaskAction)]
    ];
    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.lettishPeriodDissolveEarEditors = [PriceViewController putPubMergeIncomingCoercionSeven];

    [self bookmark];
}

- (void)bookmark {
    if (!self.lettishPeriodDissolveEarEditors) {
        _textView.text = eggBeatWork.blobTriangleAvailablePartiallyStepServices;
        return;
    }

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSString *logs;
        if (self.selectedDate) {
            logs = [self.lettishPeriodDissolveEarEditors localeTodayDate:self.selectedDate];
        } else {
            logs = [self.lettishPeriodDissolveEarEditors indexHueWet];
        }

        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 = eggBeatWork.fingerLoudCanElevatedSubstringSharing;
            }

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

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

- (void)sendOddAction {
    [self bookmark];
}

- (void)updateTitle {
    if (self.selectedDate) {
        NSDateFormatter *mapSomali = [[NSDateFormatter alloc] init];
        mapSomali.dateFormat = eggBeatWork.invertedInvisibleWeekdayCountReversedOnlyRecognize;
        NSString *butWaxPong = [mapSomali stringFromDate:self.selectedDate];

        NSCalendar *calendar = [NSCalendar currentCalendar];
        if ([calendar isDateInToday:self.selectedDate]) {
            self.title = eggBeatWork.extractLabelBreakPulseTabularStrongest;
        } else if ([calendar isDateInYesterday:self.selectedDate]) {
            self.title = eggBeatWork.gaspHaveUnlockQualityFlagBecomeInterest;
        } else {
            self.title = butWaxPong;
        }
    } else {
        self.title = eggBeatWork.safetySubsetSignalTapPingClang;
    }
}

- (void)beforeMaskAction {
    if (!self.lettishPeriodDissolveEarEditors) {
        return;
    }

    NSArray<NSDate *> *staleEnterGolf = [self.lettishPeriodDissolveEarEditors overFindSee];
    if (staleEnterGolf.count == 0) {
        UIAlertController *euler = [UIAlertController alertControllerWithTitle:eggBeatWork.targetRangingCancelsManganeseRespondSon
                                                                       message:eggBeatWork.fingerLoudCanElevatedSubstringSharing
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [euler addAction:[UIAlertAction actionWithTitle:eggBeatWork.ligaturesRenderIntensityAreEffectSend style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:euler animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:eggBeatWork.boostAbortedStretchEarConstantBetterFooters
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:eggBeatWork.safetySubsetSignalTapPingClang
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        self.selectedDate = nil;
        [self bookmark];
    }]];

    NSDateFormatter *mapSomali = [[NSDateFormatter alloc] init];
    mapSomali.dateFormat = eggBeatWork.invertedInvisibleWeekdayCountReversedOnlyRecognize;

    NSCalendar *calendar = [NSCalendar currentCalendar];

    for (NSDate *date in staleEnterGolf) {
        NSString *title;
        if ([calendar isDateInToday:date]) {
            title = eggBeatWork.extractLabelBreakPulseTabularStrongest;
        } else if ([calendar isDateInYesterday:date]) {
            title = eggBeatWork.gaspHaveUnlockQualityFlagBecomeInterest;
        } else {
            title = [mapSomali stringFromDate:date];
        }

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

    [actionSheet addAction:[UIAlertAction actionWithTitle:eggBeatWork.justBestInsideGuaraniReplyExisting style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)bleedAction {
    if (!self.lettishPeriodDissolveEarEditors) {
        return;
    }

    NSArray *radioRet = [self.lettishPeriodDissolveEarEditors ourSecurity];
    if (radioRet.count == 0) {
        UIAlertController *euler = [UIAlertController alertControllerWithTitle:eggBeatWork.targetRangingCancelsManganeseRespondSon
                                                                       message:eggBeatWork.glucoseSeekDecigramsDesignBorderFit
                                                                preferredStyle:UIAlertControllerStyleAlert];
        [euler addAction:[UIAlertAction actionWithTitle:eggBeatWork.ligaturesRenderIntensityAreEffectSend style:UIAlertActionStyleDefault handler:nil]];
        [self presentViewController:euler animated:YES completion:nil];
        return;
    }

    UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:eggBeatWork.warpPressRationalSpecifyThemeShowImplied
                                                                         message:nil
                                                                  preferredStyle:UIAlertControllerStyleActionSheet];

    [actionSheet addAction:[UIAlertAction actionWithTitle:eggBeatWork.shadowManganeseSheetShipmentDirectorHeapArtwork
                                                    style:UIAlertActionStyleDefault
                                                  handler:^(UIAlertAction *action) {
        [self semaphoreAny];
    }]];

    for (NSURL *fileURL in radioRet) {
        NSString *fileName = fileURL.lastPathComponent;
        [actionSheet addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:eggBeatWork.fatAdvanceOwnershipCollectedWaitingDeletingVolume, fileName]
                                                        style:UIAlertActionStyleDefault
                                                      handler:^(UIAlertAction *action) {
            [self silencedFile:fileURL];
        }]];
    }

    [actionSheet addAction:[UIAlertAction actionWithTitle:eggBeatWork.justBestInsideGuaraniReplyExisting style:UIAlertActionStyleCancel handler:nil]];

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

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

- (void)semaphoreAny {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        NSString *dateDid = [self.lettishPeriodDissolveEarEditors widthTintGiven];

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

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

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

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

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

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

@end
