<commit_before>//
//  CVCalendarView.swift
//  CVCalendar
//
//  Created by <NAME> on 12/26/14.
//  Copyright (c) 2014 GameApp. All rights reserved.
//

import UIKit

public typealias WeekView = CVCalendarWeekView
public typealias CalendarView = CVCalendarView
public typealias MonthView = CVCalendarMonthView
public typealias Manager = CVCalendarManager
public typealias DayView = CVCalendarDayView
public typealias ContentController = CVCalendarContentViewController
public typealias Appearance = CVCalendarViewAppearance
public typealias Coordinator = CVCalendarDayViewControlCoordinator
public typealias CalendarMode = CVCalendarViewPresentationMode
public typealias Weekday = CVCalendarWeekday
public typealias Animator = CVCalendarViewAnimator
public typealias Delegate = CVCalendarViewDelegate
public typealias AppearanceDelegate = CVCalendarViewAppearanceDelegate
public typealias AnimatorDelegate = CVCalendarViewAnimatorDelegate
public typealias ContentViewController = CVCalendarContentViewController
public typealias MonthContentViewController = CVCalendarMonthContentViewController
public typealias WeekContentViewController = CVCalendarWeekContentViewController
public typealias MenuViewDelegate = CVCalendarMenuViewDelegate
public typealias TouchController = CVCalendarTouchController
public typealias SelectionType = CVSelectionType

public final class CVCalendarView: UIView {
    // MARK: - Public properties
    public var manager: Manager!
    public var appearance: Appearance!
    public var touchController: TouchController!
    public var coordinator: Coordinator!
    public var animator: Animator!
    public var contentController: ContentViewController!
    public var calendarMode: CalendarMode!

    public var (weekViewSize, dayViewSize): (CGSize?, CGSize?)

    fileprivate var validated = false
    fileprivate var currentOrientation: UIDeviceOrientation
    fileprivate var maxHeight: CGFloat = 0

    public var firstWeekday: Weekday {
        if let delegate = delegate {
            return delegate.firstWeekday()
        } else {
            return .sunday
        }
    }

    public var shouldShowWeekdaysOut: Bool! {
        if let delegate = delegate, let shouldShow = delegate.shouldShowWeekdaysOut?() {
            return shouldShow
        } else {
            return false
        }
    }

    public var presentedDate: CVDate! {
        didSet {
            let calendar = self.delegate?.calendar?() ?? Calendar.current
            if oldValue != nil && presentedDate.convertedDate(calendar: calendar) != oldValue.convertedDate(calendar: calendar) {
                delegate?.presentedDateUpdated?(presentedDate)
            }
        }
    }

    public var shouldAnimateResizing: Bool {
        if let delegate = delegate, let should = delegate.shouldAnimateResizing?() {
            return should
        }
        
        return true
    }
    
    public var shouldAutoSelectDayOnMonthChange: Bool {
        if let delegate = delegate, let should = delegate.shouldAutoSelectDayOnMonthChange?() {
            return should
        }
        return true
    }

    public var shouldAutoSelectDayOnWeekChange: Bool {
        if let delegate = delegate, let should = delegate.shouldAutoSelectDayOnWeekChange?() {
            return should
        }
        return true
    }
    
    public var shouldScrollOnOutDayViewSelection: Bool {
        if let delegate = delegate, let should = delegate.shouldScrollOnOutDayViewSelection?() {
            return should
        }
        return true
    }
    
    
    public var shouldSelectRange: Bool {
        get {
            if let delegate = delegate, let should = delegate.shouldSelectRange?() {
                return should
            }
            return false
        }
    }
    
    public var disableScrollingBeyondDate: Date? {
        get {
            if let delegate = delegate, let date = delegate.disableScrollingBeforeDate?() {
                return date
            }
            return nil
        }
    }
    
