From f2cedfa84aa08ba86a46858d09f2473d43355634 Mon Sep 17 00:00:00 2001 From: Miguel Marcos Date: Tue, 24 Jul 2018 15:57:08 +0200 Subject: [PATCH 01/13] Starte work on sortable inlines --- .gitattributes | 1 + arctic/generics.py | 4 +- arctic/mixins.py | 78 +++++++++---------- .../templates/arctic/base_create_update.html | 4 +- .../arctic/partials/form_fields_inline.html | 3 +- arctic/templatetags/arctic_tags.py | 7 +- example/articles/inlines.py | 1 + 7 files changed, 54 insertions(+), 44 deletions(-) diff --git a/.gitattributes b/.gitattributes index a6702dc9..1ab02290 100755 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,4 @@ *.svg binary arctic/static/arctic/dist/** binary arctic/static/arctic/dist/** linguist-vendored +CHANGELOG.md merge=union diff --git a/arctic/generics.py b/arctic/generics.py index 8da0b477..7b052693 100755 --- a/arctic/generics.py +++ b/arctic/generics.py @@ -117,7 +117,9 @@ def get_breadcrumbs(self): breadcrumb[1]).has_permission(self.request.user): continue - url = None if not breadcrumb[1] else reverse(breadcrumb[1]) + obj = self if not hasattr(self, 'object') else self.object + url = None if not breadcrumb[1] else reverse_url(breadcrumb[1], + obj) allowed_breadcrumbs.append({'name': breadcrumb[0], 'url': url}) return allowed_breadcrumbs diff --git a/arctic/mixins.py b/arctic/mixins.py index 75627aa2..0e76e158 100755 --- a/arctic/mixins.py +++ b/arctic/mixins.py @@ -108,7 +108,6 @@ class FormMixin(ModalMixin): """ use_widget_overloads = True layout = None - _fields = [] actions = None # Optional links such as list of linked items links = None readonly_fields = None @@ -204,56 +203,53 @@ def get_actions(self): # noqa: C901 allowed_actions.append(default_action) return allowed_actions - def get_layout(self): - if not self.layout: + def get_layout(self, inline_layout=None, fields=None): + layout = inline_layout or self.layout + if not layout: return None - self._get_fields() + if not inline_layout: + fields = [field for field in self.get_form().fields] + if not fields: + return None allowed_rows = OrderedDict() - i = 0 - py36_version = 50725104 # integer that represents python 3.6.0 - if (type(self.layout) is OrderedDict) or \ - (((type(self.layout) is dict) and sys.hexversion >= py36_version)): - for fieldset, rows in self.layout.items(): + py36_version = 0x30600f0 # hex number that represents python 3.6.0 + if (type(layout) is OrderedDict) or \ + ((type(layout) is dict) and sys.hexversion >= py36_version): + for i, (fieldset, rows) in enumerate(layout.items()): fieldset = self._return_fieldset(fieldset) - if isinstance(rows, six.string_types) or \ - isinstance(rows, six.text_type): + if isinstance(rows, six.string_types): allowed_rows.update({i: {'fieldset': fieldset, 'rows': rows}}) else: - row = self._process_first_level(rows) + row = self._process_first_level(rows, fields) allowed_rows.update({i: {'fieldset': fieldset, 'rows': row}}) - i += 1 - elif type(self.layout) in (list, tuple): - row = self._process_first_level(self.layout) + elif type(layout) in (list, tuple): + row = self._process_first_level(layout) fieldset = self._return_fieldset(0) allowed_rows.update({i: {'fieldset': fieldset, 'rows': row}}) else: - raise ImproperlyConfigured('LayoutMixin expects a list/tuple or ' + raise ImproperlyConfigured('`layout` should be a list, tuple or ' 'a dict (OrderedDict if python < 3.6)') - return allowed_rows - def _get_fields(self): - self._fields = [field for field in self.get_form().fields] - - def _process_first_level(self, rows): + def _process_first_level(self, rows, fields): allowed_rows = [] for row in rows: if isinstance(row, six.string_types) or \ isinstance(row, six.text_type): - allowed_rows.append(self._return_field(row)) + allowed_rows.append(self._return_field(row, fields)) elif type(row) in (list, tuple): - rows = self._process_row(row) + rows = self._process_row(row, fields) allowed_rows.append(rows) return allowed_rows - def _process_row(self, row): + def _process_row(self, row, fields): has_column = {} has_no_column = {} sum_existing_column = 0 @@ -267,7 +263,7 @@ def _process_row(self, row): isinstance(field, six.text_type): name, column = self._split_str(field) if column: - has_column[index] = self._return_field(field) + has_column[index] = self._return_field(field, fields) sum_existing_column += int(column) else: has_no_column[index] = field @@ -276,7 +272,7 @@ def _process_row(self, row): sum_existing_column) has_no_column = self._set_has_no_columns(has_no_column, col_avg, - col_last) + col_last, fields) # Merge it all back together to a dict, to preserve the order for index, field in enumerate(row): @@ -290,7 +286,7 @@ def _process_row(self, row): return rows_to_list - def _set_has_no_columns(self, has_no_column, col_avg, col_last): + def _set_has_no_columns(self, has_no_column, col_avg, col_last, fields): """ Regenerate has_no_column by adding the amount of columns at the end """ @@ -298,11 +294,11 @@ def _set_has_no_columns(self, has_no_column, col_avg, col_last): if index == len(has_no_column): field_name = '{field}|{col_last}'.format(field=field, col_last=col_last) - has_no_column[index] = self._return_field(field_name) + has_no_column[index] = self._return_field(field_name, fields) else: field_name = '{field}|{col_avg}'.format(field=field, col_avg=col_avg) - has_no_column[index] = self._return_field(field_name) + has_no_column[index] = self._return_field(field_name, fields) return has_no_column def _return_fieldset(self, fieldset): @@ -374,9 +370,9 @@ def _split_str(self, field): elif len(field_items) == 1: return field_items[0], None - def _return_field(self, field): + def _return_field(self, field, fields): field_name, field_class = self._split_str(field) - if field_name in self._fields: + if field_name in fields: return { 'name': field_name, 'column': field_class, @@ -461,18 +457,20 @@ def get_form(self, form_class=None): def get_context_data(self, **kwargs): context = super(FormMixin, self).get_context_data(**kwargs) +# for v in vars(context['inlines'][0]): +# print (v) +# print (context['inlines'][0].form_kwargs) try: - i = 0 - for formset in context['inlines']: - j = 0 - if not hasattr(context['inlines'][i], 'verbose_name'): - setattr(context['inlines'][i], 'verbose_name', - formset.model._meta.verbose_name_plural) - for form in formset: + for i, formset in enumerate(context['inlines']): + try: + verbose_name = self.inlines[i].verbose_name + except AttributeError: + verbose_name = formset.model._meta.verbose_name_plural + setattr(context['inlines'][i], 'verbose_name', verbose_name) + + for j, form in enumerate(formset): context['inlines'][i][j].fields = \ self.update_form_fields(form).fields - j += 1 - i += 1 except KeyError: pass return context diff --git a/arctic/templates/arctic/base_create_update.html b/arctic/templates/arctic/base_create_update.html index e00398cc..8b3952a8 100755 --- a/arctic/templates/arctic/base_create_update.html +++ b/arctic/templates/arctic/base_create_update.html @@ -40,14 +40,16 @@
{{ formset.verbose_name }}
{% endblock %} {{ formset.management_form }} {{ formset.non_form_errors }} +
{% for form in formset %} {% block inlines_form_fields %} - {% include "arctic/partials/form_fields_inline.html" with form=form %} + {% include "arctic/partials/form_fields_inline.html" with form=form hide_form=forloop.last %} {% endblock %} {% if not forloop.last %}

{% endif %} {% endfor %} +
{% endfor %} {% endif %} {% endblock inlines %} diff --git a/arctic/templates/arctic/partials/form_fields_inline.html b/arctic/templates/arctic/partials/form_fields_inline.html index 1076a428..2e739361 100644 --- a/arctic/templates/arctic/partials/form_fields_inline.html +++ b/arctic/templates/arctic/partials/form_fields_inline.html @@ -1,4 +1,5 @@ -
+
+layout = {{ form.layout }} {% for field in form %} {% if field.is_hidden %} {{ field }} diff --git a/arctic/templatetags/arctic_tags.py b/arctic/templatetags/arctic_tags.py index 583c07d9..2fa6542d 100755 --- a/arctic/templatetags/arctic_tags.py +++ b/arctic/templatetags/arctic_tags.py @@ -233,6 +233,11 @@ def get_item(dictionary, key): return dictionary.get(key) -@register.filter() +@register.filter def get_attr(obj, item, default=None): return getattr(obj, item, default) + + +@register.filter +def replace(s, old, new): + return s.replace(old, new) diff --git a/example/articles/inlines.py b/example/articles/inlines.py index dd3da38e..0ea346f3 100644 --- a/example/articles/inlines.py +++ b/example/articles/inlines.py @@ -17,3 +17,4 @@ class TagsInline(InlineFormSet): class ImagesInline(InlineFormSet): model = Image fields = "__all__" + layout = {'blah': 'bah'} From 107fbaa99a23b5bed054fbd69da9834796d8c385 Mon Sep 17 00:00:00 2001 From: David-Esteves Date: Fri, 10 Aug 2018 10:31:20 +0200 Subject: [PATCH 02/13] Feature/inmodal tweak (#308) * added is_modal to context * small fix * removed print * Allow for iframe url to have parameters * removed extra row class * - listview: fix for getting reverse exception for links to related objects that are None. - listview: make it compatible to annotate (group by) * Build blocks * flake 8 fix --- CHANGELOG.md | 8 ++++ arctic/generics.py | 18 ++++++-- arctic/static/arctic/dist/assets/js/app.js | 2 +- .../arctic/src/assets/js/components/modal.js | 15 +++++-- .../templates/arctic/base_create_update.html | 6 +-- arctic/templates/arctic/base_list.html | 2 +- .../templates/arctic/partials/form_field.html | 41 ++++++++++--------- .../arctic/partials/form_fields.html | 2 +- .../arctic/partials/form_fields_inline.html | 2 +- 9 files changed, 62 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index becd2530..fb155278 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). Always reference the ticket number at the end of the issue description. +## 1.3.3 + +- fix bug with iframe view containing params +- add variable in_modal to context +- listview: fix for getting reverse exception for links + to related objects that are None. +- listview: make it compatible to annotate (group by) + ## 1.3.2 (2018-07-24) diff --git a/arctic/generics.py b/arctic/generics.py index 8da0b477..88bc88d9 100755 --- a/arctic/generics.py +++ b/arctic/generics.py @@ -56,6 +56,7 @@ class View(RoleAuthentication, base.View): requires_login = True urls = {} form_display = None + in_modal = False def dispatch(self, request, *args, **kwargs): """ @@ -99,6 +100,7 @@ def get_context_data(self, **kwargs): context['LOGOUT_URL'] = self.get_logout_url() context['media'] = self.media context['form_display'] = self.get_form_display() + context['in_modal'] = self.request.GET.get('inmodal', False) return context def get_breadcrumbs(self): @@ -423,7 +425,7 @@ def get_list_items(self, objects): # noqa: C901 for obj in objects: field_classes = self.get_field_classes(obj) row = { - 'id': getattr(obj, self.primary_key), # for row data id attr + 'id': self.get_primary_value(obj), # for row data id attr 'fields': [], 'actions': [], 'sorting_field': None @@ -445,7 +447,10 @@ def get_list_items(self, objects): # noqa: C901 if len(embeded_list) > self.max_embeded_list_items: embeded_list = embeded_list[:-1] + ['...'] field['value'] = embeded_list - if field_name in field_links.keys(): + # don't try to find url for value that + # is None for related objects. + if (field_name in field_links.keys() and + field['value'] is not None): field['url'] = self.in_modal(reverse_url( field_links[field_name], obj, self.primary_key)) field['modal'] = self.get_modal_link( @@ -460,7 +465,7 @@ def get_list_items(self, objects): # noqa: C901 if self.sorting_field: row['sorting_field'] = { 'type': 'sorting', - 'id': getattr(obj, self.primary_key), + 'id': self.get_primary_value(obj), 'value': getattr(obj, self.sorting_field) } items.append(row) @@ -483,6 +488,13 @@ def get_field_value(self, field_name, obj): # finally get field's value return find_attribute(obj, field_name) + def get_primary_value(self, obj): + # while using annotate (group by) the object is a dict + if type(obj) == dict: + return obj.get(self.primary_key) + + return getattr(obj, self.primary_key) + def get_prefix(self): return self.prefix + '-' if self.prefix else '' diff --git a/arctic/static/arctic/dist/assets/js/app.js b/arctic/static/arctic/dist/assets/js/app.js index 8c48106d..ab904b8b 100644 --- a/arctic/static/arctic/dist/assets/js/app.js +++ b/arctic/static/arctic/dist/assets/js/app.js @@ -1 +1 @@ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(x,e){"use strict";var t=[],D=x.document,i=Object.getPrototypeOf,a=t.slice,g=t.concat,l=t.push,r=t.indexOf,n={},o=n.toString,m=n.hasOwnProperty,s=m.toString,c=s.call(Object),v={},y=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},b=function(e){return null!=e&&e===e.window},u={type:!0,src:!0,noModule:!0};function _(e,t,n){var i,r=(t=t||D).createElement("script");if(r.text=e,n)for(i in u)n[i]&&(r[i]=n[i]);t.head.appendChild(r).parentNode.removeChild(r)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var T=function(e,t){return new T.fn.init(e,t)},d=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function h(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!y(e)&&!b(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+P+")"+P+"*"),z=new RegExp("="+P+"*([^\\]'\"]*?)"+P+"*\\]","g"),U=new RegExp(L),V=new RegExp("^"+H+"$"),Y={ID:new RegExp("^#("+H+")"),CLASS:new RegExp("^\\.("+H+")"),TAG:new RegExp("^("+H+"|[*])"),ATTR:new RegExp("^"+j),PSEUDO:new RegExp("^"+L),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:new RegExp("^(?:"+F+")$","i"),needsContext:new RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,X=/^[^{]+\{\s*\[native \w/,G=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,J=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),ee=function(e,t,n){var i="0x"+t-65536;return i!=i||n?t:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ie=function(){C()},re=ye(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{N.apply(t=$.call(y.childNodes),y.childNodes),t[y.childNodes.length].nodeType}catch(n){N={apply:t.length?function(e,t){A.apply(e,$.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}function oe(e,t,n,i){var r,o,s,a,l,c,u,d=t&&t.ownerDocument,h=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==h&&9!==h&&11!==h)return n;if(!i&&((t?t.ownerDocument||t:y)!==x&&C(t),t=t||x,D)){if(11!==h&&(l=G.exec(e)))if(r=l[1]){if(9===h){if(!(s=t.getElementById(r)))return n;if(s.id===r)return n.push(s),n}else if(d&&(s=d.getElementById(r))&&v(t,s)&&s.id===r)return n.push(s),n}else{if(l[2])return N.apply(n,t.getElementsByTagName(e)),n;if((r=l[3])&&f.getElementsByClassName&&t.getElementsByClassName)return N.apply(n,t.getElementsByClassName(r)),n}if(f.qsa&&!E[e+" "]&&(!m||!m.test(e))){if(1!==h)d=t,u=e;else if("object"!==t.nodeName.toLowerCase()){for((a=t.getAttribute("id"))?a=a.replace(te,ne):t.setAttribute("id",a=T),o=(c=p(e)).length;o--;)c[o]="#"+a+" "+ve(c[o]);u=c.join(","),d=J.test(e)&&ge(t.parentNode)||t}if(u)try{return N.apply(n,d.querySelectorAll(u)),n}catch(e){}finally{a===T&&t.removeAttribute("id")}}}return g(e.replace(B,"$1"),t,n,i)}function se(){var i=[];return function e(t,n){return i.push(t+" ")>_.cacheLength&&delete e[i.shift()],e[t+" "]=n}}function ae(e){return e[T]=!0,e}function le(e){var t=x.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ce(e,t){for(var n=e.split("|"),i=n.length;i--;)_.attrHandle[n[i]]=t}function ue(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function fe(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&re(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function pe(s){return ae(function(o){return o=+o,ae(function(e,t){for(var n,i=s([],e.length,o),r=i.length;r--;)e[n=i[r]]&&(e[n]=!(t[n]=e[n]))})})}function ge(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in f=oe.support={},r=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},C=oe.setDocument=function(e){var t,n,i=e?e.ownerDocument||e:y;return i!==x&&9===i.nodeType&&i.documentElement&&(s=(x=i).documentElement,D=!r(x),y!==x&&(n=x.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",ie,!1):n.attachEvent&&n.attachEvent("onunload",ie)),f.attributes=le(function(e){return e.className="i",!e.getAttribute("className")}),f.getElementsByTagName=le(function(e){return e.appendChild(x.createComment("")),!e.getElementsByTagName("*").length}),f.getElementsByClassName=X.test(x.getElementsByClassName),f.getById=le(function(e){return s.appendChild(e).id=T,!x.getElementsByName||!x.getElementsByName(T).length}),f.getById?(_.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},_.find.ID=function(e,t){if(void 0!==t.getElementById&&D){var n=t.getElementById(e);return n?[n]:[]}}):(_.filter.ID=function(e){var n=e.replace(Z,ee);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},_.find.ID=function(e,t){if(void 0!==t.getElementById&&D){var n,i,r,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(r=t.getElementsByName(e),i=0;o=r[i++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),_.find.TAG=f.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):f.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,i=[],r=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},_.find.CLASS=f.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&D)return t.getElementsByClassName(e)},a=[],m=[],(f.qsa=X.test(x.querySelectorAll))&&(le(function(e){s.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+P+"*(?:value|"+F+")"),e.querySelectorAll("[id~="+T+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+T+"+*").length||m.push(".#.+[+~]")}),le(function(e){e.innerHTML="";var t=x.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+P+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),s.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")})),(f.matchesSelector=X.test(u=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.oMatchesSelector||s.msMatchesSelector))&&le(function(e){f.disconnectedMatch=u.call(e,"*"),u.call(e,"[s!='']:x"),a.push("!=",L)}),m=m.length&&new RegExp(m.join("|")),a=a.length&&new RegExp(a.join("|")),t=X.test(s.compareDocumentPosition),v=t||X.test(s.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},S=t?function(e,t){if(e===t)return c=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!f.sortDetached&&t.compareDocumentPosition(e)===n?e===x||e.ownerDocument===y&&v(y,e)?-1:t===x||t.ownerDocument===y&&v(y,t)?1:l?M(l,e)-M(l,t):0:4&n?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,i=0,r=e.parentNode,o=t.parentNode,s=[e],a=[t];if(!r||!o)return e===x?-1:t===x?1:r?-1:o?1:l?M(l,e)-M(l,t):0;if(r===o)return ue(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)a.unshift(n);for(;s[i]===a[i];)i++;return i?ue(s[i],a[i]):s[i]===y?-1:a[i]===y?1:0}),x},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==x&&C(e),t=t.replace(z,"='$1']"),f.matchesSelector&&D&&!E[t+" "]&&(!a||!a.test(t))&&(!m||!m.test(t)))try{var n=u.call(e,t);if(n||f.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Y.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&U.test(n)&&(t=p(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=h[e+" "];return t||(t=new RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&h(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,i,r){return function(e){var t=oe.attr(e,n);return null==t?"!="===i:!i||(t+="","="===i?t===r:"!="===i?t!==r:"^="===i?r&&0===t.indexOf(r):"*="===i?r&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function O(e,n,i){return y(n)?T.grep(e,function(e,t){return!!n.call(e,t,e)!==i}):n.nodeType?T.grep(e,function(e){return e===n!==i}):"string"!=typeof n?T.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(T.fn.init=function(e,t,n){var i,r;if(!e)return this;if(n=n||I,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:A.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof T?t[0]:t,T.merge(this,T.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:D,!0)),S.test(i[1])&&T.isPlainObject(t))for(i in t)y(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(r=D.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):y(e)?void 0!==n.ready?n.ready(e):e(T):T.makeArray(e,this)}).prototype=T.fn,I=T(D);var N=/^(?:parents|prev(?:Until|All))/,$={children:!0,contents:!0,next:!0,prev:!0};function M(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}T.fn.extend({has:function(e){var t=T(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,ue=/^$|^module$|\/(?:java|ecma)script/i,de={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function he(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&E(e,t)?T.merge([e],n):n}function fe(e,t){for(var n=0,i=e.length;nx",v.noCloneChecked=!!pe.cloneNode(!0).lastChild.defaultValue;var ye=D.documentElement,be=/^key/,_e=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,we=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function xe(){return!1}function De(){try{return D.activeElement}catch(e){}}function Te(e,t,n,i,r,o){var s,a;if("object"==typeof t){for(a in"string"!=typeof n&&(i=i||n,n=void 0),t)Te(e,a,n,i,t[a],o);return e}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=xe;else if(!r)return e;return 1===o&&(s=r,(r=function(e){return T().off(e),s.apply(this,arguments)}).guid=s.guid||(s.guid=T.guid++)),e.each(function(){T.event.add(this,t,r,i,n)})}T.event={global:{},add:function(t,e,n,i,r){var o,s,a,l,c,u,d,h,f,p,g,m=Q.get(t);if(m)for(n.handler&&(n=(o=n).handler,r=o.selector),r&&T.find.matchesSelector(ye,r),n.guid||(n.guid=T.guid++),(l=m.events)||(l=m.events={}),(s=m.handle)||(s=m.handle=function(e){return void 0!==T&&T.event.triggered!==e.type?T.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(F)||[""]).length;c--;)f=g=(a=we.exec(e[c])||[])[1],p=(a[2]||"").split(".").sort(),f&&(d=T.event.special[f]||{},f=(r?d.delegateType:d.bindType)||f,d=T.event.special[f]||{},u=T.extend({type:f,origType:g,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&T.expr.match.needsContext.test(r),namespace:p.join(".")},o),(h=l[f])||((h=l[f]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(t,i,p,s)||t.addEventListener&&t.addEventListener(f,s)),d.add&&(d.add.call(t,u),u.handler.guid||(u.handler.guid=n.guid)),r?h.splice(h.delegateCount++,0,u):h.push(u),T.event.global[f]=!0)},remove:function(e,t,n,i,r){var o,s,a,l,c,u,d,h,f,p,g,m=Q.hasData(e)&&Q.get(e);if(m&&(l=m.events)){for(c=(t=(t||"").match(F)||[""]).length;c--;)if(f=g=(a=we.exec(t[c])||[])[1],p=(a[2]||"").split(".").sort(),f){for(d=T.event.special[f]||{},h=l[f=(i?d.delegateType:d.bindType)||f]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=h.length;o--;)u=h[o],!r&&g!==u.origType||n&&n.guid!==u.guid||a&&!a.test(u.namespace)||i&&i!==u.selector&&("**"!==i||!u.selector)||(h.splice(o,1),u.selector&&h.delegateCount--,d.remove&&d.remove.call(e,u));s&&!h.length&&(d.teardown&&!1!==d.teardown.call(e,p,m.handle)||T.removeEvent(e,f,m.handle),delete l[f])}else for(f in l)T.event.remove(e,f+t[c],n,i,!0);T.isEmptyObject(l)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,i,r,o,s,a=T.event.fix(e),l=new Array(arguments.length),c=(Q.get(this,"events")||{})[a.type]||[],u=T.event.special[a.type]||{};for(l[0]=a,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Ee=/\s*$/g;function Ie(e,t){return E(e,"table")&&E(11!==t.nodeType?t:t.firstChild,"tr")&&T(e).children("tbody")[0]||e}function Ae(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ne(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function $e(e,t){var n,i,r,o,s,a,l,c;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),s=Q.set(t,o),c=o.events))for(r in delete s.handle,s.events={},c)for(n=0,i=c[r].length;n")},clone:function(e,t,n){var i,r,o,s,a,l,c,u=e.cloneNode(!0),d=T.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||T.isXMLDoc(e)))for(s=he(u),i=0,r=(o=he(e)).length;i").prop({charset:n.scriptCharset,src:n.url}).on("load error",r=function(e){i.remove(),r=null,e&&t("error"===e.type?404:200,e.type)}),D.head.appendChild(i[0])},abort:function(){r&&r()}}});var qt,Wt=[],zt=/(=)\?(?=&|$)|\?\?/;T.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Wt.pop()||T.expando+"_"+_t++;return this[e]=!0,e}}),T.ajaxPrefilter("json jsonp",function(e,t,n){var i,r,o,s=!1!==e.jsonp&&(zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&zt.test(e.data)&&"data");if(s||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=y(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(zt,"$1"+i):!1!==e.jsonp&&(e.url+=(wt.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||T.error(i+" was not called"),o[0]},e.dataTypes[0]="json",r=x[i],x[i]=function(){o=arguments},n.always(function(){void 0===r?T(x).removeProp(i):x[i]=r,e[i]&&(e.jsonpCallback=t.jsonpCallback,Wt.push(i)),o&&y(r)&&r(o[0]),o=r=void 0}),"script"}),v.createHTMLDocument=((qt=D.implementation.createHTMLDocument("").body).innerHTML="
",2===qt.childNodes.length),T.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(v.createHTMLDocument?((i=(t=D.implementation.createHTMLDocument("")).createElement("base")).href=D.location.href,t.head.appendChild(i)):t=D),o=!n&&[],(r=S.exec(e))?[t.createElement(r[1])]:(r=ve([e],t,o),o&&o.length&&T(o).remove(),T.merge([],r.childNodes)));var i,r,o},T.fn.load=function(e,t,n){var i,r,o,s=this,a=e.indexOf(" ");return-1").append(T.parseHTML(e)).find(i):e)}).always(n&&function(e,t){s.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},T.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){T.fn[t]=function(e){return this.on(t,e)}}),T.expr.pseudos.animated=function(t){return T.grep(T.timers,function(e){return t===e.elem}).length},T.offset={setOffset:function(e,t,n){var i,r,o,s,a,l,c=T.css(e,"position"),u=T(e),d={};"static"===c&&(e.style.position="relative"),a=u.offset(),o=T.css(e,"top"),l=T.css(e,"left"),("absolute"===c||"fixed"===c)&&-1<(o+l).indexOf("auto")?(s=(i=u.position()).top,r=i.left):(s=parseFloat(o)||0,r=parseFloat(l)||0),y(t)&&(t=t.call(e,n,T.extend({},a))),null!=t.top&&(d.top=t.top-a.top+s),null!=t.left&&(d.left=t.left-a.left+r),"using"in t?t.using.call(e,d):u.css(d)}},T.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){T.offset.setOffset(this,t,e)});var e,n,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),n=i.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,i=this[0],r={top:0,left:0};if("fixed"===T.css(i,"position"))t=i.getBoundingClientRect();else{for(t=this.offset(),n=i.ownerDocument,e=i.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===T.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((r=T(e).offset()).top+=T.css(e,"borderTopWidth",!0),r.left+=T.css(e,"borderLeftWidth",!0))}return{top:t.top-r.top-T.css(i,"marginTop",!0),left:t.left-r.left-T.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===T.css(e,"position");)e=e.offsetParent;return e||ye})}}),T.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,r){var o="pageYOffset"===r;T.fn[t]=function(e){return q(this,function(e,t,n){var i;if(b(e)?i=e:9===e.nodeType&&(i=e.defaultView),void 0===n)return i?i[r]:e[t];i?i.scrollTo(o?i.pageXOffset:n,o?n:i.pageYOffset):e[t]=n},t,e,arguments.length)}}),T.each(["top","left"],function(e,n){T.cssHooks[n]=Re(v.pixelPosition,function(e,t){if(t)return t=Le(e,n),Pe.test(t)?T(e).position()[n]+"px":t})}),T.each({Height:"height",Width:"width"},function(s,a){T.each({padding:"inner"+s,content:a,"":"outer"+s},function(i,o){T.fn[o]=function(e,t){var n=arguments.length&&(i||"boolean"!=typeof e),r=i||(!0===e||!0===t?"margin":"border");return q(this,function(e,t,n){var i;return b(e)?0===o.indexOf("outer")?e["inner"+s]:e.document.documentElement["client"+s]:9===e.nodeType?(i=e.documentElement,Math.max(e.body["scroll"+s],i["scroll"+s],e.body["offset"+s],i["offset"+s],i["client"+s])):void 0===n?T.css(e,t,r):T.style(e,t,n,r)},a,n?e:void 0,n)}})}),T.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(e,n){T.fn[n]=function(e,t){return 0=i.clientWidth&&n>=i.clientHeight}),u=0l[e]&&!i.escapeWithReference&&(n=Math.min(u[t],l[e]-("right"===e?u.width:u.height))),w({},t,n)}};return c.forEach(function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";u=C({},u,d[t](e))}),e.offsets.popper=u,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,i=t.reference,r=e.placement.split("-")[0],o=Math.floor,s=-1!==["top","bottom"].indexOf(r),a=s?"right":"bottom",l=s?"left":"top",c=s?"width":"height";return n[a]o(i[a])&&(e.offsets.popper[l]=o(i[a])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){var n;if(!B(e.instance.modifiers,"arrow","keepTogether"))return e;var i=t.element;if("string"==typeof i){if(!(i=e.instance.popper.querySelector(i)))return e}else if(!e.instance.popper.contains(i))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var r=e.placement.split("-")[0],o=e.offsets,s=o.popper,a=o.reference,l=-1!==["left","right"].indexOf(r),c=l?"height":"width",u=l?"Top":"Left",d=u.toLowerCase(),h=l?"left":"top",f=l?"bottom":"right",p=O(i)[c];a[f]-ps[f]&&(e.offsets.popper[d]+=a[d]+p-s[f]),e.offsets.popper=x(e.offsets.popper);var g=a[d]+a[c]/2-p/2,m=_(e.instance.popper),v=parseFloat(m["margin"+u],10),y=parseFloat(m["border"+u+"Width"],10),b=g-e.offsets.popper[d]-v-y;return b=Math.max(Math.min(s[c]-p,b),0),e.arrowElement=i,e.offsets.arrow=(w(n={},d,Math.round(b)),w(n,h,""),n),e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(p,g){if(M(p.instance.modifiers,"inner"))return p;if(p.flipped&&p.placement===p.originalPlacement)return p;var m=k(p.instance.popper,p.instance.reference,g.padding,g.boundariesElement,p.positionFixed),v=p.placement.split("-")[0],y=I(v),b=p.placement.split("-")[1]||"",_=[];switch(g.behavior){case U:_=[v,y];break;case V:_=z(v);break;case Y:_=z(v,!0);break;default:_=g.behavior}return _.forEach(function(e,t){if(v!==e||_.length===t+1)return p;v=p.placement.split("-")[0],y=I(v);var n,i=p.offsets.popper,r=p.offsets.reference,o=Math.floor,s="left"===v&&o(i.right)>o(r.left)||"right"===v&&o(i.left)o(r.top)||"bottom"===v&&o(i.top)o(m.right),c=o(i.top)o(m.bottom),d="left"===v&&a||"right"===v&&l||"top"===v&&c||"bottom"===v&&u,h=-1!==["top","bottom"].indexOf(v),f=!!g.flipVariations&&(h&&"start"===b&&a||h&&"end"===b&&l||!h&&"start"===b&&c||!h&&"end"===b&&u);(s||d||f)&&(p.flipped=!0,(s||d)&&(v=_[t+1]),f&&(b="end"===(n=b)?"start":"start"===n?"end":n),p.placement=v+(b?"-"+b:""),p.offsets.popper=C({},p.offsets.popper,A(p.instance.popper,p.offsets.reference,p.placement)),p=$(p.instance.modifiers,p,"flip"))}),p},behavior:"flip",padding:5,boundariesElement:"viewport"},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],i=e.offsets,r=i.popper,o=i.reference,s=-1!==["left","right"].indexOf(n),a=-1===["top","left"].indexOf(n);return r[s?"left":"top"]=o[n]-(a?r[s?"width":"height"]:0),e.placement=I(t),e.offsets.popper=x(r),e}},hide:{order:800,enabled:!0,fn:function(e){if(!B(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=N(e.instance.modifiers,function(e){return"preventOverflow"===e.name}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.rightthis._items.length-1||e<0))if(this._isSliding)N(this._element).one(z.SLID,function(){return t.to(e)});else{if(n===e)return this.pause(),void this.cycle();var i=ndocument.documentElement.clientHeight;!this._isBodyOverflowing&&e&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!e&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},e._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},e._checkScrollbar=function(){var e=document.body.getBoundingClientRect();this._isBodyOverflowing=e.left+e.right
',trigger:"hover focus",title:"",delay:0,html:!(kt={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"}),selector:!(Tt={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)"}),placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent"},Ot="out",It={HIDE:"hide"+wt,HIDDEN:"hidden"+wt,SHOW:(St="show")+wt,SHOWN:"shown"+wt,INSERTED:"inserted"+wt,CLICK:"click"+wt,FOCUSIN:"focusin"+wt,FOCUSOUT:"focusout"+wt,MOUSEENTER:"mouseenter"+wt,MOUSELEAVE:"mouseleave"+wt},At="fade",Nt="show",$t=".tooltip-inner",Mt=".arrow",Ft="hover",Pt="focus",Ht="click",jt="manual",Lt=function(){function i(e,t){if(void 0===u)throw new TypeError("Bootstrap tooltips require Popper.js (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=e,this.config=this._getConfig(t),this.tip=null,this._setListeners()}var e=i.prototype;return e.enable=function(){this._isEnabled=!0},e.disable=function(){this._isEnabled=!1},e.toggleEnabled=function(){this._isEnabled=!this._isEnabled},e.toggle=function(e){if(this._isEnabled)if(e){var t=this.constructor.DATA_KEY,n=yt(e.currentTarget).data(t);n||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),yt(e.currentTarget).data(t,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(yt(this.getTipElement()).hasClass(Nt))return void this._leave(null,this);this._enter(null,this)}},e.dispose=function(){clearTimeout(this._timeout),yt.removeData(this.element,this.constructor.DATA_KEY),yt(this.element).off(this.constructor.EVENT_KEY),yt(this.element).closest(".modal").off("hide.bs.modal"),this.tip&&yt(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,(this._activeTrigger=null)!==this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},e.show=function(){var t=this;if("none"===yt(this.element).css("display"))throw new Error("Please use show on visible elements");var e=yt.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){yt(this.element).trigger(e);var n=yt.contains(this.element.ownerDocument.documentElement,this.element);if(e.isDefaultPrevented()||!n)return;var i=this.getTipElement(),r=qn.getUID(this.constructor.NAME);i.setAttribute("id",r),this.element.setAttribute("aria-describedby",r),this.setContent(),this.config.animation&&yt(i).addClass(At);var o="function"==typeof this.config.placement?this.config.placement.call(this,i,this.element):this.config.placement,s=this._getAttachment(o);this.addAttachmentClass(s);var a=!1===this.config.container?document.body:yt(this.config.container);yt(i).data(this.constructor.DATA_KEY,this),yt.contains(this.element.ownerDocument.documentElement,this.tip)||yt(i).appendTo(a),yt(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new u(this.element,i,{placement:s,modifiers:{offset:{offset:this.config.offset},flip:{behavior:this.config.fallbackPlacement},arrow:{element:Mt},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(e){e.originalPlacement!==e.placement&&t._handlePopperPlacementChange(e)},onUpdate:function(e){t._handlePopperPlacementChange(e)}}),yt(i).addClass(Nt),"ontouchstart"in document.documentElement&&yt(document.body).children().on("mouseover",null,yt.noop);var l=function(){t.config.animation&&t._fixTransition();var e=t._hoverState;t._hoverState=null,yt(t.element).trigger(t.constructor.Event.SHOWN),e===Ot&&t._leave(null,t)};if(yt(this.tip).hasClass(At)){var c=qn.getTransitionDurationFromElement(this.tip);yt(this.tip).one(qn.TRANSITION_END,l).emulateTransitionEnd(c)}else l()}},e.hide=function(e){var t=this,n=this.getTipElement(),i=yt.Event(this.constructor.Event.HIDE),r=function(){t._hoverState!==St&&n.parentNode&&n.parentNode.removeChild(n),t._cleanTipClass(),t.element.removeAttribute("aria-describedby"),yt(t.element).trigger(t.constructor.Event.HIDDEN),null!==t._popper&&t._popper.destroy(),e&&e()};if(yt(this.element).trigger(i),!i.isDefaultPrevented()){if(yt(n).removeClass(Nt),"ontouchstart"in document.documentElement&&yt(document.body).children().off("mouseover",null,yt.noop),this._activeTrigger[Ht]=!1,this._activeTrigger[Pt]=!1,this._activeTrigger[Ft]=!1,yt(this.tip).hasClass(At)){var o=qn.getTransitionDurationFromElement(n);yt(n).one(qn.TRANSITION_END,r).emulateTransitionEnd(o)}else r();this._hoverState=""}},e.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},e.isWithContent=function(){return Boolean(this.getTitle())},e.addAttachmentClass=function(e){yt(this.getTipElement()).addClass(xt+"-"+e)},e.getTipElement=function(){return this.tip=this.tip||yt(this.config.template)[0],this.tip},e.setContent=function(){var e=yt(this.getTipElement());this.setElementContent(e.find($t),this.getTitle()),e.removeClass(At+" "+Nt)},e.setElementContent=function(e,t){var n=this.config.html;"object"==typeof t&&(t.nodeType||t.jquery)?n?yt(t).parent().is(e)||e.empty().append(t):e.text(yt(t).text()):e[n?"html":"text"](t)},e.getTitle=function(){var e=this.element.getAttribute("data-original-title");return e||(e="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),e},e._getAttachment=function(e){return kt[e.toUpperCase()]},e._setListeners=function(){var i=this;this.config.trigger.split(" ").forEach(function(e){if("click"===e)yt(i.element).on(i.constructor.Event.CLICK,i.config.selector,function(e){return i.toggle(e)});else if(e!==jt){var t=e===Ft?i.constructor.Event.MOUSEENTER:i.constructor.Event.FOCUSIN,n=e===Ft?i.constructor.Event.MOUSELEAVE:i.constructor.Event.FOCUSOUT;yt(i.element).on(t,i.config.selector,function(e){return i._enter(e)}).on(n,i.config.selector,function(e){return i._leave(e)})}yt(i.element).closest(".modal").on("hide.bs.modal",function(){return i.hide()})}),this.config.selector?this.config=c({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},e._fixTitle=function(){var e=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==e)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},e._enter=function(e,t){var n=this.constructor.DATA_KEY;(t=t||yt(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),yt(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusin"===e.type?Pt:Ft]=!0),yt(t.getTipElement()).hasClass(Nt)||t._hoverState===St?t._hoverState=St:(clearTimeout(t._timeout),t._hoverState=St,t.config.delay&&t.config.delay.show?t._timeout=setTimeout(function(){t._hoverState===St&&t.show()},t.config.delay.show):t.show())},e._leave=function(e,t){var n=this.constructor.DATA_KEY;(t=t||yt(e.currentTarget).data(n))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),yt(e.currentTarget).data(n,t)),e&&(t._activeTrigger["focusout"===e.type?Pt:Ft]=!1),t._isWithActiveTrigger()||(clearTimeout(t._timeout),t._hoverState=Ot,t.config.delay&&t.config.delay.hide?t._timeout=setTimeout(function(){t._hoverState===Ot&&t.hide()},t.config.delay.hide):t.hide())},e._isWithActiveTrigger=function(){for(var e in this._activeTrigger)if(this._activeTrigger[e])return!0;return!1},e._getConfig=function(e){return"number"==typeof(e=c({},this.constructor.Default,yt(this.element).data(),"object"==typeof e&&e?e:{})).delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),qn.typeCheckConfig(bt,e,this.constructor.DefaultType),e},e._getDelegateConfig=function(){var e={};if(this.config)for(var t in this.config)this.constructor.Default[t]!==this.config[t]&&(e[t]=this.config[t]);return e},e._cleanTipClass=function(){var e=yt(this.getTipElement()),t=e.attr("class").match(Dt);null!==t&&0

'}),Kt=c({},Qn.DefaultType,{content:"(string|element|function)"}),Qt="fade",Gt=".popover-header",Jt=".popover-body",Zt={HIDE:"hide"+Wt,HIDDEN:"hidden"+Wt,SHOW:(Xt="show")+Wt,SHOWN:"shown"+Wt,INSERTED:"inserted"+Wt,CLICK:"click"+Wt,FOCUSIN:"focusin"+Wt,FOCUSOUT:"focusout"+Wt,MOUSEENTER:"mouseenter"+Wt,MOUSELEAVE:"mouseleave"+Wt},en=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),(t.prototype.constructor=t).__proto__=n;var r=i.prototype;return r.isWithContent=function(){return this.getTitle()||this._getContent()},r.addAttachmentClass=function(e){Rt(this.getTipElement()).addClass(Ut+"-"+e)},r.getTipElement=function(){return this.tip=this.tip||Rt(this.config.template)[0],this.tip},r.setContent=function(){var e=Rt(this.getTipElement());this.setElementContent(e.find(Gt),this.getTitle());var t=this._getContent();"function"==typeof t&&(t=t.call(this.element)),this.setElementContent(e.find(Jt),t),e.removeClass(Qt+" "+Xt)},r._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},r._cleanTipClass=function(){var e=Rt(this.getTipElement()),t=e.attr("class").match(Vt);null!==t&&0=this._offsets[r]&&(void 0===this._offsets[r+1]||e',nextHtml:'',navTitles:{days:"MM, yyyy",months:"yyyy",years:"yyyy1 - yyyy2"},timepicker:!1,onlyTimepicker:!1,dateTimeSeparator:" ",timeFormat:"",minHours:0,maxHours:24,minMinutes:0,maxMinutes:59,hoursStep:1,minutesStep:1,onSelect:"",onShow:"",onHide:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},l={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]},(p=c=function(e,t){this.el=e,this.$el=s(e),this.opts=s.extend(!0,{},a,t,this.$el.data()),n==o&&(n=s("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?s(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.minRange="",this.maxRange="",this._prevOnSelectValue="",this.init()}).prototype={VERSION:"2.2.3",viewIndexes:["days","months","years"],init:function(){t||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents()),this.opts.keyboardNav&&!this.opts.onlyTimepicker&&this._bindKeyboardEvents(),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this))),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.opts.timepicker&&(this.timepicker=new s.fn.datepicker.Timepicker(this,this.opts),this._bindTimepickerEvents()),this.opts.onlyTimepicker&&this.$datepicker.addClass("-only-timepicker-"),this.views[this.currentView]=new s.fn.datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new s.fn.datepicker.Navigation(this,this.opts),this.view=this.currentView,this.$el.on("clickCell.adp",this._onClickCell.bind(this)),this.$datepicker.on("mouseenter",".datepicker--cell",this._onMouseEnterCell.bind(this)),this.$datepicker.on("mouseleave",".datepicker--cell",this._onMouseLeaveCell.bind(this)),this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent+".adp",this._onShowEvent.bind(this)),this.$el.on("mouseup.adp",this._onMouseUpEl.bind(this)),this.$el.on("blur.adp",this._onBlur.bind(this)),this.$el.on("keyup.adp",this._onKeyUpGeneral.bind(this)),s(e).on("resize.adp",this._onResize.bind(this)),s("body").on("mouseup.adp",this._onMouseUpBody.bind(this))},_bindKeyboardEvents:function(){this.$el.on("keydown.adp",this._onKeyDown.bind(this)),this.$el.on("keyup.adp",this._onKeyUp.bind(this)),this.$el.on("hotKey.adp",this._onHotKey.bind(this))},_bindTimepickerEvents:function(){this.$el.on("timeChange.adp",this._onTimeChange.bind(this))},isWeekend:function(e){return-1!==this.opts.weekends.indexOf(e)},_defineLocale:function(e){"string"==typeof e?(this.loc=s.fn.datepicker.language[e],this.loc||(console.warn("Can't find language \""+e+'" in Datepicker.language, will use "ru" instead'),this.loc=s.extend(!0,{},s.fn.datepicker.language.ru)),this.loc=s.extend(!0,{},s.fn.datepicker.language.ru,s.fn.datepicker.language[e])):this.loc=s.extend(!0,{},s.fn.datepicker.language.ru,e),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),this.opts.timeFormat&&(this.loc.timeFormat=this.opts.timeFormat),""!==this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay),this.opts.timepicker&&(this.loc.dateFormat=[this.loc.dateFormat,this.loc.timeFormat].join(this.opts.dateTimeSeparator)),this.opts.onlyTimepicker&&(this.loc.dateFormat=this.loc.timeFormat);var t=this._getWordBoundaryRegExp;(this.loc.timeFormat.match(t("aa"))||this.loc.timeFormat.match(t("AA")))&&(this.ampm=!0)},_buildDatepickersContainer:function(){t=!0,n.append('
'),i=s("#datepickers-container")},_buildBaseHtml:function(){var e,t=s('
');e="INPUT"==this.el.nodeName?this.opts.inline?t.insertAfter(this.$el):i:t.appendTo(this.$el),this.$datepicker=s('
').appendTo(e),this.$content=s(".datepicker--content",this.$datepicker),this.$nav=s(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length){if(""===this._prevOnSelectValue)return;return this._prevOnSelectValue="",this.opts.onSelect("","",this)}var e,t=this.selectedDates,n=p.getParsedDate(t[0]),i=this,r=new Date(n.year,n.month,n.date,n.hours,n.minutes);e=t.map(function(e){return i.formatDate(i.loc.dateFormat,e)}).join(this.opts.multipleDatesSeparator),(this.opts.multipleDates||this.opts.range)&&(r=t.map(function(e){var t=p.getParsedDate(e);return new Date(t.year,t.month,t.date,t.hours,t.minutes)})),this._prevOnSelectValue=e,this.opts.onSelect(e,r,this)},next:function(){var e=this.parsedDate,t=this.opts;switch(this.view){case"days":this.date=new Date(e.year,e.month+1,1),t.onChangeMonth&&t.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(e.year+1,e.month,1),t.onChangeYear&&t.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(e.year+10,0,1),t.onChangeDecade&&t.onChangeDecade(this.curDecade)}},prev:function(){var e=this.parsedDate,t=this.opts;switch(this.view){case"days":this.date=new Date(e.year,e.month-1,1),t.onChangeMonth&&t.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(e.year-1,e.month,1),t.onChangeYear&&t.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(e.year-10,0,1),t.onChangeDecade&&t.onChangeDecade(this.curDecade)}},formatDate:function(e,t){t=t||this.date;var n,i=e,r=this._getWordBoundaryRegExp,o=this.loc,s=p.getLeadingZeroNum,a=p.getDecade(t),l=p.getParsedDate(t),c=l.fullHours,u=l.hours,d=e.match(r("aa"))||e.match(r("AA")),h="am",f=this._replacer;switch(this.opts.timepicker&&this.timepicker&&d&&(c=s((n=this.timepicker._getValidHoursFromDate(t,d)).hours),u=n.hours,h=n.dayPeriod),!0){case/@/.test(i):i=i.replace(/@/,t.getTime());case/aa/.test(i):i=f(i,r("aa"),h);case/AA/.test(i):i=f(i,r("AA"),h.toUpperCase());case/dd/.test(i):i=f(i,r("dd"),l.fullDate);case/d/.test(i):i=f(i,r("d"),l.date);case/DD/.test(i):i=f(i,r("DD"),o.days[l.day]);case/D/.test(i):i=f(i,r("D"),o.daysShort[l.day]);case/mm/.test(i):i=f(i,r("mm"),l.fullMonth);case/m/.test(i):i=f(i,r("m"),l.month+1);case/MM/.test(i):i=f(i,r("MM"),this.loc.months[l.month]);case/M/.test(i):i=f(i,r("M"),o.monthsShort[l.month]);case/ii/.test(i):i=f(i,r("ii"),l.fullMinutes);case/i/.test(i):i=f(i,r("i"),l.minutes);case/hh/.test(i):i=f(i,r("hh"),c);case/h/.test(i):i=f(i,r("h"),u);case/yyyy/.test(i):i=f(i,r("yyyy"),l.year);case/yyyy1/.test(i):i=f(i,r("yyyy1"),a[0]);case/yyyy2/.test(i):i=f(i,r("yyyy2"),a[1]);case/yy/.test(i):i=f(i,r("yy"),l.year.toString().slice(-2))}return i},_replacer:function(e,t,r){return e.replace(t,function(e,t,n,i){return t+r+i})},_getWordBoundaryRegExp:function(e){var t="\\s|\\.|-|/|\\\\|,|\\$|\\!|\\?|:|;";return new RegExp("(^|>|"+t+")("+e+")($|<|"+t+")","g")},selectDate:function(e){var t=this,n=t.opts,i=t.parsedDate,r=t.selectedDates.length,o="";if(Array.isArray(e))e.forEach(function(e){t.selectDate(e)});else if(e instanceof Date){if(this.lastSelectedDate=e,this.timepicker&&this.timepicker._setTime(e),t._trigger("selectDate",e),this.timepicker&&(e.setHours(this.timepicker.hours),e.setMinutes(this.timepicker.minutes)),"days"==t.view&&e.getMonth()!=i.month&&n.moveToOtherMonthsOnSelect&&(o=new Date(e.getFullYear(),e.getMonth(),1)),"years"==t.view&&e.getFullYear()!=i.year&&n.moveToOtherYearsOnSelect&&(o=new Date(e.getFullYear(),0,1)),o&&(t.silent=!0,t.date=o,t.silent=!1,t.nav._render()),n.multipleDates&&!n.range){if(r===n.multipleDates)return;t._isSelected(e)||t.selectedDates.push(e)}else n.range?2==r?(t.selectedDates=[e],t.minRange=e,t.maxRange=""):1==r?(t.selectedDates.push(e),t.maxRange?t.minRange=e:t.maxRange=e,p.bigger(t.maxRange,t.minRange)&&(t.maxRange=t.minRange,t.minRange=e),t.selectedDates=[t.minRange,t.maxRange]):(t.selectedDates=[e],t.minRange=e):t.selectedDates=[e];t._setInputValue(),n.onSelect&&t._triggerOnChange(),n.autoClose&&!this.timepickerIsActive&&(n.multipleDates||n.range?n.range&&2==t.selectedDates.length&&t.hide():t.hide()),t.views[this.currentView]._render()}},removeDate:function(n){var i=this.selectedDates,r=this;if(n instanceof Date)return i.some(function(e,t){if(p.isSame(e,n))return i.splice(t,1),r.selectedDates.length?r.lastSelectedDate=r.selectedDates[r.selectedDates.length-1]:(r.minRange="",r.maxRange="",r.lastSelectedDate=""),r.views[r.currentView]._render(),r._setInputValue(),r.opts.onSelect&&r._triggerOnChange(),!0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date,this.opts.todayButton instanceof Date&&this.selectDate(this.opts.todayButton)},clear:function(){this.selectedDates=[],this.minRange="",this.maxRange="",this.views[this.currentView]._render(),this._setInputValue(),this.opts.onSelect&&this._triggerOnChange()},update:function(e,t){var n=arguments.length,i=this.lastSelectedDate;return 2==n?this.opts[e]=t:1==n&&"object"==typeof e&&(this.opts=s.extend(!0,this.opts,e)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.opts.onlyTimepicker||this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.opts.onlyTimepicker&&this.$datepicker.addClass("-only-timepicker-"),this.opts.timepicker&&(i&&this.timepicker._handleDate(i),this.timepicker._updateRanges(),this.timepicker._updateCurrentTime(),i&&(i.setHours(this.timepicker.hours),i.setMinutes(this.timepicker.minutes))),this._setInputValue(),this},_syncWithMinMaxDates:function(){var e=this.date.getTime();this.silent=!0,this.minTime>e&&(this.date=this.minDate),this.maxTime=this.minTime&&n<=this.maxTime,month:s>=this.minTime&&a<=this.maxTime,year:i.year>=r.year&&i.year<=o.year};return t?l[t]:l.day},_getDimensions:function(e){var t=e.offset();return{width:e.outerWidth(),height:e.outerHeight(),left:t.left,top:t.top}},_getDateFromCell:function(e){var t=this.parsedDate,n=e.data("year")||t.year,i=e.data("month")==o?t.month:e.data("month"),r=e.data("date")||1;return new Date(n,i,r)},_setPositionClasses:function(e){var t=(e=e.split(" "))[0],n="datepicker -"+t+"-"+e[1]+"- -from-"+t+"-";this.visible&&(n+=" active"),this.$datepicker.removeAttr("class").addClass(n)},setPosition:function(e){e=e||this.opts.position;var t,n,i=this._getDimensions(this.$el),r=this._getDimensions(this.$datepicker),o=e.split(" "),s=this.opts.offset,a=o[0],l=o[1];switch(a){case"top":t=i.top-r.height-s;break;case"right":n=i.left+i.width+s;break;case"bottom":t=i.top+i.height+s;break;case"left":n=i.left-r.width-s}switch(l){case"top":t=i.top;break;case"right":n=i.left+i.width-r.width;break;case"bottom":t=i.top+i.height-r.height;break;case"left":n=i.left;break;case"center":/left|right/.test(a)?t=i.top+i.height/2-r.height/2:n=i.left+i.width/2-r.width/2}this.$datepicker.css({left:n,top:t})},show:function(){var e=this.opts.onShow;this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0,e&&this._bindVisionEvents(e)},hide:function(){var e=this.opts.onHide;this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur(),e&&this._bindVisionEvents(e)},down:function(e){this._changeView(e,"down")},up:function(e){this._changeView(e,"up")},_bindVisionEvents:function(e){this.$datepicker.off("transitionend.dp"),e(this,!1),this.$datepicker.one("transitionend.dp",e.bind(this,this,!0))},_changeView:function(e,t){e=e||this.focused||this.date;var n="up"==t?this.viewIndex+1:this.viewIndex-1;2this.maxTime&&(n=this.maxDate),this.focused=n,t=p.getParsedDate(n),s&&o.onChangeMonth&&o.onChangeMonth(t.month,t.year),a&&o.onChangeYear&&o.onChangeYear(t.year),l&&o.onChangeDecade&&o.onChangeDecade(this.curDecade)},_registerKey:function(t){this.keys.some(function(e){return e==t})||this.keys.push(t)},_unRegisterKey:function(e){var t=this.keys.indexOf(e);this.keys.splice(t,1)},_isHotKeyPressed:function(){var e,t=!1,n=this.keys.sort();for(var i in l)e=l[i],n.length==e.length&&e.every(function(e,t){return e==n[t]})&&(this._trigger("hotKey",i),t=!0);return t},_trigger:function(e,t){this.$el.trigger(e,t)},_focusNextCell:function(e,t){t=t||this.cellType;var n=p.getParsedDate(this._getFocusedDate()),i=n.year,r=n.month,o=n.date;if(!this._isHotKeyPressed()){switch(e){case 37:"day"==t&&(o-=1),"month"==t&&(r-=1),"year"==t&&(i-=1);break;case 38:"day"==t&&(o-=7),"month"==t&&(r-=3),"year"==t&&(i-=4);break;case 39:"day"==t&&(o+=1),"month"==t&&(r+=1),"year"==t&&(i+=1);break;case 40:"day"==t&&(o+=7),"month"==t&&(r+=3),"year"==t&&(i+=4)}var s=new Date(i,r,o);s.getTime()this.maxTime&&(s=this.maxDate),this.focused=s}},_getFocusedDate:function(){var e=this.focused||this.selectedDates[this.selectedDates.length-1],t=this.parsedDate;if(!e)switch(this.view){case"days":e=new Date(t.year,t.month,(new Date).getDate());break;case"months":e=new Date(t.year,t.month,1);break;case"years":e=new Date(t.year,0,1)}return e},_getCell:function(e,t){t=t||this.cellType;var n,i=p.getParsedDate(e),r='.datepicker--cell[data-year="'+i.year+'"]';switch(t){case"month":r='[data-month="'+i.month+'"]';break;case"day":r+='[data-month="'+i.month+'"][data-date="'+i.date+'"]'}return(n=this.views[this.currentView].$el.find(r)).length?n:s("")},destroy:function(){var e=this;e.$el.off(".adp").data("datepicker",""),e.selectedDates=[],e.focused="",e.views={},e.keys=[],e.minRange="",e.maxRange="",e.opts.inline||!e.elIsInput?e.$datepicker.closest(".datepicker-inline").remove():e.$datepicker.remove()},_handleAlreadySelectedDates:function(e,t){this.opts.range?this.opts.toggleSelected?this.removeDate(t):2!=this.selectedDates.length&&this._trigger("clickCell",t):this.opts.toggleSelected&&this.removeDate(t),this.opts.toggleSelected||(this.lastSelectedDate=e,this.opts.timepicker&&(this.timepicker._setTime(e),this.timepicker.update()))},_onShowEvent:function(e){this.visible||this.show()},_onBlur:function(){!this.inFocus&&this.visible&&this.hide()},_onMouseDownDatepicker:function(e){this.inFocus=!0},_onMouseUpDatepicker:function(e){this.inFocus=!1,e.originalEvent.inFocus=!0,e.originalEvent.timepickerFocus||this.$el.focus()},_onKeyUpGeneral:function(e){this.$el.val()||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onMouseUpBody:function(e){e.originalEvent.inFocus||this.visible&&!this.inFocus&&this.hide()},_onMouseUpEl:function(e){e.originalEvent.inFocus=!0,setTimeout(this._onKeyUpGeneral.bind(this),4)},_onKeyDown:function(e){var t=e.which;if(this._registerKey(t),37<=t&&t<=40&&(e.preventDefault(),this._focusNextCell(t)),13==t&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var n=this._isSelected(this.focused,this.cellType);if(!n)return this.timepicker&&(this.focused.setHours(this.timepicker.hours),this.focused.setMinutes(this.timepicker.minutes)),void this.selectDate(this.focused);this._handleAlreadySelectedDates(n,this.focused)}}27==t&&this.hide()},_onKeyUp:function(e){var t=e.which;this._unRegisterKey(t)},_onHotKey:function(e,t){this._handleHotKey(t)},_onMouseEnterCell:function(e){var t=s(e.target).closest(".datepicker--cell"),n=this._getDateFromCell(t);this.silent=!0,this.focused&&(this.focused=""),t.addClass("-focus-"),this.focused=n,this.silent=!1,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",p.less(this.minRange,this.focused)&&(this.maxRange=this.minRange,this.minRange=""),this.views[this.currentView]._update())},_onMouseLeaveCell:function(e){s(e.target).closest(".datepicker--cell").removeClass("-focus-"),this.silent=!0,this.focused="",this.silent=!1},_onTimeChange:function(e,t,n){var i=new Date,r=!1;this.selectedDates.length&&(r=!0,i=this.lastSelectedDate),i.setHours(t),i.setMinutes(n),r||this._getCell(i).hasClass("-disabled-")?(this._setInputValue(),this.opts.onSelect&&this._triggerOnChange()):this.selectDate(i)},_onClickCell:function(e,t){this.timepicker&&(t.setHours(this.timepicker.hours),t.setMinutes(this.timepicker.minutes)),this.selectDate(t)},set focused(e){if(!e&&this.focused){var t=this._getCell(this.focused);t.length&&t.removeClass("-focus-")}this._focused=e,this.opts.range&&1==this.selectedDates.length&&(this.minRange=this.selectedDates[0],this.maxRange="",p.less(this.minRange,this._focused)&&(this.maxRange=this.minRange,this.minRange="")),this.silent||(this.date=e)},get focused(){return this._focused},get parsedDate(){return p.getParsedDate(this.date)},set date(e){if(e instanceof Date)return this.currentDate=e,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),e},get date(){return this.currentDate},set view(e){if(this.viewIndex=this.viewIndexes.indexOf(e),!(this.viewIndex<0))return this.prevView=this.currentView,this.currentView=e,this.inited&&(this.views[e]?this.views[e]._render():this.views[e]=new s.fn.datepicker.Body(this,e,this.opts),this.views[this.prevView].hide(),this.views[e].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(e),this.elIsInput&&this.visible&&this.setPosition()),e},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var e=p.getParsedDate(this.minDate);return new Date(e.year,e.month,e.date).getTime()},get maxTime(){var e=p.getParsedDate(this.maxDate);return new Date(e.year,e.month,e.date).getTime()},get curDecade(){return p.getDecade(this.date)}},p.getDaysCount=function(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()},p.getParsedDate=function(e){return{year:e.getFullYear(),month:e.getMonth(),fullMonth:e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1,date:e.getDate(),fullDate:e.getDate()<10?"0"+e.getDate():e.getDate(),day:e.getDay(),hours:e.getHours(),fullHours:e.getHours()<10?"0"+e.getHours():e.getHours(),minutes:e.getMinutes(),fullMinutes:e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes()}},p.getDecade=function(e){var t=10*Math.floor(e.getFullYear()/10);return[t,t+9]},p.template=function(e,n){return e.replace(/#\{([\w]+)\}/g,function(e,t){if(n[t]||0===n[t])return n[t]})},p.isSame=function(e,t,n){if(!e||!t)return!1;var i=p.getParsedDate(e),r=p.getParsedDate(t),o=n||"day";return{day:i.date==r.date&&i.month==r.month&&i.year==r.year,month:i.month==r.month&&i.year==r.year,year:i.year==r.year}[o]},p.less=function(e,t,n){return!(!e||!t)&&t.getTime()e.getTime()},p.getLeadingZeroNum=function(e){return parseInt(e)<10?"0"+e:e},p.resetTime=function(e){if("object"==typeof e)return e=p.getParsedDate(e),new Date(e.year,e.month,e.date)},s.fn.datepicker=function(t){return this.each(function(){if(s.data(this,r)){var e=s.data(this,r);e.opts=s.extend(!0,e.opts,t),e.update()}else s.data(this,r,new c(this,t))})},s.fn.datepicker.Constructor=c,s.fn.datepicker.language={ru:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.mm.yyyy",timeFormat:"hh:ii",firstDay:1}},s(function(){s(".datepicker-here").datepicker()}),u={days:'
',months:'
',years:'
'},d=s.fn.datepicker,h=d.Constructor,d.Body=function(e,t,n){this.d=e,this.type=t,this.opts=n,this.$el=s(""),this.opts.onlyTimepicker||this.init()},d.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("click",".datepicker--cell",s.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=s(u[this.type]).appendTo(this.d.$content),this.$names=s(".datepicker--days-names",this.$el),this.$cells=s(".datepicker--cells",this.$el)},_getDayNamesHtml:function(e,t,n,i){return n=n||"",7<(i=i!=o?i:0)?n:7==(t=t!=o?t:e)?this._getDayNamesHtml(e,0,n,++i):(n+='
'+this.d.loc.daysMin[t]+"
",this._getDayNamesHtml(e,++t,n,++i))},_getCellContents:function(e,t){var n="datepicker--cell datepicker--cell-"+t,i=new Date,r=this.d,o=h.resetTime(r.minRange),s=h.resetTime(r.maxRange),a=r.opts,l=h.getParsedDate(e),c={},u=l.date;switch(t){case"day":r.isWeekend(l.day)&&(n+=" -weekend-"),l.month!=this.d.parsedDate.month&&(n+=" -other-month-",a.selectOtherMonths||(n+=" -disabled-"),a.showOtherMonths||(u=""));break;case"month":u=r.loc[r.opts.monthsField][l.month];break;case"year":var d=r.curDecade;u=l.year,(l.yeard[1])&&(n+=" -other-decade-",a.selectOtherYears||(n+=" -disabled-"),a.showOtherYears||(u=""))}return a.onRenderCell&&(u=(c=a.onRenderCell(e,t)||{}).html?c.html:u,n+=c.classes?" "+c.classes:""),a.range&&(h.isSame(o,e,t)&&(n+=" -range-from-"),h.isSame(s,e,t)&&(n+=" -range-to-"),1==r.selectedDates.length&&r.focused?((h.bigger(o,e)&&h.less(r.focused,e)||h.less(s,e)&&h.bigger(r.focused,e))&&(n+=" -in-range-"),h.less(s,e)&&h.isSame(r.focused,e)&&(n+=" -range-from-"),h.bigger(o,e)&&h.isSame(r.focused,e)&&(n+=" -range-to-")):2==r.selectedDates.length&&h.bigger(o,e)&&h.less(s,e)&&(n+=" -in-range-")),h.isSame(i,e,t)&&(n+=" -current-"),r.focused&&h.isSame(e,r.focused,t)&&(n+=" -focus-"),r._isSelected(e,t)&&(n+=" -selected-"),r._isInRange(e,t)&&!c.disabled||(n+=" -disabled-"),{html:u,classes:n}},_getDaysHtml:function(e){for(var t,n,i=h.getDaysCount(e),r=new Date(e.getFullYear(),e.getMonth(),1).getDay(),o=new Date(e.getFullYear(),e.getMonth(),i).getDay(),s=r-this.d.loc.firstDay,a=6-o+this.d.loc.firstDay,l="",c=1-(s=s<0?s+7:s),u=i+(a=6'+t.html+"
"},_getMonthsHtml:function(e){for(var t="",n=h.getParsedDate(e),i=0;i<12;)t+=this._getMonthHtml(new Date(n.year,i)),i++;return t},_getMonthHtml:function(e){var t=this._getCellContents(e,"month");return'
'+t.html+"
"},_getYearsHtml:function(e){h.getParsedDate(e);for(var t=h.getDecade(e),n="",i=t[0]-1;i<=t[1]+1;i++)n+=this._getYearHtml(new Date(i,0));return n},_getYearHtml:function(e){var t=this._getCellContents(e,"year");return'
'+t.html+"
"},_renderTypes:{days:function(){var e=this._getDayNamesHtml(this.d.loc.firstDay),t=this._getDaysHtml(this.d.currentDate);this.$cells.html(t),this.$names.html(e)},months:function(){var e=this._getMonthsHtml(this.d.currentDate);this.$cells.html(e)},years:function(){var e=this._getYearsHtml(this.d.currentDate);this.$cells.html(e)}},_render:function(){this.opts.onlyTimepicker||this._renderTypes[this.type].bind(this)()},_update:function(){var n,i,r,e=s(".datepicker--cell",this.$cells),o=this;e.each(function(e,t){i=s(this),r=o.d._getDateFromCell(s(this)),n=o._getCellContents(r,o.d.cellType),i.attr("class",n.classes)})},show:function(){this.opts.onlyTimepicker||(this.$el.addClass("active"),this.acitve=!0)},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(e){var t=e.data("date")||1,n=e.data("month")||0,i=e.data("year")||this.d.parsedDate.year,r=this.d;if(r.view==this.opts.minView){var o=new Date(i,n,t),s=this.d._isSelected(o,this.d.cellType);s?r._handleAlreadySelectedDates.bind(r,s,o)():r._trigger("clickCell",o)}else r.down(new Date(i,n,t))},_onClickCell:function(e){var t=s(e.target).closest(".datepicker--cell");t.hasClass("-disabled-")||this._handleClick.bind(this)(t)}},f=s.fn.datepicker,g=f.Constructor,f.Navigation=function(e,t){this.d=e,this.opts=t,this.$buttonsContainer="",this.init()},f.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",s.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",s.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",s.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this.opts.onlyTimepicker||this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var e=this._getTitle(this.d.currentDate),t=g.template('
#{prevHtml}
#{title}
#{nextHtml}
',s.extend({title:e},this.opts));this.d.$nav.html(t),"years"==this.d.view&&s(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(e){return this.d.formatDate(this.opts.navTitles[this.d.view],e)},_addButton:function(e){this.$buttonsContainer.length||this._addButtonsContainer();var t={action:e,label:this.d.loc[e]},n=g.template('#{label}',t);s("[data-action="+e+"]",this.$buttonsContainer).length||this.$buttonsContainer.append(n)},_addButtonsContainer:function(){this.d.$datepicker.append('
'),this.$buttonsContainer=s(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var e=this.d.parsedDate,t=e.month,n=e.year,i=e.date;switch(this.d.view){case"days":this.d._isInRange(new Date(n,t-1,1),"month")||this._disableNav("prev"),this.d._isInRange(new Date(n,t+1,1),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(n-1,t,i),"year")||this._disableNav("prev"),this.d._isInRange(new Date(n+1,t,i),"year")||this._disableNav("next");break;case"years":var r=g.getDecade(this.d.date);this.d._isInRange(new Date(r[0]-1,0,1),"year")||this._disableNav("prev"),this.d._isInRange(new Date(r[1]+1,0,1),"year")||this._disableNav("next")}}},_disableNav:function(e){s('[data-action="'+e+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(e){s('[data-action="'+e+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(e){var t=s(e.target).closest("[data-action]").data("action");this.d[t]()},_onClickNavTitle:function(e){if(!s(e.target).hasClass("-disabled-"))return"days"==this.d.view?this.d.view="months":void(this.d.view="years")}},m=s.fn.datepicker,v=m.Constructor,m.Timepicker=function(e,t){this.d=e,this.opts=t,this.init()},m.Timepicker.prototype={init:function(){var e="input";this._setTime(this.d.date),this._buildHTML(),navigator.userAgent.match(/trident/gi)&&(e="change"),this.d.$el.on("selectDate",this._onSelectDate.bind(this)),this.$ranges.on(e,this._onChangeRange.bind(this)),this.$ranges.on("mouseup",this._onMouseUpRange.bind(this)),this.$ranges.on("mousemove focus ",this._onMouseEnterRange.bind(this)),this.$ranges.on("mouseout blur",this._onMouseOutRange.bind(this))},_setTime:function(e){var t=v.getParsedDate(e);this._handleDate(e),this.hours=t.hourse.getHours()&&(this.minMinutes=this.opts.minMinutes)},_setMaxTimeFromDate:function(e){this.maxHours=e.getHours(),this.maxMinutes=e.getMinutes(),this.d.lastSelectedDate&&this.d.lastSelectedDate.getHours()this.maxHours&&(this.hours=this.maxHours),this.minutesthis.maxMinutes&&(this.minutes=this.maxMinutes)},_buildHTML:function(){var e=v.getLeadingZeroNum,t={hourMin:this.minHours,hourMax:e(this.maxHours),hourStep:this.opts.hoursStep,hourValue:this.hours,hourVisible:e(this.displayHours),minMin:this.minMinutes,minMax:e(this.maxMinutes),minStep:this.opts.minutesStep,minValue:e(this.minutes)},n=v.template('
#{hourVisible} : #{minValue}
',t);this.$timepicker=s(n).appendTo(this.d.$datepicker),this.$ranges=s('[type="range"]',this.$timepicker),this.$hours=s('[name="hours"]',this.$timepicker),this.$minutes=s('[name="minutes"]',this.$timepicker),this.$hoursText=s(".datepicker--time-current-hours",this.$timepicker),this.$minutesText=s(".datepicker--time-current-minutes",this.$timepicker),this.d.ampm&&(this.$ampm=s('').appendTo(s(".datepicker--time-current",this.$timepicker)).html(this.dayPeriod),this.$timepicker.addClass("-am-pm-"))},_updateCurrentTime:function(){var e=v.getLeadingZeroNum(this.displayHours),t=v.getLeadingZeroNum(this.minutes);this.$hoursText.html(e),this.$minutesText.html(t),this.d.ampm&&this.$ampm.html(this.dayPeriod)},_updateRanges:function(){this.$hours.attr({min:this.minHours,max:this.maxHours}).val(this.hours),this.$minutes.attr({min:this.minMinutes,max:this.maxMinutes}).val(this.minutes)},_handleDate:function(e){this._setDefaultMinMaxTime(),e&&(v.isSame(e,this.d.opts.minDate)?this._setMinTimeFromDate(this.d.opts.minDate):v.isSame(e,this.d.opts.maxDate)&&this._setMaxTimeFromDate(this.d.opts.maxDate)),this._validateHoursMinutes(e)},update:function(){this._updateRanges(),this._updateCurrentTime()},_getValidHoursFromDate:function(e,t){var n=e;e instanceof Date&&(n=v.getParsedDate(e).hours);var i="am";if(t||this.d.ampm)switch(!0){case 0==n:n=12;break;case 12==n:i="pm";break;case 11/g,">").replace(/"/g,""")},t={before:function(e,t,n){var i=e[t];e[t]=function(){return n.apply(e,arguments),i.apply(e,arguments)}},after:function(t,e,n){var i=t[e];t[e]=function(){var e=i.apply(t,arguments);return n.apply(t,arguments),e}}},n=function(t,n,e){var i,r=t.trigger,o={};for(i in t.trigger=function(){var e=arguments[0];if(-1===n.indexOf(e))return r.apply(t,arguments);o[e]=arguments},e.apply(t,[]),t.trigger=r,o)o.hasOwnProperty(i)&&r.apply(t,o[i])},h=function(e){var t={};if("selectionStart"in e)t.start=e.selectionStart,t.length=e.selectionEnd-t.start;else if(document.selection){e.focus();var n=document.selection.createRange(),i=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t.start=n.text.length-i,t.length=i}return t},S=function(u){var d=null,e=function(e,t){var n,i,r,o,s,a,l,c;t=t||{},(e=e||window.event||{}).metaKey||e.altKey||(t.force||!1!==u.data("grow"))&&(n=u.val(),e.type&&"keydown"===e.type.toLowerCase()&&(r=97<=(i=e.keyCode)&&i<=122||65<=i&&i<=90||48<=i&&i<=57||32===i,46===i||8===i?(c=h(u[0])).length?n=n.substring(0,c.start)+n.substring(c.start+c.length):8===i&&c.start?n=n.substring(0,c.start-1)+n.substring(c.start+1):46===i&&void 0!==c.start&&(n=n.substring(0,c.start)+n.substring(c.start+1)):r&&(a=e.shiftKey,l=String.fromCharCode(e.keyCode),n+=l=a?l.toUpperCase():l.toLowerCase())),o=u.attr("placeholder"),!n&&o&&(n=o),(s=function(e,t){if(!e)return 0;var n=D("").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(e).appendTo("body");!function(e,t,n){var i,r,o={};if(n)for(i=0,r=n.length;i").addClass(g.wrapperClass).addClass(a).addClass(s),t=D("
").addClass(g.inputClass).addClass("items").appendTo(e),n=D('').appendTo(t).attr("tabindex",b.is(":disabled")?"-1":p.tabIndex),o=D(g.dropdownParent||e),i=D("
").addClass(g.dropdownClass).addClass(s).hide().appendTo(o),r=D("
").addClass(g.dropdownContentClass).appendTo(i),(c=b.attr("id"))&&(n.attr("id",c+"-selectized"),D("label[for='"+c+"']").attr("for",c+"-selectized")),p.settings.copyClassesToDropdown&&i.addClass(a),e.css({width:b[0].style.width}),p.plugins.names.length&&(l="plugin-"+p.plugins.names.join(" plugin-"),e.addClass(l),i.addClass(l)),(null===g.maxItems||1'+e.html+"
"},optgroup_header:function(e,t){return'
'+t(e[i])+"
"},option:function(e,t){return'
'+t(e[n])+"
"},item:function(e,t){return'
'+t(e[n])+"
"},option_create:function(e,t){return'
Add '+t(e.input)+"
"}};this.settings.render=D.extend({},e,this.settings.render)},setupCallbacks:function(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)n.hasOwnProperty(e)&&(t=this.settings[n[e]])&&this.on(e,t)},onClick:function(e){this.isFocused||(this.focus(),e.preventDefault())},onMouseDown:function(e){var t=this,n=e.isDefaultPrevented();D(e.target);if(t.isFocused){if(e.target!==t.$control_input[0])return"single"===t.settings.mode?t.isOpen?t.close():t.open():n||t.setActiveItem(null),!1}else n||window.setTimeout(function(){t.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(e){var r=this;r.isFull()||r.isInputHidden||r.isLocked?e.preventDefault():r.settings.splitOn&&setTimeout(function(){var e=r.$control_input.val();if(e.match(r.settings.splitOn))for(var t=D.trim(e).split(r.settings.splitOn),n=0,i=t.length;n=this.settings.maxItems},updateOriginalInput:function(e){var t,n,i,r,o=this;if(e=e||{},1===o.tagType){for(i=[],t=0,n=o.items.length;t'+a(r)+"");i.length||this.$input.attr("multiple")||i.push(''),o.$input.html(i.join(""))}else o.$input.val(o.getValue()),o.$input.attr("value",o.$input.val());o.isSetup&&(e.silent||o.trigger("change",o.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var e=this.$control_input;this.items.length?e.removeAttr("placeholder"):e.attr("placeholder",this.settings.placeholder),e.triggerHandler("update",{force:!0})}},open:function(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.focus(),e.isOpen=!0,e.refreshState(),e.$dropdown.css({visibility:"hidden",display:"block"}),e.positionDropdown(),e.$dropdown.css({visibility:"visible"}),e.trigger("dropdown_open",e.$dropdown))},close:function(){var e=this,t=e.isOpen;"single"===e.settings.mode&&e.items.length&&(e.hideInput(),e.$control_input.blur()),e.isOpen=!1,e.$dropdown.hide(),e.setActiveOption(null),e.refreshState(),t&&e.trigger("dropdown_close",e.$dropdown)},positionDropdown:function(){var e=this.$control,t="body"===this.settings.dropdownParent?e.offset():e.position();t.top+=e.outerHeight(!0),this.$dropdown.css({width:e.outerWidth(),top:t.top,left:t.left})},clear:function(e){var t=this;t.items.length&&(t.$control.children(":not(input)").remove(),t.items=[],t.lastQuery=null,t.setCaret(0),t.setActiveItem(null),t.updatePlaceholder(),t.updateOriginalInput({silent:e}),t.refreshState(),t.showInput(),t.trigger("clear"))},insertAtCaret:function(e){var t=Math.min(this.caretPos,this.items.length);0===t?this.$control.prepend(e):D(this.$control[0].childNodes[t]).before(e),this.setCaret(t+1)},deleteSelection:function(e){var t,n,i,r,o,s,a,l,c,u=this;if(i=e&&8===e.keyCode?-1:1,r=h(u.$control_input[0]),u.$activeOption&&!u.settings.hideSelected&&(a=u.getAdjacentOption(u.$activeOption,-1).attr("data-value")),o=[],u.$activeItems.length){for(c=u.$control.children(".active:"+(0
'+e.title+'×
'}},e),n.setup=(t=n.setup,function(){t.apply(n,arguments),n.$dropdown_header=D(e.html(e)),n.$dropdown.prepend(n.$dropdown_header)})}),y.define("optgroup_columns",function(a){var o,l=this;a=D.extend({equalizeWidth:!0,equalizeHeight:!0},a),this.getAdjacentOption=function(e,t){var n=e.closest("[data-group]").find("[data-selectable]"),i=n.index(e)+t;return 0<=i&&i
',e=e.firstChild,n.body.appendChild(e),t=c.width=e.offsetWidth-e.clientWidth,n.body.removeChild(e)),t},e=function(){var e,t,n,i,r,o,s;if((t=(s=D("[data-group]",l.$dropdown_content)).length)&&l.$dropdown_content.width()){if(a.equalizeHeight){for(e=n=0;e'+t.label+"",o.setup=(n=i.setup,function(){if(t.append){var r=i.settings.render.item;i.settings.render.item=function(e){return t=r.apply(o,arguments),n=s,i=t.search(/(<\/[^>]+>\s*)$/),t.substring(0,i)+n+t.substring(i);var t,n,i}}n.apply(o,arguments),o.$control.on("click","."+t.className,function(e){if(e.preventDefault(),!i.isLocked){var t=D(e.currentTarget).parent();i.setActiveItem(t),i.deleteSelection()&&i.setCaret(i.items.length)}})})):function(n,i){i.className="remove-single";var r,o=n,s=''+i.label+"";n.setup=(r=o.setup,function(){if(i.append){var e=D(o.$input.context).attr("id"),t=(D("#"+e),o.settings.render.item);o.settings.render.item=function(e){return t.apply(n,arguments)+s}}r.apply(n,arguments),n.$control.on("click","."+i.className,function(e){e.preventDefault(),o.isLocked||o.clear()})})}(this,e)}),y.define("restore_on_backspace",function(i){var r,e=this;i.text=i.text||function(e){return e[this.settings.labelField]},this.onKeyDown=(r=e.onKeyDown,function(e){var t,n;return 8===e.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&0<=(t=this.caretPos-1)&&t*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==q.supportPointer};for(var i in n)!(i in t)&&(t[i]=n[i]);for(var r in D(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&f,U(e,"mousedown",this._onTapStart),U(e,"touchstart",this._onTapStart),t.supportPointer&&U(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(U(e,"dragover",this),U(e,"dragenter",this)),x.push(this._onDragOver),t.store&&this.sort(t.store.get(this))}function W(e,t){"clone"!==e.lastPullMode&&(t=!0),S&&S.state!==t&&(K(S,"display",t?"none":""),t||S.state&&(e.options.group.revertClone?(O.insertBefore(S,I),e._animate(T,S)):O.insertBefore(S,T)),S.state=t)}function z(e,t,n){if(e){n=n||h;do{if(">*"===t&&e.parentNode===n||ne(e,t))return e}while(void 0,e=(r=(i=e).host)&&r.nodeType?r:i.parentNode)}var i,r;return null}function U(e,t,n){e.addEventListener(t,n,s)}function V(e,t,n){e.removeEventListener(t,n,s)}function Y(e,t,n){if(e)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(r," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(r," ")}}function K(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return h.defaultView&&h.defaultView.getComputedStyle?n=h.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in i||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function Q(e,t,n){if(e){var i=e.getElementsByTagName(t),r=0,o=i.length;if(n)for(;r*"!==t&&!ne(e,t)||n++;return n}function ne(e,t){if(e){var n=(t=t.split(".")).shift().toUpperCase(),i=new RegExp("\\s("+t.join("|")+")(?=\\s)","g");return!(""!==n&&e.nodeName.toUpperCase()!=n||t.length&&((" "+e.className+" ").match(i)||[]).length!=t.length)}return!1}function ie(e,t){var n,i;return function(){void 0===n&&(n=arguments,i=this,L(function(){1===n.length?e.call(i,n[0]):e.apply(i,n),n=void 0},t))}}function re(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function oe(e){return n&&n.dom?n.dom(e).cloneNode(!0):t?t(e).clone(!0)[0]:e.cloneNode(!0)}function se(e){return L(e,0)}function ae(e){return clearTimeout(e)}return q.prototype={constructor:q,_onTapStart:function(e){var t,n=this,i=this.el,r=this.options,o=r.preventOnFilter,s=e.type,a=e.touches&&e.touches[0],l=(a||e).target,c=e.target.shadowRoot&&e.path&&e.path[0]||l,u=r.filter;if(function(e){var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var i=t[n];i.checked&&C.push(i)}}(i),!T&&!(/mousedown|pointerdown/.test(s)&&0!==e.button||r.disabled)&&!c.isContentEditable&&(l=z(l,r.draggable,i))&&d!==l){if(t=te(l,r.draggable),"function"==typeof u){if(u.call(this,e,l,this))return X(n,c,"filter",l,i,i,t),void(o&&e.preventDefault())}else if(u&&(u=u.split(",").some(function(e){if(e=z(c,e.trim(),i))return X(n,e,"filter",l,i,i,t),!0})))return void(o&&e.preventDefault());r.handle&&!z(c,r.handle,i)||this._prepareDragStart(e,a,l,t)}},_prepareDragStart:function(e,t,n,i){var r,o=this,s=o.el,a=o.options,l=s.ownerDocument;n&&!T&&n.parentNode===s&&(u=e,O=s,k=(T=n).parentNode,I=T.nextSibling,d=n,M=a.group,c=i,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,T.style["will-change"]="all",r=function(){o._disableDelayedDrag(),T.draggable=o.nativeDraggable,Y(T,a.chosenClass,!0),o._triggerDragStart(e,t),X(o,O,"choose",T,O,O,c)},a.ignore.split(",").forEach(function(e){Q(T,e.trim(),J)}),U(l,"mouseup",o._onDrop),U(l,"touchend",o._onDrop),U(l,"touchcancel",o._onDrop),U(l,"selectstart",o),a.supportPointer&&U(l,"pointercancel",o._onDrop),a.delay?(U(l,"mouseup",o._disableDelayedDrag),U(l,"touchend",o._disableDelayedDrag),U(l,"touchcancel",o._disableDelayedDrag),U(l,"mousemove",o._disableDelayedDrag),U(l,"touchmove",o._disableDelayedDrag),a.supportPointer&&U(l,"pointermove",o._disableDelayedDrag),o._dragStartTimer=L(r,a.delay)):r())},_disableDelayedDrag:function(){var e=this.el.ownerDocument;clearTimeout(this._dragStartTimer),V(e,"mouseup",this._disableDelayedDrag),V(e,"touchend",this._disableDelayedDrag),V(e,"touchcancel",this._disableDelayedDrag),V(e,"mousemove",this._disableDelayedDrag),V(e,"touchmove",this._disableDelayedDrag),V(e,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(e,t){(t=t||("touch"==e.pointerType?e:null))?(u={target:T,clientX:t.clientX,clientY:t.clientY},this._onDragStart(u,"touch")):this.nativeDraggable?(U(T,"dragend",this),U(O,"dragstart",this._onDragStart)):this._onDragStart(u,!0);try{h.selection?se(function(){h.selection.empty()}):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(){if(O&&T){var e=this.options;Y(T,e.ghostClass,!0),Y(T,e.dragClass,!1),X(q.active=this,O,"start",T,O,O,c)}else this._nulling()},_emulateDragOver:function(){if(l){if(this._lastX===l.clientX&&this._lastY===l.clientY)return;this._lastX=l.clientX,this._lastY=l.clientY,p||K(E,"display","none");var e=h.elementFromPoint(l.clientX,l.clientY),t=e,n=x.length;if(e&&e.shadowRoot&&(t=e=e.shadowRoot.elementFromPoint(l.clientX,l.clientY)),t)do{if(t[j]){for(;n--;)x[n]({clientX:l.clientX,clientY:l.clientY,target:e,rootEl:t});break}e=t}while(t=t.parentNode);p||K(E,"display","")}},_onTouchMove:function(e){if(u){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,r=e.touches?e.touches[0]:e,o=r.clientX-u.clientX+i.x,s=r.clientY-u.clientY+i.y,a=e.touches?"translate3d("+o+"px,"+s+"px,0)":"translate("+o+"px,"+s+"px)";if(!q.active){if(n&&g(w(r.clientX-this._lastX),w(r.clientY-this._lastY))T.offsetWidth,y=t.offsetHeight>T.offsetHeight,b=.5<(m?(e.clientX-i.left)/p:(e.clientY-i.top)/g),_=t.nextElementSibling,w=!1;if(m){var C=T.offsetTop,x=t.offsetTop;w=C===x?t.previousElementSibling===T&&!v||b&&v:t.previousElementSibling===T||T.previousElementSibling===t?.5<(e.clientY-i.top)/g:C'+i+""),t.prev().height(t.height())},e.onload=function(e){t.html(''),t.height()<22?setTimeout(function(){t.prev().height(t.height())},20):t.prev().height(t.height())},e.src=n,$(t).next(".better-file-clear-checkbox")&&($(t).next(".better-file-clear-checkbox").prop("checked",!1),$(t).next().next().show()),!1}function modal_close(){"parentIFrame"in window&&window.parentIFrame.sendMessage("close")}!function(l){"use strict";if("undefined"!=typeof window){var e,c=0,u=!1,t=!1,v="message".length,y="[iFrameSizer]",b=y.length,_=null,o=window.requestAnimationFrame,d={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},w={},n=null,h={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){E("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}},C={};window.jQuery&&((e=window.jQuery).fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(n){return this.filter("iframe").each(function(e,t){f(t,n)}).end()}):k("","Unable to bind to jQuery, it is not fully loaded.")),"function"==typeof define&&define.amd?define([],L):"object"===("undefined"==typeof module?"undefined":_typeof(module))&&"object"===_typeof(module.exports)?module.exports=L():window.iFrameResize=window.iFrameResize||L()}function x(e,t,n){"addEventListener"in window?e.addEventListener(t,n,!1):"attachEvent"in window&&e.attachEvent("on"+t,n)}function D(e,t,n){"removeEventListener"in window?e.removeEventListener(t,n,!1):"detachEvent"in window&&e.detachEvent("on"+t,n)}function r(e){return y+"["+(n="Host page: "+(t=e),window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+t:"Nested host page: "+t),n)+"]";var t,n}function i(e){return w[e]?w[e].log:u}function T(e,t){s("log",e,t,i(e))}function k(e,t){s("info",e,t,i(e))}function E(e,t){s("warn",e,t,!0)}function s(e,t,n,i){!0===i&&"object"===_typeof(window.console)&&console[e](r(t),n)}function a(t){function s(){e("Height"),e("Width"),F(function(){M(g),A(m),h("resizedCallback",g)},g,"init")}function e(e){var t=Number(w[m]["max"+e]),n=Number(w[m]["min"+e]),i=e.toLowerCase(),r=Number(g[i]);T(m,"Checking "+i+" is in range "+n+"-"+t),rw[a]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}t("Height"),t("Width"),e("maxHeight"),e("minHeight"),e("maxWidth"),e("minWidth")}(),"number"!=typeof(w[a]&&w[a].bodyMargin)&&"0"!==(w[a]&&w[a].bodyMargin)||(w[a].bodyMarginV1=w[a].bodyMargin,w[a].bodyMargin=w[a].bodyMargin+"px"),r=H(a),x(n,"load",function(){var e,t;P("iFrame.onload",r,n,l,!0),e=w[a]&&w[a].firstRun,t=w[a]&&w[a].heightCalculationMethod in d,!e&&t&&$({iframe:n,height:0,width:0,type:"init"})}),P("init",r,n,l,!0),Function.prototype.bind&&w[a]&&(w[a].iframe.iFrameResizer={close:O.bind(null,w[a].iframe),resize:P.bind(null,"Window resize","resize",w[a].iframe),moveToAnchor:function(e){P("Move to anchor","moveToAnchor:"+e,w[a].iframe,a)},sendMessage:function(e){P("Send Message","message:"+(e=JSON.stringify(e)),w[a].iframe,a)}}))}function p(e,t){null===n&&(n=setTimeout(function(){n=null,e()},t))}function g(e){T("window","Trigger event: "+e),p(function(){j("Window "+e,"resize")},16)}function m(){"hidden"!==document.visibilityState&&(T("document","Trigger event: Visiblity change"),p(function(){j("Tab Visable","resize")},16))}function j(e,t){for(var n in w)w[i=n]&&"parent"===w[i].resizeFrom&&w[i].autoResize&&!w[i].firstRun&&P(e,t,document.getElementById(n),n);var i}function L(){function i(e,t){t&&(!function(){if(!t.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==t.tagName.toUpperCase())throw new TypeError("Expected