diff --git a/.gitignore b/.gitignore
index 131f236781569ef3d47a82f46dffe63c5be48b02..5f846bdc44dc42490d2b3c88d19b3dc0f50533e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ out
 smash/htmlcov/
 run-coverage.bat
 
+media
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fd2748cea54a607609c5c9468f6aa2ee75c9e208..7cf83b16820ded2b91b06faef75aad4f0645f8c5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,7 @@ variables:
   POSTGRES_PASSWORD: password
 
 before_script:
-  - apt-get update && apt-get install -y libsasl2-dev libssl-dev
+  - apt-get update && apt-get install -y libsasl2-dev libssl-dev locales locales-all
   - pip install -r requirements.txt --default-timeout=180
   - pip install -r requirements-dev.txt --default-timeout=180
 
diff --git a/readme.md b/readme.md
index a858f3e05339a24033f8690f41e217d8f1a99031..842b82732fb6795b10be63d4985bdf9df5bb184c 100644
--- a/readme.md
+++ b/readme.md
@@ -3,7 +3,7 @@
 [![coverage report](https://git-r3lab.uni.lu/piotr.atyjaszyk/scheduling-system/badges/master/coverage.svg)](https://git-r3lab.uni.lu/piotr.atyjaszyk/scheduling-system/commits/master)
 
 ## Required software (on ubuntu's OS family):
-  - `sudo apt-get install libpq-dev python-dev postgresql postgresql-contrib python virtualenv python-virtualenv gcc`
+  - `sudo apt-get install libpq-dev python-dev postgresql postgresql-contrib python virtualenv python-virtualenv gcc python-lxml libxml2-dev`
 
 ## Postgres installation
   - If you don't have postgres installed, complete step seven from [https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn) (remember to save all the credentials, they will be necessary to run the application).
@@ -30,9 +30,9 @@
 ## Production deployment
   - git pull and other project installation should be performed in a dir where this django app should be installed, in this tutorial it's /var/www/scheduling-system/
   - install nginx: `apt-get install nginx`
-  - create gunicorn service in systemd (http://docs.gunicorn.org/en/stable/deploy.html#systemd): 
+  - create gunicorn service in systemd (http://docs.gunicorn.org/en/stable/deploy.html#systemd):
 
-### /etc/systemd/system/gunicorn.service 
+### /etc/systemd/system/gunicorn.service
 
 ```
 [Unit]
@@ -67,7 +67,7 @@ ListenStream=[::]:8000
 
 [Install]
 WantedBy=sockets.target
-  
+
    - modify nginx configuration
 
 # /etc/nginx/nginx.conf
@@ -148,6 +148,16 @@ server {
         ssl_certificate_key /etc/nginx/ssl/nginx.key;
 
 
+        #configuration for static and media files hosted by nginx
+        location /media/ {
+                root /var/www/scheduling-system-files;
+        }
+
+        location /static/ {
+                root /var/www/scheduling-system-files;
+        }
+
+
         location / {
               # checks for static file, if not found proxy to app
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -163,4 +173,22 @@ server {
 }
 ```
   - extract static files and make them available via nginx: `./manage.py collectstatic`
-  - you start application by starting gunicorn and nginx: `service gunicorn start`, `service nginx start`
\ No newline at end of file
+  - you start application by starting gunicorn and nginx: `service gunicorn start`, `service nginx start`
+
+## Operations
+
+### Public holidays
+
+to import public holidays run:
+
+```
+./manage.py holidays ${YEARS}
+```
+
+where ${YEARS} should be a space separated list of years for which the holidays will be imported.
+
+example:
+
+```
+./manage.py holidays 2017 2018 2019
+```
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 72e849e28c5189314ff7943b733264979c9a153a..7c8c8a256eade03dd1b45e814f2edf0593fd446b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,8 @@
-Django==1.10.3
+Django==1.10.7
 gunicorn==19.6.0
 Pillow==3.4.2
 psycopg2==2.6.2
 pytz==2016.10
+lxml==3.7.3
+python-docx==0.8.6
+django-cleanup==0.4.2
\ No newline at end of file
diff --git a/smash/smash/local_settings.py.template b/smash/smash/local_settings.py.template
index ba1dcda662d69f97380d284555e5284a86898335..32397c94d8545705fce662d3e443f15b3cdf4a20 100644
--- a/smash/smash/local_settings.py.template
+++ b/smash/smash/local_settings.py.template
@@ -1,5 +1,5 @@
 # SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = 'Paste long random string here' # Insert long random string
+SECRET_KEY = 'Paste long random string here'  # Insert long random string
 
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = True
@@ -21,11 +21,11 @@ DEFAULT_FROM_EMAIL = 'prc-scheduling-admin@uni.lu'
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
-        'NAME': 'smashdb', # Insert your database's name
-        'USER': 'postgresmashuser', # Insert your database's user
-        'PASSWORD': 'thePOSTGRESpassword', # Insert your user's password
+        'NAME': 'smashdb',  # Insert your database's name
+        'USER': 'postgresmashuser',  # Insert your database's user
+        'PASSWORD': 'thePOSTGRESpassword',  # Insert your user's password
         'HOST': 'localhost',
-        'PORT': '' # '' === default one # Empty string is OK
+        'PORT': ''  # '' === default one # Empty string is OK
 
         # If to use sqlite
         # 'ENGINE': 'django.db.backends.sqlite3',
@@ -33,5 +33,7 @@ DATABASES = {
     }
 }
 
-STATIC_ROOT = '/tmp/static' # Warning! `/tmp` directory can be flushed in any moment; use a persistent one; e.g. ~/tmp/static
-MEDIA_ROOT = '/tmp/media' # Warning! `/tmp` directory can be flushed in any moment; use a persistent one, e.g. ~/tmp/media
+STATIC_ROOT = '/tmp/static'  # Warning! `/tmp` directory can be flushed in any moment; use a persistent one; e.g. ~/tmp/static
+MEDIA_ROOT = '/tmp/media'  # Warning! `/tmp` directory can be flushed in any moment; use a persistent one, e.g. ~/tmp/media
+
+STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
diff --git a/smash/smash/settings.py b/smash/smash/settings.py
index 0e57c97649286fdad18830070e20f69a20303d03..48fbaf41986bb03af7835e85f076684e91bdbc90 100644
--- a/smash/smash/settings.py
+++ b/smash/smash/settings.py
@@ -38,6 +38,7 @@ INSTALLED_APPS = [
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'django_cleanup',
     'debug_toolbar',
     'web'
 ]
diff --git a/smash/web/api_urls.py b/smash/web/api_urls.py
index e6f8f746b77ac19011e44a46cee9f7fbe6af5c17..a53d92e8adccd0b57667eeda9378fadaa60e01e5 100644
--- a/smash/web/api_urls.py
+++ b/smash/web/api_urls.py
@@ -15,7 +15,7 @@ Including another URLconf
 """
 from django.conf.urls import url
 
-from web.api_views import worker, location, subject, appointment_type, appointment, configuration
+from web.api_views import worker, location, subject, appointment_type, appointment, configuration, daily_planning
 
 urlpatterns = [
     # appointments
@@ -34,11 +34,19 @@ urlpatterns = [
     url(r'^countries$', subject.countries, name='web.api.countries'),
     url(r'^referrals$', subject.referrals, name='web.api.referrals'),
     url(r'^subjects/(?P<type>[A-z]+)$', subject.subjects, name='web.api.subjects'),
+    url(r'^subject_types', subject.types, name='web.api.subject_types'),
 
     # locations
     url(r'^locations$', location.locations, name='web.api.locations'),
 
+
     # worker data
     url(r'^specializations$', worker.specializations, name='web.api.specializations'),
     url(r'^units$', worker.units, name='web.api.units'),
+    url(r'^workers$', worker.workers_for_daily_planning, name='web.api.workers'),
+
+    # daily planning events
+    url(r'^events/(?P<date>\d{4}-\d{2}-\d{2})/$', daily_planning.events, name='web.api.events'),
+    url(r'^events_persist$', daily_planning.events_persist, name='web.api.events_persist'),
+
 ]
diff --git a/smash/web/api_views/appointment.py b/smash/web/api_views/appointment.py
index a31bb9f13dc84481e4c782a0d7c57f518e4cdeac..28a521b378a99371025414b1cdbdba1f56de573c 100644
--- a/smash/web/api_views/appointment.py
+++ b/smash/web/api_views/appointment.py
@@ -59,7 +59,7 @@ def appointments(request, type):
 
         appointments = sliced_subjects
 
-        count_filtered = sliced_subjects.count()
+        count_filtered = all_appointments.count()
 
         data = []
         for appointment in appointments:
@@ -77,16 +77,20 @@ def appointments(request, type):
 
 
 def serialize_appointment(appointment):
-    subject = ""
+    subject_string = ""
+    nd_number = screening_number = phone_numbers = appointment_types = None
     if appointment.visit is not None:
         title = appointment.visit.follow_up_title()
-        subject = appointment.visit.subject.first_name + " " + appointment.visit.subject.last_name + " (" + appointment.visit.subject.nd_number + ")"
+        subject = appointment.visit.subject
+        subject_string = subject.last_name + " " + subject.first_name
+        nd_number = subject.nd_number
+        screening_number = subject.screening_number
+        phone_numbers = ", ".join(filter(None, [subject.phone_number, subject.phone_number_2, subject.phone_number_3]))
+        appointment_types = ", ".join([unicode(type) for type in appointment.appointment_types.all()])
     else:
         title = appointment.comment
 
-    type = ""
-    for appointment_type in appointment.appointment_types.all():
-        type += appointment_type.code + ", "
+    type = ", ".join([type.code for type in appointment.appointment_types.all()])
     time = ""
     if appointment.datetime_when is not None:
         time = appointment.datetime_when.strftime('%Y-%m-%d %H:%M')
@@ -96,8 +100,12 @@ def serialize_appointment(appointment):
         until = appointment.datetime_until().strftime('%Y-%m-%d %H:%M')
 
     result = {
-        "subject": subject,
+        "subject": subject_string,
         "title": title,
+        "nd_number": nd_number,
+        "screening_number": screening_number,
+        "phone_number": phone_numbers,
+        "appointment_types": appointment_types,
         "type": type,
         "datetime_when": time,
         "datetime_until": until,
diff --git a/smash/web/api_views/daily_planning.py b/smash/web/api_views/daily_planning.py
new file mode 100644
index 0000000000000000000000000000000000000000..ce152cf31c801e3c4c4bb95b0b0056f0fa7f6dd3
--- /dev/null
+++ b/smash/web/api_views/daily_planning.py
@@ -0,0 +1,97 @@
+import datetime
+import json
+import random
+
+from django.contrib.auth.decorators import login_required
+from django.http import JsonResponse
+from django.shortcuts import get_object_or_404
+
+from ..models import Appointment, AppointmentTypeLink
+from ..views.notifications import get_filter_locations
+
+# mix_color = (0, 166, 90)
+mix_color = (155, 155, 155)
+
+
+def get_random_color():
+    r = lambda: random.randint(0, 255)
+    return '#%02X%02X%02X' % ((r() + mix_color[0]) / 2, (r() + mix_color[1]) / 2, (r() + mix_color[2]) / 2)
+
+
+RANDOM_COLORS = [get_random_color() for i in range(20)]
+
+
+def build_duration(duration):
+    number_of_hours = duration // 60
+    minutes = duration - number_of_hours * 60
+    return "{0:02d}:{1:02d}".format(number_of_hours, minutes)
+
+
+@login_required
+def events(request, date):
+    appointments = Appointment.objects.filter(
+        datetime_when__date=date,
+        location__in=get_filter_locations(request.user),
+        status=Appointment.APPOINTMENT_STATUS_SCHEDULED,
+        visit__isnull=False).all()
+    subjects = {}
+    for i, appointment in enumerate(appointments):
+        appointment_subject = appointment.visit.subject
+        if appointment_subject.id not in subjects:
+            # create subject
+            subject = {
+                'name': unicode(appointment_subject),
+                'id': appointment_subject.id,
+                'color': RANDOM_COLORS[i],
+                'events': []
+            }
+            subjects[appointment_subject.id] = subject
+        links = AppointmentTypeLink.objects.filter(appointment=appointment).all()
+        for j, link in enumerate(links):
+            link_when = link.date_when
+            link_end = None
+            if link_when is not None:
+                link_when = link_when.replace(tzinfo=None)
+                link_end = link_when + datetime.timedelta(minutes=link.appointment_type.default_duration)
+            event = {
+                'title': link.appointment_type.description,
+                'duration': build_duration(link.appointment_type.default_duration),
+                'subject': unicode(appointment_subject),
+                'id': '{}-{}'.format(i, j),
+                'link_id': link.id,
+                'link_when': link_when,
+                'link_who': link.worker_id,
+                'link_end': link_end,
+                'location': str(appointment.location),
+                'flying_team_location': str(appointment.flying_team),
+                'appointment_start': appointment.datetime_when.replace(tzinfo=None),
+                'appointment_end': appointment.datetime_when.replace(tzinfo=None, hour=19, minute=0),
+            }
+            subject_events = subjects[appointment_subject.id]['events']
+            subject_events.append(event)
+    return JsonResponse({
+        "data": subjects.values(),
+    })
+
+
+@login_required
+def events_persist(request):
+    event_links = json.loads(request.POST.get('events_to_persist'))
+    for event_link in event_links:
+        try:
+            when = datetime.datetime.strptime(event_link['start'], '%Y-%m-%dT%H:%M:00')
+        except ValueError:
+            when = datetime.datetime.strptime(event_link['start'][0:-6], '%Y-%m-%dT%H:%M:00')
+        worker_id = event_link['link_who']
+        link_id = event_link['link_id']
+        appointment_type_link = get_object_or_404(AppointmentTypeLink, pk=link_id)
+        appointment_type_link.worker_id = worker_id
+        appointment_type_link.date_when = when
+        appointment_type_link.save()
+    events_to_clear = json.loads(request.POST.get('events_to_clear'))
+    for link_id in events_to_clear:
+        appointment_type_link = get_object_or_404(AppointmentTypeLink, pk=link_id)
+        appointment_type_link.worker_id = None
+        appointment_type_link.date_when = None
+        appointment_type_link.save()
+    return JsonResponse({}, status=201)
diff --git a/smash/web/api_views/subject.py b/smash/web/api_views/subject.py
index 4aead296fcda779bf13106b762c0004e436d2699..eec4a799862890f5312067b34afa66b2efa6df82 100644
--- a/smash/web/api_views/subject.py
+++ b/smash/web/api_views/subject.py
@@ -2,6 +2,7 @@ from django.contrib.auth.decorators import login_required
 from django.http import JsonResponse
 
 from web.models import Subject
+from web.models.constants import SUBJECT_TYPE_CHOICES
 from web.views import e500_error
 from web.views.notifications import get_subjects_with_no_visit, get_subjects_with_reminder
 from web.views.subject import SUBJECT_LIST_GENERIC, SUBJECT_LIST_NO_VISIT, SUBJECT_LIST_REQUIRE_CONTACT
@@ -67,6 +68,8 @@ def get_subjects_order(subjects, order_column, order_direction):
         result = subjects.order_by(order_direction + 'information_sent')
     elif order_column == "postponed":
         result = subjects.order_by(order_direction + 'postponed')
+    elif order_column == "type":
+        result = subjects.order_by(order_direction + 'type')
     return result
 
 
@@ -76,13 +79,13 @@ def get_subjects_filtered(subjects, filters):
         column = row[0]
         value = row[1]
         if column == "first_name":
-            result = result.filter(first_name__contains=value)
+            result = result.filter(first_name__icontains=value)
         elif column == "last_name":
-            result = result.filter(last_name__contains=value)
+            result = result.filter(last_name__icontains=value)
         elif column == "nd_number":
-            result = result.filter(nd_number__contains=value)
+            result = result.filter(nd_number__icontains=value)
         elif column == "screening_number":
-            result = result.filter(screening_number__contains=value)
+            result = result.filter(screening_number__icontains=value)
         elif column == "dead":
             result = result.filter(dead=(value == "true"))
         elif column == "resigned":
@@ -93,6 +96,8 @@ def get_subjects_filtered(subjects, filters):
             result = result.filter(information_sent=(value == "true"))
         elif column == "default_location":
             result = result.filter(default_location=value)
+        elif column == "type":
+            result = result.filter(type=value)
         elif column == "":
             pass
         else:
@@ -148,6 +153,15 @@ def subjects(request, type):
         return e500_error(request)
 
 
+
+@login_required
+def types(request):
+    data = [{"id": subject_type_id, "name": subject_type_name} for subject_type_id, subject_type_name in SUBJECT_TYPE_CHOICES.items() ]
+    return JsonResponse({
+        "types": data
+    })
+
+
 def get_yes_no(val):
     if val:
         return "YES"
@@ -170,6 +184,7 @@ def serialize_subject(subject):
         "resigned": get_yes_no(subject.resigned),
         "postponed": get_yes_no(subject.postponed),
         "information_sent": get_yes_no(subject.information_sent),
+        "type": subject.get_type_display(),
         "id": subject.id,
     }
     return result
diff --git a/smash/web/api_views/worker.py b/smash/web/api_views/worker.py
index 3c141e25dd9e32e08d8a2523b4804a2e03f726a7..2b4aeaf1f31f7b83e0af569d4951b00fcc3f8be3 100644
--- a/smash/web/api_views/worker.py
+++ b/smash/web/api_views/worker.py
@@ -1,7 +1,8 @@
 from django.contrib.auth.decorators import login_required
 from django.http import JsonResponse
 
-from web.models import Worker
+from ..models import Worker
+from ..views.notifications import get_filter_locations
 
 
 @login_required
@@ -18,3 +19,18 @@ def units(request):
     return JsonResponse({
         "units": [x[0] for x in X]
     })
+
+
+@login_required
+def workers_for_daily_planning(request):
+    workers = Worker.objects.filter(locations__in=get_filter_locations(request.user)).exclude(
+        role=Worker.ROLE_CHOICES_SECRETARY).distinct()
+    workers_list_for_json = []
+    for worker in workers:
+        worker_dict_for_json = {
+            'id': worker.id,
+            'title': u"{} ({})".format(unicode(worker), worker.get_role_display()[:1].upper()),
+            'role': worker.get_role_display()
+        }
+        workers_list_for_json.append(worker_dict_for_json)
+    return JsonResponse(workers_list_for_json, safe=False)
diff --git a/smash/web/docx_helper.py b/smash/web/docx_helper.py
new file mode 100644
index 0000000000000000000000000000000000000000..fb78711c12cf62d7129610e3417785a2039ed796
--- /dev/null
+++ b/smash/web/docx_helper.py
@@ -0,0 +1,17 @@
+from docx import Document
+
+
+def process_file(path_to_docx, path_to_new_docx, changes_to_apply):
+    """
+    Tries to open the docx document using given path to file.
+    Then, applies the transformations- replaces template tags
+    in format of ##name## to values specified in the second
+    argument.
+    """
+    doc = Document(path_to_docx)
+    for paragraph in doc.paragraphs:
+        for placeholder, replacement in changes_to_apply.items():
+            if placeholder in paragraph.text:
+                paragraph.text = paragraph.text.replace(placeholder, replacement)
+
+    doc.save(path_to_new_docx)
diff --git a/smash/web/forms.py b/smash/web/forms.py
index b5d6da32b6eabcfbfff044f17d34135352f3a77a..ae861b874122cfc4fb5886b09111c8e4bac4be05 100644
--- a/smash/web/forms.py
+++ b/smash/web/forms.py
@@ -1,11 +1,12 @@
 import datetime
+from collections import OrderedDict
 
 from django import forms
 from django.forms import ModelForm, Form
 from django.utils.dates import MONTHS
 
-from models import Subject, Worker, Appointment, Visit, AppointmentType, ContactAttempt
-from models.constants import SUBJECT_TYPE_CHOICES
+from models import Subject, Worker, Appointment, Visit, AppointmentType, ContactAttempt, AppointmentTypeLink
+from models.constants import SUBJECT_TYPE_CHOICES, SCREENING_NUMBER_PREFIXES_FOR_TYPE
 
 """
 Possible redundancy, but if need arises, contents of forms can be easily customized
@@ -24,14 +25,14 @@ DATETIMEPICKER_DATE_ATTRS = {
     'data-date-format': 'Y-MM-DD HH:mm',
 }
 START_YEAR_STATISTICS = 2015
+APPOINTMENT_TYPES_FIELD_POSITION = 1
 
 
-def validate_subject_nd_number(self):
-    subject = self.cleaned_data
-    if subject['nd_number'] != "":
-        subjects_from_db = Subject.objects.filter(nd_number=subject['nd_number'])
+def validate_subject_nd_number(self, cleaned_data):
+    if cleaned_data['nd_number'] != "":
+        subjects_from_db = Subject.objects.filter(nd_number=cleaned_data['nd_number'])
         if subjects_from_db:
-            if subjects_from_db[0].screening_number != subject.get('screening_number', ''):
+            if subjects_from_db[0].screening_number != cleaned_data.get('screening_number', ''):
                 self.add_error('nd_number', "ND number already in use")
 
 
@@ -41,10 +42,10 @@ class SubjectAddForm(ModelForm):
                                 required=False
                                 )
 
-    datetime_contact_reminder = forms.DateField(label="Contact on",
-                                                widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
-                                                required=False
-                                                )
+    datetime_contact_reminder = forms.DateTimeField(label="Contact on",
+                                                    widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS),
+                                                    required=False
+                                                    )
 
     class Meta:
         model = Subject
@@ -60,24 +61,41 @@ class SubjectAddForm(ModelForm):
             raise TypeError("Worker not defined for: " + user.username)
 
         super(ModelForm, self).__init__(*args, **kwargs)
-
-    def clean_screening_number(self):
-        screening_number = self.cleaned_data['screening_number']
-        prefix_screening_number = get_prefix_screening_number(self.user)
-        if screening_number == prefix_screening_number:
-            screening_number = get_new_screening_number(prefix_screening_number)
+        self.fields['screening_number'].required = False
+
+    def build_screening_number(self, cleaned_data):
+        screening_number = cleaned_data.get('screening_number', None)
+        if not screening_number:
+            prefix_screening_number = self.get_prefix_screening_number()
+            if prefix_screening_number is not None:
+                screening_number = get_new_screening_number(prefix_screening_number)
         return screening_number
 
     def clean(self):
-        subject = self.cleaned_data
-        screening_number = subject.get('screening_number', '')
-
-        subjects_from_db = Subject.objects.filter(screening_number=screening_number)
-
-        if len(subjects_from_db) > 0:
-            self.add_error('screening_number', "Screening number already in use")
-
-        validate_subject_nd_number(self)
+        cleaned_data = super(SubjectAddForm, self).clean()
+        screening_number = self.build_screening_number(cleaned_data)
+        if screening_number is not None:
+            cleaned_data['screening_number'] = screening_number
+            subjects_from_db = Subject.objects.filter(screening_number=screening_number)
+
+            if len(subjects_from_db) > 0:
+                self.add_error('screening_number', "Screening number already in use")
+        validate_subject_nd_number(self, cleaned_data)
+        return cleaned_data
+
+    def get_prefix_screening_number(self):
+        default_location = self.cleaned_data.get('default_location', None)
+        screening_number_prefix = None
+        if default_location is not None and default_location.prefix:
+            screening_number_prefix = default_location.prefix
+        else:
+            subject_type = self.cleaned_data.get('type', None)
+            if subject_type is not None:
+                screening_number_prefix = SCREENING_NUMBER_PREFIXES_FOR_TYPE[subject_type]
+        if screening_number_prefix is None:
+            return None
+        prefix_screening_number = screening_number_prefix + "-"
+        return prefix_screening_number
 
 
 def get_new_screening_number(screening_number_prefix):
@@ -97,13 +115,6 @@ def get_new_screening_number(screening_number_prefix):
     return screening_number_prefix + str(result_number + 1).zfill(3)
 
 
-def get_prefix_screening_number(user):
-    prefix_screening_number = ''
-    if (user is not None) and (user.screening_number_prefix is not None) and (user.screening_number_prefix != ""):
-        prefix_screening_number = user.screening_number_prefix + "-"
-    return prefix_screening_number
-
-
 class SubjectDetailForm(ModelForm):
     class Meta:
         model = Subject
@@ -111,10 +122,10 @@ class SubjectDetailForm(ModelForm):
 
 
 class SubjectEditForm(ModelForm):
-    datetime_contact_reminder = forms.DateField(label="Contact on",
-                                                widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
-                                                required=False
-                                                )
+    datetime_contact_reminder = forms.DateTimeField(label="Contact on",
+                                                    widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS),
+                                                    required=False
+                                                    )
     date_born = forms.DateField(label="Date of birth",
                                 widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
                                 required=False
@@ -137,7 +148,7 @@ class SubjectEditForm(ModelForm):
             self.fields['resigned'].disabled = True
 
     def clean(self):
-        validate_subject_nd_number(self)
+        validate_subject_nd_number(self, self.cleaned_data)
 
     class Meta:
         model = Subject
@@ -176,12 +187,11 @@ class AppointmentEditForm(ModelForm):
     class Meta:
         model = Appointment
         fields = '__all__'
+        exclude = ['appointment_types']
 
     datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
                                         widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
                                         )
-    appointment_types = forms.ModelMultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple,
-                                                       queryset=AppointmentType.objects.all())
 
     def __init__(self, *args, **kwargs):
         user = kwargs.pop('user', None)
@@ -190,8 +200,22 @@ class AppointmentEditForm(ModelForm):
         self.user = Worker.get_by_user(user)
         if self.user is None:
             raise TypeError("Worker not defined for: " + user.username)
-
         super(ModelForm, self).__init__(*args, **kwargs)
+        if 'instance' in kwargs:
+            initial_appointment_types = AppointmentTypeLink.objects.filter(appointment=kwargs['instance']).values_list(
+                'appointment_type', flat=True)
+        else:
+            initial_appointment_types = []
+        fields = OrderedDict()
+        for i, tuple in enumerate(self.fields.items()):
+            key, value = tuple
+            fields[key] = value
+            if i == APPOINTMENT_TYPES_FIELD_POSITION:
+                fields['appointment_types'] = forms.ModelMultipleChoiceField(required=False,
+                                                                             widget=forms.CheckboxSelectMultiple,
+                                                                             queryset=AppointmentType.objects.all(),
+                                                                             initial=initial_appointment_types)
+        self.fields = fields
 
     def clean_location(self):
         location = self.cleaned_data['location']
@@ -200,17 +224,24 @@ class AppointmentEditForm(ModelForm):
         else:
             return location
 
+    def save(self, commit=True):
+        appointment = super(AppointmentEditForm, self).save(commit)
+        AppointmentTypeLink.objects.filter(appointment=appointment).delete()
+        appointment_types = self.cleaned_data['appointment_types']
+        for appointment_type in appointment_types:
+            appointment_type_link = AppointmentTypeLink(appointment=appointment, appointment_type=appointment_type)
+            appointment_type_link.save()
+        return appointment
+
 
 class AppointmentAddForm(ModelForm):
     class Meta:
         model = Appointment
-        exclude = ['status']
+        exclude = ['status', 'appointment_types']
 
     datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
                                         widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
                                         )
-    appointment_types = forms.ModelMultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple,
-                                                       queryset=AppointmentType.objects.all())
 
     def __init__(self, *args, **kwargs):
         user = kwargs.pop('user', None)
@@ -221,6 +252,16 @@ class AppointmentAddForm(ModelForm):
             raise TypeError("Worker not defined for: " + user.username)
 
         super(ModelForm, self).__init__(*args, **kwargs)
+        fields = OrderedDict()
+        for i, tuple in enumerate(self.fields.items()):
+            key, value = tuple
+            fields[key] = value
+            if i == APPOINTMENT_TYPES_FIELD_POSITION:
+                fields['appointment_types'] = forms.ModelMultipleChoiceField(required=False,
+                                                                             widget=forms.CheckboxSelectMultiple,
+                                                                             queryset=AppointmentType.objects.all(),
+                                                                             )
+        self.fields = fields
 
     def clean_location(self):
         location = self.cleaned_data['location']
@@ -229,6 +270,14 @@ class AppointmentAddForm(ModelForm):
         else:
             return location
 
+    def save(self, commit=True):
+        appointment = super(AppointmentAddForm, self).save(commit)
+        appointment_types = self.cleaned_data['appointment_types']
+        for appointment_type in appointment_types:
+            appointment_type_link = AppointmentTypeLink(appointment=appointment, appointment_type=appointment_type)
+            appointment_type_link.save()
+        return appointment
+
 
 class VisitDetailForm(ModelForm):
     datetime_begin = forms.DateField(label="Visit begins on",
@@ -272,7 +321,7 @@ class VisitAddForm(ModelForm):
 
 
 class ContactAttemptForm(ModelForm):
-    datetime_when = forms.DateTimeField(label='Contact on (YYYY-MM-DD HH:MM)',
+    datetime_when = forms.DateTimeField(label='When? (YYYY-MM-DD HH:MM)',
                                         widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
                                         )
 
diff --git a/smash/web/management/__init__.py b/smash/web/management/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/smash/web/management/commands/__init__.py b/smash/web/management/commands/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/smash/web/management/commands/holidays.py b/smash/web/management/commands/holidays.py
new file mode 100644
index 0000000000000000000000000000000000000000..7c01d080eecf0b2718506b3c7a33eebc566cf3ba
--- /dev/null
+++ b/smash/web/management/commands/holidays.py
@@ -0,0 +1,95 @@
+import datetime
+
+from django.core.management.base import BaseCommand
+
+from ...models import Appointment, Location, AppointmentType, AppointmentTypeLink
+
+appointment_type_other = AppointmentType.objects.filter(code='OTHER').first()
+
+
+def get_easter_monday(easter_sunday):
+    return next_weekday(easter_sunday, 0)
+
+
+def get_ascension_day(easter_sunday):
+    return easter_sunday + datetime.timedelta(days=39)
+
+
+class Command(BaseCommand):
+    help = 'import holidays for the specified years'
+
+    def add_arguments(self, parser):
+        parser.add_argument('year', nargs='+', type=int)
+
+    def handle(self, *args, **options):
+        for location in Location.objects.exclude(name="Flying Team").all():
+            for year in options['year']:
+                self.stdout.write("importing holidays for year {} and location {}".format(year, location))
+                # new years day
+                self.create_holiday(year, 1, 1, "New Years Day", location)
+                # easter monday
+                easter_sunday = get_easter_sunday_date(year)
+                easter_monday = get_easter_monday(easter_sunday)
+                self.create_holiday(year, easter_monday.month, easter_monday.day, "Easter Monday", location)
+                # ascension day
+                ascension_day = get_ascension_day(easter_sunday)
+                self.create_holiday(year, ascension_day.month, ascension_day.day, "Ascension Day", location)
+                # pentecost monday
+                pentecost_day = get_pentecost_day(easter_sunday)
+                self.create_holiday(year, pentecost_day.month, pentecost_day.day, "Pentecost Monday", location)
+                # labour day
+                self.create_holiday(year, 5, 1, "Labour Day", location)
+                # national day
+                self.create_holiday(year, 6, 23, "National Day", location)
+                # assumption day
+                self.create_holiday(year, 8, 15, "Assumption Day", location)
+                # all saints day
+                self.create_holiday(year, 11, 1, "All Saints Day", location)
+                # christmas
+                self.create_holiday(year, 12, 25, "Christmas Day", location)
+                self.create_holiday(year, 12, 26, "St Stephens Day", location)
+
+    def create_holiday(self, year, month, day, comment, location):
+        # check if already exists:
+        count = Appointment.objects.filter(datetime_when__year=year, datetime_when__month=month, datetime_when__day=day,
+                                           location=location, comment=comment).count()
+        if count != 0:
+            self.stdout.write(
+                'an holiday with the same description already exists for the same day: {}'.format(comment))
+            return
+        holiday = Appointment()
+        holiday.datetime_when = datetime.datetime(year=year, month=month, day=day, hour=9)
+        holiday.location = location
+        holiday.length = 60 * 8
+        holiday.comment = comment
+        holiday.visit_id = None
+        holiday.save()
+        link = AppointmentTypeLink(appointment=holiday, appointment_type=appointment_type_other)
+        link.save()
+
+
+def get_easter_sunday_date(year):
+    # source: http://www.officeholidays.com/religious/christian/easter_monday.php
+    c = year // 100
+    n = year - 19 * (year // 19)
+    k = (c - 17) // 25
+    i = c - c // 4 - (c - k) // 3 + 19 * n + 15
+    i = i - 30 * (i // 30)
+    i = i - (i // 28) * (1 - (i // 28) * (29 // (i + 1)) * ((21 - n) // 11))
+    j = year + year // 4 + i + 2 - c + c // 4
+    j = j - 7 * (j // 7)
+    l = i - j
+    month = 3 + (l + 40) // 44
+    day = l + 28 - 31 * (month // 4)
+    return datetime.datetime(year=year, month=month, day=day)
+
+
+def get_pentecost_day(easter_sunday):
+    return easter_sunday + datetime.timedelta(days=50)
+
+
+def next_weekday(day_datetime, week_day):
+    days_ahead = week_day - day_datetime.weekday()
+    if days_ahead <= 0:
+        days_ahead += 7
+    return day_datetime + datetime.timedelta(days_ahead)
diff --git a/smash/web/migrations/0033_auto_20170406_1146.py b/smash/web/migrations/0033_auto_20170406_1146.py
new file mode 100644
index 0000000000000000000000000000000000000000..c12ce67d6f03a61a8018f4f902586710c4b0be5a
--- /dev/null
+++ b/smash/web/migrations/0033_auto_20170406_1146.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-04-06 09:46
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('web', '0032_configurationitem_email_items'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='subject',
+            name='datetime_contact_reminder',
+            field=models.DateTimeField(blank=True, null=True, verbose_name=b'Contact on'),
+        ),
+    ]
diff --git a/smash/web/migrations/0034_mail_templates.py b/smash/web/migrations/0034_mail_templates.py
new file mode 100644
index 0000000000000000000000000000000000000000..20dec068d4b2392361b8c76a112dd32828354401
--- /dev/null
+++ b/smash/web/migrations/0034_mail_templates.py
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-04-07 07:10
+from __future__ import unicode_literals
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+def update_languages(apps, schema_editor):
+    Language = apps.get_model("web", "Language")
+    updates_to_perform = [
+        ("French", 10, "fr_FR"),
+        ("Dutch", 100, "nl_NL"),
+        ("Swedish", 200, "se_SE"),
+        ("Spanish", 110, "es_ES"),
+        ("Slovak", 200, "es_ES"),
+        ("Romanian", 200, "ro_RO"),
+        ("Polish", 200, "pl_PL"),
+        ("Italian", 100, "it_IT"),
+        ("Hungarian", 200, "hu_HU"),
+        ("Greek", 200, "el_GR"),
+        ("Finnish", 200, "fi_FI"),
+        ("Danish", 200, "da_DK"),
+        ("Arabic", 200, "ar_DZ"),
+        ("Portuguese", 80, "pt_PT"),
+        ("Luxembourgish", 20, "lb_LU"),
+        ("English", 50, "en_GB"),
+        ("German", 30, "de_DE"),
+    ]
+    for update_to_perform in updates_to_perform:
+        name, order, locale = update_to_perform
+        language = Language.objects.filter(name=name).first()
+        if language is not None:
+            language.order = order
+            language.locale = locale
+            language.save()
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('web', '0033_auto_20170406_1146'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='MailTemplate',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=255)),
+                ('context', models.CharField(choices=[(b'A', b'Appointment'), (b'S', b'Subject'), (b'V', b'Visit')],
+                                             max_length=1)),
+                ('template_file', models.FileField(upload_to=b'templates/')),
+            ],
+        ),
+        migrations.AlterModelOptions(
+            name='language',
+            options={'ordering': ['order']},
+        ),
+        migrations.AddField(
+            model_name='language',
+            name='locale',
+            field=models.CharField(
+                choices=[(b'af_ZA', b'af_ZA'), (b'am_ET', b'am_ET'), (b'ar_AE', b'ar_AE'), (b'ar_BH', b'ar_BH'),
+                         (b'ar_DZ', b'ar_DZ'), (b'ar_EG', b'ar_EG'), (b'ar_IQ', b'ar_IQ'), (b'ar_JO', b'ar_JO'),
+                         (b'ar_KW', b'ar_KW'), (b'ar_LB', b'ar_LB'), (b'ar_LY', b'ar_LY'), (b'ar_MA', b'ar_MA'),
+                         (b'ar_OM', b'ar_OM'), (b'ar_QA', b'ar_QA'), (b'ar_SA', b'ar_SA'), (b'ar_SY', b'ar_SY'),
+                         (b'ar_TN', b'ar_TN'), (b'ar_YE', b'ar_YE'), (b'arn_CL', b'arn_CL'), (b'as_IN', b'as_IN'),
+                         (b'az_AZ', b'az_AZ'), (b'az_AZ', b'az_AZ'), (b'ba_RU', b'ba_RU'), (b'be_BY', b'be_BY'),
+                         (b'bg_BG', b'bg_BG'), (b'bn_IN', b'bn_IN'), (b'bo_BT', b'bo_BT'), (b'bo_CN', b'bo_CN'),
+                         (b'br_FR', b'br_FR'), (b'bs_BA', b'bs_BA'), (b'bs_BA', b'bs_BA'), (b'ca_ES', b'ca_ES'),
+                         (b'co_FR', b'co_FR'), (b'cs_CZ', b'cs_CZ'), (b'cy_GB', b'cy_GB'), (b'da_DK', b'da_DK'),
+                         (b'de_AT', b'de_AT'), (b'de_CH', b'de_CH'), (b'de_DE', b'de_DE'), (b'de_LI', b'de_LI'),
+                         (b'de_LU', b'de_LU'), (b'div_MV', b'div_MV'), (b'dsb_DE', b'dsb_DE'), (b'el_GR', b'el_GR'),
+                         (b'en_AU', b'en_AU'), (b'en_BZ', b'en_BZ'), (b'en_CA', b'en_CA'), (b'en_CB', b'en_CB'),
+                         (b'en_GB', b'en_GB'), (b'en_IE', b'en_IE'), (b'en_IN', b'en_IN'), (b'en_IN', b'en_IN'),
+                         (b'en_JA', b'en_JA'), (b'en_MY', b'en_MY'), (b'en_NZ', b'en_NZ'), (b'en_PH', b'en_PH'),
+                         (b'en_TT', b'en_TT'), (b'en_US', b'en_US'), (b'en_ZA', b'en_ZA'), (b'en_ZW', b'en_ZW'),
+                         (b'es_AR', b'es_AR'), (b'es_BO', b'es_BO'), (b'es_CL', b'es_CL'), (b'es_CO', b'es_CO'),
+                         (b'es_CR', b'es_CR'), (b'es_DO', b'es_DO'), (b'es_EC', b'es_EC'), (b'es_ES', b'es_ES'),
+                         (b'es_ES', b'es_ES'), (b'es_GT', b'es_GT'), (b'es_HN', b'es_HN'), (b'es_MX', b'es_MX'),
+                         (b'es_NI', b'es_NI'), (b'es_PA', b'es_PA'), (b'es_PE', b'es_PE'), (b'es_PR', b'es_PR'),
+                         (b'es_PY', b'es_PY'), (b'es_SV', b'es_SV'), (b'es_UR', b'es_UR'), (b'es_US', b'es_US'),
+                         (b'es_VE', b'es_VE'), (b'et_EE', b'et_EE'), (b'eu_ES', b'eu_ES'), (b'fa_IR', b'fa_IR'),
+                         (b'fi_FI', b'fi_FI'), (b'fil_PH', b'fil_PH'), (b'fo_FO', b'fo_FO'), (b'fr_BE', b'fr_BE'),
+                         (b'fr_CA', b'fr_CA'), (b'fr_CH', b'fr_CH'), (b'fr_FR', b'fr_FR'), (b'fr_LU', b'fr_LU'),
+                         (b'fr_MC', b'fr_MC'), (b'fy_NL', b'fy_NL'), (b'ga_IE', b'ga_IE'), (b'gbz_AF', b'gbz_AF'),
+                         (b'gl_ES', b'gl_ES'), (b'gsw_FR', b'gsw_FR'), (b'gu_IN', b'gu_IN'), (b'ha_NG', b'ha_NG'),
+                         (b'he_IL', b'he_IL'), (b'hi_IN', b'hi_IN'), (b'hr_BA', b'hr_BA'), (b'hr_HR', b'hr_HR'),
+                         (b'hu_HU', b'hu_HU'), (b'hy_AM', b'hy_AM'), (b'id_ID', b'id_ID'), (b'ii_CN', b'ii_CN'),
+                         (b'is_IS', b'is_IS'), (b'it_CH', b'it_CH'), (b'it_IT', b'it_IT'), (b'iu_CA', b'iu_CA'),
+                         (b'iu_CA', b'iu_CA'), (b'ja_JP', b'ja_JP'), (b'ka_GE', b'ka_GE'), (b'kh_KH', b'kh_KH'),
+                         (b'kk_KZ', b'kk_KZ'), (b'kl_GL', b'kl_GL'), (b'kn_IN', b'kn_IN'), (b'ko_KR', b'ko_KR'),
+                         (b'kok_IN', b'kok_IN'), (b'ky_KG', b'ky_KG'), (b'lb_LU', b'lb_LU'), (b'lo_LA', b'lo_LA'),
+                         (b'lt_LT', b'lt_LT'), (b'lv_LV', b'lv_LV'), (b'mi_NZ', b'mi_NZ'), (b'mk_MK', b'mk_MK'),
+                         (b'ml_IN', b'ml_IN'), (b'mn_CN', b'mn_CN'), (b'mn_MN', b'mn_MN'), (b'moh_CA', b'moh_CA'),
+                         (b'mr_IN', b'mr_IN'), (b'ms_BN', b'ms_BN'), (b'ms_MY', b'ms_MY'), (b'mt_MT', b'mt_MT'),
+                         (b'nb_NO', b'nb_NO'), (b'ne_NP', b'ne_NP'), (b'nl_BE', b'nl_BE'), (b'nl_NL', b'nl_NL'),
+                         (b'nn_NO', b'nn_NO'), (b'ns_ZA', b'ns_ZA'), (b'oc_FR', b'oc_FR'), (b'or_IN', b'or_IN'),
+                         (b'pa_IN', b'pa_IN'), (b'pl_PL', b'pl_PL'), (b'ps_AF', b'ps_AF'), (b'pt_BR', b'pt_BR'),
+                         (b'pt_PT', b'pt_PT'), (b'qut_GT', b'qut_GT'), (b'quz_BO', b'quz_BO'), (b'quz_EC', b'quz_EC'),
+                         (b'quz_PE', b'quz_PE'), (b'rm_CH', b'rm_CH'), (b'ro_RO', b'ro_RO'), (b'ru_RU', b'ru_RU'),
+                         (b'rw_RW', b'rw_RW'), (b'sa_IN', b'sa_IN'), (b'sah_RU', b'sah_RU'), (b'se_FI', b'se_FI'),
+                         (b'se_NO', b'se_NO'), (b'se_SE', b'se_SE'), (b'si_LK', b'si_LK'), (b'sk_SK', b'sk_SK'),
+                         (b'sl_SI', b'sl_SI'), (b'sma_NO', b'sma_NO'), (b'sma_SE', b'sma_SE'), (b'smj_NO', b'smj_NO'),
+                         (b'smj_SE', b'smj_SE'), (b'smn_FI', b'smn_FI'), (b'sms_FI', b'sms_FI'), (b'sq_AL', b'sq_AL'),
+                         (b'sr_BA', b'sr_BA'), (b'sr_BA', b'sr_BA'), (b'sr_SP', b'sr_SP'), (b'sr_SP', b'sr_SP'),
+                         (b'sv_FI', b'sv_FI'), (b'sv_SE', b'sv_SE'), (b'sw_KE', b'sw_KE'), (b'syr_SY', b'syr_SY'),
+                         (b'ta_IN', b'ta_IN'), (b'te_IN', b'te_IN'), (b'tg_TJ', b'tg_TJ'), (b'th_TH', b'th_TH'),
+                         (b'tk_TM', b'tk_TM'), (b'tmz_DZ', b'tmz_DZ'), (b'tn_ZA', b'tn_ZA'), (b'tr_TR', b'tr_TR'),
+                         (b'tt_RU', b'tt_RU'), (b'ug_CN', b'ug_CN'), (b'uk_UA', b'uk_UA'), (b'ur_IN', b'ur_IN'),
+                         (b'ur_PK', b'ur_PK'), (b'uz_UZ', b'uz_UZ'), (b'uz_UZ', b'uz_UZ'), (b'vi_VN', b'vi_VN'),
+                         (b'wen_DE', b'wen_DE'), (b'wo_SN', b'wo_SN'), (b'xh_ZA', b'xh_ZA'), (b'yo_NG', b'yo_NG'),
+                         (b'zh_CHS', b'zh_CHS'), (b'zh_CHT', b'zh_CHT'), (b'zh_CN', b'zh_CN'), (b'zh_HK', b'zh_HK'),
+                         (b'zh_MO', b'zh_MO'), (b'zh_SG', b'zh_SG'), (b'zh_TW', b'zh_TW'), (b'zu_ZA', b'zu_ZA')],
+                default=b'fr_FR', max_length=10),
+        ),
+        migrations.AddField(
+            model_name='language',
+            name='order',
+            field=models.IntegerField(default=0),
+        ),
+        migrations.AddField(
+            model_name='mailtemplate',
+            name='language',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Language'),
+        ),
+        migrations.RunPython(update_languages, reverse_code=lambda x, y: None),
+    ]
diff --git a/smash/web/migrations/0035_screening_number.py b/smash/web/migrations/0035_screening_number.py
new file mode 100644
index 0000000000000000000000000000000000000000..3bf1a4e18c22356fc3a472716073dd1e28f72480
--- /dev/null
+++ b/smash/web/migrations/0035_screening_number.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-04-20 14:35
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+def add_prefixes(apps, schema_editor):
+    Location = apps.get_model("web", "Location")
+    updates_to_perform = [
+        ("LIH", "L"),
+        ("PRC", "P"),
+    ]
+    for update_to_perform in updates_to_perform:
+        name, prefix = update_to_perform
+        location = Location.objects.filter(name=name).first()
+        if location is not None:
+            location.prefix = prefix
+            location.save()
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('web', '0034_mail_templates'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='worker',
+            name='screening_number_prefix',
+        ),
+        migrations.AddField(
+            model_name='location',
+            name='prefix',
+            field=models.CharField(max_length=1, blank=True),
+        ),
+        migrations.RunPython(add_prefixes, reverse_code=lambda x, y: None),
+
+    ]
diff --git a/smash/web/migrations/0036_year_of_diagnosis_default.py b/smash/web/migrations/0036_year_of_diagnosis_default.py
new file mode 100644
index 0000000000000000000000000000000000000000..173f64b200ff28e468d0e26b6b1ce5ebf5271e8a
--- /dev/null
+++ b/smash/web/migrations/0036_year_of_diagnosis_default.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-04-25 07:28
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('web', '0035_screening_number'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='subject',
+            name='year_of_diagnosis',
+            field=models.IntegerField(blank=True, null=True, verbose_name=b'Year of diagnosis (YYYY)'),
+        ),
+        migrations.RunSQL(
+            "UPDATE web_subject SET year_of_diagnosis=NULL WHERE year_of_diagnosis = 0;",
+            "UPDATE web_subject SET year_of_diagnosis=0 WHERE year_of_diagnosis = NULL;"),
+    ]
diff --git a/smash/web/migrations/0037_appointment_types_descriptions_changes.py b/smash/web/migrations/0037_appointment_types_descriptions_changes.py
new file mode 100644
index 0000000000000000000000000000000000000000..a17f554c73ed4bc9f4854a8e509f4a94a4aefc2b
--- /dev/null
+++ b/smash/web/migrations/0037_appointment_types_descriptions_changes.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-04-20 14:35
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+updates_to_perform = [
+    ("SB", "Skin Biopsy", "Level B Skin Biopsy"),
+    ("B", "Level B NP", "Level B"),
+    ("PSP", "Level B PSP", "PSP"),
+]
+
+
+def add_prefixes(apps, schema_editor):
+    AppointmentType = apps.get_model("web", "AppointmentType")
+    for update_to_perform in updates_to_perform:
+        code, description, _ = update_to_perform
+        appointment_type = AppointmentType.objects.filter(code=code).first()
+        if appointment_type is not None:
+            appointment_type.description = description
+            appointment_type.save()
+
+
+def revert_prefixes(apps, schema_editor):
+    AppointmentType = apps.get_model("web", "AppointmentType")
+    for update_to_perform in updates_to_perform:
+        code, _, previous_description = update_to_perform
+        appointment_type = AppointmentType.objects.filter(code=code).first()
+        if appointment_type is not None:
+            appointment_type.description = previous_description
+            appointment_type.save()
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('web', '0036_year_of_diagnosis_default'),
+    ]
+
+    operations = [
+
+        migrations.RunPython(add_prefixes, reverse_code=revert_prefixes),
+
+    ]
diff --git a/smash/web/migrations/0038_subject_pd_family_allow_null.py b/smash/web/migrations/0038_subject_pd_family_allow_null.py
new file mode 100644
index 0000000000000000000000000000000000000000..cf0d4757d70ea13e5b71b0f74e6e0dc0b514aeff
--- /dev/null
+++ b/smash/web/migrations/0038_subject_pd_family_allow_null.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-04-26 06:58
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('web', '0037_appointment_types_descriptions_changes'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='contactattempt',
+            name='datetime_when',
+            field=models.DateTimeField(help_text=b'When did the contact occurred?', verbose_name=b'When'),
+        ),
+        migrations.AlterField(
+            model_name='subject',
+            name='pd_in_family',
+            field=models.NullBooleanField(default=False, verbose_name=b'PD in family'),
+        ),
+    ]
diff --git a/smash/web/migrations/0039_pd_family_default_unknown.py b/smash/web/migrations/0039_pd_family_default_unknown.py
new file mode 100644
index 0000000000000000000000000000000000000000..dba92d641cd5ae0c3e3684b973ee670b273c6847
--- /dev/null
+++ b/smash/web/migrations/0039_pd_family_default_unknown.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-05-17 13:46
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('web', '0038_subject_pd_family_allow_null'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='subject',
+            name='pd_in_family',
+            field=models.NullBooleanField(default=None, verbose_name=b'PD in family'),
+        ),
+        migrations.RunSQL(
+            "UPDATE web_subject SET pd_in_family=NULL WHERE pd_in_family = FALSE;",
+            reverse_sql="UPDATE web_subject SET pd_in_family=FALSE WHERE pd_in_family = NULL;")
+    ]
diff --git a/smash/web/migrations/0040_daily_planning.py b/smash/web/migrations/0040_daily_planning.py
new file mode 100644
index 0000000000000000000000000000000000000000..5e0404df8547fc898e1a4fbb07b8e72a2083d75d
--- /dev/null
+++ b/smash/web/migrations/0040_daily_planning.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-05-09 11:49
+from __future__ import unicode_literals
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+from ..models import AppointmentTypeLink
+
+
+def convert_records(apps, schema_editor):
+    Appointment = apps.get_model("web", "Appointment")
+    for appointment in Appointment.objects.all():
+        for appointment_type_id in appointment.appointment_types.values_list('id', flat=True):
+            new_link = AppointmentTypeLink(appointment_id=appointment.id, appointment_type_id=appointment_type_id)
+            new_link.save()
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('web', '0039_pd_family_default_unknown'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='AppointmentTypeLink',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('date_when', models.DateTimeField(null=True, default=None)),
+                ('appointment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Appointment')),
+                ('appointment_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.AppointmentType')),
+                ('worker', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='web.Worker')),
+            ],
+        ),
+        migrations.AddField(
+            model_name='appointment',
+            name='appointment_types_new',
+            field=models.ManyToManyField(blank=True, related_name='new_appointment', through='web.AppointmentTypeLink', to='web.AppointmentType', verbose_name=b'Appointment types'),
+        ),
+        migrations.RunPython(convert_records),
+        migrations.RunSQL(
+            "DROP TABLE web_appointment_appointment_types"),
+        migrations.RenameField(model_name='appointment', old_name='appointment_types_new', new_name='appointment_types')
+
+    ]
diff --git a/smash/web/models/__init__.py b/smash/web/models/__init__.py
index a2dc22415ab64d1292bb53ec1fbcdc4262fbbeaf..1ec7eb07a74595218e24e585fec0c3724378db43 100644
--- a/smash/web/models/__init__.py
+++ b/smash/web/models/__init__.py
@@ -8,6 +8,7 @@ from django.contrib.auth.models import User
 from configuration_item import ConfigurationItem
 from flying_team import FlyingTeam
 from location import Location
+from appointment_type_link import AppointmentTypeLink
 from room import Room
 from visit import Visit
 from worker import Worker
@@ -19,6 +20,7 @@ from item import Item
 from language import Language
 from subject import Subject
 from contact_attempt import ContactAttempt
+from mail_template import MailTemplate
 
 
 def get_current_year():
@@ -26,4 +28,4 @@ def get_current_year():
 
 
 __all__ = [FlyingTeam, Appointment, AppointmentType, Availability, Holiday, Item, Language, Location, Room, Subject,
-           Visit, Worker, ContactAttempt, ConfigurationItem]
+           Visit, Worker, ContactAttempt, ConfigurationItem, MailTemplate, AppointmentTypeLink]
diff --git a/smash/web/models/appointment.py b/smash/web/models/appointment.py
index 176dd9d0b9a0cbdb19c15a2d88aa7d5a6b4066a0..9db12586d0d83c0f61f9eba87d55260192eb5c8a 100644
--- a/smash/web/models/appointment.py
+++ b/smash/web/models/appointment.py
@@ -5,7 +5,6 @@ from django.db import models
 
 from constants import APPOINTMENT_TYPE_DEFAULT_COLOR, APPOINTMENT_TYPE_DEFAULT_FONT_COLOR, \
     CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE, NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
-from . import FlyingTeam, Location, Room, Visit, Worker
 from . import ConfigurationItem
 
 
@@ -24,27 +23,29 @@ class Appointment(models.Model):
         APPOINTMENT_STATUS_NO_SHOW: 'No Show',
     }
 
-    flying_team = models.ForeignKey(FlyingTeam,
+    flying_team = models.ForeignKey("web.FlyingTeam",
                                     verbose_name='Flying team (if applicable)',
                                     null=True, blank=True
                                     )
-    worker_assigned = models.ForeignKey(Worker,
+    worker_assigned = models.ForeignKey("web.Worker",
                                         verbose_name='Worker conducting the assessment (if applicable)',
                                         null=True, blank=True
                                         )
+
     appointment_types = models.ManyToManyField("web.AppointmentType",
                                                verbose_name='Appointment types',
-                                               blank=True
+                                               blank=True, through="web.AppointmentTypeLink",
+                                               related_name="new_appointment"
                                                )
-    room = models.ForeignKey(Room,
+    room = models.ForeignKey("web.Room",
                              verbose_name='Room ID',
                              null=True,
                              blank=True
                              )
-    location = models.ForeignKey(Location,
+    location = models.ForeignKey("web.Location",
                                  verbose_name='Location',
                                  )
-    visit = models.ForeignKey(Visit,
+    visit = models.ForeignKey("web.Visit",
                               verbose_name='Visit ID',
                               editable=False,
                               null=True,
diff --git a/smash/web/models/appointment_type.py b/smash/web/models/appointment_type.py
index 84304f466bc0da92703207852048dbc8f180f48d..a6a3ba76a64784212b1f1db2b32eba312aec0af1 100644
--- a/smash/web/models/appointment_type.py
+++ b/smash/web/models/appointment_type.py
@@ -7,6 +7,7 @@ from constants import APPOINTMENT_TYPE_DEFAULT_COLOR, APPOINTMENT_TYPE_DEFAULT_F
 class AppointmentType(models.Model):
     class Meta:
         app_label = 'web'
+        ordering = ['description']
 
     required_equipment = models.ManyToManyField("web.Item",
                                                 verbose_name='Required equipment',
@@ -52,9 +53,6 @@ class AppointmentType(models.Model):
                                        default='ANY'
                                        )
 
-    class Meta:
-        ordering = ['description']
-
     def __str__(self):
         return self.description
 
diff --git a/smash/web/models/appointment_type_link.py b/smash/web/models/appointment_type_link.py
new file mode 100644
index 0000000000000000000000000000000000000000..a48a55026880f9437ee66c390a19645dfe3a5671
--- /dev/null
+++ b/smash/web/models/appointment_type_link.py
@@ -0,0 +1,14 @@
+from django.db import models
+
+
+class AppointmentTypeLink(models.Model):
+    appointment = models.ForeignKey("web.Appointment", on_delete=models.CASCADE)
+    appointment_type = models.ForeignKey("web.AppointmentType", on_delete=models.CASCADE)
+    date_when = models.DateTimeField(null=True, default=None)
+    worker = models.ForeignKey("web.Worker", null=True, default=None)
+
+    def save(self, *args, **kwargs):
+        if self.date_when is not None:
+            self.date_when = self.date_when.replace(tzinfo=None)
+        super(AppointmentTypeLink, self).save(*args, **kwargs)
+        return self
diff --git a/smash/web/models/constants.py b/smash/web/models/constants.py
index 5d7ac193bc9e18e59b15e858bafb2a92ee8e15aa..fb01625467218e48e9111f775824a84e93372843 100644
--- a/smash/web/models/constants.py
+++ b/smash/web/models/constants.py
@@ -1,4 +1,6 @@
 # coding=utf-8
+import locale
+
 BOOL_CHOICES = ((True, 'Yes'), (False, 'No'))
 SEX_CHOICES_MALE = 'M'
 SEX_CHOICES_FEMALE = 'F'
@@ -7,10 +9,16 @@ SEX_CHOICES = (
     (SEX_CHOICES_FEMALE, 'Female'),
 )
 SUBJECT_TYPE_CHOICES_CONTROL = 'C'
+SUBJECT_TYPE_CHOICES_PATIENT = 'P'
 SUBJECT_TYPE_CHOICES = {
     SUBJECT_TYPE_CHOICES_CONTROL: 'CONTROL',
-    'P': 'PATIENT',
+    SUBJECT_TYPE_CHOICES_PATIENT: 'PATIENT',
+}
+SCREENING_NUMBER_PREFIXES_FOR_TYPE = {
+    SUBJECT_TYPE_CHOICES_CONTROL: "L",
+    SUBJECT_TYPE_CHOICES_PATIENT: "P",
 }
+
 APPOINTMENT_TYPE_DEFAULT_COLOR = '#cfc600'
 APPOINTMENT_TYPE_DEFAULT_FONT_COLOR = '#00000'
 
@@ -34,3 +42,14 @@ NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE = "NO_SHOW_APPOINTMENT_COLOR"
 KIT_RECIPIENT_EMAIL_CONFIGURATION_TYPE = "KIT_RECIPIENT_EMAIL_CONFIGURATION_TYPE"
 KIT_EMAIL_HOUR_CONFIGURATION_TYPE = "KIT_DAILY_EMAIL_HOUR_CONFIGURATION_TYPE"
 KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE = "KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE"
+
+MAIL_TEMPLATE_CONTEXT_SUBJECT = 'S'
+MAIL_TEMPLATE_CONTEXT_APPOINTMENT = 'A'
+MAIL_TEMPLATE_CONTEXT_VISIT = 'V'
+
+MAIL_TEMPLATE_CONTEXT_CHOICES = (
+    (MAIL_TEMPLATE_CONTEXT_APPOINTMENT, 'Appointment'),
+    (MAIL_TEMPLATE_CONTEXT_SUBJECT, 'Subject'),
+    (MAIL_TEMPLATE_CONTEXT_VISIT, 'Visit'),
+)
+LOCALE_CHOICES = [(value, value) for value in sorted(locale.windows_locale.values())]
diff --git a/smash/web/models/contact_attempt.py b/smash/web/models/contact_attempt.py
index 796b1ce5e68bb97b24278b60fcbb4ce1032d9db9..b21d8d60de852e1588c785cbecfd885554390d68 100644
--- a/smash/web/models/contact_attempt.py
+++ b/smash/web/models/contact_attempt.py
@@ -15,7 +15,7 @@ class ContactAttempt(models.Model):
                                )
     type = models.CharField(max_length=2, default=CONTACT_TYPES_PHONE, choices=CONTACT_TYPES_CHOICES)
 
-    datetime_when = models.DateTimeField(verbose_name="Contact on", help_text='When did the contact occurred?')
+    datetime_when = models.DateTimeField(verbose_name="When", help_text='When did the contact occurred?')
 
     success = models.BooleanField(default=False)
 
diff --git a/smash/web/models/language.py b/smash/web/models/language.py
index 8e786111d9a4265f366f2f1389db98a9af1e50f0..1b0cb703255e0aa6f9f7c23e22d804ee901ec946 100644
--- a/smash/web/models/language.py
+++ b/smash/web/models/language.py
@@ -1,13 +1,19 @@
 # coding=utf-8
+
 from django.db import models
 
+from .constants import LOCALE_CHOICES
+
 
 class Language(models.Model):
     class Meta:
         app_label = 'web'
+        ordering = ["order"]
 
     name = models.CharField(max_length=20)
     image = models.ImageField()
+    order = models.IntegerField(default=0)
+    locale = models.CharField(max_length=10, choices=LOCALE_CHOICES, null=False, blank=False, default="fr_FR")
 
     def __str__(self):
         return self.name
diff --git a/smash/web/models/location.py b/smash/web/models/location.py
index c185a5f26736228b572b828d1504296edb0e15d4..5720f26897115e0148138e130988a8b2cbfd9181 100644
--- a/smash/web/models/location.py
+++ b/smash/web/models/location.py
@@ -13,6 +13,8 @@ class Location(models.Model):
                              blank=True,
                              default="")
 
+    prefix = models.CharField(max_length=1, blank=True)
+
     def __str__(self):
         return "%s" % self.name
 
diff --git a/smash/web/models/mail_template.py b/smash/web/models/mail_template.py
new file mode 100644
index 0000000000000000000000000000000000000000..a7de8d6656b3985b9631943c61322299e0d92dc4
--- /dev/null
+++ b/smash/web/models/mail_template.py
@@ -0,0 +1,222 @@
+# coding=utf-8
+import datetime
+import locale
+from contextlib import contextmanager
+
+from django.db import models
+
+from .constants import MAIL_TEMPLATE_CONTEXT_CHOICES, MAIL_TEMPLATE_CONTEXT_APPOINTMENT, MAIL_TEMPLATE_CONTEXT_SUBJECT, \
+    MAIL_TEMPLATE_CONTEXT_VISIT
+from ..docx_helper import process_file
+from ..models import Appointment, Visit, Subject, Worker
+
+DATE_FORMAT_FULL = "%A %-d %B %Y"
+
+DATETIME_FORMAT = "%A %-d %B %Y, %H:%m"
+
+DATE_FORMAT_SHORT = "%d.%m.%Y"
+
+DATE_FORMAT_TIME = "%H:%M"
+
+now = datetime.datetime.now()
+
+
+@contextmanager
+def setlocale(name):
+    saved = locale.setlocale(locale.LC_TIME)
+    try:
+        yield locale.setlocale(locale.LC_TIME, name)
+    finally:
+        locale.setlocale(locale.LC_TIME, saved)
+
+
+class MailTemplate(models.Model):
+    MAILS_TEMPLATE_GENERIC_TAGS = [
+        ("##DATE_FULL##", "Current date when the mail will be generated (long format)", now.strftime(DATE_FORMAT_FULL)),
+        ("##DATE_SHORT##", "Current date when the mail will be generated (short format)",
+         now.strftime(DATE_FORMAT_SHORT)),
+        ("##WORKER##", "The full name of the currently logged in user", "")
+    ]
+
+    MAILS_TEMPLATE_SUBJECT_TAGS = [
+        ("##S_FULL_NAME##", "Subject's full name", "first_name last_name"),
+        ("##S_FIRST_NAME##", "Subject's first name", ""),
+        ("##S_LAST_NAME##", "Subject's last name", ""),
+        ("##S_ADDRESS##", "Subject's address", "street name and number"),
+        ("##S_CITY##", "Subject's city of residence", ""),
+        ("##S_POST_CODE##", "Subject's post code of residence", ""),
+        ("##S_COUNTRY##", "Subject's country of residence", ""),
+        ("##S_SEX##", "Subject's gender", "Male/Female"),
+        ("##S_TYPE##", "Subject's type", "CONTROL/PATIENT"),
+        ("##S_DATE_BORN##", "Subject's date of birth", now.strftime(DATE_FORMAT_SHORT)),
+
+        ("##S_EMAIL##", "Subject's email address", ""),
+        ("##S_PHONE_NUMBER##", "Subject's phone number", ""),
+        ("##S_PHONE_NUMBER_2##", "Subject's second phone number", ""),
+        ("##S_PHONE_NUMBER_3##", "Subject's third phone number", ""),
+        ("##S_MAIL_LANGUAGE##", "Subject's preferred language for written communication", ""),
+        ("##S_KNOWN_LANGUAGES##", "List of languages known by the subject", "comma separated"),
+
+        ("##S_SCREENING_NUMBER##", "Subject's screening number", ""),
+        ("##S_DIAGNOSIS##", "Subject's diagnosis", ""),
+        ("##S_DIAGNOSIS_YEAR##", "Subject's year of diagnosis", ""),
+        ("##S_MPOWER_ID##", "Subject's mPower identifier", ""),
+        ("##S_ND_NUMBER##", "Subject's ND number", ""),
+        ("##S_DATE_ADDED##", "Subject's date of creation", now.strftime(DATE_FORMAT_SHORT)),
+    ]
+
+    MAILS_TEMPLATE_VISIT_TAGS = [
+        ("##V_DATE_START_FULL##", "Visit's start date", now.strftime(DATETIME_FORMAT)),
+        ("##V_DATE_START_SHORT##", "Visit's start date", now.strftime(DATE_FORMAT_SHORT)),
+        ("##V_DATE_ENDS_FULL##", "Visit's end date", now.strftime(DATETIME_FORMAT)),
+        ("##V_DATE_ENDS_SHORT##", "Visit's end date", now.strftime(DATE_FORMAT_SHORT)),
+    ]
+
+    MAILS_TEMPLATE_APPOINTMENT_TAGS = [
+        ("##A_DATE_FULL##", "Appointment's date and time", now.strftime(DATETIME_FORMAT)),
+        ("##A_DATE_SHORT##", "Appointment's date", now.strftime(DATE_FORMAT_SHORT)),
+        ("##A_TIME##", "Appointment's time", now.strftime(DATE_FORMAT_TIME)),
+        ("##A_FLYING_TEAM##", "Appointment's flying team location", ""),
+        ("##A_LOCATION##", "Appointment's location", "value can be 'Flying Team'"),
+        ("##A_LOCATION_OR_FLYINGTEAM##", "Appointment's real location",
+         "if flying team then returns flying team exact location, otherwise returns location name"),
+        ("##A_STATUS##", "Appointment's status", ""),
+        ("##A_WORKER##", "Worker conducting the assessment", "first_name last_name"),
+        ("##A_WORKER_PHONE##", "Phone number of the worker conducting the assessment", ""),
+        ("##A_WORKER_EMAIL##", "Email address of the worker conducting the assessment", ""),
+        ("##A_ROOM##", "Appointment's room", 'room_number address city'),
+        ("##A_LENGTH##", "Appointment's duration", 'integer, value in minutes'),
+        ("##A_TYPES##", "Appointment's types", "comma separated"),
+    ]
+
+    name = models.CharField(max_length=255)
+    context = models.CharField(max_length=1, choices=MAIL_TEMPLATE_CONTEXT_CHOICES)
+    language = models.ForeignKey("web.Language", on_delete=models.CASCADE)
+    template_file = models.FileField(upload_to='templates/')
+
+    @staticmethod
+    def get_appointment_mail_templates(languages):
+        return MailTemplate.get_mail_templates_for_context(languages, MAIL_TEMPLATE_CONTEXT_APPOINTMENT)
+
+    @staticmethod
+    def get_subject_mail_templates(languages):
+        return MailTemplate.get_mail_templates_for_context(languages, MAIL_TEMPLATE_CONTEXT_SUBJECT)
+
+    @staticmethod
+    def get_visit_mail_templates(languages):
+        return MailTemplate.get_mail_templates_for_context(languages, MAIL_TEMPLATE_CONTEXT_VISIT)
+
+    @staticmethod
+    def get_mail_templates_for_context(languages, context):
+        languages_names = [language.name for language in languages]
+        templates = list(MailTemplate.objects.filter(context=context).all())
+        active_templates = []
+        disabled_templates = []
+        for template in templates:
+            if template.language.name in languages_names:
+                active_templates.append(template)
+            else:
+                disabled_templates.append(template)
+        active_templates.sort(key=lambda x: languages_names.index(x.language.name))
+        return active_templates, disabled_templates
+
+    def apply(self, instance, user, stream):
+        appointment = None
+        visit = None
+        subject = None
+        if isinstance(instance, Appointment):
+            appointment = instance
+            visit = instance.visit
+            subject = visit.subject
+        elif isinstance(instance, Visit):
+            visit = instance
+            subject = visit.subject
+        elif isinstance(instance, Subject):
+            subject = instance
+        # set locale to get correct date format
+        with setlocale(self.language.locale.encode('utf8')):
+            replacements = {}
+            self._add_generic_replacements(replacements, Worker.get_by_user(user))
+            self._add_appointment_replacements(replacements, appointment)
+            self._add_visit_replacements(replacements, visit)
+            self._add_subject_replacements(replacements, subject)
+            process_file(self.template_file.path, stream, replacements)
+        return stream
+
+    def _add_generic_replacements(self, replacements, worker):
+        current_datetime = datetime.datetime.now()
+        replacements.update({
+            "##DATE_FULL##": current_datetime.strftime(DATE_FORMAT_FULL),
+            "##DATE_SHORT##": current_datetime.strftime(DATE_FORMAT_SHORT),
+            "##WORKER##": unicode(worker)
+        })
+
+    def _add_appointment_replacements(self, replacements, appointment):
+        if appointment is not None:
+            if appointment.worker_assigned is not None:
+                worker_phone_number = appointment.worker_assigned.phone_number
+                worker_email_address = appointment.worker_assigned.email
+            else:
+                worker_phone_number = ""
+                worker_email_address = ""
+            if appointment.datetime_when is not None:
+                appointment_date_full = appointment.datetime_when.strftime(DATETIME_FORMAT)
+                appointment_date_short = appointment.datetime_when.strftime(DATE_FORMAT_SHORT)
+                appointment_date_time = appointment.datetime_when.strftime(DATE_FORMAT_TIME)
+            else:
+                appointment_date_full = appointment_date_short = appointment_date_time = ""
+            replacements.update({
+                "##A_DATE_FULL##": appointment_date_full,
+                "##A_DATE_SHORT##": appointment_date_short,
+                "##A_TIME##": appointment_date_time,
+                "##A_FLYING_TEAM##": appointment.flying_team,
+                "##A_STATUS##": appointment.get_status_display(),
+                "##A_LOCATION##": appointment.location.name,
+                "##A_LOCATION_OR_FLYINGTEAM##": appointment.flying_team or appointment.location.name,
+                "##A_WORKER##": unicode(appointment.worker_assigned),
+                '##A_WORKER_PHONE##': worker_phone_number,
+                '##A_WORKER_EMAIL##': worker_email_address,
+                "##A_ROOM##": str(appointment.room),
+                "##A_LENGTH##": appointment.length,
+                "##A_TYPES##": ", ".join([a.description for a in appointment.appointment_types.all()])
+            })
+
+    def _add_visit_replacements(self, replacements, visit):
+        if visit is not None:
+            replacements.update({
+                "##V_DATE_START_FULL##": visit.datetime_begin.strftime(DATETIME_FORMAT),
+                "##V_DATE_START_SHORT##": visit.datetime_begin.strftime(DATE_FORMAT_SHORT),
+                "##V_DATE_ENDS_FULL##": visit.datetime_end.strftime(DATETIME_FORMAT),
+                "##V_DATE_ENDS_SHORT##": visit.datetime_end.strftime(DATE_FORMAT_SHORT),
+            })
+
+    def _add_subject_replacements(self, replacements, subject):
+        if subject is not None:
+            if subject.date_born is not None:
+                date_born = subject.date_born.strftime(DATE_FORMAT_SHORT)
+            else:
+                date_born = None
+            replacements.update({
+                "##S_FULL_NAME##": unicode(subject),
+                "##S_FIRST_NAME##": subject.first_name,
+                "##S_LAST_NAME##": subject.last_name,
+                "##S_ADDRESS##": subject.address,
+                "##S_CITY##": subject.city,
+                "##S_COUNTRY##": subject.country,
+                "##S_DIAGNOSIS_YEAR##": subject.year_of_diagnosis,
+                "##S_DATE_ADDED##": subject.date_added.strftime(DATE_FORMAT_SHORT),
+                "##S_DATE_BORN##": date_born,
+                "##S_DIAGNOSIS##": subject.diagnosis,
+                "##S_EMAIL##": subject.email,
+                "##S_SEX##": subject.get_sex_display(),
+                "##S_MPOWER_ID##": subject.mpower_id,
+                "##S_ND_NUMBER##": subject.nd_number,
+                "##S_PHONE_NUMBER##": subject.phone_number,
+                "##S_PHONE_NUMBER_2##": subject.phone_number_2,
+                "##S_PHONE_NUMBER_3##": subject.phone_number_3,
+                "##S_POST_CODE##": subject.postal_code,
+                "##S_SCREENING_NUMBER##": subject.screening_number,
+                "##S_TYPE##": subject.get_type_display(),
+                '##S_MAIL_LANGUAGE##': subject.default_written_communication_language,
+                '##S_KNOWN_LANGUAGES##': ", ".join([l.name for l in subject.languages.all()])
+            })
diff --git a/smash/web/models/subject.py b/smash/web/models/subject.py
index 499b977741cafab600a13ce2a9304f7ad663338b..b28ef59c2de1e34eff123afee3a8c3ac5d033594 100644
--- a/smash/web/models/subject.py
+++ b/smash/web/models/subject.py
@@ -39,7 +39,7 @@ class Subject(models.Model):
                                     verbose_name='Postponed',
                                     default=False
                                     )
-    datetime_contact_reminder = models.DateField(
+    datetime_contact_reminder = models.DateTimeField(
         null=True,
         blank=True,
         verbose_name='Contact on',
@@ -110,7 +110,7 @@ class Subject(models.Model):
                                )
     screening_number = models.CharField(max_length=50,
                                         unique=True,
-                                        verbose_name='Screening number'
+                                        verbose_name='Screening number', blank=False, null=False
                                         )
     nd_number = models.CharField(max_length=6,
                                  blank=True,
@@ -138,24 +138,23 @@ class Subject(models.Model):
                                  verbose_name='Diagnosis'
                                  )
     year_of_diagnosis = models.IntegerField(
-        default=0,
         null=True,
         blank=True,
         verbose_name='Year of diagnosis (YYYY)'
     )
 
-    dead = models.BooleanField(
-        verbose_name='Deceased',
-        default=False,
-        editable=True
-    )
     information_sent = models.BooleanField(
         verbose_name='Information sent',
         default=False
     )
-    pd_in_family = models.BooleanField(
+    pd_in_family = models.NullBooleanField(
         verbose_name='PD in family',
+        default=None,
+    )
+    dead = models.BooleanField(
+        verbose_name='Deceased',
         default=False,
+        editable=True
     )
     resigned = models.BooleanField(
         verbose_name='Resigned',
diff --git a/smash/web/models/worker.py b/smash/web/models/worker.py
index 3272433486b8347f765dc6fea8eaeef634b5585e..fe6fc96e2e3e07f3290b7010c96c20a6d215b5fe 100644
--- a/smash/web/models/worker.py
+++ b/smash/web/models/worker.py
@@ -36,11 +36,6 @@ class Worker(models.Model):
     email = models.EmailField(
         verbose_name='E-mail'
     )
-    screening_number_prefix = models.CharField(max_length=1,
-        null=True,
-        blank=True,
-        verbose_name='Default screening number prefix',
-    )
 
     ROLE_CHOICES_SECRETARY = "SECRETARY"
     ROLE_CHOICES = (
diff --git a/smash/web/email.py b/smash/web/smash_email.py
similarity index 79%
rename from smash/web/email.py
rename to smash/web/smash_email.py
index 6ed3208b503036cf40acde5bef6290fd7cad1b34..51d54ba029b0851bc44847db3e471a972487bde5 100644
--- a/smash/web/email.py
+++ b/smash/web/smash_email.py
@@ -1,12 +1,13 @@
 # coding=utf-8
 
 from django.conf import settings
-from django.core.mail import send_mail
 from django.core.mail import EmailMessage
 
 
 class EmailSender(object):
-    def send_email(self, subject, body, recipients, cc_recipients=[]):
+    def send_email(self, subject, body, recipients, cc_recipients=None):
+        if cc_recipients is None:
+            cc_recipients = []
         email_from = getattr(settings, "DEFAULT_FROM_EMAIL", None)
         recipient_list = []
         for recipient in recipients.split(";"):
@@ -23,4 +24,4 @@ class EmailSender(object):
         message.content_subtype = "html"
         message.send()
 
-#        send_mail(subject, "", email_from, recipient_list, cc=cc_recipients, html_message=body)
+# send_mail(subject, "", email_from, recipient_list, cc=cc_recipients, html_message=body)
diff --git a/smash/web/static/AdminLTE/plugins/fullcalendar/fullcalendar_custom.print.css b/smash/web/static/AdminLTE/plugins/fullcalendar/fullcalendar_custom.print.css
new file mode 100644
index 0000000000000000000000000000000000000000..31ab3159091d9987194f54ea3509c038cc35cd23
--- /dev/null
+++ b/smash/web/static/AdminLTE/plugins/fullcalendar/fullcalendar_custom.print.css
@@ -0,0 +1,191 @@
+/*!
+ * FullCalendar v2.2.5 Print Stylesheet
+ * Docs & License: http://arshaw.com/fullcalendar/
+ * (c) 2013 Adam Shaw
+ */
+
+/*
+ * Include this stylesheet on your page to get a more printer-friendly calendar.
+ * When including this stylesheet, use the media='print' attribute of the <link> tag.
+ * Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
+ */
+
+.fc {
+    max-width: 100% !important;
+}
+
+/* Global Event Restyling
+--------------------------------------------------------------------------------------------------*/
+
+.fc-event {
+    page-break-inside: avoid;
+}
+
+.fc-event .fc-resizer {
+    display: none;
+}
+
+/* Table & Day-Row Restyling
+--------------------------------------------------------------------------------------------------*/
+
+/* kill the overlaid, absolutely-positioned common components */
+.fc-bg,
+.fc-bgevent-skeleton,
+.fc-highlight-skeleton,
+.fc-helper-skeleton {
+    display: none;
+}
+
+/* don't force a min-height on rows (for DayGrid) */
+.fc tbody .fc-row {
+    height: auto !important; /* undo height that JS set in distributeHeight */
+    min-height: 0 !important; /* undo the min-height from each view's specific stylesheet */
+}
+
+.fc tbody .fc-row .fc-content-skeleton {
+    position: static; /* undo .fc-rigid */
+    padding-bottom: 0 !important; /* use a more border-friendly method for this... */
+}
+
+.fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td { /* only works in newer browsers */
+    padding-bottom: 1em; /* ...gives space within the skeleton. also ensures min height in a way */
+}
+
+.fc tbody .fc-row .fc-content-skeleton table {
+    /* provides a min-height for the row, but only effective for IE, which exaggerates this value,
+       making it look more like 3em. for other browers, it will already be this tall */
+    height: 1em;
+}
+
+/* Undo month-view event limiting. Display all events and hide the "more" links
+--------------------------------------------------------------------------------------------------*/
+
+.fc-more-cell,
+.fc-more {
+    display: none !important;
+}
+
+.fc tr.fc-limited {
+    display: table-row !important;
+}
+
+.fc td.fc-limited {
+    display: table-cell !important;
+}
+
+.fc-popover {
+    display: none; /* never display the "more.." popover in print mode */
+}
+
+/* TimeGrid Restyling
+--------------------------------------------------------------------------------------------------*/
+
+/* undo the min-height 100% trick used to fill the container's height */
+.fc-time-grid {
+    min-height: 0 !important;
+}
+
+/* don't display the side axis at all ("all-day" and time cells) */
+.fc-agenda-view .fc-axis {
+    display: none;
+}
+
+/* don't display the horizontal lines */
+.fc-slats,
+.fc-time-grid hr { /* this hr is used when height is underused and needs to be filled */
+    display: none !important; /* important overrides inline declaration */
+}
+
+/* let the container that holds the events be naturally positioned and create real height */
+.fc-time-grid .fc-content-skeleton {
+    position: static;
+}
+
+/* in case there are no events, we still want some height */
+.fc-time-grid .fc-content-skeleton table {
+    height: 4em;
+}
+
+/* kill the horizontal spacing made by the event container. event margins will be done below */
+.fc-time-grid .fc-event-container {
+    margin: 0 !important;
+}
+
+/* TimeGrid *Event* Restyling
+--------------------------------------------------------------------------------------------------*/
+
+/* naturally position events, vertically stacking them */
+.fc-time-grid .fc-event {
+    position: static !important;
+    margin: 3px 2px !important;
+}
+
+/* for events that continue to a future day, give the bottom border back */
+.fc-time-grid .fc-event.fc-not-end {
+    border-bottom-width: 1px !important;
+}
+
+/* indicate the event continues via "..." text */
+.fc-time-grid .fc-event.fc-not-end:after {
+    content: "...";
+}
+
+/* for events that are continuations from previous days, give the top border back */
+.fc-time-grid .fc-event.fc-not-start {
+    border-top-width: 1px !important;
+}
+
+/* indicate the event is a continuation via "..." text */
+.fc-time-grid .fc-event.fc-not-start:before {
+    content: "...";
+}
+
+/* time */
+
+/* undo a previous declaration and let the time text span to a second line */
+.fc-time-grid .fc-event .fc-time {
+    white-space: normal !important;
+}
+
+/* hide the the time that is normally displayed... */
+.fc-time-grid .fc-event .fc-time span {
+    display: none;
+}
+
+/* ...replace it with a more verbose version (includes AM/PM) stored in an html attribute */
+.fc-time-grid .fc-event .fc-time:after {
+    content: attr(data-full);
+}
+
+/* Vertical Scroller & Containers
+--------------------------------------------------------------------------------------------------*/
+
+/* kill the scrollbars and allow natural height */
+.fc-scroller,
+.fc-day-grid-container, /* these divs might be assigned height, which we need to cleared */
+.fc-time-grid-container { /* */
+    overflow: visible !important;
+    height: auto !important;
+}
+
+/* kill the horizontal border/padding used to compensate for scrollbars */
+.fc-row {
+    border: 0 !important;
+    margin: 0 !important;
+}
+
+/* Button Controls
+--------------------------------------------------------------------------------------------------*/
+
+.fc-button-group,
+.fc button {
+    display: none; /* don't display any button-related controls */
+}
+
+.fc-scroller {
+    margin: 0px !important;
+}
+
+.fc-timeline-event {
+    font-size: 8px;
+}
\ No newline at end of file
diff --git a/smash/web/static/css/daily_planning.css b/smash/web/static/css/daily_planning.css
new file mode 100644
index 0000000000000000000000000000000000000000..6402f390b6f5fee01bcbd460029f121075caa3f0
--- /dev/null
+++ b/smash/web/static/css/daily_planning.css
@@ -0,0 +1,29 @@
+#subjects {
+    margin-bottom: 60px;
+}
+
+.subjects-events h4 {
+    font-size: 16px;
+    margin-top: 0;
+    padding-top: 1em;
+}
+
+.subjects-events .fc-event {
+    margin: 10px 0;
+    cursor: pointer;
+    border: none;
+    color: #fff;
+    padding-left: 10px;
+    font-weight: bold;
+    font-size: 1em;
+}
+
+.popover-content ul {
+    list-style: none;
+    margin: 0;
+    padding: 0;
+}
+
+.fc-event {
+    font-size: 1em !important;
+}
\ No newline at end of file
diff --git a/smash/web/static/css/smash.css b/smash/web/static/css/smash.css
index 90663bb9f408b41852301da3312b6fe08ba495a6..64399d3dd124d7c2a559759da199a9e45baebe56 100644
--- a/smash/web/static/css/smash.css
+++ b/smash/web/static/css/smash.css
@@ -16,4 +16,14 @@
 
 .checkbox {
     margin-top: 10px !important;
+}
+
+.table-separator {
+    background-color: #f4f4f4;
+    font-variant: small-caps;
+    font-size: 1.5em;
+}
+
+.top-buffer {
+    margin-top: 20px;
 }
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/CHANGELOG.txt b/smash/web/static/fullcalendar-scheduler/CHANGELOG.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8820ffa8c74d0628a874153e06092948cc1bbdd9
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/CHANGELOG.txt
@@ -0,0 +1,182 @@
+
+v1.6.2 (2017-04-27)
+-------------------
+
+- composer.js for Composer (PHP package manager) (#291)
+- fixed removed background events coming back when collapsing & expanding a resource (#295)
+- fixed refetchResourcesOnNavigate with refetchResources not receiving start & end (#296)
+- internal refactor of async systems
+
+
+v1.6.1 (2017-04-01)
+-------------------
+
+Bugfixes (code changes in v3.3.1 of core project):
+- stale calendar title when navigate away from then back to the a view
+- js error when gotoDate immediately after calendar initialization
+- agenda view scrollbars causes misalignment in jquery 3.2.1
+- navigation bug when trying to navigate to a day of another week
+- dateIncrement not working when duration and dateIncrement have different units (#287)
+
+
+v1.6.0 (2017-03-23)
+-------------------
+
+Adjustments to accommodate all date-related features in core v3.3.0, including:
+- `visibleRange` - complete control over view's date range
+- `validRange` - restrict date range
+- `changeView` - pass in a date or visibleRange as second param
+- `dateIncrement` - customize prev/next jump (#36)
+- `dateAlignment` - custom view alignment, like start-of-week
+- `dayCount` - force a fixed number-of-days, even with hiddenDays
+- `disableNonCurrentDates` - option to hide day cells for prev/next months
+
+Bugfixes:
+- event titles strangely positioned while touch scrolling in Timeline (#223)
+
+
+v1.5.1 (2017-02-14)
+-------------------
+
+- dragging an event that lives on multiple resources should maintain the
+  non-dragged resource IDs when dropped (#111)
+- resources function/feed should receive start/end params (#246)
+  (when `refetchResourcesOnNavigate` is true)
+- iOS 10, unwanted scrolling while dragging events/selection (#230)
+- timeline, clicking scrollbars triggers dayClick (#256)
+- timeline, external drag element droppable when outside of calendar (#256)
+
+
+v1.5.0 (2016-12-05)
+-------------------
+
+- dynamically refetch resources upon navigation (#12):
+	- `refetchResourcesOnNavigate`
+- only display resources with events (#98):
+	- `filterResourcesWithEvents`
+- `navLinks` support (#218)
+- timeline vertical scrolling wrongly resetting (#238)
+- missing bottom border on last resource (#162)
+- businessHours occupying whole view wouldn't display (#233)
+- text-decoration on event elements lost when scrolling (#229)
+- fc-today and other day-related classes in timeline header cells
+- fix touch scrolling glitchiness regression
+- made gulp-based build system consistent with core project
+- as with the corresponding core project release, there was an internal refactor
+  related to timing of rendering and firing handlers. calls to rerender the current
+  date-range/events/resources from within handlers might not execute immediately.
+  instead, will execute after handler finishes.
+
+
+v1.4.0 (2016-09-04)
+-------------------
+
+- `eventResourceEditable` for control over events changing resources (#140)
+- `eventConstraint` accepts `resourceId` or `resourceIds` (#50)
+- `eventAllow`, programmatic control over event dragging (#50)
+- `selectAllow`,  programmatic control over allowed selection
+- adjustments to work with v3 of the core project
+
+
+v1.3.3 (2016-07-31)
+-------------------
+
+- business hours per-resource (#61)
+- fix non-business days without styles (#109)
+- fix bug with scrollbars causing selection after the first (#192)
+- certain rendering actions, such as initial rendering of a resource view,
+   would not always execute synchronously once jQuery 3 was introduced.
+   fixes have been made to ensure synchronous execution with jQuery 3.
+- integration with TravisCI
+
+
+v1.3.2 (2016-06-02)
+-------------------
+
+- refetchResources and view switching causes blank screen (#179)
+- UMD definition for Node, defined core dependency (#172)
+- setResources should return an array copy (#160)
+- revertFunc misbehaves for events specified with multiple resourceIds (#156)
+- nowIndicator sometimes incorrectly positioned on wide screens (#130)
+- memory leak upon destroy (#87)
+
+
+v1.3.1 (2016-05-01)
+-------------------
+
+- events offset by minTime in timelineWeek view (#151)
+- icons for prev/next not working in MS Edge
+
+
+v1.3.0 (2016-04-23)
+-------------------
+
+touch support introduced in core v2.7.0
+
+
+v1.2.1 (2016-02-17)
+-------------------
+
+- allow minTime/maxTime to be negative or beyond 24hrs in timeline (#112)
+- fix for nowIndicator not updating position on window resize (#130)
+- fix for events resourceId/resourceIds being non-string integers (#120)
+- fix external drag handlers not being unbound (#117, #118)
+- fix refetchResources should rerender resources in vertical view (#100)
+- fix events incorrectly rendered when clipped by minTime/maxTime (#96)
+- fix resourceRender's resource object param when resources above dates (#91)
+- fix eventOverlap:false with eventResourceField (#86)
+- fix license key warning being rendered multiple times (#75)
+- fix broken Resource Object eventClassName property
+- fix separate event instances via multiple resourceIds, wrong color assignment
+
+
+v1.2.0 (2016-01-07)
+-------------------
+
+- current time indicator (#9)
+- resourceIds, allows associating an event to multiple resources (#13)
+- pass resourceId into the drop event (#27)
+- fix for refetchEvents reseting the scroll position (#89)
+- fix for addResource/removeResource failing to rerender in vertical views (#84)
+- fix for timeline resource rows sometimes being misaligned when column grouping (#80)
+- fix for timeline events not rendering correctly when minTime specified (#78)
+- fix for erradic resource ordering in verical views when no resourceOrder specified (#74)
+- fix bug where external event dragging would not respect eventOverlap (#72)
+
+
+v1.1.0 (2015-11-30)
+-------------------
+
+- vertical resource view (#5)
+- fix event overlap not working in day/week/month view (#24)
+
+
+v1.0.2 (2015-10-18)
+-------------------
+
+- incorrect rendering of events when using slotDuration equal to one day (#49)
+- minimum jQuery is now v1.8.0 (solves #44)
+- more tests
+
+
+v1.0.1 (2015-10-13)
+-------------------
+
+- fix event rendering coordinates when timezone (#15)
+- fix event rendering in non-expanded non-rendered resource rows (#30)
+- fix accidentally caching result of resource fetching (#41)
+- fix for dragging between resources when custom eventResourceField (#18)
+- fix scroll jumping bug (#25)
+- relax bower's ignore (#21)
+
+
+v1.0.0 (2015-08-17)
+-------------------
+
+Issues resolved since v1.0.0-beta:
+[2523], [2533], [2534], [2562]
+
+[2523]: https://code.google.com/p/fullcalendar/issues/detail?id=2523
+[2533]: https://code.google.com/p/fullcalendar/issues/detail?id=2533
+[2534]: https://code.google.com/p/fullcalendar/issues/detail?id=2534
+[2562]: https://code.google.com/p/fullcalendar/issues/detail?id=2562
diff --git a/smash/web/static/fullcalendar-scheduler/CONTRIBUTING.txt b/smash/web/static/fullcalendar-scheduler/CONTRIBUTING.txt
new file mode 100644
index 0000000000000000000000000000000000000000..803f63747733b5efb67db61c867a1533ae8c1742
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/CONTRIBUTING.txt
@@ -0,0 +1,34 @@
+
+## Reporting Bugs
+
+Each bug report MUST have a [JSFiddle/JSBin] recreation before any work can begin. [further instructions &raquo;](http://fullcalendar.io/wiki/Reporting-Bugs/)
+
+
+## Requesting Features
+
+Please search the [Issue Tracker] to see if your feature has already been requested, and if so, subscribe to it. Otherwise, read these [further instructions &raquo;](http://fullcalendar.io/wiki/Requesting-Features/)
+
+
+## Contributing Features
+
+Each new feature should be designed as robustly as possible and be useful beyond the immediate usecase it was initially designed for. Feel free to start a ticket discussing the feature's specs before coding.
+
+
+## Contributing Bugfixes
+
+In the description of your [Pull Request][Using Pull Requests], please include recreation steps for the bug as well as a [JSFiddle/JSBin] demo. Communicating the buggy behavior is a requirement before a merge can happen.
+
+
+## Other Ways to Contribute
+
+[Read about other ways to contribute &raquo;](http://fullcalendar.io/wiki/Contributing/)
+
+
+## What to edit
+
+When modifying files, please do not edit the generated or minified files in the `dist/` directory. Please edit the original `src/` files.
+
+
+[JSFiddle/JSBin]: http://fullcalendar.io/wiki/Reporting-Bugs/
+[Issue Tracker]: https://github.com/fullcalendar/fullcalendar-scheduler/issues
+[Using Pull Requests]: https://help.github.com/articles/using-pull-requests/
diff --git a/smash/web/static/fullcalendar-scheduler/LICENSE.txt b/smash/web/static/fullcalendar-scheduler/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..77009030f13b6bd45bfd16ad3443490cdebeda2d
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/LICENSE.txt
@@ -0,0 +1,18 @@
+
+For complete licensing information, visit:
+http://fullcalendar.io/scheduler/license/
+
+FullCalendar Scheduler is tri-licensed, meaning you must choose
+one of three licenses to use. Here is a summary of those licenses:
+
+- Commercial License
+  (a paid license, meant for commercial use)
+  http://fullcalendar.io/scheduler/license-details/
+
+- Creative Commons Non-Commercial No-Derivatives
+  (meant for trial and non-commercial use)
+  https://creativecommons.org/licenses/by-nc-nd/4.0/
+
+- GPLv3 License
+  (meant for open-source projects)
+  http://www.gnu.org/licenses/gpl-3.0.en.html
diff --git a/smash/web/static/fullcalendar-scheduler/demos/background-events.html b/smash/web/static/fullcalendar-scheduler/demos/background-events.html
new file mode 100644
index 0000000000000000000000000000000000000000..31f3b6cd04e02251524170622bd6a5ffe1924ce8
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/background-events.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true, // enable draggable events
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+
+				// background event, associated with a resource
+				{ id: 'bg1', resourceId: 'b', rendering: 'background', start: '2017-05-07T01:00:00', end: '2017-05-07T04:00:00' },
+
+				// background event, NOT associated with a resource
+				{ id: 'bg2', rendering: 'background', start: '2017-05-07T05:00:00', end: '2017-05-07T08:00:00' },
+
+				// normal events...
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/column-grouping.html b/smash/web/static/fullcalendar-scheduler/demos/column-grouping.html
new file mode 100644
index 0000000000000000000000000000000000000000..160c60043b442dfa68302130f4fdfb5a97d46bab
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/column-grouping.html
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceAreaWidth: '40%',
+			resourceColumns: [
+				{
+					group: true,
+					labelText: 'Building',
+					field: 'building'
+				},
+				{
+					labelText: 'Room',
+					field: 'title'
+				},
+				{
+					labelText: 'Occupancy',
+					field: 'occupancy'
+				}
+			],
+			resources: [
+				{ id: 'a', building: '460 Bryant', title: 'Auditorium A', occupancy: 40 },
+				{ id: 'b', building: '460 Bryant', title: 'Auditorium B', occupancy: 40, eventColor: 'green' },
+				{ id: 'c', building: '460 Bryant', title: 'Auditorium C', occupancy: 40, eventColor: 'orange' },
+				{ id: 'd', building: '460 Bryant', title: 'Auditorium D', occupancy: 40, children: [
+					{ id: 'd1', title: 'Room D1', occupancy: 10 },
+					{ id: 'd2', title: 'Room D2', occupancy: 10 }
+				] },
+				{ id: 'e', building: '460 Bryant', title: 'Auditorium E', occupancy: 40 },
+				{ id: 'f', building: '460 Bryant', title: 'Auditorium F', occupancy: 40, eventColor: 'red' },
+				{ id: 'g', building: '564 Pacific', title: 'Auditorium G', occupancy: 40 },
+				{ id: 'h', building: '564 Pacific', title: 'Auditorium H', occupancy: 40 },
+				{ id: 'i', building: '564 Pacific', title: 'Auditorium I', occupancy: 40 },
+				{ id: 'j', building: '564 Pacific', title: 'Auditorium J', occupancy: 40 },
+				{ id: 'k', building: '564 Pacific', title: 'Auditorium K', occupancy: 40 },
+				{ id: 'l', building: '564 Pacific', title: 'Auditorium L', occupancy: 40 },
+				{ id: 'm', building: '564 Pacific', title: 'Auditorium M', occupancy: 40 },
+				{ id: 'n', building: '564 Pacific', title: 'Auditorium N', occupancy: 40 },
+				{ id: 'o', building: '564 Pacific', title: 'Auditorium O', occupancy: 40 },
+				{ id: 'p', building: '564 Pacific', title: 'Auditorium P', occupancy: 40 },
+				{ id: 'q', building: '564 Pacific', title: 'Auditorium Q', occupancy: 40 },
+				{ id: 'r', building: '564 Pacific', title: 'Auditorium R', occupancy: 40 },
+				{ id: 's', building: '564 Pacific', title: 'Auditorium S', occupancy: 40 },
+				{ id: 't', building: '564 Pacific', title: 'Auditorium T', occupancy: 40 },
+				{ id: 'u', building: '564 Pacific', title: 'Auditorium U', occupancy: 40 },
+				{ id: 'v', building: '564 Pacific', title: 'Auditorium V', occupancy: 40 },
+				{ id: 'w', building: '564 Pacific', title: 'Auditorium W', occupancy: 40 },
+				{ id: 'x', building: '564 Pacific', title: 'Auditorium X', occupancy: 40 },
+				{ id: 'y', building: '564 Pacific', title: 'Auditorium Y', occupancy: 40 },
+				{ id: 'z', building: '564 Pacific', title: 'Auditorium Z', occupancy: 40 }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/columns.html b/smash/web/static/fullcalendar-scheduler/demos/columns.html
new file mode 100644
index 0000000000000000000000000000000000000000..410372c4d7f7caf2f77cac76c752ed3d71e84209
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/columns.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceAreaWidth: '30%',
+			resourceColumns: [
+				{
+					labelText: 'Room',
+					field: 'title'
+				},
+				{
+					labelText: 'Occupancy',
+					field: 'occupancy'
+				}
+			],
+			resources: [
+				{ id: 'a', title: 'Auditorium A', occupancy: 40 },
+				{ id: 'b', title: 'Auditorium B', occupancy: 40, eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', occupancy: 40, eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', occupancy: 40, children: [
+					{ id: 'd1', title: 'Room D1', occupancy: 10 },
+					{ id: 'd2', title: 'Room D2', occupancy: 10 }
+				] },
+				{ id: 'e', title: 'Auditorium E', occupancy: 40 },
+				{ id: 'f', title: 'Auditorium F', occupancy: 40, eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G', occupancy: 40 },
+				{ id: 'h', title: 'Auditorium H', occupancy: 40 },
+				{ id: 'i', title: 'Auditorium I', occupancy: 40 },
+				{ id: 'j', title: 'Auditorium J', occupancy: 40 },
+				{ id: 'k', title: 'Auditorium K', occupancy: 40 },
+				{ id: 'l', title: 'Auditorium L', occupancy: 40 },
+				{ id: 'm', title: 'Auditorium M', occupancy: 40 },
+				{ id: 'n', title: 'Auditorium N', occupancy: 40 },
+				{ id: 'o', title: 'Auditorium O', occupancy: 40 },
+				{ id: 'p', title: 'Auditorium P', occupancy: 40 },
+				{ id: 'q', title: 'Auditorium Q', occupancy: 40 },
+				{ id: 'r', title: 'Auditorium R', occupancy: 40 },
+				{ id: 's', title: 'Auditorium S', occupancy: 40 },
+				{ id: 't', title: 'Auditorium T', occupancy: 40 },
+				{ id: 'u', title: 'Auditorium U', occupancy: 40 },
+				{ id: 'v', title: 'Auditorium V', occupancy: 40 },
+				{ id: 'w', title: 'Auditorium W', occupancy: 40 },
+				{ id: 'x', title: 'Auditorium X', occupancy: 40 },
+				{ id: 'y', title: 'Auditorium Y', occupancy: 40 },
+				{ id: 'z', title: 'Auditorium Z', occupancy: 40 }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/dynamic-add-remove.html b/smash/web/static/fullcalendar-scheduler/demos/dynamic-add-remove.html
new file mode 100644
index 0000000000000000000000000000000000000000..abe1cd58b20eae21ecf8201e757e2458cbe529d1
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/dynamic-add-remove.html
@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'promptResource today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			customButtons: {
+				promptResource: {
+					text: '+ room',
+					click: function() {
+						var title = prompt('Room name');
+						if (title) {
+							$('#calendar').fullCalendar(
+								'addResource',
+								{ title: title },
+								true // scroll to the new resource?
+							);
+						}
+					}
+				}
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceLabelText: 'Rooms',
+			resourceRender: function(resource, cellEls) {
+				cellEls.on('click', function() {
+					if (confirm('Are you sure you want to delete ' + resource.title + '?')) {
+						$('#calendar').fullCalendar('removeResource', resource);
+					}
+				});
+			},
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	p {
+		text-align: center;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+	.fc-resource-area td {
+		cursor: pointer;
+	}
+
+</style>
+</head>
+<body>
+
+	<p>
+		HINT: click on a resource to delete it.
+	</p>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/external-dragging.html b/smash/web/static/fullcalendar-scheduler/demos/external-dragging.html
new file mode 100644
index 0000000000000000000000000000000000000000..f5ddcbbee94ca291ebf36d33b98a5c1b81d4ab8c
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/external-dragging.html
@@ -0,0 +1,193 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/jquery-ui.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+
+		/* initialize the external events
+		-----------------------------------------------------------------*/
+
+		$('#external-events .fc-event').each(function() {
+
+			// store data so the calendar knows to render an event upon drop
+			$(this).data('event', {
+				title: $.trim($(this).text()), // use the element's text as the event title
+				stick: true // maintain when user navigates (see docs on the renderEvent method)
+			});
+
+			// make the event draggable using jQuery UI
+			$(this).draggable({
+				zIndex: 999,
+				revert: true,      // will cause the event to go back to its
+				revertDuration: 0  //  original position after the drag
+			});
+
+		});
+
+
+		/* initialize the calendar
+		-----------------------------------------------------------------*/
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true, // enable draggable events
+			droppable: true, // this allows things to be dropped onto the calendar
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			],
+			drop: function(date, jsEvent, ui, resourceId) {
+				console.log('drop', date.format(), resourceId);
+
+				// is the "remove after drop" checkbox checked?
+				if ($('#drop-remove').is(':checked')) {
+					// if so, remove the element from the "Draggable Events" list
+					$(this).remove();
+				}
+			},
+			eventReceive: function(event) { // called when a proper external event is dropped
+				console.log('eventReceive', event);
+			},
+			eventDrop: function(event) { // called when an event (already on the calendar) is moved
+				console.log('eventDrop', event);
+			}
+		});
+
+	});
+
+</script>
+<style>
+
+	body {
+		margin-top: 40px;
+		text-align: center;
+		font-size: 14px;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+	}
+		
+	#wrap {
+		width: 1100px;
+		margin: 0 auto;
+	}
+		
+	#external-events {
+		float: left;
+		width: 150px;
+		padding: 0 10px;
+		border: 1px solid #ccc;
+		background: #eee;
+		text-align: left;
+	}
+		
+	#external-events h4 {
+		font-size: 16px;
+		margin-top: 0;
+		padding-top: 1em;
+	}
+		
+	#external-events .fc-event {
+		margin: 10px 0;
+		cursor: pointer;
+	}
+		
+	#external-events p {
+		margin: 1.5em 0;
+		font-size: 11px;
+		color: #666;
+	}
+		
+	#external-events p input {
+		margin: 0;
+		vertical-align: middle;
+	}
+
+	#calendar {
+		float: right;
+		width: 900px;
+	}
+
+</style>
+</head>
+<body>
+	<div id='wrap'>
+
+		<div id='external-events'>
+			<h4>Draggable Events</h4>
+			<div class='fc-event'>My Event 1</div>
+			<div class='fc-event'>My Event 2</div>
+			<div class='fc-event'>My Event 3</div>
+			<div class='fc-event'>My Event 4</div>
+			<div class='fc-event'>My Event 5</div>
+			<p>
+				<input type='checkbox' id='drop-remove' />
+				<label for='drop-remove'>remove after drop</label>
+			</p>
+		</div>
+
+		<div id='calendar'></div>
+
+		<div style='clear:both'></div>
+
+	</div>
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/gcal.html b/smash/web/static/fullcalendar-scheduler/demos/gcal.html
new file mode 100644
index 0000000000000000000000000000000000000000..a36ad20a297f7f1720ebba0380a7c9925947e522
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/gcal.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../lib/gcal.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true, // enable draggable events
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineMonth,timelineYear'
+			},
+			defaultView: 'timelineMonth',
+
+			/*
+			NOTE: unfortunately, Scheduler doesn't know how to associated events from
+			Google Calendar with resources, so if you specify a resource list,
+			nothing will show up :(  Working on some solutions.
+			*/
+
+			// THIS KEY WON'T WORK IN PRODUCTION!!!
+			// To make your own Google API key, follow the directions here:
+			// http://fullcalendar.io/docs/google_calendar/
+			googleCalendarApiKey: 'AIzaSyDcnW6WejpTOCffshGDDb4neIrXVUA1EAE',
+		
+			// US Holidays
+			events: 'usa__en@holiday.calendar.google.com',
+
+			eventClick: function(event) {
+				// opens events in a popup window
+				window.open(event.url, 'gcalevent', 'width=700,height=600');
+				return false;
+			}
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/grouping.html b/smash/web/static/fullcalendar-scheduler/demos/grouping.html
new file mode 100644
index 0000000000000000000000000000000000000000..f3a6ac162aa508096ec9fcf763b4430e6c955f7b
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/grouping.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceGroupField: 'building',
+			resources: [
+				{ id: 'a', building: '460 Bryant', title: 'Auditorium A' },
+				{ id: 'b', building: '460 Bryant', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', building: '460 Bryant', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', building: '460 Bryant', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1', occupancy: 10 },
+					{ id: 'd2', title: 'Room D2', occupancy: 10 }
+				] },
+				{ id: 'e', building: '460 Bryant', title: 'Auditorium E' },
+				{ id: 'f', building: '460 Bryant', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', building: '564 Pacific', title: 'Auditorium G' },
+				{ id: 'h', building: '564 Pacific', title: 'Auditorium H' },
+				{ id: 'i', building: '564 Pacific', title: 'Auditorium I' },
+				{ id: 'j', building: '564 Pacific', title: 'Auditorium J' },
+				{ id: 'k', building: '564 Pacific', title: 'Auditorium K' },
+				{ id: 'l', building: '564 Pacific', title: 'Auditorium L' },
+				{ id: 'm', building: '564 Pacific', title: 'Auditorium M' },
+				{ id: 'n', building: '564 Pacific', title: 'Auditorium N' },
+				{ id: 'o', building: '564 Pacific', title: 'Auditorium O' },
+				{ id: 'p', building: '564 Pacific', title: 'Auditorium P' },
+				{ id: 'q', building: '564 Pacific', title: 'Auditorium Q' },
+				{ id: 'r', building: '564 Pacific', title: 'Auditorium R' },
+				{ id: 's', building: '564 Pacific', title: 'Auditorium S' },
+				{ id: 't', building: '564 Pacific', title: 'Auditorium T' },
+				{ id: 'u', building: '564 Pacific', title: 'Auditorium U' },
+				{ id: 'v', building: '564 Pacific', title: 'Auditorium V' },
+				{ id: 'w', building: '564 Pacific', title: 'Auditorium W' },
+				{ id: 'x', building: '564 Pacific', title: 'Auditorium X' },
+				{ id: 'y', building: '564 Pacific', title: 'Auditorium Y' },
+				{ id: 'z', building: '564 Pacific', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/json.html b/smash/web/static/fullcalendar-scheduler/demos/json.html
new file mode 100644
index 0000000000000000000000000000000000000000..0574df01425ba92067f35c69b26b4c5d7df1e953
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/json.html
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true, // enable draggable events
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceLabelText: 'Rooms',
+
+			resources: { // you can also specify a plain string like 'json/resources.json'
+				url: 'json/resources.json',
+				error: function() {
+					$('#script-warning').show();
+				}
+			},
+
+			events: { // you can also specify a plain string like 'json/events.json'
+				url: 'json/events.json',
+				error: function() {
+					$('#script-warning').show();
+				}
+			}
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#script-warning {
+		display: none;
+		background: #eee;
+		border-bottom: 1px solid #ddd;
+		padding: 0 10px;
+		line-height: 40px;
+		text-align: center;
+		font-weight: bold;
+		font-size: 12px;
+		color: red;
+	}
+
+	#loading {
+		display: none;
+		position: absolute;
+		top: 10px;
+		right: 10px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='script-warning'>
+		This page should be running from a webserver, to allow fetching from the <code>json/</code> directory.
+	</div>
+
+	<div id='loading'>loading...</div>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/json/events.json b/smash/web/static/fullcalendar-scheduler/demos/json/events.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c238b48cc5b74bc3fad2346234aa3dece8fdedd
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/json/events.json
@@ -0,0 +1,7 @@
+[
+	{ "id": "1", "resourceId": "b", "start": "2017-05-07T02:00:00", "end": "2017-05-07T07:00:00", "title": "event 1" },
+	{ "id": "2", "resourceId": "c", "start": "2017-05-07T05:00:00", "end": "2017-05-07T22:00:00", "title": "event 2" },
+	{ "id": "3", "resourceId": "d", "start": "2017-05-06", "end": "2017-05-08", "title": "event 3" },
+	{ "id": "4", "resourceId": "e", "start": "2017-05-07T03:00:00", "end": "2017-05-07T08:00:00", "title": "event 4" },
+	{ "id": "5", "resourceId": "f", "start": "2017-05-07T00:30:00", "end": "2017-05-07T02:30:00", "title": "event 5" }
+]
diff --git a/smash/web/static/fullcalendar-scheduler/demos/json/resources.json b/smash/web/static/fullcalendar-scheduler/demos/json/resources.json
new file mode 100644
index 0000000000000000000000000000000000000000..f4b922dbd3018e45789788e0ca680cc53876aaee
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/json/resources.json
@@ -0,0 +1,31 @@
+[
+	{ "id": "a", "title": "Auditorium A" },
+	{ "id": "b", "title": "Auditorium B", "eventColor": "green" },
+	{ "id": "c", "title": "Auditorium C", "eventColor": "orange" },
+	{ "id": "d", "title": "Auditorium D", "children": [
+		{ "id": "d1", "title": "Room D1" },
+		{ "id": "d2", "title": "Room D2" }
+	] },
+	{ "id": "e", "title": "Auditorium E" },
+	{ "id": "f", "title": "Auditorium F", "eventColor": "red" },
+	{ "id": "g", "title": "Auditorium G" },
+	{ "id": "h", "title": "Auditorium H" },
+	{ "id": "i", "title": "Auditorium I" },
+	{ "id": "j", "title": "Auditorium J" },
+	{ "id": "k", "title": "Auditorium K" },
+	{ "id": "l", "title": "Auditorium L" },
+	{ "id": "m", "title": "Auditorium M" },
+	{ "id": "n", "title": "Auditorium N" },
+	{ "id": "o", "title": "Auditorium O" },
+	{ "id": "p", "title": "Auditorium P" },
+	{ "id": "q", "title": "Auditorium Q" },
+	{ "id": "r", "title": "Auditorium R" },
+	{ "id": "s", "title": "Auditorium S" },
+	{ "id": "t", "title": "Auditorium T" },
+	{ "id": "u", "title": "Auditorium U" },
+	{ "id": "v", "title": "Auditorium V" },
+	{ "id": "w", "title": "Auditorium W" },
+	{ "id": "x", "title": "Auditorium X" },
+	{ "id": "y", "title": "Auditorium Y" },
+	{ "id": "z", "title": "Auditorium Z" }
+]
diff --git a/smash/web/static/fullcalendar-scheduler/demos/misc-callbacks.html b/smash/web/static/fullcalendar-scheduler/demos/misc-callbacks.html
new file mode 100644
index 0000000000000000000000000000000000000000..613bc382ebf94526e3b6edc6cc19e1bf66fb373e
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/misc-callbacks.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+
+			// the point if this demo is to demonstrate dayClick...
+			dayClick: function(date, jsEvent, view, resourceObj) {
+				console.log('dayClick', date.format(), resourceObj);
+			},
+
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	p {
+		text-align: center;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/no-overlap.html b/smash/web/static/fullcalendar-scheduler/demos/no-overlap.html
new file mode 100644
index 0000000000000000000000000000000000000000..711e97b5aac8d70473214e736c2f5fa24d493293
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/no-overlap.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			eventOverlap: false, // will cause the event to take up entire resource height
+			resourceAreaWidth: '25%',
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	p {
+		text-align: center;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<p>
+		Things render a bit differently with <code>eventOverlap:false</code>
+	</p>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/ordering.html b/smash/web/static/fullcalendar-scheduler/demos/ordering.html
new file mode 100644
index 0000000000000000000000000000000000000000..75f13b69f7b7266ec1d9f366b7199e0421f3cb56
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/ordering.html
@@ -0,0 +1,112 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceAreaWidth: '30%',
+			resourceColumns: [
+				{
+					labelText: 'Room',
+					field: 'title'
+				},
+				{
+					labelText: 'Occupancy',
+					field: 'occupancy'
+				}
+			],
+			resourceOrder: '-occupancy,title', // when occupancy tied, order by title
+			resources: [
+				{ id: 'a', title: 'Auditorium A', occupancy: 40 },
+				{ id: 'b', title: 'Auditorium B', occupancy: 40, eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', occupancy: 40, eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', occupancy: 40 },
+				{ id: 'e', title: 'Auditorium E', occupancy: 40 },
+				{ id: 'f', title: 'Auditorium F', occupancy: 40, eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G', occupancy: 40 },
+				{ id: 'h', title: 'Auditorium H', occupancy: 40 },
+				{ id: 'i', title: 'Auditorium I', occupancy: 50 },
+				{ id: 'j', title: 'Auditorium J', occupancy: 50 },
+				{ id: 'k', title: 'Auditorium K', occupancy: 40 },
+				{ id: 'l', title: 'Auditorium L', occupancy: 40 },
+				{ id: 'm', title: 'Auditorium M', occupancy: 40 },
+				{ id: 'n', title: 'Auditorium N', occupancy: 80 },
+				{ id: 'o', title: 'Auditorium O', occupancy: 80 },
+				{ id: 'p', title: 'Auditorium P', occupancy: 40 },
+				{ id: 'q', title: 'Auditorium Q', occupancy: 40 },
+				{ id: 'r', title: 'Auditorium R', occupancy: 40 },
+				{ id: 's', title: 'Auditorium S', occupancy: 40 },
+				{ id: 't', title: 'Auditorium T', occupancy: 40 },
+				{ id: 'u', title: 'Auditorium U', occupancy: 40 },
+				{ id: 'v', title: 'Auditorium V', occupancy: 40 },
+				{ id: 'w', title: 'Auditorium W', occupancy: 40 },
+				{ id: 'x', title: 'Auditorium X', occupancy: 40 },
+				{ id: 'y', title: 'Auditorium Y', occupancy: 40 },
+				{ id: 'z', title: 'Auditorium Z', occupancy: 40 }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	p {
+		text-align: center;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<p>Ordered by occupancy (descending)</p>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/rendering-hooks.html b/smash/web/static/fullcalendar-scheduler/demos/rendering-hooks.html
new file mode 100644
index 0000000000000000000000000000000000000000..4832ba2fd124db97e74ab21e32b493ff047f532a
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/rendering-hooks.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true, // enable draggable events
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceLabelText: 'Rooms',
+			resourceText: function(resource) {
+				return 'Auditorium ' + ('' + resource.id).toUpperCase();
+			},
+			resourceRender: function(resource, leftCells, rightCells) {
+				if (resource.id == 'h') {
+					leftCells.css('background-color', 'rgb(255, 243, 206)');
+					rightCells.css('background-color', 'rgba(255, 243, 206, .5)');
+				}
+			},
+			resources: [
+				{ id: 'a' },
+				{ id: 'b', eventColor: 'green' },
+				{ id: 'c', eventColor: 'orange' },
+				{ id: 'd' },
+				{ id: 'e' },
+				{ id: 'f', eventColor: 'red' },
+				{ id: 'g' },
+				{ id: 'h' },
+				{ id: 'i' },
+				{ id: 'j' },
+				{ id: 'k' },
+				{ id: 'l' },
+				{ id: 'm' },
+				{ id: 'n' },
+				{ id: 'o' },
+				{ id: 'p' },
+				{ id: 'q' },
+				{ id: 'r' },
+				{ id: 's' },
+				{ id: 't' },
+				{ id: 'u' },
+				{ id: 'v' },
+				{ id: 'w' },
+				{ id: 'x' },
+				{ id: 'y' },
+				{ id: 'z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/scale.html b/smash/web/static/fullcalendar-scheduler/demos/scale.html
new file mode 100644
index 0000000000000000000000000000000000000000..9c3310d1f9d60e8efc1850700f5080c6cfee7537
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/scale.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true,
+			aspectRatio: 1.8,
+			scrollTime: '00:00',
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineTenDay,timelineMonth,timelineYear'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineDay: {
+					buttonText: ':15 slots',
+					slotDuration: '00:15'
+				},
+				timelineTenDay: {
+					type: 'timeline',
+					duration: { days: 10 }
+				}
+			},
+			navLinks: true,
+			resourceAreaWidth: '25%',
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/selectable.html b/smash/web/static/fullcalendar-scheduler/demos/selectable.html
new file mode 100644
index 0000000000000000000000000000000000000000..71f42193d517e09cc4672cd119dbd2531a4e9b96
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/selectable.html
@@ -0,0 +1,128 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			selectable: true,
+			selectHelper: true,
+			editable: true, // enable draggable events
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			],
+			select: function(start, end, jsEvent, view, resource) {
+				console.log(
+					'select callback',
+					start.format(),
+					end.format(),
+					resource ? resource.id : '(no resource)'
+				);
+			},
+			dayClick: function(date, jsEvent, view, resource) {
+				console.log(
+					'dayClick',
+					date.format(),
+					resource ? resource.id : '(no resource)'
+				);
+			}
+		});
+
+		$('#select-G').on('click', function() {
+			$('#calendar').fullCalendar('select', '2017-05-07T02:00:00', '2017-05-07T07:00:00', 'g');
+		});
+
+		$('#select-unspecified').on('click', function() {
+			$('#calendar').fullCalendar('select', '2017-05-07T02:00:00', '2017-05-07T07:00:00');
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+	<p style='text-align:center'>
+		<button id='select-G'>select G</button>
+		<button id='select-unspecified'>select w/o a resource</button>
+	</p>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/simple.html b/smash/web/static/fullcalendar-scheduler/demos/simple.html
new file mode 100644
index 0000000000000000000000000000000000000000..fc81e99553e00fa537244ede95df6820697d7ef4
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/simple.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			now: '2017-05-07',
+			editable: true, // enable draggable events
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month,listWeek'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/theme.html b/smash/web/static/fullcalendar-scheduler/demos/theme.html
new file mode 100644
index 0000000000000000000000000000000000000000..63c40b5899d9d4288f5932c612720084a9974919
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/theme.html
@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/cupertino/jquery-ui.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			theme: true,
+			now: '2017-05-07',
+			editable: true, // enable draggable events
+			aspectRatio: 1.8,
+			scrollTime: '00:00', // undo default 6am scrollTime
+			header: {
+				left: 'today prev,next',
+				center: 'title',
+				right: 'timelineDay,timelineThreeDays,agendaWeek,month,listWeek'
+			},
+			defaultView: 'timelineDay',
+			views: {
+				timelineThreeDays: {
+					type: 'timeline',
+					duration: { days: 3 }
+				}
+			},
+			navLinks: true,
+			resourceLabelText: 'Rooms',
+			resources: [
+				{ id: 'a', title: 'Auditorium A' },
+				{ id: 'b', title: 'Auditorium B', eventColor: 'green' },
+				{ id: 'c', title: 'Auditorium C', eventColor: 'orange' },
+				{ id: 'd', title: 'Auditorium D', children: [
+					{ id: 'd1', title: 'Room D1' },
+					{ id: 'd2', title: 'Room D2' }
+				] },
+				{ id: 'e', title: 'Auditorium E' },
+				{ id: 'f', title: 'Auditorium F', eventColor: 'red' },
+				{ id: 'g', title: 'Auditorium G' },
+				{ id: 'h', title: 'Auditorium H' },
+				{ id: 'i', title: 'Auditorium I' },
+				{ id: 'j', title: 'Auditorium J' },
+				{ id: 'k', title: 'Auditorium K' },
+				{ id: 'l', title: 'Auditorium L' },
+				{ id: 'm', title: 'Auditorium M' },
+				{ id: 'n', title: 'Auditorium N' },
+				{ id: 'o', title: 'Auditorium O' },
+				{ id: 'p', title: 'Auditorium P' },
+				{ id: 'q', title: 'Auditorium Q' },
+				{ id: 'r', title: 'Auditorium R' },
+				{ id: 's', title: 'Auditorium S' },
+				{ id: 't', title: 'Auditorium T' },
+				{ id: 'u', title: 'Auditorium U' },
+				{ id: 'v', title: 'Auditorium V' },
+				{ id: 'w', title: 'Auditorium W' },
+				{ id: 'x', title: 'Auditorium X' },
+				{ id: 'y', title: 'Auditorium Y' },
+				{ id: 'z', title: 'Auditorium Z' }
+			],
+			events: [
+				{ id: '1', resourceId: 'b', start: '2017-05-07T02:00:00', end: '2017-05-07T07:00:00', title: 'event 1' },
+				{ id: '2', resourceId: 'c', start: '2017-05-07T05:00:00', end: '2017-05-07T22:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'd', start: '2017-05-06', end: '2017-05-08', title: 'event 3' },
+				{ id: '4', resourceId: 'e', start: '2017-05-07T03:00:00', end: '2017-05-07T08:00:00', title: 'event 4' },
+				{ id: '5', resourceId: 'f', start: '2017-05-07T00:30:00', end: '2017-05-07T02:30:00', title: 'event 5' }
+			]
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/demos/vertical-resource-view.html b/smash/web/static/fullcalendar-scheduler/demos/vertical-resource-view.html
new file mode 100644
index 0000000000000000000000000000000000000000..3b88bec10faaf3ec33819d24bf32821a2ed9e6ca
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/demos/vertical-resource-view.html
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset='utf-8' />
+<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
+<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
+<link href='../scheduler.min.css' rel='stylesheet' />
+<script src='../lib/moment.min.js'></script>
+<script src='../lib/jquery.min.js'></script>
+<script src='../lib/fullcalendar.min.js'></script>
+<script src='../scheduler.min.js'></script>
+<script>
+
+	$(function() { // document ready
+
+		$('#calendar').fullCalendar({
+			defaultView: 'agendaDay',
+			defaultDate: '2017-05-07',
+			editable: true,
+			selectable: true,
+			eventLimit: true, // allow "more" link when too many events
+			header: {
+				left: 'prev,next today',
+				center: 'title',
+				right: 'agendaDay,agendaTwoDay,agendaWeek,month'
+			},
+			views: {
+				agendaTwoDay: {
+					type: 'agenda',
+					duration: { days: 2 },
+
+					// views that are more than a day will NOT do this behavior by default
+					// so, we need to explicitly enable it
+					groupByResource: true
+
+					//// uncomment this line to group by day FIRST with resources underneath
+					//groupByDateAndResource: true
+				}
+			},
+
+			//// uncomment this line to hide the all-day slot
+			//allDaySlot: false,
+
+			resources: [
+				{ id: 'a', title: 'Room A' },
+				{ id: 'b', title: 'Room B', eventColor: 'green' },
+				{ id: 'c', title: 'Room C', eventColor: 'orange' },
+				{ id: 'd', title: 'Room D', eventColor: 'red' }
+			],
+			events: [
+				{ id: '1', resourceId: 'a', start: '2017-05-06', end: '2017-05-08', title: 'event 1' },
+				{ id: '2', resourceId: 'a', start: '2017-05-07T09:00:00', end: '2017-05-07T14:00:00', title: 'event 2' },
+				{ id: '3', resourceId: 'b', start: '2017-05-07T12:00:00', end: '2017-05-08T06:00:00', title: 'event 3' },
+				{ id: '4', resourceId: 'c', start: '2017-05-07T07:30:00', end: '2017-05-07T09:30:00', title: 'event 4' },
+				{ id: '5', resourceId: 'd', start: '2017-05-07T10:00:00', end: '2017-05-07T15:00:00', title: 'event 5' }
+			],
+
+			select: function(start, end, jsEvent, view, resource) {
+				console.log(
+					'select',
+					start.format(),
+					end.format(),
+					resource ? resource.id : '(no resource)'
+				);
+			},
+			dayClick: function(date, jsEvent, view, resource) {
+				console.log(
+					'dayClick',
+					date.format(),
+					resource ? resource.id : '(no resource)'
+				);
+			}
+		});
+	
+	});
+
+</script>
+<style>
+
+	body {
+		margin: 0;
+		padding: 0;
+		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
+		font-size: 14px;
+	}
+
+	#calendar {
+		max-width: 900px;
+		margin: 50px auto;
+	}
+
+</style>
+</head>
+<body>
+
+	<div id='calendar'></div>
+
+</body>
+</html>
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png
new file mode 100644
index 0000000000000000000000000000000000000000..2f3c69b520998462513ce68fadca920e0c88a595
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png
new file mode 100644
index 0000000000000000000000000000000000000000..0cef1efede6cc410bd4614d75e9916387d6324d8
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_50_3baae3_1x400.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_50_3baae3_1x400.png
new file mode 100644
index 0000000000000000000000000000000000000000..c2f2bbce8f56c988bf3adb48f4902f7a0b928aae
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_50_3baae3_1x400.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png
new file mode 100644
index 0000000000000000000000000000000000000000..1b1bd3b3ab96309550befef0abd0d13b37653469
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png
new file mode 100644
index 0000000000000000000000000000000000000000..afaf4fe33e837eeab032d65433a0beab804db8cb
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png
new file mode 100644
index 0000000000000000000000000000000000000000..4d8dfcc279f1804d6e130924ff9f29a740baadee
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png
new file mode 100644
index 0000000000000000000000000000000000000000..7758a1d76d914615e450c3965f458ba97bf0f3ea
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png
new file mode 100644
index 0000000000000000000000000000000000000000..db227a6d38204ffdfed2d754698734f1618c1efd
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_2694e8_256x240.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_2694e8_256x240.png
new file mode 100644
index 0000000000000000000000000000000000000000..8aab51b00ce0d8d415a324079a8d73379bd806a1
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_2694e8_256x240.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_2e83ff_256x240.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_2e83ff_256x240.png
new file mode 100644
index 0000000000000000000000000000000000000000..264b221358985bc548f331520991a6e7a159f812
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_2e83ff_256x240.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_3d80b3_256x240.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_3d80b3_256x240.png
new file mode 100644
index 0000000000000000000000000000000000000000..2877b23d891d9d84c881408a0360b8c4115ada03
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_3d80b3_256x240.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_72a7cf_256x240.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_72a7cf_256x240.png
new file mode 100644
index 0000000000000000000000000000000000000000..fadbb6cc0e1c764e1adcea6446b70847f740d002
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_72a7cf_256x240.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_ffffff_256x240.png b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_ffffff_256x240.png
new file mode 100644
index 0000000000000000000000000000000000000000..2cbe10f0b2b34be6b2f7ca3850fbc948ce281fa5
Binary files /dev/null and b/smash/web/static/fullcalendar-scheduler/lib/cupertino/images/ui-icons_ffffff_256x240.png differ
diff --git a/smash/web/static/fullcalendar-scheduler/lib/cupertino/jquery-ui.min.css b/smash/web/static/fullcalendar-scheduler/lib/cupertino/jquery-ui.min.css
new file mode 100644
index 0000000000000000000000000000000000000000..ef73f044ee6ac20da9942d5b1e5761b43278992b
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/cupertino/jquery-ui.min.css
@@ -0,0 +1,7 @@
+/*! jQuery UI - v1.12.1 - 2016-09-14
+* http://jqueryui.com
+* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
+* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande%2CLucida%20Sans%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=deedf7&bgTextureHeader=highlight_soft&bgImgOpacityHeader=100&borderColorHeader=aed0ea&fcHeader=222222&iconColorHeader=72a7cf&bgColorContent=f2f5f7&bgTextureContent=highlight_hard&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=362b36&iconColorContent=72a7cf&bgColorDefault=d7ebf9&bgTextureDefault=glass&bgImgOpacityDefault=80&borderColorDefault=aed0ea&fcDefault=2779aa&iconColorDefault=3d80b3&bgColorHover=e4f1fb&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=74b2e2&fcHover=0070a3&iconColorHover=2694e8&bgColorActive=3baae3&bgTextureActive=glass&bgImgOpacityActive=50&borderColorActive=2694e8&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=ffef8f&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=25&borderColorHighlight=f9dd34&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=cd0a0a&bgTextureError=flat&bgImgOpacityError=15&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=eeeeee&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=90&opacityOverlay=80&bgColorShadow=000000&bgTextureShadow=highlight_hard&bgImgOpacityShadow=70&opacityShadow=30&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px
+* Copyright jQuery Foundation and other contributors; Licensed MIT */
+
+.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Lucida Grande,Lucida Sans,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Lucida Grande,Lucida Sans,Arial,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #aed0ea}.ui-widget-content{border:1px solid #ddd;background:#f2f5f7 url("images/ui-bg_highlight-hard_100_f2f5f7_1x100.png") 50% top repeat-x;color:#362b36}.ui-widget-content a{color:#362b36}.ui-widget-header{border:1px solid #aed0ea;background:#deedf7 url("images/ui-bg_highlight-soft_100_deedf7_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #aed0ea;background:#d7ebf9 url("images/ui-bg_glass_80_d7ebf9_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#2779aa}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#2779aa;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #74b2e2;background:#e4f1fb url("images/ui-bg_glass_100_e4f1fb_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#0070a3}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#0070a3;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #2694e8;background:#3baae3 url("images/ui-bg_glass_50_3baae3_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#2694e8;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #f9dd34;background:#ffef8f url("images/ui-bg_highlight-soft_25_ffef8f_1x100.png") 50% top repeat-x;color:#363636}.ui-state-checked{border:1px solid #f9dd34;background:#ffef8f}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#cd0a0a;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_72a7cf_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_72a7cf_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_2694e8_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_2e83ff_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_3d80b3_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:6px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:6px}.ui-widget-overlay{background:#eee url("images/ui-bg_diagonals-thick_90_eeeeee_40x40.png") 50% 50% repeat;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{-webkit-box-shadow:-7px -7px 7px #000;box-shadow:-7px -7px 7px #000}
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.min.css b/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.min.css
new file mode 100644
index 0000000000000000000000000000000000000000..4eab5405e880a44825ad0af80ce7e9ff6dada853
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.min.css
@@ -0,0 +1,5 @@
+/*!
+ * FullCalendar v3.4.0 Stylesheet
+ * Docs & License: https://fullcalendar.io/
+ * (c) 2017 Adam Shaw
+ */.fc-icon,body .fc{font-size:1em}.fc-button-group,.fc-icon{display:inline-block}.fc-bg,.fc-row .fc-bgevent-skeleton,.fc-row .fc-highlight-skeleton{bottom:0}.fc-icon,.fc-unselectable{-khtml-user-select:none;-webkit-touch-callout:none}.fc{direction:ltr;text-align:left}.fc-rtl{text-align:right}.fc th,.fc-basic-view td.fc-week-number,.fc-icon,.fc-toolbar{text-align:center}.fc-unthemed .fc-content,.fc-unthemed .fc-divider,.fc-unthemed .fc-list-heading td,.fc-unthemed .fc-list-view,.fc-unthemed .fc-popover,.fc-unthemed .fc-row,.fc-unthemed tbody,.fc-unthemed td,.fc-unthemed th,.fc-unthemed thead{border-color:#ddd}.fc-unthemed .fc-popover{background-color:#fff}.fc-unthemed .fc-divider,.fc-unthemed .fc-list-heading td,.fc-unthemed .fc-popover .fc-header{background:#eee}.fc-unthemed .fc-popover .fc-header .fc-close{color:#666}.fc-unthemed td.fc-today{background:#fcf8e3}.fc-highlight{background:#bce8f1;opacity:.3}.fc-bgevent{background:#8fdf82;opacity:.3}.fc-nonbusiness{background:#d7d7d7}.fc-unthemed .fc-disabled-day{background:#d7d7d7;opacity:.3}.ui-widget .fc-disabled-day{background-image:none}.fc-icon{height:1em;line-height:1em;overflow:hidden;font-family:"Courier New",Courier,monospace;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fc-icon:after{position:relative}.fc-icon-left-single-arrow:after{content:"\02039";font-weight:700;font-size:200%;top:-7%}.fc-icon-right-single-arrow:after{content:"\0203A";font-weight:700;font-size:200%;top:-7%}.fc-icon-left-double-arrow:after{content:"\000AB";font-size:160%;top:-7%}.fc-icon-right-double-arrow:after{content:"\000BB";font-size:160%;top:-7%}.fc-icon-left-triangle:after{content:"\25C4";font-size:125%;top:3%}.fc-icon-right-triangle:after{content:"\25BA";font-size:125%;top:3%}.fc-icon-down-triangle:after{content:"\25BC";font-size:125%;top:2%}.fc-icon-x:after{content:"\000D7";font-size:200%;top:6%}.fc button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;height:2.1em;padding:0 .6em;font-size:1em;white-space:nowrap;cursor:pointer}.fc button::-moz-focus-inner{margin:0;padding:0}.fc-state-default{border:1px solid;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.fc-state-default.fc-corner-left{border-top-left-radius:4px;border-bottom-left-radius:4px}.fc-state-default.fc-corner-right{border-top-right-radius:4px;border-bottom-right-radius:4px}.fc button .fc-icon{position:relative;top:-.05em;margin:0 .2em;vertical-align:middle}.fc-state-active,.fc-state-disabled,.fc-state-down,.fc-state-hover{color:#333;background-color:#e6e6e6}.fc-state-hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.fc-state-active,.fc-state-down{background-color:#ccc;background-image:none;box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.fc-state-disabled{cursor:default;background-image:none;opacity:.65;box-shadow:none}.fc-event.fc-draggable,.fc-event[href],.fc-popover .fc-header .fc-close,a[data-goto]{cursor:pointer}.fc .fc-button-group>*{float:left;margin:0 0 0 -1px}.fc .fc-button-group>:first-child{margin-left:0}.fc-popover{position:absolute;box-shadow:0 2px 6px rgba(0,0,0,.15)}.fc-popover .fc-header{padding:2px 4px}.fc-popover .fc-header .fc-title{margin:0 2px}.fc-ltr .fc-popover .fc-header .fc-title,.fc-rtl .fc-popover .fc-header .fc-close{float:left}.fc-ltr .fc-popover .fc-header .fc-close,.fc-rtl .fc-popover .fc-header .fc-title{float:right}.fc-unthemed .fc-popover{border-width:1px;border-style:solid}.fc-unthemed .fc-popover .fc-header .fc-close{font-size:.9em;margin-top:2px}.fc-popover>.ui-widget-header+.ui-widget-content{border-top:0}.fc-divider{border-style:solid;border-width:1px}hr.fc-divider{height:0;margin:0;padding:0 0 2px;border-width:1px 0}.fc-bg table,.fc-row .fc-bgevent-skeleton table,.fc-row .fc-highlight-skeleton table{height:100%}.fc-clear{clear:both}.fc-bg,.fc-bgevent-skeleton,.fc-helper-skeleton,.fc-highlight-skeleton{position:absolute;top:0;left:0;right:0}.fc table{width:100%;box-sizing:border-box;table-layout:fixed;border-collapse:collapse;border-spacing:0;font-size:1em}.fc td,.fc th{border-style:solid;border-width:1px;padding:0;vertical-align:top}.fc td.fc-today{border-style:double}a[data-goto]:hover{text-decoration:underline}.fc .fc-row{border-style:solid;border-width:0}.fc-row table{border-left:0 hidden transparent;border-right:0 hidden transparent;border-bottom:0 hidden transparent}.fc-row:first-child table{border-top:0 hidden transparent}.fc-row{position:relative}.fc-row .fc-bg{z-index:1}.fc-row .fc-bgevent-skeleton td,.fc-row .fc-highlight-skeleton td{border-color:transparent}.fc-row .fc-bgevent-skeleton{z-index:2}.fc-row .fc-highlight-skeleton{z-index:3}.fc-row .fc-content-skeleton{position:relative;z-index:4;padding-bottom:2px}.fc-row .fc-helper-skeleton{z-index:5}.fc-row .fc-content-skeleton td,.fc-row .fc-helper-skeleton td{background:0 0;border-color:transparent;border-bottom:0}.fc-row .fc-content-skeleton tbody td,.fc-row .fc-helper-skeleton tbody td{border-top:0}.fc-scroller{-webkit-overflow-scrolling:touch}.fc-row.fc-rigid,.fc-time-grid-event{overflow:hidden}.fc-scroller>.fc-day-grid,.fc-scroller>.fc-time-grid{position:relative;width:100%}.fc-event{position:relative;display:block;font-size:.85em;line-height:1.3;border-radius:3px;border:1px solid #3a87ad;font-weight:400}.fc-event,.fc-event-dot{background-color:#3a87ad}.fc-event,.fc-event:hover,.ui-widget .fc-event{color:#fff;text-decoration:none}.fc-not-allowed,.fc-not-allowed .fc-event{cursor:not-allowed}.fc-event .fc-bg{z-index:1;background:#fff;opacity:.25}.fc-event .fc-content{position:relative;z-index:2}.fc-event .fc-resizer{position:absolute;z-index:4;display:none}.fc-event.fc-allow-mouse-resize .fc-resizer,.fc-event.fc-selected .fc-resizer{display:block}.fc-event.fc-selected .fc-resizer:before{content:"";position:absolute;z-index:9999;top:50%;left:50%;width:40px;height:40px;margin-left:-20px;margin-top:-20px}.fc-event.fc-selected{z-index:9999!important;box-shadow:0 2px 5px rgba(0,0,0,.2)}.fc-event.fc-selected.fc-dragging{box-shadow:0 2px 7px rgba(0,0,0,.3)}.fc-h-event.fc-selected:before{content:"";position:absolute;z-index:3;top:-10px;bottom:-10px;left:0;right:0}.fc-ltr .fc-h-event.fc-not-start,.fc-rtl .fc-h-event.fc-not-end{margin-left:0;border-left-width:0;padding-left:1px;border-top-left-radius:0;border-bottom-left-radius:0}.fc-ltr .fc-h-event.fc-not-end,.fc-rtl .fc-h-event.fc-not-start{margin-right:0;border-right-width:0;padding-right:1px;border-top-right-radius:0;border-bottom-right-radius:0}.fc-ltr .fc-h-event .fc-start-resizer,.fc-rtl .fc-h-event .fc-end-resizer{cursor:w-resize;left:-1px}.fc-ltr .fc-h-event .fc-end-resizer,.fc-rtl .fc-h-event .fc-start-resizer{cursor:e-resize;right:-1px}.fc-h-event.fc-allow-mouse-resize .fc-resizer{width:7px;top:-1px;bottom:-1px}.fc-h-event.fc-selected .fc-resizer{border-radius:4px;border-width:1px;width:6px;height:6px;border-style:solid;border-color:inherit;background:#fff;top:50%;margin-top:-4px}.fc-ltr .fc-h-event.fc-selected .fc-start-resizer,.fc-rtl .fc-h-event.fc-selected .fc-end-resizer{margin-left:-4px}.fc-ltr .fc-h-event.fc-selected .fc-end-resizer,.fc-rtl .fc-h-event.fc-selected .fc-start-resizer{margin-right:-4px}.fc-day-grid-event{margin:1px 2px 0;padding:0 1px}tr:first-child>td>.fc-day-grid-event{margin-top:2px}.fc-day-grid-event.fc-selected:after{content:"";position:absolute;z-index:1;top:-1px;right:-1px;bottom:-1px;left:-1px;background:#000;opacity:.25}.fc-day-grid-event .fc-content{white-space:nowrap;overflow:hidden}.fc-day-grid-event .fc-time{font-weight:700}.fc-ltr .fc-day-grid-event.fc-allow-mouse-resize .fc-start-resizer,.fc-rtl .fc-day-grid-event.fc-allow-mouse-resize .fc-end-resizer{margin-left:-2px}.fc-ltr .fc-day-grid-event.fc-allow-mouse-resize .fc-end-resizer,.fc-rtl .fc-day-grid-event.fc-allow-mouse-resize .fc-start-resizer{margin-right:-2px}a.fc-more{margin:1px 3px;font-size:.85em;cursor:pointer;text-decoration:none}a.fc-more:hover{text-decoration:underline}.fc-limited{display:none}.fc-day-grid .fc-row{z-index:1}.fc-more-popover{z-index:2;width:220px}.fc-more-popover .fc-event-container{padding:10px}.fc-now-indicator{position:absolute;border:0 solid red}.fc-unselectable{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.fc-toolbar.fc-header-toolbar{margin-bottom:1em}.fc-toolbar.fc-footer-toolbar{margin-top:1em}.fc-toolbar .fc-left{float:left}.fc-toolbar .fc-right{float:right}.fc-toolbar .fc-center{display:inline-block}.fc .fc-toolbar>*>*{float:left;margin-left:.75em}.fc .fc-toolbar>*>:first-child{margin-left:0}.fc-toolbar h2{margin:0}.fc-toolbar button{position:relative}.fc-toolbar .fc-state-hover,.fc-toolbar .ui-state-hover{z-index:2}.fc-toolbar .fc-state-down{z-index:3}.fc-toolbar .fc-state-active,.fc-toolbar .ui-state-active{z-index:4}.fc-toolbar button:focus{z-index:5}.fc-view-container *,.fc-view-container :after,.fc-view-container :before{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.fc-view,.fc-view>table{position:relative;z-index:1}.fc-basicDay-view .fc-content-skeleton,.fc-basicWeek-view .fc-content-skeleton{padding-bottom:1em}.fc-basic-view .fc-body .fc-row{min-height:4em}.fc-row.fc-rigid .fc-content-skeleton{position:absolute;top:0;left:0;right:0}.fc-day-top.fc-other-month{opacity:.3}.fc-basic-view .fc-day-number,.fc-basic-view .fc-week-number{padding:2px}.fc-basic-view th.fc-day-number,.fc-basic-view th.fc-week-number{padding:0 2px}.fc-ltr .fc-basic-view .fc-day-top .fc-day-number{float:right}.fc-rtl .fc-basic-view .fc-day-top .fc-day-number{float:left}.fc-ltr .fc-basic-view .fc-day-top .fc-week-number{float:left;border-radius:0 0 3px}.fc-rtl .fc-basic-view .fc-day-top .fc-week-number{float:right;border-radius:0 0 0 3px}.fc-basic-view .fc-day-top .fc-week-number{min-width:1.5em;text-align:center;background-color:#f2f2f2;color:grey}.fc-basic-view td.fc-week-number>*{display:inline-block;min-width:1.25em}.fc-agenda-view .fc-day-grid{position:relative;z-index:2}.fc-agenda-view .fc-day-grid .fc-row{min-height:3em}.fc-agenda-view .fc-day-grid .fc-row .fc-content-skeleton{padding-bottom:1em}.fc .fc-axis{vertical-align:middle;padding:0 4px;white-space:nowrap}.fc-ltr .fc-axis{text-align:right}.fc-rtl .fc-axis{text-align:left}.ui-widget td.fc-axis{font-weight:400}.fc-time-grid,.fc-time-grid-container{position:relative;z-index:1}.fc-time-grid{min-height:100%}.fc-time-grid table{border:0 hidden transparent}.fc-time-grid>.fc-bg{z-index:1}.fc-time-grid .fc-slats,.fc-time-grid>hr{position:relative;z-index:2}.fc-time-grid .fc-content-col{position:relative}.fc-time-grid .fc-content-skeleton{position:absolute;z-index:3;top:0;left:0;right:0}.fc-time-grid .fc-business-container{position:relative;z-index:1}.fc-time-grid .fc-bgevent-container{position:relative;z-index:2}.fc-time-grid .fc-highlight-container{z-index:3;position:relative}.fc-time-grid .fc-event-container{position:relative;z-index:4}.fc-time-grid .fc-now-indicator-line{z-index:5}.fc-time-grid .fc-helper-container{position:relative;z-index:6}.fc-time-grid .fc-slats td{height:1.5em;border-bottom:0}.fc-time-grid .fc-slats .fc-minor td{border-top-style:dotted}.fc-time-grid .fc-slats .ui-widget-content{background:0 0}.fc-time-grid .fc-highlight{position:absolute;left:0;right:0}.fc-ltr .fc-time-grid .fc-event-container{margin:0 2.5% 0 2px}.fc-rtl .fc-time-grid .fc-event-container{margin:0 2px 0 2.5%}.fc-time-grid .fc-bgevent,.fc-time-grid .fc-event{position:absolute;z-index:1}.fc-time-grid .fc-bgevent{left:0;right:0}.fc-v-event.fc-not-start{border-top-width:0;padding-top:1px;border-top-left-radius:0;border-top-right-radius:0}.fc-v-event.fc-not-end{border-bottom-width:0;padding-bottom:1px;border-bottom-left-radius:0;border-bottom-right-radius:0}.fc-time-grid-event.fc-selected{overflow:visible}.fc-time-grid-event.fc-selected .fc-bg{display:none}.fc-time-grid-event .fc-content{overflow:hidden}.fc-time-grid-event .fc-time,.fc-time-grid-event .fc-title{padding:0 1px}.fc-time-grid-event .fc-time{font-size:.85em;white-space:nowrap}.fc-time-grid-event.fc-short .fc-content{white-space:nowrap}.fc-time-grid-event.fc-short .fc-time,.fc-time-grid-event.fc-short .fc-title{display:inline-block;vertical-align:top}.fc-time-grid-event.fc-short .fc-time span{display:none}.fc-time-grid-event.fc-short .fc-time:before{content:attr(data-start)}.fc-time-grid-event.fc-short .fc-time:after{content:"\000A0-\000A0"}.fc-time-grid-event.fc-short .fc-title{font-size:.85em;padding:0}.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer{left:0;right:0;bottom:0;height:8px;overflow:hidden;line-height:8px;font-size:11px;font-family:monospace;text-align:center;cursor:s-resize}.fc-time-grid-event.fc-allow-mouse-resize .fc-resizer:after{content:"="}.fc-time-grid-event.fc-selected .fc-resizer{border-radius:5px;border-width:1px;width:8px;height:8px;border-style:solid;border-color:inherit;background:#fff;left:50%;margin-left:-5px;bottom:-5px}.fc-time-grid .fc-now-indicator-line{border-top-width:1px;left:0;right:0}.fc-time-grid .fc-now-indicator-arrow{margin-top:-5px}.fc-ltr .fc-time-grid .fc-now-indicator-arrow{left:0;border-width:5px 0 5px 6px;border-top-color:transparent;border-bottom-color:transparent}.fc-rtl .fc-time-grid .fc-now-indicator-arrow{right:0;border-width:5px 6px 5px 0;border-top-color:transparent;border-bottom-color:transparent}.fc-event-dot{display:inline-block;width:10px;height:10px;border-radius:5px}.fc-rtl .fc-list-view{direction:rtl}.fc-list-view{border-width:1px;border-style:solid}.fc .fc-list-table{table-layout:auto}.fc-list-table td{border-width:1px 0 0;padding:8px 14px}.fc-list-table tr:first-child td{border-top-width:0}.fc-list-heading{border-bottom-width:1px}.fc-list-heading td{font-weight:700}.fc-ltr .fc-list-heading-main{float:left}.fc-ltr .fc-list-heading-alt,.fc-rtl .fc-list-heading-main{float:right}.fc-rtl .fc-list-heading-alt{float:left}.fc-list-item.fc-has-url{cursor:pointer}.fc-list-item:hover td{background-color:#f5f5f5}.fc-list-item-marker,.fc-list-item-time{white-space:nowrap;width:1px}.fc-ltr .fc-list-item-marker{padding-right:0}.fc-rtl .fc-list-item-marker{padding-left:0}.fc-list-item-title a{text-decoration:none;color:inherit}.fc-list-item-title a[href]:hover{text-decoration:underline}.fc-list-empty-wrap2{position:absolute;top:0;left:0;right:0;bottom:0}.fc-list-empty-wrap1{width:100%;height:100%;display:table}.fc-list-empty{display:table-cell;vertical-align:middle;text-align:center}.fc-unthemed .fc-list-empty{background-color:#eee}
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.min.js b/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..76e1d438342775611372b5656451982010606551
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.min.js
@@ -0,0 +1,10 @@
+/*!
+ * FullCalendar v3.4.0
+ * Docs & License: https://fullcalendar.io/
+ * (c) 2017 Adam Shaw
+ */
+!function(t){"function"==typeof define&&define.amd?define(["jquery","moment"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("moment")):t(jQuery,moment)}(function(t,e){function n(t){return it(t,Qt)}function i(t,e){e.left&&t.css({"border-left-width":1,"margin-left":e.left-1}),e.right&&t.css({"border-right-width":1,"margin-right":e.right-1})}function r(t){t.css({"margin-left":"","margin-right":"","border-left-width":"","border-right-width":""})}function s(){t("body").addClass("fc-not-allowed")}function o(){t("body").removeClass("fc-not-allowed")}function a(e,n,i){var r=Math.floor(n/e.length),s=Math.floor(n-r*(e.length-1)),o=[],a=[],u=[],h=0;l(e),e.each(function(n,i){var l=n===e.length-1?s:r,c=t(i).outerHeight(!0);c<l?(o.push(i),a.push(c),u.push(t(i).height())):h+=c}),i&&(n-=h,r=Math.floor(n/o.length),s=Math.floor(n-r*(o.length-1))),t(o).each(function(e,n){var i=e===o.length-1?s:r,l=a[e],h=u[e],c=i-(l-h);l<i&&t(n).height(c)})}function l(t){t.height("")}function u(e){var n=0;return e.find("> *").each(function(e,i){var r=t(i).outerWidth();r>n&&(n=r)}),n++,e.width(n),n}function h(t,e){var n,i=t.add(e);return i.css({position:"relative",left:-1}),n=t.outerHeight()-e.outerHeight(),i.css({position:"",left:""}),n}function c(e){var n=e.css("position"),i=e.parents().filter(function(){var e=t(this);return/(auto|scroll)/.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==n&&i.length?i:t(e[0].ownerDocument||document)}function d(t,e){var n=t.offset(),i=n.left-(e?e.left:0),r=n.top-(e?e.top:0);return{left:i,right:i+t.outerWidth(),top:r,bottom:r+t.outerHeight()}}function f(t,e){var n=t.offset(),i=p(t),r=n.left+w(t,"border-left-width")+i.left-(e?e.left:0),s=n.top+w(t,"border-top-width")+i.top-(e?e.top:0);return{left:r,right:r+t[0].clientWidth,top:s,bottom:s+t[0].clientHeight}}function g(t,e){var n=t.offset(),i=n.left+w(t,"border-left-width")+w(t,"padding-left")-(e?e.left:0),r=n.top+w(t,"border-top-width")+w(t,"padding-top")-(e?e.top:0);return{left:i,right:i+t.width(),top:r,bottom:r+t.height()}}function p(t){var e,n=t[0].offsetWidth-t[0].clientWidth,i=t[0].offsetHeight-t[0].clientHeight;return n=v(n),i=v(i),e={left:0,right:0,top:0,bottom:i},m()&&"rtl"==t.css("direction")?e.left=n:e.right=n,e}function v(t){return t=Math.max(0,t),t=Math.round(t)}function m(){return null===Xt&&(Xt=y()),Xt}function y(){var e=t("<div><div/></div>").css({position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}).appendTo("body"),n=e.children(),i=n.offset().left>e.offset().left;return e.remove(),i}function w(t,e){return parseFloat(t.css(e))||0}function S(t){return 1==t.which&&!t.ctrlKey}function b(t){var e=t.originalEvent.touches;return e&&e.length?e[0].pageX:t.pageX}function E(t){var e=t.originalEvent.touches;return e&&e.length?e[0].pageY:t.pageY}function D(t){return/^touch/.test(t.type)}function T(t){t.addClass("fc-unselectable").on("selectstart",H)}function C(t){t.removeClass("fc-unselectable").off("selectstart",H)}function H(t){t.preventDefault()}function R(t,e){var n={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)};return n.left<n.right&&n.top<n.bottom&&n}function x(t,e){return{left:Math.min(Math.max(t.left,e.left),e.right),top:Math.min(Math.max(t.top,e.top),e.bottom)}}function I(t){return{left:(t.left+t.right)/2,top:(t.top+t.bottom)/2}}function k(t,e){return{left:t.left-e.left,top:t.top-e.top}}function M(e){var n,i,r=[],s=[];for("string"==typeof e?s=e.split(/\s*,\s*/):"function"==typeof e?s=[e]:t.isArray(e)&&(s=e),n=0;n<s.length;n++)i=s[n],"string"==typeof i?r.push("-"==i.charAt(0)?{field:i.substring(1),order:-1}:{field:i,order:1}):"function"==typeof i&&r.push({func:i});return r}function B(t,e,n){var i,r;for(i=0;i<n.length;i++)if(r=L(t,e,n[i]))return r;return 0}function L(t,e,n){return n.func?n.func(t,e):N(t[n.field],e[n.field])*(n.order||1)}function N(e,n){return e||n?null==n?-1:null==e?1:"string"===t.type(e)||"string"===t.type(n)?String(e).localeCompare(String(n)):e-n:0}function z(t,e){var n,i,r,s,o=t.start,a=t.end,l=e.start,u=e.end;if(a>l&&o<u)return o>=l?(n=o.clone(),r=!0):(n=l.clone(),r=!1),a<=u?(i=a.clone(),s=!0):(i=u.clone(),s=!1),{start:n,end:i,isStart:r,isEnd:s}}function F(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days"),ms:t.time()-n.time()})}function A(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days")})}function G(t,n,i){return e.duration(Math.round(t.diff(n,i,!0)),i)}function V(t,e){var n,i,r;for(n=0;n<Jt.length&&(i=Jt[n],!((r=P(i,t,e))>=1&&vt(r)));n++);return i}function O(t,e){var n=V(t);return"week"===n&&"object"==typeof e&&e.days&&(n="day"),n}function P(t,n,i){return null!=i?i.diff(n,t,!0):e.isDuration(n)?n.as(t):n.end.diff(n.start,t,!0)}function _(t,e,n){var i;return tt(n)?(e-t)/n:(i=n.asMonths(),Math.abs(i)>=1&&vt(i)?e.diff(t,"months",!0)/i:e.diff(t,"days",!0)/n.asDays())}function W(t,e){var n,i;return tt(t)||tt(e)?t/e:(n=t.asMonths(),i=e.asMonths(),Math.abs(n)>=1&&vt(n)&&Math.abs(i)>=1&&vt(i)?n/i:t.asDays()/e.asDays())}function Y(t,n){var i;return tt(t)?e.duration(t*n):(i=t.asMonths(),Math.abs(i)>=1&&vt(i)?e.duration({months:i*n}):e.duration({days:t.asDays()*n}))}function q(t){return{start:t.start.clone(),end:t.end.clone()}}function U(t,e){return t=q(t),e.start&&(t.start=j(t.start,e)),e.end&&(t.end=K(t.end,e.end)),t}function j(t,e){return t=t.clone(),e.start&&(t=J(t,e.start)),e.end&&t>=e.end&&(t=e.end.clone().subtract(1)),t}function Z(t,e){return(!e.start||t>=e.start)&&(!e.end||t<e.end)}function $(t,e){return(!e.start||t.end>=e.start)&&(!e.end||t.start<e.end)}function Q(t,e){return(!e.start||t.start>=e.start)&&(!e.end||t.end<=e.end)}function X(t,e){return(t.start&&e.start&&t.start.isSame(e.start)||!t.start&&!e.start)&&(t.end&&e.end&&t.end.isSame(e.end)||!t.end&&!e.end)}function K(t,e){return(t.isBefore(e)?t:e).clone()}function J(t,e){return(t.isAfter(e)?t:e).clone()}function tt(t){return Boolean(t.hours()||t.minutes()||t.seconds()||t.milliseconds())}function et(t){return"[object Date]"===Object.prototype.toString.call(t)||t instanceof Date}function nt(t){return/^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(t)}function it(t,e){var n,i,r,s,o,a,l={};if(e)for(n=0;n<e.length;n++){for(i=e[n],r=[],s=t.length-1;s>=0;s--)if("object"==typeof(o=t[s][i]))r.unshift(o);else if(void 0!==o){l[i]=o;break}r.length&&(l[i]=it(r))}for(n=t.length-1;n>=0;n--){a=t[n];for(i in a)i in l||(l[i]=a[i])}return l}function rt(t){var e=function(){};return e.prototype=t,new e}function st(t,e){for(var n in t)ot(t,n)&&(e[n]=t[n])}function ot(t,e){return te.call(t,e)}function at(e){return/undefined|null|boolean|number|string/.test(t.type(e))}function lt(e,n,i){if(t.isFunction(e)&&(e=[e]),e){var r,s;for(r=0;r<e.length;r++)s=e[r].apply(n,i)||s;return s}}function ut(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]}function ht(t){return(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function ct(t){return t.replace(/&.*?;/g,"")}function dt(e){var n=[];return t.each(e,function(t,e){null!=e&&n.push(t+":"+e)}),n.join(";")}function ft(e){var n=[];return t.each(e,function(t,e){null!=e&&n.push(t+'="'+ht(e)+'"')}),n.join(" ")}function gt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function pt(t,e){return t-e}function vt(t){return t%1==0}function mt(t,e){var n=t[e];return function(){return n.apply(t,arguments)}}function yt(t,e,n){var i,r,s,o,a,l=function(){var u=+new Date-o;u<e?i=setTimeout(l,e-u):(i=null,n||(a=t.apply(s,r),s=r=null))};return function(){s=this,r=arguments,o=+new Date;var u=n&&!i;return i||(i=setTimeout(l,e)),u&&(a=t.apply(s,r),s=r=null),a}}function wt(n,i,r){var s,o,a,l,u=n[0],h=1==n.length&&"string"==typeof u;return e.isMoment(u)||et(u)||void 0===u?l=e.apply(null,n):(s=!1,o=!1,h?ee.test(u)?(u+="-01",n=[u],s=!0,o=!0):(a=ne.exec(u))&&(s=!a[5],o=!0):t.isArray(u)&&(o=!0),l=i||s?e.utc.apply(e,n):e.apply(null,n),s?(l._ambigTime=!0,l._ambigZone=!0):r&&(o?l._ambigZone=!0:h&&l.utcOffset(u))),l._fullCalendar=!0,l}function St(t){return"en"!==t.locale()?t.clone().locale("en"):t}function bt(){}function Et(t,e){var n;return ot(e,"constructor")&&(n=e.constructor),"function"!=typeof n&&(n=e.constructor=function(){t.apply(this,arguments)}),n.prototype=rt(t.prototype),st(e,n.prototype),st(t,n),n}function Dt(t,e){st(e,t.prototype)}function Tt(t,e){t.then=function(n){return"function"==typeof n&&n(e),t}}function Ct(t){t.then=function(e,n){return"function"==typeof n&&n(),t}}function Ht(t,e){return!t&&!e||!(!t||!e)&&(t.component===e.component&&Rt(t,e)&&Rt(e,t))}function Rt(t,e){for(var n in t)if(!/^(component|left|right|top|bottom)$/.test(n)&&t[n]!==e[n])return!1;return!0}function xt(t){return{start:t.start.clone(),end:t.end?t.end.clone():null,allDay:t.allDay}}function It(t){var e=Mt(t);return"background"===e||"inverse-background"===e}function kt(t){return"inverse-background"===Mt(t)}function Mt(t){return ut((t.source||{}).rendering,t.rendering)}function Bt(t){var e,n,i={};for(e=0;e<t.length;e++)n=t[e],(i[n._id]||(i[n._id]=[])).push(n);return i}function Lt(t,e){return t.start-e.start}function Nt(n){var i,r,s,o,a=Zt.dataAttrPrefix;return a&&(a+="-"),i=n.data(a+"event")||null,i&&(i="object"==typeof i?t.extend({},i):{},r=i.start,null==r&&(r=i.time),s=i.duration,o=i.stick,delete i.start,delete i.time,delete i.duration,delete i.stick),null==r&&(r=n.data(a+"start")),null==r&&(r=n.data(a+"time")),null==s&&(s=n.data(a+"duration")),null==o&&(o=n.data(a+"stick")),r=null!=r?e.duration(r):null,s=null!=s?e.duration(s):null,o=Boolean(o),{eventProps:i,startTime:r,duration:s,stick:o}}function zt(t,e){var n,i;for(n=0;n<e.length;n++)if(i=e[n],i.leftCol<=t.rightCol&&i.rightCol>=t.leftCol)return!0;return!1}function Ft(t,e){return t.leftCol-e.leftCol}function At(t){var e,n,i,r=[];for(e=0;e<t.length;e++){for(n=t[e],i=0;i<r.length&&Ot(n,r[i]).length;i++);n.level=i,(r[i]||(r[i]=[])).push(n)}return r}function Gt(t){var e,n,i,r,s;for(e=0;e<t.length;e++)for(n=t[e],i=0;i<n.length;i++)for(r=n[i],r.forwardSegs=[],s=e+1;s<t.length;s++)Ot(r,t[s],r.forwardSegs)}function Vt(t){var e,n,i=t.forwardSegs,r=0;if(void 0===t.forwardPressure){for(e=0;e<i.length;e++)n=i[e],Vt(n),r=Math.max(r,1+n.forwardPressure);t.forwardPressure=r}}function Ot(t,e,n){n=n||[];for(var i=0;i<e.length;i++)Pt(t,e[i])&&n.push(e[i]);return n}function Pt(t,e){return t.bottom>e.top&&t.top<e.bottom}function _t(t){this.items=t||[]}function Wt(e,n){function i(t){n=t}function r(){var i=n.layout;p=e.opt("theme")?"ui":"fc",i?(g?g.empty():g=this.el=t("<div class='fc-toolbar "+n.extraClasses+"'/>"),g.append(o("left")).append(o("right")).append(o("center")).append('<div class="fc-clear"/>')):s()}function s(){g&&(g.remove(),g=f.el=null)}function o(i){var r=t('<div class="fc-'+i+'"/>'),s=n.layout[i],o=e.opt("customButtons")||{},a=e.opt("buttonText")||{};return s&&t.each(s.split(" "),function(n){var i,s=t(),l=!0;t.each(this.split(","),function(n,i){var r,u,h,c,d,f,g,m,y,w;"title"==i?(s=s.add(t("<h2>&nbsp;</h2>")),l=!1):((r=o[i])?(h=function(t){r.click&&r.click.call(w[0],t)},c="",d=r.text):(u=e.getViewSpec(i))?(h=function(){e.changeView(i)},v.push(i),c=u.buttonTextOverride,d=u.buttonTextDefault):e[i]&&(h=function(){e[i]()},c=(e.overrides.buttonText||{})[i],d=a[i]),h&&(f=r?r.themeIcon:e.opt("themeButtonIcons")[i],g=r?r.icon:e.opt("buttonIcons")[i],m=c?ht(c):f&&e.opt("theme")?"<span class='ui-icon ui-icon-"+f+"'></span>":g&&!e.opt("theme")?"<span class='fc-icon fc-icon-"+g+"'></span>":ht(d),y=["fc-"+i+"-button",p+"-button",p+"-state-default"],w=t('<button type="button" class="'+y.join(" ")+'">'+m+"</button>").click(function(t){w.hasClass(p+"-state-disabled")||(h(t),(w.hasClass(p+"-state-active")||w.hasClass(p+"-state-disabled"))&&w.removeClass(p+"-state-hover"))}).mousedown(function(){w.not("."+p+"-state-active").not("."+p+"-state-disabled").addClass(p+"-state-down")}).mouseup(function(){w.removeClass(p+"-state-down")}).hover(function(){w.not("."+p+"-state-active").not("."+p+"-state-disabled").addClass(p+"-state-hover")},function(){w.removeClass(p+"-state-hover").removeClass(p+"-state-down")}),s=s.add(w)))}),l&&s.first().addClass(p+"-corner-left").end().last().addClass(p+"-corner-right").end(),s.length>1?(i=t("<div/>"),l&&i.addClass("fc-button-group"),i.append(s),r.append(i)):r.append(s)}),r}function a(t){g&&g.find("h2").text(t)}function l(t){g&&g.find(".fc-"+t+"-button").addClass(p+"-state-active")}function u(t){g&&g.find(".fc-"+t+"-button").removeClass(p+"-state-active")}function h(t){g&&g.find(".fc-"+t+"-button").prop("disabled",!0).addClass(p+"-state-disabled")}function c(t){g&&g.find(".fc-"+t+"-button").prop("disabled",!1).removeClass(p+"-state-disabled")}function d(){return v}var f=this;f.setToolbarOptions=i,f.render=r,f.removeElement=s,f.updateTitle=a,f.activateButton=l,f.deactivateButton=u,f.disableButton=h,f.enableButton=c,f.getViewsWithButtons=d,f.el=null;var g,p,v=[]}function Yt(e){t.each(Me,function(t,n){null==e[t]&&(e[t]=n(e))})}function qt(t){return e.localeData(t)||e.localeData("en")}function Ut(){function n(t,e){return!q.opt("lazyFetching")||s(t,e)?o(t,e):he.resolve(Z)}function i(){Z=r(K),q.trigger("eventsReset",Z)}function r(t){var e,n,i=[];for(e=0;e<t.length;e++)n=t[e],n.start.clone().stripZone()<j&&q.getEventEnd(n).stripZone()>U&&i.push(n);return i}function s(t,e){return!U||t<U||e>j}function o(t,e){return U=t,j=e,a()}function a(){return u(Q,"reset")}function l(t){return u(b(t))}function u(t,e){var n,i;for("reset"===e?K=[]:"add"!==e&&(K=C(K,t)),n=0;n<t.length;n++)i=t[n],"pending"!==i._status&&X++,i._fetchId=(i._fetchId||0)+1,i._status="pending";for(n=0;n<t.length;n++)i=t[n],h(i,i._fetchId);return X?he.construct(function(t){q.one("eventsReceived",t)}):he.resolve(Z)}function h(e,n){f(e,function(i){var r,s,o,a=t.isArray(e.events);if(n===e._fetchId&&"rejected"!==e._status){if(e._status="resolved",i)for(r=0;r<i.length;r++)s=i[r],(o=a?s:z(s,e))&&K.push.apply(K,_(o));d()}})}function c(t){var e="pending"===t._status;t._status="rejected",e&&d()}function d(){--X||(i(K),q.trigger("eventsReceived",Z))}function f(e,n){var i,r,s=Zt.sourceFetchers;for(i=0;i<s.length;i++){if(!0===(r=s[i].call(q,e,U.clone(),j.clone(),q.opt("timezone"),n)))return;if("object"==typeof r)return void f(r,n)}var o=e.events;if(o)t.isFunction(o)?(q.pushLoading(),o.call(q,U.clone(),j.clone(),q.opt("timezone"),function(t){n(t),q.popLoading()})):t.isArray(o)?n(o):n();else{if(e.url){var a,l=e.success,u=e.error,h=e.complete;a=t.isFunction(e.data)?e.data():e.data;var c=t.extend({},a||{}),d=ut(e.startParam,q.opt("startParam")),g=ut(e.endParam,q.opt("endParam")),p=ut(e.timezoneParam,q.opt("timezoneParam"));d&&(c[d]=U.format()),g&&(c[g]=j.format()),q.opt("timezone")&&"local"!=q.opt("timezone")&&(c[p]=q.opt("timezone")),q.pushLoading(),t.ajax(t.extend({},Be,e,{data:c,success:function(e){e=e||[];var i=lt(l,this,arguments);t.isArray(i)&&(e=i),n(e)},error:function(){lt(u,this,arguments),n()},complete:function(){lt(h,this,arguments),q.popLoading()}}))}else n()}}function g(t){var e=p(t);e&&(Q.push(e),u([e],"add"))}function p(e){var n,i,r=Zt.sourceNormalizers;if(t.isFunction(e)||t.isArray(e)?n={events:e}:"string"==typeof e?n={url:e}:"object"==typeof e&&(n=t.extend({},e)),n){for(n.className?"string"==typeof n.className&&(n.className=n.className.split(/\s+/)):n.className=[],t.isArray(n.events)&&(n.origArray=n.events,n.events=t.map(n.events,function(t){return z(t,n)})),i=0;i<r.length;i++)r[i].call(q,n);return n}}function v(t){y(E(t))}function m(t){null==t?y(Q,!0):y(b(t))}function y(e,n){var r;for(r=0;r<e.length;r++)c(e[r]);n?(Q=[],K=[]):(Q=t.grep(Q,function(t){for(r=0;r<e.length;r++)if(t===e[r])return!1;return!0}),K=C(K,e)),i()}function w(){return Q.slice(1)}function S(e){return t.grep(Q,function(t){return t.id&&t.id===e})[0]}function b(e){e?t.isArray(e)||(e=[e]):e=[];var n,i=[];for(n=0;n<e.length;n++)i.push.apply(i,E(e[n]));return i}function E(e){var n,i;for(n=0;n<Q.length;n++)if((i=Q[n])===e)return[i];return i=S(e),i?[i]:t.grep(Q,function(t){return D(e,t)})}function D(t,e){return t&&e&&T(t)==T(e)}function T(t){return("object"==typeof t?t.origArray||t.googleCalendarId||t.url||t.events:null)||t}function C(e,n){return t.grep(e,function(t){for(var e=0;e<n.length;e++)if(t.source===n[e])return!1;return!0})}function H(t){R([t])}function R(t){var e,n;for(e=0;e<t.length;e++)n=t[e],n.start=q.moment(n.start),n.end?n.end=q.moment(n.end):n.end=null,W(n,x(n));i()}function x(e){var n={};return t.each(e,function(t,e){I(t)&&void 0!==e&&at(e)&&(n[t]=e)}),n}function I(t){return!/^_|^(id|allDay|start|end)$/.test(t)}function k(t,e){return M([t],e)}function M(t,e){var n,r,s,o,a,l=[];for(s=0;s<t.length;s++)if(r=z(t[s])){for(n=_(r),o=0;o<n.length;o++)a=n[o],a.source||(e&&($.events.push(a),a.source=$),K.push(a));l=l.concat(n)}return l.length&&i(),l}function B(e){var n,r;for(null==e?e=function(){return!0}:t.isFunction(e)||(n=e+"",e=function(t){return t._id==n}),K=t.grep(K,e,!0),r=0;r<Q.length;r++)t.isArray(Q[r].events)&&(Q[r].events=t.grep(Q[r].events,e,!0));i()}function L(e){return t.isFunction(e)?t.grep(K,e):null!=e?(e+="",t.grep(K,function(t){return t._id==e})):K}function N(t){t.start=q.moment(t.start),t.end&&(t.end=q.moment(t.end)),jt(t)}function z(n,i){var r,s,o,a=q.opt("eventDataTransform"),l={};if(a&&(n=a(n)),i&&i.eventDataTransform&&(n=i.eventDataTransform(n)),t.extend(l,n),i&&(l.source=i),l._id=n._id||(void 0===n.id?"_fc"+Le++:n.id+""),n.className?"string"==typeof n.className?l.className=n.className.split(/\s+/):l.className=n.className:l.className=[],r=n.start||n.date,s=n.end,nt(r)&&(r=e.duration(r)),nt(s)&&(s=e.duration(s)),n.dow||e.isDuration(r)||e.isDuration(s))l.start=r?e.duration(r):null,l.end=s?e.duration(s):null,l._recurring=!0;else{if(r&&(r=q.moment(r),!r.isValid()))return!1;s&&(s=q.moment(s),s.isValid()||(s=null)),o=n.allDay,void 0===o&&(o=ut(i?i.allDayDefault:void 0,q.opt("allDayDefault"))),V(r,s,o,l)}return q.normalizeEvent(l),l}function V(t,e,n,i){i.start=t,i.end=e,i.allDay=n,O(i),jt(i)}function O(t){P(t),t.end&&!t.end.isAfter(t.start)&&(t.end=null),t.end||(q.opt("forceEventDuration")?t.end=q.getDefaultEventEnd(t.allDay,t.start):t.end=null)}function P(t){null==t.allDay&&(t.allDay=!(t.start.hasTime()||t.end&&t.end.hasTime())),t.allDay?(t.start.stripTime(),t.end&&t.end.stripTime()):(t.start.hasTime()||(t.start=q.applyTimezone(t.start.time(0))),t.end&&!t.end.hasTime()&&(t.end=q.applyTimezone(t.end.time(0))))}function _(e,n,i){var r,s,o,a,l,u,h,c,d,f=[];if(n=n||U,i=i||j,e)if(e._recurring){if(s=e.dow)for(r={},o=0;o<s.length;o++)r[s[o]]=!0;for(a=n.clone().stripTime();a.isBefore(i);)r&&!r[a.day()]||(l=e.start,u=e.end,h=a.clone(),c=null,l&&(h=h.time(l)),u&&(c=a.clone().time(u)),d=t.extend({},e),V(h,c,!l&&!u,d),f.push(d)),a.add(1,"days")}else f.push(e);return f}function W(e,n,i){function r(t,e){return i?G(t,e,i):n.allDay?A(t,e):F(t,e)}var s,o,a,l,u,h,c={};return n=n||{},n.start||(n.start=e.start.clone()),void 0===n.end&&(n.end=e.end?e.end.clone():null),null==n.allDay&&(n.allDay=e.allDay),O(n),s={start:e._start.clone(),end:e._end?e._end.clone():q.getDefaultEventEnd(e._allDay,e._start),allDay:n.allDay},O(s),o=null!==e._end&&null===n.end,a=r(n.start,s.start),n.end?(l=r(n.end,s.end),u=l.subtract(a)):u=null,t.each(n,function(t,e){I(t)&&void 0!==e&&(c[t]=e)}),h=Y(L(e._id),o,n.allDay,a,u,c),{dateDelta:a,durationDelta:u,undo:h}}function Y(e,n,i,r,s,o){var a=q.getIsAmbigTimezone(),l=[];return r&&!r.valueOf()&&(r=null),s&&!s.valueOf()&&(s=null),t.each(e,function(e,u){var h,c;h={start:u.start.clone(),end:u.end?u.end.clone():null,allDay:u.allDay},t.each(o,function(t){h[t]=u[t]}),c={start:u._start,end:u._end,allDay:i},O(c),n?c.end=null:s&&!c.end&&(c.end=q.getDefaultEventEnd(c.allDay,c.start)),r&&(c.start.add(r),c.end&&c.end.add(r)),s&&c.end.add(s),a&&!c.allDay&&(r||s)&&(c.start.stripZone(),c.end&&c.end.stripZone()),t.extend(u,o,c),jt(u),l.push(function(){t.extend(u,h),jt(u)})}),function(){for(var t=0;t<l.length;t++)l[t]()}}var q=this;q.requestEvents=n,q.reportEventChange=i,q.isFetchNeeded=s,q.fetchEvents=o,q.fetchEventSources=u,q.refetchEvents=a,q.refetchEventSources=l,q.getEventSources=w,q.getEventSourceById=S,q.addEventSource=g,q.removeEventSource=v,q.removeEventSources=m,q.updateEvent=H,q.updateEvents=R,q.renderEvent=k,q.renderEvents=M,q.removeEvents=B,q.clientEvents=L,q.mutateEvent=W,q.normalizeEventDates=O,q.normalizeEventTimes=P;var U,j,Z,$={events:[]},Q=[$],X=0,K=[];t.each((q.opt("events")?[q.opt("events")]:[]).concat(q.opt("eventSources")||[]),function(t,e){var n=p(e);n&&Q.push(n)}),q.getEventCache=function(){return K},q.rezoneArrayEventSources=function(){var e,n,i;for(e=0;e<Q.length;e++)if(n=Q[e].events,t.isArray(n))for(i=0;i<n.length;i++)N(n[i])},q.buildEventFromInput=z,q.expandEvent=_}function jt(t){t._allDay=t.allDay,t._start=t.start.clone(),t._end=t.end?t.end.clone():null}var Zt=t.fullCalendar={version:"3.4.0",internalApiVersion:9},$t=Zt.views={};t.fn.fullCalendar=function(e){var n=Array.prototype.slice.call(arguments,1),i=this;return this.each(function(r,s){var o,a=t(s),l=a.data("fullCalendar");"string"==typeof e?l&&t.isFunction(l[e])&&(o=l[e].apply(l,n),r||(i=o),"destroy"===e&&a.removeData("fullCalendar")):l||(l=new Re(a,e),a.data("fullCalendar",l),l.render())}),i};var Qt=["header","footer","buttonText","buttonIcons","themeButtonIcons"];Zt.intersectRanges=z,Zt.applyAll=lt,Zt.debounce=yt,Zt.isInt=vt,Zt.htmlEscape=ht,Zt.cssToStr=dt,Zt.proxy=mt,Zt.capitaliseFirstLetter=gt,Zt.getOuterRect=d,Zt.getClientRect=f,Zt.getContentRect=g,Zt.getScrollbarWidths=p;var Xt=null;Zt.preventDefault=H,Zt.intersectRects=R,Zt.parseFieldSpecs=M,Zt.compareByFieldSpecs=B,Zt.compareByFieldSpec=L,Zt.flexibleCompare=N,Zt.computeGreatestUnit=V,Zt.divideRangeByDuration=_,Zt.divideDurationByDuration=W,Zt.multiplyDuration=Y,Zt.durationHasTime=tt;var Kt=["sun","mon","tue","wed","thu","fri","sat"],Jt=["year","month","week","day","hour","minute","second","millisecond"];Zt.log=function(){var t=window.console;if(t&&t.log)return t.log.apply(t,arguments)},Zt.warn=function(){var t=window.console;return t&&t.warn?t.warn.apply(t,arguments):Zt.log.apply(Zt,arguments)};var te={}.hasOwnProperty;Zt.createObject=rt;var ee=/^\s*\d{4}-\d\d$/,ne=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/,ie=e.fn,re=t.extend({},ie),se=e.momentProperties;se.push("_fullCalendar"),se.push("_ambigTime"),se.push("_ambigZone"),Zt.moment=function(){return wt(arguments)},Zt.moment.utc=function(){var t=wt(arguments,!0);return t.hasTime()&&t.utc(),t},Zt.moment.parseZone=function(){return wt(arguments,!0,!0)},ie.week=ie.weeks=function(t){var e=this._locale._fullCalendar_weekCalc;return null==t&&"function"==typeof e?e(this):"ISO"===e?re.isoWeek.apply(this,arguments):re.week.apply(this,arguments)},ie.time=function(t){if(!this._fullCalendar)return re.time.apply(this,arguments);if(null==t)return e.duration({hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()});this._ambigTime=!1,e.isDuration(t)||e.isMoment(t)||(t=e.duration(t));var n=0;return e.isDuration(t)&&(n=24*Math.floor(t.asDays())),this.hours(n+t.hours()).minutes(t.minutes()).seconds(t.seconds()).milliseconds(t.milliseconds())},ie.stripTime=function(){return this._ambigTime||(this.utc(!0),this.set({hours:0,minutes:0,seconds:0,ms:0}),this._ambigTime=!0,this._ambigZone=!0),this},ie.hasTime=function(){return!this._ambigTime},ie.stripZone=function(){var t;return this._ambigZone||(t=this._ambigTime,this.utc(!0),this._ambigTime=t||!1,this._ambigZone=!0),this},ie.hasZone=function(){return!this._ambigZone},ie.local=function(t){return re.local.call(this,this._ambigZone||t),this._ambigTime=!1,this._ambigZone=!1,this},ie.utc=function(t){return re.utc.call(this,t),this._ambigTime=!1,this._ambigZone=!1,this},ie.utcOffset=function(t){return null!=t&&(this._ambigTime=!1,this._ambigZone=!1),re.utcOffset.apply(this,arguments)},ie.format=function(){return this._fullCalendar&&arguments[0]?oe(this,arguments[0]):this._ambigTime?le(St(this),"YYYY-MM-DD"):this._ambigZone?le(St(this),"YYYY-MM-DD[T]HH:mm:ss"):this._fullCalendar?le(St(this)):re.format.apply(this,arguments)},ie.toISOString=function(){return this._ambigTime?le(St(this),"YYYY-MM-DD"):this._ambigZone?le(St(this),"YYYY-MM-DD[T]HH:mm:ss"):this._fullCalendar?re.toISOString.apply(St(this),arguments):re.toISOString.apply(this,arguments)},function(){function t(t,e){return h(r(e).fakeFormatString,t)}function e(t,e){return re.format.call(t,e)}function n(t,e,n,s,o){var a;return t=Zt.moment.parseZone(t),e=Zt.moment.parseZone(e),a=t.localeData(),n=a.longDateFormat(n)||n,i(r(n),t,e,s||" - ",o)}function i(t,e,n,i,r){var s,o,a,l=t.sameUnits,u=e.clone().stripZone(),h=n.clone().stripZone(),f=c(t.fakeFormatString,e),g=c(t.fakeFormatString,n),p="",v="",m="",y="",w="";for(s=0;s<l.length&&(!l[s]||u.isSame(h,l[s]));s++)p+=f[s];for(o=l.length-1;o>s&&(!l[o]||u.isSame(h,l[o]))&&(o-1!==s||"."!==f[o]);o--)v=f[o]+v;for(a=s;a<=o;a++)m+=f[a],y+=g[a];return(m||y)&&(w=r?y+i+m:m+i+y),d(p+w+v)}function r(t){return S[t]||(S[t]=s(t))}function s(t){var e=o(t);return{fakeFormatString:l(e),sameUnits:u(e)}}function o(t){for(var e,n=[],i=/\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;e=i.exec(t);)e[1]?n.push.apply(n,a(e[1])):e[2]?n.push({maybe:o(e[2])}):e[3]?n.push({token:e[3]}):e[5]&&n.push.apply(n,a(e[5]));return n}function a(t){return". "===t?["."," "]:[t]}function l(t){var e,n,i=[];for(e=0;e<t.length;e++)n=t[e],"string"==typeof n?i.push("["+n+"]"):n.token?n.token in y?i.push(p+"["+n.token+"]"):i.push(n.token):n.maybe&&i.push(v+l(n.maybe)+v);return i.join(g)}function u(t){var e,n,i,r=[];for(e=0;e<t.length;e++)n=t[e],n.token?(i=w[n.token.charAt(0)],r.push(i?i.unit:"second")):n.maybe?r.push.apply(r,u(n.maybe)):r.push(null);return r}function h(t,e){return d(c(t,e).join(""))}function c(t,n){var i,r,s=[],o=e(n,t),a=o.split(g);for(i=0;i<a.length;i++)r=a[i],r.charAt(0)===p?s.push(y[r.substring(1)](n)):s.push(r);return s}function d(t){return t.replace(m,function(t,e){return e.match(/[1-9]/)?e:""})}function f(t){var e,n,i,r,s=o(t);for(e=0;e<s.length;e++)n=s[e],n.token&&(i=w[n.token.charAt(0)])&&(!r||i.value>r.value)&&(r=i);return r?r.unit:null}Zt.formatDate=t,Zt.formatRange=n,Zt.oldMomentFormat=e,Zt.queryMostGranularFormatUnit=f;var g="\v",p="",v="",m=new RegExp(v+"([^"+v+"]*)"+v,"g"),y={t:function(t){return e(t,"a").charAt(0)},T:function(t){return e(t,"A").charAt(0)}},w={Y:{value:1,unit:"year"},M:{value:2,unit:"month"},W:{value:3,unit:"week"},w:{value:3,unit:"week"},D:{value:4,unit:"day"},d:{value:4,unit:"day"}},S={}}();var oe=Zt.formatDate,ae=Zt.formatRange,le=Zt.oldMomentFormat;Zt.Class=bt,bt.extend=function(){var t,e,n=arguments.length;for(t=0;t<n;t++)e=arguments[t],t<n-1&&Dt(this,e);return Et(this,e||{})},bt.mixin=function(t){Dt(this,t)};var ue=bt.extend(fe,ge,{_props:null,_watchers:null,_globalWatchArgs:null,constructor:function(){this._watchers={},this._props={},this.applyGlobalWatchers()},applyGlobalWatchers:function(){var t,e=this._globalWatchArgs||[];for(t=0;t<e.length;t++)this.watch.apply(this,e[t])},has:function(t){return t in this._props},get:function(t){return void 0===t?this._props:this._props[t]},set:function(t,e){var n;"string"==typeof t?(n={},n[t]=void 0===e?null:e):n=t,this.setProps(n)},reset:function(t){var e,n=this._props,i={};for(e in n)i[e]=void 0;for(e in t)i[e]=t[e];this.setProps(i)},unset:function(t){var e,n,i={};for(e="string"==typeof t?[t]:t,n=0;n<e.length;n++)i[e[n]]=void 0;this.setProps(i)},setProps:function(t){var e,n,i={},r=0;for(e in t)"object"!=typeof(n=t[e])&&n===this._props[e]||(i[e]=n,r++);if(r){this.trigger("before:batchChange",i);for(e in i)n=i[e],this.trigger("before:change",e,n),this.trigger("before:change:"+e,n);for(e in i)n=i[e],void 0===n?delete this._props[e]:this._props[e]=n,this.trigger("change:"+e,n),this.trigger("change",e,n);this.trigger("batchChange",i)}},watch:function(t,e,n,i){var r=this;this.unwatch(t),this._watchers[t]=this._watchDeps(e,function(e){var i=n.call(r,e);i&&i.then?(r.unset(t),i.then(function(e){r.set(t,e)})):r.set(t,i)},function(){r.unset(t),i&&i.call(r)})},unwatch:function(t){var e=this._watchers[t];e&&(delete this._watchers[t],e.teardown())},_watchDeps:function(t,e,n){function i(t,e,i){1===++a&&u===l&&(d=!0,n(),d=!1)}function r(t,n,i){void 0===n?(i||void 0===h[t]||u--,delete h[t]):(i||void 0!==h[t]||u++,h[t]=n),--a||u===l&&(d||e(h))}function s(t,e){o.on(t,e),c.push([t,e])}var o=this,a=0,l=t.length,u=0,h={},c=[],d=!1;return t.forEach(function(t){var e=!1;"?"===t.charAt(0)&&(t=t.substring(1),e=!0),s("before:change:"+t,function(n){i(t,n,e)}),s("change:"+t,function(n){r(t,n,e)})}),t.forEach(function(t){var e=!1;"?"===t.charAt(0)&&(t=t.substring(1),e=!0),o.has(t)?(h[t]=o.get(t),u++):e&&u++}),u===l&&e(h),{teardown:function(){for(var t=0;t<c.length;t++)o.off(c[t][0],c[t][1]);c=null,u===l&&n()},flash:function(){u===l&&(n(),e(h))}}},flash:function(t){var e=this._watchers[t];e&&e.flash()}});ue.watch=function(){var t=this.prototype;t._globalWatchArgs||(t._globalWatchArgs=[]),t._globalWatchArgs.push(arguments)},Zt.Model=ue;var he={construct:function(e){var n=t.Deferred(),i=n.promise();return"function"==typeof e&&e(function(t){n.resolve(t),Tt(i,t)},function(){n.reject(),Ct(i)}),i},resolve:function(e){var n=t.Deferred().resolve(e),i=n.promise();return Tt(i,e),i},reject:function(){var e=t.Deferred().reject(),n=e.promise();return Ct(n),n}};Zt.Promise=he;var ce=bt.extend(fe,{q:null,isPaused:!1,isRunning:!1,constructor:function(){this.q=[]},queue:function(){this.q.push.apply(this.q,arguments),this.tryStart()},pause:function(){this.isPaused=!0},resume:function(){this.isPaused=!1,this.tryStart()},tryStart:function(){!this.isRunning&&this.canRunNext()&&(this.isRunning=!0,this.trigger("start"),this.runNext())},canRunNext:function(){return!this.isPaused&&this.q.length},runNext:function(){this.runTask(this.q.shift())},runTask:function(t){this.runTaskFunc(t)},runTaskFunc:function(t){function e(){n.canRunNext()?n.runNext():(n.isRunning=!1,n.trigger("stop"))}var n=this,i=t();i&&i.then?i.then(e):e()}});Zt.TaskQueue=ce;var de=ce.extend({waitsByNamespace:null,waitNamespace:null,waitId:null,constructor:function(t){ce.call(this),this.waitsByNamespace=t||{}},queue:function(t,e,n){var i,r={func:t,namespace:e,type:n};e&&(i=this.waitsByNamespace[e]),this.waitNamespace&&(e===this.waitNamespace&&null!=i?this.delayWait(i):(this.clearWait(),this.tryStart())),this.compoundTask(r)&&(this.waitNamespace||null==i?this.tryStart():this.startWait(e,i))},startWait:function(t,e){this.waitNamespace=t,this.spawnWait(e)},delayWait:function(t){clearTimeout(this.waitId),this.spawnWait(t)},spawnWait:function(t){var e=this;this.waitId=setTimeout(function(){e.waitNamespace=null,e.tryStart()},t)},clearWait:function(){this.waitNamespace&&(clearTimeout(this.waitId),this.waitId=null,this.waitNamespace=null)},canRunNext:function(){if(!ce.prototype.canRunNext.apply(this,arguments))return!1;if(this.waitNamespace){for(var t=this.q,e=0;e<t.length;e++)if(t[e].namespace!==this.waitNamespace)return!0;return!1}return!0},runTask:function(t){this.runTaskFunc(t.func)},compoundTask:function(t){var e,n,i=this.q,r=!0;if(t.namespace&&("destroy"===t.type||"init"===t.type)){for(e=i.length-1;e>=0;e--)n=i[e],n.namespace!==t.namespace||"add"!==n.type&&"remove"!==n.type||i.splice(e,1);"destroy"===t.type?i.length&&(n=i[i.length-1],n.namespace===t.namespace&&("init"===n.type?(r=!1,i.pop()):"destroy"===n.type&&(r=!1))):"init"===t.type&&i.length&&(n=i[i.length-1],n.namespace===t.namespace&&"init"===n.type&&i.pop())}return r&&i.push(t),r}});Zt.RenderQueue=de;var fe=Zt.EmitterMixin={on:function(e,n){return t(this).on(e,this._prepareIntercept(n)),this},one:function(e,n){return t(this).one(e,this._prepareIntercept(n)),this},_prepareIntercept:function(e){var n=function(t,n){return e.apply(n.context||this,n.args||[])};return e.guid||(e.guid=t.guid++),n.guid=e.guid,n},
+off:function(e,n){return t(this).off(e,n),this},trigger:function(e){var n=Array.prototype.slice.call(arguments,1);return t(this).triggerHandler(e,{args:n}),this},triggerWith:function(e,n,i){return t(this).triggerHandler(e,{context:n,args:i}),this}},ge=Zt.ListenerMixin=function(){var e=0;return{listenerId:null,listenTo:function(e,n,i){if("object"==typeof n)for(var r in n)n.hasOwnProperty(r)&&this.listenTo(e,r,n[r]);else"string"==typeof n&&e.on(n+"."+this.getListenerNamespace(),t.proxy(i,this))},stopListeningTo:function(t,e){t.off((e||"")+"."+this.getListenerNamespace())},getListenerNamespace:function(){return null==this.listenerId&&(this.listenerId=e++),"_listener"+this.listenerId}}}(),pe=bt.extend(ge,{isHidden:!0,options:null,el:null,margin:10,constructor:function(t){this.options=t||{}},show:function(){this.isHidden&&(this.el||this.render(),this.el.show(),this.position(),this.isHidden=!1,this.trigger("show"))},hide:function(){this.isHidden||(this.el.hide(),this.isHidden=!0,this.trigger("hide"))},render:function(){var e=this,n=this.options;this.el=t('<div class="fc-popover"/>').addClass(n.className||"").css({top:0,left:0}).append(n.content).appendTo(n.parentEl),this.el.on("click",".fc-close",function(){e.hide()}),n.autoHide&&this.listenTo(t(document),"mousedown",this.documentMousedown)},documentMousedown:function(e){this.el&&!t(e.target).closest(this.el).length&&this.hide()},removeElement:function(){this.hide(),this.el&&(this.el.remove(),this.el=null),this.stopListeningTo(t(document),"mousedown")},position:function(){var e,n,i,r,s,o=this.options,a=this.el.offsetParent().offset(),l=this.el.outerWidth(),u=this.el.outerHeight(),h=t(window),d=c(this.el);r=o.top||0,s=void 0!==o.left?o.left:void 0!==o.right?o.right-l:0,d.is(window)||d.is(document)?(d=h,e=0,n=0):(i=d.offset(),e=i.top,n=i.left),e+=h.scrollTop(),n+=h.scrollLeft(),!1!==o.viewportConstrain&&(r=Math.min(r,e+d.outerHeight()-u-this.margin),r=Math.max(r,e+this.margin),s=Math.min(s,n+d.outerWidth()-l-this.margin),s=Math.max(s,n+this.margin)),this.el.css({top:r-a.top,left:s-a.left})},trigger:function(t){this.options[t]&&this.options[t].apply(this,Array.prototype.slice.call(arguments,1))}}),ve=Zt.CoordCache=bt.extend({els:null,forcedOffsetParentEl:null,origin:null,boundingRect:null,isHorizontal:!1,isVertical:!1,lefts:null,rights:null,tops:null,bottoms:null,constructor:function(e){this.els=t(e.els),this.isHorizontal=e.isHorizontal,this.isVertical=e.isVertical,this.forcedOffsetParentEl=e.offsetParent?t(e.offsetParent):null},build:function(){var t=this.forcedOffsetParentEl;!t&&this.els.length>0&&(t=this.els.eq(0).offsetParent()),this.origin=t?t.offset():null,this.boundingRect=this.queryBoundingRect(),this.isHorizontal&&this.buildElHorizontals(),this.isVertical&&this.buildElVerticals()},clear:function(){this.origin=null,this.boundingRect=null,this.lefts=null,this.rights=null,this.tops=null,this.bottoms=null},ensureBuilt:function(){this.origin||this.build()},buildElHorizontals:function(){var e=[],n=[];this.els.each(function(i,r){var s=t(r),o=s.offset().left,a=s.outerWidth();e.push(o),n.push(o+a)}),this.lefts=e,this.rights=n},buildElVerticals:function(){var e=[],n=[];this.els.each(function(i,r){var s=t(r),o=s.offset().top,a=s.outerHeight();e.push(o),n.push(o+a)}),this.tops=e,this.bottoms=n},getHorizontalIndex:function(t){this.ensureBuilt();var e,n=this.lefts,i=this.rights,r=n.length;for(e=0;e<r;e++)if(t>=n[e]&&t<i[e])return e},getVerticalIndex:function(t){this.ensureBuilt();var e,n=this.tops,i=this.bottoms,r=n.length;for(e=0;e<r;e++)if(t>=n[e]&&t<i[e])return e},getLeftOffset:function(t){return this.ensureBuilt(),this.lefts[t]},getLeftPosition:function(t){return this.ensureBuilt(),this.lefts[t]-this.origin.left},getRightOffset:function(t){return this.ensureBuilt(),this.rights[t]},getRightPosition:function(t){return this.ensureBuilt(),this.rights[t]-this.origin.left},getWidth:function(t){return this.ensureBuilt(),this.rights[t]-this.lefts[t]},getTopOffset:function(t){return this.ensureBuilt(),this.tops[t]},getTopPosition:function(t){return this.ensureBuilt(),this.tops[t]-this.origin.top},getBottomOffset:function(t){return this.ensureBuilt(),this.bottoms[t]},getBottomPosition:function(t){return this.ensureBuilt(),this.bottoms[t]-this.origin.top},getHeight:function(t){return this.ensureBuilt(),this.bottoms[t]-this.tops[t]},queryBoundingRect:function(){var t;return this.els.length>0&&(t=c(this.els.eq(0)),!t.is(document))?f(t):null},isPointInBounds:function(t,e){return this.isLeftInBounds(t)&&this.isTopInBounds(e)},isLeftInBounds:function(t){return!this.boundingRect||t>=this.boundingRect.left&&t<this.boundingRect.right},isTopInBounds:function(t){return!this.boundingRect||t>=this.boundingRect.top&&t<this.boundingRect.bottom}}),me=Zt.DragListener=bt.extend(ge,{options:null,subjectEl:null,originX:null,originY:null,scrollEl:null,isInteracting:!1,isDistanceSurpassed:!1,isDelayEnded:!1,isDragging:!1,isTouch:!1,isGeneric:!1,delay:null,delayTimeoutId:null,minDistance:null,shouldCancelTouchScroll:!0,scrollAlwaysKills:!1,constructor:function(t){this.options=t||{}},startInteraction:function(e,n){if("mousedown"===e.type){if(we.get().shouldIgnoreMouse())return;if(!S(e))return;e.preventDefault()}this.isInteracting||(n=n||{},this.delay=ut(n.delay,this.options.delay,0),this.minDistance=ut(n.distance,this.options.distance,0),this.subjectEl=this.options.subjectEl,T(t("body")),this.isInteracting=!0,this.isTouch=D(e),this.isGeneric="dragstart"===e.type,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.originX=b(e),this.originY=E(e),this.scrollEl=c(t(e.target)),this.bindHandlers(),this.initAutoScroll(),this.handleInteractionStart(e),this.startDelay(e),this.minDistance||this.handleDistanceSurpassed(e))},handleInteractionStart:function(t){this.trigger("interactionStart",t)},endInteraction:function(e,n){this.isInteracting&&(this.endDrag(e),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null),this.destroyAutoScroll(),this.unbindHandlers(),this.isInteracting=!1,this.handleInteractionEnd(e,n),C(t("body")))},handleInteractionEnd:function(t,e){this.trigger("interactionEnd",t,e||!1)},bindHandlers:function(){var e=we.get();this.isGeneric?this.listenTo(t(document),{drag:this.handleMove,dragstop:this.endInteraction}):this.isTouch?this.listenTo(e,{touchmove:this.handleTouchMove,touchend:this.endInteraction,scroll:this.handleTouchScroll}):this.listenTo(e,{mousemove:this.handleMouseMove,mouseup:this.endInteraction}),this.listenTo(e,{selectstart:H,contextmenu:H})},unbindHandlers:function(){this.stopListeningTo(we.get()),this.stopListeningTo(t(document))},startDrag:function(t,e){this.startInteraction(t,e),this.isDragging||(this.isDragging=!0,this.handleDragStart(t))},handleDragStart:function(t){this.trigger("dragStart",t)},handleMove:function(t){var e=b(t)-this.originX,n=E(t)-this.originY,i=this.minDistance;this.isDistanceSurpassed||e*e+n*n>=i*i&&this.handleDistanceSurpassed(t),this.isDragging&&this.handleDrag(e,n,t)},handleDrag:function(t,e,n){this.trigger("drag",t,e,n),this.updateAutoScroll(n)},endDrag:function(t){this.isDragging&&(this.isDragging=!1,this.handleDragEnd(t))},handleDragEnd:function(t){this.trigger("dragEnd",t)},startDelay:function(t){var e=this;this.delay?this.delayTimeoutId=setTimeout(function(){e.handleDelayEnd(t)},this.delay):this.handleDelayEnd(t)},handleDelayEnd:function(t){this.isDelayEnded=!0,this.isDistanceSurpassed&&this.startDrag(t)},handleDistanceSurpassed:function(t){this.isDistanceSurpassed=!0,this.isDelayEnded&&this.startDrag(t)},handleTouchMove:function(t){this.isDragging&&this.shouldCancelTouchScroll&&t.preventDefault(),this.handleMove(t)},handleMouseMove:function(t){this.handleMove(t)},handleTouchScroll:function(t){this.isDragging&&!this.scrollAlwaysKills||this.endInteraction(t,!0)},trigger:function(t){this.options[t]&&this.options[t].apply(this,Array.prototype.slice.call(arguments,1)),this["_"+t]&&this["_"+t].apply(this,Array.prototype.slice.call(arguments,1))}});me.mixin({isAutoScroll:!1,scrollBounds:null,scrollTopVel:null,scrollLeftVel:null,scrollIntervalId:null,scrollSensitivity:30,scrollSpeed:200,scrollIntervalMs:50,initAutoScroll:function(){var t=this.scrollEl;this.isAutoScroll=this.options.scroll&&t&&!t.is(window)&&!t.is(document),this.isAutoScroll&&this.listenTo(t,"scroll",yt(this.handleDebouncedScroll,100))},destroyAutoScroll:function(){this.endAutoScroll(),this.isAutoScroll&&this.stopListeningTo(this.scrollEl,"scroll")},computeScrollBounds:function(){this.isAutoScroll&&(this.scrollBounds=d(this.scrollEl))},updateAutoScroll:function(t){var e,n,i,r,s=this.scrollSensitivity,o=this.scrollBounds,a=0,l=0;o&&(e=(s-(E(t)-o.top))/s,n=(s-(o.bottom-E(t)))/s,i=(s-(b(t)-o.left))/s,r=(s-(o.right-b(t)))/s,e>=0&&e<=1?a=e*this.scrollSpeed*-1:n>=0&&n<=1&&(a=n*this.scrollSpeed),i>=0&&i<=1?l=i*this.scrollSpeed*-1:r>=0&&r<=1&&(l=r*this.scrollSpeed)),this.setScrollVel(a,l)},setScrollVel:function(t,e){this.scrollTopVel=t,this.scrollLeftVel=e,this.constrainScrollVel(),!this.scrollTopVel&&!this.scrollLeftVel||this.scrollIntervalId||(this.scrollIntervalId=setInterval(mt(this,"scrollIntervalFunc"),this.scrollIntervalMs))},constrainScrollVel:function(){var t=this.scrollEl;this.scrollTopVel<0?t.scrollTop()<=0&&(this.scrollTopVel=0):this.scrollTopVel>0&&t.scrollTop()+t[0].clientHeight>=t[0].scrollHeight&&(this.scrollTopVel=0),this.scrollLeftVel<0?t.scrollLeft()<=0&&(this.scrollLeftVel=0):this.scrollLeftVel>0&&t.scrollLeft()+t[0].clientWidth>=t[0].scrollWidth&&(this.scrollLeftVel=0)},scrollIntervalFunc:function(){var t=this.scrollEl,e=this.scrollIntervalMs/1e3;this.scrollTopVel&&t.scrollTop(t.scrollTop()+this.scrollTopVel*e),this.scrollLeftVel&&t.scrollLeft(t.scrollLeft()+this.scrollLeftVel*e),this.constrainScrollVel(),this.scrollTopVel||this.scrollLeftVel||this.endAutoScroll()},endAutoScroll:function(){this.scrollIntervalId&&(clearInterval(this.scrollIntervalId),this.scrollIntervalId=null,this.handleScrollEnd())},handleDebouncedScroll:function(){this.scrollIntervalId||this.handleScrollEnd()},handleScrollEnd:function(){}});var ye=me.extend({component:null,origHit:null,hit:null,coordAdjust:null,constructor:function(t,e){me.call(this,e),this.component=t},handleInteractionStart:function(t){var e,n,i,r=this.subjectEl;this.component.hitsNeeded(),this.computeScrollBounds(),t?(n={left:b(t),top:E(t)},i=n,r&&(e=d(r),i=x(i,e)),this.origHit=this.queryHit(i.left,i.top),r&&this.options.subjectCenter&&(this.origHit&&(e=R(this.origHit,e)||e),i=I(e)),this.coordAdjust=k(i,n)):(this.origHit=null,this.coordAdjust=null),me.prototype.handleInteractionStart.apply(this,arguments)},handleDragStart:function(t){var e;me.prototype.handleDragStart.apply(this,arguments),(e=this.queryHit(b(t),E(t)))&&this.handleHitOver(e)},handleDrag:function(t,e,n){var i;me.prototype.handleDrag.apply(this,arguments),i=this.queryHit(b(n),E(n)),Ht(i,this.hit)||(this.hit&&this.handleHitOut(),i&&this.handleHitOver(i))},handleDragEnd:function(){this.handleHitDone(),me.prototype.handleDragEnd.apply(this,arguments)},handleHitOver:function(t){var e=Ht(t,this.origHit);this.hit=t,this.trigger("hitOver",this.hit,e,this.origHit)},handleHitOut:function(){this.hit&&(this.trigger("hitOut",this.hit),this.handleHitDone(),this.hit=null)},handleHitDone:function(){this.hit&&this.trigger("hitDone",this.hit)},handleInteractionEnd:function(){me.prototype.handleInteractionEnd.apply(this,arguments),this.origHit=null,this.hit=null,this.component.hitsNotNeeded()},handleScrollEnd:function(){me.prototype.handleScrollEnd.apply(this,arguments),this.isDragging&&(this.component.releaseHits(),this.component.prepareHits())},queryHit:function(t,e){return this.coordAdjust&&(t+=this.coordAdjust.left,e+=this.coordAdjust.top),this.component.queryHit(t,e)}});Zt.touchMouseIgnoreWait=500;var we=bt.extend(ge,fe,{isTouching:!1,mouseIgnoreDepth:0,handleScrollProxy:null,bind:function(){var e=this;this.listenTo(t(document),{touchstart:this.handleTouchStart,touchcancel:this.handleTouchCancel,touchend:this.handleTouchEnd,mousedown:this.handleMouseDown,mousemove:this.handleMouseMove,mouseup:this.handleMouseUp,click:this.handleClick,selectstart:this.handleSelectStart,contextmenu:this.handleContextMenu}),window.addEventListener("touchmove",this.handleTouchMoveProxy=function(n){e.handleTouchMove(t.Event(n))},{passive:!1}),window.addEventListener("scroll",this.handleScrollProxy=function(n){e.handleScroll(t.Event(n))},!0)},unbind:function(){this.stopListeningTo(t(document)),window.removeEventListener("touchmove",this.handleTouchMoveProxy),window.removeEventListener("scroll",this.handleScrollProxy,!0)},handleTouchStart:function(t){this.stopTouch(t,!0),this.isTouching=!0,this.trigger("touchstart",t)},handleTouchMove:function(t){this.isTouching&&this.trigger("touchmove",t)},handleTouchCancel:function(t){this.isTouching&&(this.trigger("touchcancel",t),this.stopTouch(t))},handleTouchEnd:function(t){this.stopTouch(t)},handleMouseDown:function(t){this.shouldIgnoreMouse()||this.trigger("mousedown",t)},handleMouseMove:function(t){this.shouldIgnoreMouse()||this.trigger("mousemove",t)},handleMouseUp:function(t){this.shouldIgnoreMouse()||this.trigger("mouseup",t)},handleClick:function(t){this.shouldIgnoreMouse()||this.trigger("click",t)},handleSelectStart:function(t){this.trigger("selectstart",t)},handleContextMenu:function(t){this.trigger("contextmenu",t)},handleScroll:function(t){this.trigger("scroll",t)},stopTouch:function(t,e){this.isTouching&&(this.isTouching=!1,this.trigger("touchend",t),e||this.startTouchMouseIgnore())},startTouchMouseIgnore:function(){var t=this,e=Zt.touchMouseIgnoreWait;e&&(this.mouseIgnoreDepth++,setTimeout(function(){t.mouseIgnoreDepth--},e))},shouldIgnoreMouse:function(){return this.isTouching||Boolean(this.mouseIgnoreDepth)}});!function(){var t=null,e=0;we.get=function(){return t||(t=new we,t.bind()),t},we.needed=function(){we.get(),e++},we.unneeded=function(){--e||(t.unbind(),t=null)}}();var Se=bt.extend(ge,{options:null,sourceEl:null,el:null,parentEl:null,top0:null,left0:null,y0:null,x0:null,topDelta:null,leftDelta:null,isFollowing:!1,isHidden:!1,isAnimating:!1,constructor:function(e,n){this.options=n=n||{},this.sourceEl=e,this.parentEl=n.parentEl?t(n.parentEl):e.parent()},start:function(e){this.isFollowing||(this.isFollowing=!0,this.y0=E(e),this.x0=b(e),this.topDelta=0,this.leftDelta=0,this.isHidden||this.updatePosition(),D(e)?this.listenTo(t(document),"touchmove",this.handleMove):this.listenTo(t(document),"mousemove",this.handleMove))},stop:function(e,n){function i(){r.isAnimating=!1,r.removeElement(),r.top0=r.left0=null,n&&n()}var r=this,s=this.options.revertDuration;this.isFollowing&&!this.isAnimating&&(this.isFollowing=!1,this.stopListeningTo(t(document)),e&&s&&!this.isHidden?(this.isAnimating=!0,this.el.animate({top:this.top0,left:this.left0},{duration:s,complete:i})):i())},getEl:function(){var t=this.el;return t||(t=this.el=this.sourceEl.clone().addClass(this.options.additionalClass||"").css({position:"absolute",visibility:"",display:this.isHidden?"none":"",margin:0,right:"auto",bottom:"auto",width:this.sourceEl.width(),height:this.sourceEl.height(),opacity:this.options.opacity||"",zIndex:this.options.zIndex}),t.addClass("fc-unselectable"),t.appendTo(this.parentEl)),t},removeElement:function(){this.el&&(this.el.remove(),this.el=null)},updatePosition:function(){var t,e;this.getEl(),null===this.top0&&(t=this.sourceEl.offset(),e=this.el.offsetParent().offset(),this.top0=t.top-e.top,this.left0=t.left-e.left),this.el.css({top:this.top0+this.topDelta,left:this.left0+this.leftDelta})},handleMove:function(t){this.topDelta=E(t)-this.y0,this.leftDelta=b(t)-this.x0,this.isHidden||this.updatePosition()},hide:function(){this.isHidden||(this.isHidden=!0,this.el&&this.el.hide())},show:function(){this.isHidden&&(this.isHidden=!1,this.updatePosition(),this.getEl().show())}}),be=Zt.Grid=bt.extend(ge,{hasDayInteractions:!0,view:null,isRTL:null,start:null,end:null,el:null,elsByFill:null,eventTimeFormat:null,displayEventTime:null,displayEventEnd:null,minResizeDuration:null,largeUnit:null,dayClickListener:null,daySelectListener:null,segDragListener:null,segResizeListener:null,externalDragListener:null,constructor:function(t){this.view=t,this.isRTL=t.opt("isRTL"),this.elsByFill={},this.dayClickListener=this.buildDayClickListener(),this.daySelectListener=this.buildDaySelectListener()},computeEventTimeFormat:function(){return this.view.opt("smallTimeFormat")},computeDisplayEventTime:function(){return!0},computeDisplayEventEnd:function(){return!0},setRange:function(t){this.start=t.start.clone(),this.end=t.end.clone(),this.rangeUpdated(),this.processRangeOptions()},rangeUpdated:function(){},processRangeOptions:function(){var t,e,n=this.view;this.eventTimeFormat=n.opt("eventTimeFormat")||n.opt("timeFormat")||this.computeEventTimeFormat(),t=n.opt("displayEventTime"),null==t&&(t=this.computeDisplayEventTime()),e=n.opt("displayEventEnd"),null==e&&(e=this.computeDisplayEventEnd()),this.displayEventTime=t,this.displayEventEnd=e},spanToSegs:function(t){},diffDates:function(t,e){return this.largeUnit?G(t,e,this.largeUnit):F(t,e)},hitsNeededDepth:0,hitsNeeded:function(){this.hitsNeededDepth++||this.prepareHits()},hitsNotNeeded:function(){this.hitsNeededDepth&&!--this.hitsNeededDepth&&this.releaseHits()},prepareHits:function(){},releaseHits:function(){},queryHit:function(t,e){},getSafeHitSpan:function(t){var e=this.getHitSpan(t);return Q(e,this.view.activeRange)?e:null},getHitSpan:function(t){},getHitEl:function(t){},setElement:function(t){this.el=t,this.hasDayInteractions&&(T(t),this.bindDayHandler("touchstart",this.dayTouchStart),this.bindDayHandler("mousedown",this.dayMousedown)),this.bindSegHandlers(),this.bindGlobalHandlers()},bindDayHandler:function(e,n){var i=this;this.el.on(e,function(e){if(!t(e.target).is(i.segSelector+","+i.segSelector+" *,.fc-more,a[data-goto]"))return n.call(i,e)})},removeElement:function(){this.unbindGlobalHandlers(),this.clearDragListeners(),this.el.remove()},renderSkeleton:function(){},renderDates:function(){},unrenderDates:function(){},bindGlobalHandlers:function(){this.listenTo(t(document),{dragstart:this.externalDragStart,sortstart:this.externalDragStart})},unbindGlobalHandlers:function(){this.stopListeningTo(t(document))},dayMousedown:function(t){var e=this.view;we.get().shouldIgnoreMouse()||(this.dayClickListener.startInteraction(t),e.opt("selectable")&&this.daySelectListener.startInteraction(t,{distance:e.opt("selectMinDistance")}))},dayTouchStart:function(t){var e,n=this.view;n.isSelected||n.selectedEvent||(e=n.opt("selectLongPressDelay"),null==e&&(e=n.opt("longPressDelay")),this.dayClickListener.startInteraction(t),n.opt("selectable")&&this.daySelectListener.startInteraction(t,{delay:e}))},buildDayClickListener:function(){var t,e=this,n=this.view,i=new ye(this,{scroll:n.opt("dragScroll"),interactionStart:function(){t=i.origHit},hitOver:function(e,n,i){n||(t=null)},hitOut:function(){t=null},interactionEnd:function(i,r){var s;!r&&t&&(s=e.getSafeHitSpan(t))&&n.triggerDayClick(s,e.getHitEl(t),i)}});return i.shouldCancelTouchScroll=!1,i.scrollAlwaysKills=!0,i},buildDaySelectListener:function(){var t,e=this,n=this.view;return new ye(this,{scroll:n.opt("dragScroll"),interactionStart:function(){t=null},dragStart:function(){n.unselect()},hitOver:function(n,i,r){var o,a;r&&(o=e.getSafeHitSpan(r),a=e.getSafeHitSpan(n),t=o&&a?e.computeSelection(o,a):null,t?e.renderSelection(t):!1===t&&s())},hitOut:function(){t=null,e.unrenderSelection()},hitDone:function(){o()},interactionEnd:function(e,i){!i&&t&&n.reportSelection(t,e)}})},clearDragListeners:function(){this.dayClickListener.endInteraction(),this.daySelectListener.endInteraction(),this.segDragListener&&this.segDragListener.endInteraction(),this.segResizeListener&&this.segResizeListener.endInteraction(),this.externalDragListener&&this.externalDragListener.endInteraction()},renderEventLocationHelper:function(t,e){var n=this.fabricateHelperEvent(t,e);return this.renderHelper(n,e)},fabricateHelperEvent:function(t,e){var n=e?rt(e.event):{};return n.start=t.start.clone(),n.end=t.end?t.end.clone():null,n.allDay=null,this.view.calendar.normalizeEventDates(n),n.className=(n.className||[]).concat("fc-helper"),e||(n.editable=!1),n},renderHelper:function(t,e){},unrenderHelper:function(){},renderSelection:function(t){this.renderHighlight(t)},unrenderSelection:function(){this.unrenderHighlight()},computeSelection:function(t,e){var n=this.computeSelectionSpan(t,e);return!(n&&!this.view.calendar.isSelectionSpanAllowed(n))&&n},computeSelectionSpan:function(t,e){var n=[t.start,t.end,e.start,e.end];return n.sort(pt),{start:n[0].clone(),end:n[3].clone()}},renderHighlight:function(t){this.renderFill("highlight",this.spanToSegs(t))},unrenderHighlight:function(){this.unrenderFill("highlight")},highlightSegClasses:function(){return["fc-highlight"]},renderBusinessHours:function(){},unrenderBusinessHours:function(){},getNowIndicatorUnit:function(){},renderNowIndicator:function(t){},unrenderNowIndicator:function(){},renderFill:function(t,e){},unrenderFill:function(t){var e=this.elsByFill[t];e&&(e.remove(),delete this.elsByFill[t])},renderFillSegEls:function(e,n){var i,r=this,s=this[e+"SegEl"],o="",a=[];if(n.length){for(i=0;i<n.length;i++)o+=this.fillSegHtml(e,n[i]);t(o).each(function(e,i){var o=n[e],l=t(i);s&&(l=s.call(r,o,l)),l&&(l=t(l),l.is(r.fillSegTag)&&(o.el=l,a.push(o)))})}return a},fillSegTag:"div",fillSegHtml:function(t,e){var n=this[t+"SegClasses"],i=this[t+"SegCss"],r=n?n.call(this,e):[],s=dt(i?i.call(this,e):{});return"<"+this.fillSegTag+(r.length?' class="'+r.join(" ")+'"':"")+(s?' style="'+s+'"':"")+" />"},getDayClasses:function(t,e){var n,i=this.view,r=[];return Z(t,i.activeRange)?(r.push("fc-"+Kt[t.day()]),1==i.currentRangeAs("months")&&t.month()!=i.currentRange.start.month()&&r.push("fc-other-month"),n=i.calendar.getNow(),t.isSame(n,"day")?(r.push("fc-today"),!0!==e&&r.push(i.highlightStateClass)):t<n?r.push("fc-past"):r.push("fc-future")):r.push("fc-disabled-day"),r}});be.mixin({segSelector:".fc-event-container > *",mousedOverSeg:null,isDraggingSeg:!1,isResizingSeg:!1,isDraggingExternal:!1,segs:null,renderEvents:function(t){var e,n=[],i=[];for(e=0;e<t.length;e++)(It(t[e])?n:i).push(t[e]);this.segs=[].concat(this.renderBgEvents(n),this.renderFgEvents(i))},renderBgEvents:function(t){var e=this.eventsToSegs(t);return this.renderBgSegs(e)||e},renderFgEvents:function(t){var e=this.eventsToSegs(t);return this.renderFgSegs(e)||e},unrenderEvents:function(){this.handleSegMouseout(),this.clearDragListeners(),this.unrenderFgSegs(),this.unrenderBgSegs(),this.segs=null},getEventSegs:function(){return this.segs||[]},renderFgSegs:function(t){},unrenderFgSegs:function(){},renderFgSegEls:function(e,n){var i,r=this.view,s="",o=[];if(e.length){for(i=0;i<e.length;i++)s+=this.fgSegHtml(e[i],n);t(s).each(function(n,i){var s=e[n],a=r.resolveEventEl(s.event,t(i));a&&(a.data("fc-seg",s),s.el=a,o.push(s))})}return o},fgSegHtml:function(t,e){},renderBgSegs:function(t){return this.renderFill("bgEvent",t)},unrenderBgSegs:function(){this.unrenderFill("bgEvent")},bgEventSegEl:function(t,e){return this.view.resolveEventEl(t.event,e)},bgEventSegClasses:function(t){var e=t.event,n=e.source||{};return["fc-bgevent"].concat(e.className,n.className||[])},bgEventSegCss:function(t){return{"background-color":this.getSegSkinCss(t)["background-color"]}},businessHoursSegClasses:function(t){return["fc-nonbusiness","fc-bgevent"]},buildBusinessHourSegs:function(t,e){return this.eventsToSegs(this.buildBusinessHourEvents(t,e))},buildBusinessHourEvents:function(e,n){var i,r=this.view.calendar;return null==n&&(n=r.opt("businessHours")),i=r.computeBusinessHourEvents(e,n),!i.length&&n&&(i=[t.extend({},Ne,{start:this.view.activeRange.end,end:this.view.activeRange.end,dow:null})]),i},bindSegHandlers:function(){this.bindSegHandlersToEl(this.el)},bindSegHandlersToEl:function(t){this.bindSegHandlerToEl(t,"touchstart",this.handleSegTouchStart),this.bindSegHandlerToEl(t,"mouseenter",this.handleSegMouseover),this.bindSegHandlerToEl(t,"mouseleave",this.handleSegMouseout),this.bindSegHandlerToEl(t,"mousedown",this.handleSegMousedown),this.bindSegHandlerToEl(t,"click",this.handleSegClick)},bindSegHandlerToEl:function(e,n,i){var r=this;e.on(n,this.segSelector,function(e){var n=t(this).data("fc-seg");if(n&&!r.isDraggingSeg&&!r.isResizingSeg)return i.call(r,n,e)})},handleSegClick:function(t,e){!1===this.view.publiclyTrigger("eventClick",t.el[0],t.event,e)&&e.preventDefault()},handleSegMouseover:function(t,e){we.get().shouldIgnoreMouse()||this.mousedOverSeg||(this.mousedOverSeg=t,this.view.isEventResizable(t.event)&&t.el.addClass("fc-allow-mouse-resize"),this.view.publiclyTrigger("eventMouseover",t.el[0],t.event,e))},handleSegMouseout:function(t,e){e=e||{},this.mousedOverSeg&&(t=t||this.mousedOverSeg,this.mousedOverSeg=null,this.view.isEventResizable(t.event)&&t.el.removeClass("fc-allow-mouse-resize"),this.view.publiclyTrigger("eventMouseout",t.el[0],t.event,e))},handleSegMousedown:function(t,e){!this.startSegResize(t,e,{distance:5})&&this.view.isEventDraggable(t.event)&&this.buildSegDragListener(t).startInteraction(e,{distance:5})},handleSegTouchStart:function(t,e){var n,i,r=this.view,s=t.event,o=r.isEventSelected(s),a=r.isEventDraggable(s),l=r.isEventResizable(s),u=!1;o&&l&&(u=this.startSegResize(t,e)),u||!a&&!l||(i=r.opt("eventLongPressDelay"),null==i&&(i=r.opt("longPressDelay")),n=a?this.buildSegDragListener(t):this.buildSegSelectListener(t),n.startInteraction(e,{delay:o?0:i}))},startSegResize:function(e,n,i){return!!t(n.target).is(".fc-resizer")&&(this.buildSegResizeListener(e,t(n.target).is(".fc-start-resizer")).startInteraction(n,i),!0)},buildSegDragListener:function(t){var e,n,i,r=this,a=this.view,l=t.el,u=t.event;if(this.segDragListener)return this.segDragListener;var h=this.segDragListener=new ye(a,{scroll:a.opt("dragScroll"),subjectEl:l,subjectCenter:!0,interactionStart:function(i){t.component=r,e=!1,n=new Se(t.el,{additionalClass:"fc-dragging",parentEl:a.el,opacity:h.isTouch?null:a.opt("dragOpacity"),revertDuration:a.opt("dragRevertDuration"),zIndex:2}),n.hide(),n.start(i)},dragStart:function(n){h.isTouch&&!a.isEventSelected(u)&&a.selectEvent(u),e=!0,r.handleSegMouseout(t,n),r.segDragStart(t,n),a.hideEvent(u)},hitOver:function(e,o,l){var c,d,f,g=!0;t.hit&&(l=t.hit),c=l.component.getSafeHitSpan(l),d=e.component.getSafeHitSpan(e),c&&d?(i=r.computeEventDrop(c,d,u),g=i&&r.isEventLocationAllowed(i,u)):g=!1,g||(i=null,s()),i&&(f=a.renderDrag(i,t))?(f.addClass("fc-dragging"),h.isTouch||r.applyDragOpacity(f),n.hide()):n.show(),o&&(i=null)},hitOut:function(){a.unrenderDrag(),n.show(),i=null},hitDone:function(){o()},interactionEnd:function(s){delete t.component,n.stop(!i,function(){e&&(a.unrenderDrag(),r.segDragStop(t,s)),i?a.reportSegDrop(t,i,r.largeUnit,l,s):a.showEvent(u)}),r.segDragListener=null}});return h},buildSegSelectListener:function(t){var e=this,n=this.view,i=t.event;if(this.segDragListener)return this.segDragListener;var r=this.segDragListener=new me({dragStart:function(t){r.isTouch&&!n.isEventSelected(i)&&n.selectEvent(i)},interactionEnd:function(t){e.segDragListener=null}});return r},segDragStart:function(t,e){this.isDraggingSeg=!0,this.view.publiclyTrigger("eventDragStart",t.el[0],t.event,e,{})},segDragStop:function(t,e){this.isDraggingSeg=!1,this.view.publiclyTrigger("eventDragStop",t.el[0],t.event,e,{})},computeEventDrop:function(t,e,n){var i,r,s=this.view.calendar,o=t.start,a=e.start;return o.hasTime()===a.hasTime()?(i=this.diffDates(a,o),n.allDay&&tt(i)?(r={start:n.start.clone(),end:s.getEventEnd(n),allDay:!1},s.normalizeEventTimes(r)):r=xt(n),r.start.add(i),r.end&&r.end.add(i)):r={start:a.clone(),end:null,allDay:!a.hasTime()},r},applyDragOpacity:function(t){var e=this.view.opt("dragOpacity");null!=e&&t.css("opacity",e)},externalDragStart:function(e,n){var i,r,s=this.view;s.opt("droppable")&&(i=t((n?n.item:null)||e.target),r=s.opt("dropAccept"),(t.isFunction(r)?r.call(i[0],i):i.is(r))&&(this.isDraggingExternal||this.listenToExternalDrag(i,e,n)))},listenToExternalDrag:function(t,e,n){var i,r=this,a=this.view,l=Nt(t);(r.externalDragListener=new ye(this,{interactionStart:function(){r.isDraggingExternal=!0},hitOver:function(t){var e=!0,n=t.component.getSafeHitSpan(t);n?(i=r.computeExternalDrop(n,l),e=i&&r.isExternalLocationAllowed(i,l.eventProps)):e=!1,e||(i=null,s()),i&&r.renderDrag(i)},hitOut:function(){i=null},hitDone:function(){o(),r.unrenderDrag()},interactionEnd:function(e){i&&a.reportExternalDrop(l,i,t,e,n),r.isDraggingExternal=!1,r.externalDragListener=null}})).startDrag(e)},computeExternalDrop:function(t,e){var n=this.view.calendar,i={start:n.applyTimezone(t.start),end:null};return e.startTime&&!i.start.hasTime()&&i.start.time(e.startTime),e.duration&&(i.end=i.start.clone().add(e.duration)),i},renderDrag:function(t,e){},unrenderDrag:function(){},buildSegResizeListener:function(t,e){var n,i,r=this,a=this.view,l=a.calendar,u=t.el,h=t.event,c=l.getEventEnd(h);return this.segResizeListener=new ye(this,{scroll:a.opt("dragScroll"),subjectEl:u,interactionStart:function(){n=!1},dragStart:function(e){n=!0,r.handleSegMouseout(t,e),r.segResizeStart(t,e)},hitOver:function(n,o,l){var u=!0,d=r.getSafeHitSpan(l),f=r.getSafeHitSpan(n);d&&f?(i=e?r.computeEventStartResize(d,f,h):r.computeEventEndResize(d,f,h),u=i&&r.isEventLocationAllowed(i,h)):u=!1,u?i.start.isSame(h.start.clone().stripZone())&&i.end.isSame(c.clone().stripZone())&&(i=null):(i=null,s()),i&&(a.hideEvent(h),r.renderEventResize(i,t))},hitOut:function(){i=null,a.showEvent(h)},hitDone:function(){r.unrenderEventResize(),o()},interactionEnd:function(e){n&&r.segResizeStop(t,e),i?a.reportSegResize(t,i,r.largeUnit,u,e):a.showEvent(h),r.segResizeListener=null}})},segResizeStart:function(t,e){this.isResizingSeg=!0,this.view.publiclyTrigger("eventResizeStart",t.el[0],t.event,e,{})},segResizeStop:function(t,e){this.isResizingSeg=!1,this.view.publiclyTrigger("eventResizeStop",t.el[0],t.event,e,{})},computeEventStartResize:function(t,e,n){return this.computeEventResize("start",t,e,n)},computeEventEndResize:function(t,e,n){return this.computeEventResize("end",t,e,n)},computeEventResize:function(t,e,n,i){var r,s,o=this.view.calendar,a=this.diffDates(n[t],e[t]);return r={start:i.start.clone(),end:o.getEventEnd(i),allDay:i.allDay},r.allDay&&tt(a)&&(r.allDay=!1,o.normalizeEventTimes(r)),r[t].add(a),r.start.isBefore(r.end)||(s=this.minResizeDuration||(i.allDay?o.defaultAllDayEventDuration:o.defaultTimedEventDuration),"start"==t?r.start=r.end.clone().subtract(s):r.end=r.start.clone().add(s)),r},renderEventResize:function(t,e){},unrenderEventResize:function(){},getEventTimeText:function(t,e,n){return null==e&&(e=this.eventTimeFormat),null==n&&(n=this.displayEventEnd),this.displayEventTime&&t.start.hasTime()?n&&t.end?this.view.formatRange(t,e):t.start.format(e):""},getSegClasses:function(t,e,n){var i=this.view,r=["fc-event",t.isStart?"fc-start":"fc-not-start",t.isEnd?"fc-end":"fc-not-end"].concat(this.getSegCustomClasses(t));return e&&r.push("fc-draggable"),n&&r.push("fc-resizable"),i.isEventSelected(t.event)&&r.push("fc-selected"),r},getSegCustomClasses:function(t){var e=t.event;return[].concat(e.className,e.source?e.source.className:[])},getSegSkinCss:function(t){return{"background-color":this.getSegBackgroundColor(t),"border-color":this.getSegBorderColor(t),color:this.getSegTextColor(t)}},getSegBackgroundColor:function(t){return t.event.backgroundColor||t.event.color||this.getSegDefaultBackgroundColor(t)},getSegDefaultBackgroundColor:function(t){var e=t.event.source||{};return e.backgroundColor||e.color||this.view.opt("eventBackgroundColor")||this.view.opt("eventColor")},getSegBorderColor:function(t){return t.event.borderColor||t.event.color||this.getSegDefaultBorderColor(t)},getSegDefaultBorderColor:function(t){var e=t.event.source||{};return e.borderColor||e.color||this.view.opt("eventBorderColor")||this.view.opt("eventColor")},getSegTextColor:function(t){
+return t.event.textColor||this.getSegDefaultTextColor(t)},getSegDefaultTextColor:function(t){return(t.event.source||{}).textColor||this.view.opt("eventTextColor")},isEventLocationAllowed:function(t,e){if(this.isEventLocationInRange(t)){var n,i=this.view.calendar,r=this.eventToSpans(t);if(r.length){for(n=0;n<r.length;n++)if(!i.isEventSpanAllowed(r[n],e))return!1;return!0}}return!1},isExternalLocationAllowed:function(t,e){if(this.isEventLocationInRange(t)){var n,i=this.view.calendar,r=this.eventToSpans(t);if(r.length){for(n=0;n<r.length;n++)if(!i.isExternalSpanAllowed(r[n],t,e))return!1;return!0}}return!1},isEventLocationInRange:function(t){return Q(this.eventToRawRange(t),this.view.validRange)},eventToSegs:function(t){return this.eventsToSegs([t])},eventToSpans:function(t){var e=this.eventToRange(t);return e?this.eventRangeToSpans(e,t):[]},eventsToSegs:function(e,n){var i=this,r=Bt(e),s=[];return t.each(r,function(t,e){var r,o,a=[],l=[];for(o=0;o<e.length;o++)(r=i.eventToRange(e[o]))&&(l.push(r),a.push(e[o]));if(kt(e[0]))for(l=i.invertRanges(l),o=0;o<l.length;o++)s.push.apply(s,i.eventRangeToSegs(l[o],e[0],n));else for(o=0;o<l.length;o++)s.push.apply(s,i.eventRangeToSegs(l[o],a[o],n))}),s},eventToRange:function(t){return this.refineRawEventRange(this.eventToRawRange(t))},refineRawEventRange:function(t){var e=this.view,n=e.calendar,i=z(t,e.activeRange);if(i)return n.localizeMoment(i.start),n.localizeMoment(i.end),i},eventToRawRange:function(t){var e=this.view.calendar;return{start:t.start.clone().stripZone(),end:(t.end?t.end.clone():e.getDefaultEventEnd(null!=t.allDay?t.allDay:!t.start.hasTime(),t.start)).stripZone()}},eventRangeToSegs:function(t,e,n){var i,r=this.eventRangeToSpans(t,e),s=[];for(i=0;i<r.length;i++)s.push.apply(s,this.eventSpanToSegs(r[i],e,n));return s},eventRangeToSpans:function(e,n){return[t.extend({},e)]},eventSpanToSegs:function(t,e,n){var i,r,s=n?n(t):this.spanToSegs(t);for(i=0;i<s.length;i++)r=s[i],t.isStart||(r.isStart=!1),t.isEnd||(r.isEnd=!1),r.event=e,r.eventStartMS=+t.start,r.eventDurationMS=t.end-t.start;return s},invertRanges:function(t){var e,n,i=this.view,r=i.activeRange.start.clone(),s=i.activeRange.end.clone(),o=[],a=r;for(t.sort(Lt),e=0;e<t.length;e++)n=t[e],n.start>a&&o.push({start:a,end:n.start}),n.end>a&&(a=n.end);return a<s&&o.push({start:a,end:s}),o},sortEventSegs:function(t){t.sort(mt(this,"compareEventSegs"))},compareEventSegs:function(t,e){return t.eventStartMS-e.eventStartMS||e.eventDurationMS-t.eventDurationMS||e.event.allDay-t.event.allDay||B(t.event,e.event,this.view.eventOrderSpecs)}}),Zt.pluckEventDateProps=xt,Zt.isBgEvent=It,Zt.dataAttrPrefix="";var Ee=Zt.DayTableMixin={breakOnWeeks:!1,dayDates:null,dayIndices:null,daysPerRow:null,rowCnt:null,colCnt:null,colHeadFormat:null,updateDayTable:function(){for(var t,e,n,i=this.view,r=this.start.clone(),s=-1,o=[],a=[];r.isBefore(this.end);)i.isHiddenDay(r)?o.push(s+.5):(s++,o.push(s),a.push(r.clone())),r.add(1,"days");if(this.breakOnWeeks){for(e=a[0].day(),t=1;t<a.length&&a[t].day()!=e;t++);n=Math.ceil(a.length/t)}else n=1,t=a.length;this.dayDates=a,this.dayIndices=o,this.daysPerRow=t,this.rowCnt=n,this.updateDayTableCols()},updateDayTableCols:function(){this.colCnt=this.computeColCnt(),this.colHeadFormat=this.view.opt("columnFormat")||this.computeColHeadFormat()},computeColCnt:function(){return this.daysPerRow},getCellDate:function(t,e){return this.dayDates[this.getCellDayIndex(t,e)].clone()},getCellRange:function(t,e){var n=this.getCellDate(t,e);return{start:n,end:n.clone().add(1,"days")}},getCellDayIndex:function(t,e){return t*this.daysPerRow+this.getColDayIndex(e)},getColDayIndex:function(t){return this.isRTL?this.colCnt-1-t:t},getDateDayIndex:function(t){var e=this.dayIndices,n=t.diff(this.start,"days");return n<0?e[0]-1:n>=e.length?e[e.length-1]+1:e[n]},computeColHeadFormat:function(){return this.rowCnt>1||this.colCnt>10?"ddd":this.colCnt>1?this.view.opt("dayOfMonthFormat"):"dddd"},sliceRangeByRow:function(t){var e,n,i,r,s,o=this.daysPerRow,a=this.view.computeDayRange(t),l=this.getDateDayIndex(a.start),u=this.getDateDayIndex(a.end.clone().subtract(1,"days")),h=[];for(e=0;e<this.rowCnt;e++)n=e*o,i=n+o-1,r=Math.max(l,n),s=Math.min(u,i),r=Math.ceil(r),s=Math.floor(s),r<=s&&h.push({row:e,firstRowDayIndex:r-n,lastRowDayIndex:s-n,isStart:r===l,isEnd:s===u});return h},sliceRangeByDay:function(t){var e,n,i,r,s,o,a=this.daysPerRow,l=this.view.computeDayRange(t),u=this.getDateDayIndex(l.start),h=this.getDateDayIndex(l.end.clone().subtract(1,"days")),c=[];for(e=0;e<this.rowCnt;e++)for(n=e*a,i=n+a-1,r=n;r<=i;r++)s=Math.max(u,r),o=Math.min(h,r),s=Math.ceil(s),o=Math.floor(o),s<=o&&c.push({row:e,firstRowDayIndex:s-n,lastRowDayIndex:o-n,isStart:s===u,isEnd:o===h});return c},renderHeadHtml:function(){return'<div class="fc-row '+this.view.widgetHeaderClass+'"><table><thead>'+this.renderHeadTrHtml()+"</thead></table></div>"},renderHeadIntroHtml:function(){return this.renderIntroHtml()},renderHeadTrHtml:function(){return"<tr>"+(this.isRTL?"":this.renderHeadIntroHtml())+this.renderHeadDateCellsHtml()+(this.isRTL?this.renderHeadIntroHtml():"")+"</tr>"},renderHeadDateCellsHtml:function(){var t,e,n=[];for(t=0;t<this.colCnt;t++)e=this.getCellDate(0,t),n.push(this.renderHeadDateCellHtml(e));return n.join("")},renderHeadDateCellHtml:function(t,e,n){var i=this.view,r=Z(t,i.activeRange),s=["fc-day-header",i.widgetHeaderClass],o=ht(t.format(this.colHeadFormat));return 1===this.rowCnt?s=s.concat(this.getDayClasses(t,!0)):s.push("fc-"+Kt[t.day()]),'<th class="'+s.join(" ")+'"'+(1===(r&&this.rowCnt)?' data-date="'+t.format("YYYY-MM-DD")+'"':"")+(e>1?' colspan="'+e+'"':"")+(n?" "+n:"")+">"+(r?i.buildGotoAnchorHtml({date:t,forceOff:this.rowCnt>1||1===this.colCnt},o):o)+"</th>"},renderBgTrHtml:function(t){return"<tr>"+(this.isRTL?"":this.renderBgIntroHtml(t))+this.renderBgCellsHtml(t)+(this.isRTL?this.renderBgIntroHtml(t):"")+"</tr>"},renderBgIntroHtml:function(t){return this.renderIntroHtml()},renderBgCellsHtml:function(t){var e,n,i=[];for(e=0;e<this.colCnt;e++)n=this.getCellDate(t,e),i.push(this.renderBgCellHtml(n));return i.join("")},renderBgCellHtml:function(t,e){var n=this.view,i=Z(t,n.activeRange),r=this.getDayClasses(t);return r.unshift("fc-day",n.widgetContentClass),'<td class="'+r.join(" ")+'"'+(i?' data-date="'+t.format("YYYY-MM-DD")+'"':"")+(e?" "+e:"")+"></td>"},renderIntroHtml:function(){},bookendCells:function(t){var e=this.renderIntroHtml();e&&(this.isRTL?t.append(e):t.prepend(e))}},De=Zt.DayGrid=be.extend(Ee,{numbersVisible:!1,bottomCoordPadding:0,rowEls:null,cellEls:null,helperEls:null,rowCoordCache:null,colCoordCache:null,renderDates:function(t){var e,n,i=this.view,r=this.rowCnt,s=this.colCnt,o="";for(e=0;e<r;e++)o+=this.renderDayRowHtml(e,t);for(this.el.html(o),this.rowEls=this.el.find(".fc-row"),this.cellEls=this.el.find(".fc-day, .fc-disabled-day"),this.rowCoordCache=new ve({els:this.rowEls,isVertical:!0}),this.colCoordCache=new ve({els:this.cellEls.slice(0,this.colCnt),isHorizontal:!0}),e=0;e<r;e++)for(n=0;n<s;n++)i.publiclyTrigger("dayRender",null,this.getCellDate(e,n),this.getCellEl(e,n))},unrenderDates:function(){this.removeSegPopover()},renderBusinessHours:function(){var t=this.buildBusinessHourSegs(!0);this.renderFill("businessHours",t,"bgevent")},unrenderBusinessHours:function(){this.unrenderFill("businessHours")},renderDayRowHtml:function(t,e){var n=this.view,i=["fc-row","fc-week",n.widgetContentClass];return e&&i.push("fc-rigid"),'<div class="'+i.join(" ")+'"><div class="fc-bg"><table>'+this.renderBgTrHtml(t)+'</table></div><div class="fc-content-skeleton"><table>'+(this.numbersVisible?"<thead>"+this.renderNumberTrHtml(t)+"</thead>":"")+"</table></div></div>"},renderNumberTrHtml:function(t){return"<tr>"+(this.isRTL?"":this.renderNumberIntroHtml(t))+this.renderNumberCellsHtml(t)+(this.isRTL?this.renderNumberIntroHtml(t):"")+"</tr>"},renderNumberIntroHtml:function(t){return this.renderIntroHtml()},renderNumberCellsHtml:function(t){var e,n,i=[];for(e=0;e<this.colCnt;e++)n=this.getCellDate(t,e),i.push(this.renderNumberCellHtml(n));return i.join("")},renderNumberCellHtml:function(t){var e,n,i=this.view,r="",s=Z(t,i.activeRange),o=i.dayNumbersVisible&&s;return o||i.cellWeekNumbersVisible?(e=this.getDayClasses(t),e.unshift("fc-day-top"),i.cellWeekNumbersVisible&&(n="ISO"===t._locale._fullCalendar_weekCalc?1:t._locale.firstDayOfWeek()),r+='<td class="'+e.join(" ")+'"'+(s?' data-date="'+t.format()+'"':"")+">",i.cellWeekNumbersVisible&&t.day()==n&&(r+=i.buildGotoAnchorHtml({date:t,type:"week"},{class:"fc-week-number"},t.format("w"))),o&&(r+=i.buildGotoAnchorHtml(t,{class:"fc-day-number"},t.date())),r+="</td>"):"<td/>"},computeEventTimeFormat:function(){return this.view.opt("extraSmallTimeFormat")},computeDisplayEventEnd:function(){return 1==this.colCnt},rangeUpdated:function(){this.updateDayTable()},spanToSegs:function(t){var e,n,i=this.sliceRangeByRow(t);for(e=0;e<i.length;e++)n=i[e],this.isRTL?(n.leftCol=this.daysPerRow-1-n.lastRowDayIndex,n.rightCol=this.daysPerRow-1-n.firstRowDayIndex):(n.leftCol=n.firstRowDayIndex,n.rightCol=n.lastRowDayIndex);return i},prepareHits:function(){this.colCoordCache.build(),this.rowCoordCache.build(),this.rowCoordCache.bottoms[this.rowCnt-1]+=this.bottomCoordPadding},releaseHits:function(){this.colCoordCache.clear(),this.rowCoordCache.clear()},queryHit:function(t,e){if(this.colCoordCache.isLeftInBounds(t)&&this.rowCoordCache.isTopInBounds(e)){var n=this.colCoordCache.getHorizontalIndex(t),i=this.rowCoordCache.getVerticalIndex(e);if(null!=i&&null!=n)return this.getCellHit(i,n)}},getHitSpan:function(t){return this.getCellRange(t.row,t.col)},getHitEl:function(t){return this.getCellEl(t.row,t.col)},getCellHit:function(t,e){return{row:t,col:e,component:this,left:this.colCoordCache.getLeftOffset(e),right:this.colCoordCache.getRightOffset(e),top:this.rowCoordCache.getTopOffset(t),bottom:this.rowCoordCache.getBottomOffset(t)}},getCellEl:function(t,e){return this.cellEls.eq(t*this.colCnt+e)},renderDrag:function(t,e){var n,i=this.eventToSpans(t);for(n=0;n<i.length;n++)this.renderHighlight(i[n]);if(e&&e.component!==this)return this.renderEventLocationHelper(t,e)},unrenderDrag:function(){this.unrenderHighlight(),this.unrenderHelper()},renderEventResize:function(t,e){var n,i=this.eventToSpans(t);for(n=0;n<i.length;n++)this.renderHighlight(i[n]);return this.renderEventLocationHelper(t,e)},unrenderEventResize:function(){this.unrenderHighlight(),this.unrenderHelper()},renderHelper:function(e,n){var i,r=[],s=this.eventToSegs(e);return s=this.renderFgSegEls(s),i=this.renderSegRows(s),this.rowEls.each(function(e,s){var o,a=t(s),l=t('<div class="fc-helper-skeleton"><table/></div>');o=n&&n.row===e?n.el.position().top:a.find(".fc-content-skeleton tbody").position().top,l.css("top",o).find("table").append(i[e].tbodyEl),a.append(l),r.push(l[0])}),this.helperEls=t(r)},unrenderHelper:function(){this.helperEls&&(this.helperEls.remove(),this.helperEls=null)},fillSegTag:"td",renderFill:function(e,n,i){var r,s,o,a=[];for(n=this.renderFillSegEls(e,n),r=0;r<n.length;r++)s=n[r],o=this.renderFillRow(e,s,i),this.rowEls.eq(s.row).append(o),a.push(o[0]);return this.elsByFill[e]=t(a),n},renderFillRow:function(e,n,i){var r,s,o=this.colCnt,a=n.leftCol,l=n.rightCol+1;return i=i||e.toLowerCase(),r=t('<div class="fc-'+i+'-skeleton"><table><tr/></table></div>'),s=r.find("tr"),a>0&&s.append('<td colspan="'+a+'"/>'),s.append(n.el.attr("colspan",l-a)),l<o&&s.append('<td colspan="'+(o-l)+'"/>'),this.bookendCells(s),r}});De.mixin({rowStructs:null,unrenderEvents:function(){this.removeSegPopover(),be.prototype.unrenderEvents.apply(this,arguments)},getEventSegs:function(){return be.prototype.getEventSegs.call(this).concat(this.popoverSegs||[])},renderBgSegs:function(e){var n=t.grep(e,function(t){return t.event.allDay});return be.prototype.renderBgSegs.call(this,n)},renderFgSegs:function(e){var n;return e=this.renderFgSegEls(e),n=this.rowStructs=this.renderSegRows(e),this.rowEls.each(function(e,i){t(i).find(".fc-content-skeleton > table").append(n[e].tbodyEl)}),e},unrenderFgSegs:function(){for(var t,e=this.rowStructs||[];t=e.pop();)t.tbodyEl.remove();this.rowStructs=null},renderSegRows:function(t){var e,n,i=[];for(e=this.groupSegRows(t),n=0;n<e.length;n++)i.push(this.renderSegRow(n,e[n]));return i},fgSegHtml:function(t,e){var n,i,r=this.view,s=t.event,o=r.isEventDraggable(s),a=!e&&s.allDay&&t.isStart&&r.isEventResizableFromStart(s),l=!e&&s.allDay&&t.isEnd&&r.isEventResizableFromEnd(s),u=this.getSegClasses(t,o,a||l),h=dt(this.getSegSkinCss(t)),c="";return u.unshift("fc-day-grid-event","fc-h-event"),t.isStart&&(n=this.getEventTimeText(s))&&(c='<span class="fc-time">'+ht(n)+"</span>"),i='<span class="fc-title">'+(ht(s.title||"")||"&nbsp;")+"</span>",'<a class="'+u.join(" ")+'"'+(s.url?' href="'+ht(s.url)+'"':"")+(h?' style="'+h+'"':"")+'><div class="fc-content">'+(this.isRTL?i+" "+c:c+" "+i)+"</div>"+(a?'<div class="fc-resizer fc-start-resizer" />':"")+(l?'<div class="fc-resizer fc-end-resizer" />':"")+"</a>"},renderSegRow:function(e,n){function i(e){for(;o<e;)h=(m[r-1]||[])[o],h?h.attr("rowspan",parseInt(h.attr("rowspan")||1,10)+1):(h=t("<td/>"),a.append(h)),v[r][o]=h,m[r][o]=h,o++}var r,s,o,a,l,u,h,c=this.colCnt,d=this.buildSegLevels(n),f=Math.max(1,d.length),g=t("<tbody/>"),p=[],v=[],m=[];for(r=0;r<f;r++){if(s=d[r],o=0,a=t("<tr/>"),p.push([]),v.push([]),m.push([]),s)for(l=0;l<s.length;l++){for(u=s[l],i(u.leftCol),h=t('<td class="fc-event-container"/>').append(u.el),u.leftCol!=u.rightCol?h.attr("colspan",u.rightCol-u.leftCol+1):m[r][o]=h;o<=u.rightCol;)v[r][o]=h,p[r][o]=u,o++;a.append(h)}i(c),this.bookendCells(a),g.append(a)}return{row:e,tbodyEl:g,cellMatrix:v,segMatrix:p,segLevels:d,segs:n}},buildSegLevels:function(t){var e,n,i,r=[];for(this.sortEventSegs(t),e=0;e<t.length;e++){for(n=t[e],i=0;i<r.length&&zt(n,r[i]);i++);n.level=i,(r[i]||(r[i]=[])).push(n)}for(i=0;i<r.length;i++)r[i].sort(Ft);return r},groupSegRows:function(t){var e,n=[];for(e=0;e<this.rowCnt;e++)n.push([]);for(e=0;e<t.length;e++)n[t[e].row].push(t[e]);return n}}),De.mixin({segPopover:null,popoverSegs:null,removeSegPopover:function(){this.segPopover&&this.segPopover.hide()},limitRows:function(t){var e,n,i=this.rowStructs||[];for(e=0;e<i.length;e++)this.unlimitRow(e),!1!==(n=!!t&&("number"==typeof t?t:this.computeRowLevelLimit(e)))&&this.limitRow(e,n)},computeRowLevelLimit:function(e){function n(e,n){s=Math.max(s,t(n).outerHeight())}var i,r,s,o=this.rowEls.eq(e),a=o.height(),l=this.rowStructs[e].tbodyEl.children();for(i=0;i<l.length;i++)if(r=l.eq(i).removeClass("fc-limited"),s=0,r.find("> td > :first-child").each(n),r.position().top+s>a)return i;return!1},limitRow:function(e,n){function i(i){for(;E<i;)u=w.getCellSegs(e,E,n),u.length&&(d=s[n-1][E],y=w.renderMoreLink(e,E,u),m=t("<div/>").append(y),d.append(m),b.push(m[0])),E++}var r,s,o,a,l,u,h,c,d,f,g,p,v,m,y,w=this,S=this.rowStructs[e],b=[],E=0;if(n&&n<S.segLevels.length){for(r=S.segLevels[n-1],s=S.cellMatrix,o=S.tbodyEl.children().slice(n).addClass("fc-limited").get(),a=0;a<r.length;a++){for(l=r[a],i(l.leftCol),c=[],h=0;E<=l.rightCol;)u=this.getCellSegs(e,E,n),c.push(u),h+=u.length,E++;if(h){for(d=s[n-1][l.leftCol],f=d.attr("rowspan")||1,g=[],p=0;p<c.length;p++)v=t('<td class="fc-more-cell"/>').attr("rowspan",f),u=c[p],y=this.renderMoreLink(e,l.leftCol+p,[l].concat(u)),m=t("<div/>").append(y),v.append(m),g.push(v[0]),b.push(v[0]);d.addClass("fc-limited").after(t(g)),o.push(d[0])}}i(this.colCnt),S.moreEls=t(b),S.limitedEls=t(o)}},unlimitRow:function(t){var e=this.rowStructs[t];e.moreEls&&(e.moreEls.remove(),e.moreEls=null),e.limitedEls&&(e.limitedEls.removeClass("fc-limited"),e.limitedEls=null)},renderMoreLink:function(e,n,i){var r=this,s=this.view;return t('<a class="fc-more"/>').text(this.getMoreLinkText(i.length)).on("click",function(o){var a=s.opt("eventLimitClick"),l=r.getCellDate(e,n),u=t(this),h=r.getCellEl(e,n),c=r.getCellSegs(e,n),d=r.resliceDaySegs(c,l),f=r.resliceDaySegs(i,l);"function"==typeof a&&(a=s.publiclyTrigger("eventLimitClick",null,{date:l,dayEl:h,moreEl:u,segs:d,hiddenSegs:f},o)),"popover"===a?r.showSegPopover(e,n,u,d):"string"==typeof a&&s.calendar.zoomTo(l,a)})},showSegPopover:function(t,e,n,i){var r,s,o=this,a=this.view,l=n.parent();r=1==this.rowCnt?a.el:this.rowEls.eq(t),s={className:"fc-more-popover",content:this.renderSegPopoverContent(t,e,i),parentEl:this.view.el,top:r.offset().top,autoHide:!0,viewportConstrain:a.opt("popoverViewportConstrain"),hide:function(){if(o.popoverSegs)for(var t,e=0;e<o.popoverSegs.length;++e)t=o.popoverSegs[e],a.publiclyTrigger("eventDestroy",t.event,t.event,t.el);o.segPopover.removeElement(),o.segPopover=null,o.popoverSegs=null}},this.isRTL?s.right=l.offset().left+l.outerWidth()+1:s.left=l.offset().left-1,this.segPopover=new pe(s),this.segPopover.show(),this.bindSegHandlersToEl(this.segPopover.el)},renderSegPopoverContent:function(e,n,i){var r,s=this.view,o=s.opt("theme"),a=this.getCellDate(e,n).format(s.opt("dayPopoverFormat")),l=t('<div class="fc-header '+s.widgetHeaderClass+'"><span class="fc-close '+(o?"ui-icon ui-icon-closethick":"fc-icon fc-icon-x")+'"></span><span class="fc-title">'+ht(a)+'</span><div class="fc-clear"/></div><div class="fc-body '+s.widgetContentClass+'"><div class="fc-event-container"></div></div>'),u=l.find(".fc-event-container");for(i=this.renderFgSegEls(i,!0),this.popoverSegs=i,r=0;r<i.length;r++)this.hitsNeeded(),i[r].hit=this.getCellHit(e,n),this.hitsNotNeeded(),u.append(i[r].el);return l},resliceDaySegs:function(e,n){var i=t.map(e,function(t){return t.event}),r=n.clone(),s=r.clone().add(1,"days"),o={start:r,end:s};return e=this.eventsToSegs(i,function(t){var e=z(t,o);return e?[e]:[]}),this.sortEventSegs(e),e},getMoreLinkText:function(t){var e=this.view.opt("eventLimitText");return"function"==typeof e?e(t):"+"+t+" "+e},getCellSegs:function(t,e,n){for(var i,r=this.rowStructs[t].segMatrix,s=n||0,o=[];s<r.length;)i=r[s][e],i&&o.push(i),s++;return o}});var Te=Zt.TimeGrid=be.extend(Ee,{slotDuration:null,snapDuration:null,snapsPerSlot:null,labelFormat:null,labelInterval:null,colEls:null,slatContainerEl:null,slatEls:null,nowIndicatorEls:null,colCoordCache:null,slatCoordCache:null,constructor:function(){be.apply(this,arguments),this.processOptions()},renderDates:function(){this.el.html(this.renderHtml()),this.colEls=this.el.find(".fc-day, .fc-disabled-day"),this.slatContainerEl=this.el.find(".fc-slats"),this.slatEls=this.slatContainerEl.find("tr"),this.colCoordCache=new ve({els:this.colEls,isHorizontal:!0}),this.slatCoordCache=new ve({els:this.slatEls,isVertical:!0}),this.renderContentSkeleton()},renderHtml:function(){return'<div class="fc-bg"><table>'+this.renderBgTrHtml(0)+'</table></div><div class="fc-slats"><table>'+this.renderSlatRowHtml()+"</table></div>"},renderSlatRowHtml:function(){for(var t,n,i,r=this.view,s=this.isRTL,o="",a=e.duration(+this.view.minTime);a<this.view.maxTime;)t=this.start.clone().time(a),n=vt(W(a,this.labelInterval)),i='<td class="fc-axis fc-time '+r.widgetContentClass+'" '+r.axisStyleAttr()+">"+(n?"<span>"+ht(t.format(this.labelFormat))+"</span>":"")+"</td>",o+='<tr data-time="'+t.format("HH:mm:ss")+'"'+(n?"":' class="fc-minor"')+">"+(s?"":i)+'<td class="'+r.widgetContentClass+'"/>'+(s?i:"")+"</tr>",a.add(this.slotDuration);return o},processOptions:function(){var n,i=this.view,r=i.opt("slotDuration"),s=i.opt("snapDuration");r=e.duration(r),s=s?e.duration(s):r,this.slotDuration=r,this.snapDuration=s,this.snapsPerSlot=r/s,this.minResizeDuration=s,n=i.opt("slotLabelFormat"),t.isArray(n)&&(n=n[n.length-1]),this.labelFormat=n||i.opt("smallTimeFormat"),n=i.opt("slotLabelInterval"),this.labelInterval=n?e.duration(n):this.computeLabelInterval(r)},computeLabelInterval:function(t){var n,i,r;for(n=_e.length-1;n>=0;n--)if(i=e.duration(_e[n]),r=W(i,t),vt(r)&&r>1)return i;return e.duration(t)},computeEventTimeFormat:function(){return this.view.opt("noMeridiemTimeFormat")},computeDisplayEventEnd:function(){return!0},prepareHits:function(){this.colCoordCache.build(),this.slatCoordCache.build()},releaseHits:function(){this.colCoordCache.clear()},queryHit:function(t,e){var n=this.snapsPerSlot,i=this.colCoordCache,r=this.slatCoordCache;if(i.isLeftInBounds(t)&&r.isTopInBounds(e)){var s=i.getHorizontalIndex(t),o=r.getVerticalIndex(e);if(null!=s&&null!=o){var a=r.getTopOffset(o),l=r.getHeight(o),u=(e-a)/l,h=Math.floor(u*n),c=o*n+h,d=a+h/n*l,f=a+(h+1)/n*l;return{col:s,snap:c,component:this,left:i.getLeftOffset(s),right:i.getRightOffset(s),top:d,bottom:f}}}},getHitSpan:function(t){var e,n=this.getCellDate(0,t.col),i=this.computeSnapTime(t.snap);return n.time(i),e=n.clone().add(this.snapDuration),{start:n,end:e}},getHitEl:function(t){return this.colEls.eq(t.col)},rangeUpdated:function(){this.updateDayTable()},computeSnapTime:function(t){return e.duration(this.view.minTime+this.snapDuration*t)},spanToSegs:function(t){var e,n=this.sliceRangeByTimes(t);for(e=0;e<n.length;e++)this.isRTL?n[e].col=this.daysPerRow-1-n[e].dayIndex:n[e].col=n[e].dayIndex;return n},sliceRangeByTimes:function(t){var e,n,i,r,s=[];for(n=0;n<this.daysPerRow;n++)i=this.dayDates[n].clone().time(0),r={start:i.clone().add(this.view.minTime),end:i.clone().add(this.view.maxTime)},(e=z(t,r))&&(e.dayIndex=n,s.push(e));return s},updateSize:function(t){this.slatCoordCache.build(),t&&this.updateSegVerticals([].concat(this.fgSegs||[],this.bgSegs||[],this.businessSegs||[]))},getTotalSlatHeight:function(){return this.slatContainerEl.outerHeight()},computeDateTop:function(t,n){return this.computeTimeTop(e.duration(t-n.clone().stripTime()))},computeTimeTop:function(t){var e,n,i=this.slatEls.length,r=(t-this.view.minTime)/this.slotDuration;return r=Math.max(0,r),r=Math.min(i,r),e=Math.floor(r),e=Math.min(e,i-1),n=r-e,this.slatCoordCache.getTopPosition(e)+this.slatCoordCache.getHeight(e)*n},renderDrag:function(t,e){var n,i;if(e)return this.renderEventLocationHelper(t,e);for(n=this.eventToSpans(t),i=0;i<n.length;i++)this.renderHighlight(n[i])},unrenderDrag:function(){this.unrenderHelper(),this.unrenderHighlight()},renderEventResize:function(t,e){return this.renderEventLocationHelper(t,e)},unrenderEventResize:function(){this.unrenderHelper()},renderHelper:function(t,e){return this.renderHelperSegs(this.eventToSegs(t),e)},unrenderHelper:function(){this.unrenderHelperSegs()},renderBusinessHours:function(){this.renderBusinessSegs(this.buildBusinessHourSegs())},unrenderBusinessHours:function(){this.unrenderBusinessSegs()},getNowIndicatorUnit:function(){return"minute"},renderNowIndicator:function(e){var n,i=this.spanToSegs({start:e,end:e}),r=this.computeDateTop(e,e),s=[];for(n=0;n<i.length;n++)s.push(t('<div class="fc-now-indicator fc-now-indicator-line"></div>').css("top",r).appendTo(this.colContainerEls.eq(i[n].col))[0]);i.length>0&&s.push(t('<div class="fc-now-indicator fc-now-indicator-arrow"></div>').css("top",r).appendTo(this.el.find(".fc-content-skeleton"))[0]),this.nowIndicatorEls=t(s)},unrenderNowIndicator:function(){this.nowIndicatorEls&&(this.nowIndicatorEls.remove(),this.nowIndicatorEls=null)},renderSelection:function(t){this.view.opt("selectHelper")?this.renderEventLocationHelper(t):this.renderHighlight(t)},unrenderSelection:function(){this.unrenderHelper(),this.unrenderHighlight()},renderHighlight:function(t){this.renderHighlightSegs(this.spanToSegs(t))},unrenderHighlight:function(){this.unrenderHighlightSegs()}});Te.mixin({colContainerEls:null,fgContainerEls:null,bgContainerEls:null,helperContainerEls:null,highlightContainerEls:null,businessContainerEls:null,fgSegs:null,bgSegs:null,helperSegs:null,highlightSegs:null,businessSegs:null,renderContentSkeleton:function(){var e,n,i="";for(e=0;e<this.colCnt;e++)i+='<td><div class="fc-content-col"><div class="fc-event-container fc-helper-container"></div><div class="fc-event-container"></div><div class="fc-highlight-container"></div><div class="fc-bgevent-container"></div><div class="fc-business-container"></div></div></td>';n=t('<div class="fc-content-skeleton"><table><tr>'+i+"</tr></table></div>"),this.colContainerEls=n.find(".fc-content-col"),this.helperContainerEls=n.find(".fc-helper-container"),this.fgContainerEls=n.find(".fc-event-container:not(.fc-helper-container)"),this.bgContainerEls=n.find(".fc-bgevent-container"),this.highlightContainerEls=n.find(".fc-highlight-container"),this.businessContainerEls=n.find(".fc-business-container"),this.bookendCells(n.find("tr")),this.el.append(n)},renderFgSegs:function(t){return t=this.renderFgSegsIntoContainers(t,this.fgContainerEls),this.fgSegs=t,t},unrenderFgSegs:function(){this.unrenderNamedSegs("fgSegs")},renderHelperSegs:function(e,n){var i,r,s,o=[];for(e=this.renderFgSegsIntoContainers(e,this.helperContainerEls),i=0;i<e.length;i++)r=e[i],n&&n.col===r.col&&(s=n.el,r.el.css({left:s.css("left"),right:s.css("right"),"margin-left":s.css("margin-left"),"margin-right":s.css("margin-right")})),o.push(r.el[0]);return this.helperSegs=e,t(o)},unrenderHelperSegs:function(){this.unrenderNamedSegs("helperSegs")},renderBgSegs:function(t){return t=this.renderFillSegEls("bgEvent",t),this.updateSegVerticals(t),this.attachSegsByCol(this.groupSegsByCol(t),this.bgContainerEls),this.bgSegs=t,t},unrenderBgSegs:function(){this.unrenderNamedSegs("bgSegs")},renderHighlightSegs:function(t){t=this.renderFillSegEls("highlight",t),this.updateSegVerticals(t),this.attachSegsByCol(this.groupSegsByCol(t),this.highlightContainerEls),this.highlightSegs=t},unrenderHighlightSegs:function(){this.unrenderNamedSegs("highlightSegs")},renderBusinessSegs:function(t){t=this.renderFillSegEls("businessHours",t),this.updateSegVerticals(t),this.attachSegsByCol(this.groupSegsByCol(t),this.businessContainerEls),this.businessSegs=t},unrenderBusinessSegs:function(){this.unrenderNamedSegs("businessSegs")},groupSegsByCol:function(t){var e,n=[];for(e=0;e<this.colCnt;e++)n.push([]);for(e=0;e<t.length;e++)n[t[e].col].push(t[e]);return n},attachSegsByCol:function(t,e){var n,i,r;for(n=0;n<this.colCnt;n++)for(i=t[n],r=0;r<i.length;r++)e.eq(n).append(i[r].el)},unrenderNamedSegs:function(t){var e,n=this[t];if(n){for(e=0;e<n.length;e++)n[e].el.remove();this[t]=null}},renderFgSegsIntoContainers:function(t,e){var n,i;for(t=this.renderFgSegEls(t),n=this.groupSegsByCol(t),i=0;i<this.colCnt;i++)this.updateFgSegCoords(n[i]);return this.attachSegsByCol(n,e),t},fgSegHtml:function(t,e){var n,i,r,s=this.view,o=t.event,a=s.isEventDraggable(o),l=!e&&t.isStart&&s.isEventResizableFromStart(o),u=!e&&t.isEnd&&s.isEventResizableFromEnd(o),h=this.getSegClasses(t,a,l||u),c=dt(this.getSegSkinCss(t));return h.unshift("fc-time-grid-event","fc-v-event"),s.isMultiDayEvent(o)?(t.isStart||t.isEnd)&&(n=this.getEventTimeText(t),i=this.getEventTimeText(t,"LT"),r=this.getEventTimeText(t,null,!1)):(n=this.getEventTimeText(o),i=this.getEventTimeText(o,"LT"),r=this.getEventTimeText(o,null,!1)),'<a class="'+h.join(" ")+'"'+(o.url?' href="'+ht(o.url)+'"':"")+(c?' style="'+c+'"':"")+'><div class="fc-content">'+(n?'<div class="fc-time" data-start="'+ht(r)+'" data-full="'+ht(i)+'"><span>'+ht(n)+"</span></div>":"")+(o.title?'<div class="fc-title">'+ht(o.title)+"</div>":"")+'</div><div class="fc-bg"/>'+(u?'<div class="fc-resizer fc-end-resizer" />':"")+"</a>"},updateSegVerticals:function(t){this.computeSegVerticals(t),this.assignSegVerticals(t)},computeSegVerticals:function(t){var e,n,i;for(e=0;e<t.length;e++)n=t[e],i=this.dayDates[n.dayIndex],n.top=this.computeDateTop(n.start,i),n.bottom=this.computeDateTop(n.end,i)},assignSegVerticals:function(t){var e,n;for(e=0;e<t.length;e++)n=t[e],n.el.css(this.generateSegVerticalCss(n))},generateSegVerticalCss:function(t){return{top:t.top,bottom:-t.bottom}},updateFgSegCoords:function(t){this.computeSegVerticals(t),this.computeFgSegHorizontals(t),this.assignSegVerticals(t),this.assignFgSegHorizontals(t)},computeFgSegHorizontals:function(t){var e,n,i;if(this.sortEventSegs(t),e=At(t),Gt(e),n=e[0]){for(i=0;i<n.length;i++)Vt(n[i]);for(i=0;i<n.length;i++)this.computeFgSegForwardBack(n[i],0,0)}},computeFgSegForwardBack:function(t,e,n){var i,r=t.forwardSegs;if(void 0===t.forwardCoord)for(r.length?(this.sortForwardSegs(r),this.computeFgSegForwardBack(r[0],e+1,n),t.forwardCoord=r[0].backwardCoord):t.forwardCoord=1,t.backwardCoord=t.forwardCoord-(t.forwardCoord-n)/(e+1),i=0;i<r.length;i++)this.computeFgSegForwardBack(r[i],0,t.forwardCoord)},sortForwardSegs:function(t){t.sort(mt(this,"compareForwardSegs"))},compareForwardSegs:function(t,e){return e.forwardPressure-t.forwardPressure||(t.backwardCoord||0)-(e.backwardCoord||0)||this.compareEventSegs(t,e)},assignFgSegHorizontals:function(t){var e,n;for(e=0;e<t.length;e++)n=t[e],n.el.css(this.generateFgSegHorizontalCss(n)),n.bottom-n.top<30&&n.el.addClass("fc-short")},generateFgSegHorizontalCss:function(t){var e,n,i=this.view.opt("slotEventOverlap"),r=t.backwardCoord,s=t.forwardCoord,o=this.generateSegVerticalCss(t);return i&&(s=Math.min(1,r+2*(s-r))),this.isRTL?(e=1-s,n=r):(e=r,n=1-s),o.zIndex=t.level+1,o.left=100*e+"%",o.right=100*n+"%",i&&t.forwardPressure&&(o[this.isRTL?"marginLeft":"marginRight"]=20),o}});var Ce=Zt.View=ue.extend({type:null,name:null,title:null,calendar:null,viewSpec:null,options:null,el:null,renderQueue:null,batchRenderDepth:0,isDatesRendered:!1,isEventsRendered:!1,isBaseRendered:!1,queuedScroll:null,isRTL:!1,isSelected:!1,selectedEvent:null,eventOrderSpecs:null,widgetHeaderClass:null,widgetContentClass:null,highlightStateClass:null,nextDayThreshold:null,isHiddenDayHash:null,isNowIndicatorRendered:null,initialNowDate:null,initialNowQueriedMs:null,nowIndicatorTimeoutID:null,nowIndicatorIntervalID:null,constructor:function(t,n){ue.prototype.constructor.call(this),this.calendar=t,this.viewSpec=n,this.type=n.type,this.options=n.options,this.name=this.type,this.nextDayThreshold=e.duration(this.opt("nextDayThreshold")),this.initThemingProps(),this.initHiddenDays(),this.isRTL=this.opt("isRTL"),this.eventOrderSpecs=M(this.opt("eventOrder")),this.renderQueue=this.buildRenderQueue(),this.initAutoBatchRender(),this.initialize()},buildRenderQueue:function(){var t=this,e=new de({event:this.opt("eventRenderWait")});return e.on("start",function(){t.freezeHeight(),t.addScroll(t.queryScroll())}),e.on("stop",function(){t.thawHeight(),t.popScroll()}),e},initAutoBatchRender:function(){var t=this;this.on("before:change",function(){t.startBatchRender()}),this.on("change",function(){t.stopBatchRender()})},startBatchRender:function(){this.batchRenderDepth++||this.renderQueue.pause()},stopBatchRender:function(){--this.batchRenderDepth||this.renderQueue.resume()},initialize:function(){},opt:function(t){return this.options[t]},publiclyTrigger:function(t,e){var n=this.calendar;return n.publiclyTrigger.apply(n,[t,e||this].concat(Array.prototype.slice.call(arguments,2),[this]))},updateTitle:function(){this.title=this.computeTitle(),this.calendar.setToolbarsTitle(this.title)},computeTitle:function(){var t;return t=/^(year|month)$/.test(this.currentRangeUnit)?this.currentRange:this.activeRange,this.formatRange({start:this.calendar.applyTimezone(t.start),end:this.calendar.applyTimezone(t.end)},this.opt("titleFormat")||this.computeTitleFormat(),this.opt("titleRangeSeparator"))},computeTitleFormat:function(){return"year"==this.currentRangeUnit?"YYYY":"month"==this.currentRangeUnit?this.opt("monthYearFormat"):this.currentRangeAs("days")>1?"ll":"LL"},formatRange:function(t,e,n){var i=t.end;return i.hasTime()||(i=i.clone().subtract(1)),ae(t.start,i,e,n,this.opt("isRTL"))},getAllDayHtml:function(){return this.opt("allDayHtml")||ht(this.opt("allDayText"))},buildGotoAnchorHtml:function(e,n,i){var r,s,o,a;return t.isPlainObject(e)?(r=e.date,s=e.type,o=e.forceOff):r=e,r=Zt.moment(r),a={date:r.format("YYYY-MM-DD"),type:s||"day"},"string"==typeof n&&(i=n,n=null),n=n?" "+ft(n):"",i=i||"",!o&&this.opt("navLinks")?"<a"+n+' data-goto="'+ht(JSON.stringify(a))+'">'+i+"</a>":"<span"+n+">"+i+"</span>"},setElement:function(t){this.el=t,this.bindGlobalHandlers(),this.bindBaseRenderHandlers(),this.renderSkeleton()},
+removeElement:function(){this.unsetDate(),this.unrenderSkeleton(),this.unbindGlobalHandlers(),this.unbindBaseRenderHandlers(),this.el.remove()},renderSkeleton:function(){},unrenderSkeleton:function(){},setDate:function(t){var e=this.get("dateProfile"),n=this.buildDateProfile(t,null,!0);return e&&X(e.activeRange,n.activeRange)||this.set("dateProfile",n),n.date},unsetDate:function(){this.unset("dateProfile")},requestDateRender:function(t){var e=this;this.renderQueue.queue(function(){e.executeDateRender(t)},"date","init")},requestDateUnrender:function(){var t=this;this.renderQueue.queue(function(){t.executeDateUnrender()},"date","destroy")},fetchInitialEvents:function(t){return this.calendar.requestEvents(t.activeRange.start,t.activeRange.end)},bindEventChanges:function(){this.listenTo(this.calendar,"eventsReset",this.resetEvents)},unbindEventChanges:function(){this.stopListeningTo(this.calendar,"eventsReset")},setEvents:function(t){this.set("currentEvents",t),this.set("hasEvents",!0)},unsetEvents:function(){this.unset("currentEvents"),this.unset("hasEvents")},resetEvents:function(t){this.startBatchRender(),this.unsetEvents(),this.setEvents(t),this.stopBatchRender()},requestEventsRender:function(t){var e=this;this.renderQueue.queue(function(){e.executeEventsRender(t)},"event","init")},requestEventsUnrender:function(){var t=this;this.renderQueue.queue(function(){t.executeEventsUnrender()},"event","destroy")},executeDateRender:function(t,e){this.setDateProfileForRendering(t),this.updateTitle(),this.calendar.updateToolbarButtons(),this.render&&this.render(),this.renderDates(),this.updateSize(),this.renderBusinessHours(),this.startNowIndicator(),e||this.addScroll(this.computeInitialDateScroll()),this.isDatesRendered=!0,this.trigger("datesRendered")},executeDateUnrender:function(){this.unselect(),this.stopNowIndicator(),this.trigger("before:datesUnrendered"),this.unrenderBusinessHours(),this.unrenderDates(),this.destroy&&this.destroy(),this.isDatesRendered=!1},renderDates:function(){},unrenderDates:function(){},bindBaseRenderHandlers:function(){var t=this;this.on("datesRendered.baseHandler",function(){t.onBaseRender()}),this.on("before:datesUnrendered.baseHandler",function(){t.onBeforeBaseUnrender()})},unbindBaseRenderHandlers:function(){this.off(".baseHandler")},onBaseRender:function(){this.applyScreenState(),this.publiclyTrigger("viewRender",this,this,this.el)},onBeforeBaseUnrender:function(){this.applyScreenState(),this.publiclyTrigger("viewDestroy",this,this,this.el)},bindGlobalHandlers:function(){this.listenTo(we.get(),{touchstart:this.processUnselect,mousedown:this.handleDocumentMousedown})},unbindGlobalHandlers:function(){this.stopListeningTo(we.get())},initThemingProps:function(){var t=this.opt("theme")?"ui":"fc";this.widgetHeaderClass=t+"-widget-header",this.widgetContentClass=t+"-widget-content",this.highlightStateClass=t+"-state-highlight"},renderBusinessHours:function(){},unrenderBusinessHours:function(){},startNowIndicator:function(){var t,n,i,r=this;this.opt("nowIndicator")&&(t=this.getNowIndicatorUnit())&&(n=mt(this,"updateNowIndicator"),this.initialNowDate=this.calendar.getNow(),this.initialNowQueriedMs=+new Date,this.renderNowIndicator(this.initialNowDate),this.isNowIndicatorRendered=!0,i=this.initialNowDate.clone().startOf(t).add(1,t)-this.initialNowDate,this.nowIndicatorTimeoutID=setTimeout(function(){r.nowIndicatorTimeoutID=null,n(),i=+e.duration(1,t),i=Math.max(100,i),r.nowIndicatorIntervalID=setInterval(n,i)},i))},updateNowIndicator:function(){this.isNowIndicatorRendered&&(this.unrenderNowIndicator(),this.renderNowIndicator(this.initialNowDate.clone().add(new Date-this.initialNowQueriedMs)))},stopNowIndicator:function(){this.isNowIndicatorRendered&&(this.nowIndicatorTimeoutID&&(clearTimeout(this.nowIndicatorTimeoutID),this.nowIndicatorTimeoutID=null),this.nowIndicatorIntervalID&&(clearTimeout(this.nowIndicatorIntervalID),this.nowIndicatorIntervalID=null),this.unrenderNowIndicator(),this.isNowIndicatorRendered=!1)},getNowIndicatorUnit:function(){},renderNowIndicator:function(t){},unrenderNowIndicator:function(){},updateSize:function(t){var e;t&&(e=this.queryScroll()),this.updateHeight(t),this.updateWidth(t),this.updateNowIndicator(),t&&this.applyScroll(e)},updateWidth:function(t){},updateHeight:function(t){var e=this.calendar;this.setHeight(e.getSuggestedViewHeight(),e.isHeightAuto())},setHeight:function(t,e){},addForcedScroll:function(e){this.addScroll(t.extend(e,{isForced:!0}))},addScroll:function(e){var n=this.queuedScroll||(this.queuedScroll={});n.isForced||t.extend(n,e)},popScroll:function(){this.applyQueuedScroll(),this.queuedScroll=null},applyQueuedScroll:function(){this.queuedScroll&&this.applyScroll(this.queuedScroll)},queryScroll:function(){var e={};return this.isDatesRendered&&t.extend(e,this.queryDateScroll()),e},applyScroll:function(t){this.isDatesRendered&&this.applyDateScroll(t)},computeInitialDateScroll:function(){return{}},queryDateScroll:function(){return{}},applyDateScroll:function(t){},freezeHeight:function(){this.calendar.freezeContentHeight()},thawHeight:function(){this.calendar.thawContentHeight()},executeEventsRender:function(t){this.renderEvents(t),this.isEventsRendered=!0,this.onEventsRender()},executeEventsUnrender:function(){this.onBeforeEventsUnrender(),this.destroyEvents&&this.destroyEvents(),this.unrenderEvents(),this.isEventsRendered=!1},onEventsRender:function(){this.applyScreenState(),this.renderedEventSegEach(function(t){this.publiclyTrigger("eventAfterRender",t.event,t.event,t.el)}),this.publiclyTrigger("eventAfterAllRender")},onBeforeEventsUnrender:function(){this.applyScreenState(),this.renderedEventSegEach(function(t){this.publiclyTrigger("eventDestroy",t.event,t.event,t.el)})},applyScreenState:function(){this.thawHeight(),this.freezeHeight(),this.applyQueuedScroll()},renderEvents:function(t){},unrenderEvents:function(){},resolveEventEl:function(e,n){var i=this.publiclyTrigger("eventRender",e,e,n);return!1===i?n=null:i&&!0!==i&&(n=t(i)),n},showEvent:function(t){this.renderedEventSegEach(function(t){t.el.css("visibility","")},t)},hideEvent:function(t){this.renderedEventSegEach(function(t){t.el.css("visibility","hidden")},t)},renderedEventSegEach:function(t,e){var n,i=this.getEventSegs();for(n=0;n<i.length;n++)e&&i[n].event._id!==e._id||i[n].el&&t.call(this,i[n])},getEventSegs:function(){return[]},isEventDraggable:function(t){return this.isEventStartEditable(t)},isEventStartEditable:function(t){return ut(t.startEditable,(t.source||{}).startEditable,this.opt("eventStartEditable"),this.isEventGenerallyEditable(t))},isEventGenerallyEditable:function(t){return ut(t.editable,(t.source||{}).editable,this.opt("editable"))},reportSegDrop:function(t,e,n,i,r){var s=this.calendar,o=s.mutateSeg(t,e,n),a=function(){o.undo(),s.reportEventChange()};this.triggerEventDrop(t.event,o.dateDelta,a,i,r),s.reportEventChange()},triggerEventDrop:function(t,e,n,i,r){this.publiclyTrigger("eventDrop",i[0],t,e,n,r,{})},reportExternalDrop:function(e,n,i,r,s){var o,a,l=e.eventProps;l&&(o=t.extend({},l,n),a=this.calendar.renderEvent(o,e.stick)[0]),this.triggerExternalDrop(a,n,i,r,s)},triggerExternalDrop:function(t,e,n,i,r){this.publiclyTrigger("drop",n[0],e.start,i,r),t&&this.publiclyTrigger("eventReceive",null,t)},renderDrag:function(t,e){},unrenderDrag:function(){},isEventResizableFromStart:function(t){return this.opt("eventResizableFromStart")&&this.isEventResizable(t)},isEventResizableFromEnd:function(t){return this.isEventResizable(t)},isEventResizable:function(t){var e=t.source||{};return ut(t.durationEditable,e.durationEditable,this.opt("eventDurationEditable"),t.editable,e.editable,this.opt("editable"))},reportSegResize:function(t,e,n,i,r){var s=this.calendar,o=s.mutateSeg(t,e,n),a=function(){o.undo(),s.reportEventChange()};this.triggerEventResize(t.event,o.durationDelta,a,i,r),s.reportEventChange()},triggerEventResize:function(t,e,n,i,r){this.publiclyTrigger("eventResize",i[0],t,e,n,r,{})},select:function(t,e){this.unselect(e),this.renderSelection(t),this.reportSelection(t,e)},renderSelection:function(t){},reportSelection:function(t,e){this.isSelected=!0,this.triggerSelect(t,e)},triggerSelect:function(t,e){this.publiclyTrigger("select",null,this.calendar.applyTimezone(t.start),this.calendar.applyTimezone(t.end),e)},unselect:function(t){this.isSelected&&(this.isSelected=!1,this.destroySelection&&this.destroySelection(),this.unrenderSelection(),this.publiclyTrigger("unselect",null,t))},unrenderSelection:function(){},selectEvent:function(t){this.selectedEvent&&this.selectedEvent===t||(this.unselectEvent(),this.renderedEventSegEach(function(t){t.el.addClass("fc-selected")},t),this.selectedEvent=t)},unselectEvent:function(){this.selectedEvent&&(this.renderedEventSegEach(function(t){t.el.removeClass("fc-selected")},this.selectedEvent),this.selectedEvent=null)},isEventSelected:function(t){return this.selectedEvent&&this.selectedEvent._id===t._id},handleDocumentMousedown:function(t){S(t)&&this.processUnselect(t)},processUnselect:function(t){this.processRangeUnselect(t),this.processEventUnselect(t)},processRangeUnselect:function(e){var n;this.isSelected&&this.opt("unselectAuto")&&((n=this.opt("unselectCancel"))&&t(e.target).closest(n).length||this.unselect(e))},processEventUnselect:function(e){this.selectedEvent&&(t(e.target).closest(".fc-selected").length||this.unselectEvent())},triggerDayClick:function(t,e,n){this.publiclyTrigger("dayClick",e,this.calendar.applyTimezone(t.start),n)},computeDayRange:function(t){var e,n=t.start.clone().stripTime(),i=t.end,r=null;return i&&(r=i.clone().stripTime(),(e=+i.time())&&e>=this.nextDayThreshold&&r.add(1,"days")),(!i||r<=n)&&(r=n.clone().add(1,"days")),{start:n,end:r}},isMultiDayEvent:function(t){var e=this.computeDayRange(t);return e.end.diff(e.start,"days")>1}});Ce.watch("displayingDates",["dateProfile"],function(t){this.requestDateRender(t.dateProfile)},function(){this.requestDateUnrender()}),Ce.watch("initialEvents",["dateProfile"],function(t){return this.fetchInitialEvents(t.dateProfile)}),Ce.watch("bindingEvents",["initialEvents"],function(t){this.setEvents(t.initialEvents),this.bindEventChanges()},function(){this.unbindEventChanges(),this.unsetEvents()}),Ce.watch("displayingEvents",["displayingDates","hasEvents"],function(){this.requestEventsRender(this.get("currentEvents"))},function(){this.requestEventsUnrender()}),Ce.mixin({currentRange:null,currentRangeUnit:null,renderRange:null,activeRange:null,validRange:null,dateIncrement:null,minTime:null,maxTime:null,usesMinMaxTime:!1,start:null,end:null,intervalStart:null,intervalEnd:null,setDateProfileForRendering:function(t){this.currentRange=t.currentRange,this.currentRangeUnit=t.currentRangeUnit,this.renderRange=t.renderRange,this.activeRange=t.activeRange,this.validRange=t.validRange,this.dateIncrement=t.dateIncrement,this.minTime=t.minTime,this.maxTime=t.maxTime,this.start=t.activeRange.start,this.end=t.activeRange.end,this.intervalStart=t.currentRange.start,this.intervalEnd=t.currentRange.end},buildPrevDateProfile:function(t){var e=t.clone().startOf(this.currentRangeUnit).subtract(this.dateIncrement);return this.buildDateProfile(e,-1)},buildNextDateProfile:function(t){var e=t.clone().startOf(this.currentRangeUnit).add(this.dateIncrement);return this.buildDateProfile(e,1)},buildDateProfile:function(t,n,i){var r,s,o,a,l=this.buildValidRange(),u=null,h=null;return i&&(t=j(t,l)),r=this.buildCurrentRangeInfo(t,n),s=this.buildRenderRange(r.range,r.unit),o=q(s),this.opt("showNonCurrentDates")||(o=U(o,r.range)),u=e.duration(this.opt("minTime")),h=e.duration(this.opt("maxTime")),this.adjustActiveRange(o,u,h),o=U(o,l),t=j(t,o),a=$(r.range,l),{validRange:l,currentRange:r.range,currentRangeUnit:r.unit,activeRange:o,renderRange:s,minTime:u,maxTime:h,isValid:a,date:t,dateIncrement:this.buildDateIncrement(r.duration)}},buildValidRange:function(){return this.getRangeOption("validRange",this.calendar.getNow())||{}},buildCurrentRangeInfo:function(t,e){var n,i=null,r=null,s=null;return this.viewSpec.duration?(i=this.viewSpec.duration,r=this.viewSpec.durationUnit,s=this.buildRangeFromDuration(t,e,i,r)):(n=this.opt("dayCount"))?(r="day",s=this.buildRangeFromDayCount(t,e,n)):(s=this.buildCustomVisibleRange(t))?r=V(s.start,s.end):(i=this.getFallbackDuration(),r=V(i),s=this.buildRangeFromDuration(t,e,i,r)),this.normalizeCurrentRange(s,r),{duration:i,unit:r,range:s}},getFallbackDuration:function(){return e.duration({days:1})},normalizeCurrentRange:function(t,e){/^(year|month|week|day)$/.test(e)?(t.start.stripTime(),t.end.stripTime()):(t.start.hasTime()||t.start.time(0),t.end.hasTime()||t.end.time(0))},adjustActiveRange:function(t,e,n){var i=!1;this.usesMinMaxTime&&(e<0&&(t.start.time(0).add(e),i=!0),n>864e5&&(t.end.time(n-864e5),i=!0),i&&(t.start.hasTime()||t.start.time(0),t.end.hasTime()||t.end.time(0)))},buildRangeFromDuration:function(t,n,i,r){var s,o,a,l=this.opt("dateAlignment"),u=t.clone();return i.as("days")<=1&&this.isHiddenDay(u)&&(u=this.skipHiddenDays(u,n),u.startOf("day")),l||(o=this.opt("dateIncrement"),o?(a=e.duration(o),l=a<i?O(a,o):r):l=r),u.startOf(l),s=u.clone().add(i),{start:u,end:s}},buildRangeFromDayCount:function(t,e,n){var i,r=this.opt("dateAlignment"),s=0,o=t.clone();r&&o.startOf(r),o.startOf("day"),o=this.skipHiddenDays(o,e),i=o.clone();do{i.add(1,"day"),this.isHiddenDay(i)||s++}while(s<n);return{start:o,end:i}},buildCustomVisibleRange:function(t){var e=this.getRangeOption("visibleRange",this.calendar.moment(t));return!e||e.start&&e.end?e:null},buildRenderRange:function(t,e){return this.trimHiddenDays(t)},buildDateIncrement:function(t){var n,i=this.opt("dateIncrement");return i?e.duration(i):(n=this.opt("dateAlignment"))?e.duration(1,n):t||e.duration({days:1})},trimHiddenDays:function(t){return{start:this.skipHiddenDays(t.start),end:this.skipHiddenDays(t.end,-1,!0)}},currentRangeAs:function(t){var e=this.currentRange;return e.end.diff(e.start,t,!0)},getRangeOption:function(t){var e=this.opt(t);if("function"==typeof e&&(e=e.apply(null,Array.prototype.slice.call(arguments,1))),e)return this.calendar.parseRange(e)},initHiddenDays:function(){var e,n=this.opt("hiddenDays")||[],i=[],r=0;for(!1===this.opt("weekends")&&n.push(0,6),e=0;e<7;e++)(i[e]=-1!==t.inArray(e,n))||r++;if(!r)throw"invalid hiddenDays";this.isHiddenDayHash=i},isHiddenDay:function(t){return e.isMoment(t)&&(t=t.day()),this.isHiddenDayHash[t]},skipHiddenDays:function(t,e,n){var i=t.clone();for(e=e||1;this.isHiddenDayHash[(i.day()+(n?e:0)+7)%7];)i.add(e,"days");return i}});var He=Zt.Scroller=bt.extend({el:null,scrollEl:null,overflowX:null,overflowY:null,constructor:function(t){t=t||{},this.overflowX=t.overflowX||t.overflow||"auto",this.overflowY=t.overflowY||t.overflow||"auto"},render:function(){this.el=this.renderEl(),this.applyOverflow()},renderEl:function(){return this.scrollEl=t('<div class="fc-scroller"></div>')},clear:function(){this.setHeight("auto"),this.applyOverflow()},destroy:function(){this.el.remove()},applyOverflow:function(){this.scrollEl.css({"overflow-x":this.overflowX,"overflow-y":this.overflowY})},lockOverflow:function(t){var e=this.overflowX,n=this.overflowY;t=t||this.getScrollbarWidths(),"auto"===e&&(e=t.top||t.bottom||this.scrollEl[0].scrollWidth-1>this.scrollEl[0].clientWidth?"scroll":"hidden"),"auto"===n&&(n=t.left||t.right||this.scrollEl[0].scrollHeight-1>this.scrollEl[0].clientHeight?"scroll":"hidden"),this.scrollEl.css({"overflow-x":e,"overflow-y":n})},setHeight:function(t){this.scrollEl.height(t)},getScrollTop:function(){return this.scrollEl.scrollTop()},setScrollTop:function(t){this.scrollEl.scrollTop(t)},getClientWidth:function(){return this.scrollEl[0].clientWidth},getClientHeight:function(){return this.scrollEl[0].clientHeight},getScrollbarWidths:function(){return p(this.scrollEl)}});_t.prototype.proxyCall=function(t){var e=Array.prototype.slice.call(arguments,1),n=[];return this.items.forEach(function(i){n.push(i[t].apply(i,e))}),n};var Re=Zt.Calendar=bt.extend(fe,{view:null,viewsByType:null,currentDate:null,loadingLevel:0,constructor:function(t,e){we.needed(),this.el=t,this.viewsByType={},this.viewSpecCache={},this.initOptionsInternals(e),this.initMomentInternals(),this.initCurrentDate(),Ut.call(this),this.initialize()},initialize:function(){},getCalendar:function(){return this},getView:function(){return this.view},publiclyTrigger:function(t,e){var n=Array.prototype.slice.call(arguments,2),i=this.opt(t);if(e=e||this.el[0],this.triggerWith(t,e,n),i)return i.apply(e,n)},instantiateView:function(t){var e=this.getViewSpec(t);return new e.class(this,e)},isValidViewType:function(t){return Boolean(this.getViewSpec(t))},changeView:function(t,e){e&&(e.start&&e.end?this.recordOptionOverrides({visibleRange:e}):this.currentDate=this.moment(e).stripZone()),this.renderView(t)},zoomTo:function(t,e){var n;e=e||"day",n=this.getViewSpec(e)||this.getUnitViewSpec(e),this.currentDate=t.clone(),this.renderView(n?n.type:null)},initCurrentDate:function(){var t=this.opt("defaultDate");this.currentDate=null!=t?this.moment(t).stripZone():this.getNow()},prev:function(){var t=this.view.buildPrevDateProfile(this.currentDate);t.isValid&&(this.currentDate=t.date,this.renderView())},next:function(){var t=this.view.buildNextDateProfile(this.currentDate);t.isValid&&(this.currentDate=t.date,this.renderView())},prevYear:function(){this.currentDate.add(-1,"years"),this.renderView()},nextYear:function(){this.currentDate.add(1,"years"),this.renderView()},today:function(){this.currentDate=this.getNow(),this.renderView()},gotoDate:function(t){this.currentDate=this.moment(t).stripZone(),this.renderView()},incrementDate:function(t){this.currentDate.add(e.duration(t)),this.renderView()},getDate:function(){return this.applyTimezone(this.currentDate)},pushLoading:function(){this.loadingLevel++||this.publiclyTrigger("loading",null,!0,this.view)},popLoading:function(){--this.loadingLevel||this.publiclyTrigger("loading",null,!1,this.view)},select:function(t,e){this.view.select(this.buildSelectSpan.apply(this,arguments))},unselect:function(){this.view&&this.view.unselect()},buildSelectSpan:function(t,e){var n,i=this.moment(t).stripZone();return n=e?this.moment(e).stripZone():i.hasTime()?i.clone().add(this.defaultTimedEventDuration):i.clone().add(this.defaultAllDayEventDuration),{start:i,end:n}},parseRange:function(t){var e=null,n=null;return t.start&&(e=this.moment(t.start).stripZone()),t.end&&(n=this.moment(t.end).stripZone()),e||n?e&&n&&n.isBefore(e)?null:{start:e,end:n}:null},rerenderEvents:function(){this.elementVisible()&&this.reportEventChange()}});Re.mixin({dirDefaults:null,localeDefaults:null,overrides:null,dynamicOverrides:null,optionsModel:null,initOptionsInternals:function(e){this.overrides=t.extend({},e),this.dynamicOverrides={},this.optionsModel=new ue,this.populateOptionsHash()},option:function(t,e){var n;if("string"==typeof t){if(void 0===e)return this.optionsModel.get(t);n={},n[t]=e,this.setOptions(n)}else"object"==typeof t&&this.setOptions(t)},opt:function(t){return this.optionsModel.get(t)},setOptions:function(t){var e,n=0;this.recordOptionOverrides(t);for(e in t)n++;if(1===n){if("height"===e||"contentHeight"===e||"aspectRatio"===e)return void this.updateSize(!0);if("defaultDate"===e)return;if("businessHours"===e)return void(this.view&&(this.view.unrenderBusinessHours(),this.view.renderBusinessHours()));if("timezone"===e)return this.rezoneArrayEventSources(),void this.refetchEvents()}this.renderHeader(),this.renderFooter(),this.viewsByType={},this.reinitView()},populateOptionsHash:function(){var t,e,i,r,s;t=ut(this.dynamicOverrides.locale,this.overrides.locale),e=xe[t],e||(t=Re.defaults.locale,e=xe[t]||{}),i=ut(this.dynamicOverrides.isRTL,this.overrides.isRTL,e.isRTL,Re.defaults.isRTL),r=i?Re.rtlDefaults:{},this.dirDefaults=r,this.localeDefaults=e,s=n([Re.defaults,r,e,this.overrides,this.dynamicOverrides]),Yt(s),this.optionsModel.reset(s)},recordOptionOverrides:function(t){var e;for(e in t)this.dynamicOverrides[e]=t[e];this.viewSpecCache={},this.populateOptionsHash()}}),Re.mixin({defaultAllDayEventDuration:null,defaultTimedEventDuration:null,localeData:null,initMomentInternals:function(){var t=this;this.defaultAllDayEventDuration=e.duration(this.opt("defaultAllDayEventDuration")),this.defaultTimedEventDuration=e.duration(this.opt("defaultTimedEventDuration")),this.optionsModel.watch("buildingMomentLocale",["?locale","?monthNames","?monthNamesShort","?dayNames","?dayNamesShort","?firstDay","?weekNumberCalculation"],function(e){var n,i=e.weekNumberCalculation,r=e.firstDay;"iso"===i&&(i="ISO");var s=rt(qt(e.locale));e.monthNames&&(s._months=e.monthNames),e.monthNamesShort&&(s._monthsShort=e.monthNamesShort),e.dayNames&&(s._weekdays=e.dayNames),e.dayNamesShort&&(s._weekdaysShort=e.dayNamesShort),null==r&&"ISO"===i&&(r=1),null!=r&&(n=rt(s._week),n.dow=r,s._week=n),"ISO"!==i&&"local"!==i&&"function"!=typeof i||(s._fullCalendar_weekCalc=i),t.localeData=s,t.currentDate&&t.localizeMoment(t.currentDate)})},moment:function(){var t;return"local"===this.opt("timezone")?(t=Zt.moment.apply(null,arguments),t.hasTime()&&t.local()):t="UTC"===this.opt("timezone")?Zt.moment.utc.apply(null,arguments):Zt.moment.parseZone.apply(null,arguments),this.localizeMoment(t),t},localizeMoment:function(t){t._locale=this.localeData},getIsAmbigTimezone:function(){return"local"!==this.opt("timezone")&&"UTC"!==this.opt("timezone")},applyTimezone:function(t){if(!t.hasTime())return t.clone();var e,n=this.moment(t.toArray()),i=t.time()-n.time();return i&&(e=n.clone().add(i),t.time()-e.time()==0&&(n=e)),n},getNow:function(){var t=this.opt("now");return"function"==typeof t&&(t=t()),this.moment(t).stripZone()},humanizeDuration:function(t){return t.locale(this.opt("locale")).humanize()},getEventEnd:function(t){return t.end?t.end.clone():this.getDefaultEventEnd(t.allDay,t.start)},getDefaultEventEnd:function(t,e){var n=e.clone();return t?n.stripTime().add(this.defaultAllDayEventDuration):n.add(this.defaultTimedEventDuration),this.getIsAmbigTimezone()&&n.stripZone(),n}}),Re.mixin({viewSpecCache:null,getViewSpec:function(t){var e=this.viewSpecCache;return e[t]||(e[t]=this.buildViewSpec(t))},getUnitViewSpec:function(e){var n,i,r;if(-1!=t.inArray(e,Jt))for(n=this.header.getViewsWithButtons(),t.each(Zt.views,function(t){n.push(t)}),i=0;i<n.length;i++)if((r=this.getViewSpec(n[i]))&&r.singleUnit==e)return r},buildViewSpec:function(t){for(var i,r,s,o,a,l=this.overrides.views||{},u=[],h=[],c=[],d=t;d;)i=$t[d],r=l[d],d=null,"function"==typeof i&&(i={class:i}),i&&(u.unshift(i),h.unshift(i.defaults||{}),s=s||i.duration,d=d||i.type),r&&(c.unshift(r),s=s||r.duration,d=d||r.type);return i=it(u),i.type=t,!!i.class&&(s=s||this.dynamicOverrides.duration||this.overrides.duration,s&&(o=e.duration(s),o.valueOf()&&(a=O(o,s),i.duration=o,i.durationUnit=a,1===o.as(a)&&(i.singleUnit=a,c.unshift(l[a]||{})))),i.defaults=n(h),i.overrides=n(c),this.buildViewSpecOptions(i),this.buildViewSpecButtonText(i,t),i)},buildViewSpecOptions:function(t){t.options=n([Re.defaults,t.defaults,this.dirDefaults,this.localeDefaults,this.overrides,t.overrides,this.dynamicOverrides]),Yt(t.options)},buildViewSpecButtonText:function(t,e){function n(n){var i=n.buttonText||{};return i[e]||(t.buttonTextKey?i[t.buttonTextKey]:null)||(t.singleUnit?i[t.singleUnit]:null)}t.buttonTextOverride=n(this.dynamicOverrides)||n(this.overrides)||t.overrides.buttonText,t.buttonTextDefault=n(this.localeDefaults)||n(this.dirDefaults)||t.defaults.buttonText||n(Re.defaults)||(t.duration?this.humanizeDuration(t.duration):null)||e}}),Re.mixin({el:null,contentEl:null,suggestedViewHeight:null,windowResizeProxy:null,ignoreWindowResize:0,render:function(){this.contentEl?this.elementVisible()&&(this.calcSize(),this.renderView()):this.initialRender()},initialRender:function(){var e=this,n=this.el;n.addClass("fc"),n.on("click.fc","a[data-goto]",function(n){var i=t(this),r=i.data("goto"),s=e.moment(r.date),o=r.type,a=e.view.opt("navLink"+gt(o)+"Click");"function"==typeof a?a(s,n):("string"==typeof a&&(o=a),e.zoomTo(s,o))}),this.optionsModel.watch("applyingThemeClasses",["?theme"],function(t){n.toggleClass("ui-widget",t.theme),n.toggleClass("fc-unthemed",!t.theme)}),this.optionsModel.watch("applyingDirClasses",["?isRTL","?locale"],function(t){n.toggleClass("fc-ltr",!t.isRTL),n.toggleClass("fc-rtl",t.isRTL)}),this.contentEl=t("<div class='fc-view-container'/>").prependTo(n),this.initToolbars(),this.renderHeader(),this.renderFooter(),this.renderView(this.opt("defaultView")),this.opt("handleWindowResize")&&t(window).resize(this.windowResizeProxy=yt(this.windowResize.bind(this),this.opt("windowResizeDelay")))},destroy:function(){this.view&&this.view.removeElement(),this.toolbarsManager.proxyCall("removeElement"),this.contentEl.remove(),this.el.removeClass("fc fc-ltr fc-rtl fc-unthemed ui-widget"),this.el.off(".fc"),this.windowResizeProxy&&(t(window).unbind("resize",this.windowResizeProxy),this.windowResizeProxy=null),we.unneeded()},elementVisible:function(){return this.el.is(":visible")},renderView:function(e,n){this.ignoreWindowResize++;var i=this.view&&e&&this.view.type!==e;i&&(this.freezeContentHeight(),this.clearView()),!this.view&&e&&(this.view=this.viewsByType[e]||(this.viewsByType[e]=this.instantiateView(e)),this.view.setElement(t("<div class='fc-view fc-"+e+"-view' />").appendTo(this.contentEl)),this.toolbarsManager.proxyCall("activateButton",e)),this.view&&(n&&this.view.addForcedScroll(n),this.elementVisible()&&(this.currentDate=this.view.setDate(this.currentDate))),i&&this.thawContentHeight(),this.ignoreWindowResize--},clearView:function(){this.toolbarsManager.proxyCall("deactivateButton",this.view.type),this.view.removeElement(),this.view=null},reinitView:function(){this.ignoreWindowResize++,this.freezeContentHeight();var t=this.view.type,e=this.view.queryScroll();this.clearView(),this.calcSize(),this.renderView(t,e),this.thawContentHeight(),this.ignoreWindowResize--},getSuggestedViewHeight:function(){return null===this.suggestedViewHeight&&this.calcSize(),this.suggestedViewHeight},isHeightAuto:function(){return"auto"===this.opt("contentHeight")||"auto"===this.opt("height")},updateSize:function(t){if(this.elementVisible())return t&&this._calcSize(),this.ignoreWindowResize++,this.view.updateSize(!0),this.ignoreWindowResize--,!0},calcSize:function(){this.elementVisible()&&this._calcSize()},_calcSize:function(){var t=this.opt("contentHeight"),e=this.opt("height");this.suggestedViewHeight="number"==typeof t?t:"function"==typeof t?t():"number"==typeof e?e-this.queryToolbarsHeight():"function"==typeof e?e()-this.queryToolbarsHeight():"parent"===e?this.el.parent().height()-this.queryToolbarsHeight():Math.round(this.contentEl.width()/Math.max(this.opt("aspectRatio"),.5))},windowResize:function(t){!this.ignoreWindowResize&&t.target===window&&this.view.renderRange&&this.updateSize(!0)&&this.view.publiclyTrigger("windowResize",this.el[0])},freezeContentHeight:function(){this.contentEl.css({width:"100%",height:this.contentEl.height(),overflow:"hidden"})},thawContentHeight:function(){this.contentEl.css({width:"",height:"",overflow:""})}}),Re.mixin({header:null,footer:null,toolbarsManager:null,initToolbars:function(){this.header=new Wt(this,this.computeHeaderOptions()),this.footer=new Wt(this,this.computeFooterOptions()),this.toolbarsManager=new _t([this.header,this.footer])},computeHeaderOptions:function(){return{extraClasses:"fc-header-toolbar",layout:this.opt("header")}},computeFooterOptions:function(){return{extraClasses:"fc-footer-toolbar",layout:this.opt("footer")}},renderHeader:function(){var t=this.header;t.setToolbarOptions(this.computeHeaderOptions()),t.render(),t.el&&this.el.prepend(t.el)},renderFooter:function(){var t=this.footer;t.setToolbarOptions(this.computeFooterOptions()),t.render(),t.el&&this.el.append(t.el)},setToolbarsTitle:function(t){this.toolbarsManager.proxyCall("updateTitle",t)},updateToolbarButtons:function(){var t=this.getNow(),e=this.view,n=e.buildDateProfile(t),i=e.buildPrevDateProfile(this.currentDate),r=e.buildNextDateProfile(this.currentDate);this.toolbarsManager.proxyCall(n.isValid&&!Z(t,e.currentRange)?"enableButton":"disableButton","today"),this.toolbarsManager.proxyCall(i.isValid?"enableButton":"disableButton","prev"),this.toolbarsManager.proxyCall(r.isValid?"enableButton":"disableButton","next")},queryToolbarsHeight:function(){return this.toolbarsManager.items.reduce(function(t,e){return t+(e.el?e.el.outerHeight(!0):0)},0)}}),Re.defaults={titleRangeSeparator:" – ",monthYearFormat:"MMMM YYYY",defaultTimedEventDuration:"02:00:00",defaultAllDayEventDuration:{days:1},forceEventDuration:!1,nextDayThreshold:"09:00:00",defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberTitle:"W",weekNumberCalculation:"local",scrollTime:"06:00:00",minTime:"00:00:00",maxTime:"24:00:00",showNonCurrentDates:!0,lazyFetching:!0,startParam:"start",endParam:"end",timezoneParam:"timezone",timezone:!1,isRTL:!1,buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day"},buttonIcons:{prev:"left-single-arrow",next:"right-single-arrow",prevYear:"left-double-arrow",nextYear:"right-double-arrow"},allDayText:"all-day",theme:!1,themeButtonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e",prevYear:"seek-prev",nextYear:"seek-next"},dragOpacity:.75,dragRevertDuration:500,dragScroll:!0,unselectAuto:!0,dropAccept:"*",eventOrder:"title",eventLimit:!1,eventLimitText:"more",eventLimitClick:"popover",dayPopoverFormat:"LL",handleWindowResize:!0,windowResizeDelay:100,longPressDelay:1e3},Re.englishDefaults={dayPopoverFormat:"dddd, MMMM D"},Re.rtlDefaults={header:{left:"next,prev today",center:"",right:"title"},buttonIcons:{prev:"right-single-arrow",next:"left-single-arrow",prevYear:"right-double-arrow",nextYear:"left-double-arrow"},themeButtonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w",nextYear:"seek-prev",prevYear:"seek-next"}};var xe=Zt.locales={};Zt.datepickerLocale=function(e,n,i){var r=xe[e]||(xe[e]={});r.isRTL=i.isRTL,r.weekNumberTitle=i.weekHeader,t.each(Ie,function(t,e){r[t]=e(i)}),t.datepicker&&(t.datepicker.regional[n]=t.datepicker.regional[e]=i,t.datepicker.regional.en=t.datepicker.regional[""],t.datepicker.setDefaults(i))},Zt.locale=function(e,i){var r,s;r=xe[e]||(xe[e]={}),i&&(r=xe[e]=n([r,i])),s=qt(e),t.each(ke,function(t,e){null==r[t]&&(r[t]=e(s,r))}),Re.defaults.locale=e};var Ie={buttonText:function(t){return{prev:ct(t.prevText),next:ct(t.nextText),today:ct(t.currentText)}},monthYearFormat:function(t){return t.showMonthAfterYear?"YYYY["+t.yearSuffix+"] MMMM":"MMMM YYYY["+t.yearSuffix+"]"}},ke={dayOfMonthFormat:function(t,e){var n=t.longDateFormat("l");return n=n.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g,""),e.isRTL?n+=" ddd":n="ddd "+n,n},mediumTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"a")},smallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"a")},extraSmallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"t")},hourFormat:function(t){return t.longDateFormat("LT").replace(":mm","").replace(/(\Wmm)$/,"").replace(/\s*a$/i,"a")},noMeridiemTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"")}},Me={smallDayDateFormat:function(t){return t.isRTL?"D dd":"dd D"},weekFormat:function(t){return t.isRTL?"w[ "+t.weekNumberTitle+"]":"["+t.weekNumberTitle+" ]w"},smallWeekFormat:function(t){return t.isRTL?"w["+t.weekNumberTitle+"]":"["+t.weekNumberTitle+"]w"}};Zt.locale("en",Re.englishDefaults),Zt.sourceNormalizers=[],Zt.sourceFetchers=[];var Be={dataType:"json",cache:!1},Le=1;Re.prototype.mutateSeg=function(t,e){return this.mutateEvent(t.event,e)},Re.prototype.normalizeEvent=function(t){},Re.prototype.spanContainsSpan=function(t,e){var n=t.start.clone().stripZone(),i=this.getEventEnd(t).stripZone()
+;return e.start>=n&&e.end<=i},Re.prototype.getPeerEvents=function(t,e){var n,i,r=this.getEventCache(),s=[];for(n=0;n<r.length;n++)i=r[n],e&&e._id===i._id||s.push(i);return s},Re.prototype.isEventSpanAllowed=function(t,e){var n=e.source||{},i=this.opt("eventAllow"),r=ut(e.constraint,n.constraint,this.opt("eventConstraint")),s=ut(e.overlap,n.overlap,this.opt("eventOverlap"));return this.isSpanAllowed(t,r,s,e)&&(!i||!1!==i(t,e))},Re.prototype.isExternalSpanAllowed=function(e,n,i){var r,s;return i&&(r=t.extend({},i,n),s=this.expandEvent(this.buildEventFromInput(r))[0]),s?this.isEventSpanAllowed(e,s):this.isSelectionSpanAllowed(e)},Re.prototype.isSelectionSpanAllowed=function(t){var e=this.opt("selectAllow");return this.isSpanAllowed(t,this.opt("selectConstraint"),this.opt("selectOverlap"))&&(!e||!1!==e(t))},Re.prototype.isSpanAllowed=function(t,e,n,i){var r,s,o,a,l,u;if(null!=e&&(r=this.constraintToEvents(e))){for(s=!1,a=0;a<r.length;a++)if(this.spanContainsSpan(r[a],t)){s=!0;break}if(!s)return!1}for(o=this.getPeerEvents(t,i),a=0;a<o.length;a++)if(l=o[a],this.eventIntersectsRange(l,t)){if(!1===n)return!1;if("function"==typeof n&&!n(l,i))return!1;if(i){if(!1===(u=ut(l.overlap,(l.source||{}).overlap)))return!1;if("function"==typeof u&&!u(i,l))return!1}}return!0},Re.prototype.constraintToEvents=function(t){return"businessHours"===t?this.getCurrentBusinessHourEvents():"object"==typeof t?null!=t.start?this.expandEvent(this.buildEventFromInput(t)):null:this.clientEvents(t)},Re.prototype.eventIntersectsRange=function(t,e){var n=t.start.clone().stripZone(),i=this.getEventEnd(t).stripZone();return e.start<i&&e.end>n};var Ne={id:"_fcBusinessHours",start:"09:00",end:"17:00",dow:[1,2,3,4,5],rendering:"inverse-background"};Re.prototype.getCurrentBusinessHourEvents=function(t){return this.computeBusinessHourEvents(t,this.opt("businessHours"))},Re.prototype.computeBusinessHourEvents=function(e,n){return!0===n?this.expandBusinessHourEvents(e,[{}]):t.isPlainObject(n)?this.expandBusinessHourEvents(e,[n]):t.isArray(n)?this.expandBusinessHourEvents(e,n,!0):[]},Re.prototype.expandBusinessHourEvents=function(e,n,i){var r,s,o=this.getView(),a=[];for(r=0;r<n.length;r++)s=n[r],i&&!s.dow||(s=t.extend({},Ne,s),e&&(s.start=null,s.end=null),a.push.apply(a,this.expandEvent(this.buildEventFromInput(s),o.activeRange.start,o.activeRange.end)));return a};var ze=Zt.BasicView=Ce.extend({scroller:null,dayGridClass:De,dayGrid:null,dayNumbersVisible:!1,colWeekNumbersVisible:!1,cellWeekNumbersVisible:!1,weekNumberWidth:null,headContainerEl:null,headRowEl:null,initialize:function(){this.dayGrid=this.instantiateDayGrid(),this.scroller=new He({overflowX:"hidden",overflowY:"auto"})},instantiateDayGrid:function(){return new(this.dayGridClass.extend(Fe))(this)},buildRenderRange:function(t,e){var n=Ce.prototype.buildRenderRange.apply(this,arguments);return/^(year|month)$/.test(e)&&(n.start.startOf("week"),n.end.weekday()&&n.end.add(1,"week").startOf("week")),this.trimHiddenDays(n)},renderDates:function(){this.dayGrid.breakOnWeeks=/year|month|week/.test(this.currentRangeUnit),this.dayGrid.setRange(this.renderRange),this.dayNumbersVisible=this.dayGrid.rowCnt>1,this.opt("weekNumbers")&&(this.opt("weekNumbersWithinDays")?(this.cellWeekNumbersVisible=!0,this.colWeekNumbersVisible=!1):(this.cellWeekNumbersVisible=!1,this.colWeekNumbersVisible=!0)),this.dayGrid.numbersVisible=this.dayNumbersVisible||this.cellWeekNumbersVisible||this.colWeekNumbersVisible,this.el.addClass("fc-basic-view").html(this.renderSkeletonHtml()),this.renderHead(),this.scroller.render();var e=this.scroller.el.addClass("fc-day-grid-container"),n=t('<div class="fc-day-grid" />').appendTo(e);this.el.find(".fc-body > tr > td").append(e),this.dayGrid.setElement(n),this.dayGrid.renderDates(this.hasRigidRows())},renderHead:function(){this.headContainerEl=this.el.find(".fc-head-container").html(this.dayGrid.renderHeadHtml()),this.headRowEl=this.headContainerEl.find(".fc-row")},unrenderDates:function(){this.dayGrid.unrenderDates(),this.dayGrid.removeElement(),this.scroller.destroy()},renderBusinessHours:function(){this.dayGrid.renderBusinessHours()},unrenderBusinessHours:function(){this.dayGrid.unrenderBusinessHours()},renderSkeletonHtml:function(){return'<table><thead class="fc-head"><tr><td class="fc-head-container '+this.widgetHeaderClass+'"></td></tr></thead><tbody class="fc-body"><tr><td class="'+this.widgetContentClass+'"></td></tr></tbody></table>'},weekNumberStyleAttr:function(){return null!==this.weekNumberWidth?'style="width:'+this.weekNumberWidth+'px"':""},hasRigidRows:function(){var t=this.opt("eventLimit");return t&&"number"!=typeof t},updateWidth:function(){this.colWeekNumbersVisible&&(this.weekNumberWidth=u(this.el.find(".fc-week-number")))},setHeight:function(t,e){var n,s,o=this.opt("eventLimit");this.scroller.clear(),r(this.headRowEl),this.dayGrid.removeSegPopover(),o&&"number"==typeof o&&this.dayGrid.limitRows(o),n=this.computeScrollerHeight(t),this.setGridHeight(n,e),o&&"number"!=typeof o&&this.dayGrid.limitRows(o),e||(this.scroller.setHeight(n),s=this.scroller.getScrollbarWidths(),(s.left||s.right)&&(i(this.headRowEl,s),n=this.computeScrollerHeight(t),this.scroller.setHeight(n)),this.scroller.lockOverflow(s))},computeScrollerHeight:function(t){return t-h(this.el,this.scroller.el)},setGridHeight:function(t,e){e?l(this.dayGrid.rowEls):a(this.dayGrid.rowEls,t,!0)},computeInitialDateScroll:function(){return{top:0}},queryDateScroll:function(){return{top:this.scroller.getScrollTop()}},applyDateScroll:function(t){void 0!==t.top&&this.scroller.setScrollTop(t.top)},hitsNeeded:function(){this.dayGrid.hitsNeeded()},hitsNotNeeded:function(){this.dayGrid.hitsNotNeeded()},prepareHits:function(){this.dayGrid.prepareHits()},releaseHits:function(){this.dayGrid.releaseHits()},queryHit:function(t,e){return this.dayGrid.queryHit(t,e)},getHitSpan:function(t){return this.dayGrid.getHitSpan(t)},getHitEl:function(t){return this.dayGrid.getHitEl(t)},renderEvents:function(t){this.dayGrid.renderEvents(t),this.updateHeight()},getEventSegs:function(){return this.dayGrid.getEventSegs()},unrenderEvents:function(){this.dayGrid.unrenderEvents()},renderDrag:function(t,e){return this.dayGrid.renderDrag(t,e)},unrenderDrag:function(){this.dayGrid.unrenderDrag()},renderSelection:function(t){this.dayGrid.renderSelection(t)},unrenderSelection:function(){this.dayGrid.unrenderSelection()}}),Fe={renderHeadIntroHtml:function(){var t=this.view;return t.colWeekNumbersVisible?'<th class="fc-week-number '+t.widgetHeaderClass+'" '+t.weekNumberStyleAttr()+"><span>"+ht(t.opt("weekNumberTitle"))+"</span></th>":""},renderNumberIntroHtml:function(t){var e=this.view,n=this.getCellDate(t,0);return e.colWeekNumbersVisible?'<td class="fc-week-number" '+e.weekNumberStyleAttr()+">"+e.buildGotoAnchorHtml({date:n,type:"week",forceOff:1===this.colCnt},n.format("w"))+"</td>":""},renderBgIntroHtml:function(){var t=this.view;return t.colWeekNumbersVisible?'<td class="fc-week-number '+t.widgetContentClass+'" '+t.weekNumberStyleAttr()+"></td>":""},renderIntroHtml:function(){var t=this.view;return t.colWeekNumbersVisible?'<td class="fc-week-number" '+t.weekNumberStyleAttr()+"></td>":""}},Ae=Zt.MonthView=ze.extend({buildRenderRange:function(){var t,e=ze.prototype.buildRenderRange.apply(this,arguments);return this.isFixedWeeks()&&(t=Math.ceil(e.end.diff(e.start,"weeks",!0)),e.end.add(6-t,"weeks")),e},setGridHeight:function(t,e){e&&(t*=this.rowCnt/6),a(this.dayGrid.rowEls,t,!e)},isFixedWeeks:function(){return this.opt("fixedWeekCount")}});$t.basic={class:ze},$t.basicDay={type:"basic",duration:{days:1}},$t.basicWeek={type:"basic",duration:{weeks:1}},$t.month={class:Ae,duration:{months:1},defaults:{fixedWeekCount:!0}};var Ge=Zt.AgendaView=Ce.extend({scroller:null,timeGridClass:Te,timeGrid:null,dayGridClass:De,dayGrid:null,axisWidth:null,headContainerEl:null,noScrollRowEls:null,bottomRuleEl:null,usesMinMaxTime:!0,initialize:function(){this.timeGrid=this.instantiateTimeGrid(),this.opt("allDaySlot")&&(this.dayGrid=this.instantiateDayGrid()),this.scroller=new He({overflowX:"hidden",overflowY:"auto"})},instantiateTimeGrid:function(){return new(this.timeGridClass.extend(Ve))(this)},instantiateDayGrid:function(){return new(this.dayGridClass.extend(Oe))(this)},renderDates:function(){this.timeGrid.setRange(this.renderRange),this.dayGrid&&this.dayGrid.setRange(this.renderRange),this.el.addClass("fc-agenda-view").html(this.renderSkeletonHtml()),this.renderHead(),this.scroller.render();var e=this.scroller.el.addClass("fc-time-grid-container"),n=t('<div class="fc-time-grid" />').appendTo(e);this.el.find(".fc-body > tr > td").append(e),this.timeGrid.setElement(n),this.timeGrid.renderDates(),this.bottomRuleEl=t('<hr class="fc-divider '+this.widgetHeaderClass+'"/>').appendTo(this.timeGrid.el),this.dayGrid&&(this.dayGrid.setElement(this.el.find(".fc-day-grid")),this.dayGrid.renderDates(),this.dayGrid.bottomCoordPadding=this.dayGrid.el.next("hr").outerHeight()),this.noScrollRowEls=this.el.find(".fc-row:not(.fc-scroller *)")},renderHead:function(){this.headContainerEl=this.el.find(".fc-head-container").html(this.timeGrid.renderHeadHtml())},unrenderDates:function(){this.timeGrid.unrenderDates(),this.timeGrid.removeElement(),this.dayGrid&&(this.dayGrid.unrenderDates(),this.dayGrid.removeElement()),this.scroller.destroy()},renderSkeletonHtml:function(){return'<table><thead class="fc-head"><tr><td class="fc-head-container '+this.widgetHeaderClass+'"></td></tr></thead><tbody class="fc-body"><tr><td class="'+this.widgetContentClass+'">'+(this.dayGrid?'<div class="fc-day-grid"/><hr class="fc-divider '+this.widgetHeaderClass+'"/>':"")+"</td></tr></tbody></table>"},axisStyleAttr:function(){return null!==this.axisWidth?'style="width:'+this.axisWidth+'px"':""},renderBusinessHours:function(){this.timeGrid.renderBusinessHours(),this.dayGrid&&this.dayGrid.renderBusinessHours()},unrenderBusinessHours:function(){this.timeGrid.unrenderBusinessHours(),this.dayGrid&&this.dayGrid.unrenderBusinessHours()},getNowIndicatorUnit:function(){return this.timeGrid.getNowIndicatorUnit()},renderNowIndicator:function(t){this.timeGrid.renderNowIndicator(t)},unrenderNowIndicator:function(){this.timeGrid.unrenderNowIndicator()},updateSize:function(t){this.timeGrid.updateSize(t),Ce.prototype.updateSize.call(this,t)},updateWidth:function(){this.axisWidth=u(this.el.find(".fc-axis"))},setHeight:function(t,e){var n,s,o;this.bottomRuleEl.hide(),this.scroller.clear(),r(this.noScrollRowEls),this.dayGrid&&(this.dayGrid.removeSegPopover(),n=this.opt("eventLimit"),n&&"number"!=typeof n&&(n=Pe),n&&this.dayGrid.limitRows(n)),e||(s=this.computeScrollerHeight(t),this.scroller.setHeight(s),o=this.scroller.getScrollbarWidths(),(o.left||o.right)&&(i(this.noScrollRowEls,o),s=this.computeScrollerHeight(t),this.scroller.setHeight(s)),this.scroller.lockOverflow(o),this.timeGrid.getTotalSlatHeight()<s&&this.bottomRuleEl.show())},computeScrollerHeight:function(t){return t-h(this.el,this.scroller.el)},computeInitialDateScroll:function(){var t=e.duration(this.opt("scrollTime")),n=this.timeGrid.computeTimeTop(t);return n=Math.ceil(n),n&&n++,{top:n}},queryDateScroll:function(){return{top:this.scroller.getScrollTop()}},applyDateScroll:function(t){void 0!==t.top&&this.scroller.setScrollTop(t.top)},hitsNeeded:function(){this.timeGrid.hitsNeeded(),this.dayGrid&&this.dayGrid.hitsNeeded()},hitsNotNeeded:function(){this.timeGrid.hitsNotNeeded(),this.dayGrid&&this.dayGrid.hitsNotNeeded()},prepareHits:function(){this.timeGrid.prepareHits(),this.dayGrid&&this.dayGrid.prepareHits()},releaseHits:function(){this.timeGrid.releaseHits(),this.dayGrid&&this.dayGrid.releaseHits()},queryHit:function(t,e){var n=this.timeGrid.queryHit(t,e);return!n&&this.dayGrid&&(n=this.dayGrid.queryHit(t,e)),n},getHitSpan:function(t){return t.component.getHitSpan(t)},getHitEl:function(t){return t.component.getHitEl(t)},renderEvents:function(t){var e,n=[],i=[];for(e=0;e<t.length;e++)t[e].allDay?n.push(t[e]):i.push(t[e]);this.timeGrid.renderEvents(i),this.dayGrid&&this.dayGrid.renderEvents(n),this.updateHeight()},getEventSegs:function(){return this.timeGrid.getEventSegs().concat(this.dayGrid?this.dayGrid.getEventSegs():[])},unrenderEvents:function(){this.timeGrid.unrenderEvents(),this.dayGrid&&this.dayGrid.unrenderEvents()},renderDrag:function(t,e){return t.start.hasTime()?this.timeGrid.renderDrag(t,e):this.dayGrid?this.dayGrid.renderDrag(t,e):void 0},unrenderDrag:function(){this.timeGrid.unrenderDrag(),this.dayGrid&&this.dayGrid.unrenderDrag()},renderSelection:function(t){t.start.hasTime()||t.end.hasTime()?this.timeGrid.renderSelection(t):this.dayGrid&&this.dayGrid.renderSelection(t)},unrenderSelection:function(){this.timeGrid.unrenderSelection(),this.dayGrid&&this.dayGrid.unrenderSelection()}}),Ve={renderHeadIntroHtml:function(){var t,e=this.view;return e.opt("weekNumbers")?(t=this.start.format(e.opt("smallWeekFormat")),'<th class="fc-axis fc-week-number '+e.widgetHeaderClass+'" '+e.axisStyleAttr()+">"+e.buildGotoAnchorHtml({date:this.start,type:"week",forceOff:this.colCnt>1},ht(t))+"</th>"):'<th class="fc-axis '+e.widgetHeaderClass+'" '+e.axisStyleAttr()+"></th>"},renderBgIntroHtml:function(){var t=this.view;return'<td class="fc-axis '+t.widgetContentClass+'" '+t.axisStyleAttr()+"></td>"},renderIntroHtml:function(){return'<td class="fc-axis" '+this.view.axisStyleAttr()+"></td>"}},Oe={renderBgIntroHtml:function(){var t=this.view;return'<td class="fc-axis '+t.widgetContentClass+'" '+t.axisStyleAttr()+"><span>"+t.getAllDayHtml()+"</span></td>"},renderIntroHtml:function(){return'<td class="fc-axis" '+this.view.axisStyleAttr()+"></td>"}},Pe=5,_e=[{hours:1},{minutes:30},{minutes:15},{seconds:30},{seconds:15}];$t.agenda={class:Ge,defaults:{allDaySlot:!0,slotDuration:"00:30:00",slotEventOverlap:!0}},$t.agendaDay={type:"agenda",duration:{days:1}},$t.agendaWeek={type:"agenda",duration:{weeks:1}};var We=Ce.extend({grid:null,scroller:null,initialize:function(){this.grid=new Ye(this),this.scroller=new He({overflowX:"hidden",overflowY:"auto"})},renderSkeleton:function(){this.el.addClass("fc-list-view "+this.widgetContentClass),this.scroller.render(),this.scroller.el.appendTo(this.el),this.grid.setElement(this.scroller.scrollEl)},unrenderSkeleton:function(){this.scroller.destroy()},setHeight:function(t,e){this.scroller.setHeight(this.computeScrollerHeight(t))},computeScrollerHeight:function(t){return t-h(this.el,this.scroller.el)},renderDates:function(){this.grid.setRange(this.renderRange)},renderEvents:function(t){this.grid.renderEvents(t)},unrenderEvents:function(){this.grid.unrenderEvents()},isEventResizable:function(t){return!1},isEventDraggable:function(t){return!1}}),Ye=be.extend({segSelector:".fc-list-item",hasDayInteractions:!1,spanToSegs:function(t){for(var e,n=this.view,i=n.renderRange.start.clone().time(0),r=0,s=[];i<n.renderRange.end;)if(e=z(t,{start:i,end:i.clone().add(1,"day")}),e&&(e.dayIndex=r,s.push(e)),i.add(1,"day"),r++,e&&!e.isEnd&&t.end.hasTime()&&t.end<i.clone().add(this.view.nextDayThreshold)){e.end=t.end.clone(),e.isEnd=!0;break}return s},computeEventTimeFormat:function(){return this.view.opt("mediumTimeFormat")},handleSegClick:function(e,n){var i;be.prototype.handleSegClick.apply(this,arguments),t(n.target).closest("a[href]").length||(i=e.event.url)&&!n.isDefaultPrevented()&&(window.location.href=i)},renderFgSegs:function(t){return t=this.renderFgSegEls(t),t.length?this.renderSegList(t):this.renderEmptyMessage(),t},renderEmptyMessage:function(){this.el.html('<div class="fc-list-empty-wrap2"><div class="fc-list-empty-wrap1"><div class="fc-list-empty">'+ht(this.view.opt("noEventsMessage"))+"</div></div></div>")},renderSegList:function(e){var n,i,r,s=this.groupSegsByDay(e),o=t('<table class="fc-list-table"><tbody/></table>'),a=o.find("tbody");for(n=0;n<s.length;n++)if(i=s[n])for(a.append(this.dayHeaderHtml(this.view.renderRange.start.clone().add(n,"days"))),this.sortEventSegs(i),r=0;r<i.length;r++)a.append(i[r].el);this.el.empty().append(o)},groupSegsByDay:function(t){var e,n,i=[];for(e=0;e<t.length;e++)n=t[e],(i[n.dayIndex]||(i[n.dayIndex]=[])).push(n);return i},dayHeaderHtml:function(t){var e=this.view,n=e.opt("listDayFormat"),i=e.opt("listDayAltFormat");return'<tr class="fc-list-heading" data-date="'+t.format("YYYY-MM-DD")+'"><td class="'+e.widgetHeaderClass+'" colspan="3">'+(n?e.buildGotoAnchorHtml(t,{class:"fc-list-heading-main"},ht(t.format(n))):"")+(i?e.buildGotoAnchorHtml(t,{class:"fc-list-heading-alt"},ht(t.format(i))):"")+"</td></tr>"},fgSegHtml:function(t){var e,n=this.view,i=["fc-list-item"].concat(this.getSegCustomClasses(t)),r=this.getSegBackgroundColor(t),s=t.event,o=s.url;return e=s.allDay?n.getAllDayHtml():n.isMultiDayEvent(s)?t.isStart||t.isEnd?ht(this.getEventTimeText(t)):n.getAllDayHtml():ht(this.getEventTimeText(s)),o&&i.push("fc-has-url"),'<tr class="'+i.join(" ")+'">'+(this.displayEventTime?'<td class="fc-list-item-time '+n.widgetContentClass+'">'+(e||"")+"</td>":"")+'<td class="fc-list-item-marker '+n.widgetContentClass+'"><span class="fc-event-dot"'+(r?' style="background-color:'+r+'"':"")+'></span></td><td class="fc-list-item-title '+n.widgetContentClass+'"><a'+(o?' href="'+ht(o)+'"':"")+">"+ht(t.event.title||"")+"</a></td></tr>"}});return $t.list={class:We,buttonTextKey:"list",defaults:{buttonText:"list",listDayFormat:"LL",noEventsMessage:"No events to display"}},$t.listDay={type:"list",duration:{days:1},defaults:{listDayFormat:"dddd"}},$t.listWeek={type:"list",duration:{weeks:1},defaults:{listDayFormat:"dddd",listDayAltFormat:"LL"}},$t.listMonth={type:"list",duration:{month:1},defaults:{listDayAltFormat:"dddd"}},$t.listYear={type:"list",duration:{year:1},defaults:{listDayAltFormat:"dddd"}},Zt});
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.print.min.css b/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.print.min.css
new file mode 100644
index 0000000000000000000000000000000000000000..8b6cdac8154659b9ccae5239709b076d7179b098
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/fullcalendar.print.min.css
@@ -0,0 +1,5 @@
+/*!
+ * FullCalendar v3.4.0 Print Stylesheet
+ * Docs & License: https://fullcalendar.io/
+ * (c) 2017 Adam Shaw
+ */.fc-bg,.fc-bgevent-container,.fc-bgevent-skeleton,.fc-business-container,.fc-event .fc-resizer,.fc-helper-container,.fc-helper-skeleton,.fc-highlight-container,.fc-highlight-skeleton{display:none}.fc tbody .fc-row,.fc-time-grid{min-height:0!important}.fc-time-grid .fc-event.fc-not-end:after,.fc-time-grid .fc-event.fc-not-start:before{content:"..."}.fc{max-width:100%!important}.fc-event{background:#fff!important;color:#000!important;page-break-inside:avoid}.fc hr,.fc tbody,.fc td,.fc th,.fc thead,.fc-row{border-color:#ccc!important;background:#fff!important}.fc tbody .fc-row{height:auto!important}.fc tbody .fc-row .fc-content-skeleton{position:static;padding-bottom:0!important}.fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td{padding-bottom:1em}.fc tbody .fc-row .fc-content-skeleton table{height:1em}.fc-more,.fc-more-cell{display:none!important}.fc tr.fc-limited{display:table-row!important}.fc td.fc-limited{display:table-cell!important}.fc-agenda-view .fc-axis,.fc-popover{display:none}.fc-slats,.fc-time-grid hr{display:none!important}.fc button,.fc-button-group,.fc-time-grid .fc-event .fc-time span{display:none}.fc-time-grid .fc-content-skeleton{position:static}.fc-time-grid .fc-content-skeleton table{height:4em}.fc-time-grid .fc-event-container{margin:0!important}.fc-time-grid .fc-event{position:static!important;margin:3px 2px!important}.fc-time-grid .fc-event.fc-not-end{border-bottom-width:1px!important}.fc-time-grid .fc-event.fc-not-start{border-top-width:1px!important}.fc-time-grid .fc-event .fc-time{white-space:normal!important}.fc-time-grid .fc-event .fc-time:after{content:attr(data-full)}.fc-day-grid-container,.fc-scroller,.fc-time-grid-container{overflow:visible!important;height:auto!important}.fc-row{border:0!important;margin:0!important}
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/lib/gcal.min.js b/smash/web/static/fullcalendar-scheduler/lib/gcal.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..d1d47b2f8a681783c4a68d68687a39bebc5028d8
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/gcal.min.js
@@ -0,0 +1,6 @@
+/*!
+ * FullCalendar v3.4.0 Google Calendar Plugin
+ * Docs & License: https://fullcalendar.io/
+ * (c) 2017 Adam Shaw
+ */
+!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){function a(a,t,d,c,i){function s(o,r){var l=r||[{message:o}];(a.googleCalendarError||e.noop).apply(i,l),(i.opt("googleCalendarError")||e.noop).apply(i,l),n.warn.apply(null,[o].concat(r||[]))}var u,g,p=r+"/"+encodeURIComponent(a.googleCalendarId)+"/events?callback=?",m=a.googleCalendarApiKey||i.opt("googleCalendarApiKey"),f=a.success;return m?(t.hasZone()||(t=t.clone().utc().add(-1,"day")),d.hasZone()||(d=d.clone().utc().add(1,"day")),c&&"local"!=c&&(g=c.replace(" ","_")),u=e.extend({},a.data||{},{key:m,timeMin:t.format(),timeMax:d.format(),timeZone:g,singleEvents:!0,maxResults:9999}),e.extend({},a,{googleCalendarId:null,url:p,data:u,startParam:!1,endParam:!1,timezoneParam:!1,success:function(a){var r,n,t=[];if(a.error)s("Google Calendar API: "+a.error.message,a.error.errors);else if(a.items&&(e.each(a.items,function(e,a){var r=a.htmlLink||null;g&&null!==r&&(r=o(r,"ctz="+g)),t.push({id:a.id,title:a.summary,start:a.start.dateTime||a.start.date,end:a.end.dateTime||a.end.date,url:r,location:a.location,description:a.description})}),r=[t].concat(Array.prototype.slice.call(arguments,1)),n=l(f,this,r),e.isArray(n)))return n;return t}})):(s("Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/"),{})}function o(e,a){return e.replace(/(\?.*?)?(#|$)/,function(e,o,r){return(o?o+"&":"?")+a+r})}var r="https://www.googleapis.com/calendar/v3/calendars",n=e.fullCalendar,l=n.applyAll;n.sourceNormalizers.push(function(e){var a,o=e.googleCalendarId,r=e.url;!o&&r&&(/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(r)?o=r:((a=/^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(r))||(a=/^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(r)))&&(o=decodeURIComponent(a[1])),o&&(e.googleCalendarId=o)),o&&(null==e.editable&&(e.editable=!1),e.url=o)}),n.sourceFetchers.push(function(e,o,r,n){if(e.googleCalendarId)return a(e,o,r,n,this)})});
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/lib/jquery-ui.min.js b/smash/web/static/fullcalendar-scheduler/lib/jquery-ui.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..25398a167415050ae8bfb0bfebac6aa3ab790909
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/jquery-ui.min.js
@@ -0,0 +1,13 @@
+/*! jQuery UI - v1.12.1 - 2016-09-14
+* http://jqueryui.com
+* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
+* Copyright jQuery Foundation and other contributors; Licensed MIT */
+
+(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):h.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=h.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),c=h.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=l+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),I=e(k.my,h.outerWidth(),h.outerHeight());"right"===n.my[0]?D.left-=l:"center"===n.my[0]&&(D.left-=l/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:l,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+I[0],u[1]+I[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-l,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)
+}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=l&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
+this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var m;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))
+}},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:T+=" ui-datepicker-group-middle",I=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,P+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(T+=P+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(A)+"</td>":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(A.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===A.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+E[1]+(A.getTime()===G.getTime()?" "+this._currentClass:"")+(A.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!E[2]?"":" title='"+E[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+A.getMonth()+"' data-year='"+A.getFullYear()+"'")+">"+(F&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+A.getDate()+"</span>":"<a class='ui-state-default"+(A.getTime()===B.getTime()?" ui-state-highlight":"")+(A.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+A.getDate()+"</a>")+"</td>",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}
+},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,h,l,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("<div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog
+},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html("&#160;")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html("&#160;")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1
+},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td>&#160;</td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;
+this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("<div>").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/lib/jquery.min.js b/smash/web/static/fullcalendar-scheduler/lib/jquery.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..644d35e274fd64ddaf6d12af813e820c424176a9
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/jquery.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
+!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=Array.isArray(d)))?(e?(e=!1,f=c&&Array.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,N,e),g(f,c,O,e)):(f++,j.call(a,g(f,c,N,e),g(f,c,O,e),g(f,c,N,c.notifyWith))):(d!==N&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S),
+a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},U=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function V(){this.expando=r.expando+V.uid++}V.uid=1,V.prototype={cache:function(a){var b=a[this.expando];return b||(b={},U(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){Array.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(L)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var W=new V,X=new V,Y=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function $(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:Y.test(a)?JSON.parse(a):a)}function _(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Z,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=$(c)}catch(e){}X.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return X.hasData(a)||W.hasData(a)},data:function(a,b,c){return X.access(a,b,c)},removeData:function(a,b){X.remove(a,b)},_data:function(a,b,c){return W.access(a,b,c)},_removeData:function(a,b){W.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=X.get(f),1===f.nodeType&&!W.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),_(f,d,e[d])));W.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){X.set(this,a)}):T(this,function(b){var c;if(f&&void 0===b){if(c=X.get(f,a),void 0!==c)return c;if(c=_(f,a),void 0!==c)return c}else this.each(function(){X.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=W.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var aa=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ba=new RegExp("^(?:([+-])=|)("+aa+")([a-z%]*)$","i"),ca=["Top","Right","Bottom","Left"],da=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},ea=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function fa(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&ba.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ga={};function ha(a){var b,c=a.ownerDocument,d=a.nodeName,e=ga[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),ga[d]=e,e)}function ia(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=W.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&da(d)&&(e[f]=ha(d))):"none"!==c&&(e[f]="none",W.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ia(this,!0)},hide:function(){return ia(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){da(this)?r(this).show():r(this).hide()})}});var ja=/^(?:checkbox|radio)$/i,ka=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c<d;c++)W.set(a[c],"globalEval",!b||W.get(b[c],"globalEval"))}var pa=/<|&#?\w+;/;function qa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(pa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ka.exec(f)||["",""])[1].toLowerCase(),i=ma[h]||ma._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==xa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===xa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&B(this,"input"))return this.click(),!1},_default:function(a){return B(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?va:wa,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:wa,isPropagationStopped:wa,isImmediatePropagationStopped:wa,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=va,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=va,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=va,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&sa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&ta.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return ya(this,a,b,c,d)},one:function(a,b,c,d){return ya(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=wa),this.each(function(){r.event.remove(this,a,c,b)})}});var za=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/<script|<style|<link/i,Ba=/checked\s*(?:[^=]|=\s*.checked.)/i,Ca=/^true\/(.*)/,Da=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}X.hasData(a)&&(h=X.access(a),i=r.extend({},h),X.set(b,i))}}function Ia(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ja.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ja(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,na(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ga),l=0;l<i;l++)j=h[l],la.test(j.type||"")&&!W.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Da,""),k))}return a}function Ka(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(na(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&oa(na(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(za,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d<e;d++)Ia(f[d],g[d]);if(b)if(c)for(f=f||na(a),g=g||na(h),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);else Ha(a,h);return g=na(h,"script"),g.length>0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(na(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ja(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(na(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var La=/^margin/,Ma=new RegExp("^("+aa+")(?!px)[a-z%]+$","i"),Na=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",ra.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,ra.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Oa(a,b,c){var d,e,f,g,h=a.style;return c=c||Na(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ma.test(g)&&La.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Pa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Qa=/^(none|table(?!-c[ea]).+)/,Ra=/^--/,Sa={position:"absolute",visibility:"hidden",display:"block"},Ta={letterSpacing:"0",fontWeight:"400"},Ua=["Webkit","Moz","ms"],Va=d.createElement("div").style;function Wa(a){if(a in Va)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ua.length;while(c--)if(a=Ua[c]+b,a in Va)return a}function Xa(a){var b=r.cssProps[a];return b||(b=r.cssProps[a]=Wa(a)||a),b}function Ya(a,b,c){var d=ba.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Za(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ca[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ca[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ca[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ca[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ca[f]+"Width",!0,e)));return g}function $a(a,b,c){var d,e=Na(a),f=Oa(a,b,e),g="border-box"===r.css(a,"boxSizing",!1,e);return Ma.test(f)?f:(d=g&&(o.boxSizingReliable()||f===a.style[b]),"auto"===f&&(f=a["offset"+b[0].toUpperCase()+b.slice(1)]),f=parseFloat(f)||0,f+Za(a,b,c||(g?"border":"content"),d,e)+"px")}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Oa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=Ra.test(b),j=a.style;return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:j[b]:(f=typeof c,"string"===f&&(e=ba.exec(c))&&e[1]&&(c=fa(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(j[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i?j.setProperty(b,c):j[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b),i=Ra.test(b);return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Oa(a,b,d)),"normal"===e&&b in Ta&&(e=Ta[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Qa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?$a(a,b,d):ea(a,Sa,function(){return $a(a,b,d)})},set:function(a,c,d){var e,f=d&&Na(a),g=d&&Za(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=ba.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ya(a,c,g)}}}),r.cssHooks.marginLeft=Pa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Oa(a,"marginLeft"))||a.getBoundingClientRect().left-ea(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ca[d]+b]=f[d]||f[d-2]||f[0];return e}},La.test(a)||(r.cssHooks[a+b].set=Ya)}),r.fn.extend({css:function(a,b){return T(this,function(a,b,c){var d,e,f={},g=0;if(Array.isArray(b)){for(d=Na(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&da(a),q=W.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],cb.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=W.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ia([a],!0),j=a.style.display||j,k=r.css(a,"display"),ia([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=W.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ia([a],!0),m.done(function(){p||ia([a]),W.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=hb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],Array.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=kb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=ab||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(i||h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:ab||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);f<g;f++)if(d=kb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,hb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j}r.Animation=r.extend(kb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return fa(c.elem,a,ba.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(L);for(var c,d=0,e=a.length;d<e;d++)c=a[d],kb.tweeners[c]=kb.tweeners[c]||[],kb.tweeners[c].unshift(b)},prefilters:[ib],prefilter:function(a,b){b?kb.prefilters.unshift(a):kb.prefilters.push(a)}}),r.speed=function(a,b,c){var d=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off?d.duration=0:"number"!=typeof d.duration&&(d.duration in r.fx.speeds?d.duration=r.fx.speeds[d.duration]:d.duration=r.fx.speeds._default),null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){r.isFunction(d.old)&&d.old.call(this),d.queue&&r.dequeue(this,d.queue)},d},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(da).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=kb(this,r.extend({},a),f);(e||W.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=W.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&db.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=W.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),r.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(ab=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),ab=void 0},r.fx.timer=function(a){r.timers.push(a),r.fx.start()},r.fx.interval=13,r.fx.start=function(){bb||(bb=!0,eb())},r.fx.stop=function(){bb=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var lb,mb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return T(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),
+null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!B(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Tb=[],Ub=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Tb.pop()||r.expando+"_"+ub++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Ub.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ub.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Ub,"$1"+e):b.jsonp!==!1&&(b.url+=(vb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Tb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=C.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=qa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=pb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length},r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),b=f.ownerDocument,c=b.documentElement,e=b.defaultView,{top:d.top+e.pageYOffset-c.clientTop,left:d.left+e.pageXOffset-c.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),B(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||ra})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return T(this,function(a,d,e){var f;return r.isWindow(a)?f=a:9===a.nodeType&&(f=a.defaultView),void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Pa(o.pixelPosition,function(a,c){if(c)return c=Oa(a,b),Ma.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return T(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.holdReady=function(a){a?r.readyWait++:r.ready(!0)},r.isArray=Array.isArray,r.parseJSON=JSON.parse,r.nodeName=B,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Vb=a.jQuery,Wb=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Wb),b&&a.jQuery===r&&(a.jQuery=Vb),r},b||(a.jQuery=a.$=r),r});
diff --git a/smash/web/static/fullcalendar-scheduler/lib/moment.min.js b/smash/web/static/fullcalendar-scheduler/lib/moment.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..770f8bc54744eb28fd0d88bab9ddcb6415d5d560
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/lib/moment.min.js
@@ -0,0 +1,7 @@
+//! moment.js
+//! version : 2.18.1
+//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
+//! license : MIT
+//! momentjs.com
+!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return sd.apply(null,arguments)}function b(a){sd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return null!=a&&"[object Object]"===Object.prototype.toString.call(a)}function e(a){var b;for(b in a)return!1;return!0}function f(a){return void 0===a}function g(a){return"number"==typeof a||"[object Number]"===Object.prototype.toString.call(a)}function h(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function i(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function j(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function k(a,b){for(var c in b)j(b,c)&&(a[c]=b[c]);return j(b,"toString")&&(a.toString=b.toString),j(b,"valueOf")&&(a.valueOf=b.valueOf),a}function l(a,b,c,d){return sb(a,b,c,d,!0).utc()}function m(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function n(a){return null==a._pf&&(a._pf=m()),a._pf}function o(a){if(null==a._isValid){var b=n(a),c=ud.call(b.parsedDateParts,function(a){return null!=a}),d=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.invalidWeekday&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated&&(!b.meridiem||b.meridiem&&c);if(a._strict&&(d=d&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour),null!=Object.isFrozen&&Object.isFrozen(a))return d;a._isValid=d}return a._isValid}function p(a){var b=l(NaN);return null!=a?k(n(b),a):n(b).userInvalidated=!0,b}function q(a,b){var c,d,e;if(f(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),f(b._i)||(a._i=b._i),f(b._f)||(a._f=b._f),f(b._l)||(a._l=b._l),f(b._strict)||(a._strict=b._strict),f(b._tzm)||(a._tzm=b._tzm),f(b._isUTC)||(a._isUTC=b._isUTC),f(b._offset)||(a._offset=b._offset),f(b._pf)||(a._pf=n(b)),f(b._locale)||(a._locale=b._locale),vd.length>0)for(c=0;c<vd.length;c++)d=vd[c],e=b[d],f(e)||(a[d]=e);return a}function r(b){q(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),wd===!1&&(wd=!0,a.updateOffset(this),wd=!1)}function s(a){return a instanceof r||null!=a&&null!=a._isAMomentObject}function t(a){return a<0?Math.ceil(a)||0:Math.floor(a)}function u(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=t(b)),c}function v(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;d<e;d++)(c&&a[d]!==b[d]||!c&&u(a[d])!==u(b[d]))&&g++;return g+f}function w(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function x(b,c){var d=!0;return k(function(){if(null!=a.deprecationHandler&&a.deprecationHandler(null,b),d){for(var e,f=[],g=0;g<arguments.length;g++){if(e="","object"==typeof arguments[g]){e+="\n["+g+"] ";for(var h in arguments[0])e+=h+": "+arguments[0][h]+", ";e=e.slice(0,-2)}else e=arguments[g];f.push(e)}w(b+"\nArguments: "+Array.prototype.slice.call(f).join("")+"\n"+(new Error).stack),d=!1}return c.apply(this,arguments)},c)}function y(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),xd[b]||(w(c),xd[b]=!0)}function z(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function A(a){var b,c;for(c in a)b=a[c],z(b)?this[c]=b:this["_"+c]=b;this._config=a,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function B(a,b){var c,e=k({},a);for(c in b)j(b,c)&&(d(a[c])&&d(b[c])?(e[c]={},k(e[c],a[c]),k(e[c],b[c])):null!=b[c]?e[c]=b[c]:delete e[c]);for(c in a)j(a,c)&&!j(b,c)&&d(a[c])&&(e[c]=k({},e[c]));return e}function C(a){null!=a&&this.set(a)}function D(a,b,c){var d=this._calendar[a]||this._calendar.sameElse;return z(d)?d.call(b,c):d}function E(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function F(){return this._invalidDate}function G(a){return this._ordinal.replace("%d",a)}function H(a,b,c,d){var e=this._relativeTime[c];return z(e)?e(a,b,c,d):e.replace(/%d/i,a)}function I(a,b){var c=this._relativeTime[a>0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Hd[c]=Hd[c+"s"]=Hd[b]=a}function K(a){return"string"==typeof a?Hd[a]||Hd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)j(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Id[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Id[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d<c.length;d++)this[c[d].unit](a[c[d].unit])}else if(a=K(a),z(this[a]))return this[a](b);return this}function T(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Md[a]=e),b&&(Md[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Md[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Jd);for(b=0,c=d.length;b<c;b++)Md[d[b]]?d[b]=Md[d[b]]:d[b]=V(d[b]);return function(b){var e,f="";for(e=0;e<c;e++)f+=z(d[e])?d[e].call(b,a):d[e];return f}}function X(a,b){return a.isValid()?(b=Y(b,a.localeData()),Ld[b]=Ld[b]||W(b),Ld[b](a)):a.localeData().invalidDate()}function Y(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Kd.lastIndex=0;d>=0&&Kd.test(a);)a=a.replace(Kd,c),Kd.lastIndex=0,d-=1;return a}function Z(a,b,c){ce[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return j(ce,a)?ce[a](b._strict,b._locale):new RegExp(_(a))}function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),g(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c<a.length;c++)de[a[c]]=d}function ca(a,b){ba(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function da(a,b,c){null!=b&&j(de,a)&&de[a](b,c._a,c,a)}function ea(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function fa(a,b){return a?c(this._months)?this._months[a.month()]:this._months[(this._months.isFormat||oe).test(b)?"format":"standalone"][a.month()]:c(this._months)?this._months:this._months.standalone}function ga(a,b){return a?c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[oe.test(b)?"format":"standalone"][a.month()]:c(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function ha(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],d=0;d<12;++d)f=l([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=ne.call(this._shortMonthsParse,g),e!==-1?e:null):(e=ne.call(this._longMonthsParse,g),e!==-1?e:null):"MMM"===b?(e=ne.call(this._shortMonthsParse,g),e!==-1?e:(e=ne.call(this._longMonthsParse,g),e!==-1?e:null)):(e=ne.call(this._longMonthsParse,g),e!==-1?e:(e=ne.call(this._shortMonthsParse,g),e!==-1?e:null))}function ia(a,b,c){var d,e,f;if(this._monthsParseExact)return ha.call(this,a,b,c);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;d<12;d++){if(e=l([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function ja(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=u(b);else if(b=a.localeData().monthsParse(b),!g(b))return a;return c=Math.min(a.date(),ea(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ka(b){return null!=b?(ja(this,b),a.updateOffset(this,!0),this):P(this,"Month")}function la(){return ea(this.year(),this.month())}function ma(a){return this._monthsParseExact?(j(this,"_monthsRegex")||oa.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):(j(this,"_monthsShortRegex")||(this._monthsShortRegex=re),this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex)}function na(a){return this._monthsParseExact?(j(this,"_monthsRegex")||oa.call(this),a?this._monthsStrictRegex:this._monthsRegex):(j(this,"_monthsRegex")||(this._monthsRegex=se),this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex)}function oa(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;b<12;b++)c=l([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;b<12;b++)d[b]=aa(d[b]),e[b]=aa(e[b]);for(b=0;b<24;b++)f[b]=aa(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}function pa(a){return qa(a)?366:365}function qa(a){return a%4===0&&a%100!==0||a%400===0}function ra(){return qa(this.year())}function sa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return a<100&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments));return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ua(a,b,c){var d=7+b-c,e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7}function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy}function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:c(this._weekdays)?this._weekdays:this._weekdays.standalone}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=l([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=ne.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){if(e=l([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN;if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(j(this,"_weekdaysRegex")||(this._weekdaysRegex=ye),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(j(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ze),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(j(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ae),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++)c=l([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for(g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Ua(a,b){return b._meridiemParse}function Va(a){return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a}function Ya(a){for(var b,c,d,e,f=0;f<a.length;){for(e=Xa(a[f]).split("-"),b=e.length,c=Xa(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1)break;b--}f++}return null}function Za(a){var b=null;if(!Fe[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Be._abbr,require("./locale/"+a),$a(b)}catch(a){}return Fe[a]}function $a(a,b){var c;return a&&(c=f(b)?bb(a):_a(a,b),c&&(Be=c)),Be._abbr}function _a(a,b){if(null!==b){var c=Ee;if(b.abbr=a,null!=Fe[a])y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Fe[a]._config;else if(null!=b.parentLocale){if(null==Fe[b.parentLocale])return Ge[b.parentLocale]||(Ge[b.parentLocale]=[]),Ge[b.parentLocale].push({name:a,config:b}),null;c=Fe[b.parentLocale]._config}return Fe[a]=new C(B(c,b)),Ge[a]&&Ge[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Fe[a]}return delete Fe[a],null}function ab(a,b){if(null!=b){var c,d=Ee;null!=Fe[a]&&(d=Fe[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Fe[a],Fe[a]=c,$a(a)}else null!=Fe[a]&&(null!=Fe[a].parentLocale?Fe[a]=Fe[a].parentLocale:null!=Fe[a]&&delete Fe[a]);return Fe[a]}function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Be;if(!c(a)){if(b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return Ad(Fe)}function db(a){var b,c=a._a;return c&&n(a).overflow===-2&&(b=c[fe]<0||c[fe]>11?fe:c[ge]<1||c[ge]>ea(c[ee],c[fe])?ge:c[he]<0||c[he]>24||24===c[he]&&(0!==c[ie]||0!==c[je]||0!==c[ke])?he:c[ie]<0||c[ie]>59?ie:c[je]<0||c[je]>59?je:c[ke]<0||c[ke]>999?ke:-1,n(a)._overflowDayOfYear&&(b<ee||b>ge)&&(b=ge),n(a)._overflowWeeks&&b===-1&&(b=le),n(a)._overflowWeekday&&b===-1&&(b=me),n(a).overflow=b),a}function eb(a){var b,c,d,e,f,g,h=a._i,i=He.exec(h)||Ie.exec(h);if(i){for(n(a).iso=!0,b=0,c=Ke.length;b<c;b++)if(Ke[b][1].exec(i[1])){e=Ke[b][0],d=Ke[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=Le.length;b<c;b++)if(Le[b][1].exec(i[3])){f=(i[2]||" ")+Le[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Je.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),lb(a)}else a._isValid=!1}function fb(a){var b,c,d,e,f,g,h,i,j={" GMT":" +0000"," EDT":" -0400"," EST":" -0500"," CDT":" -0500"," CST":" -0600"," MDT":" -0600"," MST":" -0700"," PDT":" -0700"," PST":" -0800"},k="YXWVUTSRQPONZABCDEFGHIKLM";if(b=a._i.replace(/\([^\)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s|\s$/g,""),c=Ne.exec(b)){if(d=c[1]?"ddd"+(5===c[1].length?", ":" "):"",e="D MMM "+(c[2].length>10?"YYYY ":"YY "),f="HH:mm"+(c[4]?":ss":""),c[1]){var l=new Date(c[2]),m=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][l.getDay()];if(c[1].substr(0,3)!==m)return n(a).weekdayMismatch=!0,void(a._isValid=!1)}switch(c[5].length){case 2:0===i?h=" +0000":(i=k.indexOf(c[5][1].toUpperCase())-12,h=(i<0?" -":" +")+(""+i).replace(/^-?/,"0").match(/..$/)[0]+"00");break;case 4:h=j[c[5]];break;default:h=j[" GMT"]}c[5]=h,a._i=c.splice(1).join(""),g=" ZZ",a._f=d+e+f+g,lb(a),n(a).rfc2822=!0}else a._isValid=!1}function gb(b){var c=Me.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(eb(b),void(b._isValid===!1&&(delete b._isValid,fb(b),b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b)))))}function hb(a,b,c){return null!=a?a:null!=b?b:c}function ib(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function jb(a){var b,c,d,e,f=[];if(!a._d){for(d=ib(a),a._w&&null==a._a[ge]&&null==a._a[fe]&&kb(a),null!=a._dayOfYear&&(e=hb(a._a[ee],d[ee]),(a._dayOfYear>pa(e)||0===a._dayOfYear)&&(n(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[fe]=c.getUTCMonth(),a._a[ge]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[he]&&0===a._a[ie]&&0===a._a[je]&&0===a._a[ke]&&(a._nextDay=!0,a._a[he]=0),a._d=(a._useUTC?ta:sa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[he]=24)}}function kb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4,c=hb(b.GG,a._a[ee],wa(tb(),1,4).year),d=hb(b.W,1),e=hb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(tb(),f,g);c=hb(b.gg,a._a[ee],j.year),d=hb(b.w,j.week),null!=b.d?(e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f}d<1||d>xa(c,f,g)?n(a)._overflowWeeks=!0:null!=i?n(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ee]=h.year,a._dayOfYear=h.dayOfYear)}function lb(b){if(b._f===a.ISO_8601)return void eb(b);if(b._f===a.RFC_2822)return void fb(b);b._a=[],n(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Jd)||[],c=0;c<e.length;c++)f=e[c],d=(h.match($(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&n(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Md[f]?(d?n(b).empty=!1:n(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&n(b).unusedTokens.push(f);n(b).charsLeftOver=i-j,h.length>0&&n(b).unusedInput.push(h),b._a[he]<=12&&n(b).bigHour===!0&&b._a[he]>0&&(n(b).bigHour=void 0),n(b).parsedDateParts=b._a.slice(0),n(b).meridiem=b._meridiem,b._a[he]=mb(b._locale,b._a[he],b._meridiem),jb(b),db(b)}function mb(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b}function nb(a){var b,c,d,e,f;if(0===a._f.length)return n(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=q({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],lb(b),o(b)&&(f+=n(b).charsLeftOver,f+=10*n(b).unusedTokens.length,n(b).score=f,(null==d||f<d)&&(d=f,c=b));k(a,c||b)}function ob(a){if(!a._d){var b=L(a._i);a._a=i([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),jb(a)}}function pb(a){var b=new r(db(qb(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function qb(a){var b=a._i,d=a._f;return a._locale=a._locale||bb(a._l),null===b||void 0===d&&""===b?p({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),s(b)?new r(db(b)):(h(b)?a._d=b:c(d)?nb(a):d?lb(a):rb(a),o(a)||(a._d=null),a))}function rb(b){var e=b._i;f(e)?b._d=new Date(a.now()):h(e)?b._d=new Date(e.valueOf()):"string"==typeof e?gb(b):c(e)?(b._a=i(e.slice(0),function(a){return parseInt(a,10)}),jb(b)):d(e)?ob(b):g(e)?b._d=new Date(e):a.createFromInputFallback(b)}function sb(a,b,f,g,h){var i={};return f!==!0&&f!==!1||(g=f,f=void 0),(d(a)&&e(a)||c(a)&&0===a.length)&&(a=void 0),i._isAMomentObject=!0,i._useUTC=i._isUTC=h,i._l=f,i._i=a,i._f=b,i._strict=g,pb(i)}function tb(a,b,c,d){return sb(a,b,c,d,!1)}function ub(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return tb();for(d=b[0],e=1;e<b.length;++e)b[e].isValid()&&!b[e][a](d)||(d=b[e]);return d}function vb(){var a=[].slice.call(arguments,0);return ub("isBefore",a)}function wb(){var a=[].slice.call(arguments,0);return ub("isAfter",a)}function xb(a){for(var b in a)if(Re.indexOf(b)===-1||null!=a[b]&&isNaN(a[b]))return!1;for(var c=!1,d=0;d<Re.length;++d)if(a[Re[d]]){if(c)return!1;parseFloat(a[Re[d]])!==u(a[Re[d]])&&(c=!0)}return!0}function yb(){return this._isValid}function zb(){return Sb(NaN)}function Ab(a){var b=L(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._isValid=xb(b),this._milliseconds=+k+1e3*j+6e4*i+1e3*h*60*60,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=bb(),this._bubble()}function Bb(a){return a instanceof Ab}function Cb(a){return a<0?Math.round(-1*a)*-1:Math.round(a)}function Db(a,b){U(a,0,0,function(){var a=this.utcOffset(),c="+";return a<0&&(a=-a,c="-"),c+T(~~(a/60),2)+b+T(~~a%60,2)})}function Eb(a,b){var c=(b||"").match(a);if(null===c)return null;var d=c[c.length-1]||[],e=(d+"").match(Se)||["-",0,0],f=+(60*e[1])+u(e[2]);return 0===f?0:"+"===e[0]?f:-f}function Fb(b,c){var d,e;return c._isUTC?(d=c.clone(),e=(s(b)||h(b)?b.valueOf():tb(b).valueOf())-d.valueOf(),d._d.setTime(d._d.valueOf()+e),a.updateOffset(d,!1),d):tb(b).local()}function Gb(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Hb(b,c,d){var e,f=this._offset||0;if(!this.isValid())return null!=b?this:NaN;if(null!=b){if("string"==typeof b){if(b=Eb(_d,b),null===b)return this}else Math.abs(b)<16&&!d&&(b=60*b);return!this._isUTC&&c&&(e=Gb(this)),this._offset=b,this._isUTC=!0,null!=e&&this.add(e,"m"),f!==b&&(!c||this._changeInProgress?Xb(this,Sb(b-f,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?f:Gb(this)}function Ib(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Jb(a){return this.utcOffset(0,a)}function Kb(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Gb(this),"m")),this}function Lb(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var a=Eb($d,this._i);null!=a?this.utcOffset(a):this.utcOffset(0,!0)}return this}function Mb(a){return!!this.isValid()&&(a=a?tb(a).utcOffset():0,(this.utcOffset()-a)%60===0)}function Nb(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ob(){if(!f(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=qb(a),a._a){var b=a._isUTC?l(a._a):tb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Pb(){return!!this.isValid()&&!this._isUTC}function Qb(){return!!this.isValid()&&this._isUTC}function Rb(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Sb(a,b){var c,d,e,f=a,h=null;return Bb(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:g(a)?(f={},b?f[b]=a:f.milliseconds=a):(h=Te.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:u(h[ge])*c,h:u(h[he])*c,m:u(h[ie])*c,s:u(h[je])*c,ms:u(Cb(1e3*h[ke]))*c}):(h=Ue.exec(a))?(c="-"===h[1]?-1:1,f={y:Tb(h[2],c),M:Tb(h[3],c),w:Tb(h[4],c),d:Tb(h[5],c),h:Tb(h[6],c),m:Tb(h[7],c),s:Tb(h[8],c)}):null==f?f={}:"object"==typeof f&&("from"in f||"to"in f)&&(e=Vb(tb(f.from),tb(f.to)),f={},f.ms=e.milliseconds,f.M=e.months),d=new Ab(f),Bb(a)&&j(a,"_locale")&&(d._locale=a._locale),d}function Tb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Ub(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Vb(a,b){var c;return a.isValid()&&b.isValid()?(b=Fb(b,a),a.isBefore(b)?c=Ub(a,b):(c=Ub(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function Wb(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Sb(c,d),Xb(this,e,a),this}}function Xb(b,c,d,e){var f=c._milliseconds,g=Cb(c._days),h=Cb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Yb(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Zb(b,c){var d=b||tb(),e=Fb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,tb(d)))}function $b(){return new r(this)}function _b(a,b){var c=s(a)?a:tb(a);return!(!this.isValid()||!c.isValid())&&(b=K(f(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()<this.clone().startOf(b).valueOf())}function ac(a,b){var c=s(a)?a:tb(a);return!(!this.isValid()||!c.isValid())&&(b=K(f(b)?"millisecond":b),"millisecond"===b?this.valueOf()<c.valueOf():this.clone().endOf(b).valueOf()<c.valueOf())}function bc(a,b,c,d){return d=d||"()",("("===d[0]?this.isAfter(a,c):!this.isBefore(a,c))&&(")"===d[1]?this.isBefore(b,c):!this.isAfter(b,c))}function cc(a,b){var c,d=s(a)?a:tb(a);return!(!this.isValid()||!d.isValid())&&(b=K(b||"millisecond"),"millisecond"===b?this.valueOf()===d.valueOf():(c=d.valueOf(),this.clone().startOf(b).valueOf()<=c&&c<=this.clone().endOf(b).valueOf()))}function dc(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function ec(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function fc(a,b,c){var d,e,f,g;return this.isValid()?(d=Fb(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=gc(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:t(g)):NaN):NaN}function gc(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return b-f<0?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function hc(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ic(){if(!this.isValid())return null;var a=this.clone().utc();return a.year()<0||a.year()>9999?X(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):z(Date.prototype.toISOString)?this.toDate().toISOString():X(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function jc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var a="moment",b="";this.isLocal()||(a=0===this.utcOffset()?"moment.utc":"moment.parseZone",b="Z");var c="["+a+'("]',d=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",e="-MM-DD[T]HH:mm:ss.SSS",f=b+'[")]';return this.format(c+d+e+f)}function kc(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=X(this,b);return this.localeData().postformat(c)}function lc(a,b){return this.isValid()&&(s(a)&&a.isValid()||tb(a).isValid())?Sb({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function mc(a){return this.from(tb(),a)}function nc(a,b){return this.isValid()&&(s(a)&&a.isValid()||tb(a).isValid())?Sb({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function oc(a){return this.to(tb(),a)}function pc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}function qc(){return this._locale}function rc(a){switch(a=K(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function sc(a){return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function tc(){return this._d.valueOf()-6e4*(this._offset||0)}function uc(){return Math.floor(this.valueOf()/1e3)}function vc(){return new Date(this.valueOf())}function wc(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function xc(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function yc(){return this.isValid()?this.toISOString():null}function zc(){return o(this)}function Ac(){
+return k({},n(this))}function Bc(){return n(this).overflow}function Cc(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Dc(a,b){U(0,[a,a.length],0,b)}function Ec(a){return Ic.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Fc(a){return Ic.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Gc(){return xa(this.year(),1,4)}function Hc(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ic(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Jc.call(this,a,b,c,d,e))}function Jc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Kc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Lc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Mc(a,b){b[ke]=u(1e3*("0."+a))}function Nc(){return this._isUTC?"UTC":""}function Oc(){return this._isUTC?"Coordinated Universal Time":""}function Pc(a){return tb(1e3*a)}function Qc(){return tb.apply(null,arguments).parseZone()}function Rc(a){return a}function Sc(a,b,c,d){var e=bb(),f=l().set(d,b);return e[c](f,a)}function Tc(a,b,c){if(g(a)&&(b=a,a=void 0),a=a||"",null!=b)return Sc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Sc(a,d,c,"month");return e}function Uc(a,b,c,d){"boolean"==typeof a?(g(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,g(b)&&(c=b,b=void 0),b=b||"");var e=bb(),f=a?e._week.dow:0;if(null!=c)return Sc(b,(c+f)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Sc(b,(h+f)%7,d,"day");return i}function Vc(a,b){return Tc(a,b,"months")}function Wc(a,b){return Tc(a,b,"monthsShort")}function Xc(a,b,c){return Uc(a,b,c,"weekdays")}function Yc(a,b,c){return Uc(a,b,c,"weekdaysShort")}function Zc(a,b,c){return Uc(a,b,c,"weekdaysMin")}function $c(){var a=this._data;return this._milliseconds=df(this._milliseconds),this._days=df(this._days),this._months=df(this._months),a.milliseconds=df(a.milliseconds),a.seconds=df(a.seconds),a.minutes=df(a.minutes),a.hours=df(a.hours),a.months=df(a.months),a.years=df(a.years),this}function _c(a,b,c,d){var e=Sb(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function ad(a,b){return _c(this,a,b,1)}function bd(a,b){return _c(this,a,b,-1)}function cd(a){return a<0?Math.floor(a):Math.ceil(a)}function dd(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*cd(fd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ed(g)),h+=e,g-=cd(fd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ed(a){return 4800*a/146097}function fd(a){return 146097*a/4800}function gd(a){if(!this.isValid())return NaN;var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ed(b),"month"===a?c:c/12;switch(b=this._days+Math.round(fd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function hd(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12):NaN}function id(a){return function(){return this.as(a)}}function jd(a){return a=K(a),this.isValid()?this[a+"s"]():NaN}function kd(a){return function(){return this.isValid()?this._data[a]:NaN}}function ld(){return t(this.days()/7)}function md(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function nd(a,b,c){var d=Sb(a).abs(),e=uf(d.as("s")),f=uf(d.as("m")),g=uf(d.as("h")),h=uf(d.as("d")),i=uf(d.as("M")),j=uf(d.as("y")),k=e<=vf.ss&&["s",e]||e<vf.s&&["ss",e]||f<=1&&["m"]||f<vf.m&&["mm",f]||g<=1&&["h"]||g<vf.h&&["hh",g]||h<=1&&["d"]||h<vf.d&&["dd",h]||i<=1&&["M"]||i<vf.M&&["MM",i]||j<=1&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,md.apply(null,k)}function od(a){return void 0===a?uf:"function"==typeof a&&(uf=a,!0)}function pd(a,b){return void 0!==vf[a]&&(void 0===b?vf[a]:(vf[a]=b,"s"===a&&(vf.ss=b-1),!0))}function qd(a){if(!this.isValid())return this.localeData().invalidDate();var b=this.localeData(),c=nd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function rd(){if(!this.isValid())return this.localeData().invalidDate();var a,b,c,d=wf(this._milliseconds)/1e3,e=wf(this._days),f=wf(this._months);a=t(d/60),b=t(a/60),d%=60,a%=60,c=t(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var sd,td;td=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d<c;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var ud=td,vd=a.momentProperties=[],wd=!1,xd={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var yd;yd=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)j(a,b)&&c.push(b);return c};var zd,Ad=yd,Bd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Cd={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Dd="Invalid date",Ed="%d",Fd=/\d{1,2}/,Gd={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Hd={},Id={},Jd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Kd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ld={},Md={},Nd=/\d/,Od=/\d\d/,Pd=/\d{3}/,Qd=/\d{4}/,Rd=/[+-]?\d{6}/,Sd=/\d\d?/,Td=/\d\d\d\d?/,Ud=/\d\d\d\d\d\d?/,Vd=/\d{1,3}/,Wd=/\d{1,4}/,Xd=/[+-]?\d{1,6}/,Yd=/\d+/,Zd=/[+-]?\d+/,$d=/Z|[+-]\d\d:?\d\d/gi,_d=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[+-]?\d+(\.\d{1,3})?/,be=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,ce={},de={},ee=0,fe=1,ge=2,he=3,ie=4,je=5,ke=6,le=7,me=8;zd=Array.prototype.indexOf?Array.prototype.indexOf:function(a){var b;for(b=0;b<this.length;++b)if(this[b]===a)return b;return-1};var ne=zd;U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),U("MMMM",0,0,function(a){return this.localeData().months(this,a)}),J("month","M"),M("month",8),Z("M",Sd),Z("MM",Sd,Od),Z("MMM",function(a,b){return b.monthsShortRegex(a)}),Z("MMMM",function(a,b){return b.monthsRegex(a)}),ba(["M","MM"],function(a,b){b[fe]=u(a)-1}),ba(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[fe]=e:n(c).invalidMonth=a});var oe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,pe="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),qe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),re=be,se=be;U("Y",0,0,function(){var a=this.year();return a<=9999?""+a:"+"+a}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),J("year","y"),M("year",1),Z("Y",Zd),Z("YY",Sd,Od),Z("YYYY",Wd,Qd),Z("YYYYY",Xd,Rd),Z("YYYYYY",Xd,Rd),ba(["YYYYY","YYYYYY"],ee),ba("YYYY",function(b,c){c[ee]=2===b.length?a.parseTwoDigitYear(b):u(b)}),ba("YY",function(b,c){c[ee]=a.parseTwoDigitYear(b)}),ba("Y",function(a,b){b[ee]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return u(a)+(u(a)>68?1900:2e3)};var te=O("FullYear",!0);U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),M("week",5),M("isoWeek",5),Z("w",Sd),Z("ww",Sd,Od),Z("W",Sd),Z("WW",Sd,Od),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var ue={dow:0,doy:6};U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),M("day",11),M("weekday",11),M("isoWeekday",11),Z("d",Sd),Z("e",Sd),Z("E",Sd),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:n(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)});var ve="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),we="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),xe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ye=be,ze=be,Ae=be;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1),J("hour","h"),M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Sd),Z("h",Sd),Z("k",Sd),Z("HH",Sd,Od),Z("hh",Sd,Od),Z("kk",Sd,Od),Z("hmm",Td),Z("hmmss",Ud),Z("Hmm",Td),Z("Hmmss",Ud),ba(["H","HH"],he),ba(["k","kk"],function(a,b,c){var d=u(a);b[he]=24===d?0:d}),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[he]=u(a),n(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d)),n(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d,2)),b[je]=u(a.substr(e)),n(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d,2)),b[je]=u(a.substr(e))});var Be,Ce=/[ap]\.?m?\.?/i,De=O("Hours",!0),Ee={calendar:Bd,longDateFormat:Cd,invalidDate:Dd,ordinal:Ed,dayOfMonthOrdinalParse:Fd,relativeTime:Gd,months:pe,monthsShort:qe,week:ue,weekdays:ve,weekdaysMin:xe,weekdaysShort:we,meridiemParse:Ce},Fe={},Ge={},He=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ie=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Je=/Z|[+-]\d\d(?::?\d\d)?/,Ke=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Le=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Me=/^\/?Date\((\-?\d+)/i,Ne=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;a.createFromInputFallback=x("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),a.ISO_8601=function(){},a.RFC_2822=function(){};var Oe=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=tb.apply(null,arguments);return this.isValid()&&a.isValid()?a<this?this:a:p()}),Pe=x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=tb.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:p()}),Qe=function(){return Date.now?Date.now():+new Date},Re=["year","quarter","month","week","day","hour","minute","second","millisecond"];Db("Z",":"),Db("ZZ",""),Z("Z",_d),Z("ZZ",_d),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Eb(_d,a)});var Se=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var Te=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Ue=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Sb.fn=Ab.prototype,Sb.invalid=zb;var Ve=Wb(1,"add"),We=Wb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Xe=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Dc("gggg","weekYear"),Dc("ggggg","weekYear"),Dc("GGGG","isoWeekYear"),Dc("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),M("weekYear",1),M("isoWeekYear",1),Z("G",Zd),Z("g",Zd),Z("GG",Sd,Od),Z("gg",Sd,Od),Z("GGGG",Wd,Qd),Z("gggg",Wd,Qd),Z("GGGGG",Xd,Rd),Z("ggggg",Xd,Rd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),U("Q",0,"Qo","quarter"),J("quarter","Q"),M("quarter",7),Z("Q",Nd),ba("Q",function(a,b){b[fe]=3*(u(a)-1)}),U("D",["DD",2],"Do","date"),J("date","D"),M("date",9),Z("D",Sd),Z("DD",Sd,Od),Z("Do",function(a,b){return a?b._dayOfMonthOrdinalParse||b._ordinalParse:b._dayOfMonthOrdinalParseLenient}),ba(["D","DD"],ge),ba("Do",function(a,b){b[ge]=u(a.match(Sd)[0],10)});var Ye=O("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),M("dayOfYear",4),Z("DDD",Vd),Z("DDDD",Pd),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}),U("m",["mm",2],0,"minute"),J("minute","m"),M("minute",14),Z("m",Sd),Z("mm",Sd,Od),ba(["m","mm"],ie);var Ze=O("Minutes",!1);U("s",["ss",2],0,"second"),J("second","s"),M("second",15),Z("s",Sd),Z("ss",Sd,Od),ba(["s","ss"],je);var $e=O("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),M("millisecond",16),Z("S",Vd,Nd),Z("SS",Vd,Od),Z("SSS",Vd,Pd);var _e;for(_e="SSSS";_e.length<=9;_e+="S")Z(_e,Yd);for(_e="S";_e.length<=9;_e+="S")ba(_e,Mc);var af=O("Milliseconds",!1);U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var bf=r.prototype;bf.add=Ve,bf.calendar=Zb,bf.clone=$b,bf.diff=fc,bf.endOf=sc,bf.format=kc,bf.from=lc,bf.fromNow=mc,bf.to=nc,bf.toNow=oc,bf.get=R,bf.invalidAt=Bc,bf.isAfter=_b,bf.isBefore=ac,bf.isBetween=bc,bf.isSame=cc,bf.isSameOrAfter=dc,bf.isSameOrBefore=ec,bf.isValid=zc,bf.lang=Xe,bf.locale=pc,bf.localeData=qc,bf.max=Pe,bf.min=Oe,bf.parsingFlags=Ac,bf.set=S,bf.startOf=rc,bf.subtract=We,bf.toArray=wc,bf.toObject=xc,bf.toDate=vc,bf.toISOString=ic,bf.inspect=jc,bf.toJSON=yc,bf.toString=hc,bf.unix=uc,bf.valueOf=tc,bf.creationData=Cc,bf.year=te,bf.isLeapYear=ra,bf.weekYear=Ec,bf.isoWeekYear=Fc,bf.quarter=bf.quarters=Kc,bf.month=ka,bf.daysInMonth=la,bf.week=bf.weeks=Ba,bf.isoWeek=bf.isoWeeks=Ca,bf.weeksInYear=Hc,bf.isoWeeksInYear=Gc,bf.date=Ye,bf.day=bf.days=Ka,bf.weekday=La,bf.isoWeekday=Ma,bf.dayOfYear=Lc,bf.hour=bf.hours=De,bf.minute=bf.minutes=Ze,bf.second=bf.seconds=$e,bf.millisecond=bf.milliseconds=af,bf.utcOffset=Hb,bf.utc=Jb,bf.local=Kb,bf.parseZone=Lb,bf.hasAlignedHourOffset=Mb,bf.isDST=Nb,bf.isLocal=Pb,bf.isUtcOffset=Qb,bf.isUtc=Rb,bf.isUTC=Rb,bf.zoneAbbr=Nc,bf.zoneName=Oc,bf.dates=x("dates accessor is deprecated. Use date instead.",Ye),bf.months=x("months accessor is deprecated. Use month instead",ka),bf.years=x("years accessor is deprecated. Use year instead",te),bf.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Ib),bf.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ob);var cf=C.prototype;cf.calendar=D,cf.longDateFormat=E,cf.invalidDate=F,cf.ordinal=G,cf.preparse=Rc,cf.postformat=Rc,cf.relativeTime=H,cf.pastFuture=I,cf.set=A,cf.months=fa,cf.monthsShort=ga,cf.monthsParse=ia,cf.monthsRegex=na,cf.monthsShortRegex=ma,cf.week=ya,cf.firstDayOfYear=Aa,cf.firstDayOfWeek=za,cf.weekdays=Fa,cf.weekdaysMin=Ha,cf.weekdaysShort=Ga,cf.weekdaysParse=Ja,cf.weekdaysRegex=Na,cf.weekdaysShortRegex=Oa,cf.weekdaysMinRegex=Pa,cf.isPM=Va,cf.meridiem=Wa,$a("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var df=Math.abs,ef=id("ms"),ff=id("s"),gf=id("m"),hf=id("h"),jf=id("d"),kf=id("w"),lf=id("M"),mf=id("y"),nf=kd("milliseconds"),of=kd("seconds"),pf=kd("minutes"),qf=kd("hours"),rf=kd("days"),sf=kd("months"),tf=kd("years"),uf=Math.round,vf={ss:44,s:45,m:45,h:22,d:26,M:11},wf=Math.abs,xf=Ab.prototype;return xf.isValid=yb,xf.abs=$c,xf.add=ad,xf.subtract=bd,xf.as=gd,xf.asMilliseconds=ef,xf.asSeconds=ff,xf.asMinutes=gf,xf.asHours=hf,xf.asDays=jf,xf.asWeeks=kf,xf.asMonths=lf,xf.asYears=mf,xf.valueOf=hd,xf._bubble=dd,xf.get=jd,xf.milliseconds=nf,xf.seconds=of,xf.minutes=pf,xf.hours=qf,xf.days=rf,xf.weeks=ld,xf.months=sf,xf.years=tf,xf.humanize=qd,xf.toISOString=rd,xf.toString=rd,xf.toJSON=rd,xf.locale=pc,xf.localeData=qc,xf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rd),xf.lang=Xe,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Zd),Z("X",ae),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.18.1",b(tb),a.fn=bf,a.min=vb,a.max=wb,a.now=Qe,a.utc=l,a.unix=Pc,a.months=Vc,a.isDate=h,a.locale=$a,a.invalid=p,a.duration=Sb,a.isMoment=s,a.weekdays=Xc,a.parseZone=Qc,a.localeData=bb,a.isDuration=Bb,a.monthsShort=Wc,a.weekdaysMin=Zc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Yc,a.normalizeUnits=K,a.relativeTimeRounding=od,a.relativeTimeThreshold=pd,a.calendarFormat=Yb,a.prototype=bf,a});
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/scheduler.css b/smash/web/static/fullcalendar-scheduler/scheduler.css
new file mode 100644
index 0000000000000000000000000000000000000000..d24554413ebbd94bceed48d6f5d26c5363135e84
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/scheduler.css
@@ -0,0 +1,521 @@
+/*!
+ * FullCalendar Scheduler v1.6.2
+ * Docs & License: https://fullcalendar.io/scheduler/
+ * (c) 2017 Adam Shaw
+ */
+
+/* TODO: break this file up */
+
+/* Scroller
+--------------------------------------------------------------------------------------------------*/
+
+.fc-scroller-clip {
+	overflow: hidden; /* for clipping scrollbars */
+	position: relative; /* so things like scrollfollowers can attach to this */
+}
+
+/* supresses rendering of native scrollbars */
+/* on .fc-scroller */
+.fc-no-scrollbars {
+	background: rgba(255, 255, 255, 0); /* hack for dynamic DOM nodes (in Chrome OSX at least) */
+}
+.fc-no-scrollbars::-webkit-scrollbar {
+	width: 0;
+	height: 0;
+}
+
+.fc-scroller-canvas {
+	position: relative; /* origin for bg */
+	box-sizing: border-box; /* so that padding (for gutter) will be part of height */
+	min-height: 100%;
+}
+
+.fc-scroller-canvas > .fc-bg {
+	z-index: 1; /* make default? */
+}
+
+.fc-scroller-canvas > .fc-content {
+	z-index: 2; /* make default? */
+	position: relative; /* origin for inner content */
+	border-style: solid;
+	border-width: 0;
+}
+
+/* for themed, hard to get the border-color, so just forget it (REVISIT) */
+.ui-widget .fc-scroller-canvas > .fc-content {
+	border-color: transparent;
+}
+
+.fc-scroller-canvas.fc-gutter-left > .fc-content { border-left-width: 1px; margin-left: -1px }
+.fc-scroller-canvas.fc-gutter-right > .fc-content { border-right-width: 1px; margin-right: -1px }
+.fc-scroller-canvas.fc-gutter-top > .fc-content { border-top-width: 1px; margin-top: -1px }
+/* content is responsible for bottom border */
+
+
+/* View Structure
+--------------------------------------------------------------------------------------------------*/
+
+.fc-rtl .fc-timeline {
+	direction: rtl;
+}
+
+.fc-timeline .fc-divider {
+	width: 3px;
+	border-style: double; /* overcome neighboring borders */
+}
+
+.fc-timeline .fc-head > tr > .fc-divider {
+	border-bottom: 0;
+}
+
+.fc-timeline .fc-body > tr > .fc-divider {
+	border-top: 0;
+}
+
+.fc-timeline .fc-body .fc-divider.ui-widget-header {
+	background-image: none;
+}
+
+.fc-scrolled .fc-head .fc-scroller {
+	z-index: 2; /* so drop shadow will go above body panes */
+}
+
+.fc-timeline.fc-scrolled .fc-head .fc-scroller {
+	box-shadow: 0 3px 4px rgba(0,0,0,0.075);
+}
+
+.fc-timeline .fc-body .fc-scroller {
+	z-index: 1;
+}
+
+/*
+on most tables that expand to the edges, kill the outer border,
+because the container elements take care of it.
+example tables:
+.fc-scroller-canvas .fc-content table
+.fc-scroller-canvas .fc-bg .fc-slats table
+*/
+.fc-timeline .fc-scroller-canvas > div > table,
+.fc-timeline .fc-scroller-canvas > div > div > table {
+	border-style: hidden;
+}
+
+/*
+for resource rows (in both the spreadsheet and timeline areas),
+undo previous rule in order to always show last border.
+*/
+.fc-timeline .fc-scroller-canvas > .fc-content > .fc-rows > table {
+	border-bottom-style: none;
+}
+
+
+/* Table Cell Common
+--------------------------------------------------------------------------------------------------*/
+
+.fc-timeline th,
+.fc-timeline td {
+	white-space: nowrap;
+}
+
+.fc-timeline .fc-cell-content {
+	overflow: hidden;
+}
+
+.fc-timeline .fc-cell-text {
+	padding-left: 4px;
+	padding-right: 4px;
+}
+
+.fc-timeline .fc-col-resizer {
+	cursor: col-resize;
+}
+
+/*
+Cells at the start of a week
+TODO: figure out better styling
+
+.fc-ltr .fc-timeline .fc-em-cell div {
+	border-left: 3px solid #eee;
+	height: 100%;
+}
+.fc-rtl .fc-timeline .fc-em-cell {
+	border-right-width: 3px;
+}
+*/
+
+/* head */
+
+.fc-timeline th {
+	vertical-align: middle;
+}
+
+.fc-timeline .fc-head .fc-cell-content {
+	padding-top: 3px;
+	padding-bottom: 3px;
+}
+
+/* body */
+
+.fc-timeline .fc-body .ui-widget-content {
+	background-image: none;
+}
+
+
+/* Resource Area
+--------------------------------------------------------------------------------------------------*/
+
+.fc-resource-area {
+	width: 30%;
+}
+
+.fc-resource-area col {
+	width: 40%;
+	min-width: 70px; /* will be read by JS */
+}
+
+.fc-resource-area col.fc-main-col {
+	width: 60%; /* make the first column in a nested setup bigger */
+}
+
+
+.fc-flat .fc-expander-space { /* fc-flat is opposite of fc-nested */
+	display: none;
+}
+
+
+.fc-ltr .fc-resource-area tr > * {
+	text-align: left;
+}
+.fc-rtl .fc-resource-area tr > * {
+	text-align: right;
+}
+
+.fc-resource-area .fc-cell-content {
+	padding-left: 4px;
+	padding-right: 4px;
+}
+
+/* head */
+
+.fc-resource-area .fc-super th {
+	text-align: center;
+}
+
+.fc-resource-area th > div {
+	position: relative;
+}
+
+.fc-resource-area th .fc-cell-content {
+	position: relative;
+	z-index: 1;
+}
+
+.fc-resource-area th .fc-col-resizer {
+	position: absolute;
+	z-index: 2;
+	top: 0;
+	bottom: 0;
+	width: 5px;
+}
+
+.fc-ltr .fc-resource-area th .fc-col-resizer {
+	right: -3px;
+}
+.fc-rtl .fc-resource-area th .fc-col-resizer {
+	left: -3px;
+}
+
+/* body */
+
+tr.fc-collapsed > td, /* before the transition (prevents initial flicker) */
+tr.fc-transitioning > td { /* during the transition */
+	overflow: hidden; /* prevents absolutely-positioned events from bleeding out */
+}
+
+tr.fc-transitioning > td > div {
+	transition: margin-top 0.2s;
+}
+
+tr.fc-collapsed > td > div {
+	margin-top: -10px;
+}
+
+
+.fc-body .fc-resource-area .fc-cell-content { /* might BE the cell */
+	padding-top: 8px;
+	padding-bottom: 8px;
+}
+
+.fc-no-overlap .fc-body .fc-resource-area .fc-cell-content { /* might BE the cell */
+	padding-top: 5px;
+	padding-bottom: 5px;
+}
+
+.fc-resource-area .fc-icon { /* the expander and spacers before the expander */
+	width: 1em; /* ensure constant width, esp for empty icons */
+	font-size: .9em;
+	vertical-align: middle;
+	margin-top: -1%;
+}
+
+.fc-resource-area .fc-expander {
+	cursor: pointer;
+	color: #666; /* for the icon within */
+}
+
+
+/* Time Area
+--------------------------------------------------------------------------------------------------*/
+
+.fc-time-area col {
+	min-width: 2.2em; /* detected by JS */
+}
+
+/* head */
+
+.fc-ltr .fc-time-area .fc-chrono th {
+	text-align: left;
+}
+.fc-rtl .fc-time-area .fc-chrono th {
+	text-align: right;
+}
+
+/* body slats (vertical lines) */
+
+.fc-time-area .fc-slats { /* fc-bg is responsible for a lot of this now! */
+	position: absolute;
+	z-index: 1;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+}
+
+.fc-time-area .fc-slats table {
+	height: 100%;
+}
+
+.fc-time-area .fc-slats .fc-minor {
+	border-style: dotted;
+}
+
+.fc-time-area .fc-slats td {
+	border-width: 0 1px; /* need to do this. sometimes -1 margin wouldn't hide the dotted */
+}
+
+.fc-ltr .fc-time-area .fc-slats td {
+	border-right-width: 0;
+}
+.fc-rtl .fc-time-area .fc-slats td {
+	border-left-width: 0;
+}
+
+/* body content containers
+   can be within rows or directly within the pane's content
+*/
+
+.fc-time-area .fc-bgevent-container,
+.fc-time-area .fc-highlight-container {
+	position: absolute;
+	z-index: 2; /* only for directly within pane. not for row. overridden later */
+	top: 0;
+	bottom: 0;
+	width: 0;
+}
+
+.fc-ltr .fc-time-area .fc-helper-container, /* only within row */
+.fc-ltr .fc-time-area .fc-bgevent-container,
+.fc-ltr .fc-time-area .fc-highlight-container {
+	left: 0;
+}
+.fc-rtl .fc-time-area .fc-helper-container, /* only within row */
+.fc-rtl .fc-time-area .fc-bgevent-container,
+.fc-rtl .fc-time-area .fc-highlight-container {
+	right: 0;
+}
+
+.fc-time-area .fc-bgevent,
+.fc-time-area .fc-highlight {
+	position: absolute;
+	top: 0;
+	bottom: 0;
+}
+
+/* body resource rows */
+
+.fc-time-area .fc-rows {
+	position: relative;
+	z-index: 3;
+}
+
+.fc-time-area .fc-rows .ui-widget-content {
+	background: none;
+}
+
+.fc-time-area .fc-rows td > div {
+	position: relative;
+}
+
+.fc-time-area .fc-rows .fc-bgevent-container,
+.fc-time-area .fc-rows .fc-highlight-container {
+	z-index: 1;
+}
+
+.fc-time-area .fc-event-container {
+	position: relative;
+	z-index: 2; /* above bgevent and highlight */
+	width: 0; /* for event positioning. will end up on correct side based on dir */
+}
+
+.fc-time-area .fc-helper-container { /* also an fc-event-container */
+	position: absolute;
+	z-index: 3;
+	top: 0;
+}
+
+.fc-time-area .fc-event-container {
+	padding-bottom: 8px;
+	top: -1px;
+}
+
+.fc-time-area tr:first-child .fc-event-container {
+	top: 0;
+}
+
+.fc-no-overlap .fc-time-area .fc-event-container {
+	padding-bottom: 0;
+	top: 0;
+}
+
+
+/* Now Indicator
+--------------------------------------------------------------------------------------------------*/
+
+.fc-timeline .fc-now-indicator { /* both the arrow and the line */
+	z-index: 3; /* one above scroller's fc-content */
+	top: 0;
+}
+
+.fc-time-area .fc-now-indicator-arrow {
+	margin: 0 -6px; /* 5, then one more to counteract scroller's negative margins */
+	/* triangle pointing down... */
+	border-width: 6px 5px 0 5px;
+	border-left-color: transparent;
+	border-right-color: transparent;
+}
+
+.fc-time-area .fc-now-indicator-line {
+	margin: 0 -1px; /* counteract scroller's negative margins */
+	bottom: 0;
+	border-left-width: 1px;
+}
+
+
+/* Time Grid Events
+--------------------------------------------------------------------------------------------------*/
+
+.fc-timeline-event {
+	position: absolute;
+	border-radius: 0;
+	padding: 2px 0;
+	margin-bottom: 1px;
+}
+
+.fc-no-overlap .fc-timeline-event {
+	padding: 5px 0;
+	margin-bottom: 0;
+}
+
+/* don't overlap grid lines at the event's end */
+.fc-ltr .fc-timeline-event { margin-right: 1px }
+.fc-rtl .fc-timeline-event { margin-left: 1px }
+
+.fc-timeline-event .fc-content {
+	padding: 0 1px;
+	white-space: nowrap;
+	overflow: hidden;
+}
+
+.fc-timeline-event .fc-time {
+	font-weight: bold;
+	padding: 0 1px;
+}
+
+.fc-rtl .fc-timeline-event .fc-time {
+	display: inline-block; /* will force it on the other side */
+}
+
+.fc-timeline-event .fc-title {
+	padding: 0 1px;
+}
+
+.fc-timeline-event.fc-selected .fc-bg {
+	display: none; /* hide semi-white background, to appear darker */
+}
+
+
+/* follower logic */
+
+
+.fc-ltr .fc-timeline-event .fc-title {
+	padding-left: 10px;
+	margin-left: -8px;
+}
+.fc-rtl .fc-timeline-event .fc-title {
+	padding-right: 10px;
+	margin-right: -8px;
+}
+
+.fc-ltr .fc-timeline-event.fc-not-start .fc-title {
+	margin-left: -2px;
+}
+.fc-rtl .fc-timeline-event.fc-not-start .fc-title {
+	margin-right: -2px;
+}
+
+.fc-timeline-event.fc-not-start .fc-title,
+.fc-body .fc-time-area .fc-following {
+	position: relative;
+}
+
+.fc-timeline-event.fc-not-start .fc-title:before,
+.fc-body .fc-time-area .fc-following:before { /* generic arrow */
+	content: "";
+	position: absolute;
+	top: 50%;
+	margin-top: -5px;
+	border: 5px solid #000;
+	border-top-color: transparent;
+	border-bottom-color: transparent;
+	opacity: .5;
+}
+
+.fc-ltr .fc-timeline-event.fc-not-start .fc-title:before,
+.fc-ltr .fc-body .fc-time-area .fc-following:before { /* LTR. left pointing arrow */
+	border-left: 0;
+	left: 2px;
+}
+
+.fc-rtl .fc-timeline-event.fc-not-start .fc-title:before,
+.fc-rtl .fc-body .fc-time-area .fc-following:before { /* RTL. right pointing arrow */
+	border-right: 0;
+	right: 2px;
+}
+
+
+/* License Message
+--------------------------------------------------------------------------------------------------*/
+
+.fc-license-message {
+	position: absolute;
+	z-index: 99999;
+	bottom: 1px;
+	left: 1px;
+	background: #eee;
+	border-color: #ddd;
+	border-style: solid;
+	border-width: 1px 1px 0 0;
+	padding: 2px 4px;
+	font-size: 12px;
+	border-top-right-radius: 3px;
+}
diff --git a/smash/web/static/fullcalendar-scheduler/scheduler.js b/smash/web/static/fullcalendar-scheduler/scheduler.js
new file mode 100644
index 0000000000000000000000000000000000000000..d721f81534aa9e1a668f3b411c60117cb5323305
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/scheduler.js
@@ -0,0 +1,6531 @@
+
+/*!
+FullCalendar Scheduler v1.6.2
+Docs & License: https://fullcalendar.io/scheduler/
+(c) 2017 Adam Shaw
+ */
+(function(factory) {
+	if (typeof define === 'function' && define.amd) {
+		define([ 'jquery', 'moment', 'fullcalendar' ], factory);
+	}
+	else if (typeof exports === 'object') { // Node/CommonJS
+		module.exports = factory(
+			require('jquery'),
+			require('moment'),
+			require('fullcalendar')
+		);
+	}
+	else {
+		factory(jQuery, moment);
+	}
+})(function($, moment) {;
+var COL_MIN_WIDTH, Calendar, CalendarExtension, Class, ClippedScroller, CoordCache, DEFAULT_GRID_DURATION, DragListener, EmitterMixin, EnhancedScroller, EventRow, FC, Grid, HRowGroup, LICENSE_INFO_URL, ListenerMixin, MAX_AUTO_CELLS, MAX_AUTO_SLOTS_PER_LABEL, MAX_CELLS, MIN_AUTO_LABELS, PRESET_LICENSE_KEYS, Promise, RELEASE_DATE, ResourceAgendaView, ResourceBasicView, ResourceDayGrid, ResourceDayTableMixin, ResourceGridMixin, ResourceManager, ResourceMonthView, ResourceRow, ResourceTimeGrid, ResourceTimelineGrid, ResourceTimelineView, ResourceViewMixin, RowGroup, RowParent, STOCK_SUB_DURATIONS, ScrollFollower, ScrollFollowerSprite, ScrollJoiner, ScrollerCanvas, Spreadsheet, TaskQueue, TimelineGrid, TimelineView, UPGRADE_WINDOW, VRowGroup, VertResourceViewMixin, View, _filterResourcesWithEvents, applyAll, capitaliseFirstLetter, compareByFieldSpecs, computeGreatestUnit, computeOffsetForSeg, computeOffsetForSegs, copyRect, createObject, cssToStr, debounce, detectWarningInContainer, divideDurationByDuration, divideRangeByDuration, durationHasTime, flexibleCompare, getContentRect, getOuterRect, getOwnCells, getRectHeight, getRectWidth, getScrollbarWidths, hContainRect, htmlEscape, intersectRanges, intersectRects, isImmuneUrl, isInt, isValidKey, joinRects, multiplyDuration, origGetSegCustomClasses, origGetSegDefaultBackgroundColor, origGetSegDefaultBorderColor, origGetSegDefaultTextColor, origOnBaseRender, origRemoveElement, origSetElement, parseFieldSpecs, processLicenseKey, proxy, renderingWarningInContainer, testRectContains, testRectHContains, testRectVContains, timeRowSegsCollide, vContainRect,
+  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+  hasProp = {}.hasOwnProperty,
+  indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+  slice = [].slice;
+
+FC = $.fullCalendar;
+
+FC.schedulerVersion = "1.6.2";
+
+if (FC.internalApiVersion !== 9) {
+  FC.warn('v' + FC.schedulerVersion + ' of FullCalendar Scheduler ' + 'is incompatible with v' + FC.version + ' of the core.\n' + 'Please see http://fullcalendar.io/support/ for more information.');
+  return;
+}
+
+Calendar = FC.Calendar;
+
+Class = FC.Class;
+
+View = FC.View;
+
+Grid = FC.Grid;
+
+intersectRanges = FC.intersectRanges;
+
+debounce = FC.debounce;
+
+isInt = FC.isInt;
+
+getScrollbarWidths = FC.getScrollbarWidths;
+
+DragListener = FC.DragListener;
+
+htmlEscape = FC.htmlEscape;
+
+computeGreatestUnit = FC.computeGreatestUnit;
+
+proxy = FC.proxy;
+
+capitaliseFirstLetter = FC.capitaliseFirstLetter;
+
+applyAll = FC.applyAll;
+
+EmitterMixin = FC.EmitterMixin;
+
+ListenerMixin = FC.ListenerMixin;
+
+durationHasTime = FC.durationHasTime;
+
+divideRangeByDuration = FC.divideRangeByDuration;
+
+divideDurationByDuration = FC.divideDurationByDuration;
+
+multiplyDuration = FC.multiplyDuration;
+
+parseFieldSpecs = FC.parseFieldSpecs;
+
+compareByFieldSpecs = FC.compareByFieldSpecs;
+
+flexibleCompare = FC.flexibleCompare;
+
+intersectRects = FC.intersectRects;
+
+CoordCache = FC.CoordCache;
+
+getContentRect = FC.getContentRect;
+
+getOuterRect = FC.getOuterRect;
+
+createObject = FC.createObject;
+
+Promise = FC.Promise;
+
+TaskQueue = FC.TaskQueue;
+
+
+/*
+Given a jQuery <tr> set, returns the <td>'s that do not have multi-line rowspans.
+Would use the [rowspan] selector, but never not defined in IE8.
+ */
+
+getOwnCells = function(trs) {
+  return trs.find('> td').filter(function(i, tdNode) {
+    return tdNode.rowSpan <= 1;
+  });
+};
+
+
+/*
+A Scroller with additional functionality:
+- optional ScrollerCanvas for content
+- fired events for scroll start/end
+- cross-browser normalization of horizontal scroll for RTL
+ */
+
+EnhancedScroller = (function(superClass) {
+  var detectRtlScrollSystem, rtlScrollSystem;
+
+  extend(EnhancedScroller, superClass);
+
+  EnhancedScroller.mixin(EmitterMixin);
+
+  EnhancedScroller.mixin(ListenerMixin);
+
+  EnhancedScroller.prototype.canvas = null;
+
+  EnhancedScroller.prototype.isScrolling = false;
+
+  EnhancedScroller.prototype.isTouching = false;
+
+  EnhancedScroller.prototype.isTouchedEver = false;
+
+  EnhancedScroller.prototype.isMoving = false;
+
+  EnhancedScroller.prototype.isTouchScrollEnabled = true;
+
+  EnhancedScroller.prototype.preventTouchScrollHandler = null;
+
+  function EnhancedScroller() {
+    EnhancedScroller.__super__.constructor.apply(this, arguments);
+    this.requestMovingEnd = debounce(this.reportMovingEnd, 500);
+  }
+
+  EnhancedScroller.prototype.render = function() {
+    EnhancedScroller.__super__.render.apply(this, arguments);
+    if (this.canvas) {
+      this.canvas.render();
+      this.canvas.el.appendTo(this.scrollEl);
+    }
+    return this.bindHandlers();
+  };
+
+  EnhancedScroller.prototype.destroy = function() {
+    EnhancedScroller.__super__.destroy.apply(this, arguments);
+    return this.unbindHandlers();
+  };
+
+  EnhancedScroller.prototype.disableTouchScroll = function() {
+    this.isTouchScrollEnabled = false;
+    return this.bindPreventTouchScroll();
+  };
+
+  EnhancedScroller.prototype.enableTouchScroll = function() {
+    this.isTouchScrollEnabled = true;
+    if (!this.isTouching) {
+      return this.unbindPreventTouchScroll();
+    }
+  };
+
+  EnhancedScroller.prototype.bindPreventTouchScroll = function() {
+    if (!this.preventTouchScrollHandler) {
+      return this.scrollEl.on('touchmove', this.preventTouchScrollHandler = FC.preventDefault);
+    }
+  };
+
+  EnhancedScroller.prototype.unbindPreventTouchScroll = function() {
+    if (this.preventTouchScrollHandler) {
+      this.scrollEl.off('touchmove', this.preventTouchScrollHandler);
+      return this.preventTouchScrollHandler = null;
+    }
+  };
+
+  EnhancedScroller.prototype.bindHandlers = function() {
+    return this.listenTo(this.scrollEl, {
+      scroll: this.reportScroll,
+      touchstart: this.reportTouchStart,
+      touchend: this.reportTouchEnd
+    });
+  };
+
+  EnhancedScroller.prototype.unbindHandlers = function() {
+    return this.stopListeningTo(this.scrollEl);
+  };
+
+  EnhancedScroller.prototype.reportScroll = function() {
+    if (!this.isScrolling) {
+      this.reportScrollStart();
+    }
+    this.trigger('scroll');
+    this.isMoving = true;
+    return this.requestMovingEnd();
+  };
+
+  EnhancedScroller.prototype.reportScrollStart = function() {
+    if (!this.isScrolling) {
+      this.isScrolling = true;
+      return this.trigger('scrollStart', this.isTouching);
+    }
+  };
+
+  EnhancedScroller.prototype.requestMovingEnd = null;
+
+  EnhancedScroller.prototype.reportMovingEnd = function() {
+    this.isMoving = false;
+    if (!this.isTouching) {
+      return this.reportScrollEnd();
+    }
+  };
+
+  EnhancedScroller.prototype.reportScrollEnd = function() {
+    if (this.isScrolling) {
+      this.trigger('scrollEnd');
+      return this.isScrolling = false;
+    }
+  };
+
+  EnhancedScroller.prototype.reportTouchStart = function() {
+    this.isTouching = true;
+    return this.isTouchedEver = true;
+  };
+
+  EnhancedScroller.prototype.reportTouchEnd = function() {
+    if (this.isTouching) {
+      this.isTouching = false;
+      if (this.isTouchScrollEnabled) {
+        this.unbindPreventTouchScroll();
+      }
+      if (!this.isMoving) {
+        return this.reportScrollEnd();
+      }
+    }
+  };
+
+
+  /*
+  	If RTL, and scrolled to the left, returns NEGATIVE value (like Firefox)
+   */
+
+  EnhancedScroller.prototype.getScrollLeft = function() {
+    var direction, node, val;
+    direction = this.scrollEl.css('direction');
+    node = this.scrollEl[0];
+    val = node.scrollLeft;
+    if (direction === 'rtl') {
+      switch (rtlScrollSystem) {
+        case 'positive':
+          val = val + node.clientWidth - node.scrollWidth;
+          break;
+        case 'reverse':
+          val = -val;
+      }
+    }
+    return val;
+  };
+
+
+  /*
+  	Accepts a NEGATIVE value for when scrolled in RTL
+   */
+
+  EnhancedScroller.prototype.setScrollLeft = function(val) {
+    var direction, node;
+    direction = this.scrollEl.css('direction');
+    node = this.scrollEl[0];
+    if (direction === 'rtl') {
+      switch (rtlScrollSystem) {
+        case 'positive':
+          val = val - node.clientWidth + node.scrollWidth;
+          break;
+        case 'reverse':
+          val = -val;
+      }
+    }
+    return node.scrollLeft = val;
+  };
+
+
+  /*
+  	Always returns the number of pixels scrolled from the leftmost position (even if RTL).
+  	Always positive.
+   */
+
+  EnhancedScroller.prototype.getScrollFromLeft = function() {
+    var direction, node, val;
+    direction = this.scrollEl.css('direction');
+    node = this.scrollEl[0];
+    val = node.scrollLeft;
+    if (direction === 'rtl') {
+      switch (rtlScrollSystem) {
+        case 'negative':
+          val = val - node.clientWidth + node.scrollWidth;
+          break;
+        case 'reverse':
+          val = -val - node.clientWidth + node.scrollWidth;
+      }
+    }
+    return val;
+  };
+
+  EnhancedScroller.prototype.getNativeScrollLeft = function() {
+    return this.scrollEl[0].scrollLeft;
+  };
+
+  EnhancedScroller.prototype.setNativeScrollLeft = function(val) {
+    return this.scrollEl[0].scrollLeft = val;
+  };
+
+  rtlScrollSystem = null;
+
+  detectRtlScrollSystem = function() {
+    var el, node, system;
+    el = $('<div style=" position: absolute top: -1000px; width: 1px; height: 1px; overflow: scroll; direction: rtl; font-size: 14px; ">A</div>').appendTo('body');
+    node = el[0];
+    system = node.scrollLeft > 0 ? 'positive' : (node.scrollLeft = 1, el.scrollLeft > 0 ? 'reverse' : 'negative');
+    el.remove();
+    return system;
+  };
+
+  $(function() {
+    return rtlScrollSystem = detectRtlScrollSystem();
+  });
+
+  return EnhancedScroller;
+
+})(FC.Scroller);
+
+
+/*
+A Scroller, but with a wrapping div that allows "clipping" away of native scrollbars,
+giving the appearance that there are no scrollbars.
+ */
+
+ClippedScroller = (function(superClass) {
+  extend(ClippedScroller, superClass);
+
+  ClippedScroller.prototype.isHScrollbarsClipped = false;
+
+  ClippedScroller.prototype.isVScrollbarsClipped = false;
+
+
+  /*
+  	Received overflows can be set to 'clipped', meaning scrollbars shouldn't be visible
+  	to the user, but the area should still scroll.
+   */
+
+  function ClippedScroller() {
+    ClippedScroller.__super__.constructor.apply(this, arguments);
+    if (this.overflowX === 'clipped-scroll') {
+      this.overflowX = 'scroll';
+      this.isHScrollbarsClipped = true;
+    }
+    if (this.overflowY === 'clipped-scroll') {
+      this.overflowY = 'scroll';
+      this.isVScrollbarsClipped = true;
+    }
+  }
+
+  ClippedScroller.prototype.renderEl = function() {
+    var scrollEl;
+    scrollEl = ClippedScroller.__super__.renderEl.apply(this, arguments);
+    return $('<div class="fc-scroller-clip" />').append(scrollEl);
+  };
+
+  ClippedScroller.prototype.updateSize = function() {
+    var cssProps, scrollEl, scrollbarWidths;
+    scrollEl = this.scrollEl;
+    scrollbarWidths = getScrollbarWidths(scrollEl);
+    cssProps = {
+      marginLeft: 0,
+      marginRight: 0,
+      marginTop: 0,
+      marginBottom: 0
+    };
+    if (this.isHScrollbarsClipped) {
+      cssProps.marginTop = -scrollbarWidths.top;
+      cssProps.marginBottom = -scrollbarWidths.bottom;
+    }
+    if (this.isVScrollbarsClipped) {
+      cssProps.marginLeft = -scrollbarWidths.left;
+      cssProps.marginRight = -scrollbarWidths.right;
+    }
+    scrollEl.css(cssProps);
+    return scrollEl.toggleClass('fc-no-scrollbars', (this.isHScrollbarsClipped || this.overflowX === 'hidden') && (this.isVScrollbarsClipped || this.overflowY === 'hidden') && !(scrollbarWidths.top || scrollbarWidths.bottom || scrollbarWidths.left || scrollbarWidths.right));
+  };
+
+
+  /*
+  	Accounts for 'clipped' scrollbars
+   */
+
+  ClippedScroller.prototype.getScrollbarWidths = function() {
+    var widths;
+    widths = getScrollbarWidths(this.scrollEl);
+    if (this.isHScrollbarsClipped) {
+      widths.top = 0;
+      widths.bottom = 0;
+    }
+    if (this.isVScrollbarsClipped) {
+      widths.left = 0;
+      widths.right = 0;
+    }
+    return widths;
+  };
+
+  return ClippedScroller;
+
+})(EnhancedScroller);
+
+
+/*
+A rectangular area of content that lives within a Scroller.
+Can have "gutters", areas of dead spacing around the perimeter.
+Also very useful for forcing a width, which a Scroller cannot do alone.
+Has a content area that lives above a background area.
+ */
+
+ScrollerCanvas = (function() {
+  ScrollerCanvas.prototype.el = null;
+
+  ScrollerCanvas.prototype.contentEl = null;
+
+  ScrollerCanvas.prototype.bgEl = null;
+
+  ScrollerCanvas.prototype.gutters = null;
+
+  ScrollerCanvas.prototype.width = null;
+
+  ScrollerCanvas.prototype.minWidth = null;
+
+  function ScrollerCanvas() {
+    this.gutters = {};
+  }
+
+  ScrollerCanvas.prototype.render = function() {
+    this.el = $('<div class="fc-scroller-canvas"> <div class="fc-content"></div> <div class="fc-bg"></div> </div>');
+    this.contentEl = this.el.find('.fc-content');
+    return this.bgEl = this.el.find('.fc-bg');
+  };
+
+
+  /*
+  	If falsy, resets all the gutters to 0
+   */
+
+  ScrollerCanvas.prototype.setGutters = function(gutters) {
+    if (!gutters) {
+      this.gutters = {};
+    } else {
+      $.extend(this.gutters, gutters);
+    }
+    return this.updateSize();
+  };
+
+  ScrollerCanvas.prototype.setWidth = function(width1) {
+    this.width = width1;
+    return this.updateSize();
+  };
+
+  ScrollerCanvas.prototype.setMinWidth = function(minWidth1) {
+    this.minWidth = minWidth1;
+    return this.updateSize();
+  };
+
+  ScrollerCanvas.prototype.clearWidth = function() {
+    this.width = null;
+    this.minWidth = null;
+    return this.updateSize();
+  };
+
+  ScrollerCanvas.prototype.updateSize = function() {
+    var gutters;
+    gutters = this.gutters;
+    this.el.toggleClass('fc-gutter-left', Boolean(gutters.left)).toggleClass('fc-gutter-right', Boolean(gutters.right)).toggleClass('fc-gutter-top', Boolean(gutters.top)).toggleClass('fc-gutter-bottom', Boolean(gutters.bottom)).css({
+      paddingLeft: gutters.left || '',
+      paddingRight: gutters.right || '',
+      paddingTop: gutters.top || '',
+      paddingBottom: gutters.bottom || '',
+      width: this.width != null ? this.width + (gutters.left || 0) + (gutters.right || 0) : '',
+      minWidth: this.minWidth != null ? this.minWidth + (gutters.left || 0) + (gutters.right || 0) : ''
+    });
+    return this.bgEl.css({
+      left: gutters.left || '',
+      right: gutters.right || '',
+      top: gutters.top || '',
+      bottom: gutters.bottom || ''
+    });
+  };
+
+  return ScrollerCanvas;
+
+})();
+
+ScrollJoiner = (function() {
+  ScrollJoiner.prototype.axis = null;
+
+  ScrollJoiner.prototype.scrollers = null;
+
+  ScrollJoiner.prototype.masterScroller = null;
+
+  function ScrollJoiner(axis, scrollers) {
+    var j, len, ref, scroller;
+    this.axis = axis;
+    this.scrollers = scrollers;
+    ref = this.scrollers;
+    for (j = 0, len = ref.length; j < len; j++) {
+      scroller = ref[j];
+      this.initScroller(scroller);
+    }
+    return;
+  }
+
+  ScrollJoiner.prototype.initScroller = function(scroller) {
+    scroller.scrollEl.on('wheel mousewheel DomMouseScroll MozMousePixelScroll', (function(_this) {
+      return function() {
+        _this.assignMasterScroller(scroller);
+      };
+    })(this));
+    return scroller.on('scrollStart', (function(_this) {
+      return function() {
+        if (!_this.masterScroller) {
+          return _this.assignMasterScroller(scroller);
+        }
+      };
+    })(this)).on('scroll', (function(_this) {
+      return function() {
+        var j, len, otherScroller, ref, results;
+        if (scroller === _this.masterScroller) {
+          ref = _this.scrollers;
+          results = [];
+          for (j = 0, len = ref.length; j < len; j++) {
+            otherScroller = ref[j];
+            if (otherScroller !== scroller) {
+              switch (_this.axis) {
+                case 'horizontal':
+                  results.push(otherScroller.setNativeScrollLeft(scroller.getNativeScrollLeft()));
+                  break;
+                case 'vertical':
+                  results.push(otherScroller.setScrollTop(scroller.getScrollTop()));
+                  break;
+                default:
+                  results.push(void 0);
+              }
+            } else {
+              results.push(void 0);
+            }
+          }
+          return results;
+        }
+      };
+    })(this)).on('scrollEnd', (function(_this) {
+      return function() {
+        if (scroller === _this.masterScroller) {
+          return _this.unassignMasterScroller();
+        }
+      };
+    })(this));
+  };
+
+  ScrollJoiner.prototype.assignMasterScroller = function(scroller) {
+    var j, len, otherScroller, ref;
+    this.unassignMasterScroller();
+    this.masterScroller = scroller;
+    ref = this.scrollers;
+    for (j = 0, len = ref.length; j < len; j++) {
+      otherScroller = ref[j];
+      if (otherScroller !== scroller) {
+        otherScroller.disableTouchScroll();
+      }
+    }
+  };
+
+  ScrollJoiner.prototype.unassignMasterScroller = function() {
+    var j, len, otherScroller, ref;
+    if (this.masterScroller) {
+      ref = this.scrollers;
+      for (j = 0, len = ref.length; j < len; j++) {
+        otherScroller = ref[j];
+        otherScroller.enableTouchScroll();
+      }
+      this.masterScroller = null;
+    }
+  };
+
+  ScrollJoiner.prototype.update = function() {
+    var allWidths, i, j, k, len, len1, maxBottom, maxLeft, maxRight, maxTop, ref, scroller, widths;
+    allWidths = (function() {
+      var j, len, ref, results;
+      ref = this.scrollers;
+      results = [];
+      for (j = 0, len = ref.length; j < len; j++) {
+        scroller = ref[j];
+        results.push(scroller.getScrollbarWidths());
+      }
+      return results;
+    }).call(this);
+    maxLeft = maxRight = maxTop = maxBottom = 0;
+    for (j = 0, len = allWidths.length; j < len; j++) {
+      widths = allWidths[j];
+      maxLeft = Math.max(maxLeft, widths.left);
+      maxRight = Math.max(maxRight, widths.right);
+      maxTop = Math.max(maxTop, widths.top);
+      maxBottom = Math.max(maxBottom, widths.bottom);
+    }
+    ref = this.scrollers;
+    for (i = k = 0, len1 = ref.length; k < len1; i = ++k) {
+      scroller = ref[i];
+      widths = allWidths[i];
+      scroller.canvas.setGutters(this.axis === 'horizontal' ? {
+        left: maxLeft - widths.left,
+        right: maxRight - widths.right
+      } : {
+        top: maxTop - widths.top,
+        bottom: maxBottom - widths.bottom
+      });
+    }
+  };
+
+  return ScrollJoiner;
+
+})();
+
+ScrollFollower = (function() {
+  ScrollFollower.prototype.scroller = null;
+
+  ScrollFollower.prototype.scrollbarWidths = null;
+
+  ScrollFollower.prototype.sprites = null;
+
+  ScrollFollower.prototype.viewportRect = null;
+
+  ScrollFollower.prototype.contentOffset = null;
+
+  ScrollFollower.prototype.isHFollowing = true;
+
+  ScrollFollower.prototype.isVFollowing = false;
+
+  ScrollFollower.prototype.allowPointerEvents = false;
+
+  ScrollFollower.prototype.containOnNaturalLeft = false;
+
+  ScrollFollower.prototype.containOnNaturalRight = false;
+
+  ScrollFollower.prototype.minTravel = 0;
+
+  ScrollFollower.prototype.isTouch = false;
+
+  ScrollFollower.prototype.isForcedRelative = false;
+
+  function ScrollFollower(scroller, allowPointerEvents) {
+    this.allowPointerEvents = allowPointerEvents != null ? allowPointerEvents : false;
+    this.scroller = scroller;
+    this.sprites = [];
+    scroller.on('scroll', (function(_this) {
+      return function() {
+        if (scroller.isTouchedEver) {
+          _this.isTouch = true;
+          return _this.isForcedRelative = true;
+        } else {
+          _this.isTouch = false;
+          _this.isForcedRelative = false;
+          return _this.handleScroll();
+        }
+      };
+    })(this));
+    scroller.on('scrollEnd', (function(_this) {
+      return function() {
+        return _this.handleScroll();
+      };
+    })(this));
+  }
+
+  ScrollFollower.prototype.setSprites = function(sprites) {
+    var j, len, sprite;
+    this.clearSprites();
+    if (sprites instanceof $) {
+      return this.sprites = (function() {
+        var j, len, results;
+        results = [];
+        for (j = 0, len = sprites.length; j < len; j++) {
+          sprite = sprites[j];
+          results.push(new ScrollFollowerSprite($(sprite), this));
+        }
+        return results;
+      }).call(this);
+    } else {
+      for (j = 0, len = sprites.length; j < len; j++) {
+        sprite = sprites[j];
+        sprite.follower = this;
+      }
+      return this.sprites = sprites;
+    }
+  };
+
+  ScrollFollower.prototype.clearSprites = function() {
+    var j, len, ref, sprite;
+    ref = this.sprites;
+    for (j = 0, len = ref.length; j < len; j++) {
+      sprite = ref[j];
+      sprite.clear();
+    }
+    return this.sprites = [];
+  };
+
+  ScrollFollower.prototype.handleScroll = function() {
+    this.updateViewport();
+    return this.updatePositions();
+  };
+
+  ScrollFollower.prototype.cacheDimensions = function() {
+    var j, len, ref, sprite;
+    this.updateViewport();
+    this.scrollbarWidths = this.scroller.getScrollbarWidths();
+    this.contentOffset = this.scroller.canvas.el.offset();
+    ref = this.sprites;
+    for (j = 0, len = ref.length; j < len; j++) {
+      sprite = ref[j];
+      sprite.cacheDimensions();
+    }
+  };
+
+  ScrollFollower.prototype.updateViewport = function() {
+    var left, scroller, top;
+    scroller = this.scroller;
+    left = scroller.getScrollFromLeft();
+    top = scroller.getScrollTop();
+    return this.viewportRect = {
+      left: left,
+      right: left + scroller.getClientWidth(),
+      top: top,
+      bottom: top + scroller.getClientHeight()
+    };
+  };
+
+  ScrollFollower.prototype.forceRelative = function() {
+    var j, len, ref, results, sprite;
+    if (!this.isForcedRelative) {
+      this.isForcedRelative = true;
+      ref = this.sprites;
+      results = [];
+      for (j = 0, len = ref.length; j < len; j++) {
+        sprite = ref[j];
+        if (sprite.doAbsolute) {
+          results.push(sprite.assignPosition());
+        } else {
+          results.push(void 0);
+        }
+      }
+      return results;
+    }
+  };
+
+  ScrollFollower.prototype.clearForce = function() {
+    var j, len, ref, results, sprite;
+    if (this.isForcedRelative && !this.isTouch) {
+      this.isForcedRelative = false;
+      ref = this.sprites;
+      results = [];
+      for (j = 0, len = ref.length; j < len; j++) {
+        sprite = ref[j];
+        results.push(sprite.assignPosition());
+      }
+      return results;
+    }
+  };
+
+  ScrollFollower.prototype.update = function() {
+    this.cacheDimensions();
+    return this.updatePositions();
+  };
+
+  ScrollFollower.prototype.updatePositions = function() {
+    var j, len, ref, sprite;
+    ref = this.sprites;
+    for (j = 0, len = ref.length; j < len; j++) {
+      sprite = ref[j];
+      sprite.updatePosition();
+    }
+  };
+
+  ScrollFollower.prototype.getContentRect = function(el) {
+    return getContentRect(el, this.contentOffset);
+  };
+
+  ScrollFollower.prototype.getBoundingRect = function(el) {
+    return getOuterRect(el, this.contentOffset);
+  };
+
+  return ScrollFollower;
+
+})();
+
+ScrollFollowerSprite = (function() {
+  ScrollFollowerSprite.prototype.follower = null;
+
+  ScrollFollowerSprite.prototype.el = null;
+
+  ScrollFollowerSprite.prototype.absoluteEl = null;
+
+  ScrollFollowerSprite.prototype.naturalRect = null;
+
+  ScrollFollowerSprite.prototype.parentRect = null;
+
+  ScrollFollowerSprite.prototype.containerRect = null;
+
+  ScrollFollowerSprite.prototype.isEnabled = true;
+
+  ScrollFollowerSprite.prototype.isHFollowing = false;
+
+  ScrollFollowerSprite.prototype.isVFollowing = false;
+
+  ScrollFollowerSprite.prototype.doAbsolute = false;
+
+  ScrollFollowerSprite.prototype.isAbsolute = false;
+
+  ScrollFollowerSprite.prototype.isCentered = false;
+
+  ScrollFollowerSprite.prototype.rect = null;
+
+  ScrollFollowerSprite.prototype.isBlock = false;
+
+  ScrollFollowerSprite.prototype.naturalWidth = null;
+
+  function ScrollFollowerSprite(el1, follower1) {
+    this.el = el1;
+    this.follower = follower1 != null ? follower1 : null;
+    this.isBlock = this.el.css('display') === 'block';
+    this.el.css('position', 'relative');
+  }
+
+  ScrollFollowerSprite.prototype.disable = function() {
+    if (this.isEnabled) {
+      this.isEnabled = false;
+      this.resetPosition();
+      return this.unabsolutize();
+    }
+  };
+
+  ScrollFollowerSprite.prototype.enable = function() {
+    if (!this.isEnabled) {
+      this.isEnabled = true;
+      return this.assignPosition();
+    }
+  };
+
+  ScrollFollowerSprite.prototype.clear = function() {
+    this.disable();
+    this.follower = null;
+    return this.absoluteEl = null;
+  };
+
+  ScrollFollowerSprite.prototype.cacheDimensions = function() {
+    var containerRect, follower, isCentered, isHFollowing, isVFollowing, minTravel, naturalRect, parentEl;
+    isHFollowing = false;
+    isVFollowing = false;
+    isCentered = false;
+    this.naturalWidth = this.el.width();
+    this.resetPosition();
+    follower = this.follower;
+    naturalRect = this.naturalRect = follower.getBoundingRect(this.el);
+    parentEl = this.el.parent();
+    this.parentRect = follower.getBoundingRect(parentEl);
+    containerRect = this.containerRect = joinRects(follower.getContentRect(parentEl), naturalRect);
+    minTravel = follower.minTravel;
+    if (follower.containOnNaturalLeft) {
+      containerRect.left = naturalRect.left;
+    }
+    if (follower.containOnNaturalRight) {
+      containerRect.right = naturalRect.right;
+    }
+    if (follower.isHFollowing) {
+      if (getRectWidth(containerRect) - getRectWidth(naturalRect) >= minTravel) {
+        isCentered = this.el.css('text-align') === 'center';
+        isHFollowing = true;
+      }
+    }
+    if (follower.isVFollowing) {
+      if (getRectHeight(containerRect) - getRectHeight(naturalRect) >= minTravel) {
+        isVFollowing = true;
+      }
+    }
+    this.isHFollowing = isHFollowing;
+    this.isVFollowing = isVFollowing;
+    return this.isCentered = isCentered;
+  };
+
+  ScrollFollowerSprite.prototype.updatePosition = function() {
+    this.computePosition();
+    return this.assignPosition();
+  };
+
+  ScrollFollowerSprite.prototype.resetPosition = function() {
+    return this.el.css({
+      top: '',
+      left: ''
+    });
+  };
+
+  ScrollFollowerSprite.prototype.computePosition = function() {
+    var containerRect, doAbsolute, parentRect, rect, rectWidth, subjectRect, viewportRect, visibleParentRect;
+    viewportRect = this.follower.viewportRect;
+    parentRect = this.parentRect;
+    containerRect = this.containerRect;
+    visibleParentRect = intersectRects(viewportRect, parentRect);
+    rect = null;
+    doAbsolute = false;
+    if (visibleParentRect) {
+      rect = copyRect(this.naturalRect);
+      subjectRect = intersectRects(rect, parentRect);
+      if ((this.isCentered && !testRectContains(viewportRect, parentRect)) || (subjectRect && !testRectContains(viewportRect, subjectRect))) {
+        doAbsolute = true;
+        if (this.isHFollowing) {
+          if (this.isCentered) {
+            rectWidth = getRectWidth(rect);
+            rect.left = (visibleParentRect.left + visibleParentRect.right) / 2 - rectWidth / 2;
+            rect.right = rect.left + rectWidth;
+          } else {
+            if (!hContainRect(rect, viewportRect)) {
+              doAbsolute = false;
+            }
+          }
+          if (hContainRect(rect, containerRect)) {
+            doAbsolute = false;
+          }
+        }
+        if (this.isVFollowing) {
+          if (!vContainRect(rect, viewportRect)) {
+            doAbsolute = false;
+          }
+          if (vContainRect(rect, containerRect)) {
+            doAbsolute = false;
+          }
+        }
+        if (!testRectContains(viewportRect, rect)) {
+          doAbsolute = false;
+        }
+      }
+    }
+    this.rect = rect;
+    return this.doAbsolute = doAbsolute;
+  };
+
+  ScrollFollowerSprite.prototype.assignPosition = function() {
+    var left, top;
+    if (this.isEnabled) {
+      if (!this.rect) {
+        return this.unabsolutize();
+      } else if (this.doAbsolute && !this.follower.isForcedRelative) {
+        this.absolutize();
+        return this.absoluteEl.css({
+          top: this.rect.top - this.follower.viewportRect.top + this.follower.scrollbarWidths.top,
+          left: this.rect.left - this.follower.viewportRect.left + this.follower.scrollbarWidths.left,
+          width: this.isBlock ? this.naturalWidth : ''
+        });
+      } else {
+        top = this.rect.top - this.naturalRect.top;
+        left = this.rect.left - this.naturalRect.left;
+        this.unabsolutize();
+        return this.el.toggleClass('fc-following', Boolean(top || left)).css({
+          top: top,
+          left: left
+        });
+      }
+    }
+  };
+
+  ScrollFollowerSprite.prototype.absolutize = function() {
+    if (!this.isAbsolute) {
+      if (!this.absoluteEl) {
+        this.absoluteEl = this.buildAbsoluteEl();
+      }
+      this.absoluteEl.appendTo(this.follower.scroller.el);
+      this.el.css('visibility', 'hidden');
+      return this.isAbsolute = true;
+    }
+  };
+
+  ScrollFollowerSprite.prototype.unabsolutize = function() {
+    if (this.isAbsolute) {
+      this.absoluteEl.detach();
+      this.el.css('visibility', '');
+      return this.isAbsolute = false;
+    }
+  };
+
+  ScrollFollowerSprite.prototype.buildAbsoluteEl = function() {
+    var el;
+    el = this.el.clone().addClass('fc-following');
+    el.css({
+      'position': 'absolute',
+      'z-index': 1000,
+      'font-weight': this.el.css('font-weight'),
+      'font-size': this.el.css('font-size'),
+      'font-family': this.el.css('font-family'),
+      'text-decoration': this.el.css('text-decoration'),
+      'color': this.el.css('color'),
+      'padding-top': this.el.css('padding-top'),
+      'padding-bottom': this.el.css('padding-bottom'),
+      'padding-left': this.el.css('padding-left'),
+      'padding-right': this.el.css('padding-right')
+    });
+    if (!this.follower.allowPointerEvents) {
+      el.css('pointer-events', 'none');
+    }
+    return el;
+  };
+
+  return ScrollFollowerSprite;
+
+})();
+
+copyRect = function(rect) {
+  return {
+    left: rect.left,
+    right: rect.right,
+    top: rect.top,
+    bottom: rect.bottom
+  };
+};
+
+getRectWidth = function(rect) {
+  return rect.right - rect.left;
+};
+
+getRectHeight = function(rect) {
+  return rect.bottom - rect.top;
+};
+
+testRectContains = function(rect, innerRect) {
+  return testRectHContains(rect, innerRect) && testRectVContains(rect, innerRect);
+};
+
+testRectHContains = function(rect, innerRect) {
+  return innerRect.left >= rect.left && innerRect.right <= rect.right;
+};
+
+testRectVContains = function(rect, innerRect) {
+  return innerRect.top >= rect.top && innerRect.bottom <= rect.bottom;
+};
+
+hContainRect = function(rect, outerRect) {
+  if (rect.left < outerRect.left) {
+    rect.right = outerRect.left + getRectWidth(rect);
+    rect.left = outerRect.left;
+    return true;
+  } else if (rect.right > outerRect.right) {
+    rect.left = outerRect.right - getRectWidth(rect);
+    rect.right = outerRect.right;
+    return true;
+  } else {
+    return false;
+  }
+};
+
+vContainRect = function(rect, outerRect) {
+  if (rect.top < outerRect.top) {
+    rect.bottom = outerRect.top + getRectHeight(rect);
+    rect.top = outerRect.top;
+    return true;
+  } else if (rect.bottom > outerRect.bottom) {
+    rect.top = outerRect.bottom - getRectHeight(rect);
+    rect.bottom = outerRect.bottom;
+    return true;
+  } else {
+    return false;
+  }
+};
+
+joinRects = function(rect1, rect2) {
+  return {
+    left: Math.min(rect1.left, rect2.left),
+    right: Math.max(rect1.right, rect2.right),
+    top: Math.min(rect1.top, rect2.top),
+    bottom: Math.max(rect1.bottom, rect2.bottom)
+  };
+};
+
+CalendarExtension = (function(superClass) {
+  extend(CalendarExtension, superClass);
+
+  function CalendarExtension() {
+    return CalendarExtension.__super__.constructor.apply(this, arguments);
+  }
+
+  CalendarExtension.prototype.resourceManager = null;
+
+  CalendarExtension.prototype.initialize = function() {
+    return this.resourceManager = new ResourceManager(this);
+  };
+
+  CalendarExtension.prototype.instantiateView = function(viewType) {
+    var spec, viewClass;
+    spec = this.getViewSpec(viewType);
+    viewClass = spec['class'];
+    if (this.opt('resources') && spec.options.resources !== false) {
+      if (spec.queryResourceClass) {
+        viewClass = spec.queryResourceClass(spec) || viewClass;
+      } else if (spec.resourceClass) {
+        viewClass = spec.resourceClass;
+      }
+    }
+    return new viewClass(this, spec);
+  };
+
+  CalendarExtension.prototype.getResources = function() {
+    return Array.prototype.slice.call(this.resourceManager.topLevelResources);
+  };
+
+  CalendarExtension.prototype.addResource = function(resourceInput, scroll) {
+    var promise;
+    if (scroll == null) {
+      scroll = false;
+    }
+    promise = this.resourceManager.addResource(resourceInput);
+    if (scroll && this.view.scrollToResource) {
+      promise.then((function(_this) {
+        return function(resource) {
+          return _this.view.scrollToResource(resource);
+        };
+      })(this));
+    }
+  };
+
+  CalendarExtension.prototype.removeResource = function(idOrResource) {
+    return this.resourceManager.removeResource(idOrResource);
+  };
+
+  CalendarExtension.prototype.refetchResources = function() {
+    this.resourceManager.clear();
+    this.view.flash('initialResources');
+  };
+
+  CalendarExtension.prototype.rerenderResources = function() {
+    this.resourceManager.resetCurrentResources();
+  };
+
+  CalendarExtension.prototype.isSpanAllowed = function(span, constraint) {
+    var constrainToResourceIds, ref;
+    if (typeof constraint === 'object') {
+      constrainToResourceIds = this.getEventResourceIds(constraint);
+      if (constrainToResourceIds.length && (!span.resourceId || !(ref = span.resourceId, indexOf.call(constrainToResourceIds, ref) >= 0))) {
+        return false;
+      }
+    }
+    return CalendarExtension.__super__.isSpanAllowed.apply(this, arguments);
+  };
+
+  CalendarExtension.prototype.mutateSeg = function(span, newProps, largeUnit) {
+    var mutatedResourceIds, newResourceId, oldResourceId, ref;
+    if (newProps.resourceId) {
+      oldResourceId = ((ref = span.resource) != null ? ref.id : void 0) || span.resourceId;
+      newResourceId = newProps.resourceId;
+      mutatedResourceIds = this.getEventResourceIds(span.event);
+      if (oldResourceId !== newResourceId) {
+        mutatedResourceIds = mutatedResourceIds.filter(function(resourceId) {
+          return resourceId !== oldResourceId && resourceId !== newResourceId;
+        });
+        mutatedResourceIds.push(newResourceId);
+      }
+      newProps = $.extend({}, newProps);
+      this.setEventResourceIds(newProps, mutatedResourceIds);
+    }
+    return this.mutateEvent(span.event, newProps, largeUnit);
+  };
+
+  CalendarExtension.prototype.getPeerEvents = function(span, event) {
+    var filteredPeerEvents, isPeer, j, k, l, len, len1, len2, newResourceId, newResourceIds, peerEvent, peerEvents, peerResourceId, peerResourceIds;
+    peerEvents = CalendarExtension.__super__.getPeerEvents.apply(this, arguments);
+    newResourceIds = span.resourceId ? [span.resourceId] : event ? this.getEventResourceIds(event) : [];
+    filteredPeerEvents = [];
+    for (j = 0, len = peerEvents.length; j < len; j++) {
+      peerEvent = peerEvents[j];
+      isPeer = false;
+      peerResourceIds = this.getEventResourceIds(peerEvent);
+      if (!peerResourceIds.length || !newResourceIds.length) {
+        isPeer = true;
+      } else {
+        for (k = 0, len1 = peerResourceIds.length; k < len1; k++) {
+          peerResourceId = peerResourceIds[k];
+          for (l = 0, len2 = newResourceIds.length; l < len2; l++) {
+            newResourceId = newResourceIds[l];
+            if (newResourceId === peerResourceId) {
+              isPeer = true;
+              break;
+            }
+          }
+        }
+      }
+      if (isPeer) {
+        filteredPeerEvents.push(peerEvent);
+      }
+    }
+    return filteredPeerEvents;
+  };
+
+  CalendarExtension.prototype.spanContainsSpan = function(outerSpan, innerSpan) {
+    if (outerSpan.resourceId && outerSpan.resourceId !== innerSpan.resourceId) {
+      return false;
+    } else {
+      return CalendarExtension.__super__.spanContainsSpan.apply(this, arguments);
+    }
+  };
+
+  CalendarExtension.prototype.getCurrentBusinessHourEvents = function(wholeDay) {
+    var allEvents, anyCustomBusinessHours, event, events, flatResources, j, k, l, len, len1, len2, resource;
+    flatResources = this.resourceManager.getFlatResources();
+    anyCustomBusinessHours = false;
+    for (j = 0, len = flatResources.length; j < len; j++) {
+      resource = flatResources[j];
+      if (resource.businessHours) {
+        anyCustomBusinessHours = true;
+      }
+    }
+    if (anyCustomBusinessHours) {
+      allEvents = [];
+      for (k = 0, len1 = flatResources.length; k < len1; k++) {
+        resource = flatResources[k];
+        events = this.computeBusinessHourEvents(wholeDay, resource.businessHours || this.opt('businessHours'));
+        for (l = 0, len2 = events.length; l < len2; l++) {
+          event = events[l];
+          event.resourceId = resource.id;
+          allEvents.push(event);
+        }
+      }
+      return allEvents;
+    } else {
+      return CalendarExtension.__super__.getCurrentBusinessHourEvents.apply(this, arguments);
+    }
+  };
+
+  CalendarExtension.prototype.buildSelectSpan = function(startInput, endInput, resourceId) {
+    var span;
+    span = CalendarExtension.__super__.buildSelectSpan.apply(this, arguments);
+    if (resourceId) {
+      span.resourceId = resourceId;
+    }
+    return span;
+  };
+
+  CalendarExtension.prototype.getResourceById = function(id) {
+    return this.resourceManager.getResourceById(id);
+  };
+
+  CalendarExtension.prototype.normalizeEvent = function(event) {
+    CalendarExtension.__super__.normalizeEvent.apply(this, arguments);
+    if (event.resourceId == null) {
+      event.resourceId = null;
+    }
+    return event.resourceIds != null ? event.resourceIds : event.resourceIds = null;
+  };
+
+  CalendarExtension.prototype.getEventResourceId = function(event) {
+    return this.getEventResourceIds(event)[0];
+  };
+
+  CalendarExtension.prototype.getEventResourceIds = function(event) {
+    var j, len, normalResourceId, normalResourceIds, ref, ref1, ref2, resourceId;
+    resourceId = String((ref = (ref1 = event[this.getEventResourceField()]) != null ? ref1 : event.resourceId) != null ? ref : '');
+    if (resourceId) {
+      return [resourceId];
+    } else if (event.resourceIds) {
+      normalResourceIds = [];
+      ref2 = event.resourceIds;
+      for (j = 0, len = ref2.length; j < len; j++) {
+        resourceId = ref2[j];
+        normalResourceId = String(resourceId != null ? resourceId : '');
+        if (normalResourceId) {
+          normalResourceIds.push(normalResourceId);
+        }
+      }
+      return normalResourceIds;
+    } else {
+      return [];
+    }
+  };
+
+  CalendarExtension.prototype.setEventResourceId = function(event, resourceId) {
+    return this.setEventResourceIds(event, resourceId ? [resourceId] : []);
+  };
+
+  CalendarExtension.prototype.setEventResourceIds = function(event, resourceIds) {
+    event[this.getEventResourceField()] = resourceIds.length === 1 ? resourceIds[0] : null;
+    return event.resourceIds = resourceIds.length > 1 ? resourceIds : null;
+  };
+
+  CalendarExtension.prototype.getEventResourceField = function() {
+    return this.opt('eventResourceField') || 'resourceId';
+  };
+
+  CalendarExtension.prototype.getResourceEvents = function(idOrResource) {
+    var resource;
+    resource = typeof idOrResource === 'object' ? idOrResource : this.getResourceById(idOrResource);
+    if (resource) {
+      return this.clientEvents((function(_this) {
+        return function(event) {
+          return $.inArray(resource.id, _this.getEventResourceIds(event)) !== -1;
+        };
+      })(this));
+    } else {
+      return [];
+    }
+  };
+
+  CalendarExtension.prototype.getEventResource = function(idOrEvent) {
+    return this.getEventResources(idOrEvent)[0];
+  };
+
+  CalendarExtension.prototype.getEventResources = function(idOrEvent) {
+    var event, j, len, ref, resource, resourceId, resources;
+    event = typeof idOrEvent === 'object' ? idOrEvent : this.clientEvents(idOrEvent)[0];
+    resources = [];
+    if (event) {
+      ref = this.getEventResourceIds(event);
+      for (j = 0, len = ref.length; j < len; j++) {
+        resourceId = ref[j];
+        resource = this.getResourceById(resourceId);
+        if (resource) {
+          resources.push(resource);
+        }
+      }
+    }
+    return resources;
+  };
+
+  return CalendarExtension;
+
+})(Calendar);
+
+Calendar.prototype = CalendarExtension.prototype;
+
+origSetElement = View.prototype.setElement;
+
+origRemoveElement = View.prototype.removeElement;
+
+origOnBaseRender = View.prototype.onBaseRender;
+
+Calendar.defaults.refetchResourcesOnNavigate = false;
+
+View.prototype.canHandleSpecificResources = false;
+
+View.prototype.isDestroying = false;
+
+View.prototype.setElement = function() {
+  origSetElement.apply(this, arguments);
+  return this.watchResources();
+};
+
+View.prototype.removeElement = function() {
+  this.isDestroying = true;
+  this.unwatchResources();
+  origRemoveElement.apply(this, arguments);
+  return this.isDestroying = false;
+};
+
+View.prototype.onBaseRender = function() {
+  processLicenseKey(this.calendar.opt('schedulerLicenseKey'), this.el);
+  return origOnBaseRender.apply(this, arguments);
+};
+
+View.prototype.watchResources = function() {
+  var bindingDepNames, initialDepNames;
+  initialDepNames = [];
+  bindingDepNames = ['initialResources'];
+  if (this.opt('refetchResourcesOnNavigate')) {
+    initialDepNames.push('dateProfile');
+  }
+  if (this.opt('filterResourcesWithEvents')) {
+    bindingDepNames.push('currentEvents');
+  }
+  this.watch('initialResources', initialDepNames, (function(_this) {
+    return function(deps) {
+      return _this.getInitialResources(deps.dateProfile);
+    };
+  })(this));
+  return this.watch('bindingResources', bindingDepNames, (function(_this) {
+    return function(deps) {
+      _this.bindResourceChanges(deps.currentEvents);
+      _this.setResources(deps.initialResources, deps.currentEvents);
+    };
+  })(this), (function(_this) {
+    return function() {
+      _this.unbindResourceChanges();
+      _this.unsetResources();
+    };
+  })(this));
+};
+
+View.prototype.unwatchResources = function() {
+  this.unwatch('initialResources');
+  return this.unwatch('bindingResources');
+};
+
+View.prototype.getInitialResources = function(dateProfile) {
+  if (dateProfile) {
+    return this.calendar.resourceManager.getResources(dateProfile.activeRange.start, dateProfile.activeRange.end);
+  } else {
+    return this.calendar.resourceManager.getResources();
+  }
+};
+
+View.prototype.bindResourceChanges = function(currentEvents) {
+  return this.listenTo(this.calendar.resourceManager, {
+    set: (function(_this) {
+      return function(resources) {
+        return _this.setResources(resources, currentEvents);
+      };
+    })(this),
+    unset: (function(_this) {
+      return function() {
+        return _this.unsetResources();
+      };
+    })(this),
+    reset: (function(_this) {
+      return function(resources) {
+        return _this.resetResources(resources, currentEvents);
+      };
+    })(this),
+    add: (function(_this) {
+      return function(resource, allResources) {
+        return _this.addResource(resource, allResources, currentEvents);
+      };
+    })(this),
+    remove: (function(_this) {
+      return function(resource, allResources) {
+        return _this.removeResource(resource, allResources, currentEvents);
+      };
+    })(this)
+  });
+};
+
+View.prototype.unbindResourceChanges = function() {
+  return this.stopListeningTo(this.calendar.resourceManager);
+};
+
+View.watch('displayingEvents', ['displayingDates', 'hasEvents', 'currentResources'], function(deps) {
+  return this.requestEventsRender(this.get('currentEvents'));
+}, function() {
+  return this.requestEventsUnrender();
+});
+
+View.prototype.setResources = function(resources, currentEvents) {
+  if (currentEvents) {
+    resources = this.filterResourcesWithEvents(resources, currentEvents);
+  }
+  this.set('currentResources', resources);
+  this.set('hasResources', true);
+  return this.handleResourcesSet(resources);
+};
+
+View.prototype.unsetResources = function() {
+  this.unset('currentResources');
+  this.unset('hasResources');
+  return this.handleResourcesUnset();
+};
+
+View.prototype.resetResources = function(resources, currentEvents) {
+  this.startBatchRender();
+  this.unsetResources();
+  this.setResources(resources, currentEvents);
+  return this.stopBatchRender();
+};
+
+View.prototype.addResource = function(resource, allResources, currentEvents) {
+  var a;
+  if (!this.canHandleSpecificResources) {
+    return this.resetResources(allResources, currentEvents);
+  }
+  if (currentEvents) {
+    a = this.filterResourcesWithEvents([resource], currentEvents);
+    if (!a.length) {
+      resource = null;
+    }
+  }
+  if (resource) {
+    this.set('currentResources', allResources);
+    return this.handleResourceAdd(resource);
+  }
+};
+
+View.prototype.removeResource = function(resource, allResources, currentEvents) {
+  if (!this.canHandleSpecificResources) {
+    return this.resetResources(allResources, currentEvents);
+  }
+  this.set('currentResources', allResources);
+  return this.handleResourceRemove(resource);
+};
+
+View.prototype.handleResourcesSet = function(resources) {};
+
+View.prototype.handleResourcesUnset = function(resources) {};
+
+View.prototype.handleResourceAdd = function(resource) {};
+
+View.prototype.handleResourceRemove = function(resource) {};
+
+View.prototype.filterResourcesWithEvents = function(resources, events) {
+  var event, j, k, len, len1, ref, resourceId, resourceIdHits;
+  resourceIdHits = {};
+  for (j = 0, len = events.length; j < len; j++) {
+    event = events[j];
+    ref = this.calendar.getEventResourceIds(event);
+    for (k = 0, len1 = ref.length; k < len1; k++) {
+      resourceId = ref[k];
+      resourceIdHits[resourceId] = true;
+    }
+  }
+  return _filterResourcesWithEvents(resources, resourceIdHits);
+};
+
+_filterResourcesWithEvents = function(sourceResources, resourceIdHits) {
+  var filteredChildren, filteredResource, filteredResources, j, len, sourceResource;
+  filteredResources = [];
+  for (j = 0, len = sourceResources.length; j < len; j++) {
+    sourceResource = sourceResources[j];
+    if (sourceResource.children.length) {
+      filteredChildren = _filterResourcesWithEvents(sourceResource.children, resourceIdHits);
+      if (filteredChildren.length || resourceIdHits[sourceResource.id]) {
+        filteredResource = createObject(sourceResource);
+        filteredResource.children = filteredChildren;
+        filteredResources.push(filteredResource);
+      }
+    } else {
+      if (resourceIdHits[sourceResource.id]) {
+        filteredResources.push(sourceResource);
+      }
+    }
+  }
+  return filteredResources;
+};
+
+origGetSegCustomClasses = Grid.prototype.getSegCustomClasses;
+
+origGetSegDefaultBackgroundColor = Grid.prototype.getSegDefaultBackgroundColor;
+
+origGetSegDefaultBorderColor = Grid.prototype.getSegDefaultBorderColor;
+
+origGetSegDefaultTextColor = Grid.prototype.getSegDefaultTextColor;
+
+Grid.prototype.getSegCustomClasses = function(seg) {
+  var classes, j, len, ref, resource;
+  classes = origGetSegCustomClasses.apply(this, arguments);
+  ref = this.getSegResources(seg);
+  for (j = 0, len = ref.length; j < len; j++) {
+    resource = ref[j];
+    classes = classes.concat(resource.eventClassName || []);
+  }
+  return classes;
+};
+
+Grid.prototype.getSegDefaultBackgroundColor = function(seg) {
+  var currentResource, j, len, resources, val;
+  resources = this.getSegResources(seg);
+  for (j = 0, len = resources.length; j < len; j++) {
+    currentResource = resources[j];
+    while (currentResource) {
+      val = currentResource.eventBackgroundColor || currentResource.eventColor;
+      if (val) {
+        return val;
+      }
+      currentResource = currentResource._parent;
+    }
+  }
+  return origGetSegDefaultBackgroundColor.apply(this, arguments);
+};
+
+Grid.prototype.getSegDefaultBorderColor = function(seg) {
+  var currentResource, j, len, resources, val;
+  resources = this.getSegResources(seg);
+  for (j = 0, len = resources.length; j < len; j++) {
+    currentResource = resources[j];
+    while (currentResource) {
+      val = currentResource.eventBorderColor || currentResource.eventColor;
+      if (val) {
+        return val;
+      }
+      currentResource = currentResource._parent;
+    }
+  }
+  return origGetSegDefaultBorderColor.apply(this, arguments);
+};
+
+Grid.prototype.getSegDefaultTextColor = function(seg) {
+  var currentResource, j, len, resources, val;
+  resources = this.getSegResources(seg);
+  for (j = 0, len = resources.length; j < len; j++) {
+    currentResource = resources[j];
+    while (currentResource) {
+      val = currentResource.eventTextColor;
+      if (val) {
+        return val;
+      }
+      currentResource = currentResource._parent;
+    }
+  }
+  return origGetSegDefaultTextColor.apply(this, arguments);
+};
+
+Grid.prototype.getSegResources = function(seg) {
+  if (seg.resource) {
+    return [seg.resource];
+  } else {
+    return this.view.calendar.getEventResources(seg.event);
+  }
+};
+
+ResourceManager = (function(superClass) {
+  extend(ResourceManager, superClass);
+
+  ResourceManager.mixin(EmitterMixin);
+
+  ResourceManager.resourceGuid = 1;
+
+  ResourceManager.ajaxDefaults = {
+    dataType: 'json',
+    cache: false
+  };
+
+  ResourceManager.prototype.calendar = null;
+
+  ResourceManager.prototype.fetchId = 0;
+
+  ResourceManager.prototype.topLevelResources = null;
+
+  ResourceManager.prototype.resourcesById = null;
+
+  ResourceManager.prototype.fetching = null;
+
+  ResourceManager.prototype.currentStart = null;
+
+  ResourceManager.prototype.currentEnd = null;
+
+  function ResourceManager(calendar1) {
+    this.calendar = calendar1;
+    this.initializeCache();
+  }
+
+
+  /*
+  	Like fetchResources, but won't refetch if already fetched.
+   */
+
+  ResourceManager.prototype.getResources = function(start, end) {
+    var isSameRange;
+    isSameRange = (!start && !this.currentStart) || (start && this.currentStart && start.isSame(this.currentStart) && end.isSame(this.currentEnd));
+    if (!this.fetching || !isSameRange) {
+      return this.fetchResources(start, end);
+    } else {
+      return this.fetching;
+    }
+  };
+
+
+  /*
+  	Will always fetch, even if done previously.
+  	Accepts optional chrono-related params to pass on to the raw resource sources.
+  	Returns a promise.
+   */
+
+  ResourceManager.prototype.fetchResources = function(start, end) {
+    var currentFetchId;
+    currentFetchId = (this.fetchId += 1);
+    return this.fetching = Promise.construct((function(_this) {
+      return function(resolve, reject) {
+        return _this.fetchResourceInputs(function(resourceInputs) {
+          if (currentFetchId === _this.fetchId) {
+            _this.setResources(resourceInputs);
+            return resolve(_this.topLevelResources);
+          } else {
+            return reject();
+          }
+        }, start, end);
+      };
+    })(this));
+  };
+
+
+  /*
+  	Accepts optional chrono-related params to pass on to the raw resource sources.
+  	Calls callback when done.
+   */
+
+  ResourceManager.prototype.fetchResourceInputs = function(callback, start, end) {
+    var calendar, requestParams, source, timezone;
+    calendar = this.calendar;
+    source = calendar.opt('resources');
+    timezone = calendar.opt('timezone');
+    if ($.type(source) === 'string') {
+      source = {
+        url: source
+      };
+    }
+    switch ($.type(source)) {
+      case 'function':
+        this.calendar.pushLoading();
+        return source((function(_this) {
+          return function(resourceInputs) {
+            _this.calendar.popLoading();
+            return callback(resourceInputs);
+          };
+        })(this), start, end, calendar.opt('timezone'));
+      case 'object':
+        calendar.pushLoading();
+        requestParams = {};
+        if (start && end) {
+          requestParams[calendar.opt('startParam')] = start.format();
+          requestParams[calendar.opt('endParam')] = end.format();
+          if (timezone && timezone !== 'local') {
+            requestParams[calendar.opt('timezoneParam')] = timezone;
+          }
+        }
+        return $.ajax($.extend({
+          data: requestParams
+        }, ResourceManager.ajaxDefaults, source)).then((function(_this) {
+          return function(resourceInputs) {
+            calendar.popLoading();
+            return callback(resourceInputs);
+          };
+        })(this));
+      case 'array':
+        return callback(source);
+      default:
+        return callback([]);
+    }
+  };
+
+  ResourceManager.prototype.getResourceById = function(id) {
+    return this.resourcesById[id];
+  };
+
+  ResourceManager.prototype.getFlatResources = function() {
+    var id, results;
+    results = [];
+    for (id in this.resourcesById) {
+      results.push(this.resourcesById[id]);
+    }
+    return results;
+  };
+
+  ResourceManager.prototype.initializeCache = function() {
+    this.topLevelResources = [];
+    return this.resourcesById = {};
+  };
+
+  ResourceManager.prototype.setResources = function(resourceInputs) {
+    var j, len, resource, resourceInput, resources, validResources, wasSet;
+    wasSet = Boolean(this.topLevelResources);
+    this.initializeCache();
+    resources = (function() {
+      var j, len, results;
+      results = [];
+      for (j = 0, len = resourceInputs.length; j < len; j++) {
+        resourceInput = resourceInputs[j];
+        results.push(this.buildResource(resourceInput));
+      }
+      return results;
+    }).call(this);
+    validResources = (function() {
+      var j, len, results;
+      results = [];
+      for (j = 0, len = resources.length; j < len; j++) {
+        resource = resources[j];
+        if (this.addResourceToIndex(resource)) {
+          results.push(resource);
+        }
+      }
+      return results;
+    }).call(this);
+    for (j = 0, len = validResources.length; j < len; j++) {
+      resource = validResources[j];
+      this.addResourceToTree(resource);
+    }
+    if (wasSet) {
+      this.trigger('reset', this.topLevelResources);
+    } else {
+      this.trigger('set', this.topLevelResources);
+    }
+    return this.calendar.publiclyTrigger('resourcesSet', null, this.topLevelResources);
+  };
+
+  ResourceManager.prototype.resetCurrentResources = function() {
+    if (this.topLevelResources) {
+      return this.trigger('reset', this.topLevelResources);
+    }
+  };
+
+  ResourceManager.prototype.clear = function() {
+    this.topLevelResources = null;
+    return this.fetching = null;
+  };
+
+  ResourceManager.prototype.addResource = function(resourceInput) {
+    if (this.fetching) {
+      return this.fetching.then((function(_this) {
+        return function() {
+          var resource;
+          resource = _this.buildResource(resourceInput);
+          if (_this.addResourceToIndex(resource)) {
+            _this.addResourceToTree(resource);
+            _this.trigger('add', resource, _this.topLevelResources);
+            return resource;
+          } else {
+            return false;
+          }
+        };
+      })(this));
+    } else {
+      return Promise.reject();
+    }
+  };
+
+  ResourceManager.prototype.addResourceToIndex = function(resource) {
+    var child, j, len, ref;
+    if (this.resourcesById[resource.id]) {
+      return false;
+    } else {
+      this.resourcesById[resource.id] = resource;
+      ref = resource.children;
+      for (j = 0, len = ref.length; j < len; j++) {
+        child = ref[j];
+        this.addResourceToIndex(child);
+      }
+      return true;
+    }
+  };
+
+  ResourceManager.prototype.addResourceToTree = function(resource) {
+    var parent, parentId, ref, siblings;
+    if (!resource.parent) {
+      parentId = String((ref = resource['parentId']) != null ? ref : '');
+      if (parentId) {
+        parent = this.resourcesById[parentId];
+        if (parent) {
+          resource.parent = parent;
+          siblings = parent.children;
+        } else {
+          return false;
+        }
+      } else {
+        siblings = this.topLevelResources;
+      }
+      siblings.push(resource);
+    }
+    return true;
+  };
+
+  ResourceManager.prototype.removeResource = function(idOrResource) {
+    var id;
+    id = typeof idOrResource === 'object' ? idOrResource.id : idOrResource;
+    if (this.fetching) {
+      return this.fetching.then((function(_this) {
+        return function() {
+          var resource;
+          resource = _this.removeResourceFromIndex(id);
+          if (resource) {
+            _this.removeResourceFromTree(resource);
+            _this.trigger('remove', resource, _this.topLevelResources);
+          }
+          return resource;
+        };
+      })(this));
+    } else {
+      return Promise.reject();
+    }
+  };
+
+  ResourceManager.prototype.removeResourceFromIndex = function(resourceId) {
+    var child, j, len, ref, resource;
+    resource = this.resourcesById[resourceId];
+    if (resource) {
+      delete this.resourcesById[resourceId];
+      ref = resource.children;
+      for (j = 0, len = ref.length; j < len; j++) {
+        child = ref[j];
+        this.removeResourceFromIndex(child.id);
+      }
+      return resource;
+    } else {
+      return false;
+    }
+  };
+
+  ResourceManager.prototype.removeResourceFromTree = function(resource, siblings) {
+    var i, j, len, sibling;
+    if (siblings == null) {
+      siblings = this.topLevelResources;
+    }
+    for (i = j = 0, len = siblings.length; j < len; i = ++j) {
+      sibling = siblings[i];
+      if (sibling === resource) {
+        resource.parent = null;
+        siblings.splice(i, 1);
+        return true;
+      }
+      if (this.removeResourceFromTree(resource, sibling.children)) {
+        return true;
+      }
+    }
+    return false;
+  };
+
+  ResourceManager.prototype.buildResource = function(resourceInput) {
+    var child, childInput, rawClassName, ref, resource;
+    resource = $.extend({}, resourceInput);
+    resource.id = String((ref = resourceInput.id) != null ? ref : '_fc' + ResourceManager.resourceGuid++);
+    rawClassName = resourceInput.eventClassName;
+    resource.eventClassName = (function() {
+      switch ($.type(rawClassName)) {
+        case 'string':
+          return rawClassName.split(/\s+/);
+        case 'array':
+          return rawClassName;
+        default:
+          return [];
+      }
+    })();
+    resource.children = (function() {
+      var j, len, ref1, ref2, results;
+      ref2 = (ref1 = resourceInput.children) != null ? ref1 : [];
+      results = [];
+      for (j = 0, len = ref2.length; j < len; j++) {
+        childInput = ref2[j];
+        child = this.buildResource(childInput);
+        child.parent = resource;
+        results.push(child);
+      }
+      return results;
+    }).call(this);
+    return resource;
+  };
+
+  return ResourceManager;
+
+})(Class);
+
+Calendar.defaults.filterResourcesWithEvents = false;
+
+
+/*
+A view that structurally distinguishes events by resource
+ */
+
+ResourceViewMixin = {
+  isResourcesRendered: false,
+  resourceTextFunc: null,
+  setElement: function() {
+    View.prototype.setElement.apply(this, arguments);
+    this.watch('displayingResources', ['hasResources'], (function(_this) {
+      return function() {
+        return _this.requestResourcesRender(_this.get('currentResources'));
+      };
+    })(this), (function(_this) {
+      return function() {
+        return _this.requestResourcesUnrender();
+      };
+    })(this));
+    return this.watch('displayingEvents', ['displayingDates', 'hasEvents', 'displayingResources'], (function(_this) {
+      return function() {
+        return _this.requestEventsRender(_this.get('currentEvents'));
+      };
+    })(this), (function(_this) {
+      return function() {
+        return _this.requestEventsUnrender();
+      };
+    })(this));
+  },
+  queryScroll: function() {
+    var scroll;
+    scroll = View.prototype.queryScroll.apply(this, arguments);
+    if (this.isResourcesRendered) {
+      $.extend(scroll, this.queryResourceScroll());
+    }
+    return scroll;
+  },
+  applyScroll: function(scroll) {
+    View.prototype.applyScroll.apply(this, arguments);
+    if (this.isResourcesRendered) {
+      return this.applyResourceScroll(scroll);
+    }
+  },
+  queryResourceScroll: function() {
+    return {};
+  },
+  applyResourceScroll: function() {},
+  bindBaseRenderHandlers: function() {
+    var isDatesRendered, isResourcesRendered;
+    isResourcesRendered = false;
+    isDatesRendered = false;
+    this.on('resourcesRendered.baseHandler', function() {
+      if (!isResourcesRendered) {
+        isResourcesRendered = true;
+        if (isDatesRendered) {
+          return this.onBaseRender();
+        }
+      }
+    });
+    this.on('datesRendered.baseHandler', function() {
+      if (!isDatesRendered) {
+        isDatesRendered = true;
+        if (isResourcesRendered) {
+          return this.onBaseRender();
+        }
+      }
+    });
+    this.on('before:resourcesUnrendered.baseHandler', function() {
+      if (isResourcesRendered) {
+        return isResourcesRendered = false;
+      }
+    });
+    return this.on('before:datesUnrendered.baseHandler', function() {
+      if (isDatesRendered) {
+        isDatesRendered = false;
+        return this.onBeforeBaseUnrender();
+      }
+    });
+  },
+  handleResourcesSet: function(resources) {},
+  handleResourcesUnset: function() {},
+  handleResourceAdd: function(resource) {
+    return this.requestResourceRender(resource);
+  },
+  handleResourceRemove: function(resource) {
+    return this.requestResourceUnrender(resource);
+  },
+  requestResourcesRender: function(resources) {
+    return this.renderQueue.queue((function(_this) {
+      return function() {
+        return _this.executeResourcesRender(resources);
+      };
+    })(this), 'resource', 'init');
+  },
+  requestResourcesUnrender: function() {
+    return this.renderQueue.queue((function(_this) {
+      return function() {
+        return _this.executeResourcesUnrender();
+      };
+    })(this), 'resource', 'destroy');
+  },
+  requestResourceRender: function(resource) {
+    return this.renderQueue.queue((function(_this) {
+      return function() {
+        return _this.executeResourceRender(resource);
+      };
+    })(this), 'resource', 'add');
+  },
+  requestResourceUnrender: function(resource) {
+    return this.renderQueue.queue((function(_this) {
+      return function() {
+        return _this.executeResourceUnrender(resource);
+      };
+    })(this), 'resource', 'remove');
+  },
+  executeResourcesRender: function(resources) {
+    this.renderResources(resources);
+    this.isResourcesRendered = true;
+    return this.trigger('resourcesRendered');
+  },
+  executeResourcesUnrender: function() {
+    this.trigger('before:resourcesUnrendered');
+    this.unrenderResources();
+    return this.isResourcesRendered = false;
+  },
+  executeResourceRender: function(resource) {
+    return this.renderResource(resource);
+  },
+  executeResourceUnrender: function(resource) {
+    return this.unrenderResource(resource);
+  },
+  renderResources: function(resources) {},
+  unrenderResources: function() {},
+  renderResource: function(resource) {},
+  unrenderResource: function(resource) {},
+  isEventDraggable: function(event) {
+    return this.isEventResourceEditable(event) || View.prototype.isEventDraggable.call(this, event);
+  },
+  isEventResourceEditable: function(event) {
+    var ref, ref1, ref2;
+    return (ref = (ref1 = (ref2 = event.resourceEditable) != null ? ref2 : (event.source || {}).resourceEditable) != null ? ref1 : this.opt('eventResourceEditable')) != null ? ref : this.isEventGenerallyEditable(event);
+  },
+  getResourceText: function(resource) {
+    return this.getResourceTextFunc()(resource);
+  },
+  getResourceTextFunc: function() {
+    var func;
+    if (this.resourceTextFunc) {
+      return this.resourceTextFunc;
+    } else {
+      func = this.opt('resourceText');
+      if (typeof func !== 'function') {
+        func = function(resource) {
+          return resource.title || resource.id;
+        };
+      }
+      return this.resourceTextFunc = func;
+    }
+  },
+  triggerDayClick: function(span, dayEl, ev) {
+    var resourceManager;
+    resourceManager = this.calendar.resourceManager;
+    return this.publiclyTrigger('dayClick', dayEl, this.calendar.applyTimezone(span.start), ev, this, resourceManager.getResourceById(span.resourceId));
+  },
+  triggerSelect: function(span, ev) {
+    var resourceManager;
+    resourceManager = this.calendar.resourceManager;
+    return this.publiclyTrigger('select', null, this.calendar.applyTimezone(span.start), this.calendar.applyTimezone(span.end), ev, this, resourceManager.getResourceById(span.resourceId));
+  },
+  triggerExternalDrop: function(event, dropLocation, el, ev, ui) {
+    this.publiclyTrigger('drop', el[0], dropLocation.start, ev, ui, dropLocation.resourceId);
+    if (event) {
+      return this.publiclyTrigger('eventReceive', null, event);
+    }
+  },
+
+  /* Hacks
+  	 * ------------------------------------------------------------------------------------------------------------------
+  	These triggers usually call mutateEvent with dropLocation, which causes an event modification and rerender.
+  	But mutateEvent isn't aware of eventResourceField, so it might be setting the wrong property. Workaround.
+  	TODO: normalize somewhere else. maybe make a hook in core.
+   */
+  reportExternalDrop: function() {
+    var dropLocation, meta, otherArgs, ref;
+    meta = arguments[0], dropLocation = arguments[1], otherArgs = 3 <= arguments.length ? slice.call(arguments, 2) : [];
+    dropLocation = this.normalizeDropLocation(dropLocation);
+    return (ref = View.prototype.reportExternalDrop).call.apply(ref, [this, meta, dropLocation].concat(slice.call(otherArgs)));
+  },
+  normalizeDropLocation: function(dropLocation) {
+    var out;
+    out = $.extend({}, dropLocation);
+    delete out.resourceId;
+    this.calendar.setEventResourceId(out, dropLocation.resourceId);
+    return out;
+  }
+};
+
+
+/*
+For vertical resource view.
+For views that rely on grids that render their resources and dates in the same pass.
+ */
+
+VertResourceViewMixin = $.extend({}, ResourceViewMixin, {
+  setElement: function() {
+    var isDisplayingBoth, isDisplayingDatesOnly, needsScroll;
+    ResourceViewMixin.setElement.apply(this, arguments);
+    isDisplayingDatesOnly = false;
+    isDisplayingBoth = false;
+    needsScroll = false;
+    this.watch('dateProfileOnly', ['dateProfile'], (function(_this) {
+      return function() {
+        return needsScroll = true;
+      };
+    })(this));
+    this.watch('displayingDatesOnly', ['dateProfile', '?currentResources'], (function(_this) {
+      return function(deps) {
+        if (!deps.currentResources && !_this.isDestroying) {
+          isDisplayingDatesOnly = true;
+          return _this.renderQueue.queue(function() {
+            _this.executeDateRender(deps.dateProfile, !needsScroll);
+            return needsScroll = false;
+          }, 'date', 'init');
+        }
+      };
+    })(this), (function(_this) {
+      return function() {
+        if (isDisplayingDatesOnly) {
+          isDisplayingDatesOnly = false;
+          return _this.renderQueue.queue(function() {
+            return _this.executeDateUnrender();
+          }, 'date', 'destroy');
+        }
+      };
+    })(this));
+    this.watch('displayingDates', ['dateProfile', 'currentResources'], (function(_this) {
+      return function(deps) {
+        if (!_this.isDestroying) {
+          isDisplayingBoth = true;
+          return _this.renderQueue.queue(function() {
+            _this.setResourcesOnGrids(deps.currentResources);
+            _this.executeDateRender(deps.dateProfile, !needsScroll);
+            needsScroll = false;
+            return _this.trigger('resourcesRendered');
+          }, 'resource', 'init');
+        }
+      };
+    })(this), (function(_this) {
+      return function() {
+        if (isDisplayingBoth) {
+          isDisplayingBoth = false;
+          return _this.renderQueue.queue(function() {
+            _this.trigger('before:resourcesUnrendered');
+            _this.unsetResourcesOnGrids();
+            return _this.executeDateUnrender();
+          }, 'resource', 'destroy');
+        }
+      };
+    })(this));
+    return this.watch('displayingResources', ['displayingDates'], (function(_this) {
+      return function() {
+        return true;
+      };
+    })(this));
+  },
+  setResourcesOnGrids: function(resources) {},
+  unsetResourcesOnGrids: function() {}
+});
+
+ResourceGridMixin = {
+  allowCrossResource: true,
+  eventRangeToSpans: function(eventRange, event) {
+    var j, len, resourceId, resourceIds, results;
+    resourceIds = this.view.calendar.getEventResourceIds(event);
+    if (resourceIds.length) {
+      results = [];
+      for (j = 0, len = resourceIds.length; j < len; j++) {
+        resourceId = resourceIds[j];
+        results.push($.extend({}, eventRange, {
+          resourceId: resourceId
+        }));
+      }
+      return results;
+    } else if (FC.isBgEvent(event)) {
+      return Grid.prototype.eventRangeToSpans.apply(this, arguments);
+    } else {
+      return [];
+    }
+  },
+  fabricateHelperEvent: function(eventLocation, seg) {
+    var event;
+    event = Grid.prototype.fabricateHelperEvent.apply(this, arguments);
+    this.view.calendar.setEventResourceId(event, eventLocation.resourceId);
+    return event;
+  },
+  computeEventDrop: function(startSpan, endSpan, event) {
+    var dropLocation;
+    if (this.view.isEventStartEditable(event)) {
+      dropLocation = Grid.prototype.computeEventDrop.apply(this, arguments);
+    } else {
+      dropLocation = FC.pluckEventDateProps(event);
+    }
+    if (dropLocation) {
+      if (this.view.isEventResourceEditable(event)) {
+        dropLocation.resourceId = endSpan.resourceId;
+      } else {
+        dropLocation.resourceId = startSpan.resourceId;
+      }
+    }
+    return dropLocation;
+  },
+  computeExternalDrop: function(span, meta) {
+    var dropLocation;
+    dropLocation = Grid.prototype.computeExternalDrop.apply(this, arguments);
+    if (dropLocation) {
+      dropLocation.resourceId = span.resourceId;
+    }
+    return dropLocation;
+  },
+  computeEventResize: function(type, startSpan, endSpan, event) {
+    var resizeLocation;
+    if (!this.allowCrossResource && startSpan.resourceId !== endSpan.resourceId) {
+      return;
+    }
+    resizeLocation = Grid.prototype.computeEventResize.apply(this, arguments);
+    if (resizeLocation) {
+      resizeLocation.resourceId = startSpan.resourceId;
+    }
+    return resizeLocation;
+  },
+  computeSelectionSpan: function(startSpan, endSpan) {
+    var selectionSpan;
+    if (!this.allowCrossResource && startSpan.resourceId !== endSpan.resourceId) {
+      return;
+    }
+    selectionSpan = Grid.prototype.computeSelectionSpan.apply(this, arguments);
+    if (selectionSpan) {
+      selectionSpan.resourceId = startSpan.resourceId;
+    }
+    return selectionSpan;
+  }
+};
+
+
+/*
+Requirements:
+- must be a Grid
+- grid must have a view that's a ResourceView
+- DayTableMixin must already be mixed in
+ */
+
+ResourceDayTableMixin = {
+  flattenedResources: null,
+  resourceCnt: 0,
+  datesAboveResources: false,
+  allowCrossResource: false,
+  setResources: function(resources) {
+    this.flattenedResources = this.flattenResources(resources);
+    this.resourceCnt = this.flattenedResources.length;
+    return this.updateDayTableCols();
+  },
+  unsetResources: function() {
+    this.flattenedResources = null;
+    this.resourceCnt = 0;
+    return this.updateDayTableCols();
+  },
+  flattenResources: function(resources) {
+    var orderSpecs, orderVal, res, sortFunc;
+    orderVal = this.view.opt('resourceOrder');
+    if (orderVal) {
+      orderSpecs = parseFieldSpecs(orderVal);
+      sortFunc = function(a, b) {
+        return compareByFieldSpecs(a, b, orderSpecs);
+      };
+    } else {
+      sortFunc = null;
+    }
+    res = [];
+    this.accumulateResources(resources, sortFunc, res);
+    return res;
+  },
+  accumulateResources: function(resources, sortFunc, res) {
+    var j, len, resource, results, sortedResources;
+    if (sortFunc) {
+      sortedResources = resources.slice(0);
+      sortedResources.sort(sortFunc);
+    } else {
+      sortedResources = resources;
+    }
+    results = [];
+    for (j = 0, len = sortedResources.length; j < len; j++) {
+      resource = sortedResources[j];
+      res.push(resource);
+      results.push(this.accumulateResources(resource.children, sortFunc, res));
+    }
+    return results;
+  },
+  updateDayTableCols: function() {
+    this.datesAboveResources = this.view.opt('groupByDateAndResource');
+    return FC.DayTableMixin.updateDayTableCols.call(this);
+  },
+  computeColCnt: function() {
+    return (this.resourceCnt || 1) * this.daysPerRow;
+  },
+  getColDayIndex: function(col) {
+    if (this.isRTL) {
+      col = this.colCnt - 1 - col;
+    }
+    if (this.datesAboveResources) {
+      return Math.floor(col / (this.resourceCnt || 1));
+    } else {
+      return col % this.daysPerRow;
+    }
+  },
+  getColResource: function(col) {
+    return this.flattenedResources[this.getColResourceIndex(col)];
+  },
+  getColResourceIndex: function(col) {
+    if (this.isRTL) {
+      col = this.colCnt - 1 - col;
+    }
+    if (this.datesAboveResources) {
+      return col % (this.resourceCnt || 1);
+    } else {
+      return Math.floor(col / this.daysPerRow);
+    }
+  },
+  indicesToCol: function(resourceIndex, dayIndex) {
+    var col;
+    col = this.datesAboveResources ? dayIndex * (this.resourceCnt || 1) + resourceIndex : resourceIndex * this.daysPerRow + dayIndex;
+    if (this.isRTL) {
+      col = this.colCnt - 1 - col;
+    }
+    return col;
+  },
+  renderHeadTrHtml: function() {
+    if (!this.resourceCnt) {
+      return FC.DayTableMixin.renderHeadTrHtml.call(this);
+    } else {
+      if (this.daysPerRow > 1) {
+        if (this.datesAboveResources) {
+          return this.renderHeadDateAndResourceHtml();
+        } else {
+          return this.renderHeadResourceAndDateHtml();
+        }
+      } else {
+        return this.renderHeadResourceHtml();
+      }
+    }
+  },
+  renderHeadResourceHtml: function() {
+    var j, len, ref, resource, resourceHtmls;
+    resourceHtmls = [];
+    ref = this.flattenedResources;
+    for (j = 0, len = ref.length; j < len; j++) {
+      resource = ref[j];
+      resourceHtmls.push(this.renderHeadResourceCellHtml(resource));
+    }
+    return this.wrapTr(resourceHtmls, 'renderHeadIntroHtml');
+  },
+  renderHeadResourceAndDateHtml: function() {
+    var date, dateHtmls, dayIndex, j, k, len, ref, ref1, resource, resourceHtmls;
+    resourceHtmls = [];
+    dateHtmls = [];
+    ref = this.flattenedResources;
+    for (j = 0, len = ref.length; j < len; j++) {
+      resource = ref[j];
+      resourceHtmls.push(this.renderHeadResourceCellHtml(resource, null, this.daysPerRow));
+      for (dayIndex = k = 0, ref1 = this.daysPerRow; k < ref1; dayIndex = k += 1) {
+        date = this.dayDates[dayIndex].clone();
+        dateHtmls.push(this.renderHeadResourceDateCellHtml(date, resource));
+      }
+    }
+    return this.wrapTr(resourceHtmls, 'renderHeadIntroHtml') + this.wrapTr(dateHtmls, 'renderHeadIntroHtml');
+  },
+  renderHeadDateAndResourceHtml: function() {
+    var date, dateHtmls, dayIndex, j, k, len, ref, ref1, resource, resourceHtmls;
+    dateHtmls = [];
+    resourceHtmls = [];
+    for (dayIndex = j = 0, ref = this.daysPerRow; j < ref; dayIndex = j += 1) {
+      date = this.dayDates[dayIndex].clone();
+      dateHtmls.push(this.renderHeadDateCellHtml(date, this.resourceCnt));
+      ref1 = this.flattenedResources;
+      for (k = 0, len = ref1.length; k < len; k++) {
+        resource = ref1[k];
+        resourceHtmls.push(this.renderHeadResourceCellHtml(resource, date));
+      }
+    }
+    return this.wrapTr(dateHtmls, 'renderHeadIntroHtml') + this.wrapTr(resourceHtmls, 'renderHeadIntroHtml');
+  },
+  renderHeadResourceCellHtml: function(resource, date, colspan) {
+    return '<th class="fc-resource-cell"' + ' data-resource-id="' + resource.id + '"' + (date ? ' data-date="' + date.format('YYYY-MM-DD') + '"' : '') + (colspan > 1 ? ' colspan="' + colspan + '"' : '') + '>' + htmlEscape(this.view.getResourceText(resource)) + '</th>';
+  },
+  renderHeadResourceDateCellHtml: function(date, resource, colspan) {
+    return this.renderHeadDateCellHtml(date, colspan, 'data-resource-id="' + resource.id + '"');
+  },
+  processHeadResourceEls: function(containerEl) {
+    return containerEl.find('.fc-resource-cell').each((function(_this) {
+      return function(col, node) {
+        var resource;
+        if (_this.datesAboveResources) {
+          resource = _this.getColResource(col);
+        } else {
+          resource = _this.flattenedResources[_this.isRTL ? _this.flattenedResources.length - 1 - col : col];
+        }
+        return _this.view.publiclyTrigger('resourceRender', resource, resource, $(node), $());
+      };
+    })(this));
+  },
+  renderBgCellsHtml: function(row) {
+    var col, date, htmls, j, ref, resource;
+    if (!this.resourceCnt) {
+      return FC.DayTableMixin.renderBgCellsHtml.call(this, row);
+    } else {
+      htmls = [];
+      for (col = j = 0, ref = this.colCnt; j < ref; col = j += 1) {
+        date = this.getCellDate(row, col);
+        resource = this.getColResource(col);
+        htmls.push(this.renderResourceBgCellHtml(date, resource));
+      }
+      return htmls.join('');
+    }
+  },
+  renderResourceBgCellHtml: function(date, resource) {
+    return this.renderBgCellHtml(date, 'data-resource-id="' + resource.id + '"');
+  },
+  wrapTr: function(cellHtmls, introMethodName) {
+    if (this.isRTL) {
+      cellHtmls.reverse();
+      return '<tr>' + cellHtmls.join('') + this[introMethodName]() + '</tr>';
+    } else {
+      return '<tr>' + this[introMethodName]() + cellHtmls.join('') + '</tr>';
+    }
+  },
+
+  /*
+  	If there are no per-resource business hour definitions, returns null.
+  	Otherwise, returns a list of business hours segs for *every* resource.
+   */
+  computePerResourceBusinessHourSegs: function(wholeDay) {
+    var allSegs, anyCustomBusinessHours, businessHours, event, events, j, k, l, len, len1, len2, ref, ref1, resource, segs;
+    if (this.flattenedResources) {
+      anyCustomBusinessHours = false;
+      ref = this.flattenedResources;
+      for (j = 0, len = ref.length; j < len; j++) {
+        resource = ref[j];
+        if (resource.businessHours) {
+          anyCustomBusinessHours = true;
+        }
+      }
+      if (anyCustomBusinessHours) {
+        allSegs = [];
+        ref1 = this.flattenedResources;
+        for (k = 0, len1 = ref1.length; k < len1; k++) {
+          resource = ref1[k];
+          businessHours = resource.businessHours || this.view.calendar.opt('businessHours');
+          events = this.buildBusinessHourEvents(wholeDay, businessHours);
+          for (l = 0, len2 = events.length; l < len2; l++) {
+            event = events[l];
+            event.resourceId = resource.id;
+          }
+          segs = this.eventsToSegs(events);
+          allSegs.push.apply(allSegs, segs);
+        }
+        return allSegs;
+      }
+    }
+    return null;
+  }
+};
+
+ResourceDayGrid = (function(superClass) {
+  extend(ResourceDayGrid, superClass);
+
+  function ResourceDayGrid() {
+    return ResourceDayGrid.__super__.constructor.apply(this, arguments);
+  }
+
+  ResourceDayGrid.mixin(ResourceGridMixin);
+
+  ResourceDayGrid.mixin(ResourceDayTableMixin);
+
+  ResourceDayGrid.prototype.getHitSpan = function(hit) {
+    var span;
+    span = ResourceDayGrid.__super__.getHitSpan.apply(this, arguments);
+    if (this.resourceCnt) {
+      span.resourceId = this.getColResource(hit.col).id;
+    }
+    return span;
+  };
+
+  ResourceDayGrid.prototype.spanToSegs = function(span) {
+    var copy, genericSegs, j, k, l, len, len1, ref, resourceCnt, resourceIndex, resourceObj, resourceSegs, seg;
+    resourceCnt = this.resourceCnt;
+    genericSegs = this.datesAboveResources ? this.sliceRangeByDay(span) : this.sliceRangeByRow(span);
+    if (!resourceCnt) {
+      for (j = 0, len = genericSegs.length; j < len; j++) {
+        seg = genericSegs[j];
+        if (this.isRTL) {
+          seg.leftCol = seg.lastRowDayIndex;
+          seg.rightCol = seg.firstRowDayIndex;
+        } else {
+          seg.leftCol = seg.firstRowDayIndex;
+          seg.rightCol = seg.lastRowDayIndex;
+        }
+      }
+      return genericSegs;
+    } else {
+      resourceSegs = [];
+      for (k = 0, len1 = genericSegs.length; k < len1; k++) {
+        seg = genericSegs[k];
+        for (resourceIndex = l = 0, ref = resourceCnt; l < ref; resourceIndex = l += 1) {
+          resourceObj = this.flattenedResources[resourceIndex];
+          if (!span.resourceId || span.resourceId === resourceObj.id) {
+            copy = $.extend({}, seg);
+            copy.resource = resourceObj;
+            if (this.isRTL) {
+              copy.leftCol = this.indicesToCol(resourceIndex, seg.lastRowDayIndex);
+              copy.rightCol = this.indicesToCol(resourceIndex, seg.firstRowDayIndex);
+            } else {
+              copy.leftCol = this.indicesToCol(resourceIndex, seg.firstRowDayIndex);
+              copy.rightCol = this.indicesToCol(resourceIndex, seg.lastRowDayIndex);
+            }
+            resourceSegs.push(copy);
+          }
+        }
+      }
+      return resourceSegs;
+    }
+  };
+
+  ResourceDayGrid.prototype.renderBusinessHours = function() {
+    var segs;
+    segs = this.computePerResourceBusinessHourSegs(true);
+    if (segs) {
+      return this.renderFill('businessHours', segs, 'bgevent');
+    } else {
+      return ResourceDayGrid.__super__.renderBusinessHours.apply(this, arguments);
+    }
+  };
+
+  return ResourceDayGrid;
+
+})(FC.DayGrid);
+
+ResourceTimeGrid = (function(superClass) {
+  extend(ResourceTimeGrid, superClass);
+
+  function ResourceTimeGrid() {
+    return ResourceTimeGrid.__super__.constructor.apply(this, arguments);
+  }
+
+  ResourceTimeGrid.mixin(ResourceGridMixin);
+
+  ResourceTimeGrid.mixin(ResourceDayTableMixin);
+
+  ResourceTimeGrid.prototype.getHitSpan = function(hit) {
+    var span;
+    span = ResourceTimeGrid.__super__.getHitSpan.apply(this, arguments);
+    if (this.resourceCnt) {
+      span.resourceId = this.getColResource(hit.col).id;
+    }
+    return span;
+  };
+
+  ResourceTimeGrid.prototype.spanToSegs = function(span) {
+    var copy, genericSegs, j, k, l, len, len1, ref, resourceCnt, resourceIndex, resourceObj, resourceSegs, seg;
+    resourceCnt = this.resourceCnt;
+    genericSegs = this.sliceRangeByTimes(span);
+    if (!resourceCnt) {
+      for (j = 0, len = genericSegs.length; j < len; j++) {
+        seg = genericSegs[j];
+        seg.col = seg.dayIndex;
+      }
+      return genericSegs;
+    } else {
+      resourceSegs = [];
+      for (k = 0, len1 = genericSegs.length; k < len1; k++) {
+        seg = genericSegs[k];
+        for (resourceIndex = l = 0, ref = resourceCnt; l < ref; resourceIndex = l += 1) {
+          resourceObj = this.flattenedResources[resourceIndex];
+          if (!span.resourceId || span.resourceId === resourceObj.id) {
+            copy = $.extend({}, seg);
+            copy.resource = resourceObj;
+            copy.col = this.indicesToCol(resourceIndex, seg.dayIndex);
+            resourceSegs.push(copy);
+          }
+        }
+      }
+      return resourceSegs;
+    }
+  };
+
+  ResourceTimeGrid.prototype.renderBusinessHours = function() {
+    var segs;
+    segs = this.computePerResourceBusinessHourSegs(false);
+    if (segs) {
+      return this.renderBusinessSegs(segs);
+    } else {
+      return ResourceTimeGrid.__super__.renderBusinessHours.apply(this, arguments);
+    }
+  };
+
+  return ResourceTimeGrid;
+
+})(FC.TimeGrid);
+
+TimelineView = (function(superClass) {
+  extend(TimelineView, superClass);
+
+  function TimelineView() {
+    return TimelineView.__super__.constructor.apply(this, arguments);
+  }
+
+  TimelineView.prototype.timeGrid = null;
+
+  TimelineView.prototype.isScrolled = false;
+
+  TimelineView.prototype.usesMinMaxTime = true;
+
+  TimelineView.prototype.initialize = function() {
+    return this.timeGrid = this.instantiateGrid();
+  };
+
+  TimelineView.prototype.instantiateGrid = function() {
+    return new TimelineGrid(this);
+  };
+
+  TimelineView.prototype.setDateProfileForRendering = function(dateProfile) {
+    TimelineView.__super__.setDateProfileForRendering.apply(this, arguments);
+    this.timeGrid.initScaleProps();
+    return this.timeGrid.setRange(this.renderRange);
+  };
+
+  TimelineView.prototype.getFallbackDuration = function() {
+    return this.timeGrid.computeFallbackDuration();
+  };
+
+  TimelineView.prototype.renderSkeleton = function() {
+    this.el.addClass('fc-timeline');
+    if (this.opt('eventOverlap') === false) {
+      this.el.addClass('fc-no-overlap');
+    }
+    this.el.html(this.renderSkeletonHtml());
+    return this.renderTimeGridSkeleton();
+  };
+
+  TimelineView.prototype.renderSkeletonHtml = function() {
+    return '<table> <thead class="fc-head"> <tr> <td class="fc-time-area ' + this.widgetHeaderClass + '"></td> </tr> </thead> <tbody class="fc-body"> <tr> <td class="fc-time-area ' + this.widgetContentClass + '"></td> </tr> </tbody> </table>';
+  };
+
+  TimelineView.prototype.renderTimeGridSkeleton = function() {
+    this.timeGrid.setElement(this.el.find('tbody .fc-time-area'));
+    this.timeGrid.headEl = this.el.find('thead .fc-time-area');
+    this.timeGrid.renderSkeleton();
+    this.isScrolled = false;
+    return this.timeGrid.bodyScroller.on('scroll', proxy(this, 'handleBodyScroll'));
+  };
+
+  TimelineView.prototype.handleBodyScroll = function(top, left) {
+    if (top) {
+      if (!this.isScrolled) {
+        this.isScrolled = true;
+        return this.el.addClass('fc-scrolled');
+      }
+    } else {
+      if (this.isScrolled) {
+        this.isScrolled = false;
+        return this.el.removeClass('fc-scrolled');
+      }
+    }
+  };
+
+  TimelineView.prototype.unrenderSkeleton = function() {
+    this.timeGrid.removeElement();
+    this.handleBodyScroll(0);
+    return TimelineView.__super__.unrenderSkeleton.apply(this, arguments);
+  };
+
+  TimelineView.prototype.renderDates = function() {
+    return this.timeGrid.renderDates();
+  };
+
+  TimelineView.prototype.unrenderDates = function() {
+    return this.timeGrid.unrenderDates();
+  };
+
+  TimelineView.prototype.renderBusinessHours = function() {
+    return this.timeGrid.renderBusinessHours();
+  };
+
+  TimelineView.prototype.unrenderBusinessHours = function() {
+    return this.timeGrid.unrenderBusinessHours();
+  };
+
+  TimelineView.prototype.getNowIndicatorUnit = function() {
+    return this.timeGrid.getNowIndicatorUnit();
+  };
+
+  TimelineView.prototype.renderNowIndicator = function(date) {
+    return this.timeGrid.renderNowIndicator(date);
+  };
+
+  TimelineView.prototype.unrenderNowIndicator = function() {
+    return this.timeGrid.unrenderNowIndicator();
+  };
+
+  TimelineView.prototype.hitsNeeded = function() {
+    return this.timeGrid.hitsNeeded();
+  };
+
+  TimelineView.prototype.hitsNotNeeded = function() {
+    return this.timeGrid.hitsNotNeeded();
+  };
+
+  TimelineView.prototype.prepareHits = function() {
+    return this.timeGrid.prepareHits();
+  };
+
+  TimelineView.prototype.releaseHits = function() {
+    return this.timeGrid.releaseHits();
+  };
+
+  TimelineView.prototype.queryHit = function(leftOffset, topOffset) {
+    return this.timeGrid.queryHit(leftOffset, topOffset);
+  };
+
+  TimelineView.prototype.getHitSpan = function(hit) {
+    return this.timeGrid.getHitSpan(hit);
+  };
+
+  TimelineView.prototype.getHitEl = function(hit) {
+    return this.timeGrid.getHitEl(hit);
+  };
+
+  TimelineView.prototype.updateWidth = function() {
+    return this.timeGrid.updateWidth();
+  };
+
+  TimelineView.prototype.setHeight = function(totalHeight, isAuto) {
+    var bodyHeight;
+    if (isAuto) {
+      bodyHeight = 'auto';
+    } else {
+      bodyHeight = totalHeight - this.timeGrid.headHeight() - this.queryMiscHeight();
+    }
+    return this.timeGrid.bodyScroller.setHeight(bodyHeight);
+  };
+
+  TimelineView.prototype.queryMiscHeight = function() {
+    return this.el.outerHeight() - this.timeGrid.headScroller.el.outerHeight() - this.timeGrid.bodyScroller.el.outerHeight();
+  };
+
+  TimelineView.prototype.computeInitialDateScroll = function() {
+    var left, scrollTime;
+    left = 0;
+    if (this.timeGrid.isTimeScale) {
+      scrollTime = this.opt('scrollTime');
+      if (scrollTime) {
+        scrollTime = moment.duration(scrollTime);
+        left = this.timeGrid.dateToCoord(this.activeRange.start.clone().time(scrollTime));
+      }
+    }
+    return {
+      left: left
+    };
+  };
+
+  TimelineView.prototype.queryDateScroll = function() {
+    return {
+      left: this.timeGrid.bodyScroller.getScrollLeft()
+    };
+  };
+
+  TimelineView.prototype.applyDateScroll = function(scroll) {
+    if (scroll.left != null) {
+      this.timeGrid.headScroller.setScrollLeft(scroll.left);
+      return this.timeGrid.bodyScroller.setScrollLeft(scroll.left);
+    }
+  };
+
+  TimelineView.prototype.renderEvents = function(events) {
+    this.timeGrid.renderEvents(events);
+    return this.updateWidth();
+  };
+
+  TimelineView.prototype.unrenderEvents = function() {
+    this.timeGrid.unrenderEvents();
+    return this.updateWidth();
+  };
+
+  TimelineView.prototype.renderDrag = function(dropLocation, seg) {
+    return this.timeGrid.renderDrag(dropLocation, seg);
+  };
+
+  TimelineView.prototype.unrenderDrag = function() {
+    return this.timeGrid.unrenderDrag();
+  };
+
+  TimelineView.prototype.getEventSegs = function() {
+    return this.timeGrid.getEventSegs();
+  };
+
+  TimelineView.prototype.renderSelection = function(range) {
+    return this.timeGrid.renderSelection(range);
+  };
+
+  TimelineView.prototype.unrenderSelection = function() {
+    return this.timeGrid.unrenderSelection();
+  };
+
+  return TimelineView;
+
+})(View);
+
+cssToStr = FC.cssToStr;
+
+TimelineGrid = (function(superClass) {
+  extend(TimelineGrid, superClass);
+
+  TimelineGrid.prototype.slotDates = null;
+
+  TimelineGrid.prototype.slotCnt = null;
+
+  TimelineGrid.prototype.snapCnt = null;
+
+  TimelineGrid.prototype.snapsPerSlot = null;
+
+  TimelineGrid.prototype.snapDiffToIndex = null;
+
+  TimelineGrid.prototype.snapIndexToDiff = null;
+
+  TimelineGrid.prototype.headEl = null;
+
+  TimelineGrid.prototype.slatContainerEl = null;
+
+  TimelineGrid.prototype.slatEls = null;
+
+  TimelineGrid.prototype.containerCoordCache = null;
+
+  TimelineGrid.prototype.slatCoordCache = null;
+
+  TimelineGrid.prototype.slatInnerCoordCache = null;
+
+  TimelineGrid.prototype.headScroller = null;
+
+  TimelineGrid.prototype.bodyScroller = null;
+
+  TimelineGrid.prototype.joiner = null;
+
+  TimelineGrid.prototype.follower = null;
+
+  TimelineGrid.prototype.eventTitleFollower = null;
+
+  TimelineGrid.prototype.timeWindowMs = null;
+
+  TimelineGrid.prototype.slotDuration = null;
+
+  TimelineGrid.prototype.snapDuration = null;
+
+  TimelineGrid.prototype.duration = null;
+
+  TimelineGrid.prototype.labelInterval = null;
+
+  TimelineGrid.prototype.headerFormats = null;
+
+  TimelineGrid.prototype.isTimeScale = null;
+
+  TimelineGrid.prototype.largeUnit = null;
+
+  TimelineGrid.prototype.emphasizeWeeks = false;
+
+  TimelineGrid.prototype.titleFollower = null;
+
+  TimelineGrid.prototype.segContainerEl = null;
+
+  TimelineGrid.prototype.segContainerHeight = null;
+
+  TimelineGrid.prototype.bgSegContainerEl = null;
+
+  TimelineGrid.prototype.helperEls = null;
+
+  TimelineGrid.prototype.innerEl = null;
+
+  function TimelineGrid() {
+    TimelineGrid.__super__.constructor.apply(this, arguments);
+    this.slotWidth = this.opt('slotWidth');
+  }
+
+  TimelineGrid.prototype.opt = function(name) {
+    return this.view.opt(name);
+  };
+
+  TimelineGrid.prototype.isValidDate = function(date) {
+    var ms;
+    if (this.view.isHiddenDay(date)) {
+      return false;
+    } else if (this.isTimeScale) {
+      ms = date.time() - this.view.minTime;
+      ms = ((ms % 86400000) + 86400000) % 86400000;
+      return ms < this.timeWindowMs;
+    } else {
+      return true;
+    }
+  };
+
+  TimelineGrid.prototype.computeDisplayEventTime = function() {
+    return !this.isTimeScale;
+  };
+
+  TimelineGrid.prototype.computeDisplayEventEnd = function() {
+    return false;
+  };
+
+  TimelineGrid.prototype.computeEventTimeFormat = function() {
+    return this.opt('extraSmallTimeFormat');
+  };
+
+
+  /*
+  	Makes the given date consistent with isTimeScale/largeUnit,
+  	so, either removes the times, ensures a time, or makes it the startOf largeUnit.
+  	Strips all timezones. Returns new copy.
+  	TODO: should maybe be called "normalizeRangeDate".
+   */
+
+  TimelineGrid.prototype.normalizeGridDate = function(date) {
+    var normalDate;
+    if (this.isTimeScale) {
+      normalDate = date.clone();
+      if (!normalDate.hasTime()) {
+        normalDate.time(0);
+      }
+    } else {
+      normalDate = date.clone().stripTime();
+      if (this.largeUnit) {
+        normalDate.startOf(this.largeUnit);
+      }
+    }
+    return normalDate;
+  };
+
+  TimelineGrid.prototype.normalizeGridRange = function(range) {
+    var adjustedEnd, normalRange;
+    if (this.isTimeScale) {
+      normalRange = {
+        start: this.normalizeGridDate(range.start),
+        end: this.normalizeGridDate(range.end)
+      };
+    } else {
+      normalRange = this.view.computeDayRange(range);
+      if (this.largeUnit) {
+        normalRange.start.startOf(this.largeUnit);
+        adjustedEnd = normalRange.end.clone().startOf(this.largeUnit);
+        if (!adjustedEnd.isSame(normalRange.end) || !adjustedEnd.isAfter(normalRange.start)) {
+          adjustedEnd.add(this.slotDuration);
+        }
+        normalRange.end = adjustedEnd;
+      }
+    }
+    return normalRange;
+  };
+
+  TimelineGrid.prototype.rangeUpdated = function() {
+    var date, slotDates;
+    this.start = this.normalizeGridDate(this.start);
+    this.end = this.normalizeGridDate(this.end);
+    this.timeWindowMs = this.view.maxTime - this.view.minTime;
+    if (this.isTimeScale) {
+      this.start.add(this.view.minTime);
+      this.end.subtract(1, 'day').add(this.view.maxTime);
+    }
+    slotDates = [];
+    date = this.start.clone();
+    while (date < this.end) {
+      if (this.isValidDate(date)) {
+        slotDates.push(date.clone());
+      }
+      date.add(this.slotDuration);
+    }
+    this.slotDates = slotDates;
+    return this.updateGridDates();
+  };
+
+  TimelineGrid.prototype.updateGridDates = function() {
+    var date, snapDiff, snapDiffToIndex, snapIndex, snapIndexToDiff;
+    snapIndex = -1;
+    snapDiff = 0;
+    snapDiffToIndex = [];
+    snapIndexToDiff = [];
+    date = this.start.clone();
+    while (date < this.end) {
+      if (this.isValidDate(date)) {
+        snapIndex++;
+        snapDiffToIndex.push(snapIndex);
+        snapIndexToDiff.push(snapDiff);
+      } else {
+        snapDiffToIndex.push(snapIndex + 0.5);
+      }
+      date.add(this.snapDuration);
+      snapDiff++;
+    }
+    this.snapDiffToIndex = snapDiffToIndex;
+    this.snapIndexToDiff = snapIndexToDiff;
+    this.snapCnt = snapIndex + 1;
+    return this.slotCnt = this.snapCnt / this.snapsPerSlot;
+  };
+
+  TimelineGrid.prototype.spanToSegs = function(span) {
+    var normalRange, seg;
+    normalRange = this.normalizeGridRange(span);
+    if (this.computeDateSnapCoverage(span.start) < this.computeDateSnapCoverage(span.end)) {
+      seg = intersectRanges(normalRange, this);
+      if (seg) {
+        if (seg.isStart && !this.isValidDate(seg.start)) {
+          seg.isStart = false;
+        }
+        if (seg.isEnd && seg.end && !this.isValidDate(seg.end.clone().subtract(1))) {
+          seg.isEnd = false;
+        }
+        return [seg];
+      }
+    }
+    return [];
+  };
+
+  TimelineGrid.prototype.prepareHits = function() {
+    return this.buildCoords();
+  };
+
+  TimelineGrid.prototype.queryHit = function(leftOffset, topOffset) {
+    var containerCoordCache, localSnapIndex, partial, slatCoordCache, slatIndex, slatLeft, slatRight, slatWidth, snapIndex, snapLeft, snapRight, snapsPerSlot;
+    snapsPerSlot = this.snapsPerSlot;
+    slatCoordCache = this.slatCoordCache;
+    containerCoordCache = this.containerCoordCache;
+    if (containerCoordCache.isPointInBounds(leftOffset, topOffset)) {
+      slatIndex = slatCoordCache.getHorizontalIndex(leftOffset);
+      if (slatIndex != null) {
+        slatWidth = slatCoordCache.getWidth(slatIndex);
+        if (this.isRTL) {
+          slatRight = slatCoordCache.getRightOffset(slatIndex);
+          partial = (slatRight - leftOffset) / slatWidth;
+          localSnapIndex = Math.floor(partial * snapsPerSlot);
+          snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
+          snapRight = slatRight - (localSnapIndex / snapsPerSlot) * slatWidth;
+          snapLeft = snapRight - ((localSnapIndex + 1) / snapsPerSlot) * slatWidth;
+        } else {
+          slatLeft = slatCoordCache.getLeftOffset(slatIndex);
+          partial = (leftOffset - slatLeft) / slatWidth;
+          localSnapIndex = Math.floor(partial * snapsPerSlot);
+          snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
+          snapLeft = slatLeft + (localSnapIndex / snapsPerSlot) * slatWidth;
+          snapRight = slatLeft + ((localSnapIndex + 1) / snapsPerSlot) * slatWidth;
+        }
+        return {
+          snap: snapIndex,
+          component: this,
+          left: snapLeft,
+          right: snapRight,
+          top: containerCoordCache.getTopOffset(0),
+          bottom: containerCoordCache.getBottomOffset(0)
+        };
+      }
+    }
+  };
+
+  TimelineGrid.prototype.getHitSpan = function(hit) {
+    return this.getSnapRange(hit.snap);
+  };
+
+  TimelineGrid.prototype.getHitEl = function(hit) {
+    return this.getSnapEl(hit.snap);
+  };
+
+  TimelineGrid.prototype.getSnapRange = function(snapIndex) {
+    var end, start;
+    start = this.start.clone();
+    start.add(multiplyDuration(this.snapDuration, this.snapIndexToDiff[snapIndex]));
+    end = start.clone().add(this.snapDuration);
+    return {
+      start: start,
+      end: end
+    };
+  };
+
+  TimelineGrid.prototype.getSnapEl = function(snapIndex) {
+    return this.slatEls.eq(Math.floor(snapIndex / this.snapsPerSlot));
+  };
+
+  TimelineGrid.prototype.renderSkeleton = function() {
+    this.headScroller = new ClippedScroller({
+      overflowX: 'clipped-scroll',
+      overflowY: 'hidden'
+    });
+    this.headScroller.canvas = new ScrollerCanvas();
+    this.headScroller.render();
+    this.headEl.append(this.headScroller.el);
+    this.bodyScroller = new ClippedScroller();
+    this.bodyScroller.canvas = new ScrollerCanvas();
+    this.bodyScroller.render();
+    this.el.append(this.bodyScroller.el);
+    this.innerEl = this.bodyScroller.canvas.contentEl;
+    this.slatContainerEl = $('<div class="fc-slats"/>').appendTo(this.bodyScroller.canvas.bgEl);
+    this.segContainerEl = $('<div class="fc-event-container"/>').appendTo(this.bodyScroller.canvas.contentEl);
+    this.bgSegContainerEl = this.bodyScroller.canvas.bgEl;
+    this.containerCoordCache = new CoordCache({
+      els: this.bodyScroller.canvas.el,
+      isHorizontal: true,
+      isVertical: true
+    });
+    this.joiner = new ScrollJoiner('horizontal', [this.headScroller, this.bodyScroller]);
+    if (true) {
+      this.follower = new ScrollFollower(this.headScroller, true);
+    }
+    if (true) {
+      this.eventTitleFollower = new ScrollFollower(this.bodyScroller);
+      this.eventTitleFollower.minTravel = 50;
+      if (this.isRTL) {
+        this.eventTitleFollower.containOnNaturalRight = true;
+      } else {
+        this.eventTitleFollower.containOnNaturalLeft = true;
+      }
+    }
+    return TimelineGrid.__super__.renderSkeleton.apply(this, arguments);
+  };
+
+  TimelineGrid.prototype.headColEls = null;
+
+  TimelineGrid.prototype.slatColEls = null;
+
+  TimelineGrid.prototype.renderDates = function() {
+    var date, i, j, len, ref;
+    this.headScroller.canvas.contentEl.html(this.renderHeadHtml());
+    this.headColEls = this.headScroller.canvas.contentEl.find('col');
+    this.slatContainerEl.html(this.renderSlatHtml());
+    this.slatColEls = this.slatContainerEl.find('col');
+    this.slatEls = this.slatContainerEl.find('td');
+    this.slatCoordCache = new CoordCache({
+      els: this.slatEls,
+      isHorizontal: true
+    });
+    this.slatInnerCoordCache = new CoordCache({
+      els: this.slatEls.find('> div'),
+      isHorizontal: true,
+      offsetParent: this.bodyScroller.canvas.el
+    });
+    ref = this.slotDates;
+    for (i = j = 0, len = ref.length; j < len; i = ++j) {
+      date = ref[i];
+      this.view.publiclyTrigger('dayRender', null, date, this.slatEls.eq(i));
+    }
+    if (this.follower) {
+      return this.follower.setSprites(this.headEl.find('tr:not(:last-child) .fc-cell-text'));
+    }
+  };
+
+  TimelineGrid.prototype.unrenderDates = function() {
+    if (this.follower) {
+      this.follower.clearSprites();
+    }
+    this.headScroller.canvas.contentEl.empty();
+    this.slatContainerEl.empty();
+    this.headScroller.canvas.clearWidth();
+    return this.bodyScroller.canvas.clearWidth();
+  };
+
+  TimelineGrid.prototype.renderHeadHtml = function() {
+    var cell, cellRows, date, format, formats, headerCellClassNames, html, i, isChrono, isLast, isSingleDay, isSuperRow, isWeekStart, j, k, l, labelInterval, leadingCell, len, len1, len2, len3, len4, len5, len6, m, n, newCell, p, prevWeekNumber, q, row, rowCells, rowUnits, slatHtml, slotCells, slotDates, text, weekNumber;
+    labelInterval = this.labelInterval;
+    formats = this.headerFormats;
+    cellRows = (function() {
+      var j, len, results;
+      results = [];
+      for (j = 0, len = formats.length; j < len; j++) {
+        format = formats[j];
+        results.push([]);
+      }
+      return results;
+    })();
+    leadingCell = null;
+    prevWeekNumber = null;
+    slotDates = this.slotDates;
+    slotCells = [];
+    rowUnits = (function() {
+      var j, len, results;
+      results = [];
+      for (j = 0, len = formats.length; j < len; j++) {
+        format = formats[j];
+        results.push(FC.queryMostGranularFormatUnit(format));
+      }
+      return results;
+    })();
+    for (j = 0, len = slotDates.length; j < len; j++) {
+      date = slotDates[j];
+      weekNumber = date.week();
+      isWeekStart = this.emphasizeWeeks && prevWeekNumber !== null && prevWeekNumber !== weekNumber;
+      for (row = k = 0, len1 = formats.length; k < len1; row = ++k) {
+        format = formats[row];
+        rowCells = cellRows[row];
+        leadingCell = rowCells[rowCells.length - 1];
+        isSuperRow = formats.length > 1 && row < formats.length - 1;
+        newCell = null;
+        if (isSuperRow) {
+          text = date.format(format);
+          if (!leadingCell || leadingCell.text !== text) {
+            newCell = this.buildCellObject(date, text, rowUnits[row]);
+          } else {
+            leadingCell.colspan += 1;
+          }
+        } else {
+          if (!leadingCell || isInt(divideRangeByDuration(this.start, date, labelInterval))) {
+            text = date.format(format);
+            newCell = this.buildCellObject(date, text, rowUnits[row]);
+          } else {
+            leadingCell.colspan += 1;
+          }
+        }
+        if (newCell) {
+          newCell.weekStart = isWeekStart;
+          rowCells.push(newCell);
+        }
+      }
+      slotCells.push({
+        weekStart: isWeekStart
+      });
+      prevWeekNumber = weekNumber;
+    }
+    isChrono = labelInterval > this.slotDuration;
+    isSingleDay = this.slotDuration.as('days') === 1;
+    html = '<table>';
+    html += '<colgroup>';
+    for (l = 0, len2 = slotDates.length; l < len2; l++) {
+      date = slotDates[l];
+      html += '<col/>';
+    }
+    html += '</colgroup>';
+    html += '<tbody>';
+    for (i = m = 0, len3 = cellRows.length; m < len3; i = ++m) {
+      rowCells = cellRows[i];
+      isLast = i === cellRows.length - 1;
+      html += '<tr' + (isChrono && isLast ? ' class="fc-chrono"' : '') + '>';
+      for (n = 0, len4 = rowCells.length; n < len4; n++) {
+        cell = rowCells[n];
+        headerCellClassNames = [this.view.widgetHeaderClass];
+        if (cell.weekStart) {
+          headerCellClassNames.push('fc-em-cell');
+        }
+        if (isSingleDay) {
+          headerCellClassNames = headerCellClassNames.concat(this.getDayClasses(cell.date, true));
+        }
+        html += '<th class="' + headerCellClassNames.join(' ') + '"' + ' data-date="' + cell.date.format() + '"' + (cell.colspan > 1 ? ' colspan="' + cell.colspan + '"' : '') + '>' + '<div class="fc-cell-content">' + cell.spanHtml + '</div>' + '</th>';
+      }
+      html += '</tr>';
+    }
+    html += '</tbody></table>';
+    slatHtml = '<table>';
+    slatHtml += '<colgroup>';
+    for (p = 0, len5 = slotCells.length; p < len5; p++) {
+      cell = slotCells[p];
+      slatHtml += '<col/>';
+    }
+    slatHtml += '</colgroup>';
+    slatHtml += '<tbody><tr>';
+    for (i = q = 0, len6 = slotCells.length; q < len6; i = ++q) {
+      cell = slotCells[i];
+      date = slotDates[i];
+      slatHtml += this.slatCellHtml(date, cell.weekStart);
+    }
+    slatHtml += '</tr></tbody></table>';
+    this._slatHtml = slatHtml;
+    return html;
+  };
+
+  TimelineGrid.prototype.buildCellObject = function(date, text, rowUnit) {
+    var spanHtml;
+    date = date.clone();
+    spanHtml = this.view.buildGotoAnchorHtml({
+      date: date,
+      type: rowUnit,
+      forceOff: !rowUnit
+    }, {
+      'class': 'fc-cell-text'
+    }, htmlEscape(text));
+    return {
+      text: text,
+      spanHtml: spanHtml,
+      date: date,
+      colspan: 1
+    };
+  };
+
+  TimelineGrid.prototype.renderSlatHtml = function() {
+    return this._slatHtml;
+  };
+
+  TimelineGrid.prototype.slatCellHtml = function(date, isEm) {
+    var classes;
+    if (this.isTimeScale) {
+      classes = [];
+      classes.push(isInt(divideRangeByDuration(this.start, date, this.labelInterval)) ? 'fc-major' : 'fc-minor');
+    } else {
+      classes = this.getDayClasses(date);
+      classes.push('fc-day');
+    }
+    classes.unshift(this.view.widgetContentClass);
+    if (isEm) {
+      classes.push('fc-em-cell');
+    }
+    return '<td class="' + classes.join(' ') + '"' + ' data-date="' + date.format() + '"' + '><div /></td>';
+  };
+
+  TimelineGrid.prototype.businessHourSegs = null;
+
+  TimelineGrid.prototype.renderBusinessHours = function() {
+    var segs;
+    if (!this.largeUnit) {
+      segs = this.businessHourSegs = this.buildBusinessHourSegs(!this.isTimeScale);
+      return this.renderFill('businessHours', segs, 'bgevent');
+    }
+  };
+
+  TimelineGrid.prototype.unrenderBusinessHours = function() {
+    return this.unrenderFill('businessHours');
+  };
+
+  TimelineGrid.prototype.nowIndicatorEls = null;
+
+  TimelineGrid.prototype.getNowIndicatorUnit = function() {
+    if (this.isTimeScale) {
+      return computeGreatestUnit(this.slotDuration);
+    }
+  };
+
+  TimelineGrid.prototype.renderNowIndicator = function(date) {
+    var coord, css, nodes;
+    nodes = [];
+    date = this.normalizeGridDate(date);
+    if (date >= this.start && date < this.end) {
+      coord = this.dateToCoord(date);
+      css = this.isRTL ? {
+        right: -coord
+      } : {
+        left: coord
+      };
+      nodes.push($("<div class='fc-now-indicator fc-now-indicator-arrow'></div>").css(css).appendTo(this.headScroller.canvas.el)[0]);
+      nodes.push($("<div class='fc-now-indicator fc-now-indicator-line'></div>").css(css).appendTo(this.bodyScroller.canvas.el)[0]);
+    }
+    return this.nowIndicatorEls = $(nodes);
+  };
+
+  TimelineGrid.prototype.unrenderNowIndicator = function() {
+    if (this.nowIndicatorEls) {
+      this.nowIndicatorEls.remove();
+      return this.nowIndicatorEls = null;
+    }
+  };
+
+  TimelineGrid.prototype.explicitSlotWidth = null;
+
+  TimelineGrid.prototype.defaultSlotWidth = null;
+
+  TimelineGrid.prototype.updateWidth = function() {
+    var availableWidth, containerMinWidth, containerWidth, isDatesRendered, nonLastSlotWidth, slotWidth;
+    isDatesRendered = this.headColEls;
+    if (isDatesRendered) {
+      slotWidth = Math.round(this.slotWidth || (this.slotWidth = this.computeSlotWidth()));
+      containerWidth = slotWidth * this.slotDates.length;
+      containerMinWidth = '';
+      nonLastSlotWidth = slotWidth;
+      availableWidth = this.bodyScroller.getClientWidth();
+      if (availableWidth > containerWidth) {
+        containerMinWidth = availableWidth;
+        containerWidth = '';
+        nonLastSlotWidth = Math.floor(availableWidth / this.slotDates.length);
+      }
+    } else {
+      containerWidth = '';
+      containerMinWidth = '';
+    }
+    this.headScroller.canvas.setWidth(containerWidth);
+    this.headScroller.canvas.setMinWidth(containerMinWidth);
+    this.bodyScroller.canvas.setWidth(containerWidth);
+    this.bodyScroller.canvas.setMinWidth(containerMinWidth);
+    if (isDatesRendered) {
+      this.headColEls.slice(0, -1).add(this.slatColEls.slice(0, -1)).width(nonLastSlotWidth);
+    }
+    this.headScroller.updateSize();
+    this.bodyScroller.updateSize();
+    this.joiner.update();
+    if (isDatesRendered) {
+      this.buildCoords();
+      this.updateSegPositions();
+      this.view.updateNowIndicator();
+    }
+    if (this.follower) {
+      this.follower.update();
+    }
+    if (this.eventTitleFollower) {
+      return this.eventTitleFollower.update();
+    }
+  };
+
+  TimelineGrid.prototype.computeSlotWidth = function() {
+    var headerWidth, innerEls, maxInnerWidth, minWidth, slotWidth, slotsPerLabel;
+    maxInnerWidth = 0;
+    innerEls = this.headEl.find('tr:last-child th .fc-cell-text');
+    innerEls.each(function(i, node) {
+      var innerWidth;
+      innerWidth = $(node).outerWidth();
+      return maxInnerWidth = Math.max(maxInnerWidth, innerWidth);
+    });
+    headerWidth = maxInnerWidth + 1;
+    slotsPerLabel = divideDurationByDuration(this.labelInterval, this.slotDuration);
+    slotWidth = Math.ceil(headerWidth / slotsPerLabel);
+    minWidth = this.headColEls.eq(0).css('min-width');
+    if (minWidth) {
+      minWidth = parseInt(minWidth, 10);
+      if (minWidth) {
+        slotWidth = Math.max(slotWidth, minWidth);
+      }
+    }
+    return slotWidth;
+  };
+
+  TimelineGrid.prototype.buildCoords = function() {
+    this.containerCoordCache.build();
+    this.slatCoordCache.build();
+    return this.slatInnerCoordCache.build();
+  };
+
+  TimelineGrid.prototype.computeDateSnapCoverage = function(date) {
+    var snapCoverage, snapDiff, snapDiffInt;
+    snapDiff = divideRangeByDuration(this.start, date, this.snapDuration);
+    if (snapDiff < 0) {
+      return 0;
+    } else if (snapDiff >= this.snapDiffToIndex.length) {
+      return this.snapCnt;
+    } else {
+      snapDiffInt = Math.floor(snapDiff);
+      snapCoverage = this.snapDiffToIndex[snapDiffInt];
+      if (isInt(snapCoverage)) {
+        snapCoverage += snapDiff - snapDiffInt;
+      } else {
+        snapCoverage = Math.ceil(snapCoverage);
+      }
+      return snapCoverage;
+    }
+  };
+
+  TimelineGrid.prototype.dateToCoord = function(date) {
+    var coordCache, partial, slotCoverage, slotIndex, snapCoverage;
+    snapCoverage = this.computeDateSnapCoverage(date);
+    slotCoverage = snapCoverage / this.snapsPerSlot;
+    slotIndex = Math.floor(slotCoverage);
+    slotIndex = Math.min(slotIndex, this.slotCnt - 1);
+    partial = slotCoverage - slotIndex;
+    coordCache = this.slatInnerCoordCache;
+    if (this.isRTL) {
+      return (coordCache.getRightPosition(slotIndex) - coordCache.getWidth(slotIndex) * partial) - this.containerCoordCache.getWidth(0);
+    } else {
+      return coordCache.getLeftPosition(slotIndex) + coordCache.getWidth(slotIndex) * partial;
+    }
+  };
+
+  TimelineGrid.prototype.rangeToCoords = function(range) {
+    if (this.isRTL) {
+      return {
+        right: this.dateToCoord(range.start),
+        left: this.dateToCoord(range.end)
+      };
+    } else {
+      return {
+        left: this.dateToCoord(range.start),
+        right: this.dateToCoord(range.end)
+      };
+    }
+  };
+
+  TimelineGrid.prototype.headHeight = function() {
+    var table;
+    table = this.headScroller.canvas.contentEl.find('table');
+    return table.height.apply(table, arguments);
+  };
+
+  TimelineGrid.prototype.updateSegPositions = function() {
+    var coords, j, len, seg, segs;
+    segs = (this.segs || []).concat(this.businessHourSegs || []);
+    for (j = 0, len = segs.length; j < len; j++) {
+      seg = segs[j];
+      coords = this.rangeToCoords(seg);
+      seg.el.css({
+        left: (seg.left = coords.left),
+        right: -(seg.right = coords.right)
+      });
+    }
+  };
+
+  TimelineGrid.prototype.renderFgSegs = function(segs) {
+    segs = this.renderFgSegEls(segs);
+    this.renderFgSegsInContainers([[this, segs]]);
+    this.updateSegFollowers(segs);
+    return segs;
+  };
+
+  TimelineGrid.prototype.unrenderFgSegs = function() {
+    this.clearSegFollowers();
+    return this.unrenderFgContainers([this]);
+  };
+
+  TimelineGrid.prototype.renderFgSegsInContainers = function(pairs) {
+    var container, coords, j, k, l, len, len1, len2, len3, len4, len5, len6, len7, m, n, p, q, r, ref, ref1, ref2, ref3, results, seg, segs;
+    for (j = 0, len = pairs.length; j < len; j++) {
+      ref = pairs[j], container = ref[0], segs = ref[1];
+      for (k = 0, len1 = segs.length; k < len1; k++) {
+        seg = segs[k];
+        coords = this.rangeToCoords(seg);
+        seg.el.css({
+          left: (seg.left = coords.left),
+          right: -(seg.right = coords.right)
+        });
+      }
+    }
+    for (l = 0, len2 = pairs.length; l < len2; l++) {
+      ref1 = pairs[l], container = ref1[0], segs = ref1[1];
+      for (m = 0, len3 = segs.length; m < len3; m++) {
+        seg = segs[m];
+        seg.el.appendTo(container.segContainerEl);
+      }
+    }
+    for (n = 0, len4 = pairs.length; n < len4; n++) {
+      ref2 = pairs[n], container = ref2[0], segs = ref2[1];
+      for (p = 0, len5 = segs.length; p < len5; p++) {
+        seg = segs[p];
+        seg.height = seg.el.outerHeight(true);
+      }
+      this.buildSegLevels(segs);
+      container.segContainerHeight = computeOffsetForSegs(segs);
+    }
+    results = [];
+    for (q = 0, len6 = pairs.length; q < len6; q++) {
+      ref3 = pairs[q], container = ref3[0], segs = ref3[1];
+      for (r = 0, len7 = segs.length; r < len7; r++) {
+        seg = segs[r];
+        seg.el.css('top', seg.top);
+      }
+      results.push(container.segContainerEl.height(container.segContainerHeight));
+    }
+    return results;
+  };
+
+  TimelineGrid.prototype.buildSegLevels = function(segs) {
+    var belowSeg, isLevelCollision, j, k, l, len, len1, len2, level, placedSeg, ref, ref1, segLevels, unplacedSeg;
+    segLevels = [];
+    this.sortEventSegs(segs);
+    for (j = 0, len = segs.length; j < len; j++) {
+      unplacedSeg = segs[j];
+      unplacedSeg.above = [];
+      level = 0;
+      while (level < segLevels.length) {
+        isLevelCollision = false;
+        ref = segLevels[level];
+        for (k = 0, len1 = ref.length; k < len1; k++) {
+          placedSeg = ref[k];
+          if (timeRowSegsCollide(unplacedSeg, placedSeg)) {
+            unplacedSeg.above.push(placedSeg);
+            isLevelCollision = true;
+          }
+        }
+        if (isLevelCollision) {
+          level += 1;
+        } else {
+          break;
+        }
+      }
+      (segLevels[level] || (segLevels[level] = [])).push(unplacedSeg);
+      level += 1;
+      while (level < segLevels.length) {
+        ref1 = segLevels[level];
+        for (l = 0, len2 = ref1.length; l < len2; l++) {
+          belowSeg = ref1[l];
+          if (timeRowSegsCollide(unplacedSeg, belowSeg)) {
+            belowSeg.above.push(unplacedSeg);
+          }
+        }
+        level += 1;
+      }
+    }
+    return segLevels;
+  };
+
+  TimelineGrid.prototype.unrenderFgContainers = function(containers) {
+    var container, j, len, results;
+    results = [];
+    for (j = 0, len = containers.length; j < len; j++) {
+      container = containers[j];
+      container.segContainerEl.empty();
+      container.segContainerEl.height('');
+      results.push(container.segContainerHeight = null);
+    }
+    return results;
+  };
+
+  TimelineGrid.prototype.fgSegHtml = function(seg, disableResizing) {
+    var classes, event, isDraggable, isResizableFromEnd, isResizableFromStart, timeText;
+    event = seg.event;
+    isDraggable = this.view.isEventDraggable(event);
+    isResizableFromStart = seg.isStart && this.view.isEventResizableFromStart(event);
+    isResizableFromEnd = seg.isEnd && this.view.isEventResizableFromEnd(event);
+    classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
+    classes.unshift('fc-timeline-event', 'fc-h-event');
+    timeText = this.getEventTimeText(event);
+    return '<a class="' + classes.join(' ') + '" style="' + cssToStr(this.getSegSkinCss(seg)) + '"' + (event.url ? ' href="' + htmlEscape(event.url) + '"' : '') + '>' + '<div class="fc-content">' + (timeText ? '<span class="fc-time">' + htmlEscape(timeText) + '</span>' : '') + '<span class="fc-title">' + (event.title ? htmlEscape(event.title) : '&nbsp;') + '</span>' + '</div>' + '<div class="fc-bg" />' + (isResizableFromStart ? '<div class="fc-resizer fc-start-resizer"></div>' : '') + (isResizableFromEnd ? '<div class="fc-resizer fc-end-resizer"></div>' : '') + '</a>';
+  };
+
+  TimelineGrid.prototype.updateSegFollowers = function(segs) {
+    var j, len, seg, sprites, titleEl;
+    if (this.eventTitleFollower) {
+      sprites = [];
+      for (j = 0, len = segs.length; j < len; j++) {
+        seg = segs[j];
+        titleEl = seg.el.find('.fc-title');
+        if (titleEl.length) {
+          sprites.push(new ScrollFollowerSprite(titleEl));
+        }
+      }
+      return this.eventTitleFollower.setSprites(sprites);
+    }
+  };
+
+  TimelineGrid.prototype.clearSegFollowers = function() {
+    if (this.eventTitleFollower) {
+      return this.eventTitleFollower.clearSprites();
+    }
+  };
+
+  TimelineGrid.prototype.segDragStart = function() {
+    TimelineGrid.__super__.segDragStart.apply(this, arguments);
+    if (this.eventTitleFollower) {
+      return this.eventTitleFollower.forceRelative();
+    }
+  };
+
+  TimelineGrid.prototype.segDragEnd = function() {
+    TimelineGrid.__super__.segDragEnd.apply(this, arguments);
+    if (this.eventTitleFollower) {
+      return this.eventTitleFollower.clearForce();
+    }
+  };
+
+  TimelineGrid.prototype.segResizeStart = function() {
+    TimelineGrid.__super__.segResizeStart.apply(this, arguments);
+    if (this.eventTitleFollower) {
+      return this.eventTitleFollower.forceRelative();
+    }
+  };
+
+  TimelineGrid.prototype.segResizeEnd = function() {
+    TimelineGrid.__super__.segResizeEnd.apply(this, arguments);
+    if (this.eventTitleFollower) {
+      return this.eventTitleFollower.clearForce();
+    }
+  };
+
+  TimelineGrid.prototype.renderHelper = function(event, sourceSeg) {
+    var segs;
+    segs = this.eventToSegs(event);
+    segs = this.renderFgSegEls(segs);
+    return this.renderHelperSegsInContainers([[this, segs]], sourceSeg);
+  };
+
+  TimelineGrid.prototype.renderHelperSegsInContainers = function(pairs, sourceSeg) {
+    var containerObj, coords, helperContainerEl, helperNodes, j, k, l, len, len1, len2, len3, m, ref, ref1, ref2, seg, segNodes, segs;
+    helperNodes = [];
+    segNodes = [];
+    for (j = 0, len = pairs.length; j < len; j++) {
+      ref = pairs[j], containerObj = ref[0], segs = ref[1];
+      for (k = 0, len1 = segs.length; k < len1; k++) {
+        seg = segs[k];
+        coords = this.rangeToCoords(seg);
+        seg.el.css({
+          left: (seg.left = coords.left),
+          right: -(seg.right = coords.right)
+        });
+        if (sourceSeg && sourceSeg.resourceId === ((ref1 = containerObj.resource) != null ? ref1.id : void 0)) {
+          seg.el.css('top', sourceSeg.el.css('top'));
+        } else {
+          seg.el.css('top', 0);
+        }
+      }
+    }
+    for (l = 0, len2 = pairs.length; l < len2; l++) {
+      ref2 = pairs[l], containerObj = ref2[0], segs = ref2[1];
+      helperContainerEl = $('<div class="fc-event-container fc-helper-container"/>').appendTo(containerObj.innerEl);
+      helperNodes.push(helperContainerEl[0]);
+      for (m = 0, len3 = segs.length; m < len3; m++) {
+        seg = segs[m];
+        helperContainerEl.append(seg.el);
+        segNodes.push(seg.el[0]);
+      }
+    }
+    if (this.helperEls) {
+      this.helperEls = this.helperEls.add($(helperNodes));
+    } else {
+      this.helperEls = $(helperNodes);
+    }
+    return $(segNodes);
+  };
+
+  TimelineGrid.prototype.unrenderHelper = function() {
+    if (this.helperEls) {
+      this.helperEls.remove();
+      return this.helperEls = null;
+    }
+  };
+
+  TimelineGrid.prototype.renderEventResize = function(resizeLocation, seg) {
+    var eventSpan, eventSpans, j, len;
+    eventSpans = this.eventToSpans(resizeLocation);
+    for (j = 0, len = eventSpans.length; j < len; j++) {
+      eventSpan = eventSpans[j];
+      this.renderHighlight(eventSpan);
+    }
+    return this.renderEventLocationHelper(resizeLocation, seg);
+  };
+
+  TimelineGrid.prototype.unrenderEventResize = function() {
+    this.unrenderHighlight();
+    return this.unrenderHelper();
+  };
+
+  TimelineGrid.prototype.renderFill = function(type, segs, className) {
+    segs = this.renderFillSegEls(type, segs);
+    this.renderFillInContainers(type, [[this, segs]], className);
+    return segs;
+  };
+
+  TimelineGrid.prototype.renderFillInContainers = function(type, pairs, className) {
+    var containerObj, j, len, ref, results, segs;
+    results = [];
+    for (j = 0, len = pairs.length; j < len; j++) {
+      ref = pairs[j], containerObj = ref[0], segs = ref[1];
+      results.push(this.renderFillInContainer(type, containerObj, segs, className));
+    }
+    return results;
+  };
+
+  TimelineGrid.prototype.renderFillInContainer = function(type, containerObj, segs, className) {
+    var containerEl, coords, j, len, seg;
+    if (segs.length) {
+      className || (className = type.toLowerCase());
+      containerEl = $('<div class="fc-' + className + '-container" />').appendTo(containerObj.bgSegContainerEl);
+      for (j = 0, len = segs.length; j < len; j++) {
+        seg = segs[j];
+        coords = this.rangeToCoords(seg);
+        seg.el.css({
+          left: (seg.left = coords.left),
+          right: -(seg.right = coords.right)
+        });
+        seg.el.appendTo(containerEl);
+      }
+      if (this.elsByFill[type]) {
+        return this.elsByFill[type] = this.elsByFill[type].add(containerEl);
+      } else {
+        return this.elsByFill[type] = containerEl;
+      }
+    }
+  };
+
+  TimelineGrid.prototype.renderDrag = function(dropLocation, seg) {
+    var eventSpan, eventSpans, j, len;
+    if (seg) {
+      return this.renderEventLocationHelper(dropLocation, seg);
+    } else {
+      eventSpans = this.eventToSpans(dropLocation);
+      for (j = 0, len = eventSpans.length; j < len; j++) {
+        eventSpan = eventSpans[j];
+        this.renderHighlight(eventSpan);
+      }
+      return null;
+    }
+  };
+
+  TimelineGrid.prototype.unrenderDrag = function() {
+    this.unrenderHelper();
+    return this.unrenderHighlight();
+  };
+
+  return TimelineGrid;
+
+})(Grid);
+
+computeOffsetForSegs = function(segs) {
+  var j, len, max, seg;
+  max = 0;
+  for (j = 0, len = segs.length; j < len; j++) {
+    seg = segs[j];
+    max = Math.max(max, computeOffsetForSeg(seg));
+  }
+  return max;
+};
+
+computeOffsetForSeg = function(seg) {
+  if (seg.top == null) {
+    seg.top = computeOffsetForSegs(seg.above);
+  }
+  return seg.top + seg.height;
+};
+
+timeRowSegsCollide = function(seg0, seg1) {
+  return seg0.left < seg1.right && seg0.right > seg1.left;
+};
+
+MIN_AUTO_LABELS = 18;
+
+MAX_AUTO_SLOTS_PER_LABEL = 6;
+
+MAX_AUTO_CELLS = 200;
+
+MAX_CELLS = 1000;
+
+DEFAULT_GRID_DURATION = {
+  months: 1
+};
+
+STOCK_SUB_DURATIONS = [
+  {
+    years: 1
+  }, {
+    months: 1
+  }, {
+    days: 1
+  }, {
+    hours: 1
+  }, {
+    minutes: 30
+  }, {
+    minutes: 15
+  }, {
+    minutes: 10
+  }, {
+    minutes: 5
+  }, {
+    minutes: 1
+  }, {
+    seconds: 30
+  }, {
+    seconds: 15
+  }, {
+    seconds: 10
+  }, {
+    seconds: 5
+  }, {
+    seconds: 1
+  }, {
+    milliseconds: 500
+  }, {
+    milliseconds: 100
+  }, {
+    milliseconds: 10
+  }, {
+    milliseconds: 1
+  }
+];
+
+TimelineGrid.prototype.initScaleProps = function() {
+  var input, slotUnit, type;
+  this.labelInterval = this.queryDurationOption('slotLabelInterval');
+  this.slotDuration = this.queryDurationOption('slotDuration');
+  this.validateLabelAndSlot();
+  this.ensureLabelInterval();
+  this.ensureSlotDuration();
+  input = this.opt('slotLabelFormat');
+  type = $.type(input);
+  this.headerFormats = type === 'array' ? input : type === 'string' ? [input] : this.computeHeaderFormats();
+  this.isTimeScale = durationHasTime(this.slotDuration);
+  this.largeUnit = !this.isTimeScale ? (slotUnit = computeGreatestUnit(this.slotDuration), /year|month|week/.test(slotUnit) ? slotUnit : void 0) : void 0;
+  this.emphasizeWeeks = this.slotDuration.as('days') === 1 && this.view.currentRangeAs('weeks') >= 2 && !this.opt('businessHours');
+
+  /*
+  	console.log('label interval =', @labelInterval.humanize())
+  	console.log('slot duration =', @slotDuration.humanize())
+  	console.log('header formats =', @headerFormats)
+  	console.log('isTimeScale', @isTimeScale)
+  	console.log('largeUnit', @largeUnit)
+   */
+  this.snapDuration = (input = this.opt('snapDuration')) ? moment.duration(input) : this.slotDuration;
+  this.minResizeDuration = this.snapDuration;
+  return this.snapsPerSlot = divideDurationByDuration(this.slotDuration, this.snapDuration);
+};
+
+TimelineGrid.prototype.queryDurationOption = function(name) {
+  var dur, input;
+  input = this.opt(name);
+  if (input != null) {
+    dur = moment.duration(input);
+    if (+dur) {
+      return dur;
+    }
+  }
+};
+
+TimelineGrid.prototype.validateLabelAndSlot = function() {
+  var currentRange, labelCnt, slotCnt, slotsPerLabel;
+  currentRange = this.view.currentRange;
+  if (this.labelInterval) {
+    labelCnt = divideRangeByDuration(currentRange.start, currentRange.end, this.labelInterval);
+    if (labelCnt > MAX_CELLS) {
+      FC.warn('slotLabelInterval results in too many cells');
+      this.labelInterval = null;
+    }
+  }
+  if (this.slotDuration) {
+    slotCnt = divideRangeByDuration(currentRange.start, currentRange.end, this.slotDuration);
+    if (slotCnt > MAX_CELLS) {
+      FC.warn('slotDuration results in too many cells');
+      this.slotDuration = null;
+    }
+  }
+  if (this.labelInterval && this.slotDuration) {
+    slotsPerLabel = divideDurationByDuration(this.labelInterval, this.slotDuration);
+    if (!isInt(slotsPerLabel) || slotsPerLabel < 1) {
+      FC.warn('slotLabelInterval must be a multiple of slotDuration');
+      return this.slotDuration = null;
+    }
+  }
+};
+
+TimelineGrid.prototype.computeFallbackDuration = function() {
+  var duration, input, j, labelCnt, labelInterval;
+  duration = null;
+  if (!this.labelInterval && !this.slotDuration) {
+    duration = moment.duration(DEFAULT_GRID_DURATION);
+  } else {
+    labelInterval = this.ensureLabelInterval();
+    for (j = STOCK_SUB_DURATIONS.length - 1; j >= 0; j += -1) {
+      input = STOCK_SUB_DURATIONS[j];
+      duration = moment.duration(input);
+      labelCnt = divideDurationByDuration(duration, labelInterval);
+      if (labelCnt >= MIN_AUTO_LABELS) {
+        break;
+      }
+    }
+  }
+  return duration;
+};
+
+TimelineGrid.prototype.ensureLabelInterval = function() {
+  var currentRange, input, j, k, labelCnt, labelInterval, len, len1, slotsPerLabel, tryLabelInterval;
+  currentRange = this.view.currentRange;
+  labelInterval = this.labelInterval;
+  if (!labelInterval) {
+    if (this.slotDuration) {
+      for (j = 0, len = STOCK_SUB_DURATIONS.length; j < len; j++) {
+        input = STOCK_SUB_DURATIONS[j];
+        tryLabelInterval = moment.duration(input);
+        slotsPerLabel = divideDurationByDuration(tryLabelInterval, this.slotDuration);
+        if (isInt(slotsPerLabel) && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) {
+          labelInterval = tryLabelInterval;
+          break;
+        }
+      }
+      if (!labelInterval) {
+        labelInterval = this.slotDuration;
+      }
+    } else {
+      for (k = 0, len1 = STOCK_SUB_DURATIONS.length; k < len1; k++) {
+        input = STOCK_SUB_DURATIONS[k];
+        labelInterval = moment.duration(input);
+        labelCnt = divideRangeByDuration(currentRange.start, currentRange.end, labelInterval);
+        if (labelCnt >= MIN_AUTO_LABELS) {
+          break;
+        }
+      }
+    }
+    this.labelInterval = labelInterval;
+  }
+  return labelInterval;
+};
+
+TimelineGrid.prototype.ensureSlotDuration = function() {
+  var currentRange, input, j, labelInterval, len, slotCnt, slotDuration, slotsPerLabel, trySlotDuration;
+  currentRange = this.view.currentRange;
+  slotDuration = this.slotDuration;
+  if (!slotDuration) {
+    labelInterval = this.ensureLabelInterval();
+    for (j = 0, len = STOCK_SUB_DURATIONS.length; j < len; j++) {
+      input = STOCK_SUB_DURATIONS[j];
+      trySlotDuration = moment.duration(input);
+      slotsPerLabel = divideDurationByDuration(labelInterval, trySlotDuration);
+      if (isInt(slotsPerLabel) && slotsPerLabel > 1 && slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL) {
+        slotDuration = trySlotDuration;
+        break;
+      }
+    }
+    if (slotDuration) {
+      slotCnt = divideRangeByDuration(currentRange.start, currentRange.end, slotDuration);
+      if (slotCnt > MAX_AUTO_CELLS) {
+        slotDuration = null;
+      }
+    }
+    if (!slotDuration) {
+      slotDuration = labelInterval;
+    }
+    this.slotDuration = slotDuration;
+  }
+  return slotDuration;
+};
+
+TimelineGrid.prototype.computeHeaderFormats = function() {
+  var format0, format1, format2, labelInterval, unit, view, weekNumbersVisible;
+  view = this.view;
+  labelInterval = this.labelInterval;
+  unit = computeGreatestUnit(labelInterval);
+  weekNumbersVisible = this.opt('weekNumbers');
+  format0 = format1 = format2 = null;
+  if (unit === 'week' && !weekNumbersVisible) {
+    unit = 'day';
+  }
+  switch (unit) {
+    case 'year':
+      format0 = 'YYYY';
+      break;
+    case 'month':
+      if (view.currentRangeAs('years') > 1) {
+        format0 = 'YYYY';
+      }
+      format1 = 'MMM';
+      break;
+    case 'week':
+      if (view.currentRangeAs('years') > 1) {
+        format0 = 'YYYY';
+      }
+      format1 = this.opt('shortWeekFormat');
+      break;
+    case 'day':
+      if (view.currentRangeAs('years') > 1) {
+        format0 = this.opt('monthYearFormat');
+      } else if (view.currentRangeAs('months') > 1) {
+        format0 = 'MMMM';
+      }
+      if (weekNumbersVisible) {
+        format1 = this.opt('weekFormat');
+      }
+      format2 = 'dd D';
+      break;
+    case 'hour':
+      if (weekNumbersVisible) {
+        format0 = this.opt('weekFormat');
+      }
+      if (view.currentRangeAs('days') > 1) {
+        format1 = this.opt('dayOfMonthFormat');
+      }
+      format2 = this.opt('smallTimeFormat');
+      break;
+    case 'minute':
+      if (labelInterval.asMinutes() / 60 >= MAX_AUTO_SLOTS_PER_LABEL) {
+        format0 = this.opt('hourFormat');
+        format1 = '[:]mm';
+      } else {
+        format0 = this.opt('mediumTimeFormat');
+      }
+      break;
+    case 'second':
+      if (labelInterval.asSeconds() / 60 >= MAX_AUTO_SLOTS_PER_LABEL) {
+        format0 = 'LT';
+        format1 = '[:]ss';
+      } else {
+        format0 = 'LTS';
+      }
+      break;
+    case 'millisecond':
+      format0 = 'LTS';
+      format1 = '[.]SSS';
+  }
+  return [].concat(format0 || [], format1 || [], format2 || []);
+};
+
+FC.views.timeline = {
+  "class": TimelineView,
+  defaults: {
+    eventResizableFromStart: true
+  }
+};
+
+FC.views.timelineDay = {
+  type: 'timeline',
+  duration: {
+    days: 1
+  }
+};
+
+FC.views.timelineWeek = {
+  type: 'timeline',
+  duration: {
+    weeks: 1
+  }
+};
+
+FC.views.timelineMonth = {
+  type: 'timeline',
+  duration: {
+    months: 1
+  }
+};
+
+FC.views.timelineYear = {
+  type: 'timeline',
+  duration: {
+    years: 1
+  }
+};
+
+ResourceTimelineView = (function(superClass) {
+  extend(ResourceTimelineView, superClass);
+
+  function ResourceTimelineView() {
+    return ResourceTimelineView.__super__.constructor.apply(this, arguments);
+  }
+
+  ResourceTimelineView.mixin(ResourceViewMixin);
+
+  ResourceTimelineView.prototype.canHandleSpecificResources = true;
+
+  ResourceTimelineView.prototype.resourceGrid = null;
+
+  ResourceTimelineView.prototype.tbodyHash = null;
+
+  ResourceTimelineView.prototype.joiner = null;
+
+  ResourceTimelineView.prototype.dividerEls = null;
+
+  ResourceTimelineView.prototype.superHeaderText = null;
+
+  ResourceTimelineView.prototype.isVGrouping = null;
+
+  ResourceTimelineView.prototype.isHGrouping = null;
+
+  ResourceTimelineView.prototype.groupSpecs = null;
+
+  ResourceTimelineView.prototype.colSpecs = null;
+
+  ResourceTimelineView.prototype.orderSpecs = null;
+
+  ResourceTimelineView.prototype.rowHierarchy = null;
+
+  ResourceTimelineView.prototype.resourceRowHash = null;
+
+  ResourceTimelineView.prototype.nestingCnt = 0;
+
+  ResourceTimelineView.prototype.isNesting = null;
+
+  ResourceTimelineView.prototype.dividerWidth = null;
+
+  ResourceTimelineView.prototype.initialize = function() {
+    ResourceTimelineView.__super__.initialize.apply(this, arguments);
+    this.processResourceOptions();
+    this.resourceGrid = new Spreadsheet(this);
+    this.rowHierarchy = new RowParent(this);
+    return this.resourceRowHash = {};
+  };
+
+  ResourceTimelineView.prototype.instantiateGrid = function() {
+    return new ResourceTimelineGrid(this);
+  };
+
+  ResourceTimelineView.prototype.processResourceOptions = function() {
+    var allColSpecs, allOrderSpecs, colSpec, defaultLabelText, groupColSpecs, groupSpec, groupSpecs, hGroupField, isGroup, isHGrouping, isVGrouping, j, k, l, labelText, len, len1, len2, orderSpec, plainColSpecs, plainOrderSpecs, superHeaderText;
+    allColSpecs = this.opt('resourceColumns') || [];
+    labelText = this.opt('resourceLabelText');
+    defaultLabelText = 'Resources';
+    superHeaderText = null;
+    if (!allColSpecs.length) {
+      allColSpecs.push({
+        labelText: labelText || defaultLabelText,
+        text: this.getResourceTextFunc()
+      });
+    } else {
+      superHeaderText = labelText;
+    }
+    plainColSpecs = [];
+    groupColSpecs = [];
+    groupSpecs = [];
+    isVGrouping = false;
+    isHGrouping = false;
+    for (j = 0, len = allColSpecs.length; j < len; j++) {
+      colSpec = allColSpecs[j];
+      if (colSpec.group) {
+        groupColSpecs.push(colSpec);
+      } else {
+        plainColSpecs.push(colSpec);
+      }
+    }
+    plainColSpecs[0].isMain = true;
+    if (groupColSpecs.length) {
+      groupSpecs = groupColSpecs;
+      isVGrouping = true;
+    } else {
+      hGroupField = this.opt('resourceGroupField');
+      if (hGroupField) {
+        isHGrouping = true;
+        groupSpecs.push({
+          field: hGroupField,
+          text: this.opt('resourceGroupText'),
+          render: this.opt('resourceGroupRender')
+        });
+      }
+    }
+    allOrderSpecs = parseFieldSpecs(this.opt('resourceOrder'));
+    plainOrderSpecs = [];
+    for (k = 0, len1 = allOrderSpecs.length; k < len1; k++) {
+      orderSpec = allOrderSpecs[k];
+      isGroup = false;
+      for (l = 0, len2 = groupSpecs.length; l < len2; l++) {
+        groupSpec = groupSpecs[l];
+        if (groupSpec.field === orderSpec.field) {
+          groupSpec.order = orderSpec.order;
+          isGroup = true;
+          break;
+        }
+      }
+      if (!isGroup) {
+        plainOrderSpecs.push(orderSpec);
+      }
+    }
+    this.superHeaderText = superHeaderText;
+    this.isVGrouping = isVGrouping;
+    this.isHGrouping = isHGrouping;
+    this.groupSpecs = groupSpecs;
+    this.colSpecs = groupColSpecs.concat(plainColSpecs);
+    return this.orderSpecs = plainOrderSpecs;
+  };
+
+  ResourceTimelineView.prototype.renderSkeleton = function() {
+    ResourceTimelineView.__super__.renderSkeleton.apply(this, arguments);
+    this.renderResourceGridSkeleton();
+    this.tbodyHash = {
+      spreadsheet: this.resourceGrid.tbodyEl,
+      event: this.timeGrid.tbodyEl
+    };
+    this.joiner = new ScrollJoiner('vertical', [this.resourceGrid.bodyScroller, this.timeGrid.bodyScroller]);
+    return this.initDividerMoving();
+  };
+
+  ResourceTimelineView.prototype.renderSkeletonHtml = function() {
+    return '<table> <thead class="fc-head"> <tr> <td class="fc-resource-area ' + this.widgetHeaderClass + '"></td> <td class="fc-divider fc-col-resizer ' + this.widgetHeaderClass + '"></td> <td class="fc-time-area ' + this.widgetHeaderClass + '"></td> </tr> </thead> <tbody class="fc-body"> <tr> <td class="fc-resource-area ' + this.widgetContentClass + '"></td> <td class="fc-divider fc-col-resizer ' + this.widgetHeaderClass + '"></td> <td class="fc-time-area ' + this.widgetContentClass + '"></td> </tr> </tbody> </table>';
+  };
+
+  ResourceTimelineView.prototype.renderResourceGridSkeleton = function() {
+    this.resourceGrid.el = this.el.find('tbody .fc-resource-area');
+    this.resourceGrid.headEl = this.el.find('thead .fc-resource-area');
+    return this.resourceGrid.renderSkeleton();
+  };
+
+  ResourceTimelineView.prototype.initDividerMoving = function() {
+    var ref;
+    this.dividerEls = this.el.find('.fc-divider');
+    this.dividerWidth = (ref = this.opt('resourceAreaWidth')) != null ? ref : this.resourceGrid.tableWidth;
+    if (this.dividerWidth != null) {
+      this.positionDivider(this.dividerWidth);
+    }
+    return this.dividerEls.on('mousedown', (function(_this) {
+      return function(ev) {
+        return _this.dividerMousedown(ev);
+      };
+    })(this));
+  };
+
+  ResourceTimelineView.prototype.dividerMousedown = function(ev) {
+    var dragListener, isRTL, maxWidth, minWidth, origWidth;
+    isRTL = this.opt('isRTL');
+    minWidth = 30;
+    maxWidth = this.el.width() - 30;
+    origWidth = this.getNaturalDividerWidth();
+    dragListener = new DragListener({
+      dragStart: (function(_this) {
+        return function() {
+          return _this.dividerEls.addClass('fc-active');
+        };
+      })(this),
+      drag: (function(_this) {
+        return function(dx, dy) {
+          var width;
+          if (isRTL) {
+            width = origWidth - dx;
+          } else {
+            width = origWidth + dx;
+          }
+          width = Math.max(width, minWidth);
+          width = Math.min(width, maxWidth);
+          _this.dividerWidth = width;
+          _this.positionDivider(width);
+          return _this.updateWidth();
+        };
+      })(this),
+      dragEnd: (function(_this) {
+        return function() {
+          return _this.dividerEls.removeClass('fc-active');
+        };
+      })(this)
+    });
+    return dragListener.startInteraction(ev);
+  };
+
+  ResourceTimelineView.prototype.getNaturalDividerWidth = function() {
+    return this.el.find('.fc-resource-area').width();
+  };
+
+  ResourceTimelineView.prototype.positionDivider = function(w) {
+    return this.el.find('.fc-resource-area').width(w);
+  };
+
+  ResourceTimelineView.prototype.renderEvents = function(events) {
+    this.timeGrid.renderEvents(events);
+    this.syncRowHeights();
+    return this.updateWidth();
+  };
+
+  ResourceTimelineView.prototype.unrenderEvents = function() {
+    this.timeGrid.unrenderEvents();
+    this.syncRowHeights();
+    return this.updateWidth();
+  };
+
+  ResourceTimelineView.prototype.updateWidth = function() {
+    ResourceTimelineView.__super__.updateWidth.apply(this, arguments);
+    this.resourceGrid.updateWidth();
+    this.joiner.update();
+    if (this.cellFollower) {
+      return this.cellFollower.update();
+    }
+  };
+
+  ResourceTimelineView.prototype.updateHeight = function(isResize) {
+    ResourceTimelineView.__super__.updateHeight.apply(this, arguments);
+    if (isResize) {
+      return this.syncRowHeights();
+    }
+  };
+
+  ResourceTimelineView.prototype.setHeight = function(totalHeight, isAuto) {
+    var bodyHeight, headHeight;
+    headHeight = this.syncHeadHeights();
+    if (isAuto) {
+      bodyHeight = 'auto';
+    } else {
+      bodyHeight = totalHeight - headHeight - this.queryMiscHeight();
+    }
+    this.timeGrid.bodyScroller.setHeight(bodyHeight);
+    return this.resourceGrid.bodyScroller.setHeight(bodyHeight);
+  };
+
+  ResourceTimelineView.prototype.queryMiscHeight = function() {
+    return this.el.outerHeight() - Math.max(this.resourceGrid.headScroller.el.outerHeight(), this.timeGrid.headScroller.el.outerHeight()) - Math.max(this.resourceGrid.bodyScroller.el.outerHeight(), this.timeGrid.bodyScroller.el.outerHeight());
+  };
+
+  ResourceTimelineView.prototype.syncHeadHeights = function() {
+    var headHeight;
+    this.resourceGrid.headHeight('auto');
+    this.timeGrid.headHeight('auto');
+    headHeight = Math.max(this.resourceGrid.headHeight(), this.timeGrid.headHeight());
+    this.resourceGrid.headHeight(headHeight);
+    this.timeGrid.headHeight(headHeight);
+    return headHeight;
+  };
+
+  ResourceTimelineView.prototype.renderResources = function(resources) {
+    var j, len, resource;
+    this.batchRows();
+    for (j = 0, len = resources.length; j < len; j++) {
+      resource = resources[j];
+      this.insertResource(resource);
+    }
+    this.rowHierarchy.show();
+    this.unbatchRows();
+    return this.reinitializeCellFollowers();
+  };
+
+  ResourceTimelineView.prototype.unrenderResources = function() {
+    this.batchRows();
+    this.rowHierarchy.removeChildren();
+    this.unbatchRows();
+    return this.reinitializeCellFollowers();
+  };
+
+
+  /*
+  	TODO: the scenario where there were previously unassociated events that are now
+  	 attached to this resource. should render those events immediately.
+  
+  	Responsible for rendering the new resource
+   */
+
+  ResourceTimelineView.prototype.renderResource = function(resource) {
+    this.insertResource(resource);
+    return this.reinitializeCellFollowers();
+  };
+
+  ResourceTimelineView.prototype.unrenderResource = function(resource) {
+    var row;
+    row = this.getResourceRow(resource.id);
+    if (row) {
+      this.batchRows();
+      row.remove();
+      this.unbatchRows();
+      return this.reinitializeCellFollowers();
+    }
+  };
+
+  ResourceTimelineView.prototype.cellFollower = null;
+
+  ResourceTimelineView.prototype.reinitializeCellFollowers = function() {
+    var cellContent, j, len, nodes, ref, row;
+    if (this.cellFollower) {
+      this.cellFollower.clearSprites();
+    }
+    this.cellFollower = new ScrollFollower(this.resourceGrid.bodyScroller, true);
+    this.cellFollower.isHFollowing = false;
+    this.cellFollower.isVFollowing = true;
+    nodes = [];
+    ref = this.rowHierarchy.getNodes();
+    for (j = 0, len = ref.length; j < len; j++) {
+      row = ref[j];
+      if (row instanceof VRowGroup) {
+        if (row.groupTd) {
+          cellContent = row.groupTd.find('.fc-cell-content');
+          if (cellContent.length) {
+            nodes.push(cellContent[0]);
+          }
+        }
+      }
+    }
+    return this.cellFollower.setSprites($(nodes));
+  };
+
+  ResourceTimelineView.prototype.insertResource = function(resource, parentResourceRow) {
+    var childResource, j, len, parentId, ref, results, row;
+    row = new ResourceRow(this, resource);
+    if (parentResourceRow == null) {
+      parentId = resource.parentId;
+      if (parentId) {
+        parentResourceRow = this.getResourceRow(parentId);
+      }
+    }
+    if (parentResourceRow) {
+      this.insertRowAsChild(row, parentResourceRow);
+    } else {
+      this.insertRow(row);
+    }
+    ref = resource.children;
+    results = [];
+    for (j = 0, len = ref.length; j < len; j++) {
+      childResource = ref[j];
+      results.push(this.insertResource(childResource, row));
+    }
+    return results;
+  };
+
+  ResourceTimelineView.prototype.insertRow = function(row, parent, groupSpecs) {
+    var group;
+    if (parent == null) {
+      parent = this.rowHierarchy;
+    }
+    if (groupSpecs == null) {
+      groupSpecs = this.groupSpecs;
+    }
+    if (groupSpecs.length) {
+      group = this.ensureResourceGroup(row, parent, groupSpecs[0]);
+      if (group instanceof HRowGroup) {
+        return this.insertRowAsChild(row, group);
+      } else {
+        return this.insertRow(row, group, groupSpecs.slice(1));
+      }
+    } else {
+      return this.insertRowAsChild(row, parent);
+    }
+  };
+
+  ResourceTimelineView.prototype.insertRowAsChild = function(row, parent) {
+    return parent.addChild(row, this.computeChildRowPosition(row, parent));
+  };
+
+  ResourceTimelineView.prototype.computeChildRowPosition = function(child, parent) {
+    var cmp, i, j, len, ref, sibling;
+    if (this.orderSpecs.length) {
+      ref = parent.children;
+      for (i = j = 0, len = ref.length; j < len; i = ++j) {
+        sibling = ref[i];
+        cmp = this.compareResources(sibling.resource || {}, child.resource || {});
+        if (cmp > 0) {
+          return i;
+        }
+      }
+    }
+    return null;
+  };
+
+  ResourceTimelineView.prototype.compareResources = function(a, b) {
+    return compareByFieldSpecs(a, b, this.orderSpecs);
+  };
+
+  ResourceTimelineView.prototype.ensureResourceGroup = function(row, parent, spec) {
+    var cmp, group, groupValue, i, j, k, len, len1, ref, ref1, testGroup;
+    groupValue = (row.resource || {})[spec.field];
+    group = null;
+    if (spec.order) {
+      ref = parent.children;
+      for (i = j = 0, len = ref.length; j < len; i = ++j) {
+        testGroup = ref[i];
+        cmp = flexibleCompare(testGroup.groupValue, groupValue) * spec.order;
+        if (cmp === 0) {
+          group = testGroup;
+          break;
+        } else if (cmp > 0) {
+          break;
+        }
+      }
+    } else {
+      ref1 = parent.children;
+      for (i = k = 0, len1 = ref1.length; k < len1; i = ++k) {
+        testGroup = ref1[i];
+        if (testGroup.groupValue === groupValue) {
+          group = testGroup;
+          break;
+        }
+      }
+    }
+    if (!group) {
+      if (this.isVGrouping) {
+        group = new VRowGroup(this, spec, groupValue);
+      } else {
+        group = new HRowGroup(this, spec, groupValue);
+      }
+      parent.addChild(group, i);
+    }
+    return group;
+  };
+
+  ResourceTimelineView.prototype.pairSegsWithRows = function(segs) {
+    var j, len, pair, pairs, pairsById, resourceId, rowObj, seg;
+    pairs = [];
+    pairsById = {};
+    for (j = 0, len = segs.length; j < len; j++) {
+      seg = segs[j];
+      resourceId = seg.resourceId;
+      if (resourceId) {
+        rowObj = this.getResourceRow(resourceId);
+        if (rowObj) {
+          pair = pairsById[resourceId];
+          if (!pair) {
+            pair = [rowObj, []];
+            pairs.push(pair);
+            pairsById[resourceId] = pair;
+          }
+          pair[1].push(seg);
+        }
+      }
+    }
+    return pairs;
+  };
+
+  ResourceTimelineView.prototype.rowAdded = function(row) {
+    var isNesting, wasNesting;
+    if (row instanceof ResourceRow) {
+      this.resourceRowHash[row.resource.id] = row;
+      this.timeGrid.assignRowBusinessHourSegs(row);
+    }
+    wasNesting = this.isNesting;
+    isNesting = Boolean(this.nestingCnt += row.depth ? 1 : 0);
+    if (wasNesting !== isNesting) {
+      this.el.toggleClass('fc-nested', isNesting);
+      this.el.toggleClass('fc-flat', !isNesting);
+    }
+    return this.isNesting = isNesting;
+  };
+
+  ResourceTimelineView.prototype.rowRemoved = function(row) {
+    var isNesting, wasNesting;
+    if (row instanceof ResourceRow) {
+      delete this.resourceRowHash[row.resource.id];
+      this.timeGrid.destroyRowBusinessHourSegs(row);
+    }
+    wasNesting = this.isNesting;
+    isNesting = Boolean(this.nestingCnt -= row.depth ? 1 : 0);
+    if (wasNesting !== isNesting) {
+      this.el.toggleClass('fc-nested', isNesting);
+      this.el.toggleClass('fc-flat', !isNesting);
+    }
+    return this.isNesting = isNesting;
+  };
+
+  ResourceTimelineView.prototype.batchRowDepth = 0;
+
+  ResourceTimelineView.prototype.shownRowBatch = null;
+
+  ResourceTimelineView.prototype.hiddenRowBatch = null;
+
+  ResourceTimelineView.prototype.batchRows = function() {
+    if (!(this.batchRowDepth++)) {
+      this.shownRowBatch = [];
+      return this.hiddenRowBatch = [];
+    }
+  };
+
+  ResourceTimelineView.prototype.unbatchRows = function() {
+    if (!(--this.batchRowDepth)) {
+      if (this.hiddenRowBatch.length) {
+        this.rowsHidden(this.hiddenRowBatch);
+      }
+      if (this.shownRowBatch.length) {
+        this.rowsShown(this.shownRowBatch);
+      }
+      this.hiddenRowBatch = null;
+      return this.shownRowBatch = null;
+    }
+  };
+
+  ResourceTimelineView.prototype.rowShown = function(row) {
+    if (this.shownRowBatch) {
+      return this.shownRowBatch.push(row);
+    } else {
+      return this.rowsShown([row]);
+    }
+  };
+
+  ResourceTimelineView.prototype.rowHidden = function(row) {
+    if (this.hiddenRowBatch) {
+      return this.hiddenRowBatch.push(row);
+    } else {
+      return this.rowsHidden([row]);
+    }
+  };
+
+  ResourceTimelineView.prototype.rowsShown = function(rows) {
+    this.syncRowHeights(rows);
+    return this.updateWidth();
+  };
+
+  ResourceTimelineView.prototype.rowsHidden = function(rows) {
+    return this.updateWidth();
+  };
+
+  ResourceTimelineView.prototype.syncRowHeights = function(visibleRows, safe) {
+    var h, h1, h2, i, innerHeights, j, k, len, len1, row;
+    if (safe == null) {
+      safe = false;
+    }
+    if (visibleRows == null) {
+      visibleRows = this.getVisibleRows();
+    }
+    for (j = 0, len = visibleRows.length; j < len; j++) {
+      row = visibleRows[j];
+      row.setTrInnerHeight('');
+    }
+    innerHeights = (function() {
+      var k, len1, results;
+      results = [];
+      for (k = 0, len1 = visibleRows.length; k < len1; k++) {
+        row = visibleRows[k];
+        h = row.getMaxTrInnerHeight();
+        if (safe) {
+          h += h % 2;
+        }
+        results.push(h);
+      }
+      return results;
+    })();
+    for (i = k = 0, len1 = visibleRows.length; k < len1; i = ++k) {
+      row = visibleRows[i];
+      row.setTrInnerHeight(innerHeights[i]);
+    }
+    if (!safe) {
+      h1 = this.resourceGrid.tbodyEl.height();
+      h2 = this.timeGrid.tbodyEl.height();
+      if (Math.abs(h1 - h2) > 1) {
+        return this.syncRowHeights(visibleRows, true);
+      }
+    }
+  };
+
+  ResourceTimelineView.prototype.getVisibleRows = function() {
+    var j, len, ref, results, row;
+    ref = this.rowHierarchy.getRows();
+    results = [];
+    for (j = 0, len = ref.length; j < len; j++) {
+      row = ref[j];
+      if (row.isShown) {
+        results.push(row);
+      }
+    }
+    return results;
+  };
+
+  ResourceTimelineView.prototype.getEventRows = function() {
+    var j, len, ref, results, row;
+    ref = this.rowHierarchy.getRows();
+    results = [];
+    for (j = 0, len = ref.length; j < len; j++) {
+      row = ref[j];
+      if (row instanceof EventRow) {
+        results.push(row);
+      }
+    }
+    return results;
+  };
+
+  ResourceTimelineView.prototype.getResourceRow = function(resourceId) {
+    return this.resourceRowHash[resourceId];
+  };
+
+  ResourceTimelineView.prototype.queryResourceScroll = function() {
+    var el, elBottom, j, len, ref, rowObj, scroll, scrollerTop;
+    scroll = {};
+    scrollerTop = this.timeGrid.bodyScroller.scrollEl.offset().top;
+    ref = this.getVisibleRows();
+    for (j = 0, len = ref.length; j < len; j++) {
+      rowObj = ref[j];
+      if (rowObj.resource) {
+        el = rowObj.getTr('event');
+        elBottom = el.offset().top + el.outerHeight();
+        if (elBottom > scrollerTop) {
+          scroll.resourceId = rowObj.resource.id;
+          scroll.bottom = elBottom - scrollerTop;
+          break;
+        }
+      }
+    }
+    return scroll;
+  };
+
+  ResourceTimelineView.prototype.applyResourceScroll = function(scroll) {
+    var el, elBottom, innerTop, row, scrollTop;
+    if (scroll.resourceId) {
+      row = this.getResourceRow(scroll.resourceId);
+      if (row) {
+        el = row.getTr('event');
+        if (el) {
+          innerTop = this.timeGrid.bodyScroller.canvas.el.offset().top;
+          elBottom = el.offset().top + el.outerHeight();
+          scrollTop = elBottom - scroll.bottom - innerTop;
+          this.timeGrid.bodyScroller.setScrollTop(scrollTop);
+          return this.resourceGrid.bodyScroller.setScrollTop(scrollTop);
+        }
+      }
+    }
+  };
+
+  ResourceTimelineView.prototype.scrollToResource = function(resource) {
+    var el, innerTop, row, scrollTop;
+    row = this.getResourceRow(resource.id);
+    if (row) {
+      el = row.getTr('event');
+      if (el) {
+        innerTop = this.timeGrid.bodyScroller.canvas.el.offset().top;
+        scrollTop = el.offset().top - innerTop;
+        this.timeGrid.bodyScroller.setScrollTop(scrollTop);
+        return this.resourceGrid.bodyScroller.setScrollTop(scrollTop);
+      }
+    }
+  };
+
+  return ResourceTimelineView;
+
+})(TimelineView);
+
+ResourceTimelineGrid = (function(superClass) {
+  extend(ResourceTimelineGrid, superClass);
+
+  function ResourceTimelineGrid() {
+    return ResourceTimelineGrid.__super__.constructor.apply(this, arguments);
+  }
+
+  ResourceTimelineGrid.mixin(ResourceGridMixin);
+
+  ResourceTimelineGrid.prototype.eventRows = null;
+
+  ResourceTimelineGrid.prototype.shownEventRows = null;
+
+  ResourceTimelineGrid.prototype.tbodyEl = null;
+
+  ResourceTimelineGrid.prototype.rowCoordCache = null;
+
+  ResourceTimelineGrid.prototype.spanToSegs = function(span) {
+    var calendar, j, len, resourceId, seg, segs;
+    segs = ResourceTimelineGrid.__super__.spanToSegs.apply(this, arguments);
+    calendar = this.view.calendar;
+    resourceId = span.resourceId;
+    if (resourceId) {
+      for (j = 0, len = segs.length; j < len; j++) {
+        seg = segs[j];
+        seg.resource = calendar.getResourceById(resourceId);
+        seg.resourceId = resourceId;
+      }
+    }
+    return segs;
+  };
+
+  ResourceTimelineGrid.prototype.prepareHits = function() {
+    var row, trArray;
+    ResourceTimelineGrid.__super__.prepareHits.apply(this, arguments);
+    this.eventRows = this.view.getEventRows();
+    this.shownEventRows = (function() {
+      var j, len, ref, results;
+      ref = this.eventRows;
+      results = [];
+      for (j = 0, len = ref.length; j < len; j++) {
+        row = ref[j];
+        if (row.isShown) {
+          results.push(row);
+        }
+      }
+      return results;
+    }).call(this);
+    trArray = (function() {
+      var j, len, ref, results;
+      ref = this.shownEventRows;
+      results = [];
+      for (j = 0, len = ref.length; j < len; j++) {
+        row = ref[j];
+        results.push(row.getTr('event')[0]);
+      }
+      return results;
+    }).call(this);
+    this.rowCoordCache = new CoordCache({
+      els: trArray,
+      isVertical: true
+    });
+    return this.rowCoordCache.build();
+  };
+
+  ResourceTimelineGrid.prototype.releaseHits = function() {
+    ResourceTimelineGrid.__super__.releaseHits.apply(this, arguments);
+    this.eventRows = null;
+    this.shownEventRows = null;
+    return this.rowCoordCache.clear();
+  };
+
+  ResourceTimelineGrid.prototype.queryHit = function(leftOffset, topOffset) {
+    var rowIndex, simpleHit;
+    simpleHit = ResourceTimelineGrid.__super__.queryHit.apply(this, arguments);
+    if (simpleHit) {
+      rowIndex = this.rowCoordCache.getVerticalIndex(topOffset);
+      if (rowIndex != null) {
+        return {
+          resourceId: this.shownEventRows[rowIndex].resource.id,
+          snap: simpleHit.snap,
+          component: this,
+          left: simpleHit.left,
+          right: simpleHit.right,
+          top: this.rowCoordCache.getTopOffset(rowIndex),
+          bottom: this.rowCoordCache.getBottomOffset(rowIndex)
+        };
+      }
+    }
+  };
+
+  ResourceTimelineGrid.prototype.getHitSpan = function(hit) {
+    var span;
+    span = this.getSnapRange(hit.snap);
+    span.resourceId = hit.resourceId;
+    return span;
+  };
+
+  ResourceTimelineGrid.prototype.getHitEl = function(hit) {
+    return this.getSnapEl(hit.snap);
+  };
+
+  ResourceTimelineGrid.prototype.renderSkeleton = function() {
+    var rowContainerEl;
+    ResourceTimelineGrid.__super__.renderSkeleton.apply(this, arguments);
+    this.segContainerEl.remove();
+    this.segContainerEl = null;
+    rowContainerEl = $('<div class="fc-rows"><table><tbody/></table></div>').appendTo(this.bodyScroller.canvas.contentEl);
+    return this.tbodyEl = rowContainerEl.find('tbody');
+  };
+
+  ResourceTimelineGrid.prototype.renderFgSegs = function(segs) {
+    var containerObj, containerSegs, j, len, pair, pairs, visiblePairs;
+    segs = this.renderFgSegEls(segs);
+    pairs = this.view.pairSegsWithRows(segs);
+    visiblePairs = [];
+    for (j = 0, len = pairs.length; j < len; j++) {
+      pair = pairs[j];
+      containerObj = pair[0], containerSegs = pair[1];
+      containerObj.fgSegs = containerSegs;
+      if (containerObj.isShown) {
+        containerObj.isSegsRendered = true;
+        visiblePairs.push(pair);
+      }
+    }
+    this.renderFgSegsInContainers(visiblePairs);
+    this.updateSegFollowers(segs);
+    return segs;
+  };
+
+  ResourceTimelineGrid.prototype.unrenderFgSegs = function() {
+    var eventRow, eventRows, j, len;
+    this.clearSegFollowers();
+    eventRows = this.view.getEventRows();
+    for (j = 0, len = eventRows.length; j < len; j++) {
+      eventRow = eventRows[j];
+      eventRow.fgSegs = null;
+      eventRow.isSegsRendered = false;
+    }
+    return this.unrenderFgContainers(eventRows);
+  };
+
+  ResourceTimelineGrid.prototype.unrenderBgSegs = function() {
+    var eventRow, eventRows, j, len, results;
+    ResourceTimelineGrid.__super__.unrenderBgSegs.apply(this, arguments);
+    eventRows = this.view.getEventRows();
+    results = [];
+    for (j = 0, len = eventRows.length; j < len; j++) {
+      eventRow = eventRows[j];
+      results.push(eventRow.bgSegs = null);
+    }
+    return results;
+  };
+
+  ResourceTimelineGrid.prototype.rowCntWithCustomBusinessHours = 0;
+
+  ResourceTimelineGrid.prototype.renderBusinessHours = function() {
+    if (this.rowCntWithCustomBusinessHours) {
+      return this.ensureIndividualBusinessHours();
+    } else {
+      return ResourceTimelineGrid.__super__.renderBusinessHours.apply(this, arguments);
+    }
+  };
+
+  ResourceTimelineGrid.prototype.unrenderBusinessHours = function() {
+    if (this.rowCntWithCustomBusinessHours) {
+      return this.clearIndividualBusinessHours();
+    } else {
+      return ResourceTimelineGrid.__super__.unrenderBusinessHours.apply(this, arguments);
+    }
+  };
+
+
+  /*
+  	Ensures that all rows have their individual business hours DISPLAYED.
+   */
+
+  ResourceTimelineGrid.prototype.ensureIndividualBusinessHours = function() {
+    var j, len, ref, results, row;
+    ref = this.view.getEventRows();
+    results = [];
+    for (j = 0, len = ref.length; j < len; j++) {
+      row = ref[j];
+      if (this.view.has('dateProfile') && !row.businessHourSegs) {
+        this.populateRowBusinessHoursSegs(row);
+      }
+      if (row.isShown) {
+        results.push(row.ensureBusinessHourSegsRendered());
+      } else {
+        results.push(void 0);
+      }
+    }
+    return results;
+  };
+
+
+  /*
+  	Ensures that all rows have their individual business hours CLEARED.
+   */
+
+  ResourceTimelineGrid.prototype.clearIndividualBusinessHours = function() {
+    var j, len, ref, results, row;
+    ref = this.view.getEventRows();
+    results = [];
+    for (j = 0, len = ref.length; j < len; j++) {
+      row = ref[j];
+      results.push(row.clearBusinessHourSegs());
+    }
+    return results;
+  };
+
+
+  /*
+  	Called when a row has been added to the tree data structure, but before it's rendered.
+  	Computes and assigns business hour data *if necessary*. To be rendered soon after.
+   */
+
+  ResourceTimelineGrid.prototype.assignRowBusinessHourSegs = function(row) {
+    if (row.resource.businessHours) {
+      if (!this.rowCntWithCustomBusinessHours) {
+        TimelineGrid.prototype.unrenderBusinessHours.call(this);
+        this.ensureIndividualBusinessHours();
+      }
+      this.rowCntWithCustomBusinessHours += 1;
+    }
+    if (this.view.has('dateProfile') && this.rowCntWithCustomBusinessHours) {
+      return this.populateRowBusinessHoursSegs(row);
+    }
+  };
+
+
+  /*
+  	Called when a row has been removed from the tree data structure.
+  	Unrenders the row's segs and, if necessary, forces businessHours back to generic rendering.
+   */
+
+  ResourceTimelineGrid.prototype.destroyRowBusinessHourSegs = function(row) {
+    row.clearBusinessHourSegs();
+    if (row.resource.businessHours) {
+      this.rowCntWithCustomBusinessHours -= 1;
+      if (!this.rowCntWithCustomBusinessHours) {
+        this.clearIndividualBusinessHours();
+        return TimelineGrid.prototype.renderBusinessHours.call(this);
+      }
+    }
+  };
+
+
+  /*
+  	Compute and assign to row.businessHourSegs unconditionally
+   */
+
+  ResourceTimelineGrid.prototype.populateRowBusinessHoursSegs = function(row) {
+    var businessHourSegs, businessHours, businessHoursEvents;
+    businessHours = row.resource.businessHours || this.view.opt('businessHours');
+    businessHoursEvents = this.view.calendar.computeBusinessHourEvents(!this.isTimeScale, businessHours);
+    businessHourSegs = this.eventsToSegs(businessHoursEvents);
+    businessHourSegs = this.renderFillSegEls('businessHours', businessHourSegs);
+    row.businessHourSegs = businessHourSegs;
+  };
+
+  ResourceTimelineGrid.prototype.renderFill = function(type, segs, className) {
+    var j, k, len, len1, nonResourceSegs, pair, pairs, resourceSegs, rowObj, rowSegs, seg, visiblePairs;
+    segs = this.renderFillSegEls(type, segs);
+    resourceSegs = [];
+    nonResourceSegs = [];
+    for (j = 0, len = segs.length; j < len; j++) {
+      seg = segs[j];
+      if (seg.resourceId) {
+        resourceSegs.push(seg);
+      } else {
+        nonResourceSegs.push(seg);
+      }
+    }
+    pairs = this.view.pairSegsWithRows(resourceSegs);
+    visiblePairs = [];
+    for (k = 0, len1 = pairs.length; k < len1; k++) {
+      pair = pairs[k];
+      rowObj = pair[0], rowSegs = pair[1];
+      if (type === 'bgEvent') {
+        rowObj.bgSegs = rowSegs;
+      }
+      if (rowObj.isShown) {
+        visiblePairs.push(pair);
+      }
+    }
+    if (nonResourceSegs.length) {
+      visiblePairs.unshift([this, nonResourceSegs]);
+    }
+    this.renderFillInContainers(type, visiblePairs, className);
+    return segs;
+  };
+
+  ResourceTimelineGrid.prototype.renderHelper = function(event, sourceSeg) {
+    var pairs, segs;
+    segs = this.eventToSegs(event);
+    segs = this.renderFgSegEls(segs);
+    pairs = this.view.pairSegsWithRows(segs);
+    return this.renderHelperSegsInContainers(pairs, sourceSeg);
+  };
+
+  return ResourceTimelineGrid;
+
+})(TimelineGrid);
+
+COL_MIN_WIDTH = 30;
+
+Spreadsheet = (function() {
+  Spreadsheet.prototype.view = null;
+
+  Spreadsheet.prototype.headEl = null;
+
+  Spreadsheet.prototype.el = null;
+
+  Spreadsheet.prototype.tbodyEl = null;
+
+  Spreadsheet.prototype.headScroller = null;
+
+  Spreadsheet.prototype.bodyScroller = null;
+
+  Spreadsheet.prototype.joiner = null;
+
+  function Spreadsheet(view1) {
+    var colSpec;
+    this.view = view1;
+    this.isRTL = this.view.opt('isRTL');
+    this.givenColWidths = this.colWidths = (function() {
+      var j, len, ref, results;
+      ref = this.view.colSpecs;
+      results = [];
+      for (j = 0, len = ref.length; j < len; j++) {
+        colSpec = ref[j];
+        results.push(colSpec.width);
+      }
+      return results;
+    }).call(this);
+  }
+
+  Spreadsheet.prototype.colGroupHtml = '';
+
+  Spreadsheet.prototype.headTable = null;
+
+  Spreadsheet.prototype.headColEls = null;
+
+  Spreadsheet.prototype.headCellEls = null;
+
+  Spreadsheet.prototype.bodyColEls = null;
+
+  Spreadsheet.prototype.bodyTable = null;
+
+  Spreadsheet.prototype.renderSkeleton = function() {
+    this.headScroller = new ClippedScroller({
+      overflowX: 'clipped-scroll',
+      overflowY: 'hidden'
+    });
+    this.headScroller.canvas = new ScrollerCanvas();
+    this.headScroller.render();
+    this.headScroller.canvas.contentEl.html(this.renderHeadHtml());
+    this.headEl.append(this.headScroller.el);
+    this.bodyScroller = new ClippedScroller({
+      overflowY: 'clipped-scroll'
+    });
+    this.bodyScroller.canvas = new ScrollerCanvas();
+    this.bodyScroller.render();
+    this.bodyScroller.canvas.contentEl.html('<div class="fc-rows"><table>' + this.colGroupHtml + '<tbody/></table></div>');
+    this.tbodyEl = this.bodyScroller.canvas.contentEl.find('tbody');
+    this.el.append(this.bodyScroller.el);
+    this.joiner = new ScrollJoiner('horizontal', [this.headScroller, this.bodyScroller]);
+    this.headTable = this.headEl.find('table');
+    this.headColEls = this.headEl.find('col');
+    this.headCellEls = this.headScroller.canvas.contentEl.find('tr:last-child th');
+    this.bodyColEls = this.el.find('col');
+    this.bodyTable = this.el.find('table');
+    this.colMinWidths = this.computeColMinWidths();
+    this.applyColWidths();
+    return this.initColResizing();
+  };
+
+  Spreadsheet.prototype.renderHeadHtml = function() {
+    var colGroupHtml, colSpecs, html, i, isLast, isMainCol, j, k, len, len1, o;
+    colSpecs = this.view.colSpecs;
+    html = '<table>';
+    colGroupHtml = '<colgroup>';
+    for (j = 0, len = colSpecs.length; j < len; j++) {
+      o = colSpecs[j];
+      if (o.isMain) {
+        colGroupHtml += '<col class="fc-main-col"/>';
+      } else {
+        colGroupHtml += '<col/>';
+      }
+    }
+    colGroupHtml += '</colgroup>';
+    this.colGroupHtml = colGroupHtml;
+    html += colGroupHtml;
+    html += '<tbody>';
+    if (this.view.superHeaderText) {
+      html += '<tr class="fc-super">' + '<th class="' + this.view.widgetHeaderClass + '" colspan="' + colSpecs.length + '">' + '<div class="fc-cell-content">' + '<span class="fc-cell-text">' + htmlEscape(this.view.superHeaderText) + '</span>' + '</div>' + '</th>' + '</tr>';
+    }
+    html += '<tr>';
+    isMainCol = true;
+    for (i = k = 0, len1 = colSpecs.length; k < len1; i = ++k) {
+      o = colSpecs[i];
+      isLast = i === colSpecs.length - 1;
+      html += '<th class="' + this.view.widgetHeaderClass + '">' + '<div>' + '<div class="fc-cell-content">' + (o.isMain ? '<span class="fc-expander-space">' + '<span class="fc-icon"></span>' + '</span>' : '') + '<span class="fc-cell-text">' + htmlEscape(o.labelText || '') + '</span>' + '</div>' + (!isLast ? '<div class="fc-col-resizer"></div>' : '') + '</div>' + '</th>';
+    }
+    html += '</tr>';
+    html += '</tbody></table>';
+    return html;
+  };
+
+  Spreadsheet.prototype.givenColWidths = null;
+
+  Spreadsheet.prototype.colWidths = null;
+
+  Spreadsheet.prototype.colMinWidths = null;
+
+  Spreadsheet.prototype.tableWidth = null;
+
+  Spreadsheet.prototype.tableMinWidth = null;
+
+  Spreadsheet.prototype.initColResizing = function() {
+    return this.headEl.find('th .fc-col-resizer').each((function(_this) {
+      return function(i, resizerEl) {
+        resizerEl = $(resizerEl);
+        return resizerEl.on('mousedown', function(ev) {
+          return _this.colResizeMousedown(i, ev, resizerEl);
+        });
+      };
+    })(this));
+  };
+
+  Spreadsheet.prototype.colResizeMousedown = function(i, ev, resizerEl) {
+    var colWidths, dragListener, minWidth, origColWidth;
+    colWidths = this.colWidths = this.queryColWidths();
+    colWidths.pop();
+    colWidths.push(null);
+    origColWidth = colWidths[i];
+    minWidth = Math.min(this.colMinWidths[i], COL_MIN_WIDTH);
+    dragListener = new DragListener({
+      dragStart: (function(_this) {
+        return function() {
+          return resizerEl.addClass('fc-active');
+        };
+      })(this),
+      drag: (function(_this) {
+        return function(dx, dy) {
+          var width;
+          width = origColWidth + (_this.isRTL ? -dx : dx);
+          width = Math.max(width, minWidth);
+          colWidths[i] = width;
+          return _this.applyColWidths();
+        };
+      })(this),
+      dragEnd: (function(_this) {
+        return function() {
+          return resizerEl.removeClass('fc-active');
+        };
+      })(this)
+    });
+    return dragListener.startInteraction(ev);
+  };
+
+  Spreadsheet.prototype.applyColWidths = function() {
+    var allNumbers, anyPercentages, colMinWidths, colWidth, colWidths, cssWidth, cssWidths, defaultCssWidth, i, j, k, l, len, len1, len2, tableMinWidth, total;
+    colMinWidths = this.colMinWidths;
+    colWidths = this.colWidths;
+    allNumbers = true;
+    anyPercentages = false;
+    total = 0;
+    for (j = 0, len = colWidths.length; j < len; j++) {
+      colWidth = colWidths[j];
+      if (typeof colWidth === 'number') {
+        total += colWidth;
+      } else {
+        allNumbers = false;
+        if (colWidth) {
+          anyPercentages = true;
+        }
+      }
+    }
+    defaultCssWidth = anyPercentages && !this.view.isHGrouping ? 'auto' : '';
+    cssWidths = (function() {
+      var k, len1, results;
+      results = [];
+      for (i = k = 0, len1 = colWidths.length; k < len1; i = ++k) {
+        colWidth = colWidths[i];
+        results.push(colWidth != null ? colWidth : defaultCssWidth);
+      }
+      return results;
+    })();
+    tableMinWidth = 0;
+    for (i = k = 0, len1 = cssWidths.length; k < len1; i = ++k) {
+      cssWidth = cssWidths[i];
+      tableMinWidth += typeof cssWidth === 'number' ? cssWidth : colMinWidths[i];
+    }
+    for (i = l = 0, len2 = cssWidths.length; l < len2; i = ++l) {
+      cssWidth = cssWidths[i];
+      this.headColEls.eq(i).width(cssWidth);
+      this.bodyColEls.eq(i).width(cssWidth);
+    }
+    this.headScroller.canvas.setMinWidth(tableMinWidth);
+    this.bodyScroller.canvas.setMinWidth(tableMinWidth);
+    this.tableMinWidth = tableMinWidth;
+    return this.tableWidth = allNumbers ? total : void 0;
+  };
+
+  Spreadsheet.prototype.computeColMinWidths = function() {
+    var i, j, len, ref, results, width;
+    ref = this.givenColWidths;
+    results = [];
+    for (i = j = 0, len = ref.length; j < len; i = ++j) {
+      width = ref[i];
+      if (typeof width === 'number') {
+        results.push(width);
+      } else {
+        results.push(parseInt(this.headColEls.eq(i).css('min-width')) || COL_MIN_WIDTH);
+      }
+    }
+    return results;
+  };
+
+  Spreadsheet.prototype.queryColWidths = function() {
+    var j, len, node, ref, results;
+    ref = this.headCellEls;
+    results = [];
+    for (j = 0, len = ref.length; j < len; j++) {
+      node = ref[j];
+      results.push($(node).outerWidth());
+    }
+    return results;
+  };
+
+  Spreadsheet.prototype.updateWidth = function() {
+    this.headScroller.updateSize();
+    this.bodyScroller.updateSize();
+    this.joiner.update();
+    if (this.follower) {
+      return this.follower.update();
+    }
+  };
+
+  Spreadsheet.prototype.headHeight = function() {
+    var table;
+    table = this.headScroller.canvas.contentEl.find('table');
+    return table.height.apply(table, arguments);
+  };
+
+  return Spreadsheet;
+
+})();
+
+
+/*
+An abstract node in a row-hierarchy tree.
+May be a self-contained single row, a row with subrows,
+OR a grouping of rows without its own distinct row.
+ */
+
+RowParent = (function() {
+  RowParent.prototype.view = null;
+
+  RowParent.prototype.parent = null;
+
+  RowParent.prototype.prevSibling = null;
+
+  RowParent.prototype.children = null;
+
+  RowParent.prototype.depth = 0;
+
+  RowParent.prototype.hasOwnRow = false;
+
+  RowParent.prototype.trHash = null;
+
+  RowParent.prototype.trs = null;
+
+  RowParent.prototype.isRendered = false;
+
+  RowParent.prototype.isExpanded = true;
+
+  RowParent.prototype.isShown = false;
+
+  function RowParent(view1) {
+    this.view = view1;
+    this.children = [];
+    this.trHash = {};
+    this.trs = $();
+  }
+
+
+  /*
+  	Adds the given node as a child.
+  	Will be inserted at the `index`. If not given, will be appended to the end.
+   */
+
+  RowParent.prototype.addChild = function(child, index) {
+    var children, j, len, node, ref;
+    child.remove();
+    children = this.children;
+    if (index != null) {
+      children.splice(index, 0, child);
+    } else {
+      index = children.length;
+      children.push(child);
+    }
+    child.prevSibling = index > 0 ? children[index - 1] : null;
+    if (index < children.length - 1) {
+      children[index + 1].prevSibling = child;
+    }
+    child.parent = this;
+    child.depth = this.depth + (this.hasOwnRow ? 1 : 0);
+    ref = child.getNodes();
+    for (j = 0, len = ref.length; j < len; j++) {
+      node = ref[j];
+      node.added();
+    }
+    if (this.isShown && this.isExpanded) {
+      return child.show();
+    }
+  };
+
+
+  /*
+  	Removes the given child from the node. Assumes it is a direct child.
+  	If not a direct child, returns false and nothing happens.
+  	Unrenders the child and triggers handlers.
+   */
+
+  RowParent.prototype.removeChild = function(child) {
+    var children, i, isFound, j, k, len, len1, ref, row, testChild;
+    children = this.children;
+    isFound = false;
+    for (i = j = 0, len = children.length; j < len; i = ++j) {
+      testChild = children[i];
+      if (testChild === child) {
+        isFound = true;
+        break;
+      }
+    }
+    if (!isFound) {
+      return false;
+    } else {
+      if (i < children.length - 1) {
+        children[i + 1].prevSibling = child.prevSibling;
+      }
+      children.splice(i, 1);
+      child.recursivelyUnrender();
+      ref = child.getNodes();
+      for (k = 0, len1 = ref.length; k < len1; k++) {
+        row = ref[k];
+        row.removed();
+      }
+      child.parent = null;
+      child.prevSibling = null;
+      return child;
+    }
+  };
+
+
+  /*
+  	Removes all of the node's children from the hierarchy. Unrenders them and triggers callbacks.
+  	NOTE: batchRows/unbatchRows should probably be called before this happens :(
+   */
+
+  RowParent.prototype.removeChildren = function() {
+    var child, j, k, len, len1, ref, ref1;
+    ref = this.children;
+    for (j = 0, len = ref.length; j < len; j++) {
+      child = ref[j];
+      child.recursivelyUnrender();
+    }
+    ref1 = this.getDescendants();
+    for (k = 0, len1 = ref1.length; k < len1; k++) {
+      child = ref1[k];
+      child.removed();
+    }
+    return this.children = [];
+  };
+
+
+  /*
+  	Removes this node from its parent
+   */
+
+  RowParent.prototype.remove = function() {
+    if (this.parent) {
+      return this.parent.removeChild(this);
+    }
+  };
+
+
+  /*
+  	Gets the last direct child node
+   */
+
+  RowParent.prototype.getLastChild = function() {
+    var children;
+    children = this.children;
+    return children[children.length - 1];
+  };
+
+
+  /*
+  	Walks backward in the hierarchy to find the previous row leaf node.
+  	When looking at the hierarchy in a flat linear fashion, this is the revealed row just before the current.
+   */
+
+  RowParent.prototype.getPrevRow = function() {
+    var lastChild, node;
+    node = this;
+    while (node) {
+      if (node.prevSibling) {
+        node = node.prevSibling;
+        while ((lastChild = node.getLastChild())) {
+          node = lastChild;
+        }
+      } else {
+        node = node.parent;
+      }
+      if (node && node.hasOwnRow && node.isShown) {
+        return node;
+      }
+    }
+    return null;
+  };
+
+
+  /*
+  	Returns the first node in the subtree that has a revealed row
+   */
+
+  RowParent.prototype.getLeadingRow = function() {
+    if (this.hasOwnRow) {
+      return this;
+    } else if (this.isExpanded && this.children.length) {
+      return this.children[0].getLeadingRow();
+    }
+  };
+
+
+  /*
+  	Generates a flat array containing all the row-nodes of the subtree. Descendants + self
+   */
+
+  RowParent.prototype.getRows = function(batchArray) {
+    var child, j, len, ref;
+    if (batchArray == null) {
+      batchArray = [];
+    }
+    if (this.hasOwnRow) {
+      batchArray.push(this);
+    }
+    ref = this.children;
+    for (j = 0, len = ref.length; j < len; j++) {
+      child = ref[j];
+      child.getRows(batchArray);
+    }
+    return batchArray;
+  };
+
+
+  /*
+  	Generates a flat array containing all the nodes (row/non-row) of the subtree. Descendants + self
+   */
+
+  RowParent.prototype.getNodes = function(batchArray) {
+    var child, j, len, ref;
+    if (batchArray == null) {
+      batchArray = [];
+    }
+    batchArray.push(this);
+    ref = this.children;
+    for (j = 0, len = ref.length; j < len; j++) {
+      child = ref[j];
+      child.getNodes(batchArray);
+    }
+    return batchArray;
+  };
+
+
+  /*
+  	Generates a flat array containing all the descendant nodes the current node
+   */
+
+  RowParent.prototype.getDescendants = function() {
+    var batchArray, child, j, len, ref;
+    batchArray = [];
+    ref = this.children;
+    for (j = 0, len = ref.length; j < len; j++) {
+      child = ref[j];
+      child.getNodes(batchArray);
+    }
+    return batchArray;
+  };
+
+
+  /*
+  	Builds and populates the TRs for each row type. Inserts them into the DOM.
+  	Does this only for this single row. Not recursive. If not a row (hasOwnRow=false), does not render anything.
+  	PRECONDITION: assumes the parent has already been rendered.
+   */
+
+  RowParent.prototype.render = function() {
+    var prevRow, ref, renderMethodName, tbody, tr, trNodes, type;
+    this.trHash = {};
+    trNodes = [];
+    if (this.hasOwnRow) {
+      prevRow = this.getPrevRow();
+      ref = this.view.tbodyHash;
+      for (type in ref) {
+        tbody = ref[type];
+        tr = $('<tr/>');
+        this.trHash[type] = tr;
+        trNodes.push(tr[0]);
+        renderMethodName = 'render' + capitaliseFirstLetter(type) + 'Content';
+        if (this[renderMethodName]) {
+          this[renderMethodName](tr);
+        }
+        if (prevRow) {
+          prevRow.trHash[type].after(tr);
+        } else {
+          tbody.prepend(tr);
+        }
+      }
+    }
+    this.trs = $(trNodes).on('click', '.fc-expander', proxy(this, 'toggleExpanded'));
+    return this.isRendered = true;
+  };
+
+
+  /*
+  	Unpopulates and removes all of this row's TRs from the DOM. Only for this single row. Not recursive.
+  	Will trigger "hidden".
+   */
+
+  RowParent.prototype.unrender = function() {
+    var ref, tr, type, unrenderMethodName;
+    if (this.isRendered) {
+      ref = this.trHash;
+      for (type in ref) {
+        tr = ref[type];
+        unrenderMethodName = 'unrender' + capitaliseFirstLetter(type) + 'Content';
+        if (this[unrenderMethodName]) {
+          this[unrenderMethodName](tr);
+        }
+      }
+      this.trHash = {};
+      this.trs.remove();
+      this.trs = $();
+      this.isRendered = false;
+      this.isShown = false;
+      return this.hidden();
+    }
+  };
+
+
+  /*
+  	Like unrender(), but does it for this row AND all descendants.
+  	NOTE: batchRows/unbatchRows should probably be called before this happens :(
+   */
+
+  RowParent.prototype.recursivelyUnrender = function() {
+    var child, j, len, ref, results;
+    this.unrender();
+    ref = this.children;
+    results = [];
+    for (j = 0, len = ref.length; j < len; j++) {
+      child = ref[j];
+      results.push(child.recursivelyUnrender());
+    }
+    return results;
+  };
+
+
+  /*
+  	A simple getter for retrieving a TR jQuery object of a certain row type
+   */
+
+  RowParent.prototype.getTr = function(type) {
+    return this.trHash[type];
+  };
+
+
+  /*
+  	Renders this row if not already rendered, making sure it is visible.
+  	Also renders descendants of this subtree, based on whether they are expanded or not.
+  	NOTE: If called externally, batchRows/unbatchRows should probably be called before this happens :(
+   */
+
+  RowParent.prototype.show = function() {
+    var child, j, len, ref, results;
+    if (!this.isShown) {
+      if (!this.isRendered) {
+        this.render();
+      } else {
+        this.trs.css('display', '');
+      }
+      if (this.ensureSegsRendered) {
+        this.ensureSegsRendered();
+      }
+      if (this.isExpanded) {
+        this.indicateExpanded();
+      } else {
+        this.indicateCollapsed();
+      }
+      this.isShown = true;
+      this.shown();
+      if (this.isExpanded) {
+        ref = this.children;
+        results = [];
+        for (j = 0, len = ref.length; j < len; j++) {
+          child = ref[j];
+          results.push(child.show());
+        }
+        return results;
+      }
+    }
+  };
+
+
+  /*
+  	Temporarily hides this node's TRs (if applicable) as well as all nodes in the subtree
+   */
+
+  RowParent.prototype.hide = function() {
+    var child, j, len, ref, results;
+    if (this.isShown) {
+      if (this.isRendered) {
+        this.trs.hide();
+      }
+      this.isShown = false;
+      this.hidden();
+      if (this.isExpanded) {
+        ref = this.children;
+        results = [];
+        for (j = 0, len = ref.length; j < len; j++) {
+          child = ref[j];
+          results.push(child.hide());
+        }
+        return results;
+      }
+    }
+  };
+
+
+  /*
+  	Reveals this node's children if they have not already been revealed. Changes any expander icon.
+   */
+
+  RowParent.prototype.expand = function() {
+    var child, j, len, ref;
+    if (!this.isExpanded) {
+      this.isExpanded = true;
+      this.indicateExpanded();
+      this.view.batchRows();
+      ref = this.children;
+      for (j = 0, len = ref.length; j < len; j++) {
+        child = ref[j];
+        child.show();
+      }
+      this.view.unbatchRows();
+      return this.animateExpand();
+    }
+  };
+
+
+  /*
+  	Hides this node's children if they are not already hidden. Changes any expander icon.
+   */
+
+  RowParent.prototype.collapse = function() {
+    var child, j, len, ref;
+    if (this.isExpanded) {
+      this.isExpanded = false;
+      this.indicateCollapsed();
+      this.view.batchRows();
+      ref = this.children;
+      for (j = 0, len = ref.length; j < len; j++) {
+        child = ref[j];
+        child.hide();
+      }
+      return this.view.unbatchRows();
+    }
+  };
+
+
+  /*
+  	Switches between expanded/collapsed states
+   */
+
+  RowParent.prototype.toggleExpanded = function() {
+    if (this.isExpanded) {
+      return this.collapse();
+    } else {
+      return this.expand();
+    }
+  };
+
+
+  /*
+  	Changes the expander icon to the "expanded" state
+   */
+
+  RowParent.prototype.indicateExpanded = function() {
+    return this.trs.find('.fc-expander .fc-icon').removeClass(this.getCollapsedIcon()).addClass(this.getExpandedIcon());
+  };
+
+
+  /*
+  	Changes the expander icon to the "collapsed" state
+   */
+
+  RowParent.prototype.indicateCollapsed = function() {
+    return this.trs.find('.fc-expander .fc-icon').removeClass(this.getExpandedIcon()).addClass(this.getCollapsedIcon());
+  };
+
+
+  /*
+   */
+
+  RowParent.prototype.enableExpanding = function() {
+    return this.trs.find('.fc-expander-space').addClass('fc-expander');
+  };
+
+
+  /*
+   */
+
+  RowParent.prototype.disableExpanding = function() {
+    return this.trs.find('.fc-expander-space').removeClass('fc-expander').find('.fc-icon').removeClass(this.getExpandedIcon()).removeClass(this.getCollapsedIcon());
+  };
+
+  RowParent.prototype.getExpandedIcon = function() {
+    return 'fc-icon-down-triangle';
+  };
+
+  RowParent.prototype.getCollapsedIcon = function() {
+    var dir;
+    dir = this.view.isRTL ? 'left' : 'right';
+    return 'fc-icon-' + dir + '-triangle';
+  };
+
+
+  /*
+  	Causes a slide-down CSS transition to demonstrate that the expand has happened
+   */
+
+  RowParent.prototype.animateExpand = function() {
+    var ref, ref1, trs;
+    trs = (ref = this.children[0]) != null ? (ref1 = ref.getLeadingRow()) != null ? ref1.trs : void 0 : void 0;
+    if (trs) {
+      trs.addClass('fc-collapsed');
+      setTimeout(function() {
+        trs.addClass('fc-transitioning');
+        return trs.removeClass('fc-collapsed');
+      });
+      return trs.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() {
+        return trs.removeClass('fc-transitioning');
+      });
+    }
+  };
+
+
+  /*
+  	Find each TRs "inner div" (div within first cell). This div controls each TRs height.
+  	Returns the max pixel height.
+   */
+
+  RowParent.prototype.getMaxTrInnerHeight = function() {
+    var max;
+    max = 0;
+    $.each(this.trHash, (function(_this) {
+      return function(type, tr) {
+        var innerEl;
+        innerEl = getOwnCells(tr).find('> div:not(.fc-cell-content):first');
+        return max = Math.max(innerEl.height(), max);
+      };
+    })(this));
+    return max;
+  };
+
+
+  /*
+  	Find each TRs "inner div" and sets all of their heights to the same value.
+   */
+
+  RowParent.prototype.setTrInnerHeight = function(height) {
+    return $.each(this.trHash, (function(_this) {
+      return function(type, tr) {
+        return getOwnCells(tr).find('> div:not(.fc-cell-content):first').height(height);
+      };
+    })(this));
+  };
+
+
+  /*
+  	Triggered when the current node has been shown (either freshly rendered or re-shown)
+  	when it had previously been unrendered or hidden. `shown` does not bubble up the hierarchy.
+   */
+
+  RowParent.prototype.shown = function() {
+    if (this.hasOwnRow) {
+      return this.rowShown(this);
+    }
+  };
+
+
+  /*
+  	Triggered when the current node has been hidden (either temporarily or permanently)
+  	when it had previously been shown. `hidden` does not bubble up the hierarchy.
+   */
+
+  RowParent.prototype.hidden = function() {
+    if (this.hasOwnRow) {
+      return this.rowHidden(this);
+    }
+  };
+
+
+  /*
+  	Just like `shown`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy.
+   */
+
+  RowParent.prototype.rowShown = function(row) {
+    return (this.parent || this.view).rowShown(row);
+  };
+
+
+  /*
+  	Just like `hidden`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy.
+   */
+
+  RowParent.prototype.rowHidden = function(row) {
+    return (this.parent || this.view).rowHidden(row);
+  };
+
+
+  /*
+  	Triggered when the current node has been added to the hierarchy. `added` does not bubble up.
+   */
+
+  RowParent.prototype.added = function() {
+    if (this.hasOwnRow) {
+      return this.rowAdded(this);
+    }
+  };
+
+
+  /*
+  	Triggered when the current node has been removed from the hierarchy. `removed` does not bubble up.
+   */
+
+  RowParent.prototype.removed = function() {
+    if (this.hasOwnRow) {
+      return this.rowRemoved(this);
+    }
+  };
+
+
+  /*
+  	Just like `added`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy.
+   */
+
+  RowParent.prototype.rowAdded = function(row) {
+    return (this.parent || this.view).rowAdded(row);
+  };
+
+
+  /*
+  	Just like `removed`, but only triggered for nodes that are actual rows. Bubbles up the hierarchy.
+   */
+
+  RowParent.prototype.rowRemoved = function(row) {
+    return (this.parent || this.view).rowRemoved(row);
+  };
+
+  return RowParent;
+
+})();
+
+
+/*
+An abstract node in a row-hierarchy tree that contains other nodes.
+Will have some sort of rendered label indicating the grouping,
+up to the subclass for determining what to do with it.
+ */
+
+RowGroup = (function(superClass) {
+  extend(RowGroup, superClass);
+
+  RowGroup.prototype.groupSpec = null;
+
+  RowGroup.prototype.groupValue = null;
+
+  function RowGroup(view, groupSpec1, groupValue1) {
+    this.groupSpec = groupSpec1;
+    this.groupValue = groupValue1;
+    RowGroup.__super__.constructor.apply(this, arguments);
+  }
+
+
+  /*
+  	Called when this row (if it renders a row) or a subrow is removed
+   */
+
+  RowGroup.prototype.rowRemoved = function(row) {
+    RowGroup.__super__.rowRemoved.apply(this, arguments);
+    if (row !== this && !this.children.length) {
+      return this.remove();
+    }
+  };
+
+
+  /*
+  	Renders the content wrapper element that will be inserted into this row's TD cell
+   */
+
+  RowGroup.prototype.renderGroupContentEl = function() {
+    var contentEl, filter;
+    contentEl = $('<div class="fc-cell-content" />').append(this.renderGroupTextEl());
+    filter = this.groupSpec.render;
+    if (typeof filter === 'function') {
+      contentEl = filter(contentEl, this.groupValue) || contentEl;
+    }
+    return contentEl;
+  };
+
+
+  /*
+  	Renders the text span element that will be inserted into this row's TD cell.
+  	Goes within the content element.
+   */
+
+  RowGroup.prototype.renderGroupTextEl = function() {
+    var filter, text;
+    text = this.groupValue || '';
+    filter = this.groupSpec.text;
+    if (typeof filter === 'function') {
+      text = filter(text) || text;
+    }
+    return $('<span class="fc-cell-text" />').text(text);
+  };
+
+  return RowGroup;
+
+})(RowParent);
+
+
+/*
+A row grouping that renders as a single solid row that spans width-wise (like a horizontal rule)
+ */
+
+HRowGroup = (function(superClass) {
+  extend(HRowGroup, superClass);
+
+  function HRowGroup() {
+    return HRowGroup.__super__.constructor.apply(this, arguments);
+  }
+
+  HRowGroup.prototype.hasOwnRow = true;
+
+
+  /*
+  	Renders this row's TR for the "spreadsheet" quadrant, the area with info about each resource
+   */
+
+  HRowGroup.prototype.renderSpreadsheetContent = function(tr) {
+    var contentEl;
+    contentEl = this.renderGroupContentEl();
+    contentEl.prepend('<span class="fc-expander">' + '<span class="fc-icon"></span>' + '</span>');
+    return $('<td class="fc-divider" />').attr('colspan', this.view.colSpecs.length).append($('<div/>').append(contentEl)).appendTo(tr);
+  };
+
+
+  /*
+  	Renders this row's TR for the quadrant that contains a resource's events
+   */
+
+  HRowGroup.prototype.renderEventContent = function(tr) {
+    return tr.append('<td class="fc-divider"> <div/> </td>');
+  };
+
+  return HRowGroup;
+
+})(RowGroup);
+
+
+/*
+A row grouping that renders as a tall multi-cell vertical span in the "spreadsheet" area
+ */
+
+VRowGroup = (function(superClass) {
+  extend(VRowGroup, superClass);
+
+  function VRowGroup() {
+    return VRowGroup.__super__.constructor.apply(this, arguments);
+  }
+
+  VRowGroup.prototype.rowspan = 0;
+
+  VRowGroup.prototype.leadingTr = null;
+
+  VRowGroup.prototype.groupTd = null;
+
+
+  /*
+  	Called when a row somewhere within the grouping is shown
+   */
+
+  VRowGroup.prototype.rowShown = function(row) {
+    this.rowspan += 1;
+    this.renderRowspan();
+    return VRowGroup.__super__.rowShown.apply(this, arguments);
+  };
+
+
+  /*
+  	Called when a row somewhere within the grouping is hidden
+   */
+
+  VRowGroup.prototype.rowHidden = function(row) {
+    this.rowspan -= 1;
+    this.renderRowspan();
+    return VRowGroup.__super__.rowHidden.apply(this, arguments);
+  };
+
+
+  /*
+  	Makes sure the groupTd has the correct rowspan / place in the DOM.
+  	PRECONDITION: in the case of multiple group nesting, a child's renderRowspan()
+  	will be called before the parent's renderRowspan().
+   */
+
+  VRowGroup.prototype.renderRowspan = function() {
+    var leadingTr;
+    if (this.rowspan) {
+      if (!this.groupTd) {
+        this.groupTd = $('<td class="' + this.view.widgetContentClass + '"/>').append(this.renderGroupContentEl());
+      }
+      this.groupTd.attr('rowspan', this.rowspan);
+      leadingTr = this.getLeadingRow().getTr('spreadsheet');
+      if (leadingTr !== this.leadingTr) {
+        if (leadingTr) {
+          leadingTr.prepend(this.groupTd);
+        }
+        return this.leadingTr = leadingTr;
+      }
+    } else {
+      if (this.groupTd) {
+        this.groupTd.remove();
+        this.groupTd = null;
+      }
+      return this.leadingTr = null;
+    }
+  };
+
+  return VRowGroup;
+
+})(RowGroup);
+
+EventRow = (function(superClass) {
+  extend(EventRow, superClass);
+
+  function EventRow() {
+    return EventRow.__super__.constructor.apply(this, arguments);
+  }
+
+  EventRow.prototype.hasOwnRow = true;
+
+  EventRow.prototype.segContainerEl = null;
+
+  EventRow.prototype.segContainerHeight = null;
+
+  EventRow.prototype.innerEl = null;
+
+  EventRow.prototype.bgSegContainerEl = null;
+
+  EventRow.prototype.isSegsRendered = false;
+
+  EventRow.prototype.isBusinessHourSegsRendered = false;
+
+  EventRow.prototype.businessHourSegs = null;
+
+  EventRow.prototype.bgSegs = null;
+
+  EventRow.prototype.fgSegs = null;
+
+  EventRow.prototype.renderEventContent = function(tr) {
+    tr.html('<td class="' + this.view.widgetContentClass + '"> <div> <div class="fc-event-container" /> </div> </td>');
+    this.segContainerEl = tr.find('.fc-event-container');
+    this.innerEl = this.bgSegContainerEl = tr.find('td > div');
+    return this.ensureSegsRendered();
+  };
+
+  EventRow.prototype.ensureSegsRendered = function() {
+    if (!this.isSegsRendered) {
+      this.ensureBusinessHourSegsRendered();
+      if (this.bgSegs) {
+        this.view.timeGrid.renderFillInContainer('bgEvent', this, this.bgSegs);
+      }
+      if (this.fgSegs) {
+        this.view.timeGrid.renderFgSegsInContainers([[this, this.fgSegs]]);
+      }
+      return this.isSegsRendered = true;
+    }
+  };
+
+  EventRow.prototype.ensureBusinessHourSegsRendered = function() {
+    if (this.businessHourSegs && !this.isBusinessHourSegsRendered) {
+      this.view.timeGrid.renderFillInContainer('businessHours', this, this.businessHourSegs, 'bgevent');
+      return this.isBusinessHourSegsRendered = true;
+    }
+  };
+
+  EventRow.prototype.unrenderEventContent = function() {
+    this.clearBusinessHourSegs();
+    this.bgSegs = null;
+    this.fgSegs = null;
+    return this.isSegsRendered = false;
+  };
+
+  EventRow.prototype.clearBusinessHourSegs = function() {
+    var j, len, ref, seg;
+    if (this.businessHourSegs) {
+      ref = this.businessHourSegs;
+      for (j = 0, len = ref.length; j < len; j++) {
+        seg = ref[j];
+        if (seg.el) {
+          seg.el.remove();
+        }
+      }
+      this.businessHourSegs = null;
+    }
+    return this.isBusinessHourSegsRendered = false;
+  };
+
+  return EventRow;
+
+})(RowParent);
+
+
+/*
+A row that renders information about a particular resource, as well as it events (handled by superclass)
+ */
+
+ResourceRow = (function(superClass) {
+  extend(ResourceRow, superClass);
+
+  ResourceRow.prototype.resource = null;
+
+  function ResourceRow(view, resource1) {
+    this.resource = resource1;
+    ResourceRow.__super__.constructor.apply(this, arguments);
+  }
+
+
+  /*
+  	Called when a row in the tree has been added
+   */
+
+  ResourceRow.prototype.rowAdded = function(row) {
+    ResourceRow.__super__.rowAdded.apply(this, arguments);
+    if (row !== this && this.isRendered) {
+      if (this.children.length === 1) {
+        this.enableExpanding();
+        if (this.isExpanded) {
+          return this.indicateExpanded();
+        } else {
+          return this.indicateCollapsed();
+        }
+      }
+    }
+  };
+
+
+  /*
+  	Called when a row in the tree has been removed
+   */
+
+  ResourceRow.prototype.rowRemoved = function(row) {
+    ResourceRow.__super__.rowRemoved.apply(this, arguments);
+    if (row !== this && this.isRendered) {
+      if (!this.children.length) {
+        return this.disableExpanding();
+      }
+    }
+  };
+
+  ResourceRow.prototype.render = function() {
+    ResourceRow.__super__.render.apply(this, arguments);
+    if (this.children.length > 0) {
+      this.enableExpanding();
+    } else {
+      this.disableExpanding();
+    }
+    return this.view.publiclyTrigger('resourceRender', this.resource, this.resource, this.getTr('spreadsheet').find('> td'), this.getTr('event').find('> td'));
+  };
+
+  ResourceRow.prototype.renderEventContent = function(tr) {
+    ResourceRow.__super__.renderEventContent.apply(this, arguments);
+    return tr.attr('data-resource-id', this.resource.id);
+  };
+
+
+  /*
+  	Populates the TR with cells containing data about the resource
+   */
+
+  ResourceRow.prototype.renderSpreadsheetContent = function(tr) {
+    var colSpec, contentEl, input, j, len, ref, resource, td, text;
+    resource = this.resource;
+    ref = this.view.colSpecs;
+    for (j = 0, len = ref.length; j < len; j++) {
+      colSpec = ref[j];
+      if (colSpec.group) {
+        continue;
+      }
+      input = colSpec.field ? resource[colSpec.field] || null : resource;
+      text = typeof colSpec.text === 'function' ? colSpec.text(resource, input) : input;
+      contentEl = $('<div class="fc-cell-content">' + (colSpec.isMain ? this.renderGutterHtml() : '') + '<span class="fc-cell-text">' + (text ? htmlEscape(text) : '&nbsp;') + '</span>' + '</div>');
+      if (typeof colSpec.render === 'function') {
+        contentEl = colSpec.render(resource, contentEl, input) || contentEl;
+      }
+      td = $('<td class="' + this.view.widgetContentClass + '"/>').append(contentEl);
+      if (colSpec.isMain) {
+        td.wrapInner('<div/>');
+      }
+      tr.append(td);
+    }
+    return tr.attr('data-resource-id', resource.id);
+  };
+
+
+  /*
+  	Renders the HTML responsible for the subrow expander area,
+  	as well as the space before it (used to align expanders of similar depths)
+   */
+
+  ResourceRow.prototype.renderGutterHtml = function() {
+    var html, i, j, ref;
+    html = '';
+    for (i = j = 0, ref = this.depth; j < ref; i = j += 1) {
+      html += '<span class="fc-icon"/>';
+    }
+    html += '<span class="fc-expander-space">' + '<span class="fc-icon"></span>' + '</span>';
+    return html;
+  };
+
+  return ResourceRow;
+
+})(EventRow);
+
+FC.views.timeline.resourceClass = ResourceTimelineView;
+
+ResourceAgendaView = (function(superClass) {
+  extend(ResourceAgendaView, superClass);
+
+  function ResourceAgendaView() {
+    return ResourceAgendaView.__super__.constructor.apply(this, arguments);
+  }
+
+  ResourceAgendaView.mixin(VertResourceViewMixin);
+
+  ResourceAgendaView.prototype.timeGridClass = ResourceTimeGrid;
+
+  ResourceAgendaView.prototype.dayGridClass = ResourceDayGrid;
+
+  ResourceAgendaView.prototype.renderHead = function() {
+    ResourceAgendaView.__super__.renderHead.apply(this, arguments);
+    return this.timeGrid.processHeadResourceEls(this.headContainerEl);
+  };
+
+  ResourceAgendaView.prototype.setResourcesOnGrids = function(resources) {
+    this.timeGrid.setResources(resources);
+    if (this.dayGrid) {
+      return this.dayGrid.setResources(resources);
+    }
+  };
+
+  ResourceAgendaView.prototype.unsetResourcesOnGrids = function() {
+    this.timeGrid.unsetResources();
+    if (this.dayGrid) {
+      return this.dayGrid.unsetResources();
+    }
+  };
+
+  return ResourceAgendaView;
+
+})(FC.AgendaView);
+
+FC.views.agenda.queryResourceClass = function(viewSpec) {
+  var ref;
+  if ((ref = viewSpec.options.groupByResource || viewSpec.options.groupByDateAndResource) != null ? ref : viewSpec.duration && viewSpec.duration.as('days') === 1) {
+    return ResourceAgendaView;
+  }
+};
+
+ResourceBasicView = (function(superClass) {
+  extend(ResourceBasicView, superClass);
+
+  function ResourceBasicView() {
+    return ResourceBasicView.__super__.constructor.apply(this, arguments);
+  }
+
+  ResourceBasicView.mixin(VertResourceViewMixin);
+
+  ResourceBasicView.prototype.dayGridClass = ResourceDayGrid;
+
+  ResourceBasicView.prototype.renderHead = function() {
+    ResourceBasicView.__super__.renderHead.apply(this, arguments);
+    return this.dayGrid.processHeadResourceEls(this.headContainerEl);
+  };
+
+  ResourceBasicView.prototype.setResourcesOnGrids = function(resources) {
+    return this.dayGrid.setResources(resources);
+  };
+
+  ResourceBasicView.prototype.unsetResourcesOnGrids = function() {
+    return this.dayGrid.unsetResources();
+  };
+
+  return ResourceBasicView;
+
+})(FC.BasicView);
+
+ResourceMonthView = (function(superClass) {
+  extend(ResourceMonthView, superClass);
+
+  function ResourceMonthView() {
+    return ResourceMonthView.__super__.constructor.apply(this, arguments);
+  }
+
+  ResourceMonthView.mixin(VertResourceViewMixin);
+
+  ResourceMonthView.prototype.dayGridClass = ResourceDayGrid;
+
+  ResourceMonthView.prototype.renderHead = function() {
+    ResourceMonthView.__super__.renderHead.apply(this, arguments);
+    return this.dayGrid.processHeadResourceEls(this.headContainerEl);
+  };
+
+  ResourceMonthView.prototype.setResourcesOnGrids = function(resources) {
+    return this.dayGrid.setResources(resources);
+  };
+
+  ResourceMonthView.prototype.unsetResourcesOnGrids = function() {
+    return this.dayGrid.unsetResources();
+  };
+
+  return ResourceMonthView;
+
+})(FC.MonthView);
+
+FC.views.basic.queryResourceClass = function(viewSpec) {
+  var ref;
+  if ((ref = viewSpec.options.groupByResource || viewSpec.options.groupByDateAndResource) != null ? ref : viewSpec.duration && viewSpec.duration.as('days') === 1) {
+    return ResourceBasicView;
+  }
+};
+
+FC.views.month.queryResourceClass = function(viewSpec) {
+  if (viewSpec.options.groupByResource || viewSpec.options.groupByDateAndResource) {
+    return ResourceMonthView;
+  }
+};
+
+RELEASE_DATE = '2017-04-27';
+
+UPGRADE_WINDOW = {
+  years: 1,
+  weeks: 1
+};
+
+LICENSE_INFO_URL = 'http://fullcalendar.io/scheduler/license/';
+
+PRESET_LICENSE_KEYS = ['GPL-My-Project-Is-Open-Source', 'CC-Attribution-NonCommercial-NoDerivatives'];
+
+processLicenseKey = function(key, containerEl) {
+  if (!isImmuneUrl(window.location.href) && !isValidKey(key)) {
+    if (!detectWarningInContainer(containerEl)) {
+      return renderingWarningInContainer('Please use a valid license key. <a href="' + LICENSE_INFO_URL + '">More Info</a>', containerEl);
+    }
+  }
+};
+
+
+/*
+This decryption is not meant to be bulletproof. Just a way to remind about an upgrade.
+ */
+
+isValidKey = function(key) {
+  var minPurchaseDate, parts, purchaseDate, releaseDate;
+  if ($.inArray(key, PRESET_LICENSE_KEYS) !== -1) {
+    return true;
+  }
+  parts = (key || '').match(/^(\d+)\-fcs\-(\d+)$/);
+  if (parts && parts[1].length === 10) {
+    purchaseDate = moment.utc(parseInt(parts[2]) * 1000);
+    releaseDate = moment.utc(FC.mockSchedulerReleaseDate || RELEASE_DATE);
+    if (releaseDate.isValid()) {
+      minPurchaseDate = releaseDate.clone().subtract(UPGRADE_WINDOW);
+      if (purchaseDate.isAfter(minPurchaseDate)) {
+        return true;
+      }
+    }
+  }
+  return false;
+};
+
+isImmuneUrl = function(url) {
+  return Boolean(url.match(/\w+\:\/\/fullcalendar\.io\/|\/demos\/[\w-]+\.html$/));
+};
+
+renderingWarningInContainer = function(messageHtml, containerEl) {
+  return containerEl.append($('<div class="fc-license-message" />').html(messageHtml));
+};
+
+detectWarningInContainer = function(containerEl) {
+  return containerEl.find('.fc-license-message').length >= 1;
+};
+
+});
diff --git a/smash/web/static/fullcalendar-scheduler/scheduler.min.css b/smash/web/static/fullcalendar-scheduler/scheduler.min.css
new file mode 100644
index 0000000000000000000000000000000000000000..62478e0ed958d7b5ceedc9f4e53b419f76e4cdae
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/scheduler.min.css
@@ -0,0 +1,5 @@
+/*!
+ * FullCalendar Scheduler v1.6.2
+ * Docs & License: https://fullcalendar.io/scheduler/
+ * (c) 2017 Adam Shaw
+ */.fc-resource-area .fc-cell-content,.fc-timeline .fc-cell-text{padding-left:4px;padding-right:4px}.fc-resource-area th>div,.fc-scroller-canvas,.fc-scroller-canvas>.fc-content,.fc-scroller-clip{position:relative}.fc-scroller-clip,.fc-timeline .fc-cell-content,tr.fc-collapsed>td,tr.fc-transitioning>td{overflow:hidden}.fc-no-scrollbars{background:rgba(255,255,255,0)}.fc-timeline .fc-body .fc-divider.ui-widget-header,.fc-timeline .fc-body .ui-widget-content{background-image:none}.fc-no-scrollbars::-webkit-scrollbar{width:0;height:0}.fc-scroller-canvas{box-sizing:border-box;min-height:100%}.fc-scroller-canvas>.fc-bg{z-index:1}.fc-scroller-canvas>.fc-content{z-index:2;border-style:solid;border-width:0}.ui-widget .fc-scroller-canvas>.fc-content{border-color:transparent}.fc-scroller-canvas.fc-gutter-left>.fc-content{border-left-width:1px;margin-left:-1px}.fc-scroller-canvas.fc-gutter-right>.fc-content{border-right-width:1px;margin-right:-1px}.fc-scroller-canvas.fc-gutter-top>.fc-content{border-top-width:1px;margin-top:-1px}.fc-rtl .fc-timeline{direction:rtl}.fc-timeline .fc-divider{width:3px;border-style:double}.fc-timeline .fc-head>tr>.fc-divider{border-bottom:0}.fc-timeline .fc-body>tr>.fc-divider{border-top:0}.fc-scrolled .fc-head .fc-scroller{z-index:2}.fc-timeline.fc-scrolled .fc-head .fc-scroller{box-shadow:0 3px 4px rgba(0,0,0,.075)}.fc-timeline .fc-body .fc-scroller{z-index:1}.fc-timeline .fc-scroller-canvas>div>div>table,.fc-timeline .fc-scroller-canvas>div>table{border-style:hidden}.fc-timeline .fc-scroller-canvas>.fc-content>.fc-rows>table{border-bottom-style:none}.fc-timeline td,.fc-timeline th{white-space:nowrap}.fc-timeline .fc-col-resizer{cursor:col-resize}.fc-timeline th{vertical-align:middle}.fc-timeline .fc-head .fc-cell-content{padding-top:3px;padding-bottom:3px}.fc-resource-area{width:30%}.fc-resource-area col{width:40%;min-width:70px}.fc-resource-area col.fc-main-col{width:60%}.fc-flat .fc-expander-space{display:none}.fc-ltr .fc-resource-area tr>*{text-align:left}.fc-rtl .fc-resource-area tr>*{text-align:right}.fc-resource-area .fc-super th{text-align:center}.fc-resource-area th .fc-cell-content{position:relative;z-index:1}.fc-resource-area th .fc-col-resizer,.fc-time-area .fc-bgevent,.fc-time-area .fc-highlight,.fc-time-area .fc-slats{position:absolute;top:0;bottom:0}.fc-resource-area th .fc-col-resizer{z-index:2;width:5px}.fc-ltr .fc-resource-area th .fc-col-resizer{right:-3px}.fc-rtl .fc-resource-area th .fc-col-resizer{left:-3px}tr.fc-transitioning>td>div{transition:margin-top .2s}tr.fc-collapsed>td>div{margin-top:-10px}.fc-body .fc-resource-area .fc-cell-content{padding-top:8px;padding-bottom:8px}.fc-no-overlap .fc-body .fc-resource-area .fc-cell-content{padding-top:5px;padding-bottom:5px}.fc-resource-area .fc-icon{width:1em;font-size:.9em;vertical-align:middle;margin-top:-1%}.fc-resource-area .fc-expander{cursor:pointer;color:#666}.fc-time-area col{min-width:2.2em}.fc-ltr .fc-time-area .fc-chrono th{text-align:left}.fc-rtl .fc-time-area .fc-chrono th{text-align:right}.fc-time-area .fc-slats{z-index:1;left:0;right:0}.fc-time-area .fc-slats table{height:100%}.fc-time-area .fc-slats .fc-minor{border-style:dotted}.fc-time-area .fc-slats td{border-width:0 1px}.fc-ltr .fc-time-area .fc-slats td{border-right-width:0}.fc-rtl .fc-time-area .fc-slats td{border-left-width:0}.fc-time-area .fc-bgevent-container,.fc-time-area .fc-highlight-container{position:absolute;z-index:2;top:0;bottom:0;width:0}.fc-ltr .fc-time-area .fc-bgevent-container,.fc-ltr .fc-time-area .fc-helper-container,.fc-ltr .fc-time-area .fc-highlight-container{left:0}.fc-rtl .fc-time-area .fc-bgevent-container,.fc-rtl .fc-time-area .fc-helper-container,.fc-rtl .fc-time-area .fc-highlight-container{right:0}.fc-time-area .fc-rows{position:relative;z-index:3}.fc-time-area .fc-rows .ui-widget-content{background:0 0}.fc-time-area .fc-rows td>div{position:relative}.fc-time-area .fc-rows .fc-bgevent-container,.fc-time-area .fc-rows .fc-highlight-container{z-index:1}.fc-time-area .fc-event-container{position:relative;z-index:2;width:0}.fc-time-area .fc-helper-container{position:absolute;z-index:3;top:0}.fc-time-area .fc-event-container{padding-bottom:8px;top:-1px}.fc-time-area tr:first-child .fc-event-container{top:0}.fc-no-overlap .fc-time-area .fc-event-container{padding-bottom:0;top:0}.fc-timeline .fc-now-indicator{z-index:3;top:0}.fc-time-area .fc-now-indicator-arrow{margin:0 -6px;border-width:6px 5px 0;border-left-color:transparent;border-right-color:transparent}.fc-time-area .fc-now-indicator-line{margin:0 -1px;bottom:0;border-left-width:1px}.fc-timeline-event{position:absolute;border-radius:0;padding:2px 0;margin-bottom:1px}.fc-no-overlap .fc-timeline-event{padding:5px 0;margin-bottom:0}.fc-ltr .fc-timeline-event{margin-right:1px}.fc-rtl .fc-timeline-event{margin-left:1px}.fc-timeline-event .fc-content{padding:0 1px;white-space:nowrap;overflow:hidden}.fc-timeline-event .fc-time{font-weight:700;padding:0 1px}.fc-rtl .fc-timeline-event .fc-time{display:inline-block}.fc-timeline-event .fc-title{padding:0 1px}.fc-timeline-event.fc-selected .fc-bg{display:none}.fc-ltr .fc-timeline-event .fc-title{padding-left:10px;margin-left:-8px}.fc-rtl .fc-timeline-event .fc-title{padding-right:10px;margin-right:-8px}.fc-ltr .fc-timeline-event.fc-not-start .fc-title{margin-left:-2px}.fc-rtl .fc-timeline-event.fc-not-start .fc-title{margin-right:-2px}.fc-body .fc-time-area .fc-following,.fc-timeline-event.fc-not-start .fc-title{position:relative}.fc-body .fc-time-area .fc-following:before,.fc-timeline-event.fc-not-start .fc-title:before{content:"";position:absolute;top:50%;margin-top:-5px;border:5px solid #000;border-top-color:transparent;border-bottom-color:transparent;opacity:.5}.fc-ltr .fc-body .fc-time-area .fc-following:before,.fc-ltr .fc-timeline-event.fc-not-start .fc-title:before{border-left:0;left:2px}.fc-rtl .fc-body .fc-time-area .fc-following:before,.fc-rtl .fc-timeline-event.fc-not-start .fc-title:before{border-right:0;right:2px}.fc-license-message{position:absolute;z-index:99999;bottom:1px;left:1px;background:#eee;border-color:#ddd;border-style:solid;border-width:1px 1px 0 0;padding:2px 4px;font-size:12px;border-top-right-radius:3px}
\ No newline at end of file
diff --git a/smash/web/static/fullcalendar-scheduler/scheduler.min.js b/smash/web/static/fullcalendar-scheduler/scheduler.min.js
new file mode 100644
index 0000000000000000000000000000000000000000..549ea14625d0ed91494147410d73f6497474d45a
--- /dev/null
+++ b/smash/web/static/fullcalendar-scheduler/scheduler.min.js
@@ -0,0 +1,9 @@
+/*!
+FullCalendar Scheduler v1.6.2
+Docs & License: https://fullcalendar.io/scheduler/
+(c) 2017 Adam Shaw
+ */
+!function(e){"function"==typeof define&&define.amd?define(["jquery","moment","fullcalendar"],e):"object"==typeof exports?module.exports=e(require("jquery"),require("moment"),require("fullcalendar")):e(jQuery,moment)}(function(e,t){var r,o,s,n,i,l,u,h,c,a,p,d,f,g,y,v,R,w,m,S,b,C,E,H,T,_,I,D,x,G,B,F,W,M,L,z,k,P,O,A,q,N,V,U,j,Y,Q,X,$,K,J,Z,ee,te,re,oe,se,ne,ie,le,ue,he,ce,ae,pe,de,fe,ge,ye,ve,Re,we,me,Se,be,Ce,Ee,He,Te,_e,Ie,De,xe,Ge,Be,Fe,We,Me,Le,ze,ke,Pe,Oe,Ae,qe,Ne,Ve,Ue=function(e,t){function r(){this.constructor=e}for(var o in t)je.call(t,o)&&(e[o]=t[o]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},je={}.hasOwnProperty,Ye=[].indexOf||function(e){for(var t=0,r=this.length;t<r;t++)if(t in this&&this[t]===e)return t;return-1},Qe=[].slice;return d=e.fullCalendar,d.schedulerVersion="1.6.2",9!==d.internalApiVersion?void d.warn("v"+d.schedulerVersion+" of FullCalendar Scheduler is incompatible with v"+d.version+" of the core.\nPlease see http://fullcalendar.io/support/ for more information."):(o=d.Calendar,n=d.Class,K=d.View,f=d.Grid,be=d.intersectRanges,ue=d.debounce,He=d.isInt,we=d.getScrollbarWidths,h=d.DragListener,Se=d.htmlEscape,re=d.computeGreatestUnit,ke=d.proxy,ee=d.capitaliseFirstLetter,Z=d.applyAll,c=d.EmitterMixin,v=d.ListenerMixin,pe=d.durationHasTime,ae=d.divideRangeByDuration,ce=d.divideDurationByDuration,Ie=d.multiplyDuration,Le=d.parseFieldSpecs,te=d.compareByFieldSpecs,de=d.flexibleCompare,Ce=d.intersectRects,l=d.CoordCache,fe=d.getContentRect,ge=d.getOuterRect,ie=d.createObject,C=d.Promise,U=d.TaskQueue,ye=function(e){return e.find("> td").filter(function(e,t){return t.rowSpan<=1})},a=function(t){function r(){r.__super__.constructor.apply(this,arguments),this.requestMovingEnd=ue(this.reportMovingEnd,500)}var o,s;return Ue(r,t),r.mixin(c),r.mixin(v),r.prototype.canvas=null,r.prototype.isScrolling=!1,r.prototype.isTouching=!1,r.prototype.isTouchedEver=!1,r.prototype.isMoving=!1,r.prototype.isTouchScrollEnabled=!0,r.prototype.preventTouchScrollHandler=null,r.prototype.render=function(){return r.__super__.render.apply(this,arguments),this.canvas&&(this.canvas.render(),this.canvas.el.appendTo(this.scrollEl)),this.bindHandlers()},r.prototype.destroy=function(){return r.__super__.destroy.apply(this,arguments),this.unbindHandlers()},r.prototype.disableTouchScroll=function(){return this.isTouchScrollEnabled=!1,this.bindPreventTouchScroll()},r.prototype.enableTouchScroll=function(){if(this.isTouchScrollEnabled=!0,!this.isTouching)return this.unbindPreventTouchScroll()},r.prototype.bindPreventTouchScroll=function(){if(!this.preventTouchScrollHandler)return this.scrollEl.on("touchmove",this.preventTouchScrollHandler=d.preventDefault)},r.prototype.unbindPreventTouchScroll=function(){if(this.preventTouchScrollHandler)return this.scrollEl.off("touchmove",this.preventTouchScrollHandler),this.preventTouchScrollHandler=null},r.prototype.bindHandlers=function(){return this.listenTo(this.scrollEl,{scroll:this.reportScroll,touchstart:this.reportTouchStart,touchend:this.reportTouchEnd})},r.prototype.unbindHandlers=function(){return this.stopListeningTo(this.scrollEl)},r.prototype.reportScroll=function(){return this.isScrolling||this.reportScrollStart(),this.trigger("scroll"),this.isMoving=!0,this.requestMovingEnd()},r.prototype.reportScrollStart=function(){if(!this.isScrolling)return this.isScrolling=!0,this.trigger("scrollStart",this.isTouching)},r.prototype.requestMovingEnd=null,r.prototype.reportMovingEnd=function(){if(this.isMoving=!1,!this.isTouching)return this.reportScrollEnd()},r.prototype.reportScrollEnd=function(){if(this.isScrolling)return this.trigger("scrollEnd"),this.isScrolling=!1},r.prototype.reportTouchStart=function(){return this.isTouching=!0,this.isTouchedEver=!0},r.prototype.reportTouchEnd=function(){if(this.isTouching&&(this.isTouching=!1,this.isTouchScrollEnabled&&this.unbindPreventTouchScroll(),!this.isMoving))return this.reportScrollEnd()},r.prototype.getScrollLeft=function(){var e,t,r;if(e=this.scrollEl.css("direction"),t=this.scrollEl[0],r=t.scrollLeft,"rtl"===e)switch(s){case"positive":r=r+t.clientWidth-t.scrollWidth;break;case"reverse":r=-r}return r},r.prototype.setScrollLeft=function(e){var t,r;if(t=this.scrollEl.css("direction"),r=this.scrollEl[0],"rtl"===t)switch(s){case"positive":e=e-r.clientWidth+r.scrollWidth;break;case"reverse":e=-e}return r.scrollLeft=e},r.prototype.getScrollFromLeft=function(){var e,t,r;if(e=this.scrollEl.css("direction"),t=this.scrollEl[0],r=t.scrollLeft,"rtl"===e)switch(s){case"negative":r=r-t.clientWidth+t.scrollWidth;break;case"reverse":r=-r-t.clientWidth+t.scrollWidth}return r},r.prototype.getNativeScrollLeft=function(){return this.scrollEl[0].scrollLeft},r.prototype.setNativeScrollLeft=function(e){return this.scrollEl[0].scrollLeft=e},s=null,o=function(){var t,r,o;return t=e('<div style=" position: absolute top: -1000px; width: 1px; height: 1px; overflow: scroll; direction: rtl; font-size: 14px; ">A</div>').appendTo("body"),r=t[0],o=r.scrollLeft>0?"positive":(r.scrollLeft=1,t.scrollLeft>0?"reverse":"negative"),t.remove(),o},e(function(){return s=o()}),r}(d.Scroller),i=function(t){function r(){r.__super__.constructor.apply(this,arguments),"clipped-scroll"===this.overflowX&&(this.overflowX="scroll",this.isHScrollbarsClipped=!0),"clipped-scroll"===this.overflowY&&(this.overflowY="scroll",this.isVScrollbarsClipped=!0)}return Ue(r,t),r.prototype.isHScrollbarsClipped=!1,r.prototype.isVScrollbarsClipped=!1,r.prototype.renderEl=function(){var t;return t=r.__super__.renderEl.apply(this,arguments),e('<div class="fc-scroller-clip" />').append(t)},r.prototype.updateSize=function(){var e,t,r;return t=this.scrollEl,r=we(t),e={marginLeft:0,marginRight:0,marginTop:0,marginBottom:0},this.isHScrollbarsClipped&&(e.marginTop=-r.top,e.marginBottom=-r.bottom),this.isVScrollbarsClipped&&(e.marginLeft=-r.left,e.marginRight=-r.right),t.css(e),t.toggleClass("fc-no-scrollbars",(this.isHScrollbarsClipped||"hidden"===this.overflowX)&&(this.isVScrollbarsClipped||"hidden"===this.overflowY)&&!(r.top||r.bottom||r.left||r.right))},r.prototype.getScrollbarWidths=function(){var e;return e=we(this.scrollEl),this.isHScrollbarsClipped&&(e.top=0,e.bottom=0),this.isVScrollbarsClipped&&(e.left=0,e.right=0),e},r}(a),N=function(){function t(){this.gutters={}}return t.prototype.el=null,t.prototype.contentEl=null,t.prototype.bgEl=null,t.prototype.gutters=null,t.prototype.width=null,t.prototype.minWidth=null,t.prototype.render=function(){return this.el=e('<div class="fc-scroller-canvas"> <div class="fc-content"></div> <div class="fc-bg"></div> </div>'),this.contentEl=this.el.find(".fc-content"),this.bgEl=this.el.find(".fc-bg")},t.prototype.setGutters=function(t){return t?e.extend(this.gutters,t):this.gutters={},this.updateSize()},t.prototype.setWidth=function(e){return this.width=e,this.updateSize()},t.prototype.setMinWidth=function(e){return this.minWidth=e,this.updateSize()},t.prototype.clearWidth=function(){return this.width=null,this.minWidth=null,this.updateSize()},t.prototype.updateSize=function(){var e;return e=this.gutters,this.el.toggleClass("fc-gutter-left",Boolean(e.left)).toggleClass("fc-gutter-right",Boolean(e.right)).toggleClass("fc-gutter-top",Boolean(e.top)).toggleClass("fc-gutter-bottom",Boolean(e.bottom)).css({paddingLeft:e.left||"",paddingRight:e.right||"",paddingTop:e.top||"",paddingBottom:e.bottom||"",width:null!=this.width?this.width+(e.left||0)+(e.right||0):"",minWidth:null!=this.minWidth?this.minWidth+(e.left||0)+(e.right||0):""}),this.bgEl.css({left:e.left||"",right:e.right||"",top:e.top||"",bottom:e.bottom||""})},t}(),q=function(){function e(e,t){var r,o,s,n;for(this.axis=e,this.scrollers=t,s=this.scrollers,r=0,o=s.length;r<o;r++)n=s[r],this.initScroller(n)}return e.prototype.axis=null,e.prototype.scrollers=null,e.prototype.masterScroller=null,e.prototype.initScroller=function(e){return e.scrollEl.on("wheel mousewheel DomMouseScroll MozMousePixelScroll",function(t){return function(){t.assignMasterScroller(e)}}(this)),e.on("scrollStart",function(t){return function(){if(!t.masterScroller)return t.assignMasterScroller(e)}}(this)).on("scroll",function(t){return function(){var r,o,s,n,i;if(e===t.masterScroller){for(n=t.scrollers,i=[],r=0,o=n.length;r<o;r++)if(s=n[r],s!==e)switch(t.axis){case"horizontal":i.push(s.setNativeScrollLeft(e.getNativeScrollLeft()));break;case"vertical":i.push(s.setScrollTop(e.getScrollTop()));break;default:i.push(void 0)}else i.push(void 0);return i}}}(this)).on("scrollEnd",function(t){return function(){if(e===t.masterScroller)return t.unassignMasterScroller()}}(this))},e.prototype.assignMasterScroller=function(e){var t,r,o,s;for(this.unassignMasterScroller(),this.masterScroller=e,s=this.scrollers,t=0,r=s.length;t<r;t++)o=s[t],o!==e&&o.disableTouchScroll()},e.prototype.unassignMasterScroller=function(){var e,t,r,o;if(this.masterScroller){for(o=this.scrollers,e=0,t=o.length;e<t;e++)r=o[e],r.enableTouchScroll();this.masterScroller=null}},e.prototype.update=function(){var e,t,r,o,s,n,i,l,u,h,c,a,p;for(e=function(){var e,t,r,o;for(r=this.scrollers,o=[],e=0,t=r.length;e<t;e++)a=r[e],o.push(a.getScrollbarWidths());return o}.call(this),l=u=h=i=0,r=0,s=e.length;r<s;r++)p=e[r],l=Math.max(l,p.left),u=Math.max(u,p.right),h=Math.max(h,p.top),i=Math.max(i,p.bottom);for(c=this.scrollers,t=o=0,n=c.length;o<n;t=++o)a=c[t],p=e[t],a.canvas.setGutters("horizontal"===this.axis?{left:l-p.left,right:u-p.right}:{top:h-p.top,bottom:i-p.bottom})},e}(),O=function(){function t(e,t){this.allowPointerEvents=null!=t&&t,this.scroller=e,this.sprites=[],e.on("scroll",function(t){return function(){return e.isTouchedEver?(t.isTouch=!0,t.isForcedRelative=!0):(t.isTouch=!1,t.isForcedRelative=!1,t.handleScroll())}}(this)),e.on("scrollEnd",function(e){return function(){return e.handleScroll()}}(this))}return t.prototype.scroller=null,t.prototype.scrollbarWidths=null,t.prototype.sprites=null,t.prototype.viewportRect=null,t.prototype.contentOffset=null,t.prototype.isHFollowing=!0,t.prototype.isVFollowing=!1,t.prototype.allowPointerEvents=!1,t.prototype.containOnNaturalLeft=!1,t.prototype.containOnNaturalRight=!1,t.prototype.minTravel=0,t.prototype.isTouch=!1,t.prototype.isForcedRelative=!1,t.prototype.setSprites=function(t){var r,o,s;if(this.clearSprites(),t instanceof e)return this.sprites=function(){var r,o,n;for(n=[],r=0,o=t.length;r<o;r++)s=t[r],n.push(new A(e(s),this));return n}.call(this);for(r=0,o=t.length;r<o;r++)s=t[r],s.follower=this;return this.sprites=t},t.prototype.clearSprites=function(){var e,t,r,o;for(r=this.sprites,e=0,t=r.length;e<t;e++)o=r[e],o.clear();return this.sprites=[]},t.prototype.handleScroll=function(){return this.updateViewport(),this.updatePositions()},t.prototype.cacheDimensions=function(){var e,t,r,o;for(this.updateViewport(),this.scrollbarWidths=this.scroller.getScrollbarWidths(),this.contentOffset=this.scroller.canvas.el.offset(),r=this.sprites,e=0,t=r.length;e<t;e++)o=r[e],o.cacheDimensions()},t.prototype.updateViewport=function(){var e,t,r;return t=this.scroller,e=t.getScrollFromLeft(),r=t.getScrollTop(),this.viewportRect={left:e,right:e+t.getClientWidth(),top:r,bottom:r+t.getClientHeight()}},t.prototype.forceRelative=function(){var e,t,r,o,s;if(!this.isForcedRelative){for(this.isForcedRelative=!0,r=this.sprites,o=[],e=0,t=r.length;e<t;e++)s=r[e],s.doAbsolute?o.push(s.assignPosition()):o.push(void 0);return o}},t.prototype.clearForce=function(){var e,t,r,o,s;if(this.isForcedRelative&&!this.isTouch){for(this.isForcedRelative=!1,r=this.sprites,o=[],e=0,t=r.length;e<t;e++)s=r[e],o.push(s.assignPosition());return o}},t.prototype.update=function(){return this.cacheDimensions(),this.updatePositions()},t.prototype.updatePositions=function(){var e,t,r,o;for(r=this.sprites,e=0,t=r.length;e<t;e++)o=r[e],o.updatePosition()},t.prototype.getContentRect=function(e){return fe(e,this.contentOffset)},t.prototype.getBoundingRect=function(e){return ge(e,this.contentOffset)},t}(),A=function(){function e(e,t){this.el=e,this.follower=null!=t?t:null,this.isBlock="block"===this.el.css("display"),this.el.css("position","relative")}return e.prototype.follower=null,e.prototype.el=null,e.prototype.absoluteEl=null,e.prototype.naturalRect=null,e.prototype.parentRect=null,e.prototype.containerRect=null,e.prototype.isEnabled=!0,e.prototype.isHFollowing=!1,e.prototype.isVFollowing=!1,e.prototype.doAbsolute=!1,e.prototype.isAbsolute=!1,e.prototype.isCentered=!1,e.prototype.rect=null,e.prototype.isBlock=!1,e.prototype.naturalWidth=null,e.prototype.disable=function(){if(this.isEnabled)return this.isEnabled=!1,this.resetPosition(),this.unabsolutize()},e.prototype.enable=function(){if(!this.isEnabled)return this.isEnabled=!0,this.assignPosition()},e.prototype.clear=function(){return this.disable(),this.follower=null,this.absoluteEl=null},e.prototype.cacheDimensions=function(){var e,t,r,o,s,n,i,l;return o=!1,s=!1,r=!1,this.naturalWidth=this.el.width(),this.resetPosition(),t=this.follower,i=this.naturalRect=t.getBoundingRect(this.el),l=this.el.parent(),this.parentRect=t.getBoundingRect(l),e=this.containerRect=_e(t.getContentRect(l),i),n=t.minTravel,t.containOnNaturalLeft&&(e.left=i.left),t.containOnNaturalRight&&(e.right=i.right),t.isHFollowing&&Re(e)-Re(i)>=n&&(r="center"===this.el.css("text-align"),o=!0),t.isVFollowing&&ve(e)-ve(i)>=n&&(s=!0),this.isHFollowing=o,this.isVFollowing=s,this.isCentered=r},e.prototype.updatePosition=function(){return this.computePosition(),this.assignPosition()},e.prototype.resetPosition=function(){return this.el.css({top:"",left:""})},e.prototype.computePosition=function(){var e,t,r,o,s,n,i,l;return i=this.follower.viewportRect,r=this.parentRect,e=this.containerRect,l=Ce(i,r),o=null,t=!1,l&&(o=ne(this.naturalRect),n=Ce(o,r),(this.isCentered&&!Oe(i,r)||n&&!Oe(i,n))&&(t=!0,this.isHFollowing&&(this.isCentered?(s=Re(o),o.left=(l.left+l.right)/2-s/2,o.right=o.left+s):me(o,i)||(t=!1),me(o,e)&&(t=!1)),this.isVFollowing&&(Ve(o,i)||(t=!1),Ve(o,e)&&(t=!1)),Oe(i,o)||(t=!1))),this.rect=o,this.doAbsolute=t},e.prototype.assignPosition=function(){var e,t;if(this.isEnabled)return this.rect?this.doAbsolute&&!this.follower.isForcedRelative?(this.absolutize(),this.absoluteEl.css({top:this.rect.top-this.follower.viewportRect.top+this.follower.scrollbarWidths.top,left:this.rect.left-this.follower.viewportRect.left+this.follower.scrollbarWidths.left,width:this.isBlock?this.naturalWidth:""})):(t=this.rect.top-this.naturalRect.top,e=this.rect.left-this.naturalRect.left,this.unabsolutize(),this.el.toggleClass("fc-following",Boolean(t||e)).css({top:t,left:e})):this.unabsolutize()},e.prototype.absolutize=function(){if(!this.isAbsolute)return this.absoluteEl||(this.absoluteEl=this.buildAbsoluteEl()),this.absoluteEl.appendTo(this.follower.scroller.el),this.el.css("visibility","hidden"),this.isAbsolute=!0},e.prototype.unabsolutize=function(){if(this.isAbsolute)return this.absoluteEl.detach(),this.el.css("visibility",""),this.isAbsolute=!1},e.prototype.buildAbsoluteEl=function(){var e;return e=this.el.clone().addClass("fc-following"),e.css({position:"absolute","z-index":1e3,"font-weight":this.el.css("font-weight"),"font-size":this.el.css("font-size"),"font-family":this.el.css("font-family"),"text-decoration":this.el.css("text-decoration"),color:this.el.css("color"),"padding-top":this.el.css("padding-top"),"padding-bottom":this.el.css("padding-bottom"),"padding-left":this.el.css("padding-left"),"padding-right":this.el.css("padding-right")}),this.follower.allowPointerEvents||e.css("pointer-events","none"),e},e}(),ne=function(e){return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},Re=function(e){return e.right-e.left},ve=function(e){return e.bottom-e.top},Oe=function(e,t){return Ae(e,t)&&qe(e,t)},Ae=function(e,t){return t.left>=e.left&&t.right<=e.right},qe=function(e,t){return t.top>=e.top&&t.bottom<=e.bottom},me=function(e,t){return e.left<t.left?(e.right=t.left+Re(e),e.left=t.left,!0):e.right>t.right&&(e.left=t.right-Re(e),e.right=t.right,!0)},Ve=function(e,t){return e.top<t.top?(e.bottom=t.top+ve(e),e.top=t.top,!0):e.bottom>t.bottom&&(e.top=t.bottom-ve(e),e.bottom=t.bottom,!0)},_e=function(e,t){return{left:Math.min(e.left,t.left),right:Math.max(e.right,t.right),top:Math.min(e.top,t.top),bottom:Math.max(e.bottom,t.bottom)}},s=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.prototype.resourceManager=null,r.prototype.initialize=function(){return this.resourceManager=new x(this)},r.prototype.instantiateView=function(e){var t,r;return t=this.getViewSpec(e),r=t["class"],this.opt("resources")&&t.options.resources!==!1&&(t.queryResourceClass?r=t.queryResourceClass(t)||r:t.resourceClass&&(r=t.resourceClass)),new r(this,t)},r.prototype.getResources=function(){return Array.prototype.slice.call(this.resourceManager.topLevelResources)},r.prototype.addResource=function(e,t){var r;null==t&&(t=!1),r=this.resourceManager.addResource(e),t&&this.view.scrollToResource&&r.then(function(e){return function(t){return e.view.scrollToResource(t)}}(this))},r.prototype.removeResource=function(e){return this.resourceManager.removeResource(e)},r.prototype.refetchResources=function(){this.resourceManager.clear(),this.view.flash("initialResources")},r.prototype.rerenderResources=function(){this.resourceManager.resetCurrentResources()},r.prototype.isSpanAllowed=function(e,t){var o,s;return!("object"==typeof t&&(o=this.getEventResourceIds(t),o.length&&!(e.resourceId&&(s=e.resourceId,Ye.call(o,s)>=0))))&&r.__super__.isSpanAllowed.apply(this,arguments)},r.prototype.mutateSeg=function(t,r,o){var s,n,i,l;return r.resourceId&&(i=(null!=(l=t.resource)?l.id:void 0)||t.resourceId,n=r.resourceId,s=this.getEventResourceIds(t.event),i!==n&&(s=s.filter(function(e){return e!==i&&e!==n}),s.push(n)),r=e.extend({},r),this.setEventResourceIds(r,s)),this.mutateEvent(t.event,r,o)},r.prototype.getPeerEvents=function(e,t){var o,s,n,i,l,u,h,c,a,p,d,f,g,y;for(f=r.__super__.getPeerEvents.apply(this,arguments),p=e.resourceId?[e.resourceId]:t?this.getEventResourceIds(t):[],o=[],n=0,u=f.length;n<u;n++){if(d=f[n],s=!1,y=this.getEventResourceIds(d),y.length&&p.length){for(i=0,h=y.length;i<h;i++)for(g=y[i],l=0,c=p.length;l<c;l++)if(a=p[l],a===g){s=!0;break}}else s=!0;s&&o.push(d)}return o},r.prototype.spanContainsSpan=function(e,t){return(!e.resourceId||e.resourceId===t.resourceId)&&r.__super__.spanContainsSpan.apply(this,arguments)},r.prototype.getCurrentBusinessHourEvents=function(e){var t,o,s,n,i,l,u,h,c,a,p,d;for(i=this.resourceManager.getFlatResources(),o=!1,l=0,c=i.length;l<c;l++)d=i[l],d.businessHours&&(o=!0);if(o){for(t=[],u=0,a=i.length;u<a;u++)for(d=i[u],n=this.computeBusinessHourEvents(e,d.businessHours||this.opt("businessHours")),h=0,p=n.length;h<p;h++)s=n[h],s.resourceId=d.id,t.push(s);return t}return r.__super__.getCurrentBusinessHourEvents.apply(this,arguments)},r.prototype.buildSelectSpan=function(e,t,o){var s;return s=r.__super__.buildSelectSpan.apply(this,arguments),o&&(s.resourceId=o),s},r.prototype.getResourceById=function(e){return this.resourceManager.getResourceById(e)},r.prototype.normalizeEvent=function(e){return r.__super__.normalizeEvent.apply(this,arguments),null==e.resourceId&&(e.resourceId=null),null!=e.resourceIds?e.resourceIds:e.resourceIds=null},r.prototype.getEventResourceId=function(e){return this.getEventResourceIds(e)[0]},r.prototype.getEventResourceIds=function(e){var t,r,o,s,n,i,l,u;if(u=String(null!=(n=null!=(i=e[this.getEventResourceField()])?i:e.resourceId)?n:""))return[u];if(e.resourceIds){for(s=[],l=e.resourceIds,t=0,r=l.length;t<r;t++)u=l[t],o=String(null!=u?u:""),o&&s.push(o);return s}return[]},r.prototype.setEventResourceId=function(e,t){return this.setEventResourceIds(e,t?[t]:[])},r.prototype.setEventResourceIds=function(e,t){return e[this.getEventResourceField()]=1===t.length?t[0]:null,e.resourceIds=t.length>1?t:null},r.prototype.getEventResourceField=function(){return this.opt("eventResourceField")||"resourceId"},r.prototype.getResourceEvents=function(t){var r;return r="object"==typeof t?t:this.getResourceById(t),r?this.clientEvents(function(t){return function(o){return e.inArray(r.id,t.getEventResourceIds(o))!==-1}}(this)):[]},r.prototype.getEventResource=function(e){return this.getEventResources(e)[0]},r.prototype.getEventResources=function(e){var t,r,o,s,n,i,l;if(t="object"==typeof e?e:this.clientEvents(e)[0],l=[],t)for(s=this.getEventResourceIds(t),r=0,o=s.length;r<o;r++)i=s[r],n=this.getResourceById(i),n&&l.push(n);return l},r}(o),o.prototype=s.prototype,Me=K.prototype.setElement,We=K.prototype.removeElement,Fe=K.prototype.onBaseRender,o.defaults.refetchResourcesOnNavigate=!1,K.prototype.canHandleSpecificResources=!1,K.prototype.isDestroying=!1,K.prototype.setElement=function(){return Me.apply(this,arguments),this.watchResources()},K.prototype.removeElement=function(){return this.isDestroying=!0,this.unwatchResources(),We.apply(this,arguments),this.isDestroying=!1},K.prototype.onBaseRender=function(){return ze(this.calendar.opt("schedulerLicenseKey"),this.el),Fe.apply(this,arguments)},K.prototype.watchResources=function(){var e,t;return t=[],e=["initialResources"],this.opt("refetchResourcesOnNavigate")&&t.push("dateProfile"),this.opt("filterResourcesWithEvents")&&e.push("currentEvents"),this.watch("initialResources",t,function(e){return function(t){return e.getInitialResources(t.dateProfile)}}(this)),this.watch("bindingResources",e,function(e){return function(t){e.bindResourceChanges(t.currentEvents),e.setResources(t.initialResources,t.currentEvents)}}(this),function(e){return function(){e.unbindResourceChanges(),e.unsetResources()}}(this))},K.prototype.unwatchResources=function(){return this.unwatch("initialResources"),this.unwatch("bindingResources")},K.prototype.getInitialResources=function(e){return e?this.calendar.resourceManager.getResources(e.activeRange.start,e.activeRange.end):this.calendar.resourceManager.getResources()},K.prototype.bindResourceChanges=function(e){return this.listenTo(this.calendar.resourceManager,{set:function(t){return function(r){return t.setResources(r,e)}}(this),unset:function(e){return function(){return e.unsetResources()}}(this),reset:function(t){return function(r){return t.resetResources(r,e)}}(this),add:function(t){return function(r,o){return t.addResource(r,o,e)}}(this),remove:function(t){return function(r,o){return t.removeResource(r,o,e)}}(this)})},K.prototype.unbindResourceChanges=function(){return this.stopListeningTo(this.calendar.resourceManager)},K.watch("displayingEvents",["displayingDates","hasEvents","currentResources"],function(e){return this.requestEventsRender(this.get("currentEvents"))},function(){return this.requestEventsUnrender()}),K.prototype.setResources=function(e,t){return t&&(e=this.filterResourcesWithEvents(e,t)),this.set("currentResources",e),this.set("hasResources",!0),this.handleResourcesSet(e)},K.prototype.unsetResources=function(){return this.unset("currentResources"),this.unset("hasResources"),this.handleResourcesUnset()},K.prototype.resetResources=function(e,t){return this.startBatchRender(),this.unsetResources(),this.setResources(e,t),this.stopBatchRender()},K.prototype.addResource=function(e,t,r){var o;return this.canHandleSpecificResources?(r&&(o=this.filterResourcesWithEvents([e],r),o.length||(e=null)),e?(this.set("currentResources",t),this.handleResourceAdd(e)):void 0):this.resetResources(t,r)},K.prototype.removeResource=function(e,t,r){return this.canHandleSpecificResources?(this.set("currentResources",t),this.handleResourceRemove(e)):this.resetResources(t,r)},K.prototype.handleResourcesSet=function(e){},K.prototype.handleResourcesUnset=function(e){},K.prototype.handleResourceAdd=function(e){},K.prototype.handleResourceRemove=function(e){},K.prototype.filterResourcesWithEvents=function(e,t){var r,o,s,n,i,l,u,h;for(h={},o=0,n=t.length;o<n;o++)for(r=t[o],l=this.calendar.getEventResourceIds(r),s=0,i=l.length;s<i;s++)u=l[s],h[u]=!0;return J(e,h)},J=function(e,t){var r,o,s,n,i,l;for(s=[],n=0,i=e.length;n<i;n++)l=e[n],l.children.length?(r=J(l.children,t),(r.length||t[l.id])&&(o=ie(l),o.children=r,s.push(o))):t[l.id]&&s.push(l);return s},De=f.prototype.getSegCustomClasses,xe=f.prototype.getSegDefaultBackgroundColor,Ge=f.prototype.getSegDefaultBorderColor,Be=f.prototype.getSegDefaultTextColor,f.prototype.getSegCustomClasses=function(e){var t,r,o,s,n;for(t=De.apply(this,arguments),s=this.getSegResources(e),r=0,o=s.length;r<o;r++)n=s[r],t=t.concat(n.eventClassName||[]);return t},f.prototype.getSegDefaultBackgroundColor=function(e){var t,r,o,s,n;for(s=this.getSegResources(e),r=0,o=s.length;r<o;r++)for(t=s[r];t;){if(n=t.eventBackgroundColor||t.eventColor)return n;t=t._parent}return xe.apply(this,arguments)},f.prototype.getSegDefaultBorderColor=function(e){var t,r,o,s,n;for(s=this.getSegResources(e),r=0,o=s.length;r<o;r++)for(t=s[r];t;){if(n=t.eventBorderColor||t.eventColor)return n;t=t._parent}return Ge.apply(this,arguments)},f.prototype.getSegDefaultTextColor=function(e){var t,r,o,s,n;for(s=this.getSegResources(e),r=0,o=s.length;r<o;r++)for(t=s[r];t;){if(n=t.eventTextColor)return n;t=t._parent}return Be.apply(this,arguments)},f.prototype.getSegResources=function(e){return e.resource?[e.resource]:this.view.calendar.getEventResources(e.event)},x=function(t){function r(e){this.calendar=e,this.initializeCache()}return Ue(r,t),r.mixin(c),r.resourceGuid=1,r.ajaxDefaults={dataType:"json",cache:!1},r.prototype.calendar=null,r.prototype.fetchId=0,r.prototype.topLevelResources=null,r.prototype.resourcesById=null,r.prototype.fetching=null,r.prototype.currentStart=null,r.prototype.currentEnd=null,r.prototype.getResources=function(e,t){var r;return r=!e&&!this.currentStart||e&&this.currentStart&&e.isSame(this.currentStart)&&t.isSame(this.currentEnd),this.fetching&&r?this.fetching:this.fetchResources(e,t)},r.prototype.fetchResources=function(e,t){var r;return r=this.fetchId+=1,this.fetching=C.construct(function(o){return function(s,n){return o.fetchResourceInputs(function(e){return r===o.fetchId?(o.setResources(e),s(o.topLevelResources)):n()},e,t)}}(this))},r.prototype.fetchResourceInputs=function(t,o,s){var n,i,l,u;switch(n=this.calendar,l=n.opt("resources"),u=n.opt("timezone"),"string"===e.type(l)&&(l={url:l}),e.type(l)){case"function":return this.calendar.pushLoading(),l(function(e){return function(r){return e.calendar.popLoading(),t(r)}}(this),o,s,n.opt("timezone"));case"object":return n.pushLoading(),i={},o&&s&&(i[n.opt("startParam")]=o.format(),i[n.opt("endParam")]=s.format(),u&&"local"!==u&&(i[n.opt("timezoneParam")]=u)),e.ajax(e.extend({data:i},r.ajaxDefaults,l)).then(function(e){return function(e){return n.popLoading(),t(e)}}(this));case"array":return t(l);default:return t([])}},r.prototype.getResourceById=function(e){return this.resourcesById[e]},r.prototype.getFlatResources=function(){var e,t;t=[];for(e in this.resourcesById)t.push(this.resourcesById[e]);return t},r.prototype.initializeCache=function(){return this.topLevelResources=[],this.resourcesById={}},r.prototype.setResources=function(e){var t,r,o,s,n,i,l;for(l=Boolean(this.topLevelResources),this.initializeCache(),n=function(){var t,r,o;for(o=[],t=0,r=e.length;t<r;t++)s=e[t],o.push(this.buildResource(s));return o}.call(this),i=function(){var e,t,r;for(r=[],e=0,t=n.length;e<t;e++)o=n[e],this.addResourceToIndex(o)&&r.push(o);return r}.call(this),t=0,r=i.length;t<r;t++)o=i[t],this.addResourceToTree(o);return l?this.trigger("reset",this.topLevelResources):this.trigger("set",this.topLevelResources),this.calendar.publiclyTrigger("resourcesSet",null,this.topLevelResources)},r.prototype.resetCurrentResources=function(){if(this.topLevelResources)return this.trigger("reset",this.topLevelResources)},r.prototype.clear=function(){return this.topLevelResources=null,this.fetching=null},r.prototype.addResource=function(e){return this.fetching?this.fetching.then(function(t){return function(){var r;return r=t.buildResource(e),!!t.addResourceToIndex(r)&&(t.addResourceToTree(r),t.trigger("add",r,t.topLevelResources),r)}}(this)):C.reject()},r.prototype.addResourceToIndex=function(e){var t,r,o,s;if(this.resourcesById[e.id])return!1;for(this.resourcesById[e.id]=e,s=e.children,r=0,o=s.length;r<o;r++)t=s[r],this.addResourceToIndex(t);return!0},r.prototype.addResourceToTree=function(e){var t,r,o,s;if(!e.parent){if(r=String(null!=(o=e.parentId)?o:"")){if(t=this.resourcesById[r],!t)return!1;e.parent=t,s=t.children}else s=this.topLevelResources;s.push(e)}return!0},r.prototype.removeResource=function(e){var t;return t="object"==typeof e?e.id:e,this.fetching?this.fetching.then(function(e){return function(){var r;return r=e.removeResourceFromIndex(t),r&&(e.removeResourceFromTree(r),e.trigger("remove",r,e.topLevelResources)),r}}(this)):C.reject()},r.prototype.removeResourceFromIndex=function(e){var t,r,o,s,n;if(n=this.resourcesById[e]){for(delete this.resourcesById[e],s=n.children,r=0,o=s.length;r<o;r++)t=s[r],this.removeResourceFromIndex(t.id);return n}return!1},r.prototype.removeResourceFromTree=function(e,t){var r,o,s,n;for(null==t&&(t=this.topLevelResources),r=o=0,s=t.length;o<s;r=++o){if(n=t[r],n===e)return e.parent=null,t.splice(r,1),!0;if(this.removeResourceFromTree(e,n.children))return!0}return!1},r.prototype.buildResource=function(t){var o,s,n,i,l;return l=e.extend({},t),l.id=String(null!=(i=t.id)?i:"_fc"+r.resourceGuid++),n=t.eventClassName,l.eventClassName=function(){switch(e.type(n)){case"string":return n.split(/\s+/);case"array":return n;default:return[]}}(),l.children=function(){var e,r,n,i,u;for(i=null!=(n=t.children)?n:[],u=[],e=0,r=i.length;e<r;e++)s=i[e],o=this.buildResource(s),o.parent=l,u.push(o);return u}.call(this),l},r}(n),o.defaults.filterResourcesWithEvents=!1,L={isResourcesRendered:!1,resourceTextFunc:null,setElement:function(){return K.prototype.setElement.apply(this,arguments),this.watch("displayingResources",["hasResources"],function(e){return function(){return e.requestResourcesRender(e.get("currentResources"))}}(this),function(e){return function(){return e.requestResourcesUnrender()}}(this)),this.watch("displayingEvents",["displayingDates","hasEvents","displayingResources"],function(e){return function(){return e.requestEventsRender(e.get("currentEvents"))}}(this),function(e){return function(){return e.requestEventsUnrender()}}(this))},queryScroll:function(){var t;return t=K.prototype.queryScroll.apply(this,arguments),this.isResourcesRendered&&e.extend(t,this.queryResourceScroll()),t},applyScroll:function(e){if(K.prototype.applyScroll.apply(this,arguments),this.isResourcesRendered)return this.applyResourceScroll(e)},queryResourceScroll:function(){return{}},applyResourceScroll:function(){},bindBaseRenderHandlers:function(){var e,t;return t=!1,e=!1,this.on("resourcesRendered.baseHandler",function(){if(!t&&(t=!0,e))return this.onBaseRender()}),this.on("datesRendered.baseHandler",function(){if(!e&&(e=!0,t))return this.onBaseRender()}),this.on("before:resourcesUnrendered.baseHandler",function(){if(t)return t=!1}),this.on("before:datesUnrendered.baseHandler",function(){if(e)return e=!1,this.onBeforeBaseUnrender()})},handleResourcesSet:function(e){},handleResourcesUnset:function(){},handleResourceAdd:function(e){return this.requestResourceRender(e)},handleResourceRemove:function(e){return this.requestResourceUnrender(e)},requestResourcesRender:function(e){return this.renderQueue.queue(function(t){return function(){return t.executeResourcesRender(e)}}(this),"resource","init")},requestResourcesUnrender:function(){return this.renderQueue.queue(function(e){return function(){return e.executeResourcesUnrender()}}(this),"resource","destroy")},requestResourceRender:function(e){return this.renderQueue.queue(function(t){return function(){return t.executeResourceRender(e)}}(this),"resource","add")},requestResourceUnrender:function(e){return this.renderQueue.queue(function(t){return function(){return t.executeResourceUnrender(e)}}(this),"resource","remove")},executeResourcesRender:function(e){return this.renderResources(e),
+this.isResourcesRendered=!0,this.trigger("resourcesRendered")},executeResourcesUnrender:function(){return this.trigger("before:resourcesUnrendered"),this.unrenderResources(),this.isResourcesRendered=!1},executeResourceRender:function(e){return this.renderResource(e)},executeResourceUnrender:function(e){return this.unrenderResource(e)},renderResources:function(e){},unrenderResources:function(){},renderResource:function(e){},unrenderResource:function(e){},isEventDraggable:function(e){return this.isEventResourceEditable(e)||K.prototype.isEventDraggable.call(this,e)},isEventResourceEditable:function(e){var t,r,o;return null!=(t=null!=(r=null!=(o=e.resourceEditable)?o:(e.source||{}).resourceEditable)?r:this.opt("eventResourceEditable"))?t:this.isEventGenerallyEditable(e)},getResourceText:function(e){return this.getResourceTextFunc()(e)},getResourceTextFunc:function(){var e;return this.resourceTextFunc?this.resourceTextFunc:(e=this.opt("resourceText"),"function"!=typeof e&&(e=function(e){return e.title||e.id}),this.resourceTextFunc=e)},triggerDayClick:function(e,t,r){var o;return o=this.calendar.resourceManager,this.publiclyTrigger("dayClick",t,this.calendar.applyTimezone(e.start),r,this,o.getResourceById(e.resourceId))},triggerSelect:function(e,t){var r;return r=this.calendar.resourceManager,this.publiclyTrigger("select",null,this.calendar.applyTimezone(e.start),this.calendar.applyTimezone(e.end),t,this,r.getResourceById(e.resourceId))},triggerExternalDrop:function(e,t,r,o,s){if(this.publiclyTrigger("drop",r[0],t.start,o,s,t.resourceId),e)return this.publiclyTrigger("eventReceive",null,e)},reportExternalDrop:function(){var e,t,r,o;return t=arguments[0],e=arguments[1],r=3<=arguments.length?Qe.call(arguments,2):[],e=this.normalizeDropLocation(e),(o=K.prototype.reportExternalDrop).call.apply(o,[this,t,e].concat(Qe.call(r)))},normalizeDropLocation:function(t){var r;return r=e.extend({},t),delete r.resourceId,this.calendar.setEventResourceId(r,t.resourceId),r}},$=e.extend({},L,{setElement:function(){var e,t,r;return L.setElement.apply(this,arguments),t=!1,e=!1,r=!1,this.watch("dateProfileOnly",["dateProfile"],function(e){return function(){return r=!0}}(this)),this.watch("displayingDatesOnly",["dateProfile","?currentResources"],function(e){return function(o){if(!o.currentResources&&!e.isDestroying)return t=!0,e.renderQueue.queue(function(){return e.executeDateRender(o.dateProfile,!r),r=!1},"date","init")}}(this),function(e){return function(){if(t)return t=!1,e.renderQueue.queue(function(){return e.executeDateUnrender()},"date","destroy")}}(this)),this.watch("displayingDates",["dateProfile","currentResources"],function(t){return function(o){if(!t.isDestroying)return e=!0,t.renderQueue.queue(function(){return t.setResourcesOnGrids(o.currentResources),t.executeDateRender(o.dateProfile,!r),r=!1,t.trigger("resourcesRendered")},"resource","init")}}(this),function(t){return function(){if(e)return e=!1,t.renderQueue.queue(function(){return t.trigger("before:resourcesUnrendered"),t.unsetResourcesOnGrids(),t.executeDateUnrender()},"resource","destroy")}}(this)),this.watch("displayingResources",["displayingDates"],function(e){return function(){return!0}}(this))},setResourcesOnGrids:function(e){},unsetResourcesOnGrids:function(){}}),D={allowCrossResource:!0,eventRangeToSpans:function(t,r){var o,s,n,i,l;if(i=this.view.calendar.getEventResourceIds(r),i.length){for(l=[],o=0,s=i.length;o<s;o++)n=i[o],l.push(e.extend({},t,{resourceId:n}));return l}return d.isBgEvent(r)?f.prototype.eventRangeToSpans.apply(this,arguments):[]},fabricateHelperEvent:function(e,t){var r;return r=f.prototype.fabricateHelperEvent.apply(this,arguments),this.view.calendar.setEventResourceId(r,e.resourceId),r},computeEventDrop:function(e,t,r){var o;return o=this.view.isEventStartEditable(r)?f.prototype.computeEventDrop.apply(this,arguments):d.pluckEventDateProps(r),o&&(this.view.isEventResourceEditable(r)?o.resourceId=t.resourceId:o.resourceId=e.resourceId),o},computeExternalDrop:function(e,t){var r;return r=f.prototype.computeExternalDrop.apply(this,arguments),r&&(r.resourceId=e.resourceId),r},computeEventResize:function(e,t,r,o){var s;if(this.allowCrossResource||t.resourceId===r.resourceId)return s=f.prototype.computeEventResize.apply(this,arguments),s&&(s.resourceId=t.resourceId),s},computeSelectionSpan:function(e,t){var r;if(this.allowCrossResource||e.resourceId===t.resourceId)return r=f.prototype.computeSelectionSpan.apply(this,arguments),r&&(r.resourceId=e.resourceId),r}},I={flattenedResources:null,resourceCnt:0,datesAboveResources:!1,allowCrossResource:!1,setResources:function(e){return this.flattenedResources=this.flattenResources(e),this.resourceCnt=this.flattenedResources.length,this.updateDayTableCols()},unsetResources:function(){return this.flattenedResources=null,this.resourceCnt=0,this.updateDayTableCols()},flattenResources:function(e){var t,r,o,s;return r=this.view.opt("resourceOrder"),r?(t=Le(r),s=function(e,r){return te(e,r,t)}):s=null,o=[],this.accumulateResources(e,s,o),o},accumulateResources:function(e,t,r){var o,s,n,i,l;for(t?(l=e.slice(0),l.sort(t)):l=e,i=[],o=0,s=l.length;o<s;o++)n=l[o],r.push(n),i.push(this.accumulateResources(n.children,t,r));return i},updateDayTableCols:function(){return this.datesAboveResources=this.view.opt("groupByDateAndResource"),d.DayTableMixin.updateDayTableCols.call(this)},computeColCnt:function(){return(this.resourceCnt||1)*this.daysPerRow},getColDayIndex:function(e){return this.isRTL&&(e=this.colCnt-1-e),this.datesAboveResources?Math.floor(e/(this.resourceCnt||1)):e%this.daysPerRow},getColResource:function(e){return this.flattenedResources[this.getColResourceIndex(e)]},getColResourceIndex:function(e){return this.isRTL&&(e=this.colCnt-1-e),this.datesAboveResources?e%(this.resourceCnt||1):Math.floor(e/this.daysPerRow)},indicesToCol:function(e,t){var r;return r=this.datesAboveResources?t*(this.resourceCnt||1)+e:e*this.daysPerRow+t,this.isRTL&&(r=this.colCnt-1-r),r},renderHeadTrHtml:function(){return this.resourceCnt?this.daysPerRow>1?this.datesAboveResources?this.renderHeadDateAndResourceHtml():this.renderHeadResourceAndDateHtml():this.renderHeadResourceHtml():d.DayTableMixin.renderHeadTrHtml.call(this)},renderHeadResourceHtml:function(){var e,t,r,o,s;for(s=[],r=this.flattenedResources,e=0,t=r.length;e<t;e++)o=r[e],s.push(this.renderHeadResourceCellHtml(o));return this.wrapTr(s,"renderHeadIntroHtml")},renderHeadResourceAndDateHtml:function(){var e,t,r,o,s,n,i,l,u,h;for(h=[],t=[],i=this.flattenedResources,o=0,n=i.length;o<n;o++)for(u=i[o],h.push(this.renderHeadResourceCellHtml(u,null,this.daysPerRow)),r=s=0,l=this.daysPerRow;s<l;r=s+=1)e=this.dayDates[r].clone(),t.push(this.renderHeadResourceDateCellHtml(e,u));return this.wrapTr(h,"renderHeadIntroHtml")+this.wrapTr(t,"renderHeadIntroHtml")},renderHeadDateAndResourceHtml:function(){var e,t,r,o,s,n,i,l,u,h;for(t=[],h=[],r=o=0,i=this.daysPerRow;o<i;r=o+=1)for(e=this.dayDates[r].clone(),t.push(this.renderHeadDateCellHtml(e,this.resourceCnt)),l=this.flattenedResources,s=0,n=l.length;s<n;s++)u=l[s],h.push(this.renderHeadResourceCellHtml(u,e));return this.wrapTr(t,"renderHeadIntroHtml")+this.wrapTr(h,"renderHeadIntroHtml")},renderHeadResourceCellHtml:function(e,t,r){return'<th class="fc-resource-cell" data-resource-id="'+e.id+'"'+(t?' data-date="'+t.format("YYYY-MM-DD")+'"':"")+(r>1?' colspan="'+r+'"':"")+">"+Se(this.view.getResourceText(e))+"</th>"},renderHeadResourceDateCellHtml:function(e,t,r){return this.renderHeadDateCellHtml(e,r,'data-resource-id="'+t.id+'"')},processHeadResourceEls:function(t){return t.find(".fc-resource-cell").each(function(t){return function(r,o){var s;return s=t.datesAboveResources?t.getColResource(r):t.flattenedResources[t.isRTL?t.flattenedResources.length-1-r:r],t.view.publiclyTrigger("resourceRender",s,s,e(o),e())}}(this))},renderBgCellsHtml:function(e){var t,r,o,s,n,i;if(this.resourceCnt){for(o=[],t=s=0,n=this.colCnt;s<n;t=s+=1)r=this.getCellDate(e,t),i=this.getColResource(t),o.push(this.renderResourceBgCellHtml(r,i));return o.join("")}return d.DayTableMixin.renderBgCellsHtml.call(this,e)},renderResourceBgCellHtml:function(e,t){return this.renderBgCellHtml(e,'data-resource-id="'+t.id+'"')},wrapTr:function(e,t){return this.isRTL?(e.reverse(),"<tr>"+e.join("")+this[t]()+"</tr>"):"<tr>"+this[t]()+e.join("")+"</tr>"},computePerResourceBusinessHourSegs:function(e){var t,r,o,s,n,i,l,u,h,c,a,p,d,f,g;if(this.flattenedResources){for(r=!1,p=this.flattenedResources,i=0,h=p.length;i<h;i++)f=p[i],f.businessHours&&(r=!0);if(r){for(t=[],d=this.flattenedResources,l=0,c=d.length;l<c;l++){for(f=d[l],o=f.businessHours||this.view.calendar.opt("businessHours"),n=this.buildBusinessHourEvents(e,o),u=0,a=n.length;u<a;u++)s=n[u],s.resourceId=f.id;g=this.eventsToSegs(n),t.push.apply(t,g)}return t}}return null}},_=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.mixin(D),r.mixin(I),r.prototype.getHitSpan=function(e){var t;return t=r.__super__.getHitSpan.apply(this,arguments),this.resourceCnt&&(t.resourceId=this.getColResource(e.col).id),t},r.prototype.spanToSegs=function(t){var r,o,s,n,i,l,u,h,c,a,p,d,f;if(c=this.resourceCnt,o=this.datesAboveResources?this.sliceRangeByDay(t):this.sliceRangeByRow(t),c){for(d=[],n=0,u=o.length;n<u;n++)for(f=o[n],a=i=0,h=c;i<h;a=i+=1)p=this.flattenedResources[a],t.resourceId&&t.resourceId!==p.id||(r=e.extend({},f),r.resource=p,this.isRTL?(r.leftCol=this.indicesToCol(a,f.lastRowDayIndex),r.rightCol=this.indicesToCol(a,f.firstRowDayIndex)):(r.leftCol=this.indicesToCol(a,f.firstRowDayIndex),r.rightCol=this.indicesToCol(a,f.lastRowDayIndex)),d.push(r));return d}for(s=0,l=o.length;s<l;s++)f=o[s],this.isRTL?(f.leftCol=f.lastRowDayIndex,f.rightCol=f.firstRowDayIndex):(f.leftCol=f.firstRowDayIndex,f.rightCol=f.lastRowDayIndex);return o},r.prototype.renderBusinessHours=function(){var e;return e=this.computePerResourceBusinessHourSegs(!0),e?this.renderFill("businessHours",e,"bgevent"):r.__super__.renderBusinessHours.apply(this,arguments)},r}(d.DayGrid),F=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.mixin(D),r.mixin(I),r.prototype.getHitSpan=function(e){var t;return t=r.__super__.getHitSpan.apply(this,arguments),this.resourceCnt&&(t.resourceId=this.getColResource(e.col).id),t},r.prototype.spanToSegs=function(t){var r,o,s,n,i,l,u,h,c,a,p,d,f;if(c=this.resourceCnt,o=this.sliceRangeByTimes(t),c){for(d=[],n=0,u=o.length;n<u;n++)for(f=o[n],a=i=0,h=c;i<h;a=i+=1)p=this.flattenedResources[a],t.resourceId&&t.resourceId!==p.id||(r=e.extend({},f),r.resource=p,r.col=this.indicesToCol(a,f.dayIndex),d.push(r));return d}for(s=0,l=o.length;s<l;s++)f=o[s],f.col=f.dayIndex;return o},r.prototype.renderBusinessHours=function(){var e;return e=this.computePerResourceBusinessHourSegs(!1),e?this.renderBusinessSegs(e):r.__super__.renderBusinessHours.apply(this,arguments)},r}(d.TimeGrid),Y=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,e),r.prototype.timeGrid=null,r.prototype.isScrolled=!1,r.prototype.usesMinMaxTime=!0,r.prototype.initialize=function(){return this.timeGrid=this.instantiateGrid()},r.prototype.instantiateGrid=function(){return new j(this)},r.prototype.setDateProfileForRendering=function(e){return r.__super__.setDateProfileForRendering.apply(this,arguments),this.timeGrid.initScaleProps(),this.timeGrid.setRange(this.renderRange)},r.prototype.getFallbackDuration=function(){return this.timeGrid.computeFallbackDuration()},r.prototype.renderSkeleton=function(){return this.el.addClass("fc-timeline"),this.opt("eventOverlap")===!1&&this.el.addClass("fc-no-overlap"),this.el.html(this.renderSkeletonHtml()),this.renderTimeGridSkeleton()},r.prototype.renderSkeletonHtml=function(){return'<table> <thead class="fc-head"> <tr> <td class="fc-time-area '+this.widgetHeaderClass+'"></td> </tr> </thead> <tbody class="fc-body"> <tr> <td class="fc-time-area '+this.widgetContentClass+'"></td> </tr> </tbody> </table>'},r.prototype.renderTimeGridSkeleton=function(){return this.timeGrid.setElement(this.el.find("tbody .fc-time-area")),this.timeGrid.headEl=this.el.find("thead .fc-time-area"),this.timeGrid.renderSkeleton(),this.isScrolled=!1,this.timeGrid.bodyScroller.on("scroll",ke(this,"handleBodyScroll"))},r.prototype.handleBodyScroll=function(e,t){if(e){if(!this.isScrolled)return this.isScrolled=!0,this.el.addClass("fc-scrolled")}else if(this.isScrolled)return this.isScrolled=!1,this.el.removeClass("fc-scrolled")},r.prototype.unrenderSkeleton=function(){return this.timeGrid.removeElement(),this.handleBodyScroll(0),r.__super__.unrenderSkeleton.apply(this,arguments)},r.prototype.renderDates=function(){return this.timeGrid.renderDates()},r.prototype.unrenderDates=function(){return this.timeGrid.unrenderDates()},r.prototype.renderBusinessHours=function(){return this.timeGrid.renderBusinessHours()},r.prototype.unrenderBusinessHours=function(){return this.timeGrid.unrenderBusinessHours()},r.prototype.getNowIndicatorUnit=function(){return this.timeGrid.getNowIndicatorUnit()},r.prototype.renderNowIndicator=function(e){return this.timeGrid.renderNowIndicator(e)},r.prototype.unrenderNowIndicator=function(){return this.timeGrid.unrenderNowIndicator()},r.prototype.hitsNeeded=function(){return this.timeGrid.hitsNeeded()},r.prototype.hitsNotNeeded=function(){return this.timeGrid.hitsNotNeeded()},r.prototype.prepareHits=function(){return this.timeGrid.prepareHits()},r.prototype.releaseHits=function(){return this.timeGrid.releaseHits()},r.prototype.queryHit=function(e,t){return this.timeGrid.queryHit(e,t)},r.prototype.getHitSpan=function(e){return this.timeGrid.getHitSpan(e)},r.prototype.getHitEl=function(e){return this.timeGrid.getHitEl(e)},r.prototype.updateWidth=function(){return this.timeGrid.updateWidth()},r.prototype.setHeight=function(e,t){var r;return r=t?"auto":e-this.timeGrid.headHeight()-this.queryMiscHeight(),this.timeGrid.bodyScroller.setHeight(r)},r.prototype.queryMiscHeight=function(){return this.el.outerHeight()-this.timeGrid.headScroller.el.outerHeight()-this.timeGrid.bodyScroller.el.outerHeight()},r.prototype.computeInitialDateScroll=function(){var e,r;return e=0,this.timeGrid.isTimeScale&&(r=this.opt("scrollTime"),r&&(r=t.duration(r),e=this.timeGrid.dateToCoord(this.activeRange.start.clone().time(r)))),{left:e}},r.prototype.queryDateScroll=function(){return{left:this.timeGrid.bodyScroller.getScrollLeft()}},r.prototype.applyDateScroll=function(e){if(null!=e.left)return this.timeGrid.headScroller.setScrollLeft(e.left),this.timeGrid.bodyScroller.setScrollLeft(e.left)},r.prototype.renderEvents=function(e){return this.timeGrid.renderEvents(e),this.updateWidth()},r.prototype.unrenderEvents=function(){return this.timeGrid.unrenderEvents(),this.updateWidth()},r.prototype.renderDrag=function(e,t){return this.timeGrid.renderDrag(e,t)},r.prototype.unrenderDrag=function(){return this.timeGrid.unrenderDrag()},r.prototype.getEventSegs=function(){return this.timeGrid.getEventSegs()},r.prototype.renderSelection=function(e){return this.timeGrid.renderSelection(e)},r.prototype.unrenderSelection=function(){return this.timeGrid.unrenderSelection()},r}(K),le=d.cssToStr,j=function(t){function r(){r.__super__.constructor.apply(this,arguments),this.slotWidth=this.opt("slotWidth")}return Ue(r,t),r.prototype.slotDates=null,r.prototype.slotCnt=null,r.prototype.snapCnt=null,r.prototype.snapsPerSlot=null,r.prototype.snapDiffToIndex=null,r.prototype.snapIndexToDiff=null,r.prototype.headEl=null,r.prototype.slatContainerEl=null,r.prototype.slatEls=null,r.prototype.containerCoordCache=null,r.prototype.slatCoordCache=null,r.prototype.slatInnerCoordCache=null,r.prototype.headScroller=null,r.prototype.bodyScroller=null,r.prototype.joiner=null,r.prototype.follower=null,r.prototype.eventTitleFollower=null,r.prototype.timeWindowMs=null,r.prototype.slotDuration=null,r.prototype.snapDuration=null,r.prototype.duration=null,r.prototype.labelInterval=null,r.prototype.headerFormats=null,r.prototype.isTimeScale=null,r.prototype.largeUnit=null,r.prototype.emphasizeWeeks=!1,r.prototype.titleFollower=null,r.prototype.segContainerEl=null,r.prototype.segContainerHeight=null,r.prototype.bgSegContainerEl=null,r.prototype.helperEls=null,r.prototype.innerEl=null,r.prototype.opt=function(e){return this.view.opt(e)},r.prototype.isValidDate=function(e){var t;return!this.view.isHiddenDay(e)&&(!this.isTimeScale||(t=e.time()-this.view.minTime,t=(t%864e5+864e5)%864e5,t<this.timeWindowMs))},r.prototype.computeDisplayEventTime=function(){return!this.isTimeScale},r.prototype.computeDisplayEventEnd=function(){return!1},r.prototype.computeEventTimeFormat=function(){return this.opt("extraSmallTimeFormat")},r.prototype.normalizeGridDate=function(e){var t;return this.isTimeScale?(t=e.clone(),t.hasTime()||t.time(0)):(t=e.clone().stripTime(),this.largeUnit&&t.startOf(this.largeUnit)),t},r.prototype.normalizeGridRange=function(e){var t,r;return this.isTimeScale?r={start:this.normalizeGridDate(e.start),end:this.normalizeGridDate(e.end)}:(r=this.view.computeDayRange(e),this.largeUnit&&(r.start.startOf(this.largeUnit),t=r.end.clone().startOf(this.largeUnit),t.isSame(r.end)&&t.isAfter(r.start)||t.add(this.slotDuration),r.end=t)),r},r.prototype.rangeUpdated=function(){var e,t;for(this.start=this.normalizeGridDate(this.start),this.end=this.normalizeGridDate(this.end),this.timeWindowMs=this.view.maxTime-this.view.minTime,this.isTimeScale&&(this.start.add(this.view.minTime),this.end.subtract(1,"day").add(this.view.maxTime)),t=[],e=this.start.clone();e<this.end;)this.isValidDate(e)&&t.push(e.clone()),e.add(this.slotDuration);return this.slotDates=t,this.updateGridDates()},r.prototype.updateGridDates=function(){var e,t,r,o,s;for(o=-1,t=0,r=[],s=[],e=this.start.clone();e<this.end;)this.isValidDate(e)?(o++,r.push(o),s.push(t)):r.push(o+.5),e.add(this.snapDuration),t++;return this.snapDiffToIndex=r,this.snapIndexToDiff=s,this.snapCnt=o+1,this.slotCnt=this.snapCnt/this.snapsPerSlot},r.prototype.spanToSegs=function(e){var t,r;return t=this.normalizeGridRange(e),this.computeDateSnapCoverage(e.start)<this.computeDateSnapCoverage(e.end)&&(r=be(t,this))?(r.isStart&&!this.isValidDate(r.start)&&(r.isStart=!1),r.isEnd&&r.end&&!this.isValidDate(r.end.clone().subtract(1))&&(r.isEnd=!1),[r]):[]},r.prototype.prepareHits=function(){return this.buildCoords()},r.prototype.queryHit=function(e,t){var r,o,s,n,i,l,u,h,c,a,p,d;if(d=this.snapsPerSlot,n=this.slatCoordCache,r=this.containerCoordCache,r.isPointInBounds(e,t)&&(i=n.getHorizontalIndex(e),null!=i))return h=n.getWidth(i),this.isRTL?(u=n.getRightOffset(i),s=(u-e)/h,o=Math.floor(s*d),c=i*d+o,p=u-o/d*h,a=p-(o+1)/d*h):(l=n.getLeftOffset(i),s=(e-l)/h,o=Math.floor(s*d),c=i*d+o,a=l+o/d*h,p=l+(o+1)/d*h),{snap:c,component:this,left:a,right:p,top:r.getTopOffset(0),bottom:r.getBottomOffset(0)}},r.prototype.getHitSpan=function(e){return this.getSnapRange(e.snap)},r.prototype.getHitEl=function(e){return this.getSnapEl(e.snap)},r.prototype.getSnapRange=function(e){var t,r;return r=this.start.clone(),r.add(Ie(this.snapDuration,this.snapIndexToDiff[e])),t=r.clone().add(this.snapDuration),{start:r,end:t}},r.prototype.getSnapEl=function(e){return this.slatEls.eq(Math.floor(e/this.snapsPerSlot))},r.prototype.renderSkeleton=function(){return this.headScroller=new i({overflowX:"clipped-scroll",overflowY:"hidden"}),this.headScroller.canvas=new N,this.headScroller.render(),this.headEl.append(this.headScroller.el),this.bodyScroller=new i,this.bodyScroller.canvas=new N,this.bodyScroller.render(),this.el.append(this.bodyScroller.el),this.innerEl=this.bodyScroller.canvas.contentEl,this.slatContainerEl=e('<div class="fc-slats"/>').appendTo(this.bodyScroller.canvas.bgEl),this.segContainerEl=e('<div class="fc-event-container"/>').appendTo(this.bodyScroller.canvas.contentEl),this.bgSegContainerEl=this.bodyScroller.canvas.bgEl,this.containerCoordCache=new l({els:this.bodyScroller.canvas.el,isHorizontal:!0,isVertical:!0}),this.joiner=new q("horizontal",[this.headScroller,this.bodyScroller]),this.follower=new O(this.headScroller,(!0)),this.eventTitleFollower=new O(this.bodyScroller),this.eventTitleFollower.minTravel=50,this.isRTL?this.eventTitleFollower.containOnNaturalRight=!0:this.eventTitleFollower.containOnNaturalLeft=!0,r.__super__.renderSkeleton.apply(this,arguments)},r.prototype.headColEls=null,r.prototype.slatColEls=null,r.prototype.renderDates=function(){var e,t,r,o,s;for(this.headScroller.canvas.contentEl.html(this.renderHeadHtml()),this.headColEls=this.headScroller.canvas.contentEl.find("col"),this.slatContainerEl.html(this.renderSlatHtml()),this.slatColEls=this.slatContainerEl.find("col"),this.slatEls=this.slatContainerEl.find("td"),this.slatCoordCache=new l({els:this.slatEls,isHorizontal:!0}),this.slatInnerCoordCache=new l({els:this.slatEls.find("> div"),isHorizontal:!0,offsetParent:this.bodyScroller.canvas.el}),s=this.slotDates,t=r=0,o=s.length;r<o;t=++r)e=s[t],this.view.publiclyTrigger("dayRender",null,e,this.slatEls.eq(t));if(this.follower)return this.follower.setSprites(this.headEl.find("tr:not(:last-child) .fc-cell-text"))},r.prototype.unrenderDates=function(){return this.follower&&this.follower.clearSprites(),this.headScroller.canvas.contentEl.empty(),this.slatContainerEl.empty(),this.headScroller.canvas.clearWidth(),this.bodyScroller.canvas.clearWidth()},r.prototype.renderHeadHtml=function(){var e,t,r,o,s,n,i,l,u,h,c,a,p,f,g,y,v,R,w,m,S,b,C,E,H,T,_,I,D,x,G,B,F,W,M,L,z,k,P;for(v=this.labelInterval,s=this.headerFormats,t=function(){var e,t,r;for(r=[],e=0,t=s.length;e<t;e++)o=s[e],r.push([]);return r}(),R=null,x=null,z=this.slotDates,L=[],W=function(){var e,t,r;for(r=[],e=0,t=s.length;e<t;e++)o=s[e],r.push(d.queryMostGranularFormatUnit(o));return r}(),f=0,w=z.length;f<w;f++){for(r=z[f],P=r.week(),p=this.emphasizeWeeks&&null!==x&&x!==P,B=g=0,m=s.length;g<m;B=++g)o=s[B],F=t[B],R=F[F.length-1],a=s.length>1&&B<s.length-1,I=null,a?(k=r.format(o),R&&R.text===k?R.colspan+=1:I=this.buildCellObject(r,k,W[B])):!R||He(ae(this.start,r,v))?(k=r.format(o),I=this.buildCellObject(r,k,W[B])):R.colspan+=1,I&&(I.weekStart=p,F.push(I));L.push({weekStart:p}),x=P}for(u=v>this.slotDuration,c=1===this.slotDuration.as("days"),i="<table>",i+="<colgroup>",y=0,S=z.length;y<S;y++)r=z[y],i+="<col/>";for(i+="</colgroup>",i+="<tbody>",l=T=0,b=t.length;T<b;l=++T){for(F=t[l],h=l===t.length-1,i+="<tr"+(u&&h?' class="fc-chrono"':"")+">",_=0,C=F.length;_<C;_++)e=F[_],n=[this.view.widgetHeaderClass],e.weekStart&&n.push("fc-em-cell"),c&&(n=n.concat(this.getDayClasses(e.date,!0))),i+='<th class="'+n.join(" ")+'" data-date="'+e.date.format()+'"'+(e.colspan>1?' colspan="'+e.colspan+'"':"")+'><div class="fc-cell-content">'+e.spanHtml+"</div></th>";i+="</tr>"}for(i+="</tbody></table>",M="<table>",M+="<colgroup>",D=0,E=L.length;D<E;D++)e=L[D],M+="<col/>";for(M+="</colgroup>",M+="<tbody><tr>",l=G=0,H=L.length;G<H;l=++G)e=L[l],r=z[l],M+=this.slatCellHtml(r,e.weekStart);return M+="</tr></tbody></table>",this._slatHtml=M,i},r.prototype.buildCellObject=function(e,t,r){var o;return e=e.clone(),o=this.view.buildGotoAnchorHtml({date:e,type:r,forceOff:!r},{"class":"fc-cell-text"},Se(t)),{text:t,spanHtml:o,date:e,colspan:1}},r.prototype.renderSlatHtml=function(){return this._slatHtml},r.prototype.slatCellHtml=function(e,t){var r;return this.isTimeScale?(r=[],r.push(He(ae(this.start,e,this.labelInterval))?"fc-major":"fc-minor")):(r=this.getDayClasses(e),r.push("fc-day")),r.unshift(this.view.widgetContentClass),t&&r.push("fc-em-cell"),'<td class="'+r.join(" ")+'" data-date="'+e.format()+'"><div /></td>'},r.prototype.businessHourSegs=null,r.prototype.renderBusinessHours=function(){var e;if(!this.largeUnit)return e=this.businessHourSegs=this.buildBusinessHourSegs(!this.isTimeScale),this.renderFill("businessHours",e,"bgevent")},r.prototype.unrenderBusinessHours=function(){return this.unrenderFill("businessHours")},r.prototype.nowIndicatorEls=null,r.prototype.getNowIndicatorUnit=function(){if(this.isTimeScale)return re(this.slotDuration)},r.prototype.renderNowIndicator=function(t){var r,o,s;return s=[],t=this.normalizeGridDate(t),t>=this.start&&t<this.end&&(r=this.dateToCoord(t),o=this.isRTL?{right:-r}:{left:r},s.push(e("<div class='fc-now-indicator fc-now-indicator-arrow'></div>").css(o).appendTo(this.headScroller.canvas.el)[0]),s.push(e("<div class='fc-now-indicator fc-now-indicator-line'></div>").css(o).appendTo(this.bodyScroller.canvas.el)[0])),this.nowIndicatorEls=e(s)},r.prototype.unrenderNowIndicator=function(){if(this.nowIndicatorEls)return this.nowIndicatorEls.remove(),this.nowIndicatorEls=null},r.prototype.explicitSlotWidth=null,r.prototype.defaultSlotWidth=null,r.prototype.updateWidth=function(){var e,t,r,o,s,n;if(o=this.headColEls,o?(n=Math.round(this.slotWidth||(this.slotWidth=this.computeSlotWidth())),r=n*this.slotDates.length,t="",s=n,e=this.bodyScroller.getClientWidth(),e>r&&(t=e,r="",s=Math.floor(e/this.slotDates.length))):(r="",t=""),this.headScroller.canvas.setWidth(r),this.headScroller.canvas.setMinWidth(t),this.bodyScroller.canvas.setWidth(r),this.bodyScroller.canvas.setMinWidth(t),o&&this.headColEls.slice(0,-1).add(this.slatColEls.slice(0,-1)).width(s),this.headScroller.updateSize(),this.bodyScroller.updateSize(),this.joiner.update(),o&&(this.buildCoords(),this.updateSegPositions(),this.view.updateNowIndicator()),this.follower&&this.follower.update(),this.eventTitleFollower)return this.eventTitleFollower.update()},r.prototype.computeSlotWidth=function(){var t,r,o,s,n,i;return o=0,r=this.headEl.find("tr:last-child th .fc-cell-text"),r.each(function(t,r){var s;return s=e(r).outerWidth(),o=Math.max(o,s)}),t=o+1,i=ce(this.labelInterval,this.slotDuration),n=Math.ceil(t/i),s=this.headColEls.eq(0).css("min-width"),s&&(s=parseInt(s,10),s&&(n=Math.max(n,s))),n},r.prototype.buildCoords=function(){return this.containerCoordCache.build(),this.slatCoordCache.build(),this.slatInnerCoordCache.build()},r.prototype.computeDateSnapCoverage=function(e){var t,r,o;return r=ae(this.start,e,this.snapDuration),r<0?0:r>=this.snapDiffToIndex.length?this.snapCnt:(o=Math.floor(r),t=this.snapDiffToIndex[o],He(t)?t+=r-o:t=Math.ceil(t),t)},r.prototype.dateToCoord=function(e){var t,r,o,s,n;return n=this.computeDateSnapCoverage(e),o=n/this.snapsPerSlot,s=Math.floor(o),s=Math.min(s,this.slotCnt-1),r=o-s,t=this.slatInnerCoordCache,this.isRTL?t.getRightPosition(s)-t.getWidth(s)*r-this.containerCoordCache.getWidth(0):t.getLeftPosition(s)+t.getWidth(s)*r},r.prototype.rangeToCoords=function(e){return this.isRTL?{right:this.dateToCoord(e.start),left:this.dateToCoord(e.end)}:{left:this.dateToCoord(e.start),right:this.dateToCoord(e.end)}},r.prototype.headHeight=function(){var e;return e=this.headScroller.canvas.contentEl.find("table"),e.height.apply(e,arguments)},r.prototype.updateSegPositions=function(){var e,t,r,o,s;for(s=(this.segs||[]).concat(this.businessHourSegs||[]),t=0,r=s.length;t<r;t++)o=s[t],e=this.rangeToCoords(o),o.el.css({left:o.left=e.left,right:-(o.right=e.right)})},r.prototype.renderFgSegs=function(e){return e=this.renderFgSegEls(e),this.renderFgSegsInContainers([[this,e]]),this.updateSegFollowers(e),e},r.prototype.unrenderFgSegs=function(){return this.clearSegFollowers(),this.unrenderFgContainers([this])},r.prototype.renderFgSegsInContainers=function(e){var t,r,o,s,n,i,l,u,h,c,a,p,d,f,g,y,v,R,w,m,S,b,C,E,H;for(o=0,i=e.length;o<i;o++)for(w=e[o],t=w[0],H=w[1],s=0,l=H.length;s<l;s++)E=H[s],r=this.rangeToCoords(E),E.el.css({left:E.left=r.left,right:-(E.right=r.right)});for(n=0,u=e.length;n<u;n++)for(m=e[n],t=m[0],H=m[1],f=0,h=H.length;f<h;f++)E=H[f],E.el.appendTo(t.segContainerEl);for(g=0,c=e.length;g<c;g++){for(S=e[g],t=S[0],H=S[1],y=0,a=H.length;y<a;y++)E=H[y],E.height=E.el.outerHeight(!0);this.buildSegLevels(H),t.segContainerHeight=se(H)}for(C=[],v=0,p=e.length;v<p;v++){for(b=e[v],t=b[0],H=b[1],R=0,d=H.length;R<d;R++)E=H[R],E.el.css("top",E.top);C.push(t.segContainerEl.height(t.segContainerHeight))}return C},r.prototype.buildSegLevels=function(e){var t,r,o,s,n,i,l,u,h,c,a,p,d,f;for(d=[],this.sortEventSegs(e),o=0,i=e.length;o<i;o++){for(f=e[o],f.above=[],h=0;h<d.length;){for(r=!1,a=d[h],s=0,l=a.length;s<l;s++)c=a[s],Ne(f,c)&&(f.above.push(c),r=!0);if(!r)break;h+=1}for((d[h]||(d[h]=[])).push(f),h+=1;h<d.length;){for(p=d[h],n=0,u=p.length;n<u;n++)t=p[n],Ne(f,t)&&t.above.push(f);h+=1}}return d},r.prototype.unrenderFgContainers=function(e){var t,r,o,s;for(s=[],r=0,o=e.length;r<o;r++)t=e[r],t.segContainerEl.empty(),t.segContainerEl.height(""),s.push(t.segContainerHeight=null);return s},r.prototype.fgSegHtml=function(e,t){var r,o,s,n,i,l;return o=e.event,s=this.view.isEventDraggable(o),i=e.isStart&&this.view.isEventResizableFromStart(o),n=e.isEnd&&this.view.isEventResizableFromEnd(o),r=this.getSegClasses(e,s,i||n),r.unshift("fc-timeline-event","fc-h-event"),l=this.getEventTimeText(o),'<a class="'+r.join(" ")+'" style="'+le(this.getSegSkinCss(e))+'"'+(o.url?' href="'+Se(o.url)+'"':"")+'><div class="fc-content">'+(l?'<span class="fc-time">'+Se(l)+"</span>":"")+'<span class="fc-title">'+(o.title?Se(o.title):"&nbsp;")+'</span></div><div class="fc-bg" />'+(i?'<div class="fc-resizer fc-start-resizer"></div>':"")+(n?'<div class="fc-resizer fc-end-resizer"></div>':"")+"</a>"},r.prototype.updateSegFollowers=function(e){var t,r,o,s,n;if(this.eventTitleFollower){for(s=[],t=0,r=e.length;t<r;t++)o=e[t],n=o.el.find(".fc-title"),n.length&&s.push(new A(n));return this.eventTitleFollower.setSprites(s)}},r.prototype.clearSegFollowers=function(){if(this.eventTitleFollower)return this.eventTitleFollower.clearSprites()},r.prototype.segDragStart=function(){if(r.__super__.segDragStart.apply(this,arguments),this.eventTitleFollower)return this.eventTitleFollower.forceRelative()},r.prototype.segDragEnd=function(){if(r.__super__.segDragEnd.apply(this,arguments),this.eventTitleFollower)return this.eventTitleFollower.clearForce()},r.prototype.segResizeStart=function(){if(r.__super__.segResizeStart.apply(this,arguments),this.eventTitleFollower)return this.eventTitleFollower.forceRelative()},r.prototype.segResizeEnd=function(){if(r.__super__.segResizeEnd.apply(this,arguments),this.eventTitleFollower)return this.eventTitleFollower.clearForce()},r.prototype.renderHelper=function(e,t){var r;return r=this.eventToSegs(e),r=this.renderFgSegEls(r),this.renderHelperSegsInContainers([[this,r]],t)},r.prototype.renderHelperSegsInContainers=function(t,r){var o,s,n,i,l,u,h,c,a,p,d,f,g,y,v,R,w,m;for(i=[],w=[],l=0,c=t.length;l<c;l++)for(g=t[l],o=g[0],m=g[1],u=0,a=m.length;u<a;u++)R=m[u],s=this.rangeToCoords(R),R.el.css({left:R.left=s.left,right:-(R.right=s.right)}),r&&r.resourceId===(null!=(y=o.resource)?y.id:void 0)?R.el.css("top",r.el.css("top")):R.el.css("top",0);for(h=0,p=t.length;h<p;h++)for(v=t[h],o=v[0],m=v[1],n=e('<div class="fc-event-container fc-helper-container"/>').appendTo(o.innerEl),i.push(n[0]),f=0,d=m.length;f<d;f++)R=m[f],n.append(R.el),w.push(R.el[0]);return this.helperEls?this.helperEls=this.helperEls.add(e(i)):this.helperEls=e(i),e(w)},r.prototype.unrenderHelper=function(){if(this.helperEls)return this.helperEls.remove(),this.helperEls=null},r.prototype.renderEventResize=function(e,t){var r,o,s,n;for(o=this.eventToSpans(e),s=0,n=o.length;s<n;s++)r=o[s],this.renderHighlight(r);return this.renderEventLocationHelper(e,t)},r.prototype.unrenderEventResize=function(){return this.unrenderHighlight(),this.unrenderHelper()},r.prototype.renderFill=function(e,t,r){return t=this.renderFillSegEls(e,t),this.renderFillInContainers(e,[[this,t]],r),t},r.prototype.renderFillInContainers=function(e,t,r){var o,s,n,i,l,u;for(l=[],s=0,n=t.length;s<n;s++)i=t[s],o=i[0],u=i[1],l.push(this.renderFillInContainer(e,o,u,r));return l},r.prototype.renderFillInContainer=function(t,r,o,s){var n,i,l,u,h;if(o.length){for(s||(s=t.toLowerCase()),n=e('<div class="fc-'+s+'-container" />').appendTo(r.bgSegContainerEl),l=0,u=o.length;l<u;l++)h=o[l],i=this.rangeToCoords(h),h.el.css({left:h.left=i.left,right:-(h.right=i.right)
+}),h.el.appendTo(n);return this.elsByFill[t]?this.elsByFill[t]=this.elsByFill[t].add(n):this.elsByFill[t]=n}},r.prototype.renderDrag=function(e,t){var r,o,s,n;if(t)return this.renderEventLocationHelper(e,t);for(o=this.eventToSpans(e),s=0,n=o.length;s<n;s++)r=o[s],this.renderHighlight(r);return null},r.prototype.unrenderDrag=function(){return this.unrenderHelper(),this.unrenderHighlight()},r}(f),se=function(e){var t,r,o,s;for(o=0,t=0,r=e.length;t<r;t++)s=e[t],o=Math.max(o,oe(s));return o},oe=function(e){return null==e.top&&(e.top=se(e.above)),e.top+e.height},Ne=function(e,t){return e.left<t.right&&e.right>t.left},S=18,w=6,R=200,m=1e3,u={months:1},P=[{years:1},{months:1},{days:1},{hours:1},{minutes:30},{minutes:15},{minutes:10},{minutes:5},{minutes:1},{seconds:30},{seconds:15},{seconds:10},{seconds:5},{seconds:1},{milliseconds:500},{milliseconds:100},{milliseconds:10},{milliseconds:1}],j.prototype.initScaleProps=function(){var r,o,s;return this.labelInterval=this.queryDurationOption("slotLabelInterval"),this.slotDuration=this.queryDurationOption("slotDuration"),this.validateLabelAndSlot(),this.ensureLabelInterval(),this.ensureSlotDuration(),r=this.opt("slotLabelFormat"),s=e.type(r),this.headerFormats="array"===s?r:"string"===s?[r]:this.computeHeaderFormats(),this.isTimeScale=pe(this.slotDuration),this.largeUnit=this.isTimeScale?void 0:(o=re(this.slotDuration),/year|month|week/.test(o)?o:void 0),this.emphasizeWeeks=1===this.slotDuration.as("days")&&this.view.currentRangeAs("weeks")>=2&&!this.opt("businessHours"),this.snapDuration=(r=this.opt("snapDuration"))?t.duration(r):this.slotDuration,this.minResizeDuration=this.snapDuration,this.snapsPerSlot=ce(this.slotDuration,this.snapDuration)},j.prototype.queryDurationOption=function(e){var r,o;if(o=this.opt(e),null!=o&&(r=t.duration(o),+r))return r},j.prototype.validateLabelAndSlot=function(){var e,t,r,o;if(e=this.view.currentRange,this.labelInterval&&(t=ae(e.start,e.end,this.labelInterval),t>m&&(d.warn("slotLabelInterval results in too many cells"),this.labelInterval=null)),this.slotDuration&&(r=ae(e.start,e.end,this.slotDuration),r>m&&(d.warn("slotDuration results in too many cells"),this.slotDuration=null)),this.labelInterval&&this.slotDuration&&(o=ce(this.labelInterval,this.slotDuration),!He(o)||o<1))return d.warn("slotLabelInterval must be a multiple of slotDuration"),this.slotDuration=null},j.prototype.computeFallbackDuration=function(){var e,r,o,s,n;if(e=null,this.labelInterval||this.slotDuration)for(n=this.ensureLabelInterval(),o=P.length-1;o>=0&&(r=P[o],e=t.duration(r),s=ce(e,n),!(s>=S));o+=-1);else e=t.duration(u);return e},j.prototype.ensureLabelInterval=function(){var e,r,o,s,n,i,l,u,h,c;if(e=this.view.currentRange,i=this.labelInterval,!i){if(this.slotDuration){for(o=0,l=P.length;o<l;o++)if(r=P[o],c=t.duration(r),h=ce(c,this.slotDuration),He(h)&&h<=w){i=c;break}i||(i=this.slotDuration)}else for(s=0,u=P.length;s<u&&(r=P[s],i=t.duration(r),n=ae(e.start,e.end,i),!(n>=S));s++);this.labelInterval=i}return i},j.prototype.ensureSlotDuration=function(){var e,r,o,s,n,i,l,u,h;if(e=this.view.currentRange,l=this.slotDuration,!l){for(s=this.ensureLabelInterval(),o=0,n=P.length;o<n;o++)if(r=P[o],h=t.duration(r),u=ce(s,h),He(u)&&u>1&&u<=w){l=h;break}l&&(i=ae(e.start,e.end,l),i>R&&(l=null)),l||(l=s),this.slotDuration=l}return l},j.prototype.computeHeaderFormats=function(){var e,t,r,o,s,n,i;switch(n=this.view,o=this.labelInterval,s=re(o),i=this.opt("weekNumbers"),e=t=r=null,"week"!==s||i||(s="day"),s){case"year":e="YYYY";break;case"month":n.currentRangeAs("years")>1&&(e="YYYY"),t="MMM";break;case"week":n.currentRangeAs("years")>1&&(e="YYYY"),t=this.opt("shortWeekFormat");break;case"day":n.currentRangeAs("years")>1?e=this.opt("monthYearFormat"):n.currentRangeAs("months")>1&&(e="MMMM"),i&&(t=this.opt("weekFormat")),r="dd D";break;case"hour":i&&(e=this.opt("weekFormat")),n.currentRangeAs("days")>1&&(t=this.opt("dayOfMonthFormat")),r=this.opt("smallTimeFormat");break;case"minute":o.asMinutes()/60>=w?(e=this.opt("hourFormat"),t="[:]mm"):e=this.opt("mediumTimeFormat");break;case"second":o.asSeconds()/60>=w?(e="LT",t="[:]ss"):e="LTS";break;case"millisecond":e="LTS",t="[.]SSS"}return[].concat(e||[],t||[],r||[])},d.views.timeline={"class":Y,defaults:{eventResizableFromStart:!0}},d.views.timelineDay={type:"timeline",duration:{days:1}},d.views.timelineWeek={type:"timeline",duration:{weeks:1}},d.views.timelineMonth={type:"timeline",duration:{months:1}},d.views.timelineYear={type:"timeline",duration:{years:1}},M=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.mixin(L),r.prototype.canHandleSpecificResources=!0,r.prototype.resourceGrid=null,r.prototype.tbodyHash=null,r.prototype.joiner=null,r.prototype.dividerEls=null,r.prototype.superHeaderText=null,r.prototype.isVGrouping=null,r.prototype.isHGrouping=null,r.prototype.groupSpecs=null,r.prototype.colSpecs=null,r.prototype.orderSpecs=null,r.prototype.rowHierarchy=null,r.prototype.resourceRowHash=null,r.prototype.nestingCnt=0,r.prototype.isNesting=null,r.prototype.dividerWidth=null,r.prototype.initialize=function(){return r.__super__.initialize.apply(this,arguments),this.processResourceOptions(),this.resourceGrid=new V(this),this.rowHierarchy=new k(this),this.resourceRowHash={}},r.prototype.instantiateGrid=function(){return new W(this)},r.prototype.processResourceOptions=function(){var e,t,r,o,s,n,i,l,u,h,c,a,p,d,f,g,y,v,R,w,m,S;for(e=this.opt("resourceColumns")||[],f=this.opt("resourceLabelText"),o="Resources",S=null,e.length?S=f:e.push({labelText:f||o,text:this.getResourceTextFunc()}),w=[],s=[],i=[],c=!1,h=!1,a=0,g=e.length;a<g;a++)r=e[a],r.group?s.push(r):w.push(r);for(w[0].isMain=!0,s.length?(i=s,c=!0):(l=this.opt("resourceGroupField"),l&&(h=!0,i.push({field:l,text:this.opt("resourceGroupText"),render:this.opt("resourceGroupRender")}))),t=Le(this.opt("resourceOrder")),m=[],p=0,y=t.length;p<y;p++){for(R=t[p],u=!1,d=0,v=i.length;d<v;d++)if(n=i[d],n.field===R.field){n.order=R.order,u=!0;break}u||m.push(R)}return this.superHeaderText=S,this.isVGrouping=c,this.isHGrouping=h,this.groupSpecs=i,this.colSpecs=s.concat(w),this.orderSpecs=m},r.prototype.renderSkeleton=function(){return r.__super__.renderSkeleton.apply(this,arguments),this.renderResourceGridSkeleton(),this.tbodyHash={spreadsheet:this.resourceGrid.tbodyEl,event:this.timeGrid.tbodyEl},this.joiner=new q("vertical",[this.resourceGrid.bodyScroller,this.timeGrid.bodyScroller]),this.initDividerMoving()},r.prototype.renderSkeletonHtml=function(){return'<table> <thead class="fc-head"> <tr> <td class="fc-resource-area '+this.widgetHeaderClass+'"></td> <td class="fc-divider fc-col-resizer '+this.widgetHeaderClass+'"></td> <td class="fc-time-area '+this.widgetHeaderClass+'"></td> </tr> </thead> <tbody class="fc-body"> <tr> <td class="fc-resource-area '+this.widgetContentClass+'"></td> <td class="fc-divider fc-col-resizer '+this.widgetHeaderClass+'"></td> <td class="fc-time-area '+this.widgetContentClass+'"></td> </tr> </tbody> </table>'},r.prototype.renderResourceGridSkeleton=function(){return this.resourceGrid.el=this.el.find("tbody .fc-resource-area"),this.resourceGrid.headEl=this.el.find("thead .fc-resource-area"),this.resourceGrid.renderSkeleton()},r.prototype.initDividerMoving=function(){var e;return this.dividerEls=this.el.find(".fc-divider"),this.dividerWidth=null!=(e=this.opt("resourceAreaWidth"))?e:this.resourceGrid.tableWidth,null!=this.dividerWidth&&this.positionDivider(this.dividerWidth),this.dividerEls.on("mousedown",function(e){return function(t){return e.dividerMousedown(t)}}(this))},r.prototype.dividerMousedown=function(e){var t,r,o,s,n;return r=this.opt("isRTL"),s=30,o=this.el.width()-30,n=this.getNaturalDividerWidth(),t=new h({dragStart:function(e){return function(){return e.dividerEls.addClass("fc-active")}}(this),drag:function(e){return function(t,i){var l;return l=r?n-t:n+t,l=Math.max(l,s),l=Math.min(l,o),e.dividerWidth=l,e.positionDivider(l),e.updateWidth()}}(this),dragEnd:function(e){return function(){return e.dividerEls.removeClass("fc-active")}}(this)}),t.startInteraction(e)},r.prototype.getNaturalDividerWidth=function(){return this.el.find(".fc-resource-area").width()},r.prototype.positionDivider=function(e){return this.el.find(".fc-resource-area").width(e)},r.prototype.renderEvents=function(e){return this.timeGrid.renderEvents(e),this.syncRowHeights(),this.updateWidth()},r.prototype.unrenderEvents=function(){return this.timeGrid.unrenderEvents(),this.syncRowHeights(),this.updateWidth()},r.prototype.updateWidth=function(){if(r.__super__.updateWidth.apply(this,arguments),this.resourceGrid.updateWidth(),this.joiner.update(),this.cellFollower)return this.cellFollower.update()},r.prototype.updateHeight=function(e){if(r.__super__.updateHeight.apply(this,arguments),e)return this.syncRowHeights()},r.prototype.setHeight=function(e,t){var r,o;return o=this.syncHeadHeights(),r=t?"auto":e-o-this.queryMiscHeight(),this.timeGrid.bodyScroller.setHeight(r),this.resourceGrid.bodyScroller.setHeight(r)},r.prototype.queryMiscHeight=function(){return this.el.outerHeight()-Math.max(this.resourceGrid.headScroller.el.outerHeight(),this.timeGrid.headScroller.el.outerHeight())-Math.max(this.resourceGrid.bodyScroller.el.outerHeight(),this.timeGrid.bodyScroller.el.outerHeight())},r.prototype.syncHeadHeights=function(){var e;return this.resourceGrid.headHeight("auto"),this.timeGrid.headHeight("auto"),e=Math.max(this.resourceGrid.headHeight(),this.timeGrid.headHeight()),this.resourceGrid.headHeight(e),this.timeGrid.headHeight(e),e},r.prototype.renderResources=function(e){var t,r,o;for(this.batchRows(),t=0,r=e.length;t<r;t++)o=e[t],this.insertResource(o);return this.rowHierarchy.show(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.unrenderResources=function(){return this.batchRows(),this.rowHierarchy.removeChildren(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.renderResource=function(e){return this.insertResource(e),this.reinitializeCellFollowers()},r.prototype.unrenderResource=function(e){var t;if(t=this.getResourceRow(e.id))return this.batchRows(),t.remove(),this.unbatchRows(),this.reinitializeCellFollowers()},r.prototype.cellFollower=null,r.prototype.reinitializeCellFollowers=function(){var t,r,o,s,n,i;for(this.cellFollower&&this.cellFollower.clearSprites(),this.cellFollower=new O(this.resourceGrid.bodyScroller,(!0)),this.cellFollower.isHFollowing=!1,this.cellFollower.isVFollowing=!0,s=[],n=this.rowHierarchy.getNodes(),r=0,o=n.length;r<o;r++)i=n[r],i instanceof X&&i.groupTd&&(t=i.groupTd.find(".fc-cell-content"),t.length&&s.push(t[0]));return this.cellFollower.setSprites(e(s))},r.prototype.insertResource=function(e,t){var r,o,s,n,i,l,u;for(u=new B(this,e),null==t&&(n=e.parentId,n&&(t=this.getResourceRow(n))),t?this.insertRowAsChild(u,t):this.insertRow(u),i=e.children,l=[],o=0,s=i.length;o<s;o++)r=i[o],l.push(this.insertResource(r,u));return l},r.prototype.insertRow=function(e,t,r){var o;return null==t&&(t=this.rowHierarchy),null==r&&(r=this.groupSpecs),r.length?(o=this.ensureResourceGroup(e,t,r[0]),o instanceof g?this.insertRowAsChild(e,o):this.insertRow(e,o,r.slice(1))):this.insertRowAsChild(e,t)},r.prototype.insertRowAsChild=function(e,t){return t.addChild(e,this.computeChildRowPosition(e,t))},r.prototype.computeChildRowPosition=function(e,t){var r,o,s,n,i,l;if(this.orderSpecs.length)for(i=t.children,o=s=0,n=i.length;s<n;o=++s)if(l=i[o],r=this.compareResources(l.resource||{},e.resource||{}),r>0)return o;return null},r.prototype.compareResources=function(e,t){return te(e,t,this.orderSpecs)},r.prototype.ensureResourceGroup=function(e,t,r){var o,s,n,i,l,u,h,c,a,p,d;if(n=(e.resource||{})[r.field],s=null,r.order)for(a=t.children,i=l=0,h=a.length;l<h;i=++l){if(d=a[i],o=de(d.groupValue,n)*r.order,0===o){s=d;break}if(o>0)break}else for(p=t.children,i=u=0,c=p.length;u<c;i=++u)if(d=p[i],d.groupValue===n){s=d;break}return s||(s=this.isVGrouping?new X(this,r,n):new g(this,r,n),t.addChild(s,i)),s},r.prototype.pairSegsWithRows=function(e){var t,r,o,s,n,i,l,u;for(s=[],n={},t=0,r=e.length;t<r;t++)u=e[t],i=u.resourceId,i&&(l=this.getResourceRow(i),l&&(o=n[i],o||(o=[l,[]],s.push(o),n[i]=o),o[1].push(u)));return s},r.prototype.rowAdded=function(e){var t,r;return e instanceof B&&(this.resourceRowHash[e.resource.id]=e,this.timeGrid.assignRowBusinessHourSegs(e)),r=this.isNesting,t=Boolean(this.nestingCnt+=e.depth?1:0),r!==t&&(this.el.toggleClass("fc-nested",t),this.el.toggleClass("fc-flat",!t)),this.isNesting=t},r.prototype.rowRemoved=function(e){var t,r;return e instanceof B&&(delete this.resourceRowHash[e.resource.id],this.timeGrid.destroyRowBusinessHourSegs(e)),r=this.isNesting,t=Boolean(this.nestingCnt-=e.depth?1:0),r!==t&&(this.el.toggleClass("fc-nested",t),this.el.toggleClass("fc-flat",!t)),this.isNesting=t},r.prototype.batchRowDepth=0,r.prototype.shownRowBatch=null,r.prototype.hiddenRowBatch=null,r.prototype.batchRows=function(){if(!this.batchRowDepth++)return this.shownRowBatch=[],this.hiddenRowBatch=[]},r.prototype.unbatchRows=function(){if(!--this.batchRowDepth)return this.hiddenRowBatch.length&&this.rowsHidden(this.hiddenRowBatch),this.shownRowBatch.length&&this.rowsShown(this.shownRowBatch),this.hiddenRowBatch=null,this.shownRowBatch=null},r.prototype.rowShown=function(e){return this.shownRowBatch?this.shownRowBatch.push(e):this.rowsShown([e])},r.prototype.rowHidden=function(e){return this.hiddenRowBatch?this.hiddenRowBatch.push(e):this.rowsHidden([e])},r.prototype.rowsShown=function(e){return this.syncRowHeights(e),this.updateWidth()},r.prototype.rowsHidden=function(e){return this.updateWidth()},r.prototype.syncRowHeights=function(e,t){var r,o,s,n,i,l,u,h,c,a;for(null==t&&(t=!1),null==e&&(e=this.getVisibleRows()),l=0,h=e.length;l<h;l++)a=e[l],a.setTrInnerHeight("");for(i=function(){var o,s,n;for(n=[],o=0,s=e.length;o<s;o++)a=e[o],r=a.getMaxTrInnerHeight(),t&&(r+=r%2),n.push(r);return n}(),n=u=0,c=e.length;u<c;n=++u)a=e[n],a.setTrInnerHeight(i[n]);if(!t&&(o=this.resourceGrid.tbodyEl.height(),s=this.timeGrid.tbodyEl.height(),Math.abs(o-s)>1))return this.syncRowHeights(e,!0)},r.prototype.getVisibleRows=function(){var e,t,r,o,s;for(r=this.rowHierarchy.getRows(),o=[],e=0,t=r.length;e<t;e++)s=r[e],s.isShown&&o.push(s);return o},r.prototype.getEventRows=function(){var e,t,r,o,s;for(r=this.rowHierarchy.getRows(),o=[],e=0,t=r.length;e<t;e++)s=r[e],s instanceof p&&o.push(s);return o},r.prototype.getResourceRow=function(e){return this.resourceRowHash[e]},r.prototype.queryResourceScroll=function(){var e,t,r,o,s,n,i,l;for(i={},l=this.timeGrid.bodyScroller.scrollEl.offset().top,s=this.getVisibleRows(),r=0,o=s.length;r<o;r++)if(n=s[r],n.resource&&(e=n.getTr("event"),t=e.offset().top+e.outerHeight(),t>l)){i.resourceId=n.resource.id,i.bottom=t-l;break}return i},r.prototype.applyResourceScroll=function(e){var t,r,o,s,n;if(e.resourceId&&(s=this.getResourceRow(e.resourceId),s&&(t=s.getTr("event"))))return o=this.timeGrid.bodyScroller.canvas.el.offset().top,r=t.offset().top+t.outerHeight(),n=r-e.bottom-o,this.timeGrid.bodyScroller.setScrollTop(n),this.resourceGrid.bodyScroller.setScrollTop(n)},r.prototype.scrollToResource=function(e){var t,r,o,s;if(o=this.getResourceRow(e.id),o&&(t=o.getTr("event")))return r=this.timeGrid.bodyScroller.canvas.el.offset().top,s=t.offset().top-r,this.timeGrid.bodyScroller.setScrollTop(s),this.resourceGrid.bodyScroller.setScrollTop(s)},r}(Y),W=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.mixin(D),r.prototype.eventRows=null,r.prototype.shownEventRows=null,r.prototype.tbodyEl=null,r.prototype.rowCoordCache=null,r.prototype.spanToSegs=function(e){var t,o,s,n,i,l;if(l=r.__super__.spanToSegs.apply(this,arguments),t=this.view.calendar,n=e.resourceId)for(o=0,s=l.length;o<s;o++)i=l[o],i.resource=t.getResourceById(n),i.resourceId=n;return l},r.prototype.prepareHits=function(){var e,t;return r.__super__.prepareHits.apply(this,arguments),this.eventRows=this.view.getEventRows(),this.shownEventRows=function(){var t,r,o,s;for(o=this.eventRows,s=[],t=0,r=o.length;t<r;t++)e=o[t],e.isShown&&s.push(e);return s}.call(this),t=function(){var t,r,o,s;for(o=this.shownEventRows,s=[],t=0,r=o.length;t<r;t++)e=o[t],s.push(e.getTr("event")[0]);return s}.call(this),this.rowCoordCache=new l({els:t,isVertical:!0}),this.rowCoordCache.build()},r.prototype.releaseHits=function(){return r.__super__.releaseHits.apply(this,arguments),this.eventRows=null,this.shownEventRows=null,this.rowCoordCache.clear()},r.prototype.queryHit=function(e,t){var o,s;if(s=r.__super__.queryHit.apply(this,arguments),s&&(o=this.rowCoordCache.getVerticalIndex(t),null!=o))return{resourceId:this.shownEventRows[o].resource.id,snap:s.snap,component:this,left:s.left,right:s.right,top:this.rowCoordCache.getTopOffset(o),bottom:this.rowCoordCache.getBottomOffset(o)}},r.prototype.getHitSpan=function(e){var t;return t=this.getSnapRange(e.snap),t.resourceId=e.resourceId,t},r.prototype.getHitEl=function(e){return this.getSnapEl(e.snap)},r.prototype.renderSkeleton=function(){var t;return r.__super__.renderSkeleton.apply(this,arguments),this.segContainerEl.remove(),this.segContainerEl=null,t=e('<div class="fc-rows"><table><tbody/></table></div>').appendTo(this.bodyScroller.canvas.contentEl),this.tbodyEl=t.find("tbody")},r.prototype.renderFgSegs=function(e){var t,r,o,s,n,i,l;for(e=this.renderFgSegEls(e),i=this.view.pairSegsWithRows(e),l=[],o=0,s=i.length;o<s;o++)n=i[o],t=n[0],r=n[1],t.fgSegs=r,t.isShown&&(t.isSegsRendered=!0,l.push(n));return this.renderFgSegsInContainers(l),this.updateSegFollowers(e),e},r.prototype.unrenderFgSegs=function(){var e,t,r,o;for(this.clearSegFollowers(),t=this.view.getEventRows(),r=0,o=t.length;r<o;r++)e=t[r],e.fgSegs=null,e.isSegsRendered=!1;return this.unrenderFgContainers(t)},r.prototype.unrenderBgSegs=function(){var e,t,o,s,n;for(r.__super__.unrenderBgSegs.apply(this,arguments),t=this.view.getEventRows(),n=[],o=0,s=t.length;o<s;o++)e=t[o],n.push(e.bgSegs=null);return n},r.prototype.rowCntWithCustomBusinessHours=0,r.prototype.renderBusinessHours=function(){return this.rowCntWithCustomBusinessHours?this.ensureIndividualBusinessHours():r.__super__.renderBusinessHours.apply(this,arguments)},r.prototype.unrenderBusinessHours=function(){return this.rowCntWithCustomBusinessHours?this.clearIndividualBusinessHours():r.__super__.unrenderBusinessHours.apply(this,arguments)},r.prototype.ensureIndividualBusinessHours=function(){var e,t,r,o,s;for(r=this.view.getEventRows(),o=[],e=0,t=r.length;e<t;e++)s=r[e],this.view.has("dateProfile")&&!s.businessHourSegs&&this.populateRowBusinessHoursSegs(s),s.isShown?o.push(s.ensureBusinessHourSegsRendered()):o.push(void 0);return o},r.prototype.clearIndividualBusinessHours=function(){var e,t,r,o,s;for(r=this.view.getEventRows(),o=[],e=0,t=r.length;e<t;e++)s=r[e],o.push(s.clearBusinessHourSegs());return o},r.prototype.assignRowBusinessHourSegs=function(e){if(e.resource.businessHours&&(this.rowCntWithCustomBusinessHours||(j.prototype.unrenderBusinessHours.call(this),this.ensureIndividualBusinessHours()),this.rowCntWithCustomBusinessHours+=1),this.view.has("dateProfile")&&this.rowCntWithCustomBusinessHours)return this.populateRowBusinessHoursSegs(e)},r.prototype.destroyRowBusinessHourSegs=function(e){if(e.clearBusinessHourSegs(),e.resource.businessHours&&(this.rowCntWithCustomBusinessHours-=1,!this.rowCntWithCustomBusinessHours))return this.clearIndividualBusinessHours(),j.prototype.renderBusinessHours.call(this)},r.prototype.populateRowBusinessHoursSegs=function(e){var t,r,o;r=e.resource.businessHours||this.view.opt("businessHours"),o=this.view.calendar.computeBusinessHourEvents(!this.isTimeScale,r),t=this.eventsToSegs(o),t=this.renderFillSegEls("businessHours",t),e.businessHourSegs=t},r.prototype.renderFill=function(e,t,r){var o,s,n,i,l,u,h,c,a,p,d,f;for(t=this.renderFillSegEls(e,t),c=[],l=[],o=0,n=t.length;o<n;o++)d=t[o],d.resourceId?c.push(d):l.push(d);for(h=this.view.pairSegsWithRows(c),f=[],s=0,i=h.length;s<i;s++)u=h[s],a=u[0],p=u[1],"bgEvent"===e&&(a.bgSegs=p),a.isShown&&f.push(u);return l.length&&f.unshift([this,l]),this.renderFillInContainers(e,f,r),t},r.prototype.renderHelper=function(e,t){var r,o;return o=this.eventToSegs(e),o=this.renderFgSegEls(o),r=this.view.pairSegsWithRows(o),this.renderHelperSegsInContainers(r,t)},r}(j),r=30,V=function(){function t(e){var t;this.view=e,this.isRTL=this.view.opt("isRTL"),this.givenColWidths=this.colWidths=function(){var e,r,o,s;for(o=this.view.colSpecs,s=[],e=0,r=o.length;e<r;e++)t=o[e],s.push(t.width);return s}.call(this)}return t.prototype.view=null,t.prototype.headEl=null,t.prototype.el=null,t.prototype.tbodyEl=null,t.prototype.headScroller=null,t.prototype.bodyScroller=null,t.prototype.joiner=null,t.prototype.colGroupHtml="",t.prototype.headTable=null,t.prototype.headColEls=null,t.prototype.headCellEls=null,t.prototype.bodyColEls=null,t.prototype.bodyTable=null,t.prototype.renderSkeleton=function(){return this.headScroller=new i({overflowX:"clipped-scroll",overflowY:"hidden"}),this.headScroller.canvas=new N,this.headScroller.render(),this.headScroller.canvas.contentEl.html(this.renderHeadHtml()),this.headEl.append(this.headScroller.el),this.bodyScroller=new i({overflowY:"clipped-scroll"}),this.bodyScroller.canvas=new N,this.bodyScroller.render(),this.bodyScroller.canvas.contentEl.html('<div class="fc-rows"><table>'+this.colGroupHtml+"<tbody/></table></div>"),this.tbodyEl=this.bodyScroller.canvas.contentEl.find("tbody"),this.el.append(this.bodyScroller.el),this.joiner=new q("horizontal",[this.headScroller,this.bodyScroller]),this.headTable=this.headEl.find("table"),this.headColEls=this.headEl.find("col"),this.headCellEls=this.headScroller.canvas.contentEl.find("tr:last-child th"),this.bodyColEls=this.el.find("col"),this.bodyTable=this.el.find("table"),this.colMinWidths=this.computeColMinWidths(),this.applyColWidths(),this.initColResizing()},t.prototype.renderHeadHtml=function(){var e,t,r,o,s,n,i,l,u,h,c;for(t=this.view.colSpecs,r="<table>",e="<colgroup>",i=0,u=t.length;i<u;i++)c=t[i],e+=c.isMain?'<col class="fc-main-col"/>':"<col/>";for(e+="</colgroup>",this.colGroupHtml=e,r+=e,r+="<tbody>",this.view.superHeaderText&&(r+='<tr class="fc-super"><th class="'+this.view.widgetHeaderClass+'" colspan="'+t.length+'"><div class="fc-cell-content"><span class="fc-cell-text">'+Se(this.view.superHeaderText)+"</span></div></th></tr>"),r+="<tr>",n=!0,o=l=0,h=t.length;l<h;o=++l)c=t[o],s=o===t.length-1,r+='<th class="'+this.view.widgetHeaderClass+'"><div><div class="fc-cell-content">'+(c.isMain?'<span class="fc-expander-space"><span class="fc-icon"></span></span>':"")+'<span class="fc-cell-text">'+Se(c.labelText||"")+"</span></div>"+(s?"":'<div class="fc-col-resizer"></div>')+"</div></th>";return r+="</tr>",r+="</tbody></table>"},t.prototype.givenColWidths=null,t.prototype.colWidths=null,t.prototype.colMinWidths=null,t.prototype.tableWidth=null,t.prototype.tableMinWidth=null,t.prototype.initColResizing=function(){return this.headEl.find("th .fc-col-resizer").each(function(t){return function(r,o){return o=e(o),o.on("mousedown",function(e){return t.colResizeMousedown(r,e,o)})}}(this))},t.prototype.colResizeMousedown=function(e,t,o){var s,n,i,l;return s=this.colWidths=this.queryColWidths(),s.pop(),s.push(null),l=s[e],i=Math.min(this.colMinWidths[e],r),n=new h({dragStart:function(e){return function(){return o.addClass("fc-active")}}(this),drag:function(t){return function(r,o){var n;return n=l+(t.isRTL?-r:r),n=Math.max(n,i),s[e]=n,t.applyColWidths()}}(this),dragEnd:function(e){return function(){return o.removeClass("fc-active")}}(this)}),n.startInteraction(t)},t.prototype.applyColWidths=function(){var e,t,r,o,s,n,i,l,u,h,c,a,p,d,f,g,y;for(r=this.colMinWidths,s=this.colWidths,e=!0,t=!1,y=0,h=0,p=s.length;h<p;h++)o=s[h],"number"==typeof o?y+=o:(e=!1,o&&(t=!0));for(l=t&&!this.view.isHGrouping?"auto":"",i=function(){var e,t,r;for(r=[],u=e=0,t=s.length;e<t;u=++e)o=s[u],r.push(null!=o?o:l);return r}(),g=0,u=c=0,d=i.length;c<d;u=++c)n=i[u],g+="number"==typeof n?n:r[u];for(u=a=0,f=i.length;a<f;u=++a)n=i[u],this.headColEls.eq(u).width(n),this.bodyColEls.eq(u).width(n);return this.headScroller.canvas.setMinWidth(g),this.bodyScroller.canvas.setMinWidth(g),this.tableMinWidth=g,this.tableWidth=e?y:void 0},t.prototype.computeColMinWidths=function(){var e,t,o,s,n,i;for(s=this.givenColWidths,n=[],e=t=0,o=s.length;t<o;e=++t)i=s[e],"number"==typeof i?n.push(i):n.push(parseInt(this.headColEls.eq(e).css("min-width"))||r);return n},t.prototype.queryColWidths=function(){var t,r,o,s,n;for(s=this.headCellEls,n=[],t=0,r=s.length;t<r;t++)o=s[t],n.push(e(o).outerWidth());return n},t.prototype.updateWidth=function(){if(this.headScroller.updateSize(),this.bodyScroller.updateSize(),this.joiner.update(),this.follower)return this.follower.update()},t.prototype.headHeight=function(){var e;return e=this.headScroller.canvas.contentEl.find("table"),e.height.apply(e,arguments)},t}(),k=function(){function t(t){this.view=t,this.children=[],this.trHash={},this.trs=e()}return t.prototype.view=null,t.prototype.parent=null,t.prototype.prevSibling=null,t.prototype.children=null,t.prototype.depth=0,t.prototype.hasOwnRow=!1,t.prototype.trHash=null,t.prototype.trs=null,t.prototype.isRendered=!1,t.prototype.isExpanded=!0,t.prototype.isShown=!1,t.prototype.addChild=function(e,t){var r,o,s,n,i;for(e.remove(),r=this.children,null!=t?r.splice(t,0,e):(t=r.length,r.push(e)),e.prevSibling=t>0?r[t-1]:null,t<r.length-1&&(r[t+1].prevSibling=e),e.parent=this,e.depth=this.depth+(this.hasOwnRow?1:0),i=e.getNodes(),o=0,s=i.length;o<s;o++)n=i[o],n.added();if(this.isShown&&this.isExpanded)return e.show()},t.prototype.removeChild=function(e){var t,r,o,s,n,i,l,u,h,c;for(t=this.children,o=!1,r=s=0,i=t.length;s<i;r=++s)if(c=t[r],c===e){o=!0;break}if(o){for(r<t.length-1&&(t[r+1].prevSibling=e.prevSibling),t.splice(r,1),e.recursivelyUnrender(),u=e.getNodes(),n=0,l=u.length;n<l;n++)h=u[n],h.removed();return e.parent=null,e.prevSibling=null,e}return!1},t.prototype.removeChildren=function(){var e,t,r,o,s,n,i;for(n=this.children,t=0,o=n.length;t<o;t++)e=n[t],e.recursivelyUnrender();for(i=this.getDescendants(),r=0,s=i.length;r<s;r++)e=i[r],e.removed();return this.children=[]},t.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},t.prototype.getLastChild=function(){var e;return e=this.children,e[e.length-1]},t.prototype.getPrevRow=function(){var e,t;for(t=this;t;){if(t.prevSibling)for(t=t.prevSibling;e=t.getLastChild();)t=e;else t=t.parent;if(t&&t.hasOwnRow&&t.isShown)return t}return null},t.prototype.getLeadingRow=function(){return this.hasOwnRow?this:this.isExpanded&&this.children.length?this.children[0].getLeadingRow():void 0},t.prototype.getRows=function(e){var t,r,o,s;for(null==e&&(e=[]),this.hasOwnRow&&e.push(this),s=this.children,r=0,o=s.length;r<o;r++)t=s[r],t.getRows(e);return e},t.prototype.getNodes=function(e){var t,r,o,s;for(null==e&&(e=[]),e.push(this),s=this.children,r=0,o=s.length;r<o;r++)t=s[r],t.getNodes(e);return e},t.prototype.getDescendants=function(){var e,t,r,o,s;for(e=[],s=this.children,r=0,o=s.length;r<o;r++)t=s[r],t.getNodes(e);return e},t.prototype.render=function(){var t,r,o,s,n,i,l;if(this.trHash={},i=[],this.hasOwnRow){t=this.getPrevRow(),r=this.view.tbodyHash;for(l in r)s=r[l],n=e("<tr/>"),this.trHash[l]=n,i.push(n[0]),o="render"+ee(l)+"Content",this[o]&&this[o](n),t?t.trHash[l].after(n):s.prepend(n)}return this.trs=e(i).on("click",".fc-expander",ke(this,"toggleExpanded")),this.isRendered=!0},t.prototype.unrender=function(){var t,r,o,s;if(this.isRendered){t=this.trHash;for(o in t)r=t[o],s="unrender"+ee(o)+"Content",this[s]&&this[s](r);return this.trHash={},this.trs.remove(),this.trs=e(),this.isRendered=!1,this.isShown=!1,this.hidden()}},t.prototype.recursivelyUnrender=function(){var e,t,r,o,s;for(this.unrender(),o=this.children,s=[],t=0,r=o.length;t<r;t++)e=o[t],s.push(e.recursivelyUnrender());return s},t.prototype.getTr=function(e){return this.trHash[e]},t.prototype.show=function(){var e,t,r,o,s;if(!this.isShown&&(this.isRendered?this.trs.css("display",""):this.render(),this.ensureSegsRendered&&this.ensureSegsRendered(),this.isExpanded?this.indicateExpanded():this.indicateCollapsed(),this.isShown=!0,this.shown(),this.isExpanded)){for(o=this.children,s=[],t=0,r=o.length;t<r;t++)e=o[t],s.push(e.show());return s}},t.prototype.hide=function(){var e,t,r,o,s;if(this.isShown&&(this.isRendered&&this.trs.hide(),this.isShown=!1,this.hidden(),this.isExpanded)){for(o=this.children,s=[],t=0,r=o.length;t<r;t++)e=o[t],s.push(e.hide());return s}},t.prototype.expand=function(){var e,t,r,o;if(!this.isExpanded){for(this.isExpanded=!0,this.indicateExpanded(),this.view.batchRows(),o=this.children,t=0,r=o.length;t<r;t++)e=o[t],e.show();return this.view.unbatchRows(),this.animateExpand()}},t.prototype.collapse=function(){var e,t,r,o;if(this.isExpanded){for(this.isExpanded=!1,this.indicateCollapsed(),this.view.batchRows(),o=this.children,t=0,r=o.length;t<r;t++)e=o[t],e.hide();return this.view.unbatchRows()}},t.prototype.toggleExpanded=function(){return this.isExpanded?this.collapse():this.expand()},t.prototype.indicateExpanded=function(){return this.trs.find(".fc-expander .fc-icon").removeClass(this.getCollapsedIcon()).addClass(this.getExpandedIcon())},t.prototype.indicateCollapsed=function(){return this.trs.find(".fc-expander .fc-icon").removeClass(this.getExpandedIcon()).addClass(this.getCollapsedIcon())},t.prototype.enableExpanding=function(){return this.trs.find(".fc-expander-space").addClass("fc-expander")},t.prototype.disableExpanding=function(){return this.trs.find(".fc-expander-space").removeClass("fc-expander").find(".fc-icon").removeClass(this.getExpandedIcon()).removeClass(this.getCollapsedIcon())},t.prototype.getExpandedIcon=function(){return"fc-icon-down-triangle"},t.prototype.getCollapsedIcon=function(){var e;return e=this.view.isRTL?"left":"right","fc-icon-"+e+"-triangle"},t.prototype.animateExpand=function(){var e,t,r;if(r=null!=(e=this.children[0])&&null!=(t=e.getLeadingRow())?t.trs:void 0)return r.addClass("fc-collapsed"),setTimeout(function(){return r.addClass("fc-transitioning"),r.removeClass("fc-collapsed")}),r.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){return r.removeClass("fc-transitioning")})},t.prototype.getMaxTrInnerHeight=function(){var t;return t=0,e.each(this.trHash,function(e){return function(e,r){var o;return o=ye(r).find("> div:not(.fc-cell-content):first"),t=Math.max(o.height(),t)}}(this)),t},t.prototype.setTrInnerHeight=function(t){return e.each(this.trHash,function(e){return function(e,r){return ye(r).find("> div:not(.fc-cell-content):first").height(t)}}(this))},t.prototype.shown=function(){if(this.hasOwnRow)return this.rowShown(this)},t.prototype.hidden=function(){if(this.hasOwnRow)return this.rowHidden(this)},t.prototype.rowShown=function(e){return(this.parent||this.view).rowShown(e)},t.prototype.rowHidden=function(e){return(this.parent||this.view).rowHidden(e)},t.prototype.added=function(){if(this.hasOwnRow)return this.rowAdded(this)},t.prototype.removed=function(){if(this.hasOwnRow)return this.rowRemoved(this)},t.prototype.rowAdded=function(e){return(this.parent||this.view).rowAdded(e)},t.prototype.rowRemoved=function(e){return(this.parent||this.view).rowRemoved(e)},t}(),z=function(t){function r(e,t,o){this.groupSpec=t,this.groupValue=o,r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.prototype.groupSpec=null,r.prototype.groupValue=null,r.prototype.rowRemoved=function(e){if(r.__super__.rowRemoved.apply(this,arguments),e!==this&&!this.children.length)return this.remove()},r.prototype.renderGroupContentEl=function(){var t,r;return t=e('<div class="fc-cell-content" />').append(this.renderGroupTextEl()),r=this.groupSpec.render,"function"==typeof r&&(t=r(t,this.groupValue)||t),t},r.prototype.renderGroupTextEl=function(){var t,r;return r=this.groupValue||"",
+t=this.groupSpec.text,"function"==typeof t&&(r=t(r)||r),e('<span class="fc-cell-text" />').text(r)},r}(k),g=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.prototype.hasOwnRow=!0,r.prototype.renderSpreadsheetContent=function(t){var r;return r=this.renderGroupContentEl(),r.prepend('<span class="fc-expander"><span class="fc-icon"></span></span>'),e('<td class="fc-divider" />').attr("colspan",this.view.colSpecs.length).append(e("<div/>").append(r)).appendTo(t)},r.prototype.renderEventContent=function(e){return e.append('<td class="fc-divider"> <div/> </td>')},r}(z),X=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.prototype.rowspan=0,r.prototype.leadingTr=null,r.prototype.groupTd=null,r.prototype.rowShown=function(e){return this.rowspan+=1,this.renderRowspan(),r.__super__.rowShown.apply(this,arguments)},r.prototype.rowHidden=function(e){return this.rowspan-=1,this.renderRowspan(),r.__super__.rowHidden.apply(this,arguments)},r.prototype.renderRowspan=function(){var t;return this.rowspan?(this.groupTd||(this.groupTd=e('<td class="'+this.view.widgetContentClass+'"/>').append(this.renderGroupContentEl())),this.groupTd.attr("rowspan",this.rowspan),t=this.getLeadingRow().getTr("spreadsheet"),t!==this.leadingTr?(t&&t.prepend(this.groupTd),this.leadingTr=t):void 0):(this.groupTd&&(this.groupTd.remove(),this.groupTd=null),this.leadingTr=null)},r}(z),p=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return Ue(t,e),t.prototype.hasOwnRow=!0,t.prototype.segContainerEl=null,t.prototype.segContainerHeight=null,t.prototype.innerEl=null,t.prototype.bgSegContainerEl=null,t.prototype.isSegsRendered=!1,t.prototype.isBusinessHourSegsRendered=!1,t.prototype.businessHourSegs=null,t.prototype.bgSegs=null,t.prototype.fgSegs=null,t.prototype.renderEventContent=function(e){return e.html('<td class="'+this.view.widgetContentClass+'"> <div> <div class="fc-event-container" /> </div> </td>'),this.segContainerEl=e.find(".fc-event-container"),this.innerEl=this.bgSegContainerEl=e.find("td > div"),this.ensureSegsRendered()},t.prototype.ensureSegsRendered=function(){if(!this.isSegsRendered)return this.ensureBusinessHourSegsRendered(),this.bgSegs&&this.view.timeGrid.renderFillInContainer("bgEvent",this,this.bgSegs),this.fgSegs&&this.view.timeGrid.renderFgSegsInContainers([[this,this.fgSegs]]),this.isSegsRendered=!0},t.prototype.ensureBusinessHourSegsRendered=function(){if(this.businessHourSegs&&!this.isBusinessHourSegsRendered)return this.view.timeGrid.renderFillInContainer("businessHours",this,this.businessHourSegs,"bgevent"),this.isBusinessHourSegsRendered=!0},t.prototype.unrenderEventContent=function(){return this.clearBusinessHourSegs(),this.bgSegs=null,this.fgSegs=null,this.isSegsRendered=!1},t.prototype.clearBusinessHourSegs=function(){var e,t,r,o;if(this.businessHourSegs){for(r=this.businessHourSegs,e=0,t=r.length;e<t;e++)o=r[e],o.el&&o.el.remove();this.businessHourSegs=null}return this.isBusinessHourSegsRendered=!1},t}(k),B=function(t){function r(e,t){this.resource=t,r.__super__.constructor.apply(this,arguments)}return Ue(r,t),r.prototype.resource=null,r.prototype.rowAdded=function(e){if(r.__super__.rowAdded.apply(this,arguments),e!==this&&this.isRendered&&1===this.children.length)return this.enableExpanding(),this.isExpanded?this.indicateExpanded():this.indicateCollapsed()},r.prototype.rowRemoved=function(e){if(r.__super__.rowRemoved.apply(this,arguments),e!==this&&this.isRendered&&!this.children.length)return this.disableExpanding()},r.prototype.render=function(){return r.__super__.render.apply(this,arguments),this.children.length>0?this.enableExpanding():this.disableExpanding(),this.view.publiclyTrigger("resourceRender",this.resource,this.resource,this.getTr("spreadsheet").find("> td"),this.getTr("event").find("> td"))},r.prototype.renderEventContent=function(e){return r.__super__.renderEventContent.apply(this,arguments),e.attr("data-resource-id",this.resource.id)},r.prototype.renderSpreadsheetContent=function(t){var r,o,s,n,i,l,u,h,c;for(u=this.resource,l=this.view.colSpecs,n=0,i=l.length;n<i;n++)r=l[n],r.group||(s=r.field?u[r.field]||null:u,c="function"==typeof r.text?r.text(u,s):s,o=e('<div class="fc-cell-content">'+(r.isMain?this.renderGutterHtml():"")+'<span class="fc-cell-text">'+(c?Se(c):"&nbsp;")+"</span></div>"),"function"==typeof r.render&&(o=r.render(u,o,s)||o),h=e('<td class="'+this.view.widgetContentClass+'"/>').append(o),r.isMain&&h.wrapInner("<div/>"),t.append(h));return t.attr("data-resource-id",u.id)},r.prototype.renderGutterHtml=function(){var e,t,r,o;for(e="",t=r=0,o=this.depth;r<o;t=r+=1)e+='<span class="fc-icon"/>';return e+='<span class="fc-expander-space"><span class="fc-icon"></span></span>'},r}(p),d.views.timeline.resourceClass=M,H=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return Ue(t,e),t.mixin($),t.prototype.timeGridClass=F,t.prototype.dayGridClass=_,t.prototype.renderHead=function(){return t.__super__.renderHead.apply(this,arguments),this.timeGrid.processHeadResourceEls(this.headContainerEl)},t.prototype.setResourcesOnGrids=function(e){if(this.timeGrid.setResources(e),this.dayGrid)return this.dayGrid.setResources(e)},t.prototype.unsetResourcesOnGrids=function(){if(this.timeGrid.unsetResources(),this.dayGrid)return this.dayGrid.unsetResources()},t}(d.AgendaView),d.views.agenda.queryResourceClass=function(e){var t;if(null!=(t=e.options.groupByResource||e.options.groupByDateAndResource)?t:e.duration&&1===e.duration.as("days"))return H},T=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return Ue(t,e),t.mixin($),t.prototype.dayGridClass=_,t.prototype.renderHead=function(){return t.__super__.renderHead.apply(this,arguments),this.dayGrid.processHeadResourceEls(this.headContainerEl)},t.prototype.setResourcesOnGrids=function(e){return this.dayGrid.setResources(e)},t.prototype.unsetResourcesOnGrids=function(){return this.dayGrid.unsetResources()},t}(d.BasicView),G=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return Ue(t,e),t.mixin($),t.prototype.dayGridClass=_,t.prototype.renderHead=function(){return t.__super__.renderHead.apply(this,arguments),this.dayGrid.processHeadResourceEls(this.headContainerEl)},t.prototype.setResourcesOnGrids=function(e){return this.dayGrid.setResources(e)},t.prototype.unsetResourcesOnGrids=function(){return this.dayGrid.unsetResources()},t}(d.MonthView),d.views.basic.queryResourceClass=function(e){var t;if(null!=(t=e.options.groupByResource||e.options.groupByDateAndResource)?t:e.duration&&1===e.duration.as("days"))return T},d.views.month.queryResourceClass=function(e){if(e.options.groupByResource||e.options.groupByDateAndResource)return G},E="2017-04-27",Q={years:1,weeks:1},y="http://fullcalendar.io/scheduler/license/",b=["GPL-My-Project-Is-Open-Source","CC-Attribution-NonCommercial-NoDerivatives"],ze=function(e,t){if(!Ee(window.location.href)&&!Te(e)&&!he(t))return Pe('Please use a valid license key. <a href="'+y+'">More Info</a>',t)},Te=function(r){var o,s,n,i;return e.inArray(r,b)!==-1||(s=(r||"").match(/^(\d+)\-fcs\-(\d+)$/),!!(s&&10===s[1].length&&(n=t.utc(1e3*parseInt(s[2])),i=t.utc(d.mockSchedulerReleaseDate||E),i.isValid()&&(o=i.clone().subtract(Q),n.isAfter(o)))))},Ee=function(e){return Boolean(e.match(/\w+\:\/\/fullcalendar\.io\/|\/demos\/[\w-]+\.html$/))},Pe=function(t,r){return r.append(e('<div class="fc-license-message" />').html(t))},void(he=function(e){return e.find(".fc-license-message").length>=1}))});
\ No newline at end of file
diff --git a/smash/web/static/js/appointment.js b/smash/web/static/js/appointment.js
index 852d14ca57b1b6fd8f66c4a7afb4bdbf52fe34bf..a97996610c990ca86b1623fb2208e1a76fee1b35 100644
--- a/smash/web/static/js/appointment.js
+++ b/smash/web/static/js/appointment.js
@@ -90,6 +90,24 @@ function appointment_type_behaviour(checkboxes, outObject, api_call) {
     });
 }
 
+/**
+ * When any option is selected in flying_team_select, location value is set to flying team.
+ *
+ * @param flying_team_select
+ * @param location_select
+ */
+function appointment_flying_team_place_behaviour(flying_team_select, location_select) {
+    $(flying_team_select).change(function () {
+        if ($(this).val() != "") {
+            $(location_select).find('option').each(function () {
+                if ("Flying Team" == $(this).html()) {
+                    $(location_select).val($(this).val());
+                }
+            });
+        }
+    });
+}
+
 function get_calendar_events_function(source, allow_url_redirection) {
     if (allow_url_redirection === undefined) {
         allow_url_redirection = false;
@@ -105,21 +123,27 @@ function get_calendar_events_function(source, allow_url_redirection) {
             success: function (doc) {
                 var events = [];
                 for (var i = 0; i < doc.data.length; i++) {
-                    var title = doc.data[i].subject;
+
+                    const entry = doc.data[i];
+                    var title = entry.subject;
                     if (title != "") {
-                        title += "; type: " + doc.data[i].type;
+                        title += " (" + entry.nd_number + "); type: " + entry.type;
                     } else {
-                        title = doc.data[i].title
+                        title = entry.title
                     }
                     var event = {
                         title: title,
-                        start: doc.data[i].datetime_when,
-                        end: doc.data[i].datetime_until,
-                        id: doc.data[i].id,
-                        color: doc.data[i].color,
+                        start: entry.datetime_when,
+                        end: entry.datetime_until,
+                        id: entry.id,
+                        color: entry.color,
+                        nd_number: entry.nd_number,
+                        screening_number: entry.screening_number,
+                        phone_number: entry.phone_number,
+                        appointment_types: entry.appointment_types
                     };
                     if (allow_url_redirection) {
-                        event["url"] = doc.data[i].url;
+                        event["url"] = entry.url;
                     }
                     events.push(event)
                 }
@@ -127,4 +151,4 @@ function get_calendar_events_function(source, allow_url_redirection) {
             }
         });
     }
-}
\ No newline at end of file
+}
diff --git a/smash/web/static/js/daily_planning.js b/smash/web/static/js/daily_planning.js
new file mode 100644
index 0000000000000000000000000000000000000000..920909990dcf9d63544d1cc8aa0e62f1175c387e
--- /dev/null
+++ b/smash/web/static/js/daily_planning.js
@@ -0,0 +1,257 @@
+const TIME_FORMAT = 'HH:mm';
+const FLYING_TEAM_LABEL = 'Flying Team';
+const FLYTING_TEAM_BORDER_COLOR = "orange";
+
+var overlaps = (function () {
+    function getPositions(elem) {
+        var pos, width, height;
+        pos = $(elem).position();
+        width = $(elem).width();
+        height = $(elem).height();
+        return [[pos.left, pos.left + width], [pos.top, pos.top + height]];
+    }
+
+    function comparePositions(p1, p2) {
+        var r1, r2;
+        r1 = p1[0] < p2[0] ? p1 : p2;
+        r2 = p1[0] < p2[0] ? p2 : p1;
+        return r1[1] > r2[0] || r1[0] === r2[0];
+    }
+
+    return function (x, y, element) {
+        var pos1 = [[x, x + 100], [y, y + 20]],
+            pos2 = getPositions(element);
+        return comparePositions(pos1[0], pos2[0]) && comparePositions(pos1[1], pos2[1]);
+    };
+})();
+
+var eventsCleared = [];
+
+function add_event(event, color, subjectId, boxBody) {
+    var eventElement = $('<div class="fc-event ui-draggable ui-draggable-handle hidden-print">' + event.title + '<span style="float:right;padding-right:5px;">' + event.duration + '</span></div>');
+    eventElement.removeData();
+    var constraintStart = $.fullCalendar.moment(event.appointment_start);
+    var borderColor;
+    var location = event.location;
+    if (location === FLYING_TEAM_LABEL) {
+        eventElement.css('border', '2px solid ' + FLYTING_TEAM_BORDER_COLOR);
+        location = event.flying_team_location + ' (FT)';
+        borderColor = FLYTING_TEAM_BORDER_COLOR;
+    }
+    eventElement.data('event', {
+        appointment_start: event.appointment_start,
+        appointment_end: event.appointment_end,
+        title: event.title,
+        stick: true,
+        color: color + " !important",
+        duration: event.duration,
+        original_duration: event.duration,
+        subject: event.subject,
+        subject_id: subjectId,
+        id: event.id,
+        link_id: event.link_id,
+        link_who: event.link_who,
+        link_when: event.link_when,
+        location: event.location,
+        flying_team_location: event.flying_team_location,
+        constraint: {
+            start: constraintStart,
+            end: $.fullCalendar.moment(event.appointment_end)
+        },
+        borderColor: borderColor
+
+    });
+    eventElement.draggable({
+        zIndex: 999,
+        revert: true,
+        revertDuration: 0,
+        start: function (event, ui) {
+            $(this).popover('disable');
+        }
+    });
+    eventElement.css('background-color', color);
+    eventElement.css('width', event.width);
+    boxBody.append(eventElement);
+
+    eventElement.popover({
+        container: 'body',
+        trigger: 'click',
+        content: location + ', appointment starts at ' + constraintStart.format(TIME_FORMAT)
+    });
+}
+
+function get_subjects_events(day) {
+    $.get('/api/events/' + day, function (data) {
+        $("#subjects").empty();
+        var subjects = data.data;
+        $.each(subjects, function (index, subject) {
+            var divSubject = $("<div class='col-md-4 col-lg-3 col-sm-12 subjects-events'/>");
+            var boxSubject = $("<div class='box box-primary'/>").css('border-top-color', subject.color);
+            var boxBody = $("<div class='box-body' id='subject_" + subject.id + "'>");
+            var boxHeader = $("<div class='box-header with-border'/>");
+            var title_subject = $("<h4>" + subject.name + "</h4>");
+            boxHeader.append(title_subject);
+            $.each(subject.events, function (index_event, event) {
+                if (event.link_when) {
+                    event.color = subject.color + ' !important';
+                    event.start = $.fullCalendar.moment(event.link_when);
+                    event.end = $.fullCalendar.moment(event.link_end);
+                    event.resourceId = event.link_who.toString();
+                    event.subject_id = subject.id;
+                    event.original_duration = event.duration;
+                    event.constraint = {
+                        start: $.fullCalendar.moment(event.appointment_start),
+                        end: $.fullCalendar.moment(event.appointment_end)
+                    };
+                    $('#calendar').fullCalendar('renderEvent', event, true);
+                } else {
+                    add_event(event, subject.color, subject.id, boxBody);
+                }
+            });
+            boxSubject.append(boxHeader);
+            boxSubject.append(boxBody);
+            divSubject.append(boxSubject);
+            $("#subjects").append(divSubject);
+            divSubject.droppable({
+                drop: function (event, ui) {
+                }
+            });
+        });
+    });
+}
+function remove_event(event) {
+    $('#calendar').fullCalendar('removeEvents', event.id);
+    var selector = '#subject_' + event.subject_id;
+    var boxBody = $(selector);
+    event.duration = event.original_duration;
+    event.removed = true;
+    //remove !important
+    event.color = event.color.substring(0, 7);
+    eventsCleared.push(event.link_id);
+    add_event(event, event.color, event.subject_id, boxBody);
+}
+$(document).ready(function () {
+    $('#calendar').fullCalendar({
+        schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
+        defaultView: 'agendaDay',
+        eventDurationEditable: false,
+        eventStartEditable: true,
+        editable: true,
+        selectable: true,
+        eventOverlap: false,
+        weekends: false,
+        scrollTime: '08:00',
+        slotDuration: '00:30',
+        snapDuration: '00:05',
+        displayEventTime: true,
+        resourceOrder: 'role',
+        resourceGroupField: 'role',
+        dragRevertDuration: 0,
+        minTime: "08:00:00",
+        maxTime: "19:00:00",
+        groupByResource: true,
+        height: "auto",
+        customButtons: {
+            save: {
+                text: 'Save',
+                click: function () {
+                    calendarEvents = $('#calendar').fullCalendar('clientEvents');
+                    eventsToPersist = [];
+                    var saveButton = $(".fc-save-button");
+                    var currentBorder = saveButton.css('border-color');
+                    $.each(calendarEvents, function (i, calendar_event) {
+                        eventsToPersist.push({
+                            'link_id': calendar_event.link_id,
+                            'link_who': parseInt(calendar_event.resourceId),
+                            'start': calendar_event.start.format()
+                        });
+                        var index = eventsCleared.indexOf(calendar_event.link_id);
+                        if (index > -1) {
+                            eventsCleared.splice(index, 1);
+                        }
+                    });
+                    $.post({
+                        url: events_url,
+                        data: {
+                            events_to_persist: JSON.stringify(eventsToPersist),
+                            events_to_clear: JSON.stringify(eventsCleared)
+                        },
+                        dataType: "json"
+                    }).done(function (data) {
+
+                        saveButton.css('border-color', 'green');
+                        setTimeout(function () {
+                            saveButton.css('border-color', currentBorder);
+                        }, 200);
+                    }).error(function (data) {
+
+                        console.log(data);
+                        saveButton.css('border-color', 'red');
+                        setTimeout(function () {
+                            saveButton.delay(200).css('border-color', currentBorder);
+                        }, 200);
+                    });
+                }
+            },
+            clear: {
+                text: 'Clear',
+                click: function () {
+                    calendarEvents = $('#calendar').fullCalendar('clientEvents');
+                    $.each(calendarEvents, function (i, calendar_event) {
+                        remove_event(calendar_event);
+                    });
+                }
+            }
+        },
+        viewRender: function (view, element) {
+            var date = view.start.format('YYYY-MM-DD');
+            $('#calendar').fullCalendar('removeEvents');
+            get_subjects_events(date);
+        },
+        businessHours: {
+            start: '08:00',
+            end: '19:00'
+        },
+        header: {
+            left: 'prev,next today',
+            center: 'title',
+            right: 'save, clear'
+        },
+        droppable: true,
+        resourceAreaWidth: '15%',
+        resourceLabelText: 'Workers',
+        resources: resources_url,
+        events: [],
+        eventRender: function (event, element) {
+            element.popover({
+                title: event.title,
+                container: 'body',
+                placement: 'bottom',
+                trigger: 'click',
+                content: '<ul>' +
+                '<li>' + event.subject + '</li>' +
+                '<li>' + event.start.format(TIME_FORMAT) + ' - ' + event.end.format(TIME_FORMAT) + '</li>' +
+                '<li>Appointment starts: ' + event.constraint.start.format(TIME_FORMAT) + '</li>' +
+                '<li>Location: ' + (event.location !== FLYING_TEAM_LABEL ? event.location : event.flying_team_location + ' (FT)') + '</li>' +
+                '</ul>',
+                html: true
+            });
+        },
+        eventDragStop: function (event, jsEvent, ui, view) {
+            // var x = isElemOverDiv(jsEvent.clientX, jsEvent.clientY, $('#subjects'));
+            $('.popover').popover('hide');
+            var x = overlaps(jsEvent.clientX, jsEvent.clientY, $('#subjects'));
+            if (x) {
+                remove_event(event);
+            }
+        },
+        eventDragStart: function (event, jsEvent, view) {
+            $('.popover').popover('hide');
+        },
+        selectHelper: true,
+        drop: function (date, jsEvent, ui, resourceId) {
+            $(this).remove();
+        }
+    });
+})
+;
\ No newline at end of file
diff --git a/smash/web/static/js/smash.js b/smash/web/static/js/smash.js
new file mode 100644
index 0000000000000000000000000000000000000000..7d27ccd062cf0b7a5568f767a996abfbeb39c5bf
--- /dev/null
+++ b/smash/web/static/js/smash.js
@@ -0,0 +1,37 @@
+$(document).ready(function () {
+    $("#save-and-continue").click(function () {
+        var form = $(this).parents("form");
+        var hidden_field = $("<input type='hidden' name='_continue' value='1' />");
+        form.append(hidden_field);
+        form.submit();
+    });
+    $("[data-hide]").on("click", function () {
+        $("." + $(this).attr("data-hide")).hide();
+    });
+
+});
+
+$.ajaxSetup({
+    beforeSend: function (xhr, settings) {
+        function getCookie(name) {
+            var cookieValue = null;
+            if (document.cookie && document.cookie != '') {
+                var cookies = document.cookie.split(';');
+                for (var i = 0; i < cookies.length; i++) {
+                    var cookie = jQuery.trim(cookies[i]);
+                    // Does this cookie string begin with the name we want?
+                    if (cookie.substring(0, name.length + 1) == (name + '=')) {
+                        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+                        break;
+                    }
+                }
+            }
+            return cookieValue;
+        }
+
+        if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
+            // Only send the token to relative URLs i.e. locally.
+            xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
+        }
+    }
+});
\ No newline at end of file
diff --git a/smash/web/statistics.py b/smash/web/statistics.py
index 0de80c539f380d7c016101fd7520a09c1ac4b8d8..f52f54307ee4c65dea5ee6b2869eb888500c976e 100644
--- a/smash/web/statistics.py
+++ b/smash/web/statistics.py
@@ -12,41 +12,48 @@ from .models import AppointmentType, Appointment, Visit
 __author__ = 'Valentin Grouès'
 
 QUERY_VISITS_RANKS = """
-SELECT DISTINCT(rank() OVER (PARTITION BY subject_id ORDER BY datetime_begin)) AS rank FROM web_visit
+SELECT DISTINCT(rank() OVER (PARTITION BY subject_id ORDER BY datetime_begin)) AS rank FROM web_visit 
 """
 
 QUERY_APPOINTMENTS_COUNT = """
-SELECT count(*) FROM web_appointment LEFT JOIN (SELECT id, rank()
+SELECT count(*) FROM web_appointment LEFT JOIN (SELECT id, subject_id, rank()
 OVER (PARTITION BY subject_id ORDER BY datetime_begin) AS rnk FROM web_visit)
-a ON a.id = web_appointment.visit_id WHERE a.rnk = %s
+a ON a.id = web_appointment.visit_id 
+LEFT JOIN web_subject ON web_subject.id = subject_id
+WHERE a.rnk = %s 
 AND EXTRACT(MONTH FROM web_appointment.datetime_when) = %s
 AND EXTRACT(YEAR FROM web_appointment.datetime_when) = %s
 """
 
 QUERY_VISITS_ENDED_COUNT = """
-SELECT count(*) FROM  (SELECT id, datetime_begin, datetime_end, rank()
+SELECT count(*) FROM  (SELECT id, subject_id, datetime_begin, datetime_end, rank()
 OVER (PARTITION BY subject_id ORDER BY datetime_begin) AS rnk FROM web_visit) a
+LEFT JOIN web_subject ON web_subject.id = subject_id
 WHERE a.rnk = %s AND
 EXTRACT(MONTH FROM a.datetime_end) = %s AND
 EXTRACT(YEAR FROM a.datetime_end) = %s
 """
 
 QUERY_VISITS_STARTED_COUNT = """
-SELECT count(*) FROM  (SELECT id, datetime_begin, datetime_end, rank()
+SELECT count(*) FROM  (SELECT id, subject_id, datetime_begin, datetime_end, rank()
 OVER (PARTITION BY subject_id ORDER BY datetime_begin) AS rnk FROM web_visit) a
+LEFT JOIN web_subject ON web_subject.id = subject_id
 WHERE a.rnk = %s AND
 EXTRACT(MONTH FROM a.datetime_begin) = %s AND
 EXTRACT(YEAR FROM a.datetime_begin) = %s
 """
 
 QUERY_APPOINTMENTS = """
-SELECT types.appointmenttype_id, web_appointment.status, count(*) FROM web_appointment
-LEFT JOIN (SELECT id, rank() OVER (PARTITION BY subject_id ORDER BY datetime_begin) AS rnk
-FROM web_visit) a ON a.id = web_appointment.visit_id LEFT JOIN web_appointment_appointment_types types
-ON types.appointment_id = web_appointment.id WHERE a.rnk = %s
+SELECT types.appointment_type_id, web_appointment.status, count(*) FROM web_appointment
+LEFT JOIN (SELECT id, subject_id, rank() OVER (PARTITION BY subject_id ORDER BY datetime_begin) AS rnk
+FROM web_visit) a ON a.id = web_appointment.visit_id LEFT JOIN web_appointmenttypelink types
+ON types.appointment_id = web_appointment.id 
+LEFT JOIN web_subject ON web_subject.id = subject_id
+WHERE a.rnk = %s
 AND EXTRACT(MONTH FROM web_appointment.datetime_when) = %s
 AND EXTRACT(YEAR FROM web_appointment.datetime_when) = %s
-GROUP BY types.appointmenttype_id,  web_appointment.status
+{}
+GROUP BY TYPES.appointment_type_id,  web_appointment.status
 """
 
 
@@ -54,11 +61,11 @@ class StatisticsManager(object):
     def __init__(self):
         self.appointment_types = {appointment_type.id: appointment_type for appointment_type in
                                   AppointmentType.objects.all()}
-        self.visits_ranks = self._get_visits_ranks()
         self.statuses_list = Appointment.objects.filter().values_list('status', flat=True).distinct().order_by(
             'status').all()
         self.statuses_labels = [Appointment.APPOINTMENT_STATUS_CHOICES.get(status, status.title()) for status in
                                 self.statuses_list]
+        self.visits_ranks = self._get_visits_ranks()
 
     def get_statistics_for_month(self, month, year, subject_type=None, visit=None):
         """
@@ -85,10 +92,12 @@ class StatisticsManager(object):
         filters_month_year_appointments, filters_month_year_visits_ended, filters_month_year_visits_started = self._build_filters(
             month, subject_type, year)
 
-        number_of_appointments = self._get_number_of_appointments(filters_month_year_appointments, visit, month, year)
+        number_of_appointments = self._get_number_of_appointments(filters_month_year_appointments, visit, month, year,
+                                                                  subject_type)
         number_of_visits_started = self._get_number_visits_started(filters_month_year_visits_started, visit, month,
-                                                                   year)
-        number_of_visits_ended = self._get_number_visits_ended(filters_month_year_visits_ended, visit, month, year)
+                                                                   year, subject_type)
+        number_of_visits_ended = self._get_number_visits_ended(filters_month_year_visits_ended, visit, month, year,
+                                                               subject_type)
 
         general_results["appointments"] = number_of_appointments
         general_results["visits_started"] = number_of_visits_started
@@ -97,7 +106,7 @@ class StatisticsManager(object):
         results["general"] = general_results
 
         results_appointments = self.get_appointments_per_type_and_status(filters_month_year_appointments, month,
-                                                                         self.statuses_list, visit, year)
+                                                                         self.statuses_list, visit, year, subject_type)
         results["appointments"] = results_appointments
         results["statuses_list"] = self.statuses_labels
         appointment_types_values = map(attrgetter('code'), self.appointment_types.values())
@@ -105,7 +114,8 @@ class StatisticsManager(object):
         results["appointments_types_list"] = sorted_appointment_types_values
         return results
 
-    def get_appointments_per_type_and_status(self, filters_month_year_appointments, month, statuses_list, visit, year):
+    def get_appointments_per_type_and_status(self, filters_month_year_appointments, month, statuses_list, visit, year,
+                                             subject_type=None):
         if not visit:
             results_appointments = {}
             for appointment_type in self.appointment_types.values():
@@ -123,8 +133,13 @@ class StatisticsManager(object):
                 results_appointments[appointment_type.code] = results_appointment
         else:
             results_appointment_set = defaultdict(dict)
+            query = QUERY_APPOINTMENTS
+            subject_type_clause = ""
+            if subject_type is not None:
+                subject_type_clause = " AND web_subject.type = '{}'".format(subject_type)
+            query = query.format(subject_type_clause)
             with connection.cursor() as cursor:
-                cursor.execute(QUERY_APPOINTMENTS, [visit, month, year])
+                cursor.execute(query, [visit, month, year])
                 rows = cursor.fetchall()
                 for row in rows:
                     appointment_type_id, status, count = row
@@ -141,8 +156,10 @@ class StatisticsManager(object):
         return results_appointments
 
     @staticmethod
-    def _get_count_from_filters_or_sql(model, filters, query, visit, month, year):
+    def _get_count_from_filters_or_sql(model, filters, query, visit, month, year, subject_type):
         if visit:
+            if subject_type is not None:
+                query += " AND web_subject.type = '{}'".format(subject_type)
             with connection.cursor() as cursor:
                 cursor.execute(
                     query,
@@ -153,16 +170,17 @@ class StatisticsManager(object):
             count = model.objects.filter(filters).count()
         return count
 
-    def _get_number_visits_started(self, filters_month_year_visits_started, visit, month, year):
+    def _get_number_visits_started(self, filters_month_year_visits_started, visit, month, year, subject_type=None):
         return self._get_count_from_filters_or_sql(Visit, filters_month_year_visits_started, QUERY_VISITS_STARTED_COUNT,
-                                                   visit, month, year)
+                                                   visit, month, year, subject_type)
 
-    def _get_number_visits_ended(self, filters_month_year_visits_ended, visit, month, year):
+    def _get_number_visits_ended(self, filters_month_year_visits_ended, visit, month, year, subject_type=None):
         return self._get_count_from_filters_or_sql(Visit, filters_month_year_visits_ended, QUERY_VISITS_ENDED_COUNT,
-                                                   visit, month, year)
+                                                   visit, month, year, subject_type)
 
-    def _get_number_of_appointments(self, filters, visit, month, year):
-        return self._get_count_from_filters_or_sql(Appointment, filters, QUERY_APPOINTMENTS_COUNT, visit, month, year)
+    def _get_number_of_appointments(self, filters, visit, month, year, subject_type=None):
+        return self._get_count_from_filters_or_sql(Appointment, filters, QUERY_APPOINTMENTS_COUNT, visit, month, year,
+                                                   subject_type)
 
     @staticmethod
     def _build_filters(month, subject_type, year):
@@ -187,10 +205,14 @@ class StatisticsManager(object):
         return filters_month_year_appointments, filters_month_year_visits_ended, filters_month_year_visits_started
 
     @staticmethod
-    def _get_visits_ranks():
+    def _get_visits_ranks(subject_type=None):
+        query = QUERY_VISITS_RANKS
+        if subject_type is not None:
+            query += " LEFT JOIN web_subject ON web_subject.id = web_visit.subject_id WHERE web_subject.type = '{}'".format(
+                subject_type)
         with connection.cursor() as cursor:
             cursor.execute(
-                QUERY_VISITS_RANKS,
+                query,
                 [])
             rows = cursor.fetchall()
 
diff --git a/smash/web/templates/_base.html b/smash/web/templates/_base.html
index 0c30d7e84c00da6b6e12a64b0a2455f32fabbe7f..a36354adefc6d0fe945f4e6a7f6ad8b6c4a54032 100644
--- a/smash/web/templates/_base.html
+++ b/smash/web/templates/_base.html
@@ -265,7 +265,7 @@ desired effect
         {% block footer %}
             <!-- To the right -->
             <div class="pull-right hidden-xs">
-                Version: <strong>preview 0.4.1</strong> (03 Apr 2017)
+                Version: <strong>preview 0.6.0</strong> (18 Mai 2017)
             </div>
 
             <!-- Default to the left -->
@@ -362,14 +362,17 @@ desired effect
 {% block scripts %}
     <!-- jQuery 2.2.3 -->
     <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script>
+    <script src="{% static 'AdminLTE/plugins/jQueryUI/jquery-ui.min.js' %}"></script>
     <!-- Bootstrap 3.3.6 -->
     <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script>
     <!-- AdminLTE Template Helpers (for example- left side bar) -->
     <script src="{% static 'AdminLTE/js/app.min.js' %}"></script>
+    <!-- Smash js -->
+    <script src="{% static 'js/smash.js' %}"></script>
 
     <script>
         var activate = function (page_to_activate) {
-            var $e = $(".sidebar-menu > li[data-desc='" + page_to_activate + "']");
+            var $e = $(".sidebar-menu li[data-desc='" + page_to_activate + "']");
             $e.addClass("active");
         };
 
diff --git a/smash/web/templates/appointments/add.html b/smash/web/templates/appointments/add.html
index 8dcd32ef4be051c4ae1c4624c3f1e6dc95203fa5..707facd672ac662edc9fc48d0ef58484e2b32889 100644
--- a/smash/web/templates/appointments/add.html
+++ b/smash/web/templates/appointments/add.html
@@ -142,6 +142,7 @@
         });
 
         appointment_type_behaviour($("input[name='appointment_types']"), $("input[name='length']"), "{% url 'web.api.appointment_types' %}");
+        appointment_flying_team_place_behaviour($("select[name='flying_team']"), $("select[name='location']"));
     </script>
 
     {% include "includes/datetimepicker.js.html" %}
diff --git a/smash/web/templates/appointments/edit.html b/smash/web/templates/appointments/edit.html
index 15159b329b3b1d34ee927ae1d5b78738ad74e96b..2c1c323f86af1aa8cb3cbed18c0a156d6da20ca4 100644
--- a/smash/web/templates/appointments/edit.html
+++ b/smash/web/templates/appointments/edit.html
@@ -23,11 +23,16 @@
 {% block maincontent %}
 
     {% block content %}
+        <div class="row">
+           
+            {% if appointment.visit %}
+                <p class="col-md-2 pull-right">
+                    <a href="{% url 'web.views.visit_details' appointment.visit.id %}" type="button"
+                       class="btn btn-block btn-default">View corresponding visit</a>
+                </p>
+            {% endif %}
+        </div>
         <div class="box box-info">
-            <div class="box-header with-border">
-                <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" onclick="history.back()">Go
-                    back (without changes)</a>
-            </div>
 
             {% comment %} <div class="box-header with-border">
 		<h3 class="box-title">Details of appointment</h3>
@@ -87,16 +92,22 @@
                     </fieldset>
                 {% endif %}
                 <div class="box-footer">
-                    <div class="col-sm-6">
+                    <div class="col-sm-4">
                         <button type="submit" class="btn btn-block btn-success">Save</button>
                     </div>
-                    <div class="col-sm-6">
+                    <div class="col-sm-4">
+                        <button id="save-and-continue" type="button" class="btn btn-block btn-success">Save and
+                            Continue
+                        </button>
+                    </div>
+                    <div class="col-sm-4">
                         <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default"
                            onclick="history.back()">Cancel</a>
                     </div>
                 </div><!-- /.box-footer -->
             </form>
         </div>
+        {% include 'includes/mail_templates_box.html' with instance_id=appointment.id %}
     {% endblock %}
 
 
@@ -122,6 +133,7 @@
             });
         });
         appointment_type_behaviour($("input[name='appointment-appointment_types']"), $("input[name='appointment-length']"), "{% url 'web.api.appointment_types' %}");
+        appointment_flying_team_place_behaviour($("select[name='appointment-flying_team']"), $("select[name='appointment-location']"));
     </script>
 
     {% include "includes/datetimepicker.js.html" %}
diff --git a/smash/web/templates/appointments/index.html b/smash/web/templates/appointments/index.html
index b06cb857ded5c05577ba0d3913c3a895fd9c97d6..6e14a48c9ef9ff4c68afcb9ac3275b5f4628e36b 100644
--- a/smash/web/templates/appointments/index.html
+++ b/smash/web/templates/appointments/index.html
@@ -22,8 +22,30 @@
 {% endblock breadcrumb %}
 
 {% block maincontent %}
+
+
     <div class="row">
-        <div class="col-md-5">
+        <div class="col-md-12">
+            <div class="box box-primary">
+                <div class="box-body no-padding">
+                    <div id="calendar"></div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="row">
+
+        <div class="col-md-3 col-md-offset-3">
+            <a href="{% url 'web.views.appointment_add_general' %}" type="button"
+               class="btn btn-block btn-default">Add General appointment</a>
+        </div>
+        <div class="col-md-3">
+            <a href="{% url 'web.views.subjects' %}" type="button"
+               class="btn btn-block btn-default">Add Subject appointment</a>
+        </div>
+    </div>
+    <div class="row top-buffer">
+        <div class="col-md-12">
             <table id="approaching_table" class="table table-bordered table-striped">
                 <thead>
                 <tr>
@@ -39,22 +61,6 @@
             </table>
 
         </div>
-
-        <div class="col-md-7">
-            <div class="box box-primary">
-                <div class="box-body no-padding">
-                    <div id="calendar"></div>
-                </div>
-            </div>
-            <div class="col-md-3">
-                <a href="{% url 'web.views.appointment_add_general' %}" type="button"
-                   class="btn btn-block btn-default">Add General appointment</a>
-            </div>
-            <div class="col-md-3">
-                <a href="{% url 'web.views.subjects' %}" type="button"
-                   class="btn btn-block btn-default">Add Subject appointment</a>
-            </div>
-        </div>
     </div>
 {% endblock maincontent %}
 
@@ -69,7 +75,8 @@
 
     <script>
         $(function () {
-            var table = $('#approaching_table').DataTable({
+            var approachingTable = $('#approaching_table');
+            var table = approachingTable.DataTable({
                 serverSide: true,
                 processing: true,
                 ordering: false,
@@ -79,15 +86,15 @@
                     {"data": "title"},
                     {"data": "type"},
                     {"data": "datetime_when"},
-                    {"data": null},
+                    {"data": null}
                 ],
                 columnDefs: [{
                     "targets": 4,
                     "data": "id",
                     "defaultContent": '<a href="#" type="button" class="btn btn-block btn-default">Edit</a>'
                 }]
-            })
-            $('#approaching_table tbody').on('click', 'a', function () {
+            });
+            approachingTable.find('tbody').on('click', 'a', function () {
                 var data = table.row($(this).parents('tr')).data();
                 var url = "{% url 'web.views.appointment_edit' 12345 %}".replace(/12345/, data.id.toString());
                 window.location.href = url;
@@ -99,12 +106,40 @@
                 header: {
                     left: 'prev,next today',
                     center: 'title',
-                    right: 'month,agendaWeek',
+                    right: 'month,agendaWeek'
                 },
+                height: "auto",
+                minTime: "08:00",
+                maxTime: "19:00",
                 editable: false,
                 weekNumbers: true,
                 startParam: "start_date",
                 endParam: "end_date",
+                eventRender: function (event, element) {
+                    var content = "<ul>";
+                    if (event.phone_number) {
+                        content += '<li>Phone number: ' + event.phone_number + '</li>'
+                    }
+                    if (event.screening_number) {
+                        content += '<li>Screening number: ' + event.screening_number + '</li>'
+                    }
+                    if (event.nd_number) {
+                        content += '<li>ND number: ' + event.nd_number + '</li>'
+                    }
+                    if (event.appointment_types) {
+                        content += '<li>Appointment types: ' + event.appointment_types + '</li>'
+                    }
+                    content += "</ul>";
+                    $(element).popover({
+                        title: event.title,
+                        content: content,
+                        html: true,
+                        container: 'body',
+                        trigger: 'hover',
+                        placement: 'bottom'
+                    });
+                    console.log(event);
+                },
                 events: get_calendar_events_function("{% url 'web.api.appointments' full_list %}", true),
             });
         });
diff --git a/smash/web/templates/daily_planning.html b/smash/web/templates/daily_planning.html
new file mode 100644
index 0000000000000000000000000000000000000000..11a94fe8726eb935012a488cc63f54ad2980ded1
--- /dev/null
+++ b/smash/web/templates/daily_planning.html
@@ -0,0 +1,62 @@
+{% extends "_base.html" %}
+{% load static %}
+
+{% block styles %}
+    {{ block.super }}
+    <!-- DataTables -->
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
+
+    <!-- fullCalendar 2.2.5-->
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.css' %}">
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar_custom.print.css' %}"
+          media="print"
+    />
+    <link rel="stylesheet" href="{% static 'fullcalendar-scheduler/scheduler.min.css' %}">
+    <link rel="stylesheet" href="{% static 'css/daily_planning.css' %}">
+{% endblock styles %}
+
+{% block ui_active_tab %}'daily_planning'{% endblock ui_active_tab %}
+{% block page_header %}Daily Planning{% endblock page_header %}
+{% block page_description %}{% endblock page_description %}
+
+{% block title %}{{ block.super }} - Daily Planning{% endblock %}
+
+{% block breadcrumb %}
+    {% include "appointments/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+    <div class="row" id="subjects">
+    </div>
+    <div class="row">
+        <div class="col-md-12">
+            <div class="box box-primary">
+                <div class="box-body no-padding">
+                    <div id="calendar"></div>
+                </div>
+            </div>
+        </div>
+    </div>
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+    <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script>
+    <script src="{% static 'fullcalendar-scheduler/lib/fullcalendar.min.js' %}"></script>
+    <script src="{% static 'fullcalendar-scheduler/scheduler.min.js' %}"></script>
+    <script>
+        var resources_url = '{% url 'web.api.workers' %}';
+        var events_url = '{% url 'web.api.events_persist' %}';
+    </script>
+    <script src="{% static 'js/daily_planning.js' %}"></script>
+
+{% endblock scripts %}
+
+
+{% block messages %}
+    {{ block.super }}
+    <div class="alert alert-success alert-dismissible collapse" id="dp-saved-alert">
+        <button type="button" class="close" data-hide="alert" aria-hidden="true">×</button>
+        <h4><i class="icon fa fa-check"></i> Saved</h4>
+    </div>
+{% endblock %}
diff --git a/smash/web/templates/includes/mail_templates_box.html b/smash/web/templates/includes/mail_templates_box.html
new file mode 100644
index 0000000000000000000000000000000000000000..392126cc5a27a8b65eec19b8cc258e5cf9e94218
--- /dev/null
+++ b/smash/web/templates/includes/mail_templates_box.html
@@ -0,0 +1,27 @@
+<div class="box box-success">
+    <div class="box-header with-border">
+        <h3>Generate Mail</h3>
+    </div>
+    <div class="box-body">
+        <h4>Available templates:</h4>
+        <p>
+            {% for mail_template in mail_templates.0 %}
+                <a href="{% url "web.views.mail_template_generate" mail_template.id instance_id %}"
+                   class="btn btn-app">
+                    <i class="fa"> {% autoescape off %}{{ mail_template.language.image_img }}{% endautoescape %}</i>
+                    {{ mail_template.name }}
+                </a>
+            {% endfor %}
+        </p>
+        <h4>Unavailable templates:</h4>
+        <p>
+            {% for mail_template in mail_templates.1 %}
+                <span
+                        class="btn btn-app disabled">
+                <i class="fa"> {% autoescape off %}{{ mail_template.language.image_img }}{% endautoescape %}</i>
+                {{ mail_template.name }}
+            </span>
+            {% endfor %}
+        <p></p>
+    </div>
+</div>
\ No newline at end of file
diff --git a/smash/web/templates/languages/add.html b/smash/web/templates/languages/add.html
new file mode 100644
index 0000000000000000000000000000000000000000..48a17cd04565f678ccb9fb13114a0d5a7bcfe2d3
--- /dev/null
+++ b/smash/web/templates/languages/add.html
@@ -0,0 +1,9 @@
+{% extends "languages/add_edit.html" %}
+
+{% block page_header %}New language{% endblock page_header %}
+
+{% block title %}{{ block.super }} - Add new language{% endblock %}
+
+{% block form-title %}Enter language §details{% endblock %}
+
+{% block save-button %}Add{% endblock %}
diff --git a/smash/web/templates/languages/add_edit.html b/smash/web/templates/languages/add_edit.html
new file mode 100644
index 0000000000000000000000000000000000000000..794ba7c565fd4f2ef48e60e68b7095cb4c1610c2
--- /dev/null
+++ b/smash/web/templates/languages/add_edit.html
@@ -0,0 +1,77 @@
+{% extends "_base.html" %}
+{% load static %}
+{% load filters %}
+
+{% block styles %}
+    {{ block.super }}
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}"/>
+
+{% endblock styles %}
+
+{% block ui_active_tab %}'configuration'{% endblock ui_active_tab %}
+{% block page_description %}{% endblock page_description %}
+
+{% block breadcrumb %}
+    {% include "languages/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+
+    {% block content %}
+        <div class="row">
+            <div class="col-md-12">
+                <div class="box box-success">
+                    <div class="box-header with-border">
+                        <h3 class="box-title">{% block form-title %}Enter language details{% endblock %}</h3>
+                    </div>
+
+
+                    <form method="post" action="" class="form-horizontal" enctype="multipart/form-data">
+                        {% csrf_token %}
+
+                        <div class="box-body">
+                            {% for field in form %}
+                                <div class="form-group {% if field.errors %}has-error{% endif %}">
+                                    <label class="col-sm-4  col-lg-offset-1 col-lg-2 control-label">
+                                        {{ field.label }}
+                                    </label>
+
+                                    <div class="col-sm-8 col-lg-4">
+                                        {{ field|add_class:'form-control' }}
+                                        {% if field.errors %}
+                                            <span class="help-block">{{ field.errors }}</span>
+                                        {% endif %}
+                                    </div>
+
+
+                                </div>
+                            {% endfor %}
+                        </div><!-- /.box-body -->
+                        <div class="box-footer">
+                            <div class="col-sm-6">
+                                <button type="submit" class="btn btn-block btn-success">{% block save-button %}
+                                    Add{% endblock %}
+                                </button>
+                            </div>
+                            <div class="col-sm-6">
+                                <a href="{% url 'web.views.languages' %}"
+                                   class="btn btn-block btn-default">Cancel</a>
+                            </div>
+                        </div><!-- /.box-footer -->
+                    </form>
+                </div>
+
+            </div>
+        </div>
+
+    {% endblock %}
+
+
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+
+    <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script>
+
+{% endblock scripts %}
\ No newline at end of file
diff --git a/smash/web/templates/languages/breadcrumb.html b/smash/web/templates/languages/breadcrumb.html
new file mode 100644
index 0000000000000000000000000000000000000000..b3194bfb0a32794c726a75682425d7ea4b17f30d
--- /dev/null
+++ b/smash/web/templates/languages/breadcrumb.html
@@ -0,0 +1,2 @@
+<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
+<li class="active"><a href="{% url 'web.views.languages' %}">Languages</a></li>
\ No newline at end of file
diff --git a/smash/web/templates/languages/confirm_delete.html b/smash/web/templates/languages/confirm_delete.html
new file mode 100644
index 0000000000000000000000000000000000000000..929c61370a2960ce8a0147249fdef6411f5d4a6c
--- /dev/null
+++ b/smash/web/templates/languages/confirm_delete.html
@@ -0,0 +1,62 @@
+{% extends "_base.html" %}
+{% load static %}
+{% load filters %}
+
+{% block styles %}
+    {{ block.super }}
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}"/>
+
+{% endblock styles %}
+
+{% block ui_active_tab %}'configuration'{% endblock ui_active_tab %}
+{% block page_header %}Delete language{% endblock page_header %}
+{% block page_description %}{% endblock page_description %}
+
+{% block title %}{{ block.super }} - Delete language{% endblock %}
+
+{% block breadcrumb %}
+    {% include "languages/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+
+    {% block content %}
+        <div class="row">
+            <div class="col-md-12">
+                <div class="box box-success">
+                    <div class="box-header with-border">
+                        <h3 class="box-title">Confirm deletion</h3>
+                    </div>
+
+                    <form action="" method="post" class="form-horizontal">{% csrf_token %}
+                        <div class="box-body">
+                            <p>Are you sure you want to delete language "{{ object.name }}"?</p>
+                        </div><!-- /.box-body -->
+                        <div class="box-footer">
+                            <div class="col-sm-6">
+                                <button type="submit" class="btn btn-block btn-danger">Delete</button>
+                            </div>
+                            <div class="col-sm-6">
+                                <a href="{% url 'web.views.languages' %}"
+                                   class="btn btn-block btn-default">Cancel</a>
+                            </div>
+                        </div><!-- /.box-footer -->
+                    </form>
+                </div>
+
+            </div>
+        </div>
+
+    {% endblock %}
+
+
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+
+    <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script>
+
+{% endblock scripts %}
+
+
diff --git a/smash/web/templates/languages/edit.html b/smash/web/templates/languages/edit.html
new file mode 100644
index 0000000000000000000000000000000000000000..ee96e0910981224b10d2ad0305cdebe40d5b63c9
--- /dev/null
+++ b/smash/web/templates/languages/edit.html
@@ -0,0 +1,10 @@
+{% extends "mail_templates/add_edit.html" %}
+
+{% block page_header %}Edit language "{{ language.name }}"{% endblock page_header %}
+
+{% block title %}{{ block.super }} - Edit language "{{ language.name }}"{% endblock %}
+
+{% block form-title %}Enter language details{% endblock %}
+
+{% block save-button %}Save{% endblock %}
+
diff --git a/smash/web/templates/languages/list.html b/smash/web/templates/languages/list.html
new file mode 100644
index 0000000000000000000000000000000000000000..eeb9eb68a3fff742857578282926129f210be213
--- /dev/null
+++ b/smash/web/templates/languages/list.html
@@ -0,0 +1,76 @@
+{% extends "_base.html" %}
+{% load static %}
+
+{% block styles %}
+    {{ block.super }}
+    <!-- DataTables -->
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
+{% endblock styles %}
+
+{% block ui_active_tab %}'configuration'{% endblock ui_active_tab %}
+{% block page_header %}Languages{% endblock page_header %}
+{% block page_description %}{% endblock page_description %}
+
+{% block breadcrumb %}
+    {% include "languages/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+
+    <div>
+        <a class="btn btn-app" href="{% url 'web.views.language_add' %}">
+            <i class="fa fa-plus"></i> Add new language
+        </a>
+    </div>
+
+    <div class="box-body">
+        <table id="table" class="table table-bordered table-striped">
+            <thead>
+            <tr>
+                <th>Id</th>
+                <th>Name</th>
+                <th>Flag</th>
+                <th>Order</th>
+                <th>Locale</th>
+                <th>Edit</th>
+                <th>Delete</th>
+            </tr>
+            </thead>
+            <tbody>
+            {% for language in languages %}
+                <tr>
+                    <td>{{ language.id }}</td>
+                    <td>{{ language.name }}</td>
+                    <td>{% autoescape off %}{{ language.image_img }}{% endautoescape %}</td>
+                    <td>{{ language.order }}</td>
+                    <td>{{ language.locale }}</td>
+                    <td><a href="{% url 'web.views.language_edit' language.id %}"><i
+                            class="fa fa-edit"></i></a></td>
+                    <td><a href="{% url 'web.views.language_delete' language.id %}"><i
+                            class="fa fa-trash text-danger"></i></a></td>
+                </tr>
+            {% endfor %}
+            </tbody>
+        </table>
+    </div>
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+
+    <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script>
+    <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script>
+
+    <script>
+        $(function () {
+            $('#table').DataTable({
+                "paging": true,
+                "lengthChange": false,
+                "searching": true,
+                "ordering": true,
+                "info": true,
+                "autoWidth": false
+            });
+        });
+    </script>
+{% endblock scripts %}
diff --git a/smash/web/templates/mail_templates/add.html b/smash/web/templates/mail_templates/add.html
new file mode 100644
index 0000000000000000000000000000000000000000..561eb1a989caa72dda2f5db7e2d6aabf77e34330
--- /dev/null
+++ b/smash/web/templates/mail_templates/add.html
@@ -0,0 +1,8 @@
+{% extends "mail_templates/add_edit.html" %}
+
+{% block page_header %}New mail template{% endblock page_header %}
+
+{% block title %}{{ block.super }} - Add new mail template{% endblock %}
+
+{% block form-title %}Enter mail template details{% endblock %}
+{% block save-button %}Add{% endblock %}
\ No newline at end of file
diff --git a/smash/web/templates/mail_templates/add_edit.html b/smash/web/templates/mail_templates/add_edit.html
new file mode 100644
index 0000000000000000000000000000000000000000..4fbc937166272b85854f269c6b0d090cb677141a
--- /dev/null
+++ b/smash/web/templates/mail_templates/add_edit.html
@@ -0,0 +1,76 @@
+{% extends "_base.html" %}
+{% load static %}
+{% load filters %}
+
+{% block styles %}
+    {{ block.super }}
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}"/>
+
+{% endblock styles %}
+
+{% block ui_active_tab %}'subjects'{% endblock ui_active_tab %}
+{% block page_description %}{% endblock page_description %}
+
+{% block breadcrumb %}
+    {% include "mail_templates/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+
+    {% block content %}
+        <div class="row">
+            <div class="col-md-12">
+                <div class="box box-success">
+                    <div class="box-header with-border">
+                        <h3 class="box-title">{% block form-title %}Enter mail template details{% endblock %}</h3>
+                    </div>
+
+
+                    <form method="post" action="" class="form-horizontal" enctype="multipart/form-data">
+                        {% csrf_token %}
+
+                        <div class="box-body">
+                            {% for field in form %}
+                                <div class="form-group {% if field.errors %}has-error{% endif %}">
+                                    <label class="col-sm-4  col-lg-offset-1 col-lg-2 control-label">
+                                        {{ field.label }}
+                                    </label>
+
+                                    <div class="col-sm-8 col-lg-4">
+                                        {{ field|add_class:'form-control' }}
+                                        {% if field.errors %}
+                                            <span class="help-block">{{ field.errors }}</span>
+                                        {% endif %}
+                                    </div>
+
+
+                                </div>
+                            {% endfor %}
+                        </div><!-- /.box-body -->
+                        <div class="box-footer">
+                            <div class="col-sm-6">
+                                <button type="submit" class="btn btn-block btn-success">{% block save-button %}
+                                    Add{% endblock %}</button>
+                            </div>
+                            <div class="col-sm-6">
+                                <a href="{% url 'web.views.mail_templates' %}"
+                                   class="btn btn-block btn-default">Cancel</a>
+                            </div>
+                        </div><!-- /.box-footer -->
+                    </form>
+                </div>
+
+            </div>
+        </div>
+
+    {% endblock %}
+
+
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+
+    <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script>
+
+{% endblock scripts %}
\ No newline at end of file
diff --git a/smash/web/templates/mail_templates/confirm_delete.html b/smash/web/templates/mail_templates/confirm_delete.html
new file mode 100644
index 0000000000000000000000000000000000000000..48b1967d7f4ae545ce63aed1474c707f80f405dc
--- /dev/null
+++ b/smash/web/templates/mail_templates/confirm_delete.html
@@ -0,0 +1,62 @@
+{% extends "_base.html" %}
+{% load static %}
+{% load filters %}
+
+{% block styles %}
+    {{ block.super }}
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}"/>
+
+{% endblock styles %}
+
+{% block ui_active_tab %}'subjects'{% endblock ui_active_tab %}
+{% block page_header %}Delete mail template{% endblock page_header %}
+{% block page_description %}{% endblock page_description %}
+
+{% block title %}{{ block.super }} - Delete mail template{% endblock %}
+
+{% block breadcrumb %}
+    {% include "mail_templates/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+
+    {% block content %}
+        <div class="row">
+            <div class="col-md-12">
+                <div class="box box-success">
+                    <div class="box-header with-border">
+                        <h3 class="box-title">Confirm deletion</h3>
+                    </div>
+
+                    <form action="" method="post" class="form-horizontal">{% csrf_token %}
+                        <div class="box-body">
+                            <p>Are you sure you want to delete mail template "{{ object.name }}"?</p>
+                        </div><!-- /.box-body -->
+                        <div class="box-footer">
+                            <div class="col-sm-6">
+                                <button type="submit" class="btn btn-block btn-danger">Delete</button>
+                            </div>
+                            <div class="col-sm-6">
+                                <a href="{% url 'web.views.mail_templates' %}"
+                                   class="btn btn-block btn-default">Cancel</a>
+                            </div>
+                        </div><!-- /.box-footer -->
+                    </form>
+                </div>
+
+            </div>
+        </div>
+
+    {% endblock %}
+
+
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+
+    <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script>
+
+{% endblock scripts %}
+
+
diff --git a/smash/web/templates/mail_templates/edit.html b/smash/web/templates/mail_templates/edit.html
new file mode 100644
index 0000000000000000000000000000000000000000..d166d86a3b9bd34d14fd6a792b46572e41a53f0a
--- /dev/null
+++ b/smash/web/templates/mail_templates/edit.html
@@ -0,0 +1,9 @@
+{% extends "mail_templates/add_edit.html" %}
+
+{% block page_header %}Edit mail template "{{ mail_template.name }}"{% endblock page_header %}
+
+{% block title %}{{ block.super }} - Edit mail template "{{ mail_template.name }}"{% endblock %}
+
+{% block form-title %}Enter mail template details{% endblock %}
+
+{% block save-button %}Save{% endblock %}
diff --git a/smash/web/templates/mail_templates/list.html b/smash/web/templates/mail_templates/list.html
new file mode 100644
index 0000000000000000000000000000000000000000..f403957a7904b464a1a28ca7b817388b3254c9a7
--- /dev/null
+++ b/smash/web/templates/mail_templates/list.html
@@ -0,0 +1,115 @@
+{% extends "_base.html" %}
+{% load static %}
+
+{% block styles %}
+    {{ block.super }}
+    <!-- DataTables -->
+    <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
+{% endblock styles %}
+
+{% block ui_active_tab %}'mail_templates'{% endblock ui_active_tab %}
+{% block page_header %}Mail templates{% endblock page_header %}
+{% block page_description %}{% endblock page_description %}
+
+{% block breadcrumb %}
+    {% include "mail_templates/breadcrumb.html" %}
+{% endblock breadcrumb %}
+
+{% block maincontent %}
+
+
+    <div class="box box-success">
+        <div class="box-header with-border">
+            <h3 class="box-title">Templates</h3>
+        </div>
+        <div class="box-body">
+
+            <div>
+                <a class="btn btn-app" href="{% url 'web.views.mail_template_add' %}">
+                    <i class="fa fa-plus"></i> Add new template
+                </a>
+            </div>
+            <table id="table" class="table table-bordered table-striped">
+                <thead>
+                <tr>
+                    <th>No.</th>
+                    <th>Context</th>
+                    <th>Language</th>
+                    <th>Name</th>
+                    <th>Download</th>
+                    <th>Edit</th>
+                    <th>Delete</th>
+                </tr>
+                </thead>
+                <tbody>
+                {% for mail_template in mail_templates %}
+                    <tr>
+                        <td>{{ forloop.counter }}</td>
+                        <td>{{ mail_template.get_context_display }}</td>
+                        <td>{% autoescape off %}{{ mail_template.language.image_img }}{% endautoescape %}</td>
+                        <td>{{ mail_template.name }}</td>
+                        <td><a href="{{ mail_template.template_file.url }}"><i class="fa fa-download"></i></a></td>
+                        <td><a href="{% url 'web.views.mail_template_edit' mail_template.id %}"><i
+                                class="fa fa-edit"></i></a></td>
+                        <td><a href="{% url 'web.views.mail_template_delete' mail_template.id %}"><i
+                                class="fa fa-trash text-danger"></i></a></td>
+                    </tr>
+                {% endfor %}
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+    <div class="box box-success">
+        <div class="box-header with-border">
+            <h3 class="box-title">Tags <i class="fa fa-question-circle"></i></h3>
+        </div>
+        <div class="box-body">
+            <p>The following tags can be used within the Word documents and will be replaced by actual values during the
+                mail generation.</p>
+            <table id="table" class="table table-bordered table-striped">
+                <thead>
+                <tr>
+                    <th>Placeholder</th>
+                    <th>Description</th>
+                    <th>Comment</th>
+                </tr>
+                </thead>
+                <tbody>
+                {% for name, tags in explanations.items %}
+                    <tr>
+                        <td class="table-separator" colspan="3">{{ name | title }}</td>
+                    </tr>
+                    {% for tag in tags %}
+                        <tr>
+                            <td>{{ tag.0 }}</td>
+                            <td>{{ tag.1 }}</td>
+                            <td>{{ tag.2 }}</td>
+                        </tr>
+                    {% endfor %}
+                {% endfor %}
+                </tbody>
+            </table>
+        </div>
+    </div>
+{% endblock maincontent %}
+
+{% block scripts %}
+    {{ block.super }}
+
+    <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script>
+    <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script>
+
+    <script>
+        $(function () {
+            $('#table').DataTable({
+                "paging": true,
+                "lengthChange": false,
+                "searching": true,
+                "ordering": true,
+                "info": true,
+                "autoWidth": false
+            });
+        });
+    </script>
+{% endblock scripts %}
diff --git a/smash/web/templates/sidebar.html b/smash/web/templates/sidebar.html
index 19cd2afa61d442d314a2d0d5e97871f7a1352ff9..b021fad36954a78b967191ff704b42533aeeb37d 100644
--- a/smash/web/templates/sidebar.html
+++ b/smash/web/templates/sidebar.html
@@ -9,13 +9,6 @@
         </a>
     </li>
 
-    <li data-desc="visits">
-        <a href="{% url 'web.views.visits' %}">
-            <i class="fa fa-id-card-o"></i>
-            <span>Visits</span>
-        </a>
-    </li>
-
     <li data-desc="appointments">
         <a href="{% url 'web.views.appointments' %}">
             <i class="fa fa-calendar"></i>
@@ -23,6 +16,13 @@
         </a>
     </li>
 
+    <li data-desc="daily_planning">
+        <a href="{% url 'web.views.daily_planning' %}">
+            <i class="fa fa-clock-o"></i>
+            <span>Daily Planning</span>
+        </a>
+    </li>
+
     <li data-desc="workers">
         <a href="{% url 'web.views.doctors' %}">
             <i class="fa fa-user-md"></i>
@@ -57,12 +57,19 @@
             <span>Export</span>
         </a>
     </li>
-
-    <li data-desc="configuration">
-        <a href="{% url 'web.views.configuration' %}">
-            <i class="fa fa-wrench"></i>
-            <span>Configuration</span>
+    <li data-desc="configuration" class="treeview">
+        <a href="#">
+            <i class="fa fa-wrench"></i> <span>Configuration</span>
+            <span class="pull-right-container">
+              <i class="fa fa-angle-left pull-right"></i>
+            </span>
         </a>
+        <ul class="treeview-menu">
+            <li><a href="{% url 'web.views.configuration' %}">General</a></li>
+            <li>
+                <a href="{% url 'web.views.languages' %}">Languages</a>
+            </li>
+        </ul>
     </li>
 
 </ul>
\ No newline at end of file
diff --git a/smash/web/templates/subjects/add.html b/smash/web/templates/subjects/add.html
index 3ce7d1c7526e08a9cfd214936639aa41792484d2..c8e78745132d3fba7da0ac8307a74761ef8d5276 100644
--- a/smash/web/templates/subjects/add.html
+++ b/smash/web/templates/subjects/add.html
@@ -7,6 +7,7 @@
     <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}"/>
 
     {% include "includes/datepicker.css.html" %}
+    {% include "includes/datetimepicker.css.html" %}
 {% endblock styles %}
 
 {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %}
@@ -93,4 +94,5 @@
     </script>
 
     {% include "includes/datepicker.js.html" %}
+    {% include "includes/datetimepicker.js.html" %}
 {% endblock scripts %}
diff --git a/smash/web/templates/subjects/details.html b/smash/web/templates/subjects/details.html
index 4187da02173f53056f75e39e8942148cd506cc71..d3cd52aae7946204bc849ce185a5f1259cc76658 100644
--- a/smash/web/templates/subjects/details.html
+++ b/smash/web/templates/subjects/details.html
@@ -23,8 +23,7 @@
     {% block content %}
         <div class="box box-info">
             <div class="box-header with-border">
-                <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default"
-                   onclick="history.back()">Back</a>
+                <a href="javascript:history.back(1)" class="btn btn-block btn-default">Back</a>
             </div>
 
             {% comment %} <div class="box-header with-border">
@@ -57,7 +56,7 @@
 
 
                 <div class="box-footer">
-                    <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a>
+                    <a href="javascript:history.back(1)" class="btn btn-block btn-default">Back</a>
                 </div><!-- /.box-footer -->
             </form>
         </div>
diff --git a/smash/web/templates/subjects/edit.html b/smash/web/templates/subjects/edit.html
index 0a0163615c5c195110444c25bf2371fbc13a78a6..956823144048a7cdf7829f6b6976059d3ecb4958 100644
--- a/smash/web/templates/subjects/edit.html
+++ b/smash/web/templates/subjects/edit.html
@@ -8,6 +8,7 @@
     <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
 
     {% include "includes/datepicker.css.html" %}
+    {% include "includes/datetimepicker.css.html" %}
 {% endblock styles %}
 
 {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %}
@@ -25,9 +26,9 @@
     {% block content %}
         <div class="row">
             <p class="col-lg-3 pull-left">
-                <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default"
-                   onclick="history.back()">Go
-                    back (discard changes)</a>
+                <a href="javascript:history.back(1)" class="btn btn-block btn-default"
+                ">Go
+                back (discard changes)</a>
             </p>
             <p class="col-md-2 pull-right">
                 <a href="{% url 'web.views.subject_visit_details' subject.id %}" type="button"
@@ -69,10 +70,15 @@
 
 
                         <div class="box-footer">
-                            <div class="col-sm-6">
+                            <div class="col-sm-4">
                                 <button type="submit" class="btn btn-block btn-success">Save</button>
                             </div>
-                            <div class="col-sm-6">
+                            <div class="col-sm-4">
+                                <button id="save-and-continue" type="button" class="btn btn-block btn-success">Save and
+                                    Continue
+                                </button>
+                            </div>
+                            <div class="col-sm-4">
                                 <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default"
                                    onclick="history.back()">Cancel</a>
                             </div>
@@ -81,6 +87,9 @@
                 </div><!-- /.box -->
             </div><!-- /.col-md-12 -->
         </div><!-- /.row -->
+
+        {% include 'includes/mail_templates_box.html' with instance_id=subject.id %}
+
         <div class="row">
             <div class="col-lg-12">
                 <div class="box box-success">
@@ -122,6 +131,8 @@
             </div>
         </div>
 
+
+
         <div class="modal modal-danger fade" id="confirm-dead-resigned-mark-dialog" tabindex="-1" role="dialog">
             <div class="modal-dialog" role="document">
                 <div class="modal-content">
@@ -218,4 +229,5 @@
     </script>
 
     {% include "includes/datepicker.js.html" %}
+    {% include "includes/datetimepicker.js.html" %}
 {% endblock scripts %}
diff --git a/smash/web/templates/subjects/index.html b/smash/web/templates/subjects/index.html
index 05229e970349539827b8d9ad19613ec901e47dd4..99bc0553185ef5d02cbac7af0239a4eb60c5b80e 100644
--- a/smash/web/templates/subjects/index.html
+++ b/smash/web/templates/subjects/index.html
@@ -27,7 +27,7 @@
     </div>
 
     <div class="box-body">
-        <table id="table" class="table table-bordered table-striped">
+        <table id="table" class="table table-bordered table-striped table-responsive">
             <thead>
             <tr>
                 <th>ND</th>
@@ -40,6 +40,7 @@
                 <th>Resigned</th>
                 <th>Postponed</th>
                 <th>Info sent</th>
+                <th>Type</th>
                 <th>Edit</th>
             </tr>
             </thead>
@@ -72,6 +73,9 @@
                 <th>
                     <div name="yes_no_filter">---</div>
                 </th>
+                <th>
+                    <div name="type_filter">---</div>
+                </th>
             </tr>
             </tfoot>
 
@@ -88,29 +92,48 @@
     <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script>
 
     <script>
-        $('#table tfoot div[name="string_filter"]').each(function () {
+        var table;
+        $('#table').find('tfoot div[name="string_filter"]').each(function () {
             var title = $(this).text();
             $(this).html('<input type="text" style="width:80px" placeholder="' + title + '" />');
         });
 
-        $('#table tfoot div[name="yes_no_filter"]').each(function () {
+        $('#table').find('tfoot div[name="yes_no_filter"]').each(function () {
             $(this).html('<select style="width:60px" ><option value selected="selected">---</option><option value="true">YES</option><option value="false">NO</option></select>');
         });
 
-        $('#table tfoot div[name="location_filter"]').each(function () {
-            var obj = $(this)
+        $('#table').find('tfoot div[name="location_filter"]').each(function () {
+            var obj = $(this);
             obj.html('<select style="width:80px"><option value selected="selected">---</option></select>');
+            var select = $('select', obj);
             $.get("{% url 'web.api.locations' %}", function (data) {
                 $.each(data.locations, function (index, location) {
-                    $('select', obj).append('<option value="' + location.id + '">' + location.name + '</option>');
+                    select.append('<option value="' + location.id + '">' + location.name + '</option>');
+                });
+                {% if worker.locations.all.count == 1 %}
+                    select.val({{  worker.locations.first.id}});
+                {% endif %}
+            });
+
+        });
+        $('#table').find('tfoot div[name="type_filter"]').each(function () {
+            var obj = $(this);
+            obj.html('<select style="width:80px"><option value selected="selected">---</option></select>');
+            var select = $('select', obj);
+            $.get("{% url 'web.api.subject_types' %}", function (data) {
+                $.each(data.types, function (index, type) {
+                    select.append('<option value="' + type.id + '">' + type.name + '</option>');
                 });
             });
+
         });
 
         $(function () {
-            var table = $('#table').DataTable({
+            table = $('#table').DataTable({
+                pageLength: 25,
                 serverSide: true,
                 processing: true,
+                responsive: true,
                 ajax: "{% url 'web.api.subjects' list_type %}",
                 columns: [
                     {"data": "nd_number"},
@@ -122,14 +145,19 @@
                     {"data": "resigned"},
                     {"data": "postponed"},
                     {"data": "information_sent"},
-                    {"data": null},
+                    {"data": "type"},
+                    {"data": null}
                 ],
                 columnDefs: [{
-                    "targets": 9,
+                    "targets": 10,
                     "data": "id",
                     "defaultContent": '<a href="#" type="button" class="btn btn-block btn-default">Edit</a>'
-                }]
+                }],
+                order: [[0, 'desc']]
             });
+            {% if worker.locations.all.count == 1 %}
+                table.columns(4).search({{  worker.locations.first.id}}).draw();
+            {% endif %}
 
             $('#table tbody').on('click', 'a', function () {
                 var data = table.row($(this).parents('tr')).data();
diff --git a/smash/web/templates/subjects/visitdetails.html b/smash/web/templates/subjects/visitdetails.html
index 3901572f8a56b33a6a2899263dfce4fa4f9394dc..2bded9f9f972008022073819359c1badae8a5388 100644
--- a/smash/web/templates/subjects/visitdetails.html
+++ b/smash/web/templates/subjects/visitdetails.html
@@ -23,8 +23,8 @@
     {% block content %}
         <div class="box box-info">
             <div class="box-header with-border">
-                <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default"
-                   onclick="history.back()">Back</a>
+                <a href="{% url 'web.views.subject_edit' id %}"
+                   class="btn btn-block btn-default">Subject</a>
                 <a href="{% url 'web.views.visit_add' id %}" type="button" class="btn btn-block btn-default">Add
                     visit</a>
             </div>
diff --git a/smash/web/templates/visits/details.html b/smash/web/templates/visits/details.html
index d62679f19ab2cc314668c17c6b892f04cced51b3..1df9ff26953f2e47dd89f7a10bdd0f4f21f76bec 100644
--- a/smash/web/templates/visits/details.html
+++ b/smash/web/templates/visits/details.html
@@ -25,8 +25,6 @@
     {% block content %}
         <div class="box box-info">
             <div class="box-header with-border">
-                <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default"
-                   onclick="history.back()">Back</a>
                 <a href="{% url 'web.views.subject_visit_details' visit.subject.id %}" type="button"
                    class="btn btn-block btn-default">Subject's visits</a>
             </div>
@@ -80,7 +78,7 @@
                 </div><!-- /.box-body -->
                 <div class="box-footer">
                     <div class="col-sm-12">
-                        <button type="submit" class="btn btn-block btn-success">Save</button>
+                        <button type="submit" class="btn btn-block btn-success">Save and continue</button>
                     </div>
                 </div><!-- /.box-footer -->
             </form>
@@ -133,7 +131,7 @@
                             </td>
                             <td>
                                 {% ifequal app.status "SCHEDULED" %}
-                                    <a href="{% url 'web.views.appointment_edit' app.id %}" type="button"
+                                    <a href="{% url 'web.views.appointment_edit' app.id %}?from_visit" type="button"
                                        class="btn btn-block btn-default">Edit</a>
                                 {% else %}
                                     {{ app.status }}
@@ -177,16 +175,15 @@
                 <div class="box-footer">
                     <td><a href="{% url 'web.views.subject_edit' visit.subject.id %}" type="button"
                            class="btn btn-block btn-default">Edit subject</a></td>
-                    <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a>
                 </div><!-- /.box-footer -->
             </form>
         </div>
 
-        </form>
+        {% include 'includes/mail_templates_box.html' with instance_id=visit.id %}
+
     {% endblock %}
 
 
-    </div>
 
 {% endblock maincontent %}
 
diff --git a/smash/web/tests/__init__.py b/smash/web/tests/__init__.py
index 72b9f9adc3193fb034ac7656aea51eae348acddc..6782804f7cfe81faf815c0d9679159eed66a3816 100644
--- a/smash/web/tests/__init__.py
+++ b/smash/web/tests/__init__.py
@@ -1,9 +1,13 @@
+import os
+from django.conf import settings
 from django.contrib.auth.models import User
 from django.test import Client
 from django.test import TestCase
 
 from functions import create_worker
 
+settings.MEDIA_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')
+
 
 class LoggedInTestCase(TestCase):
     def setUp(self):
diff --git a/smash/web/tests/data/template.docx b/smash/web/tests/data/template.docx
new file mode 100644
index 0000000000000000000000000000000000000000..17aee71db3c1b8699e27daf1e0701420150976a0
Binary files /dev/null and b/smash/web/tests/data/template.docx differ
diff --git a/smash/web/tests/data/upcoming_appointment_FR.docx b/smash/web/tests/data/upcoming_appointment_FR.docx
new file mode 100644
index 0000000000000000000000000000000000000000..b118fadd9d2aa89b8a7596ffe1d534e17d33f2d3
Binary files /dev/null and b/smash/web/tests/data/upcoming_appointment_FR.docx differ
diff --git a/smash/web/tests/functions.py b/smash/web/tests/functions.py
index fea131ec68825d924ccc2e8ec60e6d0d5035d88d..24cd16c2bff10bebb7076afc7b14c00c05354fd7 100644
--- a/smash/web/tests/functions.py
+++ b/smash/web/tests/functions.py
@@ -1,8 +1,9 @@
 import datetime
 
+import os
 from django.contrib.auth.models import User
 
-from web.models import Location, AppointmentType, Subject, Worker, Visit, Appointment, ConfigurationItem
+from web.models import Location, AppointmentType, Subject, Worker, Visit, Appointment, ConfigurationItem, Language
 from web.models.constants import SEX_CHOICES_MALE, SUBJECT_TYPE_CHOICES_CONTROL
 from web.views.notifications import get_today_midnight_date
 
@@ -42,7 +43,8 @@ def create_subject(id=1):
         sex=SEX_CHOICES_MALE,
         type=SUBJECT_TYPE_CHOICES_CONTROL,
         screening_number="piotr's number" + str(id),
-        country="france")
+        country="france"
+    )
 
 
 def create_user(username=None, password=None):
@@ -84,6 +86,8 @@ def create_visit(subject=None):
 def create_appointment(visit=None, when=None):
     if visit is None:
         visit = create_visit()
+    # if when is None:
+    #     when = get_today_midnight_date()
     return Appointment.objects.create(
         visit=visit,
         length=30,
@@ -97,4 +101,14 @@ def create_configuration_item():
     item.value = "xxx"
     item.name = "yyy"
     item.save()
-    return item;
+    return item
+
+
+def create_language(name="French", locale="fr_FR"):
+    language = Language(name=name, locale=locale)
+    language.save()
+    return language
+
+
+def get_resource_path(filename):
+    return os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data', filename)
diff --git a/smash/web/tests/test_SubjectAddForm.py b/smash/web/tests/test_SubjectAddForm.py
index 158814504a49e84a5c26e84e8e837ad9c5aa92d4..bfdab7a83f04f92cae6ac0519e126016abfb0f2c 100644
--- a/smash/web/tests/test_SubjectAddForm.py
+++ b/smash/web/tests/test_SubjectAddForm.py
@@ -1,6 +1,6 @@
 from django.contrib.auth.models import User
-from django.test import TestCase
 from django.test import Client
+from django.test import TestCase
 
 from functions import get_test_location, create_subject, create_worker
 from web.forms import SubjectAddForm, get_new_screening_number
@@ -39,6 +39,7 @@ class SubjectAddFormTests(TestCase):
         form = SubjectAddForm(data=form_data, user=self.user)
         form.is_valid()
         self.assertTrue(form.is_valid())
+        self.assertIsNone(form.fields['year_of_diagnosis'].initial)
         form.save()
 
         form2 = SubjectAddForm(data=form_data, user=self.user)
@@ -61,15 +62,6 @@ class SubjectAddFormTests(TestCase):
         self.assertFalse(validation_status)
         self.assertTrue("nd_number" in form2.errors)
 
-    def test_invalid_3(self):
-        form_data = self.sample_data
-        form_data['screening_number'] = ""
-
-        form = SubjectAddForm(data=form_data, user=self.user)
-        validation_status = form.is_valid()
-        self.assertFalse(validation_status)
-        self.assertTrue("screening_number" in form.errors)
-
     def test_get_new_screening_number(self):
         prefix = "X-"
         subject = create_subject()
@@ -88,15 +80,6 @@ class SubjectAddFormTests(TestCase):
         new_screening_number = get_new_screening_number(prefix)
         self.assertEqual(prefix + "301", new_screening_number)
 
-    def test_get_new_screening_number_3(self):
-        prefix = "X-"
-        subject = create_subject()
-        subject.screening_number = prefix + "300" + "; L-1111"
-        subject.save()
-
-        new_screening_number = get_new_screening_number(prefix)
-        self.assertEqual(prefix + "301", new_screening_number)
-
     def test_get_new_screening_number_3(self):
         prefix = "X-"
         subject = create_subject()
diff --git a/smash/web/tests/test_api_appointment.py b/smash/web/tests/test_api_appointment.py
index bf28f7c757745e3c1afbe8fa1853c47a58e04b1f..b6e11b47ab024922ac51394591356279f0166517 100644
--- a/smash/web/tests/test_api_appointment.py
+++ b/smash/web/tests/test_api_appointment.py
@@ -7,6 +7,7 @@ from django.test import Client
 from django.test import TestCase
 from django.urls import reverse
 
+from web.models import AppointmentTypeLink
 from web.tests.functions import create_subject, create_worker, create_visit, create_appointment, \
     create_appointment_type, create_get_suffix
 from web.views.appointment import APPOINTMENT_LIST_GENERIC, APPOINTMENT_LIST_APPROACHING, APPOINTMENT_LIST_UNFINISHED
@@ -36,8 +37,10 @@ class TestApi(TestCase):
         create_appointment(visit)
         appointment2 = create_appointment(visit, get_today_midnight_date())
         appointment2.visit = None
-        appointment2.appointment_types.add(create_appointment_type())
+
+        appointment_type = create_appointment_type()
         appointment2.save()
+        AppointmentTypeLink.objects.create(appointment=appointment2, appointment_type=appointment_type)
 
         url = reverse('web.api.appointments', kwargs={'type': APPOINTMENT_LIST_GENERIC})
         response = self.client.get(url)
@@ -77,9 +80,10 @@ class TestApi(TestCase):
         self.subject.save()
         visit = create_visit(self.subject)
         appointment = create_appointment(visit, get_today_midnight_date())
-        appointment.appointment_types.add(create_appointment_type())
         appointment.save()
 
+        AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=create_appointment_type())
+
         params = {
             "start_date": (get_today_midnight_date() + datetime.timedelta(days=2)).strftime("%Y-%m-%d"),
             "end_date": (get_today_midnight_date() + datetime.timedelta(days=3)).strftime("%Y-%m-%d"),
diff --git a/smash/web/tests/test_email.py b/smash/web/tests/test_email.py
index 879acc7e3b4164b87d40d6c7cbc150f8c3ac9349..460d681334d5d405cb928b4f16ca15a54079af6f 100644
--- a/smash/web/tests/test_email.py
+++ b/smash/web/tests/test_email.py
@@ -3,7 +3,7 @@
 from django.core import mail
 from django.test import TestCase
 
-from web.email import EmailSender
+from web.smash_email import EmailSender
 
 
 class TestEmailSender(TestCase):
diff --git a/smash/web/tests/test_holidays.py b/smash/web/tests/test_holidays.py
new file mode 100644
index 0000000000000000000000000000000000000000..2bcfeac8ede5f9ca2a354dfb1936d2918d4feac8
--- /dev/null
+++ b/smash/web/tests/test_holidays.py
@@ -0,0 +1,39 @@
+from unittest import TestCase
+
+from web.management.commands.holidays import get_easter_sunday_date, get_ascension_day, get_pentecost_day
+
+
+class TestHolidays(TestCase):
+    def test_get_easter_sunday_date(self):
+        easter_sunday = get_easter_sunday_date(2010)
+        self.assertEqual(4, easter_sunday.month)
+        self.assertEqual(4, easter_sunday.day)
+        easter_sunday = get_easter_sunday_date(2017)
+        self.assertEqual(4, easter_sunday.month)
+        self.assertEqual(16, easter_sunday.day)
+
+    def test_get_ascension_day(self):
+        expected_values = [
+            (2018, 5, 10),
+            (2017, 5, 25),
+            (2016, 5, 5),
+            (2015, 5, 14),
+            (2014, 5, 29)
+        ]
+        for year, month, day in expected_values:
+            easter_sunday = get_easter_sunday_date(year)
+            ascension_day = get_ascension_day(easter_sunday)
+            self.assertEqual(month, ascension_day.month)
+            self.assertEqual(day, ascension_day.day)
+
+    def test_get_pentecost_day(self):
+        expected_values = [
+            (2018, 5, 21),
+            (2017, 6, 5),
+            (2016, 5, 16),
+        ]
+        for year, month, day in expected_values:
+            easter_sunday = get_easter_sunday_date(year)
+            pentecost_day = get_pentecost_day(easter_sunday)
+            self.assertEqual(month, pentecost_day.month)
+            self.assertEqual(day, pentecost_day.day)
diff --git a/smash/web/tests/test_model_mail_template.py b/smash/web/tests/test_model_mail_template.py
new file mode 100644
index 0000000000000000000000000000000000000000..0460314373a98c926c4dcabf9b725cf9949efd81
--- /dev/null
+++ b/smash/web/tests/test_model_mail_template.py
@@ -0,0 +1,125 @@
+import StringIO
+
+from django.test import TestCase
+from docx import Document
+
+from functions import create_language, get_resource_path, create_appointment, create_user, create_subject, \
+    create_visit
+from web.models import MailTemplate
+from web.models.constants import MAIL_TEMPLATE_CONTEXT_APPOINTMENT, MAIL_TEMPLATE_CONTEXT_VISIT, \
+    MAIL_TEMPLATE_CONTEXT_SUBJECT
+from web.models.mail_template import DATE_FORMAT_SHORT
+
+
+class MailTemplateModelTests(TestCase):
+    def setUp(self):
+        self.french_language = create_language("French", "fr_FR")
+        self.english_language = create_language("English", "en_GB")
+        self.template_file = get_resource_path('upcoming_appointment_FR.docx')
+        self.user = create_user()
+
+    def test_get_appointment_mail_templates(self):
+        context = MAIL_TEMPLATE_CONTEXT_APPOINTMENT
+        function_to_test = MailTemplate.get_appointment_mail_templates
+        self.check_get_mail_templates(context, function_to_test)
+
+    def test_get_visit_mail_templates(self):
+        context = MAIL_TEMPLATE_CONTEXT_VISIT
+        function_to_test = MailTemplate.get_visit_mail_templates
+        self.check_get_mail_templates(context, function_to_test)
+
+    def test_get_subject_mail_templates(self):
+        context = MAIL_TEMPLATE_CONTEXT_SUBJECT
+        function_to_test = MailTemplate.get_subject_mail_templates
+        self.check_get_mail_templates(context, function_to_test)
+
+    def check_get_mail_templates(self, context, function_to_test):
+        # create french template
+        template_name_french = "test_fr"
+        appointment_template_french = MailTemplate(name=template_name_french, language=self.french_language,
+                                                   context=context,
+                                                   template_file=self.template_file)
+        appointment_template_french.save()
+        # create english template
+        template_name_english = "test_en"
+        appointment_template_english = MailTemplate(name=template_name_english, language=self.english_language,
+                                                    context=context,
+                                                    template_file=self.template_file)
+        appointment_template_english.save()
+        active_templates, inactive_templates = function_to_test([self.french_language])
+        self.assertEqual(1, len(active_templates), "only on active template should be returned (for french)")
+        self.assertEqual(1, len(inactive_templates), "only on inactive template should be returned (for english)")
+        self.assertEqual(template_name_french, active_templates[0].name)
+        self.assertEqual(template_name_english, inactive_templates[0].name)
+        # now tries with multiple languages
+        active_templates, inactive_templates = function_to_test(
+            [self.english_language, self.french_language])
+        self.assertEqual(2, len(active_templates), "two active templates should be returned (for french and english)")
+        self.assertEqual(0, len(inactive_templates), "no inactive template should be returned")
+        # also checks the correct sorting
+        self.assertEqual(template_name_english, active_templates[0].name)
+        self.assertEqual(template_name_french, active_templates[1].name)
+
+        # tries with no languages
+        active_templates, inactive_templates = function_to_test([])
+        self.assertEqual(0, len(active_templates), "no active templates should be returned")
+        self.assertEqual(2, len(inactive_templates), "two inactive templates should be returned (french and english)")
+
+    def test_apply_appointment(self):
+        template_name_french = "test_fr"
+        appointment = create_appointment()
+        appointment_template_french = MailTemplate(name=template_name_french, language=self.french_language,
+                                                   context=MAIL_TEMPLATE_CONTEXT_APPOINTMENT,
+                                                   template_file=self.template_file)
+        stream = StringIO.StringIO()
+        appointment_template_french.apply(appointment, self.user, stream)
+        doc = Document(stream)
+        worker_name = str(self.user.worker)
+        location = appointment.location.name
+        self.check_doc_contains(doc, [worker_name, location])
+
+    def test_apply_subject(self):
+        template_name_french = "test_fr"
+        subject = create_subject()
+        subject_template_french = MailTemplate(name=template_name_french, language=self.french_language,
+                                               context=MAIL_TEMPLATE_CONTEXT_SUBJECT,
+                                               template_file=self.template_file)
+        stream = StringIO.StringIO()
+        subject_template_french.apply(subject, self.user, stream)
+        doc = Document(stream)
+        worker_name = str(self.user.worker)
+
+        self.check_doc_contains(doc, [worker_name, str(subject), subject.country, subject.nd_number,
+                                      subject.get_type_display()])
+
+    def test_apply_visit(self):
+        template_name_french = "test_fr"
+        visit = create_visit()
+        visit_template_french = MailTemplate(name=template_name_french, language=self.french_language,
+                                             context=MAIL_TEMPLATE_CONTEXT_VISIT,
+                                             template_file=self.template_file)
+        stream = StringIO.StringIO()
+        visit_template_french.apply(visit, self.user, stream)
+        doc = Document(stream)
+        worker_name = str(self.user.worker)
+
+        self.check_doc_contains(doc, [worker_name, str(visit.subject), visit.subject.country, visit.subject.nd_number,
+                                      visit.subject.get_type_display(),
+                                      visit.datetime_begin.strftime(DATE_FORMAT_SHORT),
+                                      visit.datetime_end.strftime(DATE_FORMAT_SHORT)])
+
+    def check_doc_contains(self, doc, needles):
+        founds = [False] * len(needles)
+        all_founds = False
+        count_found = 0
+        for paragraph in doc.paragraphs:
+            for i in range(0, len(needles)):
+                if not founds[i] and needles[i] in paragraph.text:
+                    founds[i] = True
+                    count_found += 1
+            if count_found == len(needles):
+                all_founds = True
+                break
+        if not all_founds:
+            for i in range(0, len(needles)):
+                self.assertTrue(founds[i], "{} was not found in the generated Word document".format(needles[i]))
diff --git a/smash/web/tests/test_process_file.py b/smash/web/tests/test_process_file.py
new file mode 100644
index 0000000000000000000000000000000000000000..413530a2a102ef9fbf36510de2f8c4eddcc6b79a
--- /dev/null
+++ b/smash/web/tests/test_process_file.py
@@ -0,0 +1,29 @@
+import datetime
+import locale
+import tempfile
+
+import os
+from django.test import TestCase
+
+from functions import get_resource_path
+from web.docx_helper import process_file
+
+
+class TestDocxProcessor(TestCase):
+    def test_process_file(self):
+        template_path = get_resource_path('template.docx')
+        locale.setlocale(locale.LC_TIME, "fr_FR")
+        output_path = tempfile.mktemp()
+        changes = {
+            "##SIR##": "Mr",
+            "##NAME##": "Jan",
+            "##SURNAME##": "Weglarz",
+            "##ADDRESS1##": "Piotrowo 23",
+            "##ADDRESS2##": "61-234, Poznan",
+            "##COUNTRY##": "POLAND",
+            "##CONTENT##": "1",
+            "##DATE##": datetime.datetime.now().date().strftime("%A %-d %B %Y"),
+        }
+        process_file(template_path, output_path, changes)
+        self.assertTrue(os.path.isfile(output_path))
+        os.remove(output_path)
diff --git a/smash/web/tests/test_statistics.py b/smash/web/tests/test_statistics.py
index b4302710970e9ee95ba81df297f26ed238f5a117..92e19cf5a8dbfe588ae20a1a311197617e392c2c 100644
--- a/smash/web/tests/test_statistics.py
+++ b/smash/web/tests/test_statistics.py
@@ -3,7 +3,7 @@ import datetime
 
 from django.test import TestCase
 
-from web.models import Visit
+from web.models import Visit, AppointmentTypeLink
 from web.statistics import get_previous_year_and_month_for_date, StatisticsManager
 from web.tests.functions import create_appointment, create_appointment_type
 from web.views.notifications import get_today_midnight_date
@@ -16,7 +16,7 @@ class TestStatistics(TestCase):
         self.now = get_today_midnight_date()
         self.appointment_type = create_appointment_type()
         appointment = create_appointment(when=self.now)
-        appointment.appointment_types = [self.appointment_type]
+        AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=self.appointment_type)
         self.visit_start = appointment.visit.datetime_begin
         self.visit_end = appointment.visit.datetime_end
         appointment.save()
@@ -57,13 +57,23 @@ class TestStatistics(TestCase):
         statistics = self.statistics_manager.get_statistics_for_month(self.now.month, self.now.year, subject_type="P")
         self.check_statistics(statistics, 0, 0, 0, {"C": [0, 0]}, ['Scheduled'])
 
+    def test_get_statistics_for_month_one_appointment_subject_type_and_visit(self):
+        statistics = self.statistics_manager.get_statistics_for_month(self.now.month, self.now.year, subject_type="C",
+                                                                      visit='1')
+        self.check_statistics(statistics, 0, 0, 1, {"C": [1, 1]}, ['Scheduled'])
+
+        statistics = self.statistics_manager.get_statistics_for_month(self.now.month, self.now.year, subject_type="P",
+                                                                      visit='1')
+        self.check_statistics(statistics, 0, 0, 0, {"C": [0, 0]}, ['Scheduled'])
+
     def test_get_statistics_for_month_multiple_visits(self):
         second_visit = Visit.objects.create(datetime_begin=self.now + datetime.timedelta(days=-32),
                                             datetime_end=self.now + datetime.timedelta(days=31),
                                             subject=self.subject,
                                             is_finished=False)
         second_appointment = create_appointment(second_visit, when=self.now)
-        second_appointment.appointment_types = [self.appointment_type]
+        AppointmentTypeLink.objects.create(appointment=second_appointment, appointment_type=self.appointment_type)
+
         second_appointment.status = "Cancelled"
         second_appointment.save()
         self.statistics_manager = StatisticsManager()
diff --git a/smash/web/tests/test_view_kit_request.py b/smash/web/tests/test_view_kit_request.py
index e2c69dbe384e40c15e8c61505cb7e03e71e07417..a5a8ad12718bdde423fd09cfad008d35bf05e592 100644
--- a/smash/web/tests/test_view_kit_request.py
+++ b/smash/web/tests/test_view_kit_request.py
@@ -4,7 +4,7 @@ from django.core import mail
 from django.urls import reverse
 
 from functions import create_appointment_type, create_appointment
-from web.models import Item, Appointment
+from web.models import Item, Appointment, AppointmentTypeLink
 from web.views.notifications import get_today_midnight_date
 from . import LoggedInTestCase
 
@@ -23,8 +23,9 @@ class ViewFunctionsTests(LoggedInTestCase):
 
         appointment = create_appointment()
         appointment.datetime_when = get_today_midnight_date() + datetime.timedelta(days=2)
-        appointment.appointment_types.add(appointment_type)
         appointment.save()
+        AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
+
 
         response = self.client.get(reverse('web.views.kit_requests'))
         self.assertEqual(response.status_code, 200)
@@ -40,9 +41,9 @@ class ViewFunctionsTests(LoggedInTestCase):
 
         appointment = create_appointment()
         appointment.datetime_when = get_today_midnight_date() + datetime.timedelta(days=2)
-        appointment.appointment_types.add(appointment_type)
         appointment.status = Appointment.APPOINTMENT_STATUS_CANCELLED
         appointment.save()
+        AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
 
         response = self.client.get(reverse('web.views.kit_requests'))
         self.assertEqual(response.status_code, 200)
@@ -58,8 +59,9 @@ class ViewFunctionsTests(LoggedInTestCase):
 
         appointment = create_appointment()
         appointment.datetime_when = get_today_midnight_date() + datetime.timedelta(days=2)
-        appointment.appointment_types.add(appointment_type)
         appointment.save()
+        AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
+
 
         response = self.client.get(reverse('web.views.kit_requests'))
         self.assertEqual(response.status_code, 200)
diff --git a/smash/web/tests/test_view_notifications.py b/smash/web/tests/test_view_notifications.py
index 9c47d92dbcd88f9ef30aaf78fb4ac8815b6a8535..1467a1699f5eb433ab9ca58fa7f7411b6644596e 100644
--- a/smash/web/tests/test_view_notifications.py
+++ b/smash/web/tests/test_view_notifications.py
@@ -5,7 +5,7 @@ from django.contrib.auth.models import AnonymousUser
 from functions import create_appointment, create_location, create_worker, create_appointment_type
 from functions import create_subject
 from functions import create_visit
-from web.models import Appointment, Location
+from web.models import Appointment, Location, AppointmentTypeLink
 from web.views.notifications import \
     get_approaching_visits_for_mail_contact, \
     get_approaching_visits_for_mail_contact_count, \
@@ -79,7 +79,7 @@ class NotificationViewTests(LoggedInTestCase):
         visit.save()
 
         appointment = create_appointment(visit)
-        appointment.appointment_types.add(appointment_type)
+        AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
         appointment.status = Appointment.APPOINTMENT_STATUS_FINISHED
         appointment.save()
 
@@ -400,7 +400,7 @@ class NotificationViewTests(LoggedInTestCase):
         original_without_visit_notification = get_subject_with_no_visit_notifications_count(self.user)
         original_notification = get_subjects_with_reminder_count(self.user)
         subject = create_subject()
-        subject.datetime_contact_reminder = get_today_midnight_date() + datetime.timedelta(hours=23)
+        subject.datetime_contact_reminder = get_today_midnight_date() + datetime.timedelta(hours=1)
         subject.save()
 
         notification = get_subjects_with_reminder_count(self.user)
diff --git a/smash/web/tests/test_view_subjects.py b/smash/web/tests/test_view_subjects.py
index 5ce3d247a2343b9a4dffcae29f3d8750c51e30a4..92444e1b6f7a388518429a2438ba558008b4419d 100644
--- a/smash/web/tests/test_view_subjects.py
+++ b/smash/web/tests/test_view_subjects.py
@@ -8,7 +8,7 @@ from django.urls import reverse
 from functions import create_subject, create_visit, create_appointment, create_worker, get_test_location
 from web.forms import SubjectAddForm, SubjectEditForm
 from web.models import Subject
-from web.models.constants import SEX_CHOICES_MALE, SUBJECT_TYPE_CHOICES_CONTROL
+from web.models.constants import SEX_CHOICES_MALE, SUBJECT_TYPE_CHOICES_CONTROL, SUBJECT_TYPE_CHOICES_PATIENT
 from web.views.notifications import get_today_midnight_date
 
 
@@ -24,15 +24,11 @@ class SubjectsViewTests(TestCase):
         self.client.login(username=username, password=password)
 
     def test_subjects_add(self):
-        self.worker.screening_number_prefix = "X"
         self.worker.save()
 
         response = self.client.get(reverse('web.views.subject_add'))
         self.assertEqual(response.status_code, 200)
 
-        # check if screening number prefix is there
-        self.assertTrue("value=\"X-\"" in response.content)
-
     def test_render_subject_edit(self):
         subject = create_subject()
 
@@ -66,8 +62,6 @@ class SubjectsViewTests(TestCase):
         self.assertTrue(updated_subject.resigned)
 
     def test_subjects_add_2(self):
-        self.worker.screening_number_prefix = "X"
-        self.worker.save()
 
         form = SubjectAddForm(user=self.user)
         form_data = {}
@@ -75,7 +69,6 @@ class SubjectsViewTests(TestCase):
             if value is not None:
                 form_data[key] = value
 
-        form_data["screening_number"] = "X-"
         form_data["country"] = "Luxembourg"
         form_data["first_name"] = "John"
         form_data["last_name"] = "Doe"
@@ -88,7 +81,57 @@ class SubjectsViewTests(TestCase):
         self.assertContains(response, "Subject created")
 
         subject = Subject.objects.all()[0]
-        self.assertEqual("X-001", subject.screening_number)
+        self.assertEqual("L-001", subject.screening_number,
+                         "prefix should start by L as default location prefix is not defined and subject type is control")
+
+    def test_subjects_add_patient(self):
+
+        form = SubjectAddForm(user=self.user)
+        form_data = {}
+        for key, value in form.initial.items():
+            if value is not None:
+                form_data[key] = value
+
+        form_data["country"] = "Luxembourg"
+        form_data["first_name"] = "John"
+        form_data["last_name"] = "Doe"
+        form_data["sex"] = SEX_CHOICES_MALE
+        form_data["type"] = SUBJECT_TYPE_CHOICES_PATIENT
+        form_data["default_location"] = get_test_location().id
+        response = self.client.post(reverse('web.views.subject_add'), data=form_data)
+        self.assertEqual(response.status_code, 302)
+        response = self.client.get(response.url)
+        self.assertContains(response, "Subject created")
+
+        subject = Subject.objects.all()[0]
+        self.assertEqual("P-001", subject.screening_number,
+                         "prefix should start by P as default location prefix is not defined and subject type is patient")
+
+    def test_subjects_add_with_prefixed_location(self):
+
+        form = SubjectAddForm(user=self.user)
+        form_data = {}
+        for key, value in form.initial.items():
+            if value is not None:
+                form_data[key] = value
+
+        form_data["country"] = "Luxembourg"
+        form_data["first_name"] = "John"
+        form_data["last_name"] = "Doe"
+        form_data["sex"] = SEX_CHOICES_MALE
+        form_data["type"] = SUBJECT_TYPE_CHOICES_PATIENT
+        location = get_test_location()
+        location.prefix = 'X'
+        location.save()
+        form_data["default_location"] = location.id
+        response = self.client.post(reverse('web.views.subject_add'), data=form_data)
+        self.assertEqual(response.status_code, 302)
+        response = self.client.get(response.url)
+        self.assertContains(response, "Subject created")
+
+        subject = Subject.objects.all()[0]
+        self.assertEqual("X-001", subject.screening_number,
+                         "prefix should start by X as default location prefix is equal to 'X'")
 
     def test_render_subjects(self):
         create_subject()
diff --git a/smash/web/urls.py b/smash/web/urls.py
index 83a16c80987041c894842f77b1427cf6420aeb34..137dd4f057f70f914fdcf71b684b27271fce9e15 100644
--- a/smash/web/urls.py
+++ b/smash/web/urls.py
@@ -16,6 +16,8 @@ Including another URLconf
 from django.conf import settings
 from django.conf.urls import include
 from django.conf.urls import url
+from django.contrib.auth.decorators import login_required
+from django.views.generic import TemplateView
 
 from web import views
 
@@ -68,7 +70,8 @@ urlpatterns = [
     #    CONTACTS      #
     ####################
 
-    url(r'^subjects/(?P<subject_id>\d+)/contacts/add$', views.contact_attempt.contact_add, name='web.views.contact_add'),
+    url(r'^subjects/(?P<subject_id>\d+)/contacts/add$', views.contact_attempt.contact_add,
+        name='web.views.contact_add'),
 
     ####################
     #     DOCTORS      #
@@ -100,7 +103,33 @@ urlpatterns = [
     #       MAIL       #
     ####################
 
-    url(r'^mail_templates$', views.mails.mail_templates, name='web.views.mail_templates'),
+    url(r'^mail_templates_old$', views.mails.mail_templates, name='web.views.mail_templates_old'),
+    url(r'^mail_templates$', views.mails.MailTemplatesListView.as_view(), name='web.views.mail_templates'),
+    url(r'^mail_templates/add$', views.mails.MailTemplatesCreateView.as_view(), name='web.views.mail_template_add'),
+    url(r'^mail_templates/(?P<pk>\d+)/delete$', views.mails.MailTemplatesDeleteView.as_view(),
+        name='web.views.mail_template_delete'),
+    url(r'^mail_templates/(?P<pk>\d+)/edit$', views.mails.MailTemplatesEditView.as_view(),
+        name='web.views.mail_template_edit'),
+    url(r'^mail_templates/(?P<mail_template_id>\d+)/generate/(?P<instance_id>\d+)$', views.mails.generate,
+        name="web.views.mail_template_generate"),
+
+    ####################
+    # DAILY PLANNING   #
+    ####################
+
+
+    url(r'^daily_planning$', login_required(TemplateView.as_view(template_name='daily_planning.html')), name='web.views.daily_planning'),
+
+    ####################
+    #     LANGUAGES    #
+    ####################
+
+    url(r'^languages$', views.language.LanguageListView.as_view(), name='web.views.languages'),
+    url(r'^languages/add$', views.language.LanguageCreateView.as_view(), name='web.views.language_add'),
+    url(r'^languages/(?P<pk>\d+)/delete$', views.language.LanguageDeleteView.as_view(),
+        name='web.views.language_delete'),
+    url(r'^languages/(?P<pk>\d+)/edit$', views.language.LanguageEditView.as_view(),
+        name='web.views.language_edit'),
 
     ####################
     #    STATISTICS    #
diff --git a/smash/web/views/__init__.py b/smash/web/views/__init__.py
index e78ca58cbcfbf9adab1177766bbcedea96fd51ca..4322cb370c651c5e613bf6f708f68a559aa7c315 100644
--- a/smash/web/views/__init__.py
+++ b/smash/web/views/__init__.py
@@ -2,6 +2,7 @@
 
 from django.contrib.auth.decorators import login_required
 from django.shortcuts import redirect, render
+from django.views.generic.base import ContextMixin
 
 from notifications import get_notifications
 from ..models import Worker
@@ -36,18 +37,26 @@ def e400_bad_request(request, context=None):
 
 @login_required
 def wrap_response(request, template, params):
-    person, role = Worker.get_details(request.user)
+    final_params = extend_context(params, request)
+    return render(request, template, final_params)
 
-    notifications = get_notifications(request.user)
 
+def extend_context(params, request):
+    person, role = Worker.get_details(request.user)
+    notifications = get_notifications(request.user)
     final_params = params.copy()
     final_params.update({
         'person': person,
         'role': role,
         'notifications': notifications
     })
+    return final_params
 
-    return render(request, template, final_params)
+
+class WrappedView(ContextMixin):
+    def get_context_data(self, **kwargs):
+        context = super(WrappedView, self).get_context_data(**kwargs)
+        return extend_context(context, self.request)
 
 
 import auth
@@ -62,3 +71,4 @@ import statistics
 import export
 import contact_attempt
 import configuration_item
+import language
diff --git a/smash/web/views/appointment.py b/smash/web/views/appointment.py
index 760b83884517ec462f60df31e0dc51ed17bf9b41..7516755a6c32e0a36c8d03cc32e71f71b483207d 100644
--- a/smash/web/views/appointment.py
+++ b/smash/web/views/appointment.py
@@ -1,9 +1,10 @@
 # coding=utf-8
+from django.contrib import messages
 from django.shortcuts import get_object_or_404, redirect
 
 from . import wrap_response
 from ..forms import AppointmentDetailForm, AppointmentAddForm, AppointmentEditForm, SubjectEditForm
-from ..models import Appointment, Subject
+from ..models import Appointment, Subject, MailTemplate
 
 APPOINTMENT_LIST_GENERIC = "GENERIC"
 APPOINTMENT_LIST_UNFINISHED = "UNFINISHED"
@@ -81,19 +82,29 @@ def appointment_edit(request, id):
                 subject.information_sent = True
                 subject.save()
 
-            if (the_appointment.status != Appointment.APPOINTMENT_STATUS_SCHEDULED) and (
-                        the_appointment.visit is not None):
+            messages.success(request, "Modifications saved")
+            if '_continue' in request.POST:
+                return redirect('web.views.appointment_edit', id=the_appointment.id)
+            if 'from_visit' in request.GET:
                 return redirect('web.views.visit_details', id=the_appointment.visit.id)
             else:
                 return redirect('web.views.appointments')
     else:
         appointment_form = AppointmentEditForm(instance=the_appointment, user=request.user, prefix="appointment")
+
         if the_appointment.visit is not None:
             subject_form = SubjectEditForm(instance=the_appointment.visit.subject, prefix="subject")
 
+    languages = []
+    if the_appointment.visit is not None:
+        subject = the_appointment.visit.subject
+        if subject.default_written_communication_language:
+            languages.append(subject.default_written_communication_language)
+        languages.extend(subject.languages.all())
     return wrap_response(request, 'appointments/edit.html', {
         'form': appointment_form,
         'subject_form': subject_form,
         'id': id,
-        'appointment': the_appointment
+        'appointment': the_appointment,
+        'mail_templates': MailTemplate.get_appointment_mail_templates(languages)
     })
diff --git a/smash/web/views/language.py b/smash/web/views/language.py
new file mode 100644
index 0000000000000000000000000000000000000000..463210b74ece287296f76634dd29a4a41e8d4df9
--- /dev/null
+++ b/smash/web/views/language.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+from django.contrib import messages
+from django.urls import reverse_lazy
+from django.views.generic import CreateView
+from django.views.generic import DeleteView
+from django.views.generic import ListView
+from django.views.generic import UpdateView
+
+from . import WrappedView
+from ..models import Language
+
+
+class LanguageListView(ListView, WrappedView):
+    model = Language
+    context_object_name = "languages"
+    template_name = 'languages/list.html'
+
+
+class LanguageCreateView(CreateView, WrappedView):
+    model = Language
+    template_name = "languages/add.html"
+    fields = '__all__'
+    success_url = reverse_lazy('web.views.languages')
+    success_message = "Template created"
+
+
+class LanguageDeleteView(DeleteView, WrappedView):
+    model = Language
+    success_url = reverse_lazy('web.views.languages')
+    template_name = 'languages/confirm_delete.html'
+
+    def delete(self, request, *args, **kwargs):
+        messages.success(request, "Template deleted")
+        return super(LanguageDeleteView, self).delete(request, *args, **kwargs)
+
+
+class LanguageEditView(UpdateView, WrappedView):
+    model = Language
+    success_url = reverse_lazy('web.views.languages')
+    fields = '__all__'
+    success_message = "Template edited"
+    template_name = "languages/edit.html"
+    context_object_name = "language"
+
+
+def generate(request, mail_template_id, instance_id):
+    return None
diff --git a/smash/web/views/mails.py b/smash/web/views/mails.py
index 041daa092e41c729c55e0d0262d1f4e5352191d4..abe5d7f79cf1d12b087d2da1c5b66a9314f4ee1b 100644
--- a/smash/web/views/mails.py
+++ b/smash/web/views/mails.py
@@ -1,6 +1,86 @@
 # coding=utf-8
-from . import wrap_response
+import StringIO
+from wsgiref.util import FileWrapper
+
+from django.contrib import messages
+from django.contrib.auth.decorators import login_required
+from django.http import HttpResponse
+from django.shortcuts import get_object_or_404
+from django.urls import reverse_lazy
+from django.views.generic import CreateView
+from django.views.generic import DeleteView
+from django.views.generic import ListView
+from django.views.generic import UpdateView
+
+from . import wrap_response, WrappedView
+from ..models import Subject, Visit, Appointment, MailTemplate
+from ..models.constants import MAIL_TEMPLATE_CONTEXT_SUBJECT, MAIL_TEMPLATE_CONTEXT_VISIT, \
+    MAIL_TEMPLATE_CONTEXT_APPOINTMENT
+
+MIMETYPE_DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
+
+CONTEXT_TYPES_MAPPING = {
+    MAIL_TEMPLATE_CONTEXT_SUBJECT: Subject,
+    MAIL_TEMPLATE_CONTEXT_VISIT: Visit,
+    MAIL_TEMPLATE_CONTEXT_APPOINTMENT: Appointment
+}
 
 
 def mail_templates(request):
     return wrap_response(request, "mail_templates/index.html", {})
+
+
+class MailTemplatesListView(ListView, WrappedView):
+    model = MailTemplate
+    context_object_name = "mail_templates"
+    template_name = 'mail_templates/list.html'
+
+    def get_context_data(self, **kwargs):
+        context = super(MailTemplatesListView, self).get_context_data()
+        context['explanations'] = {"generic": MailTemplate.MAILS_TEMPLATE_GENERIC_TAGS,
+                                   "subject": MailTemplate.MAILS_TEMPLATE_SUBJECT_TAGS,
+                                   "visit": MailTemplate.MAILS_TEMPLATE_VISIT_TAGS,
+                                   "appointment": MailTemplate.MAILS_TEMPLATE_APPOINTMENT_TAGS,
+                                   }
+        return context
+
+
+class MailTemplatesCreateView(CreateView, WrappedView):
+    model = MailTemplate
+    template_name = "mail_templates/add.html"
+    fields = '__all__'
+    success_url = reverse_lazy('web.views.mail_templates')
+    success_message = "Template created"
+
+
+class MailTemplatesDeleteView(DeleteView, WrappedView):
+    model = MailTemplate
+    success_url = reverse_lazy('web.views.mail_templates')
+    template_name = 'mail_templates/confirm_delete.html'
+
+    def delete(self, request, *args, **kwargs):
+        messages.success(request, "Template deleted")
+        return super(MailTemplatesDeleteView, self).delete(request, *args, **kwargs)
+
+
+class MailTemplatesEditView(UpdateView, WrappedView):
+    model = MailTemplate
+    success_url = reverse_lazy('web.views.mail_templates')
+    fields = '__all__'
+    success_message = "Template edited"
+    template_name = "mail_templates/edit.html"
+    context_object_name = "mail_template"
+
+
+@login_required
+def generate(request, mail_template_id, instance_id):
+    mail_template = get_object_or_404(MailTemplate, id=mail_template_id)
+    instance = get_object_or_404(CONTEXT_TYPES_MAPPING[mail_template.context], id=instance_id)
+    stream = StringIO.StringIO()
+    stream = mail_template.apply(instance, request.user, stream)
+    file_size = stream.tell()
+    stream.seek(0)
+    response = HttpResponse(FileWrapper(stream), content_type=MIMETYPE_DOCX)
+    response['Content-Length'] = file_size
+    response['Content-Disposition'] = 'attachment; filename={}.docx'.format(mail_template.name)
+    return response
diff --git a/smash/web/views/notifications.py b/smash/web/views/notifications.py
index 31f749d8f8997c25ada97ffa4f2043b059f2ce21..0f7d4e666a919281fd4845c2f5bc704eb38bf519 100644
--- a/smash/web/views/notifications.py
+++ b/smash/web/views/notifications.py
@@ -123,7 +123,7 @@ def get_subjects_with_no_visit(user):
 
 
 def get_subjects_with_reminder(user):
-    tomorrow = get_today_midnight_date() + datetime.timedelta(days=1)
+    tomorrow = datetime.datetime.now() + datetime.timedelta(hours=1)
 
     result = Subject.objects.filter(
         dead=False,
diff --git a/smash/web/views/subject.py b/smash/web/views/subject.py
index 06615727752569a3978646cd48cea3dab812625f..494dca018c55a4248bec3d23d56c42570846b958 100644
--- a/smash/web/views/subject.py
+++ b/smash/web/views/subject.py
@@ -2,18 +2,19 @@
 from django.contrib import messages
 from django.shortcuts import redirect, get_object_or_404
 
-from notifications import get_subjects_with_no_visit, get_subjects_with_reminder
 from . import wrap_response
-from ..forms import SubjectAddForm, SubjectEditForm, VisitDetailForm, get_prefix_screening_number
-from ..models import Subject, Worker
+from ..forms import SubjectAddForm, SubjectEditForm, VisitDetailForm
+from ..models import Subject, MailTemplate, Worker
 
 SUBJECT_LIST_GENERIC = "GENERIC"
 SUBJECT_LIST_NO_VISIT = "NO_VISIT"
 SUBJECT_LIST_REQUIRE_CONTACT = "REQUIRE_CONTACT"
 
+
 def subjects(request):
     context = {
         'list_type': SUBJECT_LIST_GENERIC,
+        'worker': Worker.get_by_user(request.user)
     }
     return wrap_response(request, 'subjects/index.html', context)
 
@@ -26,8 +27,7 @@ def subject_add(request):
             messages.add_message(request, messages.SUCCESS, 'Subject created')
             return redirect('web.views.subject_edit', id=form.instance.id)
     else:
-        worker = Worker.get_by_user(request.user)
-        form = SubjectAddForm(user=request.user, initial={'screening_number': get_prefix_screening_number(worker)})
+        form = SubjectAddForm(user=request.user)
 
     return wrap_response(request, 'subjects/add.html', {'form': form})
 
@@ -61,14 +61,23 @@ def subject_edit(request, id):
                 the_subject.mark_as_dead()
             if form.cleaned_data['resigned'] and not was_resigned:
                 the_subject.mark_as_resigned()
+            messages.success(request, "Modifications saved")
+            if '_continue' in request.POST:
+                return redirect('web.views.subject_edit', id=the_subject.id)
             return redirect('web.views.subjects')
     else:
         form = SubjectEditForm(instance=the_subject, was_dead=was_dead, was_resigned=was_resigned)
 
+    languages = []
+    if the_subject.default_written_communication_language:
+        languages.append(the_subject.default_written_communication_language)
+    languages.extend(the_subject.languages.all())
+
     return wrap_response(request, 'subjects/edit.html', {
         'form': form,
         'subject': the_subject,
-        'contact_attempts': contact_attempts
+        'contact_attempts': contact_attempts,
+        'mail_templates': MailTemplate.get_subject_mail_templates(languages)
     })
 
 
diff --git a/smash/web/views/visit.py b/smash/web/views/visit.py
index 4d2319cdd31642359eeb2a5fbc29189845fe9722..b4f11304a30f1d2417424c1779f98ff5682bac45 100644
--- a/smash/web/views/visit.py
+++ b/smash/web/views/visit.py
@@ -6,7 +6,7 @@ from notifications import get_active_visits_with_missing_appointments, get_unfin
     waiting_for_appointment
 from . import wrap_response
 from ..forms import VisitDetailForm, SubjectDetailForm, VisitAddForm
-from ..models import Visit, Appointment, Subject
+from ..models import Visit, Appointment, Subject, MailTemplate
 
 
 def visits(request):
@@ -61,6 +61,10 @@ def visit_details(request, id):
             can_finish = False
 
     subject_form = SubjectDetailForm(instance=displayed_subject)
+    languages = []
+    if displayed_subject.default_written_communication_language:
+        languages.append(displayed_subject.default_written_communication_language)
+    languages.extend(displayed_subject.languages.all())
 
     return wrap_response(request, 'visits/details.html', {
         'vform': visit_form,
@@ -69,7 +73,8 @@ def visit_details(request, id):
         'visFinished': visit_finished,
         'canFinish': can_finish,
         'vid': visit_id,
-        'visit': displayed_visit})
+        'visit': displayed_visit,
+        'mail_templates': MailTemplate.get_visit_mail_templates(languages)})
 
 
 def visit_mark(request, id, as_what):