    public var maxSelectableRange: Int {
        get {
            if let delegate = delegate, let range = delegate.maxSelectableRange?() {
                return range
            }
            return 0
        }
    }<commit_msg>Update CVCalendarView.swift<commit_after>//
//  CVCalendarView.swift
//  CVCalendar
//
//  Created by <NAME> on 12/26/14.
//  Copyright (c) 2014 GameApp. All rights reserved.
//

import UIKit

public typealias WeekView = CVCalendarWeekView
public typealias CalendarView = CVCalendarView
public typealias MonthView = CVCalendarMonthView
public typealias Manager = CVCalendarManager
public typealias DayView = CVCalendarDayView
public typealias ContentController = CVCalendarContentViewController
public typealias Appearance = CVCalendarViewAppearance
public typealias Coordinator = CVCalendarDayViewControlCoordinator
public typealias CalendarMode = CVCalendarViewPresentationMode
public typealias Weekday = CVCalendarWeekday
public typealias Animator = CVCalendarViewAnimator
public typealias Delegate = CVCalendarViewDelegate
public typealias AppearanceDelegate = CVCalendarViewAppearanceDelegate
public typealias AnimatorDelegate = CVCalendarViewAnimatorDelegate
public typealias ContentViewController = CVCalendarContentViewController
public typealias MonthContentViewController = CVCalendarMonthContentViewController
public typealias WeekContentViewController = CVCalendarWeekContentViewController
public typealias MenuViewDelegate = CVCalendarMenuViewDelegate
public typealias TouchController = CVCalendarTouchController
public typealias SelectionType = CVSelectionType

public final class CVCalendarView: UIView {
    // MARK: - Public properties
    public var manager: Manager!
    public var appearance: Appearance!
    public var touchController: TouchController!
    public var coordinator: Coordinator!
    public var animator: Animator!
    public var contentController: ContentViewController!
    public var calendarMode: CalendarMode!

    public var (weekViewSize, dayViewSize): (CGSize?, CGSize?)

    fileprivate var validated = false
    fileprivate var currentOrientation: UIDeviceOrientation
    fileprivate var maxHeight: CGFloat = 0

    public var firstWeekday: Weekday {
        if let delegate = delegate {
            return delegate.firstWeekday()
        } else {
            return .sunday
        }
    }

    public var shouldShowWeekdaysOut: Bool! {
        if let delegate = delegate, let shouldShow = delegate.shouldShowWeekdaysOut?() {
            return shouldShow
        } else {
            return false
        }
    }

    public var presentedDate: CVDate! {
        didSet {
            let calendar = self.delegate?.calendar?() ?? Calendar.current
            if oldValue != nil && presentedDate.convertedDate(calendar: calendar) != oldValue.convertedDate(calendar: calendar) {
                delegate?.presentedDateUpdated?(presentedDate)
            }
        }
    }

    public var shouldAnimateResizing: Bool {
        if let delegate = delegate, let should = delegate.shouldAnimateResizing?() {
            return should
        }
        
        return true
    }
    
    public var shouldAutoSelectDayOnMonthChange: Bool {
        if let delegate = delegate, let should = delegate.shouldAutoSelectDayOnMonthChange?() {
            return should
        }
        return true
    }

    public var shouldAutoSelectDayOnWeekChange: Bool {
        if let delegate = delegate, let should = delegate.shouldAutoSelectDayOnWeekChange?() {
            return should
        }
        return true
    }
    
    public var shouldScrollOnOutDayViewSelection: Bool {
        if let delegate = delegate, let should = delegate.shouldScrollOnOutDayViewSelection?() {
            return should
        }
        return true
    }
    
    
    public var shouldSelectRange: Bool {
        get {
            if let delegate = delegate, let should = delegate.shouldSelectRange?() {
                return should
            }
            return false
        }
    }
    
    public var disableScrollingBeforeDate: Date? {
        get {
            if let delegate = delegate, let date = delegate.disableScrollingBeforeDate?() {
                return date
            }
            return nil
        }
    }
    
    public var disableScrollingBeyondDate: Date? {
        get {
            if let delegate = delegate, let date = delegate.disableScrollingBeyondDate?() {
                return date
            }
            return nil
        }
    }
    
    public var maxSelectableRange: Int {
        get {
            if let delegate = delegate, let range = delegate.maxSelectableRange?() {
                return range
            }
            return 0
        }
    }
{'fraction_non_alphanumeric': 0.05539724153653254, 'fraction_numerical': 0.0027356662487176566, 'mean_word_length': 2.666527371500209, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '753695', 'n_tokens_mistral': 2151, 'n_tokens_neox': 2057, 'n_words': 629}