PageSourceSearch

https://summitchurch.com/Scripts/Bundles/RockLibs?v=foKG_lKLiyMx-FaTHcpg29jwlqPyJNScgT_C1ewCtaU1

js summitchurch.com collected 2026-09-24 10:29:45 UTC 519,527 bytes, 9,022 lines download raw bytes

1/* Minification failed. Returning unminified contents.
2(4216,25-30): run-time error JS1195: Expected expression: class
3(4216,44-45): run-time error JS1004: Expected ';': {
4(4216,92-93): run-time error JS1004: Expected ';': {
5(4216,186-187): run-time error JS1004: Expected ';': {
6(4216,472-473): run-time error JS1004: Expected ';': {
7(4216,1130-1135): run-time error JS1195: Expected expression: class
8(4216,1157-1158): run-time error JS1004: Expected ';': {
9(4216,1466-1467): run-time error JS1004: Expected ';': {
10(4216,1499-1500): run-time error JS1195: Expected expression: >
11(4216,1673-1674): run-time error JS1197: Too many errors. The file might not be a JavaScript file: ,
12(4216,1119-1129): run-time error JS1301: End of file encountered before function is properly closed: function()
13(4216,1674-1678): run-time error JS1004: Expected ';': this
14(4216,3107-3123): run-time error JS1004: Expected ';': set_default_text
15(4216,3125-3126): run-time error JS1004: Expected ';': {
16(4216,3690-3691): run-time error JS1004: Expected ';': {
17(4216,3756-3757): run-time error JS1014: Invalid character: `
18(4216,3757-3758): run-time error JS1195: Expected expression: <
19(4216,3758-3759): run-time error JS1197: Too many errors. The file might not be a JavaScript file: b
20(4216,3126-3674): run-time error JS1018: 'return' statement outside of function: return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||s.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||s.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||s.default_no_result_text
21 */
22/* This file fixes some issues caused by the Microsoft Ajax library which we
23 * don't have access to modify. It should be included early in the page. */
24
25
26/* Fix the String.prototype.startsWith function. Microsoft Ajax library
27 * loads in it's own version from an era before it was standard in browsers.
28 * But it's a broken version. */
29if (String.prototype.startsWith.toString().indexOf("function String$startsWith(") === 0) {
30    String.prototype.startsWith = function (searchString) {
31        var pos = parseInt(arguments.length > 1 ? arguments[1] : 0);
32
33        return this.indexOf(searchString, pos) === 0;
34    };
35}
36
37
38/* Fix the String.prototype.endsWith function. Microsoft Ajax library
39 * loads in it's own version from an era before it was standard in browsers.
40 * But it's a broken version.
41 * https://vanillajstoolkit.com/polyfills/stringendswith/
42 */
43if (String.prototype.endsWith.toString().indexOf("function String$endsWith(") === 0) {
44    String.prototype.endsWith = function (searchStr, position) {
45        // This works much better than >= because
46        // it compensates for NaN:
47        if (!(position < this.length)) {
48            position = this.length;
49        } else {
50            position |= 0; // round position
51        }
52        return this.substr(position - searchStr.length, searchStr.length) === searchStr;
53    };
54}
55;
56/*! jQuery UI - v1.12.1 - 2019-11-02
57* http://jqueryui.com
58* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/sortable.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/menu.js, widgets/mouse.js
59* Copyright jQuery Foundation and other contributors; Licensed MIT */
60
61(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}t.ui=t.ui||{},t.ui.version="1.12.1";var i=0,s=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}
vendor: 4,241 bytes, line 61
61,t.widget.extend=function(e){for(var i,n,o=s.call(arguments,1),a=0,r=o.length;r>a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),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()))})}
vendor: 6,613 bytes, line 61
61,_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,u=h[2];u?n.on(l,u,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])*(c.test(t[0])?e/100:1),parseFloat(t[1])*(c.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]+)?%?/,u=/^\w+/,c=/%$/,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 c,p,f,m,g,v,_=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),x={};return v=s(_),_[0].preventDefault&&(n.at="left top"),p=v.width,f=v.height,m=v.offset,g=t.extend({},m),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]),x[this]=[t?t[0]:0,e?e[0]:0],n[this]=[u.exec(i[0])[0],u.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?g.left+=p:"center"===n.at[0]&&(g.left+=p/2),"bottom"===n.at[1]?g.top+=f:"center"===n.at[1]&&(g.top+=f/2),c=e(x.at,p,f),g.left+=c[0],g.top+=c[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),u=h.outerHeight(),d=i(this,"marginLeft"),v=i(this,"marginTop"),k=l+d+i(this,"marginRight")+y.width,C=u+v+i(this,"marginBottom")+y.height,D=t.extend({},g),T=e(x.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-=u:"center"===n.my[1]&&(D.top-=u/2),D.left+=T[0],D.top+=T[1],s={marginLeft:d,marginTop:v},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:u,collisionPosition:s,collisionWidth:k,collisionHeight:C,offset:[c[0]+T[0],c[1]+T[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=m.left-D.left,i=e+p-l,s=m.top-D.top,r=s+f-u,c={target:{element:_,left:m.left,top:m.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:u},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(c.horizontal="center"),u>f&&f>a(s+r)&&(c.vertical="middle"),c.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,c)}),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>
61=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,u=l-h,c=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>u?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(u)>i)&&(t.left+=d+p+f)):c>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||c>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,u=l-h,c=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,m=-2*e.offset[1];0>u?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(u)>s)&&(t.top+=p+f+m)):c>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||c>a(i))&&(t.top+=p+f+m))}},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")}}),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")}}},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
vendor: 28,068 bytes, lines 61-62
61)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!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(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&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(),n=!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,n=!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.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,u=this.offset.click.left,c="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+u>o&&a>e+u,p=c&&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,u=this.items,c=[[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&&(c.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=c.length-1;i>=0;i--)for(a=c[i][1],r=c[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),u.push({item:h,instance:a,width:0,height:0,left:0,top:0})
62},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,u,c,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,u=d.floating||this._isFloating(this.currentItem),a=u?"left":"top",r=u?"width":"height",c=u?"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[c]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[c]-h)&&(n=Math.abs(e[c]-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.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"}
vendor: 6,828 bytes, line 62
62,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","fal
62se")},_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(
vendor: 4,123 bytes, line 62
62)},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))}
62,_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 o=/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")
63},_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;
vendor: 4,188 bytes, line 63
63return{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 a=i.options.classes[n]||"";a=t.trim(a.replace(o,"")),s[n]=(a+" "+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.iconS
vendor: 3,270 bytes, line 63
63pace.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.iconS
63pace||(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});
64;
65/*!
66 * Bootstrap v3.4.1 (https://getbootstrap.com/)
67 * Copyright 2011-2019 Twitter, Inc.
68 * Licensed under the MIT license
69 */
70if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");
vendor: 4,440 bytes, line 70
70i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".
70item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","fal
70se"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("key
70down.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;
vendor: 16,510 bytes, line 70
70n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;
70e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);
71;
72/*!
73 * Timepicker Component for Twitter Bootstrap
74 *
75 * Copyright 2013 Joris de Wit and bootstrap-timepicker contributors
76 *
77 * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
78 *
79 * For the full copyright and license information, please view the LICENSE
80 * file that was distributed with this source code.
81 */
82(function($, window, document) {
83  'use strict';
84
85  // TIMEPICKER PUBLIC CLASS DEFINITION
86  var Timepicker = function(element, options) {
87    this.widget = '';
88    this.$element = $(element);
89    this.defaultTime = options.defaultTime;
90    this.disableFocus = options.disableFocus;
91    this.disableMousewheel = options.disableMousewheel;
92    this.isOpen = options.isOpen;
93    this.minuteStep = options.minuteStep;
94    this.modalBackdrop = options.modalBackdrop;
95    this.orientation = options.orientation;
96    this.secondStep = options.secondStep;
97    this.snapToStep = options.snapToStep;
98    this.showInputs = options.showInputs;
99    this.showMeridian = options.showMeridian;
100    this.showSeconds = options.showSeconds;
101    this.template = options.template;
102    this.appendWidgetTo = options.appendWidgetTo;
103    this.showWidgetOnAddonClick = options.showWidgetOnAddonClick;
104    this.icons = options.icons;
105    this.maxHours = options.maxHours;
106    this.explicitMode = options.explicitMode; // If true 123 = 1:23, 12345 = 1:23:45, else invalid.
107
108    this.handleDocumentClick = function (e) {
109      var self = e.data.scope;
110      // This condition was inspired by bootstrap-datepicker.
111      // The element the timepicker is invoked on is the input but it has a sibling for addon/button.
112      if (!(self.$element.parent().find(e.target).length ||
113          self.$widget.is(e.target) ||
114          self.$widget.find(e.target).length)) {
115        self.hideWidget();
116      }
117    };
118
119    this._init();
120  };
121
122  Timepicker.prototype = {
123
124    constructor: Timepicker,
125    _init: function() {
126      var self = this;
127
128      if (this.showWidgetOnAddonClick && (this.$element.parent().hasClass('input-group') && this.$element.parent().hasClass('bootstrap-timepicker'))) {
129        this.$element.parent('.input-group.bootstrap-timepicker').find('.input-group-addon').on({
130          'click.timepicker': $.proxy(this.showWidget, this)
131        });
132        this.$element.on({
133          'focus.timepicker': $.proxy(this.highlightUnit, this),
134          'click.timepicker': $.proxy(this.highlightUnit, this),
135          'keydown.timepicker': $.proxy(this.elementKeydown, this),
136          'blur.timepicker': $.proxy(this.blurElement, this),
137          'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this)
138        });
139      } else {
140        if (this.template) {
141          this.$element.on({
142            'focus.timepicker': $.proxy(this.showWidget, this),
143            'click.timepicker': $.proxy(this.showWidget, this),
144            'blur.timepicker': $.proxy(this.blurElement, this),
145            'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this)
146          });
147        } else {
148          this.$element.on({
149            'focus.timepicker': $.proxy(this.highlightUnit, this),
150            'click.timepicker': $.proxy(this.highlightUnit, this),
151            'keydown.timepicker': $.proxy(this.elementKeydown, this),
152            'blur.timepicker': $.proxy(this.blurElement, this),
153            'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this)
154          });
155        }
156      }
157
158      if (this.template !== false) {
159        this.$widget = $(this.getTemplate()).on('click', $.proxy(this.widgetClick, this));
160      } else {
161        this.$widget = false;
162      }
163
164      if (this.showInputs && this.$widget !== false) {
165        this.$widget.find('input').each(function() {
166          $(this).on({
167            'click.timepicker': function() { $(this).select(); },
168            'keydown.timepicker': $.proxy(self.widgetKeydown, self),
169            'keyup.timepicker': $.proxy(self.widgetKeyup, self)
170          });
171        });
172      }
173
174      this.setDefaultTime(this.defaultTime);
175    },
176
177    blurElement: function() {
178      this.highlightedUnit = null;
179      this.updateFromElementVal();
180    },
181
182    clear: function() {
183      this.hour = '';
184      this.minute = '';
185      this.second = '';
186      this.meridian = '';
187
188      this.$element.val('');
189    },
190
191    decrementHour: function() {
192      if (this.showMeridian) {
193        if (this.hour === 1) {
194          this.hour = 12;
195        } else if (this.hour === 12) {
196          this.hour--;
197
198          return this.toggleMeridian();
199        } else if (this.hour === 0) {
200          this.hour = 11;
201
202          return this.toggleMeridian();
203        } else {
204          this.hour--;
205        }
206      } else {
207        if (this.hour <= 0) {
208          this.hour = this.maxHours - 1;
209        } else {
210          this.hour--;
211        }
212      }
213    },
214
215    decrementMinute: function(step) {
216      var newVal;
217
218      if (step) {
219        newVal = this.minute - step;
220      } else {
221        newVal = this.minute - this.minuteStep;
222      }
223
224      if (newVal < 0) {
225        this.decrementHour();
226        this.minute = newVal + 60;
227      } else {
228        this.minute = newVal;
229      }
230    },
231
232    decrementSecond: function() {
233      var newVal = this.second - this.secondStep;
234
235      if (newVal < 0) {
236        this.decrementMinute(true);
237        this.second = newVal + 60;
238      } else {
239        this.second = newVal;
240      }
241    },
242
243    elementKeydown: function(e) {
244      switch (e.which) {
245      case 9: //tab
246        if (e.shiftKey) {
247          if (this.highlightedUnit === 'hour') {
248            this.hideWidget();
249            break;
250          }
251          this.highlightPrevUnit();
252        } else if ((this.showMeridian && this.highlightedUnit === 'meridian') || (this.showSeconds && this.highlightedUnit === 'second') || (!this.showMeridian && !this.showSeconds && this.highlightedUnit ==='minute')) {
253          this.hideWidget();
254          break;
255        } else {
256          this.highlightNextUnit();
257        }
258        e.preventDefault();
259        this.updateFromElementVal();
260        break;
261      case 27: // escape
262        this.updateFromElementVal();
263        break;
264      case 37: // left arrow
265        e.preventDefault();
266        this.highlightPrevUnit();
267        this.updateFromElementVal();
268        break;
269      case 38: // up arrow
270        e.preventDefault();
271        switch (this.highlightedUnit) {
272        case 'hour':
273          this.incrementHour();
274          this.highlightHour();
275          break;
276        case 'minute':
277          this.incrementMinute();
278          this.highlightMinute();
279          break;
280        case 'second':
281          this.incrementSecond();
282          this.highlightSecond();
283          break;
284        case 'meridian':
285          this.toggleMeridian();
286          this.highlightMeridian();
287          break;
288        }
289        this.update();
290        break;
291      case 39: // right arrow
292        e.preventDefault();
293        this.highlightNextUnit();
294        this.updateFromElementVal();
295        break;
296      case 40: // down arrow
297        e.preventDefault();
298        switch (this.highlightedUnit) {
299        case 'hour':
300          this.decrementHour();
301          this.highlightHour();
302          break;
303        case 'minute':
304          this.decrementMinute();
305          this.highlightMinute();
306          break;
307        case 'second':
308          this.decrementSecond();
309          this.highlightSecond();
310          break;
311        case 'meridian':
312          this.toggleMeridian();
313          this.highlightMeridian();
314          break;
315        }
316
317        this.update();
318        break;
319      }
320    },
321
322    getCursorPosition: function() {
323      var input = this.$element.get(0);
324
325      if ('selectionStart' in input) {// Standard-compliant browsers
326
327        return input.selectionStart;
328      } else if (document.selection) {// IE fix
329        input.focus();
330        var sel = document.selection.createRange(),
331          selLen = document.selection.createRange().text.length;
332
333        sel.moveStart('character', - input.value.length);
334
335        return sel.text.length - selLen;
336      }
337    },
338
339    getTemplate: function() {
340      var template,
341        hourTemplate,
342        minuteTemplate,
343        secondTemplate,
344        meridianTemplate,
345        templateContent;
346
347      if (this.showInputs) {
348        hourTemplate = '<input type="text" class="bootstrap-timepicker-hour" maxlength="2"/>';
349        minuteTemplate = '<input type="text" class="bootstrap-timepicker-minute" maxlength="2"/>';
350        secondTemplate = '<input type="text" class="bootstrap-timepicker-second" maxlength="2"/>';
351        meridianTemplate = '<input type="text" class="bootstrap-timepicker-meridian" maxlength="2"/>';
352      } else {
353        hourTemplate = '<span class="bootstrap-timepicker-hour"></span>';
354        minuteTemplate = '<span class="bootstrap-timepicker-minute"></span>';
355        secondTemplate = '<span class="bootstrap-timepicker-second"></span>';
356        meridianTemplate = '<span class="bootstrap-timepicker-meridian"></span>';
357      }
358
359      templateContent = '<table>'+
360         '<tr>'+
361           '<td><a href="#" data-action="incrementHour"><span class="'+ this.icons.up +'"></span></a></td>'+
362           '<td class="separator">&nbsp;</td>'+
363           '<td><a href="#" data-action="incrementMinute"><span class="'+ this.icons.up +'"></span></a></td>'+
364           (this.showSeconds ?
365             '<td class="separator">&nbsp;</td>'+
366             '<td><a href="#" data-action="incrementSecond"><span class="'+ this.icons.up +'"></span></a></td>'
367           : '') +
368           (this.showMeridian ?
369             '<td class="separator">&nbsp;</td>'+
370             '<td class="meridian-column"><a href="#" data-action="toggleMeridian"><span class="'+ this.icons.up +'"></span></a></td>'
371           : '') +
372         '</tr>'+
373         '<tr>'+
374           '<td>'+ hourTemplate +'</td> '+
375           '<td class="separator">:</td>'+
376           '<td>'+ minuteTemplate +'</td> '+
377           (this.showSeconds ?
378            '<td class="separator">:</td>'+
379            '<td>'+ secondTemplate +'</td>'
380           : '') +
381           (this.showMeridian ?
382            '<td class="separator">&nbsp;</td>'+
383            '<td>'+ meridianTemplate +'</td>'
384           : '') +
385         '</tr>'+
386         '<tr>'+
387           '<td><a href="#" data-action="decrementHour"><span class="'+ this.icons.down +'"></span></a></td>'+
388           '<td class="separator"></td>'+
389           '<td><a href="#" data-action="decrementMinute"><span class="'+ this.icons.down +'"></span></a></td>'+
390           (this.showSeconds ?
391            '<td class="separator">&nbsp;</td>'+
392            '<td><a href="#" data-action="decrementSecond"><span class="'+ this.icons.down +'"></span></a></td>'
393           : '') +
394           (this.showMeridian ?
395            '<td class="separator">&nbsp;</td>'+
396            '<td><a href="#" data-action="toggleMeridian"><span class="'+ this.icons.down +'"></span></a></td>'
397           : '') +
398         '</tr>'+
399       '</table>';
400
401      switch(this.template) {
402      case 'modal':
403        template = '<div class="bootstrap-timepicker-widget modal hide fade in" data-backdrop="'+ (this.modalBackdrop ? 'true' : 'false') +'">'+
404          '<div class="modal-header">'+
405            '<a href="#" class="close" data-dismiss="modal">&times;</a>'+
406            '<h3>
406Pick a Time</h3>'+
407          '</div>'+
408          '<div class="modal-content">'+
409            templateContent +
410          '</div>'+
411          '<div class="modal-footer">'+
412            '<a href="#" class="btn btn-primary" data-dismiss="modal">OK</a>'+
413          '</div>'+
414        '</div>';
415        break;
416      case 'dropdown':
417        template = '<div class="bootstrap-timepicker-widget dropdown-menu">'+ templateContent +'</div>';
418        break;
419      }
420
421      return template;
422    },
423
424    getTime: function() {
425      if (this.hour === '') {
426        return '';
427      }
428
429      return this.hour + ':' + (this.minute.toString().length === 1 ? '0' + this.minute : this.minute) + (this.showSeconds ? ':' + (this.second.toString().length === 1 ? '0' + this.second : this.second) : '') + (this.showMeridian ? ' ' + this.meridian : '');
430    },
431
432    hideWidget: function() {
433      if (this.isOpen === false) {
434        return;
435      }
436
437      this.$element.trigger({
438        'type': 'hide.timepicker',
439        'time': {
440          'value': this.getTime(),
441          'hours': this.hour,
442          'minutes': this.minute,
443          'seconds': this.second,
444          'meridian': this.meridian
445        }
446      });
447
448      if (this.template === 'modal' && this.$widget.modal) {
449        this.$widget.modal('hide');
450      } else {
451        this.$widget.removeClass('open');
452      }
453
454      $(document).off('mousedown.timepicker, touchend.timepicker', this.handleDocumentClick);
455
456      this.isOpen = false;
457      // show/hide approach taken by datepicker
458      this.$widget.detach();
459    },
460
461    highlightUnit: function() {
462      this.position = this.getCursorPosition();
463      if (this.position >= 0 && this.position <= 2) {
464        this.highlightHour();
465      } else if (this.position >= 3 && this.position <= 5) {
466        this.highlightMinute();
467      } else if (this.position >= 6 && this.position <= 8) {
468        if (this.showSeconds) {
469          this.highlightSecond();
470        } else {
471          this.highlightMeridian();
472        }
473      } else if (this.position >= 9 && this.position <= 11) {
474        this.highlightMeridian();
475      }
476    },
477
478    highlightNextUnit: function() {
479      switch (this.highlightedUnit) {
480      case 'hour':
481        this.highlightMinute();
482        break;
483      case 'minute':
484        if (this.showSeconds) {
485          this.highlightSecond();
486        } else if (this.showMeridian){
487          this.highlightMeridian();
488        } else {
489          this.highlightHour();
490        }
491        break;
492      case 'second':
493        if (this.showMeridian) {
494          this.highlightMeridian();
495        } else {
496          this.highlightHour();
497        }
498        break;
499      case 'meridian':
500        this.highlightHour();
501        break;
502      }
503    },
504
505    highlightPrevUnit: function() {
506      switch (this.highlightedUnit) {
507      case 'hour':
508        if(this.showMeridian){
509          this.highlightMeridian();
510        } else if (this.showSeconds) {
511          this.highlightSecond();
512        } else {
513          this.highlightMinute();
514        }
515        break;
516      case 'minute':
517        this.highlightHour();
518        break;
519      case 'second':
520        this.highlightMinute();
521        break;
522      case 'meridian':
523        if (this.showSeconds) {
524          this.highlightSecond();
525        } else {
526          this.highlightMinute();
527        }
528        break;
529      }
530    },
531
532    highlightHour: function() {
533      var $element = this.$element.get(0),
534          self = this;
535
536      this.highlightedUnit = 'hour';
537
538      if ($element.setSelectionRange) {
539        setTimeout(function() {
540          if (self.hour < 10) {
541            $element.setSelectionRange(0,1);
542          } else {
543            $element.setSelectionRange(0,2);
544          }
545        }, 0);
546      }
547    },
548
549    highlightMinute: function() {
550      var $element = this.$element.get(0),
551          self = this;
552
553      this.highlightedUnit = 'minute';
554
555      if ($element.setSelectionRange) {
556        setTimeout(function() {
557          if (self.hour < 10) {
558            $element.setSelectionRange(2,4);
559          } else {
560            $element.setSelectionRange(3,5);
561          }
562        }, 0);
563      }
564    },
565
566    highlightSecond: function() {
567      var $element = this.$element.get(0),
568          self = this;
569
570      this.highlightedUnit = 'second';
571
572      if ($element.setSelectionRange) {
573        setTimeout(function() {
574          if (self.hour < 10) {
575            $element.setSelectionRange(5,7);
576          } else {
577            $element.setSelectionRange(6,8);
578          }
579        }, 0);
580      }
581    },
582
583    highlightMeridian: function() {
584      var $element = this.$element.get(0),
585          self = this;
586
587      this.highlightedUnit = 'meridian';
588
589      if ($element.setSelectionRange) {
590        if (this.showSeconds) {
591          setTimeout(function() {
592            if (self.hour < 10) {
593              $element.setSelectionRange(8,10);
594            } else {
595              $element.setSelectionRange(9,11);
596            }
597          }, 0);
598        } else {
599          setTimeout(function() {
600            if (self.hour < 10) {
601              $element.setSelectionRange(5,7);
602            } else {
603              $element.setSelectionRange(6,8);
604            }
605          }, 0);
606        }
607      }
608    },
609
610    incrementHour: function() {
611      if (this.showMeridian) {
612        if (this.hour === 11) {
613          this.hour++;
614          return this.toggleMeridian();
615        } else if (this.hour === 12) {
616          this.hour = 0;
617        }
618      }
619      if (this.hour === this.maxHours - 1) {
620        this.hour = 0;
621
622        return;
623      }
624      this.hour++;
625    },
626
627    incrementMinute: function(step) {
628      var newVal;
629
630      if (step) {
631        newVal = this.minute + step;
632      } else {
633        newVal = this.minute + this.minuteStep - (this.minute % this.minuteStep);
634      }
635
636      if (newVal > 59) {
637        this.incrementHour();
638        this.minute = newVal - 60;
639      } else {
640        this.minute = newVal;
641      }
642    },
643
644    incrementSecond: function() {
645      var newVal = this.second + this.secondStep - (this.second % this.secondStep);
646
647      if (newVal > 59) {
648        this.incrementMinute(true);
649        this.second = newVal - 60;
650      } else {
651        this.second = newVal;
652      }
653    },
654
655    mousewheel: function(e) {
656      if (this.disableMousewheel) {
657        return;
658      }
659
660      e.preventDefault();
661      e.stopPropagation();
662
663      var delta = e.originalEvent.wheelDelta || -e.originalEvent.detail,
664          scrollTo = null;
665
666      if (e.type === 'mousewheel') {
667        scrollTo = (e.originalEvent.wheelDelta * -1);
668      }
669      else if (e.type === 'DOMMouseScroll') {
670        scrollTo = 40 * e.originalEvent.detail;
671      }
672
673      if (scrollTo) {
674        e.preventDefault();
675        $(this).scrollTop(scrollTo + $(this).scrollTop());
676      }
677
678      switch (this.highlightedUnit) {
679      case 'minute':
680        if (delta > 0) {
681          this.incrementMinute();
682        } else {
683          this.decrementMinute();
684        }
685        this.highlightMinute();
686        break;
687      case 'second':
688        if (delta > 0) {
689          this.incrementSecond();
690        } else {
691          this.decrementSecond();
692        }
693        this.highlightSecond();
694        break;
695      case 'meridian':
696        this.toggleMeridian();
697        this.highlightMeridian();
698        break;
699      default:
700        if (delta > 0) {
701          this.incrementHour();
702        } else {
703          this.decrementHour();
704        }
705        this.highlightHour();
706        break;
707      }
708
709      return false;
710    },
711
712    /**
713     * Given a segment value like 43, will round and snap the segment
714     * to the nearest "step", like 45 if step is 15. Segment will
715     * "overflow" to 0 if it's larger than 59 or would otherwise
716     * round up to 60.
717     */
718    changeToNearestStep: function (segment, step) {
719      if (segment % step === 0) {
720        return segment;
721      }
722      if (Math.round((segment % step) / step)) {
723        return (segment + (step - segment % step)) % 60;
724      } else {
725        return segment - segment % step;
726      }
727    },
728
729    // This method was adapted from bootstrap-datepicker.
730    place : function() {
731      if (this.isInline) {
732        return;
733      }
734      var widgetWidth = this.$widget.outerWidth(), widgetHeight = this.$widget.outerHeight(), visualPadding = 10, windowWidth =
735        $(window).width(), windowHeight = $(window).height(), scrollTop = $(window).scrollTop();
736
737      var zIndex = parseInt(this.$element.parents().filter(function() { return $(this).css('z-index') !== 'auto'; }).first().css('z-index'), 10) + 10;
738      var offset = this.component ? this.component.parent().offset() : this.$element.offset();
739      var height = this.component ? this.component.outerHeight(true) : this.$element.outerHeight(false);
740      var width = this.component ? this.component.outerWidth(true) : this.$element.outerWidth(false);
741      var left = offset.left, top = offset.top;
742
743      this.$widget.removeClass('timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left');
744
745      if (this.orientation.x !== 'auto') {
746        this.$widget.addClass('timepicker-orient-' + this.orientation.x);
747        if (this.orientation.x === 'right') {
748          left -= widgetWidth - width;
749        }
750      } else{
751        // auto x orientation is best-placement: if it crosses a window edge, fudge it sideways
752        // Default to left
753        this.$widget.addClass('timepicker-orient-left');
754        if (offset.left < 0) {
755          left -= offset.left - visualPadding;
756        } else if (offset.left + widgetWidth > windowWidth) {
757          left = windowWidth - widgetWidth - visualPadding;
758        }
759      }
760      // auto y orientation is best-situation: top or bottom, no fudging, decision based on which shows more of the widget
761      var yorient = this.orientation.y, topOverflow, bottomOverflow;
762      if (yorient === 'auto') {
763        topOverflow = -scrollTop + offset.top - widgetHeight;
764        bottomOverflow = scrollTop + windowHeight - (offset.top + height + widgetHeight);
765        if (Math.max(topOverflow, bottomOverflow) === bottomOverflow) {
766          yorient = 'top';
767        } else {
768          yorient = 'bottom';
769        }
770      }
771      this.$widget.addClass('timepicker-orient-' + yorient);
772      if (yorient === 'top'){
773        top += height;
774      } else{
775        top -= widgetHeight + parseInt(this.$widget.css('padding-top'), 10);
776      }
777
778      this.$widget.css({
779        top : top,
780        left : left,
781        zIndex : zIndex
782      });
783    },
784
785    remove: function() {
786      $('document').off('.timepicker');
787      if (this.$widget) {
788        this.$widget.remove();
789      }
790      delete this.$element.data().timepicker;
791    },
792
793    setDefaultTime: function(defaultTime) {
794      if (!this.$element.val()) {
795        if (defaultTime === 'current') {
796          var dTime = new Date(),
797            hours = dTime.getHours(),
798            minutes = dTime.getMinutes(),
799            seconds = dTime.getSeconds(),
800            meridian = 'AM';
801
802          if (seconds !== 0) {
803            seconds = Math.ceil(dTime.getSeconds() / this.secondStep) * this.secondStep;
804            if (seconds === 60) {
805              minutes += 1;
806              seconds = 0;
807            }
808          }
809
810          if (minutes !== 0) {
811            minutes = Math.ceil(dTime.getMinutes() / this.minuteStep) * this.minuteStep;
812            if (minutes === 60) {
813              hours += 1;
814              minutes = 0;
815            }
816          }
817
818          if (this.showMeridian) {
819            if (hours === 0) {
820              hours = 12;
821            } else if (hours >= 12) {
822              if (hours > 12) {
823                hours = hours - 12;
824              }
825              meridian = 'PM';
826            } else {
827              meridian = 'AM';
828            }
829          }
830
831          this.hour = hours;
832          this.minute = minutes;
833          this.second = seconds;
834          this.meridian = meridian;
835
836          this.update();
837
838        } else if (defaultTime === false) {
839          this.hour = 0;
840          this.minute = 0;
841          this.second = 0;
842          this.meridian = 'AM';
843        } else {
844          this.setTime(defaultTime);
845        }
846      } else {
847        this.updateFromElementVal();
848      }
849    },
850
851    setTime: function(time, ignoreWidget) {
852      if (!time) {
853        this.clear();
854        return;
855      }
856
857      var timeMode,
858          timeArray,
859          hour,
860          minute,
861          second,
862          meridian;
863
864      if (typeof time === 'object' && time.getMonth){
865        // this is a date object
866        hour    = time.getHours();
867        minute  = time.getMinutes();
868        second  = time.getSeconds();
869
870        if (this.showMeridian){
871          meridian = 'AM';
872          if (hour > 12){
873            meridian = 'PM';
874            hour = hour % 12;
875          }
876
877          if (hour === 12){
878            meridian = 'PM';
879          }
880        }
881      } else {
882        timeMode = ((/a/i).test(time) ? 1 : 0) + ((/p/i).test(time) ? 2 : 0); // 0 = none, 1 = AM, 2 = PM, 3 = BOTH.
883        if (timeMode > 2) { // If both are present, fail.
884          this.clear();
885          return;
886        }
887
888        timeArray = time.replace(/[^0-9\:]/g, '').split(':');
889
890        hour = timeArray[0] ? timeArray[0].toString() : timeArray.toString();
891
892        if(this.explicitMode && hour.length > 2 && (hour.length % 2) !== 0 ) {
893          this.clear();
894          return;
895        }
896
897        minute = timeArray[1] ? timeArray[1].toString() : '';
898        second = timeArray[2] ? timeArray[2].toString() : '';
899
900        // adaptive time parsing
901        if (hour.length > 4) {
902          second = hour.slice(-2);
903          hour = hour.slice(0, -2);
904        }
905
906        if (hour.length > 2) {
907          minute = hour.slice(-2);
908          hour = hour.slice(0, -2);
909        }
910
911        if (minute.length > 2) {
912          second = minute.slice(-2);
913          minute = minute.slice(0, -2);
914        }
915
916        hour = parseInt(hour, 10);
917        minute = parseInt(minute, 10);
918        second = parseInt(second, 10);
919
920        if (isNaN(hour)) {
921          hour = 0;
922        }
923        if (isNaN(minute)) {
924          minute = 0;
925        }
926        if (isNaN(second)) {
927          second = 0;
928        }
929
930        // Adjust the time based upon unit boundary.
931        // NOTE: Negatives will never occur due to time.replace() above.
932        if (second > 59) {
933          second = 59;
934        }
935
936        if (minute > 59) {
937          minute = 59;
938        }
939
940        if (hour >= this.maxHours) {
941          // No day/date handling.
942          hour = this.maxHours - 1;
943        }
944
945        if (this.showMeridian) {
946          if (hour > 12) {
947            // Force PM.
948            timeMode = 2;
949            hour -= 12;
950          }
951          if (!timeMode) {
952            timeMode = 1;
953          }
954          if (hour === 0) {
955            hour = 12; // AM or PM, reset to 12.  0 AM = 12 AM.  0 PM = 12 PM, etc.
956          }
957          meridian = timeMode === 1 ? 'AM' : 'PM';
958        } else if (hour < 12 && timeMode === 2) {
959          hour += 12;
960        } else {
961          if (hour >= this.maxHours) {
962            hour = this.maxHours - 1;
963          } else if ((hour < 0) || (hour === 12 && timeMode === 1)){
964            hour = 0;
965          }
966        }
967      }
968
969      this.hour = hour;
970      if (this.snapToStep) {
971        this.minute = this.changeToNearestStep(minute, this.minuteStep);
972        this.second = this.changeToNearestStep(second, this.secondStep);
973      } else {
974        this.minute = minute;
975        this.second = second;
976      }
977      this.meridian = meridian;
978
979      this.update(ignoreWidget);
980    },
981
982    showWidget: function() {
983      if (this.isOpen) {
984        return;
985      }
986
987      if (this.$element.is(':disabled')) {
988        return;
989      }
990
991      // show/hide approach taken by datepicker
992      this.$widget.appendTo(this.appendWidgetTo);
993      $(document).on('mousedown.timepicker, touchend.timepicker', {scope: this}, this.handleDocumentClick);
994
995      this.$element.trigger({
996        'type': 'show.timepicker',
997        'time': {
998          'value': this.getTime(),
999          'hours': this.hour,
1000          'minutes': this.minute,
1001          'seconds': this.second,
1002          'meridian': this.meridian
1003        }
1004      });
1005
1006      this.place();
1007      if (this.disableFocus) {
1008        this.$element.blur();
1009      }
1010
1011      // widget shouldn't be empty on open
1012      if (this.hour === '') {
1013        if (this.defaultTime) {
1014          this.setDefaultTime(this.defaultTime);
1015        } else {
1016          this.setTime('0:0:0');
1017        }
1018      }
1019
1020      if (this.template === 'modal' && this.$widget.modal) {
1021        this.$widget.modal('show').on('hidden', $.proxy(this.hideWidget, this));
1022      } else {
1023        if (this.isOpen === false) {
1024          this.$widget.addClass('open');
1025        }
1026      }
1027
1028      this.isOpen = true;
1029    },
1030
1031    toggleMeridian: function() {
1032      this.meridian = this.meridian === 'AM' ? 'PM' : 'AM';
1033    },
1034
1035    update: function(ignoreWidget) {
1036      this.updateElement();
1037      if (!ignoreWidget) {
1038        this.updateWidget();
1039      }
1040
1041      this.$element.trigger({
1042        'type': 'changeTime.timepicker',
1043        'time': {
1044          'value': this.getTime(),
1045          'hours': this.hour,
1046          'minutes': this.minute,
1047          'seconds': this.second,
1048          'meridian': this.meridian
1049        }
1050      });
1051    },
1052
1053    updateElement: function() {
1054      this.$element.val(this.getTime()).change();
1055    },
1056
1057    updateFromElementVal: function() {
1058      this.setTime(this.$element.val());
1059    },
1060
1061    updateWidget: function() {
1062      if (this.$widget === false) {
1063        return;
1064      }
1065
1066      var hour = this.hour,
1067          minute = this.minute.toString().length === 1 ? '0' + this.minute : this.minute,
1068          second = this.second.toString().length === 1 ? '0' + this.second : this.second;
1069
1070      if (this.showInputs) {
1071        this.$widget.find('input.bootstrap-timepicker-hour').val(hour);
1072        this.$widget.find('input.bootstrap-timepicker-minute').val(minute);
1073
1074        if (this.showSeconds) {
1075          this.$widget.find('input.bootstrap-timepicker-second').val(second);
1076        }
1077        if (this.showMeridian) {
1078          this.$widget.find('input.bootstrap-timepicker-meridian').val(this.meridian);
1079        }
1080      } else {
1081        this.$widget.find('span.bootstrap-timepicker-hour').text(hour);
1082        this.$widget.find('span.bootstrap-timepicker-minute').text(minute);
1083
1084        if (this.showSeconds) {
1085          this.$widget.find('span.bootstrap-timepicker-second').text(second);
1086        }
1087        if (this.showMeridian) {
1088          this.$widget.find('span.bootstrap-timepicker-meridian').text(this.meridian);
1089        }
1090      }
1091    },
1092
1093    updateFromWidgetInputs: function() {
1094      if (this.$widget === false) {
1095        return;
1096      }
1097
1098      var t = this.$widget.find('input.bootstrap-timepicker-hour').val() + ':' +
1099              this.$widget.find('input.bootstrap-timepicker-minute').val() +
1100              (this.showSeconds ? ':' + this.$widget.find('input.bootstrap-timepicker-second').val() : '') +
1101              (this.showMeridian ? this.$widget.find('input.bootstrap-timepicker-meridian').val() : '')
1102      ;
1103
1104      this.setTime(t, true);
1105    },
1106
1107    widgetClick: function(e) {
1108      e.stopPropagation();
1109      e.preventDefault();
1110
1111      var $input = $(e.target),
1112          action = $input.closest('a').data('action');
1113
1114      if (action) {
1115        this[action]();
1116      }
1117      this.update();
1118
1119      if ($input.is('input')) {
1120        $input.get(0).setSelectionRange(0,2);
1121      }
1122    },
1123
1124    widgetKeydown: function(e) {
1125      var $input = $(e.target),
1126          name = $input.attr('class').replace('bootstrap-timepicker-', '');
1127
1128      switch (e.which) {
1129      case 9: //tab
1130        if (e.shiftKey) {
1131          if (name === 'hour') {
1132            return this.hideWidget();
1133          }
1134        } else if ((this.showMeridian && name === 'meridian') || (this.showSeconds && name === 'second') || (!this.showMeridian && !this.showSeconds && name === 'minute')) {
1135          return this.hideWidget();
1136        }
1137        break;
1138      case 27: // escape
1139        this.hideWidget();
1140        break;
1141      case 38: // up arrow
1142        e.preventDefault();
1143        switch (name) {
1144        case 'hour':
1145          this.incrementHour();
1146          break;
1147        case 'minute':
1148          this.incrementMinute();
1149          break;
1150        case 'second':
1151          this.incrementSecond();
1152          break;
1153        case 'meridian':
1154          this.toggleMeridian();
1155          break;
1156        }
1157        this.setTime(this.getTime());
1158        $input.get(0).setSelectionRange(0,2);
1159        break;
1160      case 40: // down arrow
1161        e.preventDefault();
1162        switch (name) {
1163        case 'hour':
1164          this.decrementHour();
1165          break;
1166        case 'minute':
1167          this.decrementMinute();
1168          break;
1169        case 'second':
1170          this.decrementSecond();
1171          break;
1172        case 'meridian':
1173          this.toggleMeridian();
1174          break;
1175        }
1176        this.setTime(this.getTime());
1177        $input.get(0).setSelectionRange(0,2);
1178        break;
1179      }
1180    },
1181
1182    widgetKeyup: function(e) {
1183      if ((e.which === 65) || (e.which === 77) || (e.which === 80) || (e.which === 46) || (e.which === 8) || (e.which >= 48 && e.which <= 57) || (e.which >= 96 && e.which <= 105)) {
1184        this.updateFromWidgetInputs();
1185      }
1186    }
1187  };
1188
1189  //TIMEPICKER PLUGIN DEFINITION
1190  $.fn.timepicker = function(option) {
1191    var args = Array.apply(null, arguments);
1192    args.shift();
1193    return this.each(function() {
1194      var $this = $(this),
1195        data = $this.data('timepicker'),
1196        options = typeof option === 'object' && option;
1197
1198      if (!data) {
1199        $this.data('timepicker', (data = new Timepicker(this, $.extend({}, $.fn.timepicker.defaults, options, $(this).data()))));
1200      }
1201
1202      if (typeof option === 'string') {
1203        data[option].apply(data, args);
1204      }
1205    });
1206  };
1207
1208  $.fn.timepicker.defaults = {
1209    defaultTime: 'current',
1210    disableFocus: false,
1211    disableMousewheel: false,
1212    isOpen: false,
1213    minuteStep: 15,
1214    modalBackdrop: false,
1215    orientation: { x: 'auto', y: 'auto'},
1216    secondStep: 15,
1217    snapToStep: false,
1218    showSeconds: false,
1219    showInputs: true,
1220    showMeridian: true,
1221    template: 'dropdown',
1222    appendWidgetTo: 'body',
1223    showWidgetOnAddonClick: true,
1224    icons: {
1225      up: 'ti ti-chevron-up',
1226      down: 'ti ti-chevron-down'
1227    },
1228    maxHours: 24,
1229    explicitMode: false
1230  };
1231
1232  $.fn.timepicker.Constructor = Timepicker;
1233
1234  $(document).on(
1235    'focus.timepicker.data-api click.timepicker.data-api',
1236    '[data-provide="timepicker"]',
1237    function(e){
vendor: 59,841 bytes, lines 1238-3273
1238      var $this = $(this);
1239      if ($this.data('timepicker')) {
1240        return;
1241      }
1242      e.preventDefault();
1243      // component click requires us to explicitly show it
1244      $this.timepicker();
1245    }
1246  );
1247
1248})(jQuery, window, document);
1249;
1250/*!
1251 * Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker)
1252 *
1253 * Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
1254 */
1255
1256(function(factory){
1257    if (typeof define === 'function' && define.amd) {
1258        define(['jquery'], factory);
1259    } else if (typeof exports === 'object') {
1260        factory(require('jquery'));
1261    } else {
1262        factory(jQuery);
1263    }
1264}(function($, undefined){
1265	function UTCDate(){
1266		return new Date(Date.UTC.apply(Date, arguments));
1267	}
1268	function UTCToday(){
1269		var today = new Date();
1270		return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
1271	}
1272	function isUTCEquals(date1, date2) {
1273		return (
1274			date1.getUTCFullYear() === date2.getUTCFullYear() &&
1275			date1.getUTCMonth() === date2.getUTCMonth() &&
1276			date1.getUTCDate() === date2.getUTCDate()
1277		);
1278	}
1279	function alias(method, deprecationMsg){
1280		return function(){
1281			if (deprecationMsg !== undefined) {
1282				$.fn.datepicker.deprecated(deprecationMsg);
1283			}
1284
1285			return this[method].apply(this, arguments);
1286		};
1287	}
1288	function isValidDate(d) {
1289		return d && !isNaN(d.getTime());
1290	}
1291
1292	var DateArray = (function(){
1293		var extras = {
1294			get: function(i){
1295				return this.slice(i)[0];
1296			},
1297			contains: function(d){
1298				// Array.indexOf is not cross-browser;
1299				// $.inArray doesn't work with Dates
1300				var val = d && d.valueOf();
1301				for (var i=0, l=this.length; i < l; i++)
1302          // Use date arithmetic to allow dates with different times to match
1303          if (0 <= this[i].valueOf() - val && this[i].valueOf() - val < 1000*60*60*24)
1304						return i;
1305				return -1;
1306			},
1307			remove: function(i){
1308				this.splice(i,1);
1309			},
1310			replace: function(new_array){
1311				if (!new_array)
1312					return;
1313				if (!$.isArray(new_array))
1314					new_array = [new_array];
1315				this.clear();
1316				this.push.apply(this, new_array);
1317			},
1318			clear: function(){
1319				this.length = 0;
1320			},
1321			copy: function(){
1322				var a = new DateArray();
1323				a.replace(this);
1324				return a;
1325			}
1326		};
1327
1328		return function(){
1329			var a = [];
1330			a.push.apply(a, arguments);
1331			$.extend(a, extras);
1332			return a;
1333		};
1334	})();
1335
1336
1337	// Picker object
1338
1339	var Datepicker = function(element, options){
1340		$.data(element, 'datepicker', this);
1341
1342		this._events = [];
1343		this._secondaryEvents = [];
1344
1345		this._process_options(options);
1346
1347		this.dates = new DateArray();
1348		this.viewDate = this.o.defaultViewDate;
1349		this.focusDate = null;
1350
1351		this.element = $(element);
1352		this.isInput = this.element.is('input');
1353		this.inputField = this.isInput ? this.element : this.element.find('input');
1354		this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn') : false;
1355		if (this.component && this.component.length === 0)
1356			this.component = false;
1357		this.isInline = !this.component && this.element.is('div');
1358
1359		this.picker = $(DPGlobal.template);
1360
1361		// Checking templates and inserting
1362		if (this._check_template(this.o.templates.leftArrow)) {
1363			this.picker.find('.prev').html(this.o.templates.leftArrow);
1364		}
1365
1366		if (this._check_template(this.o.templates.rightArrow)) {
1367			this.picker.find('.next').html(this.o.templates.rightArrow);
1368		}
1369
1370		this._buildEvents();
1371		this._attachEvents();
1372
1373		if (this.isInline){
1374			this.picker.addClass('datepicker-inline').appendTo(this.element);
1375		}
1376		else {
1377			this.picker.addClass('datepicker-dropdown dropdown-menu');
1378		}
1379
1380		if (this.o.rtl){
1381			this.picker.addClass('datepicker-rtl');
1382		}
1383
1384		if (this.o.calendarWeeks) {
1385			this.picker.find('.datepicker-days .datepicker-switch, thead .datepicker-title, tfoot .today, tfoot .clear')
1386				.attr('colspan', function(i, val){
1387					return Number(val) + 1;
1388				});
1389		}
1390
1391		this._process_options({
1392			startDate: this._o.startDate,
1393			endDate: this._o.endDate,
1394			daysOfWeekDisabled: this.o.daysOfWeekDisabled,
1395			daysOfWeekHighlighted: this.o.daysOfWeekHighlighted,
1396			datesDisabled: this.o.datesDisabled
1397		});
1398
1399		this._allow_update = false;
1400		this.setViewMode(this.o.startView);
1401		this._allow_update = true;
1402
1403		this.fillDow();
1404		this.fillMonths();
1405
1406		this.update();
1407
1408		if (this.isInline){
1409			this.show();
1410		}
1411	};
1412
1413	Datepicker.prototype = {
1414		constructor: Datepicker,
1415
1416		_resolveViewName: function(view){
1417			$.each(DPGlobal.viewModes, function(i, viewMode){
1418				if (view === i || $.inArray(view, viewMode.names) !== -1){
1419					view = i;
1420					return false;
1421				}
1422			});
1423
1424			return view;
1425		},
1426
1427		_resolveDaysOfWeek: function(daysOfWeek){
1428			if (!$.isArray(daysOfWeek))
1429				daysOfWeek = daysOfWeek.split(/[,\s]*/);
1430			return $.map(daysOfWeek, Number);
1431		},
1432
1433		_check_template: function(tmp){
1434			try {
1435				// If empty
1436				if (tmp === undefined || tmp === "") {
1437					return false;
1438				}
1439				// If no html, everything ok
1440				if ((tmp.match(/[<>]/g) || []).length <= 0) {
1441					return true;
1442				}
1443				// Checking if html is fine
1444				var jDom = $(tmp);
1445				return jDom.length > 0;
1446			}
1447			catch (ex) {
1448				return false;
1449			}
1450		},
1451
1452		_process_options: function(opts){
1453			// Store raw options for reference
1454			this._o = $.extend({}, this._o, opts);
1455			// Processed options
1456			var o = this.o = $.extend({}, this._o);
1457
1458			// Check if "de-DE" style date is available, if not language should
1459			// fallback to 2 letter code eg "de"
1460			var lang = o.language;
1461			if (!dates[lang]){
1462				lang = lang.split('-')[0];
1463				if (!dates[lang])
1464					lang = defaults.language;
1465			}
1466			o.language = lang;
1467
1468			// Retrieve view index from any aliases
1469			o.startView = this._resolveViewName(o.startView);
1470			o.minViewMode = this._resolveViewName(o.minViewMode);
1471			o.maxViewMode = this._resolveViewName(o.maxViewMode);
1472
1473			// Check view is between min and max
1474			o.startView = Math.max(this.o.minViewMode, Math.min(this.o.maxViewMode, o.startView));
1475
1476			// true, false, or Number > 0
1477			if (o.multidate !== true){
1478				o.multidate = Number(o.multidate) || false;
1479				if (o.multidate !== false)
1480					o.multidate = Math.max(0, o.multidate);
1481			}
1482			o.multidateSeparator = String(o.multidateSeparator);
1483
1484			o.weekStart %= 7;
1485			o.weekEnd = (o.weekStart + 6) % 7;
1486
1487			var format = DPGlobal.parseFormat(o.format);
1488			if (o.startDate !== -Infinity){
1489				if (!!o.startDate){
1490					if (o.startDate instanceof Date)
1491						o.startDate = this._local_to_utc(this._zero_time(o.startDate));
1492					else
1493						o.startDate = DPGlobal.parseDate(o.startDate, format, o.language, o.assumeNearbyYear);
1494				}
1495				else {
1496					o.startDate = -Infinity;
1497				}
1498			}
1499			if (o.endDate !== Infinity){
1500				if (!!o.endDate){
1501					if (o.endDate instanceof Date)
1502						o.endDate = this._local_to_utc(this._zero_time(o.endDate));
1503					else
1504						o.endDate = DPGlobal.parseDate(o.endDate, format, o.language, o.assumeNearbyYear);
1505				}
1506				else {
1507					o.endDate = Infinity;
1508				}
1509			}
1510
1511			o.daysOfWeekDisabled = this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]);
1512			o.daysOfWeekHighlighted = this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]);
1513
1514			o.datesDisabled = o.datesDisabled||[];
1515			if (!$.isArray(o.datesDisabled)) {
1516				o.datesDisabled = o.datesDisabled.split(',');
1517			}
1518			o.datesDisabled = $.map(o.datesDisabled, function(d){
1519				return DPGlobal.parseDate(d, format, o.language, o.assumeNearbyYear);
1520			});
1521
1522			var plc = String(o.orientation).toLowerCase().split(/\s+/g),
1523				_plc = o.orientation.toLowerCase();
1524			plc = $.grep(plc, function(word){
1525				return /^auto|left|right|top|bottom$/.test(word);
1526			});
1527			o.orientation = {x: 'auto', y: 'auto'};
1528			if (!_plc || _plc === 'auto')
1529				; // no action
1530			else if (plc.length === 1){
1531				switch (plc[0]){
1532					case 'top':
1533					case 'bottom':
1534						o.orientation.y = plc[0];
1535						break;
1536					case 'left':
1537					case 'right':
1538						o.orientation.x = plc[0];
1539						break;
1540				}
1541			}
1542			else {
1543				_plc = $.grep(plc, function(word){
1544					return /^left|right$/.test(word);
1545				});
1546				o.orientation.x = _plc[0] || 'auto';
1547
1548				_plc = $.grep(plc, function(word){
1549					return /^top|bottom$/.test(word);
1550				});
1551				o.orientation.y = _plc[0] || 'auto';
1552			}
1553			if (o.defaultViewDate instanceof Date || typeof o.defaultViewDate === 'string') {
1554				o.defaultViewDate = DPGlobal.parseDate(o.defaultViewDate, format, o.language, o.assumeNearbyYear);
1555			} else if (o.defaultViewDate) {
1556				var year = o.defaultViewDate.year || new Date().getFullYear();
1557				var month = o.defaultViewDate.month || 0;
1558				var day = o.defaultViewDate.day || 1;
1559				o.defaultViewDate = UTCDate(year, month, day);
1560			} else {
1561				o.defaultViewDate = UTCToday();
1562			}
1563		},
1564		_applyEvents: function(evs){
1565			for (var i=0, el, ch, ev; i < evs.length; i++){
1566				el = evs[i][0];
1567				if (evs[i].length === 2){
1568					ch = undefined;
1569					ev = evs[i][1];
1570				} else if (evs[i].length === 3){
1571					ch = evs[i][1];
1572					ev = evs[i][2];
1573				}
1574				el.on(ev, ch);
1575			}
1576		},
1577		_unapplyEvents: function(evs){
1578			for (var i=0, el, ev, ch; i < evs.length; i++){
1579				el = evs[i][0];
1580				if (evs[i].length === 2){
1581					ch = undefined;
1582					ev = evs[i][1];
1583				} else if (evs[i].length === 3){
1584					ch = evs[i][1];
1585					ev = evs[i][2];
1586				}
1587				el.off(ev, ch);
1588			}
1589		},
1590		_buildEvents: function(){
1591            var events = {
1592                keyup: $.proxy(function(e){
1593                    if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1)
1594                        this.update();
1595                }, this),
1596                keydown: $.proxy(this.keydown, this),
1597                paste: $.proxy(this.paste, this)
1598            };
1599
1600            if (this.o.showOnFocus === true) {
1601                events.focus = $.proxy(this.show, this);
1602            }
1603
1604            if (this.isInput) { // single input
1605                this._events = [
1606                    [this.element, events]
1607                ];
1608            }
1609            // component: input + button
1610            else if (this.component && this.inputField.length) {
1611                this._events = [
1612                    // For components that are not readonly, allow keyboard nav
1613                    [this.inputField, events],
1614                    [this.component, {
1615                        click: $.proxy(this.show, this)
1616                    }]
1617                ];
1618            }
1619			else {
1620				this._events = [
1621					[this.element, {
1622						click: $.proxy(this.show, this),
1623						keydown: $.proxy(this.keydown, this)
1624					}]
1625				];
1626			}
1627			this._events.push(
1628				// Component: listen for blur on element descendants
1629				[this.element, '*', {
1630					blur: $.proxy(function(e){
1631						this._focused_from = e.target;
1632					}, this)
1633				}],
1634				// Input: listen for blur on element
1635				[this.element, {
1636					blur: $.proxy(function(e){
1637						this._focused_from = e.target;
1638					}, this)
1639				}]
1640			);
1641
1642			if (this.o.immediateUpdates) {
1643				// Trigger input updates immediately on changed year/month
1644				this._events.push([this.element, {
1645					'changeYear changeMonth': $.proxy(function(e){
1646						this.update(e.date);
1647					}, this)
1648				}]);
1649			}
1650
1651			this._secondaryEvents = [
1652				[this.picker, {
1653					click: $.proxy(this.click, this)
1654				}],
1655				[this.picker, '.prev, .next', {
1656					click: $.proxy(this.navArrowsClick, this)
1657				}],
1658				[this.picker, '.day:not(.disabled)', {
1659					click: $.proxy(this.dayCellClick, this)
1660				}],
1661				[$(window), {
1662					resize: $.proxy(this.place, this)
1663				}],
1664				[$(document), {
1665					'mousedown touchstart': $.proxy(function(e){
1666						// Clicked outside the datepicker, hide it
1667						if (!(
1668							this.element.is(e.target) ||
1669							this.element.find(e.target).length ||
1670							this.picker.is(e.target) ||
1671							this.picker.find(e.target).length ||
1672							this.isInline
1673						)){
1674							this.hide();
1675						}
1676					}, this)
1677				}]
1678			];
1679		},
1680		_attachEvents: function(){
1681			this._detachEvents();
1682			this._applyEvents(this._events);
1683		},
1684		_detachEvents: function(){
1685			this._unapplyEvents(this._events);
1686		},
1687		_attachSecondaryEvents: function(){
1688			this._detachSecondaryEvents();
1689			this._applyEvents(this._secondaryEvents);
1690		},
1691		_detachSecondaryEvents: function(){
1692			this._unapplyEvents(this._secondaryEvents);
1693		},
1694		_trigger: function(event, altdate){
1695			var date = altdate || this.dates.get(-1),
1696				local_date = this._utc_to_local(date);
1697
1698			this.element.trigger({
1699				type: event,
1700				date: local_date,
1701				viewMode: this.viewMode,
1702				dates: $.map(this.dates, this._utc_to_local),
1703				format: $.proxy(function(ix, format){
1704					if (arguments.length === 0){
1705						ix = this.dates.length - 1;
1706						format = this.o.format;
1707					} else if (typeof ix === 'string'){
1708						format = ix;
1709						ix = this.dates.length - 1;
1710					}
1711					format = format || this.o.format;
1712					var date = this.dates.get(ix);
1713					return DPGlobal.formatDate(date, format, this.o.language);
1714				}, this)
1715			});
1716		},
1717
1718		show: function(){
1719			if (this.inputField.is(':disabled') || (this.inputField.prop('readonly') && this.o.enableOnReadonly === false))
1720				return;
1721			if (!this.isInline)
1722				this.picker.appendTo(this.o.container);
1723			this.place();
1724			this.picker.show();
1725			this._attachSecondaryEvents();
1726			this._trigger('show');
1727			if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {
1728				$(this.element).blur();
1729			}
1730			return this;
1731		},
1732
1733		hide: function(){
1734			if (this.isInline || !this.picker.is(':visible'))
1735				return this;
1736			this.focusDate = null;
1737			this.picker.hide().detach();
1738			this._detachSecondaryEvents();
1739			this.setViewMode(this.o.startView);
1740
1741			if (this.o.forceParse && this.inputField.val())
1742				this.setValue();
1743			this._trigger('hide');
1744			return this;
1745		},
1746
1747		destroy: function(){
1748			this.hide();
1749			this._detachEvents();
1750			this._detachSecondaryEvents();
1751			this.picker.remove();
1752			delete this.element.data().datepicker;
1753			if (!this.isInput){
1754				delete this.element.data().date;
1755			}
1756			return this;
1757		},
1758
1759		paste: function(e){
1760			var dateString;
1761			if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.types
1762				&& $.inArray('text/plain', e.originalEvent.clipboardData.types) !== -1) {
1763				dateString = e.originalEvent.clipboardData.getData('text/plain');
1764			} else if (window.clipboardData) {
1765				dateString = window.clipboardData.getData('Text');
1766			} else {
1767				return;
1768			}
1769			this.setDate(dateString);
1770			this.update();
1771			e.preventDefault();
1772		},
1773
1774		_utc_to_local: function(utc){
1775			if (!utc) {
1776				return utc;
1777			}
1778
1779			var local = new Date(utc.getTime() + (utc.getTimezoneOffset() * 60000));
1780
1781			if (local.getTimezoneOffset() !== utc.getTimezoneOffset()) {
1782				local = new Date(utc.getTime() + (local.getTimezoneOffset() * 60000));
1783			}
1784
1785			return local;
1786		},
1787		_local_to_utc: function(local){
1788			return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
1789		},
1790		_zero_time: function(local){
1791			return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
1792		},
1793		_zero_utc_time: function(utc){
1794			return utc && UTCDate(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());
1795		},
1796
1797		getDates: function(){
1798			return $.map(this.dates, this._utc_to_local);
1799		},
1800
1801		getUTCDates: function(){
1802			return $.map(this.dates, function(d){
1803				return new Date(d);
1804			});
1805		},
1806
1807		getDate: function(){
1808			return this._utc_to_local(this.getUTCDate());
1809		},
1810
1811		getUTCDate: function(){
1812			var selected_date = this.dates.get(-1);
1813			if (selected_date !== undefined) {
1814				return new Date(selected_date);
1815			} else {
1816				return null;
1817			}
1818		},
1819
1820		clearDates: function(){
1821			this.inputField.val('');
1822			this.update();
1823			this._trigger('changeDate');
1824
1825			if (this.o.autoclose) {
1826				this.hide();
1827			}
1828		},
1829
1830		setDates: function(){
1831			var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
1832			this.update.apply(this, args);
1833			this._trigger('changeDate');
1834			this.setValue();
1835			return this;
1836		},
1837
1838		setUTCDates: function(){
1839			var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
1840			this.setDates.apply(this, $.map(args, this._utc_to_local));
1841			return this;
1842		},
1843
1844		setDate: alias('setDates'),
1845		setUTCDate: alias('setUTCDates'),
1846		remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead'),
1847
1848		setValue: function(){
1849			var formatted = this.getFormattedDate();
1850			this.inputField.val(formatted);
1851			return this;
1852		},
1853
1854		getFormattedDate: function(format){
1855			if (format === undefined)
1856				format = this.o.format;
1857
1858			var lang = this.o.language;
1859			return $.map(this.dates, function(d){
1860				return DPGlobal.formatDate(d, format, lang);
1861			}).join(this.o.multidateSeparator);
1862		},
1863
1864		getStartDate: function(){
1865			return this.o.startDate;
1866		},
1867
1868		setStartDate: function(startDate){
1869			this._process_options({startDate: startDate});
1870			this.update();
1871			this.updateNavArrows();
1872			return this;
1873		},
1874
1875		getEndDate: function(){
1876			return this.o.endDate;
1877		},
1878
1879		setEndDate: function(endDate){
1880			this._process_options({endDate: endDate});
1881			this.update();
1882			this.updateNavArrows();
1883			return this;
1884		},
1885
1886		setDaysOfWeekDisabled: function(daysOfWeekDisabled){
1887			this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
1888			this.update();
1889			return this;
1890		},
1891
1892		setDaysOfWeekHighlighted: function(daysOfWeekHighlighted){
1893			this._process_options({daysOfWeekHighlighted: daysOfWeekHighlighted});
1894			this.update();
1895			return this;
1896		},
1897
1898		setDatesDisabled: function(datesDisabled){
1899			this._process_options({datesDisabled: datesDisabled});
1900			this.update();
1901			return this;
1902		},
1903
1904		place: function(){
1905			if (this.isInline)
1906				return this;
1907			var calendarWidth = this.picker.outerWidth(),
1908				calendarHeight = this.picker.outerHeight(),
1909				visualPadding = 10,
1910				container = $(this.o.container),
1911				windowWidth = container.width(),
1912				scrollTop = this.o.container === 'body' ? $(document).scrollTop() : container.scrollTop(),
1913				appendOffset = container.offset();
1914
1915			var parentsZindex = [0];
1916			this.element.parents().each(function(){
1917				var itemZIndex = $(this).css('z-index');
1918				if (itemZIndex !== 'auto' && Number(itemZIndex) !== 0) parentsZindex.push(Number(itemZIndex));
1919			});
1920			var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset;
1921			var offset = this.component ? this.component.parent().offset() : this.element.offset();
1922			var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
1923			var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
1924			var left = offset.left - appendOffset.left;
1925			var top = offset.top - appendOffset.top;
1926
1927			if (this.o.container !== 'body') {
1928				top += scrollTop;
1929			}
1930
1931			this.picker.removeClass(
1932				'datepicker-orient-top datepicker-orient-bottom '+
1933				'datepicker-orient-right datepicker-orient-left'
1934			);
1935
1936			if (this.o.orientation.x !== 'auto'){
1937				this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
1938				if (this.o.orientation.x === 'right')
1939					left -= calendarWidth - width;
1940			}
1941			// auto x orientation is best-placement: if it crosses a window
1942			// edge, fudge it sideways
1943			else {
1944				if (offset.left < 0) {
1945					// component is outside the window on the left side. Move it into visible range
1946					this.picker.addClass('datepicker-orient-left');
1947					left -= offset.left - visualPadding;
1948				} else if (left + calendarWidth > windowWidth) {
1949					// the calendar passes the widow right edge. Align it to component right side
1950					this.picker.addClass('datepicker-orient-right');
1951					left += width - calendarWidth;
1952				} else {
1953					if (this.o.rtl) {
1954						// Default to right
1955						this.picker.addClass('datepicker-orient-right');
1956					} else {
1957						// Default to left
1958						this.picker.addClass('datepicker-orient-left');
1959					}
1960				}
1961			}
1962
1963			// auto y orientation is best-situation: top or bottom, no fudging,
1964			// decision based on which shows more of the calendar
1965			var yorient = this.o.orientation.y,
1966				top_overflow;
1967			if (yorient === 'auto'){
1968				top_overflow = -scrollTop + top - calendarHeight;
1969				yorient = top_overflow < 0 ? 'bottom' : 'top';
1970			}
1971
1972			this.picker.addClass('datepicker-orient-' + yorient);
1973			if (yorient === 'top')
1974				top -= calendarHeight + parseInt(this.picker.css('padding-top'));
1975			else
1976				top += height;
1977
1978			if (this.o.rtl) {
1979				var right = windowWidth - (left + width);
1980				this.picker.css({
1981					top: top,
1982					right: right,
1983					zIndex: zIndex
1984				});
1985			} else {
1986				this.picker.css({
1987					top: top,
1988					left: left,
1989					zIndex: zIndex
1990				});
1991			}
1992			return this;
1993		},
1994
1995		_allow_update: true,
1996		update: function(){
1997			if (!this._allow_update)
1998				return this;
1999
2000			var oldDates = this.dates.copy(),
2001				dates = [],
2002				fromArgs = false;
2003			if (arguments.length){
2004				$.each(arguments, $.proxy(function(i, date){
2005					if (date instanceof Date)
2006						date = this._local_to_utc(date);
2007					dates.push(date);
2008				}, this));
2009				fromArgs = true;
2010			} else {
2011				dates = this.isInput
2012						? this.element.val()
2013						: this.element.data('date') || this.inputField.val();
2014				if (dates && this.o.multidate)
2015					dates = dates.split(this.o.multidateSeparator);
2016				else
2017					dates = [dates];
2018				delete this.element.data().date;
2019			}
2020
2021			dates = $.map(dates, $.proxy(function(date){
2022				return DPGlobal.parseDate(date, this.o.format, this.o.language, this.o.assumeNearbyYear);
2023			}, this));
2024			dates = $.grep(dates, $.proxy(function(date){
2025				return (
2026					!this.dateWithinRange(date) ||
2027					!date
2028				);
2029			}, this), true);
2030			this.dates.replace(dates);
2031
2032			if (this.o.updateViewDate) {
2033				if (this.dates.length)
2034					this.viewDate = new Date(this.dates.get(-1));
2035				else if (this.viewDate < this.o.startDate)
2036					this.viewDate = new Date(this.o.startDate);
2037				else if (this.viewDate > this.o.endDate)
2038					this.viewDate = new Date(this.o.endDate);
2039				else
2040					this.viewDate = this.o.defaultViewDate;
2041			}
2042
2043			if (fromArgs){
2044				// setting date by clicking
2045				this.setValue();
2046				this.element.change();
2047			}
2048			else if (this.dates.length){
2049				// setting date by typing
2050				if (String(oldDates) !== String(this.dates) && fromArgs) {
2051					this._trigger('changeDate');
2052					this.element.change();
2053				}
2054			}
2055			if (!this.dates.length && oldDates.length) {
2056				this._trigger('clearDate');
2057				this.element.change();
2058			}
2059
2060			this.fill();
2061			return this;
2062		},
2063
2064		fillDow: function(){
2065      if (this.o.showWeekDays) {
2066			var dowCnt = this.o.weekStart,
2067				html = '<tr>';
2068			if (this.o.calendarWeeks){
2069				html += '<th class="cw">&#160;</th>';
2070			}
2071			while (dowCnt < this.o.weekStart + 7){
2072				html += '<th class="dow';
2073        if ($.inArray(dowCnt, this.o.daysOfWeekDisabled) !== -1)
2074          html += ' disabled';
2075        html += '">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
2076			}
2077			html += '</tr>';
2078			this.picker.find('.datepicker-days thead').append(html);
2079      }
2080		},
2081
2082		fillMonths: function(){
2083      var localDate = this._utc_to_local(this.viewDate);
2084			var html = '';
2085			var focused;
2086			for (var i = 0; i < 12; i++){
2087				focused = localDate && localDate.getMonth() === i ? ' focused' : '';
2088				html += '<span class="month' + focused + '">' + dates[this.o.language].monthsShort[i] + '</span>';
2089			}
2090			this.picker.find('.datepicker-months td').html(html);
2091		},
2092
2093		setRange: function(range){
2094			if (!range || !range.length)
2095				delete this.range;
2096			else
2097				this.range = $.map(range, function(d){
2098					return d.valueOf();
2099				});
2100			this.fill();
2101		},
2102
2103		getClassNames: function(date){
2104			var cls = [],
2105				year = this.viewDate.getUTCFullYear(),
2106				month = this.viewDate.getUTCMonth(),
2107				today = UTCToday();
2108			if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
2109				cls.push('old');
2110			} else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
2111				cls.push('new');
2112			}
2113			if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
2114				cls.push('focused');
2115			// Compare internal UTC date with UTC today, not local today
2116			if (this.o.todayHighlight && isUTCEquals(date, today)) {
2117				cls.push('today');
2118			}
2119			if (this.dates.contains(date) !== -1)
2120				cls.push('active');
2121			if (!this.dateWithinRange(date)){
2122				cls.push('disabled');
2123			}
2124			if (this.dateIsDisabled(date)){
2125				cls.push('disabled', 'disabled-date');
2126			}
2127			if ($.inArray(date.getUTCDay(), this.o.daysOfWeekHighlighted) !== -1){
2128				cls.push('highlighted');
2129			}
2130
2131			if (this.range){
2132				if (date > this.range[0] && date < this.range[this.range.length-1]){
2133					cls.push('range');
2134				}
2135				if ($.inArray(date.valueOf(), this.range) !== -1){
2136					cls.push('selected');
2137				}
2138				if (date.valueOf() === this.range[0]){
2139          cls.push('range-start');
2140        }
2141        if (date.valueOf() === this.range[this.range.length-1]){
2142          cls.push('range-end');
2143        }
2144			}
2145			return cls;
2146		},
2147
2148		_fill_yearsView: function(selector, cssClass, factor, year, startYear, endYear, beforeFn){
2149			var html = '';
2150			var step = factor / 10;
2151			var view = this.picker.find(selector);
2152			var startVal = Math.floor(year / factor) * factor;
2153			var endVal = startVal + step * 9;
2154			var focusedVal = Math.floor(this.viewDate.getFullYear() / step) * step;
2155			var selected = $.map(this.dates, function(d){
2156				return Math.floor(d.getUTCFullYear() / step) * step;
2157			});
2158
2159			var classes, tooltip, before;
2160			for (var currVal = startVal - step; currVal <= endVal + step; currVal += step) {
2161				classes = [cssClass];
2162				tooltip = null;
2163
2164				if (currVal === startVal - step) {
2165					classes.push('old');
2166				} else if (currVal === endVal + step) {
2167					classes.push('new');
2168				}
2169				if ($.inArray(currVal, selected) !== -1) {
2170					classes.push('active');
2171				}
2172				if (currVal < startYear || currVal > endYear) {
2173					classes.push('disabled');
2174				}
2175				if (currVal === focusedVal) {
2176				  classes.push('focused');
2177        }
2178
2179				if (beforeFn !== $.noop) {
2180					before = beforeFn(new Date(currVal, 0, 1));
2181					if (before === undefined) {
2182						before = {};
2183					} else if (typeof before === 'boolean') {
2184						before = {enabled: before};
2185					} else if (typeof before === 'string') {
2186						before = {classes: before};
2187					}
2188					if (before.enabled === false) {
2189						classes.push('disabled');
2190					}
2191					if (before.classes) {
2192						classes = classes.concat(before.classes.split(/\s+/));
2193					}
2194					if (before.tooltip) {
2195						tooltip = before.tooltip;
2196					}
2197				}
2198
2199				html += '<span class="' + classes.join(' ') + '"' + (tooltip ? ' title="' + tooltip + '"' : '') + '>' + currVal + '</span>';
2200			}
2201
2202			view.find('.datepicker-switch').text(startVal + '-' + endVal);
2203			view.find('td').html(html);
2204		},
2205
2206		fill: function(){
2207			var d = new Date(this.viewDate),
2208				year = d.getUTCFullYear(),
2209				month = d.getUTCMonth(),
2210				startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
2211				startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
2212				endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
2213				endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
2214				todaytxt = dates[this.o.language].today || dates['en'].today || '',
2215				cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
2216        titleFormat = dates[this.o.language].titleFormat || dates['en'].titleFormat,
2217        todayDate = UTCToday(),
2218        titleBtnVisible = (this.o.todayBtn === true || this.o.todayBtn === 'linked') && todayDate >= this.o.startDate && todayDate <= this.o.endDate && !this.weekOfDateIsDisabled(todayDate),
2219				tooltip,
2220				before;
2221			if (isNaN(year) || isNaN(month))
2222				return;
2223			this.picker.find('.datepicker-days .datepicker-switch')
2224						.text(DPGlobal.formatDate(d, titleFormat, this.o.language));
2225			this.picker.find('tfoot .today')
2226						.text(todaytxt)
2227            .css('display', titleBtnVisible ? 'table-cell' : 'none');
2228			this.picker.find('tfoot .clear')
2229						.text(cleartxt)
2230						.css('display', this.o.clearBtn === true ? 'table-cell' : 'none');
2231			this.picker.find('thead .datepicker-title')
2232						.text(this.o.title)
2233						.css('display', typeof this.o.title === 'string' && this.o.title !== '' ? 'table-cell' : 'none');
2234			this.updateNavArrows();
2235			this.fillMonths();
2236			var prevMonth = UTCDate(year, month, 0),
2237				day = prevMonth.getUTCDate();
2238			prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
2239			var nextMonth = new Date(prevMonth);
2240			if (prevMonth.getUTCFullYear() < 100){
2241        nextMonth.setUTCFullYear(prevMonth.getUTCFullYear());
2242      }
2243			nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
2244			nextMonth = nextMonth.valueOf();
2245			var html = [];
2246			var weekDay, clsName;
2247			while (prevMonth.valueOf() < nextMonth){
2248				weekDay = prevMonth.getUTCDay();
2249				if (weekDay === this.o.weekStart){
2250					html.push('<tr>');
2251					if (this.o.calendarWeeks){
2252						// ISO 8601: First week contains first thursday.
2253						// ISO also states week starts on Monday, but we can be more abstract here.
2254						var
2255							// Start of current week: based on weekstart/current date
2256							ws = new Date(+prevMonth + (this.o.weekStart - weekDay - 7) % 7 * 864e5),
2257							// Thursday of this week
2258							th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
2259							// First Thursday of year, year from thursday
2260							yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),
2261							// Calendar week: ms between thursdays, div ms per day, div 7 days
2262							calWeek = (th - yth) / 864e5 / 7 + 1;
2263						html.push('<td class="cw">'+ calWeek +'</td>');
2264					}
2265				}
2266				clsName = this.getClassNames(prevMonth);
2267				clsName.push('day');
2268
2269				var content = prevMonth.getUTCDate();
2270
2271				if (this.o.beforeShowDay !== $.noop){
2272					before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
2273					if (before === undefined)
2274						before = {};
2275					else if (typeof before === 'boolean')
2276						before = {enabled: before};
2277					else if (typeof before === 'string')
2278						before = {classes: before};
2279					if (before.enabled === false)
2280						clsName.push('disabled');
2281					if (before.classes)
2282						clsName = clsName.concat(before.classes.split(/\s+/));
2283					if (before.tooltip)
2284						tooltip = before.tooltip;
2285					if (before.content)
2286						content = before.content;
2287				}
2288
2289				//Check if uniqueSort exists (supported by jquery >=1.12 and >=2.2)
2290				//Fallback to unique function for older jquery versions
2291				if ($.isFunction($.uniqueSort)) {
2292					clsName = $.uniqueSort(clsName);
2293				} else {
2294					clsName = $.unique(clsName);
2295				}
2296
2297				html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + ' data-date="' + prevMonth.getTime().toString() + '">' + content + '</td>');
2298				tooltip = null;
2299				if (weekDay === this.o.weekEnd){
2300					html.push('</tr>');
2301				}
2302				prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);
2303			}
2304			this.picker.find('.datepicker-days tbody').html(html.join(''));
2305
2306			var monthsTitle = dates[this.o.language].monthsTitle || dates['en'].monthsTitle || 'Months';
2307			var months = this.picker.find('.datepicker-months')
2308						.find('.datepicker-switch')
2309							.text(this.o.maxViewMode < 2 ? monthsTitle : year)
2310							.end()
2311						.find('tbody span').removeClass('active');
2312
2313			$.each(this.dates, function(i, d){
2314				if (d.getUTCFullYear() === year)
2315					months.eq(d.getUTCMonth()).addClass('active');
2316			});
2317
2318			if (year < startYear || year > endYear){
2319				months.addClass('disabled');
2320			}
2321			if (year === startYear){
2322				months.slice(0, startMonth).addClass('disabled');
2323			}
2324			if (year === endYear){
2325				months.slice(endMonth+1).addClass('disabled');
2326			}
2327
2328			if (this.o.beforeShowMonth !== $.noop){
2329				var that = this;
2330				$.each(months, function(i, month){
2331          var moDate = new Date(year, i, 1);
2332          var before = that.o.beforeShowMonth(moDate);
2333					if (before === undefined)
2334						before = {};
2335					else if (typeof before === 'boolean')
2336						before = {enabled: before};
2337					else if (typeof before === 'string')
2338						before = {classes: before};
2339					if (before.enabled === false && !$(month).hasClass('disabled'))
2340					    $(month).addClass('disabled');
2341					if (before.classes)
2342					    $(month).addClass(before.classes);
2343					if (before.tooltip)
2344					    $(month).prop('title', before.tooltip);
2345				});
2346			}
2347
2348			// Generating decade/years picker
2349			this._fill_yearsView(
2350				'.datepicker-years',
2351				'year',
2352				10,
2353				year,
2354				startYear,
2355				endYear,
2356				this.o.beforeShowYear
2357			);
2358
2359			// Generating century/decades picker
2360			this._fill_yearsView(
2361				'.datepicker-decades',
2362				'decade',
2363				100,
2364				year,
2365				startYear,
2366				endYear,
2367				this.o.beforeShowDecade
2368			);
2369
2370			// Generating millennium/centuries picker
2371			this._fill_yearsView(
2372				'.datepicker-centuries',
2373				'century',
2374				1000,
2375				year,
2376				startYear,
2377				endYear,
2378				this.o.beforeShowCentury
2379			);
2380		},
2381
2382		updateNavArrows: function(){
2383			if (!this._allow_update)
2384				return;
2385
2386			var d = new Date(this.viewDate),
2387				year = d.getUTCFullYear(),
2388				month = d.getUTCMonth(),
2389				startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
2390				startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
2391				endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
2392				endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
2393				prevIsDisabled,
2394				nextIsDisabled,
2395				factor = 1;
2396			switch (this.viewMode){
2397				case 4:
2398					factor *= 10;
2399					/* falls through */
2400				case 3:
2401					factor *= 10;
2402					/* falls through */
2403				case 2:
2404					factor *= 10;
2405					/* falls through */
2406				case 1:
2407					prevIsDisabled = Math.floor(year / factor) * factor <= startYear;
2408					nextIsDisabled = Math.floor(year / factor) * factor + factor > endYear;
2409					break;
2410				case 0:
2411					prevIsDisabled = year <= startYear && month <= startMonth;
2412					nextIsDisabled = year >= endYear && month >= endMonth;
2413					break;
2414			}
2415
2416			this.picker.find('.prev').toggleClass('disabled', prevIsDisabled);
2417			this.picker.find('.next').toggleClass('disabled', nextIsDisabled);
2418		},
2419
2420		click: function(e){
2421			e.preventDefault();
2422			e.stopPropagation();
2423
2424			var target, dir, day, year, month;
2425			target = $(e.target);
2426
2427			// Clicked on the switch
2428			if (target.hasClass('datepicker-switch') && this.viewMode !== this.o.maxViewMode){
2429				this.setViewMode(this.viewMode + 1);
2430			}
2431
2432			// Clicked on today button
2433			if (target.hasClass('today') && !target.hasClass('day')){
2434				this.setViewMode(0);
2435				this._setDate(UTCToday(), this.o.todayBtn === 'linked' ? null : 'view');
2436			}
2437
2438			// Clicked on clear button
2439			if (target.hasClass('clear')){
2440				this.clearDates();
2441			}
2442
2443			if (!target.hasClass('disabled')){
2444				// Clicked on a month, year, decade, century
2445				if (target.hasClass('month')
2446						|| target.hasClass('year')
2447						|| target.hasClass('decade')
2448						|| target.hasClass('century')) {
2449					this.viewDate.setUTCDate(1);
2450
2451					day = 1;
2452					if (this.viewMode === 1){
2453						month = target.parent().find('span').index(target);
2454						year = this.viewDate.getUTCFullYear();
2455						this.viewDate.setUTCMonth(month);
2456					} else {
2457						month = 0;
2458						year = Number(target.text());
2459						this.viewDate.setUTCFullYear(year);
2460					}
2461
2462					this._trigger(DPGlobal.viewModes[this.viewMode - 1].e, this.viewDate);
2463
2464					if (this.viewMode === this.o.minViewMode){
2465						this._setDate(UTCDate(year, month, day));
2466					} else {
2467						this.setViewMode(this.viewMode - 1);
2468						this.fill();
2469					}
2470				}
2471			}
2472
2473			if (this.picker.is(':visible') && this._focused_from){
2474				this._focused_from.focus();
2475			}
2476			delete this._focused_from;
2477		},
2478
2479		dayCellClick: function(e){
2480			var $target = $(e.currentTarget);
2481			var timestamp = $target.data('date');
2482			var date = new Date(timestamp);
2483
2484			if (this.o.updateViewDate) {
2485				if (date.getUTCFullYear() !== this.viewDate.getUTCFullYear()) {
2486					this._trigger('changeYear', this.viewDate);
2487				}
2488
2489				if (date.getUTCMonth() !== this.viewDate.getUTCMonth()) {
2490					this._trigger('changeMonth', this.viewDate);
2491				}
2492			}
2493			this._setDate(date);
2494		},
2495
2496		// Clicked on prev or next
2497		navArrowsClick: function(e){
2498			var $target = $(e.currentTarget);
2499			var dir = $target.hasClass('prev') ? -1 : 1;
2500			if (this.viewMode !== 0){
2501				dir *= DPGlobal.viewModes[this.viewMode].navStep * 12;
2502			}
2503			this.viewDate = this.moveMonth(this.viewDate, dir);
2504			this._trigger(DPGlobal.viewModes[this.viewMode].e, this.viewDate);
2505			this.fill();
2506		},
2507
2508		_toggle_multidate: function(date){
2509			var ix = this.dates.contains(date);
2510			if (!date){
2511				this.dates.clear();
2512			}
2513
2514			if (ix !== -1){
2515				if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){
2516					this.dates.remove(ix);
2517				}
2518			} else if (this.o.multidate === false) {
2519				this.dates.clear();
2520				this.dates.push(date);
2521			}
2522			else {
2523				this.dates.push(date);
2524			}
2525
2526			if (typeof this.o.multidate === 'number')
2527				while (this.dates.length > this.o.multidate)
2528					this.dates.remove(0);
2529		},
2530
2531		_setDate: function(date, which){
2532			if (!which || which === 'date')
2533				this._toggle_multidate(date && new Date(date));
2534			if ((!which && this.o.updateViewDate) || which === 'view')
2535				this.viewDate = date && new Date(date);
2536
2537			this.fill();
2538			this.setValue();
2539			if (!which || which !== 'view') {
2540				this._trigger('changeDate');
2541			}
2542			this.inputField.trigger('change');
2543			if (this.o.autoclose && (!which || which === 'date')){
2544				this.hide();
2545			}
2546		},
2547
2548		moveDay: function(date, dir){
2549			var newDate = new Date(date);
2550			newDate.setUTCDate(date.getUTCDate() + dir);
2551
2552			return newDate;
2553		},
2554
2555		moveWeek: function(date, dir){
2556			return this.moveDay(date, dir * 7);
2557		},
2558
2559		moveMonth: function(date, dir){
2560			if (!isValidDate(date))
2561				return this.o.defaultViewDate;
2562			if (!dir)
2563				return date;
2564			var new_date = new Date(date.valueOf()),
2565				day = new_date.getUTCDate(),
2566				month = new_date.getUTCMonth(),
2567				mag = Math.abs(dir),
2568				new_month, test;
2569			dir = dir > 0 ? 1 : -1;
2570			if (mag === 1){
2571				test = dir === -1
2572					// If going back one month, make sure month is not current month
2573					// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
2574					? function(){
2575						return new_date.getUTCMonth() === month;
2576					}
2577					// If going forward one month, make sure month is as expected
2578					// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
2579					: function(){
2580						return new_date.getUTCMonth() !== new_month;
2581					};
2582				new_month = month + dir;
2583				new_date.setUTCMonth(new_month);
2584				// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
2585				new_month = (new_month + 12) % 12;
2586			}
2587			else {
2588				// For magnitudes >1, move one month at a time...
2589				for (var i=0; i < mag; i++)
2590					// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
2591					new_date = this.moveMonth(new_date, dir);
2592				// ...then reset the day, keeping it in the new month
2593				new_month = new_date.getUTCMonth();
2594				new_date.setUTCDate(day);
2595				test = function(){
2596					return new_month !== new_date.getUTCMonth();
2597				};
2598			}
2599			// Common date-resetting loop -- if date is beyond end of month, make it
2600			// end of month
2601			while (test()){
2602				new_date.setUTCDate(--day);
2603				new_date.setUTCMonth(new_month);
2604			}
2605			return new_date;
2606		},
2607
2608		moveYear: function(date, dir){
2609			return this.moveMonth(date, dir*12);
2610		},
2611
2612		moveAvailableDate: function(date, dir, fn){
2613			do {
2614				date = this[fn](date, dir);
2615
2616				if (!this.dateWithinRange(date))
2617					return false;
2618
2619				fn = 'moveDay';
2620			}
2621			while (this.dateIsDisabled(date));
2622
2623			return date;
2624		},
2625
2626		weekOfDateIsDisabled: function(date){
2627			return $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1;
2628		},
2629
2630		dateIsDisabled: function(date){
2631			return (
2632				this.weekOfDateIsDisabled(date) ||
2633				$.grep(this.o.datesDisabled, function(d){
2634					return isUTCEquals(date, d);
2635				}).length > 0
2636			);
2637		},
2638
2639		dateWithinRange: function(date){
2640			return date >= this.o.startDate && date <= this.o.endDate;
2641		},
2642
2643		keydown: function(e){
2644			if (!this.picker.is(':visible')){
2645				if (e.keyCode === 40 || e.keyCode === 27) { // allow down to re-show picker
2646					this.show();
2647					e.stopPropagation();
2648        }
2649				return;
2650			}
2651			var dateChanged = false,
2652				dir, newViewDate,
2653				focusDate = this.focusDate || this.viewDate;
2654			switch (e.keyCode){
2655				case 27: // escape
2656					if (this.focusDate){
2657						this.focusDate = null;
2658						this.viewDate = this.dates.get(-1) || this.viewDate;
2659						this.fill();
2660					}
2661					else
2662						this.hide();
2663					e.preventDefault();
2664					e.stopPropagation();
2665					break;
2666				case 37: // left
2667				case 38: // up
2668				case 39: // right
2669				case 40: // down
2670					if (!this.o.keyboardNavigation || this.o.daysOfWeekDisabled.length === 7)
2671						break;
2672					dir = e.keyCode === 37 || e.keyCode === 38 ? -1 : 1;
2673          if (this.viewMode === 0) {
2674  					if (e.ctrlKey){
2675  						newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');
2676
2677  						if (newViewDate)
2678  							this._trigger('changeYear', this.viewDate);
2679  					} else if (e.shiftKey){
2680  						newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');
2681
2682  						if (newViewDate)
2683  							this._trigger('changeMonth', this.viewDate);
2684  					} else if (e.keyCode === 37 || e.keyCode === 39){
2685  						newViewDate = this.moveAvailableDate(focusDate, dir, 'moveDay');
2686  					} else if (!this.weekOfDateIsDisabled(focusDate)){
2687  						newViewDate = this.moveAvailableDate(focusDate, dir, 'moveWeek');
2688  					}
2689          } else if (this.viewMode === 1) {
2690            if (e.keyCode === 38 || e.keyCode === 40) {
2691              dir = dir * 4;
2692            }
2693            newViewDate = this.moveAvailableDate(focusDate, dir, 'moveMonth');
2694          } else if (this.viewMode === 2) {
2695            if (e.keyCode === 38 || e.keyCode === 40) {
2696              dir = dir * 4;
2697            }
2698            newViewDate = this.moveAvailableDate(focusDate, dir, 'moveYear');
2699          }
2700					if (newViewDate){
2701						this.focusDate = this.viewDate = newViewDate;
2702						this.setValue();
2703						this.fill();
2704						e.preventDefault();
2705					}
2706					break;
2707				case 13: // enter
2708					if (!this.o.forceParse)
2709						break;
2710					focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
2711					if (this.o.keyboardNavigation) {
2712						this._toggle_multidate(focusDate);
2713						dateChanged = true;
2714					}
2715					this.focusDate = null;
2716					this.viewDate = this.dates.get(-1) || this.viewDate;
2717					this.setValue();
2718					this.fill();
2719					if (this.picker.is(':visible')){
2720						e.preventDefault();
2721						e.stopPropagation();
2722						if (this.o.autoclose)
2723							this.hide();
2724					}
2725					break;
2726				case 9: // tab
2727					this.focusDate = null;
2728					this.viewDate = this.dates.get(-1) || this.viewDate;
2729					this.fill();
2730					this.hide();
2731					break;
2732			}
2733			if (dateChanged){
2734				if (this.dates.length)
2735					this._trigger('changeDate');
2736				else
2737					this._trigger('clearDate');
2738				this.inputField.trigger('change');
2739			}
2740		},
2741
2742		setViewMode: function(viewMode){
2743			this.viewMode = viewMode;
2744			this.picker
2745				.children('div')
2746				.hide()
2747				.filter('.datepicker-' + DPGlobal.viewModes[this.viewMode].clsName)
2748					.show();
2749			this.updateNavArrows();
2750      this._trigger('changeViewMode', new Date(this.viewDate));
2751		}
2752	};
2753
2754	var DateRangePicker = function(element, options){
2755		$.data(element, 'datepicker', this);
2756		this.element = $(element);
2757		this.inputs = $.map(options.inputs, function(i){
2758			return i.jquery ? i[0] : i;
2759		});
2760		delete options.inputs;
2761
2762		this.keepEmptyValues = options.keepEmptyValues;
2763		delete options.keepEmptyValues;
2764
2765		datepickerPlugin.call($(this.inputs), options)
2766			.on('changeDate', $.proxy(this.dateUpdated, this));
2767
2768		this.pickers = $.map(this.inputs, function(i){
2769			return $.data(i, 'datepicker');
2770		});
2771		this.updateDates();
2772	};
2773	DateRangePicker.prototype = {
2774		updateDates: function(){
2775			this.dates = $.map(this.pickers, function(i){
2776				return i.getUTCDate();
2777			});
2778			this.updateRanges();
2779		},
2780		updateRanges: function(){
2781			var range = $.map(this.dates, function(d){
2782				return d.valueOf();
2783			});
2784			$.each(this.pickers, function(i, p){
2785				p.setRange(range);
2786			});
2787		},
2788		clearDates: function(){
2789			$.each(this.pickers, function(i, p){
2790				p.clearDates();
2791			});
2792		},
2793		dateUpdated: function(e){
2794			// `this.updating` is a workaround for preventing infinite recursion
2795			// between `changeDate` triggering and `setUTCDate` calling.  Until
2796			// there is a better mechanism.
2797			if (this.updating)
2798				return;
2799			this.updating = true;
2800
2801			var dp = $.data(e.target, 'datepicker');
2802
2803			if (dp === undefined) {
2804				return;
2805			}
2806
2807			var new_date = dp.getUTCDate(),
2808				keep_empty_values = this.keepEmptyValues,
2809				i = $.inArray(e.target, this.inputs),
2810				j = i - 1,
2811				k = i + 1,
2812				l = this.inputs.length;
2813			if (i === -1)
2814				return;
2815
2816			$.each(this.pickers, function(i, p){
2817				if (!p.getUTCDate() && (p === dp || !keep_empty_values))
2818					p.setUTCDate(new_date);
2819			});
2820
2821			if (new_date < this.dates[j]){
2822				// Date being moved earlier/left
2823				while (j >= 0 && new_date < this.dates[j]){
2824					this.pickers[j--].setUTCDate(new_date);
2825				}
2826			} else if (new_date > this.dates[k]){
2827				// Date being moved later/right
2828				while (k < l && new_date > this.dates[k]){
2829					this.pickers[k++].setUTCDate(new_date);
2830				}
2831			}
2832			this.updateDates();
2833
2834			delete this.updating;
2835		},
2836		destroy: function(){
2837			$.map(this.pickers, function(p){ p.destroy(); });
2838			$(this.inputs).off('changeDate', this.dateUpdated);
2839			delete this.element.data().datepicker;
2840		},
2841		remove: alias('destroy', 'Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead')
2842	};
2843
2844	function opts_from_el(el, prefix){
2845		// Derive options from element data-attrs
2846		var data = $(el).data(),
2847			out = {}, inkey,
2848			replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
2849		prefix = new RegExp('^' + prefix.toLowerCase());
2850		function re_lower(_,a){
2851			return a.toLowerCase();
2852		}
2853		for (var key in data)
2854			if (prefix.test(key)){
2855				inkey = key.replace(replace, re_lower);
2856				out[inkey] = data[key];
2857			}
2858		return out;
2859	}
2860
2861	function opts_from_locale(lang){
2862		// Derive options from locale plugins
2863		var out = {};
2864		// Check if "de-DE" style date is available, if not language should
2865		// fallback to 2 letter code eg "de"
2866		if (!dates[lang]){
2867			lang = lang.split('-')[0];
2868			if (!dates[lang])
2869				return;
2870		}
2871		var d = dates[lang];
2872		$.each(locale_opts, function(i,k){
2873			if (k in d)
2874				out[k] = d[k];
2875		});
2876		return out;
2877	}
2878
2879	var old = $.fn.datepicker;
2880	var datepickerPlugin = function(option){
2881		var args = Array.apply(null, arguments);
2882		args.shift();
2883		var internal_return;
2884		this.each(function(){
2885			var $this = $(this),
2886				data = $this.data('datepicker'),
2887				options = typeof option === 'object' && option;
2888			if (!data){
2889				var elopts = opts_from_el(this, 'date'),
2890					// Preliminary otions
2891					xopts = $.extend({}, defaults, elopts, options),
2892					locopts = opts_from_locale(xopts.language),
2893					// Options priority: js args, data-attrs, locales, defaults
2894					opts = $.extend({}, defaults, locopts, elopts, options);
2895				if ($this.hasClass('input-daterange') || opts.inputs){
2896					$.extend(opts, {
2897						inputs: opts.inputs || $this.find('input').toArray()
2898					});
2899					data = new DateRangePicker(this, opts);
2900				}
2901				else {
2902					data = new Datepicker(this, opts);
2903				}
2904				$this.data('datepicker', data);
2905			}
2906			if (typeof option === 'string' && typeof data[option] === 'function'){
2907				internal_return = data[option].apply(data, args);
2908			}
2909		});
2910
2911		if (
2912			internal_return === undefined ||
2913			internal_return instanceof Datepicker ||
2914			internal_return instanceof DateRangePicker
2915		)
2916			return this;
2917
2918		if (this.length > 1)
2919			throw new Error('Using only allowed for the collection of a single element (' + option + ' function)');
2920		else
2921			return internal_return;
2922	};
2923	$.fn.datepicker = datepickerPlugin;
2924
2925	var defaults = $.fn.datepicker.defaults = {
2926		assumeNearbyYear: false,
2927		autoclose: false,
2928		beforeShowDay: $.noop,
2929		beforeShowMonth: $.noop,
2930		beforeShowYear: $.noop,
2931		beforeShowDecade: $.noop,
2932		beforeShowCentury: $.noop,
2933		calendarWeeks: false,
2934		clearBtn: false,
2935		toggleActive: false,
2936		daysOfWeekDisabled: [],
2937		daysOfWeekHighlighted: [],
2938		datesDisabled: [],
2939		endDate: Infinity,
2940		forceParse: true,
2941		format: 'mm/dd/yyyy',
2942		keepEmptyValues: false,
2943		keyboardNavigation: true,
2944		language: 'en',
2945		minViewMode: 0,
2946		maxViewMode: 4,
2947		multidate: false,
2948		multidateSeparator: ',',
2949		orientation: "auto",
2950		rtl: false,
2951		startDate: -Infinity,
2952		startView: 0,
2953		todayBtn: false,
2954		todayHighlight: false,
2955		updateViewDate: true,
2956		weekStart: 0,
2957		disableTouchKeyboard: false,
2958		enableOnReadonly: true,
2959		showOnFocus: true,
2960		zIndexOffset: 10,
2961		container: 'body',
2962		immediateUpdates: false,
2963		title: '',
2964		templates: {
2965			leftArrow: '&#x00AB;',
2966			rightArrow: '&#x00BB;'
2967		},
2968    showWeekDays: true
2969	};
2970	var locale_opts = $.fn.datepicker.locale_opts = [
2971		'format',
2972		'rtl',
2973		'weekStart'
2974	];
2975	$.fn.datepicker.Constructor = Datepicker;
2976	var dates = $.fn.datepicker.dates = {
2977		en: {
2978			days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
2979			daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
2980			daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
2981			months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
2982			monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
2983			today: "Today",
2984			clear: "Clear",
2985			titleFormat: "MM yyyy"
2986		}
2987	};
2988
2989	var DPGlobal = {
2990		viewModes: [
2991			{
2992				names: ['days', 'month'],
2993				clsName: 'days',
2994				e: 'changeMonth'
2995			},
2996			{
2997				names: ['months', 'year'],
2998				clsName: 'months',
2999				e: 'changeYear',
3000				navStep: 1
3001			},
3002			{
3003				names: ['years', 'decade'],
3004				clsName: 'years',
3005				e: 'changeDecade',
3006				navStep: 10
3007			},
3008			{
3009				names: ['decades', 'century'],
3010				clsName: 'decades',
3011				e: 'changeCentury',
3012				navStep: 100
3013			},
3014			{
3015				names: ['centuries', 'millennium'],
3016				clsName: 'centuries',
3017				e: 'changeMillennium',
3018				navStep: 1000
3019			}
3020		],
3021		validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
3022		nonpunctuation: /[^ -\/:-@\u5e74\u6708\u65e5\[-`{-~\t\n\r]+/g,
3023		parseFormat: function(format){
3024			if (typeof format.toValue === 'function' && typeof format.toDisplay === 'function')
3025                return format;
3026            // IE treats \0 as a string end in inputs (truncating the value),
3027			// so it's a bad format delimiter, anyway
3028			var separators = format.replace(this.validParts, '\0').split('\0'),
3029				parts = format.match(this.validParts);
3030			if (!separators || !separators.length || !parts || parts.length === 0){
3031				throw new Error("Invalid date format.");
3032			}
3033			return {separators: separators, parts: parts};
3034		},
3035		parseDate: function(date, format, language, assumeNearby){
3036			if (!date)
3037				return undefined;
3038			if (date instanceof Date)
3039				return date;
3040			if (typeof format === 'string')
3041				format = DPGlobal.parseFormat(format);
3042			if (format.toValue)
3043				return format.toValue(date, format, language);
3044			var fn_map = {
3045					d: 'moveDay',
3046					m: 'moveMonth',
3047					w: 'moveWeek',
3048					y: 'moveYear'
3049				},
3050				dateAliases = {
3051					yesterday: '-1d',
3052					today: '+0d',
3053					tomorrow: '+1d'
3054				},
3055				parts, part, dir, i, fn;
3056			if (date in dateAliases){
3057				date = dateAliases[date];
3058			}
3059			if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/i.test(date)){
3060				parts = date.match(/([\-+]\d+)([dmwy])/gi);
3061				date = new Date();
3062				for (i=0; i < parts.length; i++){
3063					part = parts[i].match(/([\-+]\d+)([dmwy])/i);
3064					dir = Number(part[1]);
3065					fn = fn_map[part[2].toLowerCase()];
3066					date = Datepicker.prototype[fn](date, dir);
3067				}
3068				return Datepicker.prototype._zero_utc_time(date);
3069			}
3070
3071			parts = date && date.match(this.nonpunctuation) || [];
3072
3073			function applyNearbyYear(year, threshold){
3074				if (threshold === true)
3075					threshold = 10;
3076
3077				// if year is 2 digits or less, than the user most likely is trying to get a recent century
3078				if (year < 100){
3079					year += 2000;
3080					// if the new year is more than threshold years in advance, use last century
3081					if (year > ((new Date()).getFullYear()+threshold)){
3082						year -= 100;
3083					}
3084				}
3085
3086				return year;
3087			}
3088
3089			var parsed = {},
3090				setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
3091				setters_map = {
3092					yyyy: function(d,v){
3093						return d.setUTCFullYear(assumeNearby ? applyNearbyYear(v, assumeNearby) : v);
3094					},
3095					m: function(d,v){
3096						if (isNaN(d))
3097							return d;
3098						v -= 1;
3099						while (v < 0) v += 12;
3100						v %= 12;
3101						d.setUTCMonth(v);
3102						while (d.getUTCMonth() !== v)
3103							d.setUTCDate(d.getUTCDate()-1);
3104						return d;
3105					},
3106					d: function(d,v){
3107						return d.setUTCDate(v);
3108					}
3109				},
3110				val, filtered;
3111			setters_map['yy'] = setters_map['yyyy'];
3112			setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
3113			setters_map['dd'] = setters_map['d'];
3114			date = UTCToday();
3115			var fparts = format.parts.slice();
3116			// Remove noop parts
3117			if (parts.length !== fparts.length){
3118				fparts = $(fparts).filter(function(i,p){
3119					return $.inArray(p, setters_order) !== -1;
3120				}).toArray();
3121			}
3122			// Process remainder
3123			function match_part(){
3124				var m = this.slice(0, parts[i].length),
3125					p = parts[i].slice(0, m.length);
3126				return m.toLowerCase() === p.toLowerCase();
3127			}
3128			if (parts.length === fparts.length){
3129				var cnt;
3130				for (i=0, cnt = fparts.length; i < cnt; i++){
3131					val = parseInt(parts[i], 10);
3132					part = fparts[i];
3133					if (isNaN(val)){
3134						switch (part){
3135							case 'MM':
3136								filtered = $(dates[language].months).filter(match_part);
3137								val = $.inArray(filtered[0], dates[language].months) + 1;
3138								break;
3139							case 'M':
3140								filtered = $(dates[language].monthsShort).filter(match_part);
3141								val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
3142								break;
3143						}
3144					}
3145					parsed[part] = val;
3146				}
3147				var _date, s;
3148				for (i=0; i < setters_order.length; i++){
3149					s = setters_order[i];
3150					if (s in parsed && !isNaN(parsed[s])){
3151						_date = new Date(date);
3152						setters_map[s](_date, parsed[s]);
3153						if (!isNaN(_date))
3154							date = _date;
3155					}
3156				}
3157			}
3158			return date;
3159		},
3160		formatDate: function(date, format, language){
3161			if (!date)
3162				return '';
3163			if (typeof format === 'string')
3164				format = DPGlobal.parseFormat(format);
3165			if (format.toDisplay)
3166                return format.toDisplay(date, format, language);
3167            var val = {
3168				d: date.getUTCDate(),
3169				D: dates[language].daysShort[date.getUTCDay()],
3170				DD: dates[language].days[date.getUTCDay()],
3171				m: date.getUTCMonth() + 1,
3172				M: dates[language].monthsShort[date.getUTCMonth()],
3173				MM: dates[language].months[date.getUTCMonth()],
3174				yy: date.getUTCFullYear().toString().substring(2),
3175				yyyy: date.getUTCFullYear()
3176			};
3177			val.dd = (val.d < 10 ? '0' : '') + val.d;
3178			val.mm = (val.m < 10 ? '0' : '') + val.m;
3179			date = [];
3180			var seps = $.extend([], format.separators);
3181			for (var i=0, cnt = format.parts.length; i <= cnt; i++){
3182				if (seps.length)
3183					date.push(seps.shift());
3184				date.push(val[format.parts[i]]);
3185			}
3186			return date.join('');
3187		},
3188		headTemplate: '<thead>'+
3189			              '<tr>'+
3190			                '<th colspan="7" class="datepicker-title"></th>'+
3191			              '</tr>'+
3192							'<tr>'+
3193								'<th class="prev">'+defaults.templates.leftArrow+'</th>'+
3194								'<th colspan="5" class="datepicker-switch"></th>'+
3195								'<th class="next">'+defaults.templates.rightArrow+'</th>'+
3196							'</tr>'+
3197						'</thead>',
3198		contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
3199		footTemplate: '<tfoot>'+
3200							'<tr>'+
3201								'<th colspan="7" class="today"></th>'+
3202							'</tr>'+
3203							'<tr>'+
3204								'<th colspan="7" class="clear"></th>'+
3205							'</tr>'+
3206						'</tfoot>'
3207	};
3208	DPGlobal.template = '<div class="datepicker">'+
3209							'<div class="datepicker-days">'+
3210								'<table class="table-condensed">'+
3211									DPGlobal.headTemplate+
3212									'<tbody></tbody>'+
3213									DPGlobal.footTemplate+
3214								'</table>'+
3215							'</div>'+
3216							'<div class="datepicker-months">'+
3217								'<table class="table-condensed">'+
3218									DPGlobal.headTemplate+
3219									DPGlobal.contTemplate+
3220									DPGlobal.footTemplate+
3221								'</table>'+
3222							'</div>'+
3223							'<div class="datepicker-years">'+
3224								'<table class="table-condensed">'+
3225									DPGlobal.headTemplate+
3226									DPGlobal.contTemplate+
3227									DPGlobal.footTemplate+
3228								'</table>'+
3229							'</div>'+
3230							'<div class="datepicker-decades">'+
3231								'<table class="table-condensed">'+
3232									DPGlobal.headTemplate+
3233									DPGlobal.contTemplate+
3234									DPGlobal.footTemplate+
3235								'</table>'+
3236							'</div>'+
3237							'<div class="datepicker-centuries">'+
3238								'<table class="table-condensed">'+
3239									DPGlobal.headTemplate+
3240									DPGlobal.contTemplate+
3241									DPGlobal.footTemplate+
3242								'</table>'+
3243							'</div>'+
3244						'</div>';
3245
3246	$.fn.datepicker.DPGlobal = DPGlobal;
3247
3248
3249	/* DATEPICKER NO CONFLICT
3250	* =================== */
3251
3252	$.fn.datepicker.noConflict = function(){
3253		$.fn.datepicker = old;
3254		return this;
3255	};
3256
3257	/* DATEPICKER VERSION
3258	 * =================== */
3259	$.fn.datepicker.version = '1.9.0';
3260
3261	$.fn.datepicker.deprecated = function(msg){
3262		var console = window.console;
3263		if (console && console.warn) {
3264			console.warn('DEPRECATED: ' + msg);
3265		}
3266	};
3267
3268
3269	/* DATEPICKER DATA-API
3270	* ================== */
3271
3272	$(document).on(
3273		'focus.datepicker.data-api click.datepicker.data-api',
3274		'[data-provide="datepicker"]',
3275		function(e){
3276			var $this = $(this);
3277			if ($this.data('datepicker'))
3278				return;
3279			e.preventDefault();
3280			// component click requires us to explicitly show it
3281			datepickerPlugin.call($this, 'show');
3282		}
3283	);
3284	$(function(){
3285		datepickerPlugin.call($('[data-provide="datepicker-inline"]'));
3286	});
3287
3288}));
3289;
3290/* =============================================================
3291 * bootstrap-limit.js v2.0.2
3292 * http://twitter.github.com/bootstrap/javascript.html#limit
3293 * =============================================================
3294 * Copyright 2012 Twitter, Inc.
3295 *
3296 * Licensed under the Apache License, Version 2.0 (the "License");
3297 * you may not use this file except in compliance with the License.
3298 * You may obtain a copy of the License at
3299 *
3300 * http://www.apache.org/licenses/LICENSE-2.0
3301 *
3302 * Unless required by applicable law or agreed to in writing, software
3303 * distributed under the License is distributed on an "AS IS" BASIS,
3304 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3305 * See the License for the specific language governing permissions and
3306 * limitations under the License.
3307 * ============================================================ */
3308
3309!function ($) {
3310
3311    "use strict"
3312
3313    var Limit = function (element, options) {
3314        this.$element = $(element)
3315        this.options = $.extend({}, $.fn.limit.defaults, options)
3316        this.maxChars = this.options.maxChars || this.maxChars
3317        this.normalClass = this.options.normalClass || ""
3318        this.warningClass = this.options.warningClass || ""
3319        this.overLimitClass = this.options.overLimitClass || ""
3320        this.counter = $(this.options.counter) || this.counter
3321        this.listen()
3322
3323        this.check()
3324    }
3325
3326    Limit.prototype = {
3327
3328        constructor: Limit
3329
3330    , listen: function () {
3331        this.$element
3332          .on('keypress', $.proxy(this.keypress, this))
3333          .on('keyup', $.proxy(this.keyup, this))
3334
3335        // TODO: Figure out if this was actually necessary...
3336        // Nick Airdo's hack fix is to just comment-out because THIS NO LONGER SUPPORTED as of jQuery 1.9
3337        //if ($.browser.webkit || $.browser.msie) {
3338        //    this.$element.on('keydown', $.proxy(this.keypress, this))
3339        //}
3340    }
3341
3342    , check: function () {
3343        this.query = this.$element.val()
3344
3345        if (!this.query) {
3346            this.counter.text(this.maxChars)
3347            //this.counter.css('color', 'red')
3348            this.counter.addClass(this.normalClass)
3349            this.$element.trigger('uncross')
3350        }
3351
3352        this.counter.text(this.maxChars - this.query.length)
3353
3354        if (this.query.length > this.maxChars) {
3355            //this.counter.css('color', 'red')
3356            this.counter.removeClass(this.warningClass)
3357            this.counter.addClass(this.overLimitClass)
3358            this.$element.trigger('cross')
3359        } else if (this.query.length > this.maxChars - 10) {
3360            //this.counter.css('color', 'red')
3361            this.counter.removeClass(this.overLimitClass)
3362            this.counter.addClass(this.warningClass)
3363            this.$element.trigger('uncross')
3364        } else {
3365            //this.counter.css('color', '')
3366            this.counter.removeClass(this.warningClass)
3367            this.counter.removeClass(this.overLimitClass)
3368            this.$element.trigger('uncross')
3369        }
3370
3371    }
3372
3373    , keyup: function (e) {
3374
3375        this.check()
3376
3377        e.stopPropagation()
3378        e.preventDefault()
3379    }
3380
3381    , keypress: function (e) {
3382
3383        this.check()
3384
3385        e.stopPropagation()
3386    }
3387    }
3388
3389
3390    /* limit PLUGIN DEFINITION
3391     * =========================== */
3392
3393    $.fn.limit = function (option) {
3394        return this.each(function () {
3395            var $this = $(this)
3396              , data = $this.data('limit')
3397              , options = typeof option == 'object' && option
3398            if (!data) $this.data('limit', (data = new Limit(this, options)))
3399            if (typeof option == 'string') data[option]()
3400        })
3401    }
3402
3403    $.fn.limit.defaults = {
3404        maxChars: 140
3405    , counter: ''
3406    }
3407
3408    $.fn.limit.Constructor = Limit
3409
3410
3411    /* limit DATA-API
3412     * ================== */
3413
3414    $(function () {
3415        $('body').on('focus.limit.data-api', '[data-provide="limit"]', function (e) {
3416            var $this = $(this)
3417            if ($this.data('limit')) return
3418            e.preventDefault()
3419            $this.limit($this.data())
3420        })
3421    })
3422
3423}(window.jQuery);;
3424/* ===========================================================
3425 * bootstrap-modalmanager.js v2.2.5
3426 * ===========================================================
3427 * Copyright 2012 Jordan Schroter.
3428 *
3429 * Licensed under the Apache License, Version 2.0 (the "License");
3430 * you may not use this file except in compliance with the License.
3431 * You may obtain a copy of the License at
3432 *
3433 * http://www.apache.org/licenses/LICENSE-2.0
3434 *
3435 * Unless required by applicable law or agreed to in writing, software
3436 * distributed under the License is distributed on an "AS IS" BASIS,
3437 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3438 * See the License for the specific language governing permissions and
3439 * limitations under the License.
3440 * ========================================================== */
3441
3442!function ($) {
3443
3444	"use strict"; // jshint ;_;
3445
3446	/* MODAL MANAGER CLASS DEFINITION
3447	* ====================== */
3448
3449	var ModalManager = function (element, options) {
3450		this.init(element, options);
3451	};
3452
3453	ModalManager.prototype = {
3454
3455		constructor: ModalManager,
3456
3457		init: function (element, options) {
3458			this.$element = $(element);
3459			this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options == 'object' && options);
3460			this.stack = [];
3461			this.backdropCount = 0;
3462
3463			if (this.options.resize) {
3464				var resizeTimeout,
3465					that = this;
3466
3467				$(window).on('resize.modal', function(){
3468					resizeTimeout && clearTimeout(resizeTimeout);
3469					resizeTimeout = setTimeout(function(){
3470						for (var i = 0; i < that.stack.length; i++){
3471							that.stack[i].isShown && that.stack[i].layout();
3472						}
3473					}, 10);
3474				});
3475			}
3476		},
3477
3478		createModal: function (element, options) {
3479			$(element).modal($.extend({ manager: this }, options));
3480		},
3481
3482		appendModal: function (modal) {
3483			this.stack.push(modal);
3484
3485			var that = this;
3486
3487			modal.$element.on('show.modalmanager', targetIsSelf(function (e) {
3488
3489				var showModal = function(){
3490					modal.isShown = true;
3491
3492					var transition = $.support.transition && modal.$element.hasClass('fade');
3493
3494					that.$element
3495						.toggleClass('modal-open', that.hasOpenModal())
3496						.toggleClass('page-overflow', $(window).height() < that.$element.height());
3497
3498					modal.$parent = modal.$element.parent();
3499
3500					modal.$container = that.createContainer(modal);
3501
3502					modal.$element.appendTo(modal.$container);
3503
3504					that.backdrop(modal, function () {
3505						modal.$element.show();
3506
3507						if (transition) {       
3508							//modal.$element[0].style.display = 'run-in';       
3509							modal.$element[0].offsetWidth;
3510							//modal.$element.one($.support.transition.end, function () { modal.$element[0].style.display = 'block' });  
3511						}
3512						
3513						modal.layout();
3514
3515						modal.$element
3516							.addClass('in')
3517							.attr('aria-hidden', false);
3518
3519						var complete = function () {
3520							that.setFocus();
3521							modal.$element.trigger('shown');
3522						};
3523
3524						transition ?
3525							modal.$element.one($.support.transition.end, complete) :
3526							complete();
3527					});
3528				};
3529
3530				modal.options.replace ?
3531					that.replace(showModal) :
3532					showModal();
3533			}));
3534
3535			modal.$element.on('hidden.modalmanager', targetIsSelf(function (e) {
3536				that.backdrop(modal);
3537				// handle the case when a modal may have been removed from the dom before this callback executes
3538				if (!modal.$element.parent().length) {
3539					that.destroyModal(modal);
3540				} else if (modal.$backdrop){
3541					var transition = $.support.transition && modal.$element.hasClass('fade');
3542
3543					// trigger a relayout due to firebox's buggy transition end event 
3544					if (transition) { modal.$element[0].offsetWidth; }
3545					$.support.transition && modal.$element.hasClass('fade') ?
3546						modal.$backdrop.one($.support.transition.end, function () { modal.destroy(); }) :
3547						modal.destroy();
3548				} else {
3549					modal.destroy();
3550				}
3551
3552			}));
3553
3554			modal.$element.on('destroyed.modalmanager', targetIsSelf(function (e) {
3555				that.destroyModal(modal);
3556			}));
3557		},
3558
3559		getOpenModals: function () {
3560			var openModals = [];
3561			for (var i = 0; i < this.stack.length; i++){
3562				if (this.stack[i].isShown) openModals.push(this.stack[i]);
3563			}
3564
3565			return openModals;
3566		},
3567
3568		hasOpenModal: function () {
3569			return this.getOpenModals().length > 0;
3570		},
3571
3572		setFocus: function () {
3573			var topModal;
3574
3575			for (var i = 0; i < this.stack.length; i++){
3576				if (this.stack[i].isShown) topModal = this.stack[i];
3577			}
3578
3579			if (!topModal) return;
3580
3581			topModal.focus();
3582		},
3583
3584		destroyModal: function (modal) {
3585			modal.$element.off('.modalmanager');
3586			if (modal.$backdrop) this.removeBackdrop(modal);
3587			this.stack.splice(this.getIndexOfModal(modal), 1);
3588
3589			var hasOpenModal = this.hasOpenModal();
3590
3591			this.$element.toggleClass('modal-open', hasOpenModal);
3592
3593			if (!hasOpenModal){
3594				this.$element.removeClass('page-overflow');
3595			}
3596
3597			this.removeContainer(modal);
3598
3599			this.setFocus();
3600		},
3601
3602		getModalAt: function (index) {
3603			return this.stack[index];
3604		},
3605
3606		getIndexOfModal: function (modal) {
3607			for (var i = 0; i < this.stack.length; i++){
3608				if (modal === this.stack[i]) return i;
3609			}
3610		},
3611
3612		replace: function (callback) {
3613			var topModal;
3614
3615			for (var i = 0; i < this.stack.length; i++){
3616				if (this.stack[i].isShown) topModal = this.stack[i];
3617			}
3618
3619			if (topModal) {
3620				this.$backdropHandle = topModal.$backdrop;
3621				topModal.$backdrop = null;
3622
3623				callback && topModal.$element.one('hidden',
3624					targetIsSelf( $.proxy(callback, this) ));
3625
3626				topModal.hide();
3627			} else if (callback) {
3628				callback();
3629			}
3630		},
3631
3632		removeBackdrop: function (modal) {
3633			modal.$backdrop.remove();
3634			modal.$backdrop = null;
3635		},
3636
3637		createBackdrop: function (animate, tmpl) {
3638			var $backdrop;
3639
3640			if (!this.$backdropHandle) {
3641				$backdrop = $(tmpl)
3642					.addClass(animate)
3643					.appendTo(this.$element);
3644			} else {
3645				$backdrop = this.$backdropHandle;
3646				$backdrop.off('.modalmanager');
3647				this.$backdropHandle = null;
3648				this.isLoading && this.removeSpinner();
3649			}
3650
3651			return $backdrop;
3652		},
3653
3654		removeContainer: function (modal) {
3655			modal.$container.remove();
3656			modal.$container = null;
3657		},
3658
3659		createContainer: function (modal) {
3660			var $container;
3661
3662			$container = $('<div class="modal-scrollable">')
3663				.css('z-index', getzIndex('modal', this.getOpenModals().length))
3664				.appendTo(this.$element);
3665
3666			if (modal && modal.options.backdrop != 'static') {
3667				$container.on('click.modal', targetIsSelf(function (e) {
3668					modal.hide();
3669				}));
3670			} else if (modal) {
3671				$container.on('click.modal', targetIsSelf(function (e) {
3672					modal.attention();
3673				}));
3674			}
3675
3676			return $container;
3677
3678		},
3679
3680		backdrop: function (modal, callback) {
3681			var animate = modal.$element.hasClass('fade') ? 'fade' : '',
3682				showBackdrop = modal.options.backdrop &&
3683					this.backdropCount < this.options.backdropLimit;
3684
3685			if (modal.isShown && showBackdrop) {
3686				var doAnimate = $.support.transition && animate && !this.$backdropHandle;
3687
3688				modal.$backdrop = this.createBackdrop(animate, modal.options.backdropTemplate);
3689
3690				modal.$backdrop.css('z-index', getzIndex( 'backdrop', this.getOpenModals().length ));
3691
3692				if (doAnimate) modal.$backdrop[0].offsetWidth; // force reflow
3693
3694				modal.$backdrop.addClass('in');
3695
3696				this.backdropCount += 1;
3697
3698				doAnimate ?
3699					modal.$backdrop.one($.support.transition.end, callback) :
3700					callback();
3701
3702			} else if (!modal.isShown && modal.$backdrop) {
3703				modal.$backdrop.removeClass('in');
3704
3705				this.backdropCount -= 1;
3706
3707				var that = this;
3708
3709				$.support.transition && modal.$element.hasClass('fade')?
3710					modal.$backdrop.one($.support.transition.end, function () { that.removeBackdrop(modal) }) :
3711					that.removeBackdrop(modal);
3712
3713			} else if (callback) {
3714				callback();
3715			}
3716		},
3717
3718		removeSpinner: function(){
3719			this.$spinner && this.$spinner.remove();
3720			this.$spinner = null;
3721			this.isLoading = false;
3722		},
3723
3724		removeLoading: function () {
3725			this.$backdropHandle && this.$backdropHandle.remove();
3726			this.$backdropHandle = null;
3727			this.removeSpinner();
3728		},
3729
3730		loading: function (callback) {
3731			callback = callback || function () { };
3732
3733			this.$element
3734				.toggleClass('modal-open', !this.isLoading || this.hasOpenModal())
3735				.toggleClass('page-overflow', $(window).height() < this.$element.height());
3736
3737			if (!this.isLoading) {
3738
3739				this.$backdropHandle = this.createBackdrop('fade', this.options.backdropTemplate);
3740
3741				this.$backdropHandle[0].offsetWidth; // force reflow
3742
3743				var openModals = this.getOpenModals();
3744
3745				this.$backdropHandle
3746					.css('z-index', getzIndex('backdrop', openModals.length + 1))
3747					.addClass('in');
3748
3749				var $spinner = $(this.options.spinner)
3750					.css('z-index', getzIndex('modal', openModals.length + 1))
3751					.appendTo(this.$element)
3752					.addClass('in');
3753
3754				this.$spinner = $(this.createContainer())
3755					.append($spinner)
3756					.on('click.modalmanager', $.proxy(this.loading, this));
3757
3758				this.isLoading = true;
3759
3760				$.support.transition ?
3761					this.$backdropHandle.one($.support.transition.end, callback) :
3762					callback();
3763
3764			} else if (this.isLoading && this.$backdropHandle) {
3765				this.$backdropHandle.removeClass('in');
3766
3767				var that = this;
3768				$.support.transition ?
3769					this.$backdropHandle.one($.support.transition.end, function () { that.removeLoading() }) :
3770					that.removeLoading();
3771
3772			} else if (callback) {
3773				callback(this.isLoading);
3774			}
3775		}
3776	};
3777
3778	/* PRIVATE METHODS
3779	* ======================= */
3780
3781	// computes and caches the zindexes
3782	var getzIndex = (function () {
3783		var zIndexFactor,
3784			baseIndex = {};
3785
3786		return function (type, pos) {
3787
3788			if (typeof zIndexFactor === 'undefined'){
3789				var $baseModal = $('<div class="modal hide" />').appendTo('body'),
3790					$baseBackdrop = $('<div class="modal-backdrop hide" />').appendTo('body');
3791
3792				baseIndex['modal'] = +$baseModal.css('z-index');
3793				baseIndex['backdrop'] = +$baseBackdrop.css('z-index');
3794				zIndexFactor = baseIndex['modal'] - baseIndex['backdrop'];
3795
3796				$baseModal.remove();
3797				$baseBackdrop.remove();
3798				$baseBackdrop = $baseModal = null;
3799			}
3800
3801			return baseIndex[type] + (zIndexFactor * pos);
3802
3803		}
3804	}());
3805
3806	// make sure the event target is the modal itself in order to prevent
3807	// other components such as tabsfrom triggering the modal manager.
3808	// if Boostsrap namespaced events, this would not be needed.
3809	function targetIsSelf(callback){
3810		return function (e) {
3811			if (e && this === e.target){
3812				return callback.apply(this, arguments);
3813			}
3814		}
3815	}
3816
3817
3818	/* MODAL MANAGER PLUGIN DEFINITION
3819	* ======================= */
3820
3821	$.fn.modalmanager = function (option, args) {
3822		return this.each(function () {
3823			var $this = $(this),
3824				data = $this.data('modalmanager');
3825
3826			if (!data) $this.data('modalmanager', (data = new ModalManager(this, option)));
3827			if (typeof option === 'string') data[option].apply(data, [].concat(args))
3828		})
3829	};
3830
3831	$.fn.modalmanager.defaults = {
3832		backdropLimit: 999,
3833		resize: true,
3834		spinner: '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',
3835		backdropTemplate: '<div class="modal-backdrop" />'
3836	};
3837
3838	$.fn.modalmanager.Constructor = ModalManager
3839
3840	// ModalManager handles the modal-open class so we need 
3841	// to remove conflicting bootstrap 3 event handlers
3842	$(function () {
3843		$(document).off('show.bs.modal').off('hidden.bs.modal');
3844	});
3845
3846}(jQuery);
3847;
3848/* ===========================================================
3849 * bootstrap-modal.js v2.2.5
3850 * ===========================================================
3851 * Copyright 2012 Jordan Schroter
3852 *
3853 * Licensed under the Apache License, Version 2.0 (the "License");
3854 * you may not use this file except in compliance with the License.
3855 * You may obtain a copy of the License at
3856 *
3857 * http://www.apache.org/licenses/LICENSE-2.0
3858 *
3859 * Unless required by applicable law or agreed to in writing, software
3860 * distributed under the License is distributed on an "AS IS" BASIS,
3861 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3862 * See the License for the specific language governing permissions and
3863 * limitations under the License.
3864 * ========================================================== */
3865
3866
3867!function ($) {
3868
3869	"use strict"; // jshint ;_;
3870
3871	/* MODAL CLASS DEFINITION
3872	* ====================== */
3873
3874	var Modal = function (element, options) {
3875		this.init(element, options);
3876	};
3877
3878	Modal.prototype = {
3879
3880		constructor: Modal,
3881
3882		init: function (element, options) {
3883			var that = this;
3884
3885			this.options = options;
3886
3887			this.$element = $(element)
3888				.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this));
3889
3890			this.options.remote && this.$element.find('.modal-body').load(this.options.remote, function () {
3891				var e = $.Event('loaded');
3892				that.$element.trigger(e);
3893			});
3894
3895			var manager = typeof this.options.manager === 'function' ?
3896				this.options.manager.call(this) : this.options.manager;
3897
3898			manager = manager.appendModal ?
3899				manager : $(manager).modalmanager().data('modalmanager');
3900
3901			manager.appendModal(this);
3902		},
3903
3904		toggle: function () {
3905			return this[!this.isShown ? 'show' : 'hide']();
3906		},
3907
3908		show: function () {
3909			var e = $.Event('show');
3910
3911			if (this.isShown) return;
3912
3913			this.$element.trigger(e);
3914
3915			if (e.isDefaultPrevented()) return;
3916
3917			this.escape();
3918
3919			this.tab();
3920
3921			this.options.loading && this.loading();
3922		},
3923
3924		hide: function (e) {
3925			e && e.preventDefault();
3926
3927			e = $.Event('hide');
3928
3929			this.$element.trigger(e);
3930
3931			if (!this.isShown || e.isDefaultPrevented()) return;
3932
3933			this.isShown = false;
3934
3935			this.escape();
3936
3937			this.tab();
3938
3939			this.isLoading && this.loading();
3940
3941			$(document).off('focusin.modal');
3942
3943			this.$element
3944				.removeClass('in')
3945				.removeClass('animated')
3946				.removeClass(this.options.attentionAnimation)
3947				.removeClass('modal-overflow')
3948				.attr('aria-hidden', true);
3949
3950			$.support.transition && this.$element.hasClass('fade') ?
3951				this.hideWithTransition() :
3952				this.hideModal();
3953		},
3954
3955		layout: function () {
3956			var prop = this.options.height ? 'height' : 'max-height',
3957				value = this.options.height || this.options.maxHeight;
3958
3959			if (this.options.width){
3960				this.$element.css('width', this.options.width);
3961
3962				var that = this;
3963				this.$element.css('margin-left', function () {
3964					if (/%/ig.test(that.options.width)){
3965						return -(parseInt(that.options.width) / 2) + '%';
3966					} else {
3967						return -($(this).width() / 2) + 'px';
3968					}
3969				});
3970			} else {
3971				this.$element.css('width', '');
3972				this.$element.css('margin-left', '');
3973			}
3974
3975			this.$element.find('.modal-body')
3976				.css('overflow', '')
3977				.css(prop, '');
3978
3979			if (value){
3980				this.$element.find('.modal-body')
3981					.css('overflow', 'auto')
3982					.css(prop, value);
3983			}
3984
3985			var modalOverflow = $(window).height() - 10 < this.$element.height();
3986            
3987			if (modalOverflow || this.options.modalOverflow) {
3988				this.$element
3989					.css('margin-top', 0)
3990					.addClass('modal-overflow');
3991			} else {
3992				this.$element
3993					.css('margin-top', 0 - this.$element.height() / 2)
3994					.removeClass('modal-overflow');
3995			}
3996		},
3997
3998		tab: function () {
3999			var that = this;
4000
4001			if (this.isShown && this.options.consumeTab) {
4002				this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) {
4003			    	if (e.keyCode && e.keyCode == 9){
4004						var elements = [],
4005							tabindex = Number($(this).data('tabindex'));
4006
4007						that.$element.find('[data-tabindex]:enabled:visible:not([readonly])').each(function (ev) {
4008							elements.push(Number($(this).data('tabindex')));
4009						});
4010						elements.sort(function(a,b){return a-b});
4011						
4012						var arrayPos = $.inArray(tabindex, elements);
4013						if (!e.shiftKey){
4014						 		arrayPos < elements.length-1 ?
4015									that.$element.find('[data-tabindex='+elements[arrayPos+1]+']').focus() :
4016									that.$element.find('[data-tabindex='+elements[0]+']').focus();
4017							} else {
4018								arrayPos == 0 ?
4019									that.$element.find('[data-tabindex='+elements[elements.length-1]+']').focus() :
4020									that.$element.find('[data-tabindex='+elements[arrayPos-1]+']').focus();
4021							}
4022						
4023						e.preventDefault();
4024					}
4025				});
4026			} else if (!this.isShown) {
4027				this.$element.off('keydown.tabindex.modal');
4028			}
4029		},
4030
4031		escape: function () {
4032			var that = this;
4033			if (this.isShown && this.options.keyboard) {
4034				if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1);
4035
4036				this.$element.on('keyup.dismiss.modal', function (e) {
4037					e.which == 27 && that.hide();
4038				});
4039			} else if (!this.isShown) {
4040				this.$element.off('keyup.dismiss.modal')
4041			}
4042		},
4043
4044		hideWithTransition: function () {
4045			var that = this
4046				, timeout = setTimeout(function () {
4047					that.$element.off($.support.transition.end);
4048					that.hideModal();
4049				}, 500);
4050
4051			this.$element.one($.support.transition.end, function () {
4052				clearTimeout(timeout);
4053				that.hideModal();
4054			});
4055		},
4056
4057		hideModal: function () {
4058			var prop = this.options.height ? 'height' : 'max-height';
4059			var value = this.options.height || this.options.maxHeight;
4060
4061			if (value){
4062				this.$element.find('.modal-body')
4063					.css('overflow', '')
4064					.css(prop, '');
4065			}
4066
4067			this.$element
4068				.hide()
4069				.trigger('hidden');
4070		},
4071
4072		removeLoading: function () {
4073			this.$loading.remove();
4074			this.$loading = null;
4075			this.isLoading = false;
4076		},
4077
4078		loading: function (callback) {
4079			callback = callback || function () {};
4080
4081			var animate = this.$element.hasClass('fade') ? 'fade' : '';
4082
4083			if (!this.isLoading) {
4084				var doAnimate = $.support.transition && animate;
4085
4086				this.$loading = $('<div class="loading-mask ' + animate + '">')
4087					.append(this.options.spinner)
4088					.appendTo(this.$element);
4089
4090				if (doAnimate) this.$loading[0].offsetWidth; // force reflow
4091
4092				this.$loading.addClass('in');
4093
4094				this.isLoading = true;
4095
4096				doAnimate ?
4097					this.$loading.one($.support.transition.end, callback) :
4098					callback();
4099
4100			} else if (this.isLoading && this.$loading) {
4101				this.$loading.removeClass('in');
4102
4103				var that = this;
4104				$.support.transition && this.$element.hasClass('fade')?
4105					this.$loading.one($.support.transition.end, function () { that.removeLoading() }) :
4106					that.removeLoading();
4107
4108			} else if (callback) {
4109				callback(this.isLoading);
4110			}
4111		},
4112
4113		focus: function () {
4114			var $focusElem = this.$element.find(this.options.focusOn);
4115
4116			$focusElem = $focusElem.length ? $focusElem : this.$element;
4117
4118			$focusElem.focus();
4119		},
4120
4121		attention: function (){
4122			// NOTE: transitionEnd with keyframes causes odd behaviour
4123
4124			if (this.options.attentionAnimation){
4125				this.$element
4126					.removeClass('animated')
4127					.removeClass(this.options.attentionAnimation);
4128
4129				var that = this;
4130
4131				setTimeout(function () {
4132					that.$element
4133						.addClass('animated')
4134						.addClass(that.options.attentionAnimation);
4135				}, 0);
4136			}
4137
4138
4139			this.focus();
4140		},
4141
4142
4143		destroy: function () {
4144			var e = $.Event('destroy');
4145
4146			this.$element.trigger(e);
4147
4148			if (e.isDefaultPrevented()) return;
4149
4150			this.$element
4151				.off('.modal')
4152				.removeData('modal')
4153				.removeClass('in')
4154				.attr('aria-hidden', true);
4155			
4156			if (this.$parent !== this.$element.parent()) {
4157				this.$element.appendTo(this.$parent);
4158			} else if (!this.$parent.length) {
4159				// modal is not part of the DOM so remove it.
4160				this.$element.remove();
4161				this.$element = null;
4162			}
4163
4164			this.$element.trigger('destroyed');
4165		}
4166	};
4167
4168
4169	/* MODAL PLUGIN DEFINITION
4170	* ======================= */
4171
4172	$.fn.modal = function (option, args) {
4173		return this.each(function () {
4174			var $this = $(this),
4175				data = $this.data('modal'),
4176				options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option);
4177
4178			if (!data) $this.data('modal', (data = new Modal(this, options)));
4179			if (typeof option == 'string') data[option].apply(data, [].concat(args));
4180			else if (options.show) data.show()
4181		})
4182	};
4183
4184	$.fn.modal.defaults = {
4185		keyboard: true,
4186		backdrop: true,
4187		loading: false,
4188		show: true,
4189		width: null,
4190		height: null,
4191		maxHeight: null,
4192		modalOverflow: false,
4193		consumeTab: true,
4194		focusOn: null,
4195		replace: false,
4196		resize: false,
4197		attentionAnimation: 'shake',
4198		manager: 'body',
4199		spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>',
4200		backdropTemplate: '<div class="modal-backdrop" />'
4201	};
4202
4203	$.fn.modal.Constructor = Modal;
4204
4205
4206	/* MODAL DATA-API
4207	* ============== */
4208
4209	$(function () {
4210		$(document).off('click.modal').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
4211			var $this = $(this),
4212				href = $this.attr('href'),
4213				$target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7
4214				option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data());
4215
4216			e.preventDefault();
4217			$target
4218				.modal(option)
4219				.one('hide', function () {
4220					$this.focus();
4221				})
4222		});
4223	});
4224
4225}(window.jQuery);
4226;
4227/**
4228 * bootbox.js v4.1.0
4229 *
4230 * http://bootboxjs.com/license.txt
4231 *
4232 * NOTE: Removed the 'use strict' option as it causes an issue when using _doPostback within a confirmation callback ( DT 2015/09/28 )
4233 *
4234 */
4235window.bootbox=window.bootbox||function a(b,c){function d(a){var b=r[p.locale];return b?b[a]:r.en[a]}function e(a,c,d){a.preventDefault();var e=b.isFunction(d)&&d(a)===!1;e||c.modal("hide")}function f(a){var b,c=0;for(b in a)c++;return c}function g(a,c){var d=0;b.each(a,function(a,b){c(a,b,d++)})}function h(a){var c,d;if("object"!=typeof a)throw new Error("Please supply an object of options");if(!a.message)throw new Error("Please specify a message");return a=b.extend({},p,a),a.buttons||(a.buttons={}),a.backdrop=a.backdrop?"static":!1,c=a.buttons,d=f(c),g(c,function(a,e,f){if(b.isFunction(e)&&(e=c[a]={callback:e}),"object"!==b.type(e))throw new Error("button with key "+a+" must be an object");e.label||(e.label=a),e.className||(e.className=2>=d&&f===d-1?"btn-primary":"btn-default")}),a}function i(a,b){var c=a.length,d={};if(1>c||c>2)throw new Error("Invalid argument length");return 2===c||"string"==typeof a[0]?(d[b[0]]=a[0],d[b[1]]=a[1]):d=a[0],d}function j(a,c,d){return b.extend(!0,{},a,i(c,d))}function k(a,b,c,d){var e={className:"bootbox-"+a,buttons:l.apply(null,b)};return m(j(e,d,c),b)}function l(){for(var a={},b=0,c=arguments.length;c>b;b++){var e=arguments[b],f=e.toLowerCase(),g=e.toUpperCase();a[f]={label:d(g)}}return a}function m(a,b){var d={};return g(b,function(a,b){d[b]=!0}),g(a.buttons,function(a){if(d[a]===c)throw new Error("button key "+a+" is not allowed (options are "+b.join("\n")+")")}),a}var n={dialog:"<div class='bootbox modal' tabindex='-1' role='dialog'><div class='modal-dialog'><div class='modal-content'><div class='modal-body'><div class='bootbox-body'></div></div></div></div></div>",header:"<div class='modal-header'><h4 class='modal-title'></h4></div>",footer:"<div class='modal-footer'></div>",closeButton:"<button type='button' class='bootbox-close-button close'>&times;</button>",form:"<form class='bootbox-form'></form>",inputs:{text:"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",email:"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",select:"<select class='bootbox-input bootbox-input-select form-control'></select>",checkbox:"<div class='checkbox'><label>
4235<input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>"}},o=b("body"),p={locale:"en",backdrop:!0,animate:!0,className:null,closeButton:!0,show:!0},q={};q.alert=function(){var a;if(a=k("alert",["ok"],["message","callback"],arguments),a.callback&&!b.isFunction(a.callback))throw new Error("alert requires callback property to be a function when provided");return a.buttons.ok.callback=a.onEscape=function(){return b.isFunction(a.callback)?a.callback():!0},q.dialog(a)},q.confirm=function(){var a;if(a=k("confirm",["cancel","confirm"],["message","callback"],arguments),a.buttons.cancel.callback=a.onEscape=function(){return a.callback(!1)},a.buttons.confirm.callback=function(){return a.callback(!0)},!b.isFunction(a.callback))throw new Error("confirm requires a callback");return q.dialog(a)},q.prompt=function(){var a,d,e,f,h,i,k;if(f=b(n.form),d={className:"bootbox-prompt",buttons:l("cancel","confirm"),value:"",inputType:"text"},a=m(j(d,arguments,["title","callback"]),["cancel","confirm"]),i=a.show===c?!0:a.show,a.message=f,a.buttons.cancel.callback=a.onEscape=function(){return a.callback(null)},a.buttons.confirm.callback=function(){var c;switch(a.inputType){case"text":case"email":case"select":c=h.val();break;case"checkbox":var d=h.find("input:checked");c=[],g(d,function(a,d){c.push(b(d).val())})}return a.callback(c)},a.show=!1,!a.title)throw new Error("prompt requires a title");if(!b.isFunction(a.callback))throw new Error("prompt requires a callback");if(!n.inputs[a.inputType])throw new Error("invalid prompt type");switch(h=b(n.inputs[a.inputType]),a.inputType){case"text":case"email":h.val(a.value);break;case"select":var o={};if(k=a.inputOptions||[],!k.length)throw new Error("prompt with select requires options");g(k,function(a,d){var e=h;if(d.value===c||d.text===c)throw new Error("given options in wrong format");d.group&&(o[d.group]||(o[d.group]=b("<optgroup/>").attr("label",d.group)),e=o[d.group]),e.append("<option value='"+d.value+"'>"+d.text+"</option>")}),g(o,function(a,b){h.append(b)}),h.val(a.value);break;case"checkbox":var p=b.isArray(a.value)?a.value:[a.value];if(k=a.inputOptions||[],!k.length)throw new Error("prompt with checkbox requires options");if(!k[0].value||!k[0].text)throw new Error("given options in wrong format");h=b("<div/>"),g(k,function(c,d){var e=b(n.inputs[a.inputType]);e.find("input").attr("value",d.value),e.find("label").append(d.text),g(p,function(a,b){b===d.value&&e.find("input").prop("checked",!0)}),h.append(e)})}return a.placeholder&&h.attr("placeholder",a.placeholder),f.append(h),f.on("submit",function(a){a.preventDefault(),e.find(".btn-primary").click()}),e=q.dialog(a),e.off("shown.bs.modal"),e.on("shown.bs.modal",function(){h.focus()}),i===!0&&e.modal("show"),e},q.dialog=function(a){a=h(a);var c=b(n.dialog),d=c.find(".modal-body"),f=a.buttons,i="",j={onEscape:a.onEscape};if(g(f,function(a,b){i+="<button data-bb-handler='"+a+"' type='button' class='btn "+b.className+"'>"+b.label+"</button>",j[a]=b.callback}),d.find(".bootbox-body").html(a.message),a.animate===!0&&c.addClass("fade"),a.className&&c.addClass(a.className),a.title&&d.before(n.header),a.closeButton){var k=b(n.closeButton);a.title?c.find(".modal-header").prepend(k):k.css("margin-top","-10px").prependTo(d)}return a.title&&c.find(".modal-title").html(a.title),i.length&&(d.after(n.footer),c.find(".modal-footer").html(i)),c.on("hidden.bs.modal",function(a){a.target===this&&c.remove()}),c.on("shown.bs.modal",function(){c.find(".btn-primary:first").focus()}),c.on("escape.close.bb",function(a){j.onEscape&&e(a,c,j.onEscape)}),c.on("click",".modal-footer button",function(a){var d=b(this).data("bb-handler");e(a,c,j[d])}),c.on("click",".bootbox-close-button",function(a){e(a,c,j.onEscape)}),c.on("keyup",function(a){27===a.which&&c.trigger("escape.close.bb")}),o.append(c),c.modal({backdrop:a.backdrop,keyboard:!1,show:!1}),a.show&&c.modal("show"),c},q.setDefaults=function(){var a={};2===arguments.length?a[arguments[0]]=arguments[1]:a=arguments[0],b.extend(p,a)},q.hideAll=function(){b(".bootbox").modal("hide")};var r={br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"Potwierdź"},ru:{OK:"OK",CANCEL:"Отмена",CONFIRM:"Применить"},zh_CN:{OK:"OK",CANCEL:"取消",CONFIRM:"确认"},zh_TW:{OK:"OK",CANCEL:"取消",CONFIRM:"確認"}};return q.init=function(c){window.bootbox=a(c||b)},q}(window.jQuery);;
4236/* Chosen v1.8.7 Rock RMS Adds | (c) 2011-2023 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
4237!function(){var o,e,h,r=class{constructor(){this.options_index=0,this.parsed=[]}add_node(e){return"OPTGROUP"===e.nodeName.toUpperCase()?this.add_group(e):this.add_option(e)}add_group(e){var t,s,i,h,l,r=this.parsed.length;for(this.parsed.push({array_index:r,group:!0,label:e.label,title:e.title||void 0,children:0,disabled:e.disabled,classes:e.className}),l=[],t=0,s=(h=e.childNodes).length;t<s;t++)i=h[t],l.push(this.add_option(i,r,e.disabled));return l}add_option(e,t,s){if("OPTION"===e.nodeName.toUpperCase())return""!==e.text?(null!=t&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,title:e.title||void 0,selected:e.selected,disabled:!0===s?s:e.disabled,group_array_index:t,group_label:null!=t?this.parsed[t].label:null,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1}};r.select_to_array=function(e){for(var t,s=new r,i=e.childNodes,h=0,l=i.length;h<l;h++)t=i[h],s.add_node(t);return s.parsed},e=function(){class s{constructor(e,t={}){this.label_click_handler=this.label_click_handler.bind(this),this.form_field=e,this.options=t,s.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}set_default_values(){return this.click_test_action=e=>this.test_active_click(e),this.activate_action=e=>this.activate_field(e),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select}set_default_text(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||s.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||s.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||s.default_no_result_text}choice_label(e){return this.include_group_label_in_selected&&null!=e.group_label?`<b class='group-name'>${this.escape_html(e.group_label)}</b>`+e.html:e.html}mouse_enter(){return this.mouse_on_container=!0}mouse_leave(){return this.mouse_on_container=!1}input_focus(e){if(this.is_multiple){if(!this.active_field)return setTimeout(()=>this.container_mousedown(),50)}else if(!this.active_field)return this.activate_field()}input_blur(e){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(()=>this.blur_test(),100)}label_click_handler(e){return this.is_multiple?this.container_mousedown(e):this.activate_field()}results_option_build(e){for(var t,s,i="",h=0,l=this.results_data,r=0,o=l.length;r<o&&((s="")!==(s=(t=l[r]).group?this.result_add_group(t):this.result_add_option(t))&&(h++,i+=s),null!=e&&e.first&&(t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(t))),!(h>=this.max_shown_results));r++);return i}result_add_option(e){var t,s;return e.search_match&&this.include_option_in_results(e)?(t=[],e.disabled||e.selected&&this.is_multiple||t.push("active-result"),!e.disabled||e.selected&&this.is_multiple||t.push("disabled-result"),e.selected&&t.push("result-selected"),null!=e.group_array_index&&t.push("group-option"),""!==e.classes&&t.pu
4237sh(e.classes),(s=document.createElement("li")).className=t.join(" "),e.style&&(s.style.cssText=e.style),s.setAttribute("data-option-array-index",e.array_index),s.innerHTML=e.highlighted_html||e.html,e.title&&(s.title=e.title),this.outerHTML(s)):""}result_add_group(e){var t,s;return(e.search_match||e.group_match)&&0<e.active_options?((t=[]).push("group-result"),e.classes&&t.push(e.classes),(s=document.createElement("li")).className=t.join(" "),s.innerHTML=e.highlighted_html||this.escape_html(e.label),e.title&&(s.title=e.title),this.outerHTML(s)):""}results_update_field(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()}reset_single_select_options(){for(var e,t=this.results_data,s=[],i=0,h=t.length;i<h;i++)(e=t[i]).selected?s.push(e.selected=!1):s.push(void 0);return s}results_toggle(){return this.results_showing?this.results_hide():this.results_show()}results_search(e){return this.results_showing?this.winnow_results():this.results_show()}winnow_results(e){var t,s,i,h,l,r,o,n,_,a,c,d,u;for(this.no_results_clear(),a=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),_=this.get_search_regex(t),i=0,h=(n=this.results_data).length;i<h;i++)(l=n[i]).search_match=!1,c=null,l.highlighted_html="",this.include_option_in_results(l)&&(l.group&&(l.group_match=!1,l.active_options=0),null!=l.group_array_index&&this.results_data[l.group_array_index]&&(0===(c=this.results_data[l.group_array_index]).active_options&&c.search_match&&(a+=1),c.active_options+=1),u=l.group?l.label:l.text,l.group&&!this.group_search||(d=this.search_string_match(u,_),l.search_match=null!=d,l.search_match&&!l.group&&(a+=1),l.search_match?(o.length&&(d=d.index,r=u.slice(0,d),s=u.slice(d,d+o.length),u=u.slice(d+o.length),l.highlighted_html=`${this.escape_html(r)}<em>${this.escape_html(s)}</em>`+this.escape_html(u)),null!=c&&(c.group_match=!0)):null!=l.group_array_index&&this.results_data[l.group_array_index].search_match&&(l.search_match=!0)));return this.result_clear_highlight(),a<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),null!=e&&e.skip_highlight?void 0:this.winnow_results_set_highlight())}get_search_regex(e){var t,e=this.search_contains?e:`(^|\\s|\\b)${e}[^\\s]*`;return this.enable_split_word_search||this.search_contains||(e="^"+e),t=this.case_sensitive_search?"":"i",new RegExp(e,t)}search_string_match(e,t){t=t.exec(e);return!this.search_contains&&null!=t&&t[1]&&(t.index+=1),t}choices_count(){var e,t,s;if(null==this.selected_option_count)for(e=this.selected_option_count=0,t=(s=this.form_field.options).length;e<t;e++)s[e].selected&&(this.selected_option_count+=1);return this.selected_option_count}choices_click(e){if(e.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()}keydown_checker(e){var t=null!=(t=e.which)?t:e.keyCode;switch(this.search_field_scale(),8!==t&&this.pending_backstroke&&this.clear_backstroke(),t){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&e.preventDefault();break;case 32:this.disable_search&&e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:e.preventDefault(),this.keydown_arrow()}}keyup_checker(e){var t=null!=(t=e.which)?t:e.keyCode;switch(this.search_field_scale(),t){case 8:this.is_multiple&&this.backstroke_length<1&&0<this.choices_count()?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:e.preventDefault(),this.results_showing&&this.result_select(e);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}}clipboard_event_checker(e){if(!this.is_disabled)return setTimeout(()=>this.results_search(),50)}container_width(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"}include_option_in_results(e){return!(this.is_multiple&&!this.display_selected_options&&e.selected||!this.display_disabled_options&&e.disabled||e.empty)}search_results_touchstart(e){return this.touch_started=!0,this.search_results_mouseover(e)}search_results_touchmove(e){return this.touch_started=!1,this.search_results_mouseout(e)}search_results_touchend(e){if(this.touch_started)return this.search_results_mouseup(e)}outerHTML(e){var t;return e.outerHTML||((t=document.createElement("div")).appendChild(e),t.innerHTML)}get_single_html(){return`<a class="chosen-single chosen-default">
4238  <span>${this.default_text}</span>
4239  <div><b></b></div>
4240</a>
4241<div class="chosen-drop">
4242  <div class="chosen-search">
4243    <input class="chosen-search-input" type="search" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" autocomplete="off" />
4244  </div>
4245  <ul class="chosen-results"></ul>
4246</div>`}get_multi_html(){return`<ul class="chosen-choices">
4247  <li class="search-field">
4248    <input class="chosen-search-input" type="search" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" autocomplete="off" value="${this.default_text}" />
4249  </li>
4250</ul>
4251<div class="chosen-drop">
4252  <ul class="chosen-results"></ul>
4253</div>`}get_no_results_html(e){return`<li class="no-results">
4254  ${this.results_none_found} <span>${this.escape_html(e)}</span>
4255</li>`}static browser_is_supported(){return"Microsoft Internet Explorer"===window.navigator.appName?8<=document.documentMode:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))}}return s.default_multiple_text="Select Some Options",s.default_single_text="Select an Option",s.default_no_result_text="No results match",s}.call(this),(o=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var t=o(this),s=t.data("chosen");"destroy"===i?s instanceof h&&s.destroy():s instanceof h||t.data("chosen",new h(this,i))}):this}}),h=class extends e{setup(){return this.form_field_jq=o(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex}set_up_html(){var e=["chosen-container"];return e.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),e={class:e.join(" "),title:this.form_field.title},this.form_field.id.length&&(e.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=o("<div />",e),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()}on_ready(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})}register_observers(){return this.container.on("touchstart.chosen",e=>{this.container_mousedown(e)}),this.container.on("touchend.chosen",e=>{this.container_mouseup(e)}),this.container.on("mousedown.chosen",e=>{this.container_mousedown(e)}),this.container.on("mouseup.chosen",e=>{this.container_mouseup(e)}),this.container.on("mouseenter.chosen",e=>{this.mouse_enter(e)}),this.container.on("mouseleave.chosen",e=>{this.mouse_leave(e)}),this.search_results.on("mouseup.chosen",e=>{this.search_results_mouseup(e)}),this.search_results.on("mouseover.chosen",e=>{this.search_results_mouseover(e)}),this.search_results.on("mouseout.chosen",e=>{this.search_results_mouseout(e)}),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",e=>{this.search_results_mousewheel(e)}),this.search_results.on("touchstart.chosen",e=>{this.search_results_touchstart(e)}),this.search_results.on("touchmove.chosen",e=>{this.search_results_touchmove(e)}),this.search_results.on("touchend.chosen",e=>{this.search_results_touchend(e)}),this.form_field_jq.on("chosen:updated.chosen",e=>{this.results_update_field(e)}),this.form_field_jq.on("chosen:activate.chosen",e=>{this.activate_field(e)}),this.form_field_jq.on("chosen:open.chosen",e=>{this.container_mousedown(e)}),this.form_field_jq.on("chosen:close.chosen",e=>{this.close_field(e)}),this.search_field.on("blur.chosen",e=>{this.input_blur(e)}),this.search_field.on("keyup.chosen",e=>{this.keyup_checker(e)}),this.search_field.on("keydown.chosen",e=>{this.keydown_checker(e)}),this.search_field.on("focus.chosen",e=>{this.input_focus(e)}),this.search_field.on("cut.chosen",e=>{this.clipboard_event_checker(e)}),this.search_field.on("paste.chosen",e=>{this.clipboard_event_checker(e)}),this.is_multiple?this.search_choices.on("click.chosen",e=>{this.choices_click(e)}):this.container.on("click.chosen",function(e){e.preventDefault()})}
4255destroy(){return o(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),0<this.form_field_label.length&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()}search_field_disabled(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)}container_mousedown(e){var t;if(!this.is_disabled)return!e||"mousedown"!==(t=e.type)&&"touchstart"!==t||this.results_showing||e.preventDefault(),null!=e&&o(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||o(e.target)[0]!==this.selected_item[0]&&!o(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),o(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())}container_mouseup(e){if("ABBR"===e.target.nodeName&&!this.is_disabled)return this.results_reset(e)}search_results_mousewheel(e){var t;if(null!=(t=e.originalEvent?e.originalEvent.deltaY||-e.originalEvent.wheelDelta||e.originalEvent.detail:t))return e.preventDefault(),"DOMMouseScroll"===e.type&&(t*=40),this.search_results.scrollTop(t+this.search_results.scrollTop())}blur_test(e){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()}close_field(){return o(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()}activate_field(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()}test_active_click(e){e=o(e.target).closest(".chosen-container");return e.length&&this.container[0]===e[0]?this.active_field=!0:this.close_field()}results_build(){return this.parsing=!0,this.selected_option_count=null,this.results_data=r.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1}result_do_highlight(e){var t,s,i;if(e.length)return this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),(e=parseInt(this.search_results.css("maxHeight"),10))+(i=this.search_results.scrollTop())<=(t=(s=this.result_highlight.position().top+this.search_results.scrollTop())+this.result_highlight.outerHeight())?this.search_results.scrollTop(0<t-e?t-e:0):s<i?this.search_results.scrollTop(s):void 0}result_clear_highlight(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null}results_show(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))}update_results_content(e){return this.search_results.html(e)}results_hide(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1}set_tab_index(e){var t;if(this.form_field.tabIndex)return t=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=t}set_label_behavior(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=o(`label[for='${this.form_field.id}']`)),0<this.form_field_label.length)return this.form_field_label.on("click.chosen",this.label_click_handler)}show_search_field_default(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))}search_results_mouseup(e){var t=o(e.target).hasClass("active-result")?o(e.target):o(e.target).parents(".active-result").first();if(t.length)return this.result_highlight=t,this.result_select(e),this.search_field.focus()}search_results_mouseover(e){e=o(e.target).hasClass("active-result")?o(e.target):o(e.target).parents(".active-result").first();if(e)return this.result_do_highlight(e)}search_results_mouseout(e){if(o(e.target).hasClass("active-result")||o(e.target).parents(".active-result").first())return this.result_clear_highlight()}choice_build(e){var t=o("<li />",{class:"search-choice"}).html(`<span>${this.choice_label(e)}</span>`);return e.disabled?t.addClass("search-choice-disabled"):((e=o("<a />",{class:"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",e=>this.choice_destroy_link_click(e)),t.append(e)),this.search_container.before(t)}choice_destroy_link_click(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(o(e.target))}choice_destroy(e){if(this.result_deselect(e[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&0<this.choices_count()&&this.get_search_field_value().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()}results_reset(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()}results_reset_cleanup(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()}result_select(e){var t;if(this.result_highlight)return t=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?t.removeClass("active-result"):this.reset_single_select_options(),t.addClass("result-selected"),(t=this.results_data[t[0].getAttribute("data-option-array-index")]).selected=!0,this.form_field.options[t.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(t):this.single_set_selected_text(this.choice_label(t)),this.is_multiple&&(!this.hide_results_on_select||e.metaKey||e.ctrlKey)?e.metaKey||e.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),!this.is_multiple&&this.form_field.selectedIndex===this.current_selectedIndex||this.trigger_form_field_change({selected:this.form_field.options[t.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,e.preventDefault(),this.search_field_scale())}single_set_selected_text(e=this.default_text){return e===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(e)}result_deselect(e){e=this.results_data[e];return!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)}single_deselect_control_build(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")}get_search_field_value(){return this.search_field.val()}get_search_text(){return o.trim(this.get_search_field_value())}escape_html(e){return o("<div/>").text(e).html()}winnow_results_set_highlight(){var e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=(e.length?e:this.search_results.find(".active-result")).first();if(null!=e)return this.result_do_highlight(e)}no_results(e){e=this.get_no_results_html(e);return this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})}no_results_clear(){return this.search_results.find(".no-results").remove()}keydown_arrow(){var e;return this.results_showing&&this.result_highlight?(e=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(e):void 0:this.results_show()}keyup_arrow(){var e;return this.results_showing||this.is_multiple?this.result_highlight?(e=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(e.first()):(0<this.choices_count()&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()}keydown_backstroke(){var e;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(e=this.search_container.siblings("li.search-choice").last()).length&&!e.hasClass("search-choice-disabled")?(this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0}clear_backstroke(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null}search_field_scale(){var e,t,s,i,h,l,r;if(this.is_multiple){for(h={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},t=0,s=(l=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;t<s;t++)h[i=l[t]]=this.search_field.css(i);return(e=o("<div />").css(h)).text(this.get_search_field_value()),o("body").append(e),r=e.width()+25,e.remove(),this.container.is(":visible")&&(r=Math.min(this.container.outerWidth()-10,r)),this.search_field.width(r)}}
4255trigger_form_field_change(e){return this.form_field_jq.trigger("input",e),this.form_field_jq.trigger("change",e)}}}.call(this);
4256;
4257/*!
4258 * typeahead.js 0.9.3
4259 * https://github.com/twitter/typeahead
4260 * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
4261 */
4262
4263!function(a){var b="0.9.3",c={isMsie:function(){var a=/(msie) ([\w.]+)/i.exec(navigator.userAgent);return a?parseInt(a[2],10):!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},bind:a.proxy,bindAll:function(b){var c;for(var d in b)a.isFunction(c=b[d])&&(b[d]=a.proxy(c,b))},indexOf:function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return c;return-1},each:a.each,map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,getUniqueId:function(){var a=0;return function(){return a++}}(),defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},tokenizeQuery:function(b){return a.trim(b).toLowerCase().split(/[\s]+/)},tokenizeText:function(b){return a.trim(b).toLowerCase().split(/[\s\-_]+/)},getProtocol:function(){return location.protocol},noop:function(){}},d=function(){var a=/\s+/;return{on:function(b,c){var d;if(!c)return this;for(this._callbacks=this._callbacks||{},b=b.split(a);d=b.shift();)this._callbacks[d]=this._callbacks[d]||[],this._callbacks[d].push(c);return this},trigger:function(b,c){var d,e;if(!this._callbacks)return this;for(b=b.split(a);d=b.shift();
4263)if(e=this._callbacks[d])for(var f=0;f<e.length;f+=1)e[f].call(this,{type:d,data:c});return this}}}(),e=function(){function b(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d="typeahead:";return c.mixin(b.prototype,{trigger:function(a){var b=[].slice.call(arguments,1);this.$el.trigger(d+a,b)}}),b}(),f=function(){function a(a){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+this.prefix)}function b(){return(new Date).getTime()}function d(a){return JSON.stringify(c.isUndefined(a)?null:a)}function e(a){return JSON.parse(a)}var f,g;try{f=window.localStorage,f.setItem("~~~","!"),f.removeItem("~~~")}catch(h){f=null}return g=f&&window.JSON?{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},get:function(a){return this.isExpired(a)&&this.remove(a),e(f.getItem(this._prefix(a)))},set:function(a,e,g){return c.isNumber(g)?f.setItem(this._ttlKey(a),d(b()+g)):f.removeItem(this._ttlKey(a)),f.setItem(this._prefix(a),d(e))},remove:function(a){return f.removeItem(this._ttlKey(a)),f.removeItem(this._prefix(a)),this},clear:function(){var a,b,c=[],d=f.length;for(a=0;d>a;a++)(b=f.key(a)).match(this.keyMatcher)&&c.push(b.replace(this.keyMatcher,""));for(a=c.length;a--;)this.remove(c[a]);return this},isExpired:function(a){var d=e(f.getItem(this._ttlKey(a)));return c.isNumber(d)&&b()>d?!0:!1}}
4263:{get:c.noop,set:c.noop,remove:c.noop,clear:c.noop,isExpired:c.noop},c.mixin(a.prototype,g),a}(),g=function(){function a(a){c.bindAll(this),a=a||{},this.sizeLimit=a.sizeLimit||10,this.cache={},this.cachedKeysByAge=[]}return c.mixin(a.prototype,{get:function(a){return this.cache[a]},set:function(a,b){var c;this.cachedKeysByAge.length===this.sizeLimit&&(c=this.cachedKeysByAge.shift(),delete this.cache[c]),this.cache[a]=b,this.cachedKeysByAge.push(a)}}),a}(),h=function(){function b(a){c.bindAll(this),a=c.isString(a)?{url:a}:a,i=i||new g,h=c.isNumber(a.maxParallelRequests)?a.maxParallelRequests:h||6,this.url=a.url,this.wildcard=a.wildcard||"%QUERY",this.filter=a.filter,this.replace=a.replace,this.ajaxSettings={type:"get",cache:a.cache,timeout:a.timeout,dataType:a.dataType||"json",beforeSend:a.beforeSend},this._get=(/^throttle$/i.test(a.rateLimitFn)?c.throttle:c.debounce)(this._get,a.rateLimitWait||300)}function d(){j++}function e(){j--}function f(){return h>j}var h,i,j=0,k={};return c.mixin(b.prototype,{_get:function(a,b){function c(c){var e=d.filter?d.filter(c):c;b&&b(e),i.set(a,c)}var d=this;f()?this._sendRequest(a).done(c):this.onDeckRequestArgs=[].slice.call(arguments,0)},_sendRequest:function(b){function c(){e(),k[b]=null,f.onDeckRequestArgs&&(f._get.apply(f,f.onDeckRequestArgs),f.onDeckRequestArgs=null)}var f=this,g=k[b];return g||(d(),g=k[b]=a.ajax(b,this.ajaxSettings).always(c)),g},get:function(a,b){var d,e,f=this,g=encodeURIComponent(a||"");return b=b||c.noop,d=this.replace?this.replace(this.url,g):this.url.replace(this.wildcard,g),(e=i.get(d))?c.defer(function(){b(f.filter?f.filter(e):e)}):this._get(d,b),!!e}}),b}(),i=function(){function d(b){c.bindAll(this),c.isString(b.template)&&!b.engine&&a.error("no template engine specified"),b.local||b.prefetch||b.remote||a.error("one of local, prefetch, or remote is required"),this.name=b.name||c.getUniqueId(),this.limit=b.limit||5,this.minLength=b.minLength||1,this.header=b.header,this.footer=b.footer,this.valueKey=b.valueKey||"value",this.template=e(b.template,b.engine,this.valueKey),this.local=b.local,this.prefetch=b.prefetch,this.remote=b.remote,this.itemHash={},this.adjacencyList={},this.storage=b.name?new f(b.name):null}function e(a,b,d){var e,f;return c.isFunction(a)?e=a:c.isString(a)?(f=b.compile(a),e=c.bind(f.render,f)):e=function(a){return"<p>"+a[d]+"</p>"},e}var g={thumbprint:"thumbprint",protocol:"protocol",itemHash:"itemHash",adjacencyList:"adjacencyList"};return c.mixin(d.prototype,{_processLocalData:function(a){this._mergeProcessedData(this._processData(a))},_loadPrefetchData:function(d){function e(a){var b=d.filter?d.filter(a):a,e=m._processData(b),f=e.itemHash,h=e.adjacencyList;m.storage&&(m.storage.set(g.itemHash,f,d.ttl),m.storage.set(g.adjacencyList,h,d.ttl),m.storage.set(g.thumbprint,n,d.ttl),m.storage.set(g.protocol,c.getProtocol(),d.ttl)),m._mergeProcessedData(e)}var f,h,i,j,k,l,m=this,n=b+(d.thumbprint||"");return this.storage&&(f=this.storage.get(g.thumbprint),h=this.storage.get(g.protocol),i=this.storage.get(g.itemHash),j=this.storage.get(g.adjacencyList)),k=f!==n||h!==c.getProtocol(),d=c.isString(d)?{url:d}:d,d.ttl=c.isNumber(d.ttl)?d.ttl:864e5,i&&j&&!k?(this._mergeProcessedData({itemHash:i,adjacencyList:j}),l=a.Deferred().resolve()):l=a.getJSON(d.url).done(e),l},_transformDatum:function(a){var b=c.isString(a)?a:a[this.valueKey],d=a.tokens||c.tokenizeText(b),e={value:b,tokens:d};return c.isString(a)?(e.datum={},e.datum[this.valueKey]=a):e.datum=a,e.tokens=c.filter(e.tokens,function(a){return!c.isBlankString(a)}),e.tokens=c.map(e.tokens,function(a){return a.toLowerCase()}),e},_processData:function(a){var b=this,d={},e={};return c.each(a,function(a,f){var g=b._transformDatum(f),h=c.getUniqueId(g.value);d[h]=g,c.each(g.tokens,function(a,b){var d=b.charAt(0),f=e[d]||(e[d]=[h]);!~c.indexOf(f,h)&&f.push(h)})}),{itemHash:d,adjacencyList:e}},_mergeProcessedData:function(a){var b=this;c.mixin(this.itemHash,a.itemHash),c.each(a.adjacencyList,function(a,c){var d=b.adjacencyList[a];b.adjacencyList[a]=d?d.concat(c):c})},_getLocalSuggestions:function(a){var b,d=this,e=[],f=[],g=[];return c.each(a,function(a,b){var d=b.charAt(0);!~c.indexOf(e,d)&&e.push(d)}),c.each(e,function(a,c){var e=d.adjacencyList[c];return e?(f.push(e),(!b||e.length<b.length)&&(b=e),void 0):!1}),f.length<e.length?[]:(c.each(b,function(b,e){var h,i,j=d.itemHash[e];h=c.every(f,function(a){return~c.indexOf(a,e)}),i=h&&c.every(a,function(a){return c.some(j.tokens,function(b){return 0===b.indexOf(a)})}),i&&g.push(j)}),g)},initialize:function(){var b;return this.local&&this._processLocalData(this.local),this.transport=this.remote?new h(this.remote):null,b=this.prefetch?this._loadPrefetchData(this.prefetch):a.Deferred().resolve(),this.local=this.prefetch=this.remote=null,this.initialize=function(){return b},b}
4263,getSuggestions:function(a,b){function d(a){f=f.slice(0),c.each(a,function(a,b){var d,e=g._transformDatum(b);return d=c.some(f,function(a){return e.value===a.value}),!d&&f.push(e),f.length<g.limit}),b&&b(f)}var e,f,g=this,h=!1;a.length<this.minLength||(e=c.tokenizeQuery(a),f=this._getLocalSuggestions(e).slice(0,this.limit),f.length<this.limit&&this.transport&&(h=this.transport.get(a,d)),!h&&b&&b(f))}}),d}(),j=function(){function b(b){var d=this;c.bindAll(this),this.specialKeyCodeMap={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},this.$hint=a(b.hint),this.$input=a(b.input).on("blur.tt",this._handleBlur).on("focus.tt",this._handleFocus).on("keydown.tt",this._handleSpecialKeyEvent),c.isMsie()?this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(a){d.specialKeyCodeMap[a.which||a.keyCode]||c.defer(d._compareQueryToInputValue)}):this.$input.on("input.tt",this._compareQueryToInputValue),this.query=this.$input.val(),this.$overflowHelper=e(this.$input)}function e(b){return a("<span></span>").css({position:"absolute",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",fontFamily:b.css("font-family"),fontSize:b.css("font-size"),fontStyle:b.css("font-style"),fontVariant:b.css("font-variant"),fontWeight:b.css("font-weight"),wordSpacing:b.css("word-spacing"),letterSpacing:b.css("letter-spacing"),textIndent:b.css("text-indent"),textRendering:b.css("text-rendering"),textTransform:b.css("text-transform")}).insertAfter(b)}function f(a,b){return a=(a||"").replace(/^\s*/g,"").replace(/\s{2,}/g," "),b=(b||"").replace(/^\s*/g,"").replace(/\s{2,}/g," "),a===b}return c.mixin(b.prototype,d,{_handleFocus:function(){this.trigger("focused")},_handleBlur:function(){this.trigger("blured")},_handleSpecialKeyEvent:function(a){var b=this.specialKeyCodeMap[a.which||a.keyCode];b&&this.trigger(b+"Keyed",a)},_compareQueryToInputValue:function(){var a=this.getInputValue(),b=f(this.query,a),c=b?this.query.length!==a.length:!1;c?this.trigger("whitespaceChanged",{value:this.query}):b||this.trigger("queryChanged",{value:this.query=a})},destroy:function(){this.$hint.off(".tt"),this.$input.off(".tt"),this.$hint=this.$input=this.$overflowHelper=null},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(a){this.query=a},getInputValue:function(){return this.$input.val()},setInputValue:function(a,b){this.$input.val(a),!b&&this._compareQueryToInputValue()},getHintValue:function(){return this.$hint.val()},setHintValue:function(a){this.$hint.val(a)},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},isOverflow:function(){return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>this.$input.width()},isCursorAtEnd:function(){var a,b=this.$input.val().length,d=this.$input[0].selectionStart;return c.isNumber(d)?d===b:document.selection?(a=document.selection.createRange(),a.moveStart("character",-b),b===a.text.length):!0}}),b}(),k=function(){function b(b){c.bindAll(this),this.isOpen=!1,this.isEmpty=!0,this.isMouseOverDropdown=!1,this.$menu=a(b.menu).on("mouseenter.tt",this._handleMouseenter).on("mouseleave.tt",this._handleMouseleave).on("click.tt",".tt-suggestion",this._handleSelection).on("mouseover.tt",".tt-suggestion",this._handleMouseover)}function e(a){return a.data("suggestion")}var f={suggestionsList:'<span class="tt-suggestions"></span>'},g={suggestionsList:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"}};return c.mixin(b.prototype,d,{_handleMouseenter:function(){this.isMouseOverDropdown=!0},_handleMouseleave:function(){this.isMouseOverDropdown=!1},_handleMouseover:function(b){var c=a(b.currentTarget);this._getSuggestions().removeClass("tt-is-under-cursor"),c.addClass("tt-is-under-cursor")},_handleSelection:function(b){var c=a(b.currentTarget);this.trigger("suggestionSelected",e(c))},_show:function(){this.$menu.css("display","block")},_hide:function(){this.$menu.hide()},_moveCursor:function(a){var b,c,d,f;if(this.isVisible()){if(b=this._getSuggestions(),c=b.filter(".tt-is-under-cursor"),c.removeClass("tt-is-under-cursor"),d=b.index(c)+a,d=(d+1)%(b.length+1)-1,-1===d)return this.trigger("cursorRemoved"),void 0;-1>d&&(d=b.length-1),f=b.eq(d).addClass("tt-is-under-cursor"),this._ensureVisibility(f),this.trigger("cursorMoved",e(f))}},_getSuggestions:function(){return this.$menu.find(".tt-suggestions > .tt-suggestion")},_ensureVisibility:function(a){var b=this.$menu.height()+parseInt(this.$menu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10),c=this.$menu.scrollTop(),d=a.position().top,e=d+a.outerHeight(!0);0>d?this.$menu.scrollTop(c+d):e>b&&this.$menu.scrollTop(c+(e-b))},destroy:function(){this.$menu.off(".tt"),this.$menu=null},isVisible:function(){return this.isOpen&&!this.isEmpty},closeUnlessMouseIsOverDropdown:function(){this.isMouseOverDropdown||this.close()},close:function(){this.isOpen&&(this.isOpen=!1,this.isMouseOverDropdown=!1,this._hide(),this.$menu.find(".tt-suggestions > .tt-suggestion").removeClass("tt-is-under-cursor"),this.trigger("closed"))},open:function(){this.isOpen||(this.isOpen=!0,!this.isEmpty&&this._show(),this.trigger("opened"))},setLanguageDirection:function(a){var b={left:"0",right:"auto"},c={left:"auto",right:" 0"};"ltr"===a?this.$menu.css(b):this.$menu.css(c)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getSuggestionUnderCursor:function(){var a=this._getSuggestions().filter(".tt-is-under-cursor").first();return a.length>0?e(a):null},getFirstSuggestion:function(){var a=this._getSuggestions().first();return a.length>0?e(a):null},renderSuggestions:function(b,d){var e,h,i,j,k,l="tt-dataset-"+b.name,m='<div class="tt-suggestion">%body</div>',n=this.$menu.find("."+l);0===n.length&&(h=a(f.suggestionsList).css(g.suggestionsList),n=a("<div></div>").addClass(l).append(b.header).append(h).append(b.footer).appendTo(this.$menu)),d.length>0?(this.isEmpty=!1,this.isOpen&&this._show(),i=document.createElement("div"),j=document.createDocumentFragment(),c.each(d,function(c,d){d.dataset=b.name,e=b.template(d.datum),i.innerHTML=m.replace("%body",e),k=a(i.firstChild).css(g.suggestion).data("suggestion",d),k.children().each(function(){a(this).css(g.suggestionChild)}),j.appendChild(k[0])}),n.show().find(".tt-suggestions").html(j)):this.clearSuggestions(b.name),this.trigger("suggestionsRendered")},clearSuggestions:function(a){var b=a?this.$menu.find(".tt-dataset-"+a):this.$menu.find('[class^="tt-dataset-"]'),c=b.find(".tt-suggestions");b.hide(),c.empty(),0===this._getSuggestions().length&&(this.isEmpty=!0,this._hide())}}),b}(),l=function(){function b(a){var b,d,f;c.bindAll(this),this.$node=e(a.input),this.datasets=a.datasets,this.dir=null,this.eventBus=a.eventBus,b=this.$node.find(".tt-dropdown-menu"),d=this.$node.find(".tt-query"),f=this.$node.find(".tt-hint"),this.dropdownView=new k({menu:b}).on("suggestionSelected",this._handleSelection).on("cursorMoved",this._clearHint).on("cursorMoved",this._setInputValueToSuggestionUnderCursor).on("cursorRemoved",this._setInputValueToQuery).on("cursorRemoved",this._updateHint).on("suggestionsRendered",this._updateHint).on("opened",this._updateHint).on("closed",this._clearHint).on("opened closed",this._propagateEvent),this.inputVie
4263w=new j({input:d,hint:f}).on("focused",this._openDropdown).on("blured",this._closeDropdown).on("blured",this._setInputValueToQuery).on("enterKeyed tabKeyed",this._handleSelection).on("queryChanged",this._clearHint).on("queryChanged",this._clearSuggestions).on("queryChanged",this._getSuggestions).on("whitespaceChanged",this._updateHint).on("queryChanged whitespaceChanged",this._openDropdown).on("queryChanged whitespaceChanged",this._setLanguageDirection).on("escKeyed",this._closeDropdown).on("escKeyed",this._setInputValueToQuery).on("tabKeyed upKeyed downKeyed",this._managePreventDefault).on("upKeyed downKeyed",this._moveDropdownCursor).on("upKeyed downKeyed",this._openDropdown).on("tabKeyed leftKeyed rightKeyed",this._autocomplete)}function e(b){var c=a(g.wrapper),d=a(g.dropdown),e=a(b),f=a(g.hint);c=c.css(h.wrapper),d=d.css(h.dropdown),f.css(h.hint).css({backgroundAttachment:e.css("background-attachment"),backgroundClip:e.css("background-clip"),backgroundColor:e.css("background-color"),backgroundImage:e.css("background-image"),backgroundOrigin:e.css("background-origin"),backgroundPosition:e.css("background-position"),backgroundRepeat:e.css("background-repeat"),backgroundSize:e.css("background-size")}),e.data("ttAttrs",{dir:e.attr("dir"),autocomplete:e.attr("autocomplete"),spellcheck:e.attr("spellcheck"),style:e.attr("style")}),e.addClass("tt-query").attr({autocomplete:"off",spellcheck:!1}).css(h.query);try{!e.attr("dir")&&e.attr("dir","auto")}catch(i){}return e.wrap(c).parent().prepend(f).append(d)}function f(a){var b=a.find(".tt-query");c.each(b.data("ttAttrs"),function(a,d){c.isUndefined(d)?b.removeAttr(a):b.attr(a,d)}),b.detach().removeData("ttAttrs").removeClass("tt-query").insertAfter(a),a.remove()}var g={wrapper:'<span class="twitter-typeahead"></span>',hint:'<input class="tt-hint" type="text" autocomplete="off" spellcheck="off" disabled>',dropdown:'<span class="tt-dropdown-menu"></span>'},h={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none"},query:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"}};return c.isMsie()&&c.mixin(h.query,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),c.isMsie()&&c.isMsie()<=7&&(c.mixin(h.wrapper,{display:"inline",zoom:"1"}),c.mixin(h.query,{marginTop:"-1px"})),c.mixin(b.prototype,d,{_managePreventDefault:function(a){var b,c,d=a.data,e=!1;switch(a.type){case"tabKeyed":b=this.inputView.getHintValue(),c=this.inputView.getInputValue(),e=b&&b!==c;break;case"upKeyed":case"downKeyed":e=!d.shiftKey&&!d.ctrlKey&&!d.metaKey}e&&d.preventDefault()},_setLanguageDirection:function(){var a=this.inputView.getLanguageDirection();a!==this.dir&&(this.dir=a,this.$node.css("direction",a),this.dropdownView.setLanguageDirection(a))},_updateHint:function(){var a,b,d,e,f,g=this.dropdownView.getFirstSuggestion(),h=g?g.value:null,i=this.dropdownView.isVisible(),j=this.inputView.isOverflow();h&&i&&!j&&(a=this.inputView.getInputValue(),b=a.replace(/\s{2,}/g," ").replace(/^\s+/g,""),d=c.escapeRegExChars(b),e=new RegExp("^(?:"+d+")(.*$)","i"),f=e.exec(h),this.inputView.setHintValue(a+(f?f[1]:"")))},_clearHint:function(){this.inputView.setHintValue("")},_clearSuggestions:function(){this.dropdownView.clearSuggestions()},_setInputValueToQuery:function(){this.inputView.setInputValue(this.inputView.getQuery())},_setInputValueToSuggestionUnderCursor:function(a){var b=a.data;this.inputView.setInputValue(b.value,!0)},_openDropdown:function(){this.dropdownView.open()},_closeDropdown:function(a){this.dropdownView["blured"===a.type?"closeUnlessMouseIsOverDropdown":"close"]()},_moveDropdownCursor:function(a){var b=a.data;b.shiftKey||b.ctrlKey||b.metaKey||this.dropdownView["upKeyed"===a.type?"moveCursorUp":"moveCursorDown"]()},_handleSelection:function(a){var b="suggestionSelected"===a.type,d=b?a.data:this.dropdownView.getSuggestionUnderCursor();
4263d&&(this.inputView.setInputValue(d.value),b?this.inputView.focus():a.data.preventDefault(),b&&c.isMsie()?c.defer(this.dropdownView.close):this.dropdownView.close(),this.eventBus.trigger("selected",d.datum,d.dataset))},_getSuggestions:function(){var a=this,b=this.inputView.getQuery();c.isBlankString(b)||c.each(this.datasets,function(c,d){d.getSuggestions(b,function(c){b===a.inputView.getQuery()&&a.dropdownView.renderSuggestions(d,c)})})},_autocomplete:function(a){var b,c,d,e,f;("rightKeyed"!==a.type&&"leftKeyed"!==a.type||(b=this.inputView.isCursorAtEnd(),c="ltr"===this.inputView.getLanguageDirection()?"leftKeyed"===a.type:"rightKeyed"===a.type,b&&!c))&&(d=this.inputView.getQuery(),e=this.inputView.getHintValue(),""!==e&&d!==e&&(f=this.dropdownView.getFirstSuggestion(),this.inputView.setInputValue(f.value),this.eventBus.trigger("autocompleted",f.datum,f.dataset)))},_propagateEvent:function(a){this.eventBus.trigger(a.type)},destroy:function(){this.inputView.destroy(),this.dropdownView.destroy(),f(this.$node),this.$node=null},setQuery:function(a){this.inputView.setQuery(a),this.inputView.setInputValue(a),this._clearHint(),this._clearSuggestions(),this._getSuggestions()}}),b}();!function(){var b,d={},f="ttView";b={initialize:function(b){function g(){var b,d=a(this),g=new e({el:d});b=c.map(h,function(a){return a.initialize()}),d.data(f,new l({input:d,eventBus:g=new e({el:d}),datasets:h})),a.when.apply(a,b).always(function(){c.defer(function(){g.trigger("initialized")})})}var h;return b=c.isArray(b)?b:[b],0===b.length&&a.error("no datasets provided"),h=c.map(b,function(a){var b=d[a.name]?d[a.name]:new i(a);return a.name&&(d[a.name]=b),b}),this.each(g)},destroy:function(){function b(){var b=a(this),c=b.data(f);c&&(c.destroy(),b.removeData(f))}return this.each(b)},setQuery:function(b){function c(){var c=a(this).data(f);c&&c.setQuery(b)}return this.each(c)}},jQuery.fn.typeahead=function(a){return b[a]?b[a].apply(this,[].slice.call(arguments,1)):b.initialize.apply(this,arguments)}}()}(window.jQuery);;
4264/*
4265 * jQuery File Upload Plugin 5.32.6
4266 * https://github.com/blueimp/jQuery-File-Upload
4267 *
4268 * Copyright 2010, Sebastian Tschan
4269 * https://blueimp.net
4270 *
4271 * Licensed under the MIT license:
4272 * http://www.opensource.org/licenses/MIT
4273 */
4274
4275/*jslint nomen: true, unparam: true, regexp: true */
4276/*global define, window, document, location, File, Blob, FormData */
4277
4278(function (factory) {
4279    'use strict';
4280    if (typeof define === 'function' && define.amd) {
4281        // Register as an anonymous AMD module:
4282        define([
4283            'jquery',
4284            'jquery.ui.widget'
4285        ], factory);
4286    } else {
4287        // Browser globals:
4288        factory(window.jQuery);
4289    }
4290}(function ($) {
4291    'use strict';
4292
4293    // Detect file input support, based on
4294    // http://viljamis.com/blog/2012/file-upload-support-on-mobile/
4295    $.support.fileInput = !(new RegExp(
4296        // Handle devices which give false positives for the feature detection:
4297        '(Android (1\\.[0156]|2\\.[01]))' +
4298            '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
4299            '|(w(eb)?OSBrowser)|(webOS)' +
4300            '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
4301    ).test(window.navigator.userAgent) ||
4302        // Feature detection for all other devices:
4303        $('<input type="file">').prop('disabled'));
4304
4305    // The FileReader API is not actually used, but works as feature detection,
4306    // as e.g. Safari supports XHR file uploads via the FormData API,
4307    // but not non-multipart XHR file uploads:
4308    $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
4309    $.support.xhrFormDataFileUpload = !!window.FormData;
4310
4311    // Detect support for Blob slicing (required for chunked uploads):
4312    $.support.blobSlice = window.Blob && (Blob.prototype.slice ||
4313        Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
4314
4315    // The fileupload widget listens for change events on file input fields defined
4316    // via fileInput setting and paste or drop events of the given dropZone.
4317    // In addition to the default jQuery Widget methods, the fileupload widget
4318    // exposes the "add" and "send" methods, to add or directly send files using
4319    // the fileupload API.
4320    // By default, files added via file input selection, paste, drag & drop or
4321    // "add" method are uploaded immediately, but it is possible to override
4322    // the "add" callback option to queue file uploads.
4323    $.widget('blueimp.fileupload', {
4324
4325        options: {
4326            // The drop target element(s), by the default the complete document.
4327            // Set to null to disable drag & drop support:
4328            dropZone: $(document),
4329            // The paste target element(s), by the default the complete document.
4330            // Set to null to disable paste support:
4331            pasteZone: $(document),
4332            // The file input field(s), that are listened to for change events.
4333            // If undefined, it is set to the file input fields inside
4334            // of the widget element on plugin initialization.
4335            // Set to null to disable the change listener.
4336            fileInput: undefined,
4337            // By default, the file input field is replaced with a clone after
4338            // each input field change event. This is required for iframe transport
4339            // queues and allows change events to be fired for the same file
4340            // selection, but can be disabled by setting the following option to false:
4341            replaceFileInput: true,
4342            // The parameter name for the file form data (the request argument name).
4343            // If undefined or empty, the name property of the file input field is
4344            // used, or "files[]" if the file input name property is also empty,
4345            // can be a string or an array of strings:
4346            paramName: undefined,
4347            // By default, each file of a selection is uploaded using an individual
4348            // request for XHR type uploads. Set to false to upload file
4349            // selections in one request each:
4350            singleFileUploads: true,
4351            // To limit the number of files uploaded with one XHR request,
4352            // set the following option to an integer greater than 0:
4353            limitMultiFileUploads: undefined,
4354            // Set the following option to true to issue all file upload requests
4355            // in a sequential order:
4356            sequentialUploads: false,
4357            // To limit the number of concurrent uploads,
4358            // set the following option to an integer greater than 0:
4359            limitConcurrentUploads: undefined,
4360            // Set the following option to true to force iframe transport uploads:
4361            forceIframeTransport: false,
4362            // Set the following option to the location of a redirect url on the
4363            // origin server, for cross-domain iframe transport uploads:
4364            redirect: undefined,
4365            // The parameter name for the redirect url, sent as part of the form
4366            // data and set to 'redirect' if this option is empty:
4367            redirectParamName: undefined,
4368            // Set the following option to the location of a postMessage window,
4369            // to enable postMessage transport uploads:
4370            postMessage: undefined,
4371            // By default, XHR file uploads are sent as multipart/form-data.
4372            // The iframe transport is always using multipart/form-data.
4373            // Set to false to enable non-multipart XHR uploads:
4374            multipart: true,
4375            // To upload large files in smaller chunks, set the following option
4376            // to a preferred maximum chunk size. If set to 0, null or undefined,
4377            // or the browser does not support the required Blob API, files will
4378            // be uploaded as a whole.
4379            maxChunkSize: undefined,
4380            // When a non-multipart upload or a chunked multipart upload has been
4381            // aborted, this option can be used to resume the upload by setting
4382            // it to the size of the already uploaded bytes. This option is most
4383            // useful when modifying the options object inside of the "add" or
4384            // "send" callbacks, as the options are cloned for each file upload.
4385            uploadedBytes: undefined,
4386            // By default, failed (abort or error) file uploads are removed from the
4387            // global progress calculation. Set the following option to false to
4388            // prevent recalculating the global progress data:
4389            recalculateProgress: true,
4390            // Interval in milliseconds to calculate and trigger progress events:
4391            progressInterval: 100,
4392            // Interval in milliseconds to calculate progress bitrate:
4393            bitrateInterval: 500,
4394            // By default, uploads are started automatically when adding files:
4395            autoUpload: true,
4396
4397            // Error and info messages:
4398            messages: {
4399                uploadedBytes: 'Uploaded bytes exceed file size'
4400            },
4401
4402            // Translation function, gets the message key to be translated
4403            // and an object with context specific data as arguments:
4404            i18n: function (message, context) {
4405                message = this.messages[message] || message.toString();
4406                if (context) {
4407                    $.each(context, function (key, value) {
4408                        message = message.replace('{' + key + '}', value);
4409                    });
4410                }
4411                return message;
4412            },
4413
4414            // Additional form data to be sent along with the file uploads can be set
4415            // using this option, which accepts an array of objects with name and
4416            // value properties, a function returning such an array, a FormData
4417            // object (for XHR file uploads), or a simple object.
4418            // The form of the first fileInput is given as parameter to the function:
4419            formData: function (form) {
4420                return form.serializeArray();
4421            },
4422
4423            // The add callback is invoked as soon as files are added to the fileupload
4424            // widget (via file input selection, drag & drop, paste or add API call).
4425            // If the singleFileUploads option is enabled, this callback will be
4426            // called once for each file in the selection for XHR file uploads, else
4427            // once for each file selection.
4428            //
4429            // The upload starts when the submit method is invoked on the data parameter.
4430            // The data object contains a files property holding the added files
4431            // and allows you to override plugin options as well as define ajax settings.
4432            //
4433            // Listeners for this callback can also be bound the following way:
4434            // .bind('fileuploadadd', func);
4435            //
4436            // data.submit() returns a Promise object and allows to attach additional
4437            // handlers using jQuery's Deferred callbacks:
4438            // data.submit().done(func).fail(func).always(func);
4439            add: function (e, data) {
4440                if (data.autoUpload || (data.autoUpload !== false &&
4441                        $(this).fileupload('option', 'autoUpload'))) {
4442                    data.process().done(function () {
4443                        data.submit();
4444                    });
4445                }
4446            },
4447
4448            // Other callbacks:
4449
4450            // Callback for the submit event of each file upload:
4451            // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
4452
4453            // Callback for the start of each file upload request:
4454            // send: function (e, data) {}, // .bind('fileuploadsend', func);
4455
4456            // Callback for successful uploads:
4457            // done: function (e, data) {}, // .bind('fileuploaddone', func);
4458
4459            // Callback for failed (abort or error) uploads:
4460            // fail: function (e, data) {}, // .bind('fileuploadfail', func);
4461
4462            // Callback for completed (success, abort or error) requests:
4463            // always: function (e, data) {}, // .bind('fileuploadalways', func);
4464
4465            // Callback for upload progress events:
4466            // progress: function (e, data) {}, // .bind('fileuploadprogress', func);
4467
4468            // Callback for global upload progress events:
4469            // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
4470
4471            // Callback for uploads start, equivalent to the global ajaxStart event:
4472            // start: function (e) {}, // .bind('fileuploadstart', func);
4473
4474            // Callback for uploads stop, equivalent to the global ajaxStop event:
4475            // stop: function (e) {}, // .bind('fileuploadstop', func);
4476
4477            // Callback for change events of the fileInput(s):
4478            // change: function (e, data) {}, // .bind('fileuploadchange', func);
4479
4480            // Callback for paste events to the pasteZone(s):
4481            // paste: function (e, data) {}, // .bind('fileuploadpaste', func);
4482
4483            // Callback for drop events of the dropZone(s):
4484            // drop: function (e, data) {}, // .bind('fileuploaddrop', func);
4485
4486            // Callback for dragover events of the dropZone(s):
4487            // dragover: function (e) {}, // .bind('fileuploaddragover', func);
4488
4489            // Callback for the start of each chunk upload request:
4490            // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
4491
4492            // Callback for successful chunk uploads:
4493            // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
4494
4495            // Callback for failed (abort or error) chunk uploads:
4496            // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
4497
4498            // Callback for completed (success, abort or error) chunk upload requests:
4499            // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
4500
4501            // The plugin options are used as settings object for the ajax calls.
4502            // The following are jQuery ajax settings required for the file uploads:
4503            processData: false,
4504            contentType: false,
4505            cache: false
4506        },
4507
4508        // A list of options that require reinitializing event listeners and/or
4509        // special initialization code:
4510        _specialOptions: [
4511            'fileInput',
4512            'dropZone',
4513            'pasteZone',
4514            'multipart',
4515            'forceIframeTransport'
4516        ],
4517
4518        _blobSlice: $.support.blobSlice && function () {
4519            var slice = this.slice || this.webkitSlice || this.mozSlice;
4520            return slice.apply(this, arguments);
4521        },
4522
4523        _BitrateTimer: function () {
4524            this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
4525            this.loaded = 0;
4526            this.bitrate = 0;
4527            this.getBitrate = function (now, loaded, interval) {
4528                var timeDiff = now - this.timestamp;
4529                if (!this.bitrate || !interval || timeDiff > interval) {
4530                    this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
4531                    this.loaded = loaded;
4532                    this.timestamp = now;
4533                }
4534                return this.bitrate;
4535            };
4536        },
4537
4538        _isXHRUpload: function (options) {
4539            return !options.forceIframeTransport &&
4540                ((!options.multipart && $.support.xhrFileUpload) ||
4541                $.support.xhrFormDataFileUpload);
4542        },
4543
4544        _getFormData: function (options) {
4545            var formData;
4546            if (typeof options.formData === 'function') {
4547                return options.formData(options.form);
4548            }
4549            if ($.isArray(options.formData)) {
4550                return options.formData;
4551            }
4552            if ($.type(options.formData) === 'object') {
4553                formData = [];
4554                $.each(options.formData, function (name, value) {
4555                    formData.push({name: name, value: value});
4556                });
4557                return formData;
4558            }
4559            return [];
4560        },
4561
4562        _getTotal: function (files) {
4563            var total = 0;
4564            $.each(files, function (index, file) {
4565                total += file.size || 1;
4566            });
4567            return total;
4568        },
4569
4570        _initProgressObject: function (obj) {
4571            var progress = {
4572                loaded: 0,
4573                total: 0,
4574                bitrate: 0
4575            };
4576            if (obj._progress) {
4577                $.extend(obj._progress, progress);
4578            } else {
4579                obj._progress = progress;
4580            }
4581        },
4582
4583        _initResponseObject: function (obj) {
4584            var prop;
4585            if (obj._response) {
4586                for (prop in obj._response) {
4587                    if (obj._response.hasOwnProperty(prop)) {
4588                        delete obj._response[prop];
4589                    }
4590                }
4591            } else {
4592                obj._response = {};
4593            }
4594        },
4595
4596        _onProgress: function (e, data) {
4597            if (e.lengthComputable) {
4598                var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
4599                    loaded;
4600                if (data._time && data.progressInterval &&
4601                        (now - data._time < data.progressInterval) &&
4602                        e.loaded !== e.total) {
4603                    return;
4604                }
4605                data._time = now;
4606                loaded = Math.floor(
4607                    e.loaded / e.total * (data.chunkSize || data._progress.total)
4608                ) + (data.uploadedBytes || 0);
4609                // Add the difference from the previously loaded state
4610                // to the global loaded counter:
4611                this._progress.loaded += (loaded - data._progress.loaded);
4612                this._progress.bitrate = this._bitrateTimer.getBitrate(
4613                    now,
4614                    this._progress.loaded,
4615                    data.bitrateInterval
4616                );
4617                data._progress.loaded = data.loaded = loaded;
4618                data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
4619                    now,
4620                    loaded,
4621                    data.bitrateInterval
4622                );
4623                // Trigger a custom progress event with a total data property set
4624                // to the file size(s) of the current upload and a loaded data
4625                // property calculated accordingly:
4626                this._trigger('progress', e, data);
4627                // Trigger a global progress event for all current file uploads,
4628                // including ajax calls queued for sequential file uploads:
4629                this._trigger('progressall', e, this._progress);
4630            }
4631        },
4632
4633        _initProgressListener: function (options) {
4634            var that = this,
4635                xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
4636            // Accesss to the native XHR object is required to add event listeners
4637            // for the upload progress event:
4638            if (xhr.upload) {
4639                $(xhr.upload).bind('progress', function (e) {
4640                    var oe = e.originalEvent;
4641                    // Make sure the progress event properties get copied over:
4642                    e.lengthComputable = oe.lengthComputable;
4643                    e.loaded = oe.loaded;
4644                    e.total = oe.total;
4645                    that._onProgress(e, options);
4646                });
4647                options.xhr = function () {
4648                    return xhr;
4649                };
4650            }
4651        },
4652
4653        _isInstanceOf: function (type, obj) {
4654            // Cross-frame instanceof check
4655            return Object.prototype.toString.call(obj) === '[object ' + type + ']';
4656        },
4657
4658        _initXHRData: function (options) {
4659            var that = this,
4660                formData,
4661                file = options.files[0],
4662                // Ignore non-multipart setting if not supported:
4663                multipart = options.multipart || !$.support.xhrFileUpload,
4664                paramName = options.paramName[0];
4665            options.headers = $.extend({}, options.headers);
4666            if (options.contentRange) {
4667                options.headers['Content-Range'] = options.contentRange;
4668            }
4669            if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
4670                options.headers['Content-Disposition'] = 'attachment; filename="' +
4671                    encodeURI(file.name) + '"';
4672            }
4673            if (!multipart) {
4674                options.contentType = file.type;
4675                options.data = options.blob || file;
4676            } else if ($.support.xhrFormDataFileUpload) {
4677                if (options.postMessage) {
4678                    // window.postMessage does not allow sending FormData
4679                    // objects, so we just add the File/Blob objects to
4680                    // the formData array and let the postMessage window
4681                    // create the FormData object out of this array:
4682                    formData = this._getFormData(options);
4683                    if (options.blob) {
4684                        formData.push({
4685                            name: paramName,
4686                            value: options.blob
4687                        });
4688                    } else {
4689                        $.each(options.files, function (index, file) {
4690                            formData.push({
4691                                name: options.paramName[index] || paramName,
4692                                value: file
4693                            });
4694                        });
4695                    }
4696                } else {
4697                    if (that._isInstanceOf('FormData', options.formData)) {
4698                        formData = options.formData;
4699                    } else {
4700                        formData = new FormData();
4701                        $.each(this._getFormData(options), function (index, field) {
4702                            formData.append(field.name, field.value);
4703                        });
4704                    }
4705                    if (options.blob) {
4706                        formData.append(paramName, options.blob, file.name);
4707                    } else {
4708                        $.each(options.files, function (index, file) {
4709                            // This check allows the tests to run with
4710                            // dummy objects:
4711                            if (that._isInstanceOf('File', file) ||
4712                                    that._isInstanceOf('Blob', file)) {
4713                                formData.append(
4714                                    options.paramName[index] || paramName,
4715                                    file,
4716                                    file.name
4717                                );
4718                            }
4719                        });
4720                    }
4721                }
4722                options.data = formData;
4723            }
4724            // Blob reference is not needed anymore, free memory:
4725            options.blob = null;
4726        },
4727
4728        _initIframeSettings: function (options) {
4729            var targetHost = $('<a></a>').prop('href', options.url).prop('host');
4730            // Setting the dataType to iframe enables the iframe transport:
4731            options.dataType = 'iframe ' + (options.dataType || '');
4732            // The iframe transport accepts a serialized array as form data:
4733            options.formData = this._getFormData(options);
4734            // Add redirect url to form data on cross-domain uploads:
4735            if (options.redirect && targetHost && targetHost !== location.host) {
4736                options.formData.push({
4737                    name: options.redirectParamName || 'redirect',
4738                    value: options.redirect
4739                });
4740            }
4741        },
4742
4743        _initDataSettings: function (options) {
4744            if (this._isXHRUpload(options)) {
4745                if (!this._chunkedUpload(options, true)) {
4746                    if (!options.data) {
4747                        this._initXHRData(options);
4748                    }
4749                    this._initProgressListener(options);
4750                }
4751                if (options.postMessage) {
4752                    // Setting the dataType to postmessage enables the
4753                    // postMessage transport:
4754                    options.dataType = 'postmessage ' + (options.dataType || '');
4755                }
4756            } else {
4757                this._initIframeSettings(options);
4758            }
4759        },
4760
4761        _getParamName: function (options) {
4762            var fileInput = $(options.fileInput),
4763                paramName = options.paramName;
4764            if (!paramName) {
4765                paramName = [];
4766                fileInput.each(function () {
4767                    var input = $(this),
4768                        name = input.prop('name') || 'files[]',
4769                        i = (input.prop('files') || [1]).length;
4770                    while (i) {
4771                        paramName.push(name);
4772                        i -= 1;
4773                    }
4774                });
4775                if (!paramName.length) {
4776                    paramName = [fileInput.prop('name') || 'files[]'];
4777                }
4778            } else if (!$.isArray(paramName)) {
4779                paramName = [paramName];
4780            }
4781            return paramName;
4782        },
4783
4784        _initFormSettings: function (options) {
4785            // Retrieve missing options from the input field and the
4786            // associated form, if available:
4787            if (!options.form || !options.form.length) {
4788                options.form = $(options.fileInput.prop('form'));
4789                // If the given file input doesn't have an associated form,
4790                // use the default widget file input's form:
4791                if (!options.form.length) {
4792                    options.form = $(this.options.fileInput.prop('form'));
4793                }
4794            }
4795            options.paramName = this._getParamName(options);
4796            if (!options.url) {
4797                options.url = options.form.prop('action') || location.href;
4798            }
4799            // The HTTP request method must be "POST" or "PUT":
4800            options.type = (options.type ||
4801                ($.type(options.form.prop('method')) === 'string' &&
4802                    options.form.prop('method')) || ''
4803                ).toUpperCase();
4804            if (options.type !== 'POST' && options.type !== 'PUT' &&
4805                    options.type !== 'PATCH') {
4806                options.type = 'POST';
4807            }
4808            if (!options.formAcceptCharset) {
4809                options.formAcceptCharset = options.form.attr('accept-charset');
4810            }
4811        },
4812
4813        _getAJAXSettings: function (data) {
4814            var options = $.extend({}, this.options, data);
4815            this._initFormSettings(options);
4816            this._initDataSettings(options);
4817            return options;
4818        },
4819
4820        // jQuery 1.6 doesn't provide .state(),
4821        // while jQuery 1.8+ removed .isRejected() and .isResolved():
4822        _getDeferredState: function (deferred) {
4823            if (deferred.state) {
4824                return deferred.state();
4825            }
4826            if (deferred.isResolved()) {
4827                return 'resolved';
4828            }
4829            if (deferred.isRejected()) {
4830                return 'rejected';
4831            }
4832            return 'pending';
4833        },
4834
4835        // Maps jqXHR callbacks to the equivalent
4836        // methods of the given Promise object:
4837        _enhancePromise: function (promise) {
4838            promise.success = promise.done;
4839            promise.error = promise.fail;
4840            promise.complete = promise.always;
4841            return promise;
4842        },
4843
4844        // Creates and returns a Promise object enhanced with
4845        // the jqXHR methods abort, success, error and complete:
4846        _getXHRPromise: function (resolveOrReject, context, args) {
4847            var dfd = $.Deferred(),
4848                promise = dfd.promise();
4849            context = context || this.options.context || promise;
4850            if (resolveOrReject === true) {
4851                dfd.resolveWith(context, args);
4852            } else if (resolveOrReject === false) {
4853                dfd.rejectWith(context, args);
4854            }
4855            promise.abort = dfd.promise;
4856            return this._enhancePromise(promise);
4857        },
4858
4859        // Adds convenience methods to the data callback argument:
4860        _addConvenienceMethods: function (e, data) {
4861            var that = this,
4862                getPromise = function (data) {
4863                    return $.Deferred().resolveWith(that, [data]).promise();
4864                };
4865            data.process = function (resolveFunc, rejectFunc) {
4866                if (resolveFunc || rejectFunc) {
4867                    data._processQueue = this._processQueue =
4868                        (this._processQueue || getPromise(this))
4869                            .pipe(resolveFunc, rejectFunc);
4870                }
4871                return this._processQueue || getPromise(this);
4872            };
4873            data.submit = function () {
4874                if (this.state() !== 'pending') {
4875                    data.jqXHR = this.jqXHR =
4876                        (that._trigger('submit', e, this) !== false) &&
4877                        that._onSend(e, this);
4878                }
4879                return this.jqXHR || that._getXHRPromise();
4880            };
4881            data.abort = function () {
4882                if (this.jqXHR) {
4883                    return this.jqXHR.abort();
4884                }
4885                return that._getXHRPromise();
4886            };
4887            data.state = function () {
4888                if (this.jqXHR) {
4889                    return that._getDeferredState(this.jqXHR);
4890                }
4891                if (this._processQueue) {
4892                    return that._getDeferredState(this._processQueue);
4893                }
4894            };
4895            data.progress = function () {
4896                return this._progress;
4897            };
4898            data.response = function () {
4899                return this._response;
4900            };
4901        },
4902
4903        // Parses the Range header from the server response
4904        // and returns the uploaded bytes:
4905        _getUploadedBytes: function (jqXHR) {
4906            var range = jqXHR.getResponseHeader('Range'),
4907                parts = range && range.split('-'),
4908                upperBytesPos = parts && parts.length > 1 &&
4909                    parseInt(parts[1], 10);
4910            return upperBytesPos && upperBytesPos + 1;
4911        },
4912
4913        // Uploads a file in multiple, sequential requests
4914        // by splitting the file up in multiple blob chunks.
4915        // If the second parameter is true, only tests if the file
4916        // should be uploaded in chunks, but does not invoke any
4917        // upload requests:
4918        _chunkedUpload: function (options, testOnly) {
4919            options.uploadedBytes = options.uploadedBytes || 0;
4920            var that = this,
4921                file = options.files[0],
4922                fs = file.size,
4923                ub = options.uploadedBytes,
4924                mcs = options.maxChunkSize || fs,
4925                slice = this._blobSlice,
4926                dfd = $.Deferred(),
4927                promise = dfd.promise(),
4928                jqXHR,
4929                upload;
4930            if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
4931                    options.data) {
4932                return false;
4933            }
4934            if (testOnly) {
4935                return true;
4936            }
4937            if (ub >= fs) {
4938                file.error = options.i18n('uploadedBytes');
4939                return this._getXHRPromise(
4940                    false,
4941                    options.context,
4942                    [null, 'error', file.error]
4943                );
4944            }
4945            // The chunk upload method:
4946            upload = function () {
4947                // Clone the options object for each chunk upload:
4948                var o = $.extend({}, options),
4949                    currentLoaded = o._progress.loaded;
4950                o.blob = slice.call(
4951                    file,
4952                    ub,
4953                    ub + mcs,
4954                    file.type
4955                );
4956                // Store the current chunk size, as the blob itself
4957                // will be dereferenced after data processing:
4958                o.chunkSize = o.blob.size;
4959                // Expose the chunk bytes position range:
4960                o.contentRange = 'bytes ' + ub + '-' +
4961                    (ub + o.chunkSize - 1) + '/' + fs;
4962                // Process the upload data (the blob and potential form data):
4963                that._initXHRData(o);
4964                // Add progress listeners for this chunk upload:
4965                that._initProgressListener(o);
4966                jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
4967                        that._getXHRPromise(false, o.context))
4968                    .done(function (result, textStatus, jqXHR) {
4969                        ub = that._getUploadedBytes(jqXHR) ||
4970                            (ub + o.chunkSize);
4971                        // Create a progress event if no final progress event
4972                        // with loaded equaling total has been triggered
4973                        // for this chunk:
4974                        if (currentLoaded + o.chunkSize - o._progress.loaded) {
4975                            that._onProgress($.Event('progress', {
4976                                lengthComputable: true,
4977                                loaded: ub - o.uploadedBytes,
4978                                total: ub - o.uploadedBytes
4979                            }), o);
4980                        }
4981                        options.uploadedBytes = o.uploadedBytes = ub;
4982                        o.result = result;
4983                        o.textStatus = textStatus;
4984                        o.jqXHR = jqXHR;
4985                        that._trigger('chunkdone', null, o);
4986                        that._trigger('chunkalways', null, o);
4987                        if (ub < fs) {
4988                            // File upload not yet complete,
4989                            // continue with the next chunk:
4990                            upload();
4991                        } else {
4992                            dfd.resolveWith(
4993                                o.context,
4994                                [result, textStatus, jqXHR]
4995                            );
4996                        }
4997                    })
4998                    .fail(function (jqXHR, textStatus, errorThrown) {
4999                        o.jqXHR = jqXHR;
5000                        o.textStatus = textStatus;
5001                        o.errorThrown = errorThrown;
5002                        that._trigger('chunkfail', null, o);
5003                        that._trigger('chunkalways', null, o);
5004                        dfd.rejectWith(
5005                            o.context,
5006                            [jqXHR, textStatus, errorThrown]
5007                        );
5008                    });
5009            };
5010            this._enhancePromise(promise);
5011            promise.abort = function () {
5012                return jqXHR.abort();
5013            };
5014            upload();
5015            return promise;
5016        },
5017
5018        _beforeSend: function (e, data) {
5019            if (this._active === 0) {
5020                // the start callback is triggered when an upload starts
5021                // and no other uploads are currently running,
5022                // equivalent to the global ajaxStart event:
5023                this._trigger('start');
5024                // Set timer for global bitrate progress calculation:
5025                this._bitrateTimer = new this._BitrateTimer();
5026                // Reset the global progress values:
5027                this._progress.loaded = this._progress.total = 0;
5028                this._progress.bitrate = 0;
5029            }
5030            // Make sure the container objects for the .response() and
5031            // .progress() methods on the data object are available
5032            // and reset to their initial state:
5033            this._initResponseObject(data);
5034            this._initProgressObject(data);
5035            data._progress.loaded = data.loaded = data.uploadedBytes || 0;
5036            data._progress.total = data.total = this._getTotal(data.files) || 1;
5037            data._progress.bitrate = data.bitrate = 0;
5038            this._active += 1;
5039            // Initialize the global progress values:
5040            this._progress.loaded += data.loaded;
5041            this._progress.total += data.total;
5042        },
5043
5044        _onDone: function (result, textStatus, jqXHR, options) {
5045            var total = options._progress.total,
5046                response = options._response;
5047            if (options._progress.loaded < total) {
5048                // Create a progress event if no final progress event
5049                // with loaded equaling total has been triggered:
5050                this._onProgress($.Event('progress', {
5051                    lengthComputable: true,
5052                    loaded: total,
5053                    total: total
5054                }), options);
5055            }
5056            response.result = options.result = result;
5057            response.textStatus = options.textStatus = textStatus;
5058            response.jqXHR = options.jqXHR = jqXHR;
5059            this._trigger('done', null, options);
5060        },
5061
5062        _onFail: function (jqXHR, textStatus, errorThrown, options) {
5063            var response = options._response;
5064            if (options.recalculateProgress) {
5065                // Remove the failed (error or abort) file upload from
5066                // the global progress calculation:
5067                this._progress.loaded -= options._progress.loaded;
5068                this._progress.total -= options._progress.total;
5069            }
5070            response.jqXHR = options.jqXHR = jqXHR;
5071            response.textStatus = options.textStatus = textStatus;
5072            response.errorThrown = options.errorThrown = errorThrown;
5073            this._trigger('fail', null, options);
5074        },
5075
5076        _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
5077            // jqXHRorResult, textStatus and jqXHRorError are added to the
5078            // options object via done and fail callbacks
5079            this._trigger('always', null, options);
5080        },
5081
5082        _onSend: function (e, data) {
5083            if (!data.submit) {
5084                this._addConvenienceMethods(e, data);
5085            }
5086            var that = this,
5087                jqXHR,
5088                aborted,
5089                slot,
5090                pipe,
5091                options = that._getAJAXSettings(data),
5092                send = function () {
5093                    that._sending += 1;
5094                    // Set timer for bitrate progress calculation:
5095                    options._bitrateTimer = new that._BitrateTimer();
5096                    jqXHR = jqXHR || (
5097                        ((aborted || that._trigger('send', e, options) === false) &&
5098                        that._getXHRPromise(false, options.context, aborted)) ||
5099                        that._chunkedUpload(options) || $.ajax(options)
5100                    ).done(function (result, textStatus, jqXHR) {
5101                        that._onDone(result, textStatus, jqXHR, options);
5102                    }).fail(function (jqXHR, textStatus, errorThrown) {
5103                        that._onFail(jqXHR, textStatus, errorThrown, options);
5104                    }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
5105                        that._onAlways(
5106                            jqXHRorResult,
5107                            textStatus,
5108                            jqXHRorError,
5109                            options
5110                        );
5111                        that._sending -= 1;
5112                        that._active -= 1;
5113                        if (options.limitConcurrentUploads &&
5114                                options.limitConcurrentUploads > that._sending) {
5115                            // Start the next queued upload,
5116                            // that has not been aborted:
5117                            var nextSlot = that._slots.shift();
5118                            while (nextSlot) {
5119                                if (that._getDeferredState(nextSlot) === 'pending') {
5120                                    nextSlot.resolve();
5121                                    break;
5122                                }
5123                                nextSlot = that._slots.shift();
5124                            }
5125                        }
5126                        if (that._active === 0) {
5127                            // The stop callback is triggered when all uploads have
5128                            // been completed, equivalent to the global ajaxStop event:
5129                            that._trigger('stop');
5130                        }
5131                    });
5132                    return jqXHR;
5133                };
5134            this._beforeSend(e, options);
5135            if (this.options.sequentialUploads ||
5136                    (this.options.limitConcurrentUploads &&
5137                    this.options.limitConcurrentUploads <= this._sending)) {
5138                if (this.options.limitConcurrentUploads > 1) {
5139                    slot = $.Deferred();
5140                    this._slots.push(slot);
5141                    pipe = slot.pipe(send);
5142                } else {
5143                    this._sequence = this._sequence.pipe(send, send);
5144                    pipe = this._sequence;
5145                }
5146                // Return the piped Promise object, enhanced with an abort method,
5147                // which is delegated to the jqXHR object of the current upload,
5148                // and jqXHR callbacks mapped to the equivalent Promise methods:
5149                pipe.abort = function () {
5150                    aborted = [undefined, 'abort', 'abort'];
5151                    if (!jqXHR) {
5152                        if (slot) {
5153                            slot.rejectWith(options.context, aborted);
5154                        }
5155                        return send();
5156                    }
5157                    return jqXHR.abort();
5158                };
5159                return this._enhancePromise(pipe);
5160            }
5161            return send();
5162        },
5163
5164        _onAdd: function (e, data) {
5165            var that = this,
5166                result = true,
5167                options = $.extend({}, this.options, data),
5168                limit = options.limitMultiFileUploads,
5169                paramName = this._getParamName(options),
5170                paramNameSet,
5171                paramNameSlice,
5172                fileSet,
5173                i;
5174            if (!(options.singleFileUploads || limit) ||
5175                    !this._isXHRUpload(options)) {
5176                fileSet = [data.files];
5177                paramNameSet = [paramName];
5178            } else if (!options.singleFileUploads && limit) {
5179                fileSet = [];
5180                paramNameSet = [];
5181                for (i = 0; i < data.files.length; i += limit) {
5182                    fileSet.push(data.files.slice(i, i + limit));
5183                    paramNameSlice = paramName.slice(i, i + limit);
5184                    if (!paramNameSlice.length) {
5185                        paramNameSlice = paramName;
5186                    }
5187                    paramNameSet.push(paramNameSlice);
5188                }
5189            } else {
5190                paramNameSet = paramName;
5191            }
5192            data.originalFiles = data.files;
5193            $.each(fileSet || data.files, function (index, element) {
5194                var newData = $.extend({}, data);
5195                newData.files = fileSet ? element : [element];
5196                newData.paramName = paramNameSet[index];
5197                that._initResponseObject(newData);
5198                that._initProgressObject(newData);
5199                that._addConvenienceMethods(e, newData);
5200                result = that._trigger('add', e, newData);
5201                return result;
5202            });
5203            return result;
5204        },
5205
5206        _replaceFileInput: function (input) {
5207            var inputClone = input.clone(true);
5208            $('<form></form>').append(inputClone)[0].reset();
5209            // Detaching allows to insert the fileInput on another form
5210            // without loosing the file input value:
5211            input.after(inputClone).detach();
5212            // Avoid memory leaks with the detached file input:
5213            $.cleanData(input.unbind('remove'));
5214            // Replace the original file input element in the fileInput
5215            // elements set with the clone, which has been copied including
5216            // event handlers:
5217            this.options.fileInput = this.options.fileInput.map(function (i, el) {
5218                if (el === input[0]) {
5219                    return inputClone[0];
5220                }
5221                return el;
5222            });
5223            // If the widget has been initialized on the file input itself,
5224            // override this.element with the file input clone:
5225            if (input[0] === this.element[0]) {
5226                this.element = inputClone;
5227            }
5228        },
5229
5230        _handleFileTreeEntry: function (entry, path) {
5231            var that = this,
5232                dfd = $.Deferred(),
5233                errorHandler = function (e) {
5234                    if (e && !e.entry) {
5235                        e.entry = entry;
5236                    }
5237                    // Since $.when returns immediately if one
5238                    // Deferred is rejected, we use resolve instead.
5239                    // This allows valid files and invalid items
5240                    // to be returned together in one set:
5241                    dfd.resolve([e]);
5242                },
5243                dirReader;
5244            path = path || '';
5245            if (entry.isFile) {
5246                if (entry._file) {
5247                    // Workaround for Chrome bug #149735
5248                    entry._file.relativePath = path;
5249                    dfd.resolve(entry._file);
5250                } else {
5251                    entry.file(function (file) {
5252                        file.relativePath = path;
5253                        dfd.resolve(file);
5254                    }, errorHandler);
5255                }
5256            } else if (entry.isDirectory) {
5257                dirReader = entry.createReader();
5258                dirReader.readEntries(function (entries) {
5259                    that._handleFileTreeEntries(
5260                        entries,
5261                        path + entry.name + '/'
5262                    ).done(function (files) {
5263                        dfd.resolve(files);
5264                    }).fail(errorHandler);
5265                }, errorHandler);
5266            } else {
5267                // Return an empy list for file system items
5268                // other than files or directories:
5269                dfd.resolve([]);
5270            }
5271            return dfd.promise();
5272        },
5273
5274        _handleFileTreeEntries: function (entries, path) {
5275            var that = this;
5276            return $.when.apply(
5277                $,
5278                $.map(entries, function (entry) {
5279                    return that._handleFileTreeEntry(entry, path);
5280                })
5281            ).pipe(function () {
5282                return Array.prototype.concat.apply(
5283                    [],
5284                    arguments
5285                );
5286            });
5287        },
5288
5289        _getDroppedFiles: function (dataTransfer) {
5290            dataTransfer = dataTransfer || {};
5291            var items = dataTransfer.items;
5292            if (items && items.length && (items[0].webkitGetAsEntry ||
5293                    items[0].getAsEntry)) {
5294                return this._handleFileTreeEntries(
5295                    $.map(items, function (item) {
5296                        var entry;
5297                        if (item.webkitGetAsEntry) {
5298                            entry = item.webkitGetAsEntry();
5299                            if (entry) {
5300                                // Workaround for Chrome bug #149735:
5301                                entry._file = item.getAsFile();
5302                            }
5303                            return entry;
5304                        }
5305                        return item.getAsEntry();
5306                    })
5307                );
5308            }
5309            return $.Deferred().resolve(
5310                $.makeArray(dataTransfer.files)
5311            ).promise();
5312        },
5313
5314        _getSingleFileInputFiles: function (fileInput) {
5315            fileInput = $(fileInput);
5316            var entries = fileInput.prop('webkitEntries') ||
5317                    fileInput.prop('entries'),
5318                files,
5319                value;
5320            if (entries && entries.length) {
5321                return this._handleFileTreeEntries(entries);
5322            }
5323            files = $.makeArray(fileInput.prop('files'));
5324            if (!files.length) {
5325                value = fileInput.prop('value');
5326                if (!value) {
5327                    return $.Deferred().resolve([]).promise();
5328                }
5329                // If the files property is not available, the browser does not
5330                // support the File API and we add a pseudo File object with
5331                // the input value as name with path information removed:
5332                files = [{name: value.replace(/^.*\\/, '')}];
5333            } else if (files[0].name === undefined && files[0].fileName) {
5334                // File normalization for Safari 4 and Firefox 3:
5335                $.each(files, function (index, file) {
5336                    file.name = file.fileName;
5337                    file.size = file.fileSize;
5338                });
5339            }
5340            return $.Deferred().resolve(files).promise();
5341        },
5342
5343        _getFileInputFiles: function (fileInput) {
5344            if (!(fileInput instanceof $) || fileInput.length === 1) {
5345                return this._getSingleFileInputFiles(fileInput);
5346            }
5347            return $.when.apply(
5348                $,
5349                $.map(fileInput, this._getSingleFileInputFiles)
5350            ).pipe(function () {
5351                return Array.prototype.concat.apply(
5352                    [],
5353                    arguments
5354                );
5355            });
5356        },
5357
5358        _onChange: function (e) {
5359            var that = this,
5360                data = {
5361                    fileInput: $(e.target),
5362                    form: $(e.target.form)
5363                };
5364            this._getFileInputFiles(data.fileInput).always(function (files) {
5365                data.files = files;
5366                if (that.options.replaceFileInput) {
5367                    that._replaceFileInput(data.fileInput);
5368                }
5369                if (that._trigger('change', e, data) !== false) {
5370                    that._onAdd(e, data);
5371                }
5372            });
5373        },
5374
5375        _onPaste: function (e) {
5376            var items = e.originalEvent && e.originalEvent.clipboardData &&
5377                    e.originalEvent.clipboardData.items,
5378                data = { files: [] };
5379
5380            // Check if there is plain text in the paste buffer, if so cancel the paste as this is hijacking the page (Issue: #2994).
5381            var pasteText = e.originalEvent.clipboardData.getData('text/plain');
5382
5383            if (pasteText != '') {
5384                return;
5385            }
5386
5387            if (items && items.length) {
5388                $.each(items, function (index, item) {
5389                    var file = item.getAsFile && item.getAsFile();
5390                    if (file) {
5391                        data.files.push(file);
5392                    }
5393                });
5394                if (this._trigger('paste', e, data) !== false) {
5395                    this._onAdd(e, data);
5396                }
5397            }
5398        },
5399
5400        _onDrop: function (e) {
5401            e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
5402            var that = this,
5403                dataTransfer = e.dataTransfer,
5404                data = {};
5405            if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
5406                e.preventDefault();
5407                this._getDroppedFiles(dataTransfer).always(function (files) {
5408                    data.files = files;
5409                    if (that._trigger('drop', e, data) !== false) {
5410                        that._onAdd(e, data);
5411                    }
5412                });
5413            }
5414        },
5415
5416        _onDragOver: function (e) {
5417            e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
5418            var dataTransfer = e.dataTransfer,
5419                data = {
5420                    dropEffect: 'copy',
5421                    preventDefault: true
5422                };
5423            if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
5424                    this._trigger('dragover', e, data) !== false) {
5425                dataTransfer.dropEffect = data.dropEffect;
5426                if (data.preventDefault) {
5427                    e.preventDefault();
5428                }
5429            }
5430        },
5431
5432        _initEventHandlers: function () {
5433            if (this._isXHRUpload(this.options)) {
5434                this._on(this.options.dropZone, {
5435                    dragover: this._onDragOver,
5436                    drop: this._onDrop
5437                });
5438                this._on(this.options.pasteZone, {
5439                    paste: this._onPaste
5440                });
5441            }
5442            if ($.support.fileInput) {
5443                this._on(this.options.fileInput, {
5444                    change: this._onChange
5445                });
5446            }
5447        },
5448
5449        _destroyEventHandlers: function () {
5450            this._off(this.options.dropZone, 'dragover drop');
5451            this._off(this.options.pasteZone, 'paste');
5452            this._off(this.options.fileInput, 'change');
5453        },
5454
5455        _setOption: function (key, value) {
5456            var reinit = $.inArray(key, this._specialOptions) !== -1;
5457            if (reinit) {
5458                this._destroyEventHandlers();
5459            }
5460            this._super(key, value);
5461            if (reinit) {
5462                this._initSpecialOptions();
5463                this._initEventHandlers();
5464            }
5465        },
5466
5467        _initSpecialOptions: function () {
5468            var options = this.options;
5469            if (options.fileInput === undefined) {
5470                options.fileInput = this.element.is('input[type="file"]') ?
5471                        this.element : this.element.find('input[type="file"]');
5472            } else if (!(options.fileInput instanceof $)) {
5473                options.fileInput = $(options.fileInput);
5474            }
5475            if (!(options.dropZone instanceof $)) {
5476                options.dropZone = $(options.dropZone);
5477            }
5478            if (!(options.pasteZone instanceof $)) {
5479                options.pasteZone = $(options.pasteZone);
5480            }
5481        },
5482
5483        _getRegExp: function (str) {
5484            var parts = str.split('/'),
5485                modifiers = parts.pop();
5486            parts.shift();
5487            return new RegExp(parts.join('/'), modifiers);
5488        },
5489
5490        _isRegExpOption: function (key, value) {
5491            return key !== 'url' && $.type(value) === 'string' &&
5492                /^\/.*\/[igm]{0,3}$/.test(value);
5493        },
5494
5495        _initDataAttributes: function () {
5496            var that = this,
5497                options = this.options;
5498            // Initialize options set via HTML5 data-attributes:
5499            $.each(
5500                $(this.element[0].cloneNode(false)).data(),
5501                function (key, value) {
5502                    if (that._isRegExpOption(key, value)) {
5503                        value = that._getRegExp(value);
5504                    }
5505                    options[key] = value;
5506                }
5507            );
5508        },
5509
5510        _create: function () {
5511            this._initDataAttributes();
5512            this._initSpecialOptions();
5513            this._slots = [];
5514            this._sequence = this._getXHRPromise(true);
5515            this._sending = this._active = 0;
5516            this._initProgressObject(this);
5517            this._initEventHandlers();
5518        },
5519
5520        // This method is exposed to the widget API and allows to query
5521        // the number of active uploads:
5522        active: function () {
5523            return this._active;
5524        },
5525
5526        // This method is exposed to the widget API and allows to query
5527        // the widget upload progress.
5528        // It returns an object with loaded, total and bitrate properties
5529        // for the running uploads:
5530        progress: function () {
5531            return this._progress;
5532        },
5533
5534        // This method is exposed to the widget API and allows adding files
5535        // using the fileupload API. The data parameter accepts an object which
5536        // must have a files property and can contain additional options:
5537        // .fileupload('add', {files: filesList});
5538        add: function (data) {
5539            var that = this;
5540            if (!data || this.options.disabled) {
5541                return;
5542            }
5543            if (data.fileInput && !data.files) {
5544                this._getFileInputFiles(data.fileInput).always(function (files) {
5545                    data.files = files;
5546                    that._onAdd(null, data);
5547                });
5548            } else {
5549                data.files = $.makeArray(data.files);
5550                this._onAdd(null, data);
5551            }
5552        },
5553
5554        // This method is exposed to the widget API and allows sending files
5555        // using the fileupload API. The data parameter accepts an object which
5556        // must have a files or fileInput property and can contain additional options:
5557        // .fileupload('send', {files: filesList});
5558        // The method returns a Promise object for the file upload call.
5559        send: function (data) {
5560            if (data && !this.options.disabled) {
5561                if (data.fileInput && !data.files) {
5562                    var that = this,
5563                        dfd = $.Deferred(),
5564                        promise = dfd.promise(),
5565                        jqXHR,
5566                        aborted;
5567                    promise.abort = function () {
5568                        aborted = true;
5569                        if (jqXHR) {
5570                            return jqXHR.abort();
5571                        }
5572                        dfd.reject(null, 'abort', 'abort');
5573                        return promise;
5574                    };
5575                    this._getFileInputFiles(data.fileInput).always(
5576                        function (files) {
5577                            if (aborted) {
5578                                return;
5579                            }
5580                            if (!files.length) {
5581                                dfd.reject();
5582                                return;
5583                            }
5584                            data.files = files;
5585                            jqXHR = that._onSend(null, data).then(
5586                                function (result, textStatus, jqXHR) {
5587                                    dfd.resolve(result, textStatus, jqXHR);
5588                                },
5589                                function (jqXHR, textStatus, errorThrown) {
5590                                    dfd.reject(jqXHR, textStatus, errorThrown);
5591                                }
5592                            );
5593                        }
5594                    );
5595                    return this._enhancePromise(promise);
5596                }
5597                data.files = $.makeArray(data.files);
5598                if (data.files.length) {
5599                    return this._onSend(null, data);
5600                }
5601            }
5602            return this._getXHRPromise(false, data && data.context);
5603        }
5604
5605    });
5606
5607}));
5608;
5609/*!
5610 * StickyTableHeaders 0.1.24 (2018-01-14 23:29)
5611 * MIT licensed
5612 * Copyright (C) Jonas Mosbech - https://github.com/jmosbech/StickyTableHeaders
5613 */
5614!function (e, i, t) { "use strict"; var o = "stickyTableHeaders", n = 0, d = { fixedOffset: 0, leftOffset: 0, marginTop: 0, objDocument: document, objHead: "head", objWindow: i, scrollableArea: i, cacheHeaderHeight: !1, zIndex: 3 }; e.fn[o] = function (t) { return this.each(function () { var l = e.data(this, "plugin_" + o); l ? "string" == typeof t ? l[t].apply(l) : l.updateOptions(t) : "destroy" !== t && e.data(this, "plugin_" + o, new function (t, l) { var a = this; a.$el = e(t), a.el = t, a.id = n++ , a.$el.bind("destroyed", e.proxy(a.teardown, a)), a.$clonedHeader = null, a.$originalHeader = null, a.cachedHeaderHeight = null, a.isSticky = !1, a.hasBeenSticky = !1, a.leftOffset = null, a.topOffset = null, a.init = function () { a.setOptions(l), a.$el.each(function () { var i = e(this); i.css("padding", 0), a.$originalHeader = e("thead:first", this), a.$clonedHeader = a.$originalHeader.clone(), i.trigger("clonedHeader." + o, [a.$clonedHeader]), a.$clonedHeader.addClass("tableFloatingHeader"), a.$clonedHeader.css({ display: "none", opacity: 0 }), a.$originalHeader.addClass("tableFloatingHeaderOriginal"), a.$originalHeader.after(a.$clonedHeader), a.$printStyle = e('<style type="text/css" media="print">.tableFloatingHeader{display:none !important;}.tableFloatingHeaderOriginal{position:static !important;}</style>'), a.$head.append(a.$printStyle) }), a.$clonedHeader.find("input, select").attr("disabled", !0), a.updateWidth(), a.toggleHeaders(), a.bind() }, a.destroy = function () { a.$el.unbind("destroyed", a.teardown), a.teardown() }, a.teardown = function () { a.isSticky && a.$originalHeader.css("position", "static"), e.removeData(a.el, "plugin_" + o), a.unbind(), a.$clonedHeader.remove(), a.$originalHeader.removeClass("tableFloatingHeaderOriginal"), a.$originalHeader.css("visibility", "visible"), a.$printStyle.remove(), a.el = null, a.$el = null }, a.bind = function () { a.$scrollableArea.on("scroll." + o, a.toggleHeaders), a.isWindowScrolling || (a.$window.on("scroll." + o + a.id, a.setPositionValues), a.$window.on("resize." + o + a.id, a.toggleHeaders)), a.$scrollableArea.on("resize." + o, a.toggleHeaders), a.$scrollableArea.on("resize." + o, a.updateWidth) }, a.unbind = function () { a.$scrollableArea.off("." + o, a.toggleHeaders), a.isWindowScrolling || (a.$window.off("." + o + a.id, a.setPositionValues), a.$window.off("." + o + a.id, a.toggleHeaders)), a.$scrollableArea.off("." + o, a.updateWidth) }, a.debounce = function (e, i) { var t = null; return function () { var o = this, n = arguments; clearTimeout(t), t = setTimeout(function () { e.apply(o, n) }, i) } }, a.toggleHeaders = a.debounce(function () { a.$el && a.$el.each(function () { var i, t, n, d = e(this), l = a.isWindowScrolling ? isNaN(a.options.fixedOffset) ? a.options.fixedOffset.outerHeight() : a.options.fixedOffset : a.$scrollableArea.offset().top + (isNaN(a.options.fixedOffset) ? 0 : a.options.fixedOffset), s = d.offset(), r = a.$scrollableArea.scrollTop() + l, c = a.$scrollableArea.scrollLeft(), f = a.isWindowScrolling ? r > s.top : l > s.top; f && (t = a.options.cacheHeaderHeight ? a.cachedHeaderHeight : a.$clonedHeader.height(), n = (a.isWindowScrolling ? r : 0) < s.top + d.height() - t - (a.isWindowScrolling ? 0 : l)), f && n ? (i = s.left - c + a.options.leftOffset, a.$originalHeader.css({ position: "fixed", "margin-top": a.options.marginTop, top: 0, left: i, "z-index": a.options.zIndex }), a.leftOffset = i, a.topOffset = l, a.$clonedHeader.css("display", ""), a.isSticky || (a.isSticky = !0, a.updateWidth(), d.trigger("enabledStickiness." + o)), a.setPositionValues()) : a.isSticky && (a.$originalHeader.css("position", "static"), a.$clonedHeader.css("display", "none"), a.isSticky = !1, a.resetWidth(e("td,th", a.$clonedHeader), e("td,th", a.$originalHeader)), d.trigger("disabledStickiness." + o)) }) }, 0), a.setPositionValues = a.debounce(function () { var e = a.$window.scrollTop(), i = a.$window.scrollLeft(); !a.isSticky || e < 0 || e + a.$window.height() > a.$document.height() || i < 0 || i + a.$window.width() > a.$document.width() || a.$originalHeader.css({ top: a.topOffset - (a.isWindowScrolling ? 0 : e), left
5614: a.leftOffset - (a.isWindowScrolling ? 0 : i) }) }, 0), a.updateWidth = a.debounce(function () { if (a.isSticky) { a.$originalHeaderCells || (a.$originalHeaderCells = e("th,td", a.$originalHeader)), a.$clonedHeaderCells || (a.$clonedHeaderCells = e("th,td", a.$clonedHeader)); var i = a.getWidth(a.$clonedHeaderCells); a.setWidth(i, a.$clonedHeaderCells, a.$originalHeaderCells), a.$originalHeader.css("width", a.$clonedHeader.width()), a.options.cacheHeaderHeight && (a.cachedHeaderHeight = a.$clonedHeader.height()) } }, 0), a.getWidth = function (t) { var o = []; return t.each(function (t) { var n, d = e(this); if ("border-box" === d.css("box-sizing")) { var l = d[0].getBoundingClientRect(); n = l.width ? l.width : l.right - l.left } else if ("collapse" === e("th", a.$originalHeader).css("border-collapse")) if (i.getComputedStyle) n = parseFloat(i.getComputedStyle(this, null).width); else { var s = parseFloat(d.css("padding-left")), r = parseFloat(d.css("padding-right")), c = parseFloat(d.css("border-width")); n = d.outerWidth() - s - r - c } else n = d.width(); o[t] = n }), o }, a.setWidth = function (e, i, t) { i.each(function (i) { var o = e[i]; t.eq(i).css({ "min-width": o, "max-width": o }) }) }, a.resetWidth = function (i, t) { i.each(function (i) { var o = e(this); t.eq(i).css({ "min-width": o.css("min-width"), "max-width": o.css("max-width") }) }) }, a.setOptions = function (i) { a.options = e.extend({}, d, i), a.$window = e(a.options.objWindow), a.$head = e(a.options.objHead), a.$document = e(a.options.objDocument), a.$scrollableArea = e(a.options.scrollableArea), a.isWindowScrolling = a.$scrollableArea[0] === a.$window[0] }, a.updateOptions = function (e) { a.setOptions(e), a.unbind(), a.bind(), a.updateWidth(), a.toggleHeaders() }, a.init() }(this, t)) }) } }(jQuery, window);;
5615/*! iScroll v5.2.0-snapshot ~ (c) 2008-2017 Matteo Spinelli ~ http://cubiq.org/license */
5616(function (window, document, Math) {
5617var rAF = window.requestAnimationFrame	||
5618	window.webkitRequestAnimationFrame	||
5619	window.mozRequestAnimationFrame		||
5620	window.oRequestAnimationFrame		||
5621	window.msRequestAnimationFrame		||
5622	function (callback) { window.setTimeout(callback, 1000 / 60); };
5623
5624var utils = (function () {
5625	var me = {};
5626
5627	var _elementStyle = document.createElement('div').style;
5628	var _vendor = (function () {
5629		var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'],
5630			transform,
5631			i = 0,
5632			l = vendors.length;
5633
5634		for ( ; i < l; i++ ) {
5635			transform = vendors[i] + 'ransform';
5636			if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1);
5637		}
5638
5639		return false;
5640	})();
5641
5642	function _prefixStyle (style) {
5643		if ( _vendor === false ) return false;
5644		if ( _vendor === '' ) return style;
5645		return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
5646	}
5647
5648	me.getTime = Date.now || function getTime () { return new Date().getTime(); };
5649
5650	me.extend = function (target, obj) {
5651		for ( var i in obj ) {
5652			target[i] = obj[i];
5653		}
5654	};
5655
5656	me.addEvent = function (el, type, fn, capture) {
5657		el.addEventListener(type, fn, !!capture);
5658	};
5659
5660	me.removeEvent = function (el, type, fn, capture) {
5661		el.removeEventListener(type, fn, !!capture);
5662	};
5663
5664	me.prefixPointerEvent = function (pointerEvent) {
5665		return window.MSPointerEvent ?
5666			'MSPointer' + pointerEvent.charAt(7).toUpperCase() + pointerEvent.substr(8):
5667			pointerEvent;
5668	};
5669
5670	me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
5671		var distance = current - start,
5672			speed = Math.abs(distance) / time,
5673			destination,
5674			duration;
5675
5676		deceleration = deceleration === undefined ? 0.0006 : deceleration;
5677
5678		destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
5679		duration = speed / deceleration;
5680
5681		if ( destination < lowerMargin ) {
5682			destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin;
5683			distance = Math.abs(destination - current);
5684			duration = distance / speed;
5685		} else if ( destination > 0 ) {
5686			destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0;
5687			distance = Math.abs(current) + destination;
5688			duration = distance / speed;
5689		}
5690
5691		return {
5692			destination: Math.round(destination),
5693			duration: duration
5694		};
5695	};
5696
5697	var _transform = _prefixStyle('transform');
5698
5699	me.extend(me, {
5700		hasTransform: _transform !== false,
5701		hasPerspective: _prefixStyle('perspective') in _elementStyle,
5702		hasTouch: 'ontouchstart' in window,
5703		hasPointer: !!(window.PointerEvent || window.MSPointerEvent), // IE10 is prefixed
5704		hasTransition: _prefixStyle('transition') in _elementStyle
5705	});
5706
5707	/*
5708	This should find all Android browsers lower than build 535.19 (both stock browser and webview)
5709	- galaxy S2 is ok
5710    - 2.3.6 : `AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1`
5711    - 4.0.4 : `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
5712   - galaxy S3 is badAndroid (stock brower, webview)
5713     `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
5714   - galaxy S4 is badAndroid (stock brower, webview)
5715     `AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30`
5716   - galaxy S5 is OK
5717     `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
5718   - galaxy S6 is OK
5719     `AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36 (Chrome/)`
5720  */
5721	me.isBadAndroid = (function() {
5722		var appVersion = window.navigator.appVersion;
5723		// Android browser is not a chrome browser.
5724		if (/Android/.test(appVersion) && !(/Chrome\/\d/.test(appVersion))) {
5725			var safariVersion = appVersion.match(/Safari\/(\d+.\d)/);
5726			if(safariVersion && typeof safariVersion === "object" && safariVersion.length >= 2) {
5727				return parseFloat(safariVersion[1]) < 535.19;
5728			} else {
5729				return true;
5730			}
5731		} else {
5732			return false;
5733		}
5734	})();
5735
5736	me.extend(me.style = {}, {
5737		transform: _transform,
5738		transitionTimingFunction: _prefixStyle('transitionTimingFunction'),
5739		transitionDuration: _prefixStyle('transitionDuration'),
5740		transitionDelay: _prefixStyle('transitionDelay'),
5741		transformOrigin: _prefixStyle('transformOrigin'),
5742		touchAction: _prefixStyle('touchAction')
5743	});
5744
5745	me.hasClass = function (e, c) {
5746		var re = new RegExp("(^|\\s)" + c + "(\\s|$)");
5747		return re.test(e.className);
5748	};
5749
5750	me.addClass = function (e, c) {
5751		if ( me.hasClass(e, c) ) {
5752			return;
5753		}
5754
5755		var newclass = e.className.split(' ');
5756		newclass.push(c);
5757		e.className = newclass.join(' ');
5758	};
5759
5760	me.removeClass = function (e, c) {
5761		if ( !me.hasClass(e, c) ) {
5762			return;
5763		}
5764
5765		var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g');
5766		e.className = e.className.replace(re, ' ');
5767	};
5768
5769	me.offset = function (el) {
5770		var left = -el.offsetLeft,
5771			top = -el.offsetTop;
5772
5773		// jshint -W084
5774		while (el = el.offsetParent) {
5775			left -= el.offsetLeft;
5776			top -= el.offsetTop;
5777		}
5778		// jshint +W084
5779
5780		return {
5781			left: left,
5782			top: top
5783		};
5784	};
5785
5786	me.preventDefaultException = function (el, exceptions) {
5787		for ( var i in exceptions ) {
5788			if ( exceptions[i].test(el[i]) ) {
5789				return true;
5790			}
5791		}
5792
5793		return false;
5794	};
5795
5796	me.extend(me.eventType = {}, {
5797		touchstart: 1,
5798		touchmove: 1,
5799		touchend: 1,
5800
5801		mousedown: 2,
5802		mousemove: 2,
5803		mouseup: 2,
5804
5805		pointerdown: 3,
5806		pointermove: 3,
5807		pointerup: 3,
5808
5809		MSPointerDown: 3,
5810		MSPointerMove: 3,
5811		MSPointerUp: 3
5812	});
5813
5814	me.extend(me.ease = {}, {
5815		quadratic: {
5816			style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
5817			fn: function (k) {
5818				return k * ( 2 - k );
5819			}
5820		},
5821		circular: {
5822			style: 'cubic-bezier(0.1, 0.57, 0.1, 1)',	// Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
5823			fn: function (k) {
5824				return Math.sqrt( 1 - ( --k * k ) );
5825			}
5826		},
5827		back: {
5828			style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
5829			fn: function (k) {
5830				var b = 4;
5831				return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1;
5832			}
5833		},
5834		bounce: {
5835			style: '',
5836			fn: function (k) {
5837				if ( ( k /= 1 ) < ( 1 / 2.75 ) ) {
5838					return 7.5625 * k * k;
5839				} else if ( k < ( 2 / 2.75 ) ) {
5840					return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
5841				} else if ( k < ( 2.5 / 2.75 ) ) {
5842					return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
5843				} else {
5844					return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
5845				}
5846			}
5847		},
5848		elastic: {
5849			style: '',
5850			fn: function (k) {
5851				var f = 0.22,
5852					e = 0.4;
5853
5854				if ( k === 0 ) { return 0; }
5855				if ( k == 1 ) { return 1; }
5856
5857				return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 );
5858			}
5859		}
5860	});
5861
5862	me.tap = function (e, eventName) {
5863		var ev = document.createEvent('Event');
5864		ev.initEvent(eventName, true, true);
5865		ev.pageX = e.pageX;
5866		ev.pageY = e.pageY;
5867		e.target.dispatchEvent(ev);
5868	};
5869
5870	me.click = function (e) {
5871		var target = e.target,
5872			ev;
5873
5874		if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
5875			// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
5876			// initMouseEvent is deprecated.
5877			ev = document.createEvent(window.MouseEvent ? 'MouseEvents' : 'Event');
5878			ev.initEvent('click', true, true);
5879			ev.view = e.view || window;
5880			ev.detail = 1;
5881			ev.screenX = target.screenX || 0;
5882			ev.screenY = target.screenY || 0;
5883			ev.clientX = target.clientX || 0;
5884			ev.clientY = target.clientY || 0;
5885			ev.ctrlKey = !!e.ctrlKey;
5886			ev.altKey = !!e.altKey;
5887			ev.shiftKey = !!e.shiftKey;
5888			ev.metaKey = !!e.metaKey;
5889			ev.button = 0;
5890			ev.relatedTarget = null;
5891			ev._constructed = true;
5892			target.dispatchEvent(ev);
5893		}
5894	};
5895
5896	me.getTouchAction = function(eventPassthrough, addPinch) {
5897		var touchAction = 'none';
5898		if ( eventPassthrough === 'vertical' ) {
5899			touchAction = 'pan-y';
5900		} else if (eventPassthrough === 'horizontal' ) {
5901			touchAction = 'pan-x';
5902		}
5903		if (addPinch && touchAction != 'none') {
5904			// add pinch-zoom support if the browser supports it, but if not (eg. Chrome <55) do nothing
5905			touchAction += ' pinch-zoom';
5906		}
5907		return touchAction;
5908	};
5909
5910	me.getRect = function(el) {
5911		if (el instanceof SVGElement) {
5912			var rect = el.getBoundingClientRect();
5913			return {
5914				top : rect.top,
5915				left : rect.left,
5916				width : rect.width,
5917				height : rect.height
5918			};
5919		} else {
5920			return {
5921				top : el.offsetTop,
5922				left : el.offsetLeft,
5923				width : el.offsetWidth,
5924				height : el.offsetHeight
5925			};
5926		}
5927	};
5928
5929	return me;
5930})();
5931function IScroll (el, options) {
5932	this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
5933	this.scroller = this.wrapper.children[0];
5934	this.scrollerStyle = this.scroller.style;		// cache style for better performance
5935
5936	this.options = {
5937
5938		resizeScrollbars: true,
5939
5940		mouseWheelSpeed: 20,
5941
5942		snapThreshold: 0.334,
5943
5944// INSERT POINT: OPTIONS
5945		disablePointer : !utils.hasPointer,
5946		disableTouch : utils.hasPointer || !utils.hasTouch,
5947		disableMouse : utils.hasPointer || utils.hasTouch,
5948		startX: 0,
5949		startY: 0,
5950		scrollY: true,
5951		directionLockThreshold: 5,
5952		momentum: true,
5953
5954		bounce: true,
5955		bounceTime: 600,
5956		bounceEasing: '',
5957
5958		preventDefault: true,
5959		preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ },
5960
5961		HWCompositing: true,
5962		useTransition: true,
5963		useTransform: true,
5964		bindToWrapper: typeof window.onmousedown === "undefined"
5965	};
5966
5967	for ( var i in options ) {
5968		this.options[i] = options[i];
5969	}
5970
5971	// Normalize options
5972	this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : '';
5973
5974	this.options.useTransition = utils.hasTransition && this.options.useTransition;
5975	this.options.useTransform = utils.hasTransform && this.options.useTransform;
5976
5977	this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough;
5978	this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault;
5979
5980	// If you want eventPassthrough I have to lock one of the axes
5981	this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY;
5982	this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX;
5983
5984	// With eventPassthrough we also need lockDirection mechanism
5985	this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
5986	this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
5987
5988	this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing;
5989
5990	this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling;
5991
5992	if ( this.options.tap === true ) {
5993		this.options.tap = 'tap';
5994	}
5995
5996	// https://github.com/cubiq/iscroll/issues/1029
5997	if (!this.options.useTransition && !this.options.useTransform) {
5998		if(!(/relative|absolute/i).test(this.scrollerStyle.position)) {
5999			this.scrollerStyle.position = "relative";
6000		}
6001	}
6002
6003	if ( this.options.shrinkScrollbars == 'scale' ) {
6004		this.options.useTransition = false;
6005	}
6006
6007	this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1;
6008
6009// INSERT POINT: NORMALIZATION
6010
6011	// Some defaults
6012	this.x = 0;
6013	this.y = 0;
6014	this.directionX = 0;
6015	this.directionY = 0;
6016	this._events = {};
6017
6018// INSERT POINT: DEFAULTS
6019
6020	this._init();
6021	this.refresh();
6022
6023	this.scrollTo(this.options.startX, this.options.startY);
6024	this.enable();
6025}
6026
6027IScroll.prototype = {
6028	version: '5.2.0-snapshot',
6029
6030	_init: function () {
6031		this._initEvents();
6032
6033		if ( this.options.scrollbars || this.options.indicators ) {
6034			this._initIndicators();
6035		}
6036
6037		if ( this.options.mouseWheel ) {
6038			this._initWheel();
6039		}
6040
6041		if ( this.options.snap ) {
6042			this._initSnap();
6043		}
6044
6045		if ( this.options.keyBindings ) {
6046			this._initKeys();
6047		}
6048
6049// INSERT POINT: _init
6050
6051	},
6052
6053	destroy: function () {
6054		this._initEvents(true);
6055		clearTimeout(this.resizeTimeout);
6056 		this.resizeTimeout = null;
6057		this._execEvent('destroy');
6058	},
6059
6060	_transitionEnd: function (e) {
6061		if ( e.target != this.scroller || !this.isInTransition ) {
6062			return;
6063		}
6064
6065		this._transitionTime();
6066		if ( !this.resetPosition(this.options.bounceTime) ) {
6067			this.isInTransition = false;
6068			this._execEvent('scrollEnd');
6069		}
6070	},
6071
6072	_start: function (e) {
6073		// React to left mouse button only
6074		if ( utils.eventType[e.type] != 1 ) {
6075		  // for button property
6076		  // http://unixpapa.com/js/mouse.html
6077		  var button;
6078	    if (!e.which) {
6079	      /* IE case */
6080	      button = (e.button < 2) ? 0 :
6081	               ((e.button == 4) ? 1 : 2);
6082	    } else {
6083	      /* All others */
6084	      button = e.button;
6085	    }
6086			if ( button !== 0 ) {
6087				return;
6088			}
6089		}
6090
6091		if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) {
6092			return;
6093		}
6094
6095		if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
6096			e.preventDefault();
6097		}
6098
6099		var point = e.touches ? e.touches[0] : e,
6100			pos;
6101
6102		this.initiated	= utils.eventType[e.type];
6103		this.moved		= false;
6104		this.distX		= 0;
6105		this.distY		= 0;
6106		this.directionX = 0;
6107		this.directionY = 0;
6108		this.directionLocked = 0;
6109
6110		this.startTime = utils.getTime();
6111
6112		if ( this.options.useTransition && this.isInTransition ) {
6113			this._transitionTime();
6114			this.isInTransition = false;
6115			pos = this.getComputedPosition();
6116			this._translate(Math.round(pos.x), Math.round(pos.y));
6117			this._execEvent('scrollEnd');
6118		} else if ( !this.options.useTransition && this.isAnimating ) {
6119			this.isAnimating = false;
6120			this._execEvent('scrollEnd');
6121		}
6122
6123		this.startX    = this.x;
6124		this.startY    = this.y;
6125		this.absStartX = this.x;
6126		this.absStartY = this.y;
6127		this.pointX    = point.pageX;
6128		this.pointY    = point.pageY;
6129
6130		this._execEvent('beforeScrollStart');
6131	},
6132
6133	_move: function (e) {
6134		if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
6135			return;
6136		}
6137
6138		if ( this.options.preventDefault ) {	// increases performance on Android? TODO: check!
6139			e.preventDefault();
6140		}
6141
6142		var point		= e.touches ? e.touches[0] : e,
6143			deltaX		= point.pageX - this.pointX,
6144			deltaY		= point.pageY - this.pointY,
6145			timestamp	= utils.getTime(),
6146			newX, newY,
6147			absDistX, absDistY;
6148
6149		this.pointX		= point.pageX;
6150		this.pointY		= point.pageY;
6151
6152		this.distX		+= deltaX;
6153		this.distY		+= deltaY;
6154		absDistX		= Math.abs(this.distX);
6155		absDistY		= Math.abs(this.distY);
6156
6157		// We need to move at least 10 pixels for the scrolling to initiate
6158		if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) {
6159			return;
6160		}
6161
6162		// If you are scrolling in one direction lock the other
6163		if ( !this.directionLocked && !this.options.freeScroll ) {
6164			if ( absDistX > absDistY + this.options.directionLockThreshold ) {
6165				this.directionLocked = 'h';		// lock horizontally
6166			} else if ( absDistY >= absDistX + this.options.directionLockThreshold ) {
6167				this.directionLocked = 'v';		// lock vertically
6168			} else {
6169				this.directionLocked = 'n';		// no lock
6170			}
6171		}
6172
6173		if ( this.directionLocked == 'h' ) {
6174			if ( this.options.eventPassthrough == 'vertical' ) {
6175				e.preventDefault();
6176			} else if ( this.options.eventPassthrough == 'horizontal' ) {
6177				this.initiated = false;
6178				return;
6179			}
6180
6181			deltaY = 0;
6182		} else if ( this.directionLocked == 'v' ) {
6183			if ( this.options.eventPassthrough == 'horizontal' ) {
6184				e.preventDefault();
6185			} else if ( this.options.eventPassthrough == 'vertical' ) {
6186				this.initiated = false;
6187				return;
6188			}
6189
6190			deltaX = 0;
6191		}
6192
6193		deltaX = this.hasHorizontalScroll ? deltaX : 0;
6194		deltaY = this.hasVerticalScroll ? deltaY : 0;
6195
6196		newX = this.x + deltaX;
6197		newY = this.y + deltaY;
6198
6199		// Slow down if outside of the boundaries
6200		if ( newX > 0 || newX < this.maxScrollX ) {
6201			newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX;
6202		}
6203		if ( newY > 0 || newY < this.maxScrollY ) {
6204			newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY;
6205		}
6206
6207		this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
6208		this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
6209
6210		if ( !this.moved ) {
6211			this._execEvent('scrollStart');
6212		}
6213
6214		this.moved = true;
6215
6216		this._translate(newX, newY);
6217
6218/* REPLACE START: _move */
6219
6220		if ( timestamp - this.startTime > 300 ) {
6221			this.startTime = timestamp;
6222			this.startX = this.x;
6223			this.startY = this.y;
6224		}
6225
6226/* REPLACE END: _move */
6227
6228	},
6229
6230	_end: function (e) {
6231		if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
6232			return;
6233		}
6234
6235		if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
6236			e.preventDefault();
6237		}
6238
6239		var point = e.changedTouches ? e.changedTouches[0] : e,
6240			momentumX,
6241			momentumY,
6242			duration = utils.getTime() - this.startTime,
6243			newX = Math.round(this.x),
6244			newY = Math.round(this.y),
6245			distanceX = Math.abs(newX - this.startX),
6246			distanceY = Math.abs(newY - this.startY),
6247			time = 0,
6248			easing = '';
6249
6250		this.isInTransition = 0;
6251		this.initiated = 0;
6252		this.endTime = utils.getTime();
6253
6254		// reset if we are outside of the boundaries
6255		if ( this.resetPosition(this.options.bounceTime) ) {
6256			return;
6257		}
6258
6259		this.scrollTo(newX, newY);	// ensures that the last position is rounded
6260
6261		// we scrolled less than 10 pixels
6262		if ( !this.moved ) {
6263			if ( this.options.tap ) {
6264				utils.tap(e, this.options.tap);
6265			}
6266
6267			if ( this.options.click ) {
6268				utils.click(e);
6269			}
6270
6271			this._execEvent('scrollCancel');
6272			return;
6273		}
6274
6275		if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) {
6276			this._execEvent('flick');
6277			return;
6278		}
6279
6280		// start momentum animation if needed
6281		if ( this.options.momentum && duration < 300 ) {
6282			momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperW
6282idth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
6283			momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
6284			newX = momentumX.destination;
6285			newY = momentumY.destination;
6286			time = Math.max(momentumX.duration, momentumY.duration);
6287			this.isInTransition = 1;
6288		}
6289
6290
6291		if ( this.options.snap ) {
6292			var snap = this._nearestSnap(newX, newY);
6293			this.currentPage = snap;
6294			time = this.options.snapSpeed || Math.max(
6295					Math.max(
6296						Math.min(Math.abs(newX - snap.x), 1000),
6297						Math.min(Math.abs(newY - snap.y), 1000)
6298					), 300);
6299			newX = snap.x;
6300			newY = snap.y;
6301
6302			this.directionX = 0;
6303			this.directionY = 0;
6304			easing = this.options.bounceEasing;
6305		}
6306
6307// INSERT POINT: _end
6308
6309		if ( newX != this.x || newY != this.y ) {
6310			// change easing function when scroller goes out of the boundaries
6311			if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) {
6312				easing = utils.ease.quadratic;
6313			}
6314
6315			this.scrollTo(newX, newY, time, easing);
6316			return;
6317		}
6318
6319		this._execEvent('scrollEnd');
6320	},
6321
6322	_resize: function () {
6323		var that = this;
6324
6325		clearTimeout(this.resizeTimeout);
6326
6327		this.resizeTimeout = setTimeout(function () {
6328			that.refresh();
6329		}, this.options.resizePolling);
6330	},
6331
6332	resetPosition: function (time) {
6333		var x = this.x,
6334			y = this.y;
6335
6336		time = time || 0;
6337
6338		if ( !this.hasHorizontalScroll || this.x > 0 ) {
6339			x = 0;
6340		} else if ( this.x < this.maxScrollX ) {
6341			x = this.maxScrollX;
6342		}
6343
6344		if ( !this.hasVerticalScroll || this.y > 0 ) {
6345			y = 0;
6346		} else if ( this.y < this.maxScrollY ) {
6347			y = this.maxScrollY;
6348		}
6349
6350		if ( x == this.x && y == this.y ) {
6351			return false;
6352		}
6353
6354		this.scrollTo(x, y, time, this.options.bounceEasing);
6355
6356		return true;
6357	},
6358
6359	disable: function () {
6360		this.enabled = false;
6361	},
6362
6363	enable: function () {
6364		this.enabled = true;
6365	},
6366
6367	refresh: function () {
6368		utils.getRect(this.wrapper);		// Force reflow
6369
6370		this.wrapperWidth	= this.wrapper.clientWidth;
6371		this.wrapperHeight	= this.wrapper.clientHeight;
6372
6373		var rect = utils.getRect(this.scroller);
6374/* REPLACE START: refresh */
6375
6376		this.scrollerWidth	= rect.width;
6377		this.scrollerHeight	= rect.height;
6378
6379		this.maxScrollX		= this.wrapperWidth - this.scrollerWidth;
6380		this.maxScrollY		= this.wrapperHeight - this.scrollerHeight;
6381
6382/* REPLACE END: refresh */
6383
6384		this.hasHorizontalScroll	= this.options.scrollX && this.maxScrollX < 0;
6385		this.hasVerticalScroll		= this.options.scrollY && this.maxScrollY < 0;
6386		
6387		if ( !this.hasHorizontalScroll ) {
6388			this.maxScrollX = 0;
6389			this.scrollerWidth = this.wrapperWidth;
6390		}
6391
6392		if ( !this.hasVerticalScroll ) {
6393			this.maxScrollY = 0;
6394			this.scrollerHeight = this.wrapperHeight;
6395		}
6396
6397		this.endTime = 0;
6398		this.directionX = 0;
6399		this.directionY = 0;
6400		
6401		if(utils.hasPointer && !this.options.disablePointer) {
6402			// The wrapper should have `touchAction` property for using pointerEvent.
6403			this.wrapper.style[utils.style.touchAction] = utils.getTouchAction(this.options.eventPassthrough, true);
6404
6405			// case. not support 'pinch-zoom'
6406			// https://github.com/cubiq/iscroll/issues/1118#issuecomment-270057583
6407			if (!this.wrapper.style[utils.style.touchAction]) {
6408				this.wrapper.style[utils.style.touchAction] = utils.getTouchAction(this.options.eventPassthrough, false);
6409			}
6410		}
6411		this.wrapperOffset = utils.offset(this.wrapper);
6412
6413		this._execEvent('refresh');
6414
6415		this.resetPosition();
6416
6417// INSERT POINT: _refresh
6418
6419	},	
6420
6421	on: function (type, fn) {
6422		if ( !this._events[type] ) {
6423			this._events[type] = [];
6424		}
6425
6426		this._events[type].push(fn);
6427	},
6428
6429	off: function (type, fn) {
6430		if ( !this._events[type] ) {
6431			return;
6432		}
6433
6434		var index = this._events[type].indexOf(fn);
6435
6436		if ( index > -1 ) {
6437			this._events[type].splice(index, 1);
6438		}
6439	},
6440
6441	_execEvent: function (type) {
6442		if ( !this._events[type] ) {
6443			return;
6444		}
6445
6446		var i = 0,
6447			l = this._events[type].length;
6448
6449		if ( !l ) {
6450			return;
6451		}
6452
6453		for ( ; i < l; i++ ) {
6454			this._events[type][i].apply(this, [].slice.call(arguments, 1));
6455		}
6456	},
6457
6458	scrollBy: function (x, y, time, easing) {
6459		x = this.x + x;
6460		y = this.y + y;
6461		time = time || 0;
6462
6463		this.scrollTo(x, y, time, easing);
6464	},
6465
6466	scrollTo: function (x, y, time, easing) {
6467		easing = easing || utils.ease.circular;
6468
6469		this.isInTransition = this.options.useTransition && time > 0;
6470		var transitionType = this.options.useTransition && easing.style;
6471		if ( !time || transitionType ) {
6472				if(transitionType) {
6473					this._transitionTimingFunction(easing.style);
6474					this._transitionTime(time);
6475				}
6476			this._translate(x, y);
6477		} else {
6478			this._animate(x, y, time, easing.fn);
6479		}
6480	},
6481
6482	scrollToElement: function (el, time, offsetX, offsetY, easing) {
6483		el = el.nodeType ? el : this.scroller.querySelector(el);
6484
6485		if ( !el ) {
6486			return;
6487		}
6488
6489		var pos = utils.offset(el);
6490
6491		pos.left -= this.wrapperOffset.left;
6492		pos.top  -= this.wrapperOffset.top;
6493
6494		// if offsetX/Y are true we center the element to the screen
6495		var elRect = utils.getRect(el);
6496		var wrapperRect = utils.getRect(this.wrapper);
6497		if ( offsetX === true ) {
6498			offsetX = Math.round(elRect.width / 2 - wrapperRect.width / 2);
6499		}
6500		if ( offsetY === true ) {
6501			offsetY = Math.round(elRect.height / 2 - wrapperRect.height / 2);
6502		}
6503
6504		pos.left -= offsetX || 0;
6505		pos.top  -= offsetY || 0;
6506
6507		pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
6508		pos.top  = pos.top  > 0 ? 0 : pos.top  < this.maxScrollY ? this.maxScrollY : pos.top;
6509
6510		time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time;
6511
6512		this.scrollTo(pos.left, pos.top, time, easing);
6513	},
6514
6515	_transitionTime: function (time) {
6516		if (!this.options.useTransition) {
6517			return;
6518		}
6519		time = time || 0;
6520		var durationProp = utils.style.transitionDuration;
6521		if(!durationProp) {
6522			return;
6523		}
6524
6525		this.scrollerStyle[durationProp] = time + 'ms';
6526
6527		if ( !time && utils.isBadAndroid ) {
6528			this.scrollerStyle[durationProp] = '0.0001ms';
6529			// remove 0.0001ms
6530			var self = this;
6531			rAF(function() {
6532				if(self.scrollerStyle[durationProp] === '0.0001ms') {
6533					self.scrollerStyle[durationProp] = '0s';
6534				}
6535			});
6536		}
6537
6538
6539		if ( this.indicators ) {
6540			for ( var i = this.indicators.length; i--; ) {
6541				this.indicators[i].transitionTime(time);
6542			}
6543		}
6544
6545
6546// INSERT POINT: _transitionTime
6547
6548	},
6549
6550	_transitionTimingFunction: function (easing) {
6551		this.scrollerStyle[utils.style.transitionTimingFunction] = easing;
6552
6553
6554		if ( this.indicators ) {
6555			for ( var i = this.indicators.length; i--; ) {
6556				this.indicators[i].transitionTimingFunction(easing);
6557			}
6558		}
6559
6560
6561// INSERT POINT: _transitionTimingFunction
6562
6563	},
6564
6565	_translate: function (x, y) {
6566		if ( this.options.useTransform ) {
6567
6568/* REPLACE START: _translate */
6569
6570			this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ;
6571
6572/* REPLACE END: _translate */
6573
6574		} else {
6575			x = Math.round(x);
6576			y = Math.round(y);
6577			this.scrollerStyle.left = x + 'px';
6578			this.scrollerStyle.top = y + 'px';
6579		}
6580
6581		this.x = x;
6582		this.y = y;
6583
6584
6585	if ( this.indicators ) {
6586		for ( var i = this.indicators.length; i--; ) {
6587			this.indicators[i].updatePosition();
6588		}
6589	}
6590
6591
6592// INSERT POINT: _translate
6593
6594	},
6595
6596	_initEvents: function (remove) {
6597		var eventType = remove ? utils.removeEvent : utils.addEvent,
6598			target = this.options.bindToWrapper ? this.wrapper : window;
6599
6600		eventType(window, 'orientationchange', this);
6601		eventType(window, 'resize', this);
6602
6603		if ( this.options.click ) {
6604			eventType(this.wrapper, 'click', this, true);
6605		}
6606
6607		if ( !this.options.disableMouse ) {
6608			eventType(this.wrapper, 'mousedown', this);
6609			eventType(target, 'mousemove', this);
6610			eventType(target, 'mousecancel', this);
6611			eventType(target, 'mouseup', this);
6612		}
6613
6614		if ( utils.hasPointer && !this.options.disablePointer ) {
6615			eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this);
6616			eventType(target, utils.prefixPointerEvent('pointermove'), this);
6617			eventType(target, utils.prefixPointerEvent('pointercancel'), this);
6618			eventType(target, utils.prefixPointerEvent('pointerup'), this);
6619		}
6620
6621		if ( utils.hasTouch && !this.options.disableTouch ) {
6622			eventType(this.wrapper, 'touchstart', this);
6623			eventType(target, 'touchmove', this);
6624			eventType(target, 'touchcancel', this);
6625			eventType(target, 'touchend', this);
6626		}
6627
6628		eventType(this.scroller, 'transitionend', this);
6629		eventType(this.scroller, 'webkitTransitionEnd', this);
6630		eventType(this.scroller, 'oTransitionEnd', this);
6631		eventType(this.scroller, 'MSTransitionEnd', this);
6632	},
6633
6634	getComputedPosition: function () {
6635		var matrix = window.getComputedStyle(this.scroller, null),
6636			x, y;
6637
6638		if ( this.options.useTransform ) {
6639			matrix = matrix[utils.style.transform].split(')')[0].split(', ');
6640			x = +(matrix[12] || matrix[4]);
6641			y = +(matrix[13] || matrix[5]);
6642		} else {
6643			x = +matrix.left.replace(/[^-\d.]/g, '');
6644			y = +matrix.top.replace(/[^-\d.]/g, '');
6645		}
6646
6647		return { x: x, y: y };
6648	},
6649	_initIndicators: function () {
6650		var interactive = this.options.interactiveScrollbars,
6651			customStyle = typeof this.options.scrollbars != 'string',
6652			indicators = [],
6653			indicator;
6654
6655		var that = this;
6656
6657		this.indicators = [];
6658
6659		if ( this.options.scrollbars ) {
6660			// Vertical scrollbar
6661			if ( this.options.scrollY ) {
6662				indicator = {
6663					el: createDefaultScrollbar('v', interactive, this.options.scrollbars),
6664					interactive: interactive,
6665					defaultScrollbars: true,
6666					customStyle: customStyle,
6667					resize: this.options.resizeScrollbars,
6668					shrink: this.options.shrinkScrollbars,
6669					fade: this.options.fadeScrollbars,
6670					listenX: false
6671				};
6672
6673				this.wrapper.appendChild(indicator.el);
6674				indicators.push(indicator);
6675			}
6676
6677			// Horizontal scrollbar
6678			if ( this.options.scrollX ) {
6679				indicator = {
6680					el: createDefaultScrollbar('h', interactive, this.options.scrollbars),
6681					interactive: interactive,
6682					defaultScrollbars: true,
6683					customStyle: customStyle,
6684					resize: this.options.resizeScrollbars,
6685					shrink: this.options.shrinkScrollbars,
6686					fade: this.options.fadeScrollbars,
6687					listenY: false
6688				};
6689
6690				this.wrapper.appendChild(indicator.el);
6691				indicators.push(indicator);
6692			}
6693		}
6694
6695		if ( this.options.indicators ) {
6696			// TODO: check concat compatibility
6697			indicators = indicators.concat(this.options.indicators);
6698		}
6699
6700		for ( var i = indicators.length; i--; ) {
6701			this.indicators.push( new Indicator(this, indicators[i]) );
6702		}
6703
6704		// TODO: check if we can use array.map (wide compatibility and performance issues)
6705		function _indicatorsMap (fn) {
6706			if (that.indicators) {
6707				for ( var i = that.indicators.length; i--; ) {
6708					fn.call(that.indicators[i]);
6709				}
6710			}
6711		}
6712
6713		if ( this.options.fadeScrollbars ) {
6714			this.on('scrollEnd', function () {
6715				_indicatorsMap(function () {
6716					this.fade();
6717				});
6718			});
6719
6720			this.on('scrollCancel', function () {
6721				_indicatorsMap(function () {
6722					this.fade();
6723				});
6724			});
6725
6726			this.on('scrollStart', function () {
6727				_indicatorsMap(function () {
6728					this.fade(1);
6729				});
6730			});
6731
6732			this.on('beforeScrollStart', function () {
6733				_indicatorsMap(function () {
6734					this.fade(1, true);
6735				});
6736			});
6737		}
6738
6739
6740		this.on('refresh', function () {
6741			_indicatorsMap(function () {
6742				this.refresh();
6743			});
6744		});
6745
6746		this.on('destroy', function () {
6747			_indicatorsMap(function () {
6748				this.destroy();
6749			});
6750
6751			delete this.indicators;
6752		});
6753	},
6754
6755	_initWheel: function () {
6756		utils.addEvent(this.wrapper, 'wheel', this);
6757		utils.addEvent(this.wrapper, 'mousewheel', this);
6758		utils.addEvent(this.wrapper, 'DOMMouseScroll', this);
6759
6760		this.on('destroy', function () {
6761			clearTimeout(this.wheelTimeout);
6762			this.wheelTimeout = null;
6763			utils.removeEvent(this.wrapper, 'wheel', this);
6764			utils.removeEvent(this.wrapper, 'mousewheel', this);
6765			utils.removeEvent(this.wrapper, 'DOMMouseScroll', this);
6766		});
6767	},
6768
6769	_wheel: function (e) {
6770		if ( !this.enabled ) {
6771			return;
6772		}
6773
6774		e.preventDefault();
6775
6776		var wheelDeltaX, wheelDeltaY,
6777			newX, newY,
6778			that = this;
6779
6780		if ( this.wheelTimeout === undefined ) {
6781			that._execEvent('scrollStart');
6782		}
6783
6784		// Execute the scrollEnd event after 400ms the wheel stopped scrolling
6785		clearTimeout(this.wheelTimeout);
6786		this.wheelTimeout = setTimeout(function () {
6787			if(!that.options.snap) {
6788				that._execEvent('scrollEnd');
6789			}
6790			that.wheelTimeout = undefined;
6791		}, 400);
6792
6793		if ( 'deltaX' in e ) {
6794			if (e.deltaMode === 1) {
6795				wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed;
6796				wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed;
6797			} else {
6798				wheelDeltaX = -e.deltaX;
6799				wheelDeltaY = -e.deltaY;
6800			}
6801		} else if ( 'wheelDeltaX' in e ) {
6802			wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed;
6803			wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed;
6804		} else if ( 'wheelDelta' in e ) {
6805			wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed;
6806		} else if ( 'detail' in e ) {
6807			wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed;
6808		} else {
6809			return;
6810		}
6811
6812		wheelDeltaX *= this.options.invertWheelDirection;
6813		wheelDeltaY *= this.options.invertWheelDirection;
6814
6815		if ( !this.hasVerticalScroll ) {
6816			wheelDeltaX = wheelDeltaY;
6817			wheelDeltaY = 0;
6818		}
6819
6820		if ( this.options.snap ) {
6821			newX = this.currentPage.pageX;
6822			newY = this.currentPage.pageY;
6823
6824			if ( wheelDeltaX > 0 ) {
6825				newX--;
6826			} else if ( wheelDeltaX < 0 ) {
6827				newX++;
6828			}
6829
6830			if ( wheelDeltaY > 0 ) {
6831				newY--;
6832			} else if ( wheelDeltaY < 0 ) {
6833				newY++;
6834			}
6835
6836			this.goToPage(newX, newY);
6837
6838			return;
6839		}
6840
6841		newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0);
6842		newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0);
6843
6844		this.directionX = wheelDeltaX > 0 ? -1 : wheelDeltaX < 0 ? 1 : 0;
6845		this.directionY = wheelDeltaY > 0 ? -1 : wheelDeltaY < 0 ? 1 : 0;
6846
6847		if ( newX > 0 ) {
6848			newX = 0;
6849		} else if ( newX < this.maxScrollX ) {
6850			newX = this.maxScrollX;
6851		}
6852
6853		if ( newY > 0 ) {
6854			newY = 0;
6855		} else if ( newY < this.maxScrollY ) {
6856			newY = this.maxScrollY;
6857		}
6858
6859		this.scrollTo(newX, newY, 0);
6860
6861// INSERT POINT: _wheel
6862	},
6863
6864	_initSnap: function () {
6865		this.currentPage = {};
6866
6867		if ( typeof this.options.snap == 'string' ) {
6868			this.options.snap = this.scroller.querySelectorAll(this.options.snap);
6869		}
6870
6871		this.on('refresh', function () {
6872			var i = 0, l,
6873				m = 0, n,
6874				cx, cy,
6875				x = 0, y,
6876				stepX = this.options.snapStepX || this.wrapperWidth,
6877				stepY = this.options.snapStepY || this.wrapperHeight,
6878				el,
6879				rect;
6880
6881			this.pages = [];
6882
6883			if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) {
6884				return;
6885			}
6886
6887			if ( this.options.snap === true ) {
6888				cx = Math.round( stepX / 2 );
6889				cy = Math.round( stepY / 2 );
6890
6891				while ( x > -this.scrollerWidth ) {
6892					this.pages[i] = [];
6893					l = 0;
6894					y = 0;
6895
6896					while ( y > -this.scrollerHeight ) {
6897						this.pages[i][l] = {
6898							x: Math.max(x, this.maxScrollX),
6899							y: Math.max(y, this.maxScrollY),
6900							width: stepX,
6901							height: stepY,
6902							cx: x - cx,
6903							cy: y - cy
6904						};
6905
6906						y -= stepY;
6907						l++;
6908					}
6909
6910					x -= stepX;
6911					i++;
6912				}
6913			} else {
6914				el = this.options.snap;
6915				l = el.length;
6916				n = -1;
6917
6918				for ( ; i < l; i++ ) {
6919					rect = utils.getRect(el[i]);
6920					if ( i === 0 || rect.left <= utils.getRect(el[i-1]).left ) {
6921						m = 0;
6922						n++;
6923					}
6924
6925					if ( !this.pages[m] ) {
6926						this.pages[m] = [];
6927					}
6928
6929					x = Math.max(-rect.left, this.maxScrollX);
6930					y = Math.max(-rect.top, this.maxScrollY);
6931					cx = x - Math.round(rect.width / 2);
6932					cy = y - Math.round(rect.height / 2);
6933
6934					this.pages[m][n] = {
6935						x: x,
6936						y: y,
6937						width: rect.width,
6938						height: rect.height,
6939						cx: cx,
6940						cy: cy
6941					};
6942
6943					if ( x > this.maxScrollX ) {
6944						m++;
6945					}
6946				}
6947			}
6948
6949			this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0);
6950
6951			// Update snap threshold if needed
6952			if ( this.options.snapThreshold % 1 === 0 ) {
6953				this.snapThresholdX = this.options.snapThreshold;
6954				this.snapThresholdY = this.options.snapThreshold;
6955			} else {
6956				this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold);
6957				this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold);
6958			}
6959		});
6960
6961		this.on('flick', function () {
6962			var time = this.options.snapSpeed || Math.max(
6963					Math.max(
6964						Math.min(Math.abs(this.x - this.startX), 1000),
6965						Math.min(Math.abs(this.y - this.startY), 1000)
6966					), 300);
6967
6968			this.goToPage(
6969				this.currentPage.pageX + this.directionX,
6970				this.currentPage.pageY + this.directionY,
6971				time
6972			);
6973		});
6974	},
6975
6976	_nearestSnap: function (x, y) {
6977		if ( !this.pages.length ) {
6978			return { x: 0, y: 0, pageX: 0, pageY: 0 };
6979		}
6980
6981		var i = 0,
6982			l = this.pages.length,
6983			m = 0;
6984
6985		// Check if we exceeded the snap threshold
6986		if ( Math.abs(x - this.absStartX) < this.snapThresholdX &&
6987			Math.abs(y - this.absStartY) < this.snapThresholdY ) {
6988			return this.currentPage;
6989		}
6990
6991		if ( x > 0 ) {
6992			x = 0;
6993		} else if ( x < this.maxScrollX ) {
6994			x = this.maxScrollX;
6995		}
6996
6997		if ( y > 0 ) {
6998			y = 0;
6999		} else if ( y < this.maxScrollY ) {
7000			y = this.maxScrollY;
7001		}
7002
7003		for ( ; i < l; i++ ) {
7004			if ( x >= this.pages[i][0].cx ) {
7005				x = this.pages[i][0].x;
7006				break;
7007			}
7008		}
7009
7010		l = this.pages[i].length;
7011
7012		for ( ; m < l; m++ ) {
7013			if ( y >= this.pages[0][m].cy ) {
7014				y = this.pages[0][m].y;
7015				break;
7016			}
7017		}
7018
7019		if ( i == this.currentPage.pageX ) {
7020			i += this.directionX;
7021
7022			if ( i < 0 ) {
7023				i = 0;
7024			} else if ( i >= this.pages.length ) {
7025				i = this.pages.length - 1;
7026			}
7027
7028			x = this.pages[i][0].x;
7029		}
7030
7031		if ( m == this.currentPage.pageY ) {
7032			m += this.directionY;
7033
7034			if ( m < 0 ) {
7035				m = 0;
7036			} else if ( m >= this.pages[0].length ) {
7037				m = this.pages[0].length - 1;
7038			}
7039
7040			y = this.pages[0][m].y;
7041		}
7042
7043		return {
7044			x: x,
7045			y: y,
7046			pageX: i,
7047			pageY: m
7048		};
7049	},
7050
7051	goToPage: function (x, y, time, easing) {
7052		easing = easing || this.options.bounceEasing;
7053
7054		if ( x >= this.pages.length ) {
7055			x = this.pages.length - 1;
7056		} else if ( x < 0 ) {
7057			x = 0;
7058		}
7059
7060		if ( y >= this.pages[x].length ) {
7061			y = this.pages[x].length - 1;
7062		} else if ( y < 0 ) {
7063			y = 0;
7064		}
7065
7066		var posX = this.pages[x][y].x,
7067			posY = this.pages[x][y].y;
7068
7069		time = time === undefined ? this.options.snapSpeed || Math.max(
7070			Math.max(
7071				Math.min(Math.abs(posX - this.x), 1000),
7072				Math.min(Math.abs(posY - this.y), 1000)
7073			), 300) : time;
7074
7075		this.currentPage = {
7076			x: posX,
7077			y: posY,
7078			pageX: x,
7079			pageY: y
7080		};
7081
7082		this.scrollTo(posX, posY, time, easing);
7083	},
7084
7085	next: function (time, easing) {
7086		var x = this.currentPage.pageX,
7087			y = this.currentPage.pageY;
7088
7089		x++;
7090
7091		if ( x >= this.pages.length && this.hasVerticalScroll ) {
7092			x = 0;
7093			y++;
7094		}
7095
7096		this.goToPage(x, y, time, easing);
7097	},
7098
7099	prev: function (time, easing) {
7100		var x = this.currentPage.pageX,
7101			y = this.currentPage.pageY;
7102
7103		x--;
7104
7105		if ( x < 0 && this.hasVerticalScroll ) {
7106			x = 0;
7107			y--;
7108		}
7109
7110		this.goToPage(x, y, time, easing);
7111	},
7112
7113	_initKeys: function (e) {
7114		// default key bindings
7115		var keys = {
7116			pageUp: 33,
7117			pageDown: 34,
7118			end: 35,
7119			home: 36,
7120			left: 37,
7121			up: 38,
7122			right: 39,
7123			down: 40
7124		};
7125		var i;
7126
7127		// if you give me characters I give you keycode
7128		if ( typeof this.options.keyBindings == 'object' ) {
7129			for ( i in this.options.keyBindings ) {
7130				if ( typeof this.options.keyBindings[i] == 'string' ) {
7131					this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCo
7131deAt(0);
7132				}
7133			}
7134		} else {
7135			this.options.keyBindings = {};
7136		}
7137
7138		for ( i in keys ) {
7139			this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i];
7140		}
7141
7142		utils.addEvent(window, 'keydown', this);
7143
7144		this.on('destroy', function () {
7145			utils.removeEvent(window, 'keydown', this);
7146		});
7147	},
7148
7149	_key: function (e) {
7150		if ( !this.enabled ) {
7151			return;
7152		}
7153
7154		var snap = this.options.snap,	// we are using this alot, better to cache it
7155			newX = snap ? this.currentPage.pageX : this.x,
7156			newY = snap ? this.currentPage.pageY : this.y,
7157			now = utils.getTime(),
7158			prevTime = this.keyTime || 0,
7159			acceleration = 0.250,
7160			pos;
7161
7162		if ( this.options.useTransition && this.isInTransition ) {
7163			pos = this.getComputedPosition();
7164
7165			this._translate(Math.round(pos.x), Math.round(pos.y));
7166			this.isInTransition = false;
7167		}
7168
7169		this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0;
7170
7171		switch ( e.keyCode ) {
7172			case this.options.keyBindings.pageUp:
7173				if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
7174					newX += snap ? 1 : this.wrapperWidth;
7175				} else {
7176					newY += snap ? 1 : this.wrapperHeight;
7177				}
7178				break;
7179			case this.options.keyBindings.pageDown:
7180				if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
7181					newX -= snap ? 1 : this.wrapperWidth;
7182				} else {
7183					newY -= snap ? 1 : this.wrapperHeight;
7184				}
7185				break;
7186			case this.options.keyBindings.end:
7187				newX = snap ? this.pages.length-1 : this.maxScrollX;
7188				newY = snap ? this.pages[0].length-1 : this.maxScrollY;
7189				break;
7190			case this.options.keyBindings.home:
7191				newX = 0;
7192				newY = 0;
7193				break;
7194			case this.options.keyBindings.left:
7195				newX += snap ? -1 : 5 + this.keyAcceleration>>0;
7196				break;
7197			case this.options.keyBindings.up:
7198				newY += snap ? 1 : 5 + this.keyAcceleration>>0;
7199				break;
7200			case this.options.keyBindings.right:
7201				newX -= snap ? -1 : 5 + this.keyAcceleration>>0;
7202				break;
7203			case this.options.keyBindings.down:
7204				newY -= snap ? 1 : 5 + this.keyAcceleration>>0;
7205				break;
7206			default:
7207				return;
7208		}
7209
7210		if ( snap ) {
7211			this.goToPage(newX, newY);
7212			return;
7213		}
7214
7215		if ( newX > 0 ) {
7216			newX = 0;
7217			this.keyAcceleration = 0;
7218		} else if ( newX < this.maxScrollX ) {
7219			newX = this.maxScrollX;
7220			this.keyAcceleration = 0;
7221		}
7222
7223		if ( newY > 0 ) {
7224			newY = 0;
7225			this.keyAcceleration = 0;
7226		} else if ( newY < this.maxScrollY ) {
7227			newY = this.maxScrollY;
7228			this.keyAcceleration = 0;
7229		}
7230
7231		this.scrollTo(newX, newY, 0);
7232
7233		this.keyTime = now;
7234	},
7235
7236	_animate: function (destX, destY, duration, easingFn) {
7237		var that = this,
7238			startX = this.x,
7239			startY = this.y,
7240			startTime = utils.getTime(),
7241			destTime = startTime + duration;
7242
7243		function step () {
7244			var now = utils.getTime(),
7245				newX, newY,
7246				easing;
7247
7248			if ( now >= destTime ) {
7249				that.isAnimating = false;
7250				that._translate(destX, destY);
7251
7252				if ( !that.resetPosition(that.options.bounceTime) ) {
7253					that._execEvent('scrollEnd');
7254				}
7255
7256				return;
7257			}
7258
7259			now = ( now - startTime ) / duration;
7260			easing = easingFn(now);
7261			newX = ( destX - startX ) * easing + startX;
7262			newY = ( destY - startY ) * easing + startY;
7263			that._translate(newX, newY);
7264
7265			if ( that.isAnimating ) {
7266				rAF(step);
7267			}
7268		}
7269
7270		this.isAnimating = true;
7271		step();
7272	},
7273	handleEvent: function (e) {
7274		switch ( e.type ) {
7275			case 'touchstart':
7276			case 'pointerdown':
7277			case 'MSPointerDown':
7278			case 'mousedown':
7279				this._start(e);
7280				break;
7281			case 'touchmove':
7282			case 'pointermove':
7283			case 'MSPointerMove':
7284			case 'mousemove':
7285				this._move(e);
7286				break;
7287			case 'touchend':
7288			case 'pointerup':
7289			case 'MSPointerUp':
7290			case 'mouseup':
7291			case 'touchcancel':
7292			case 'pointercancel':
7293			case 'MSPointerCancel':
7294			case 'mousecancel':
7295				this._end(e);
7296				break;
7297			case 'orientationchange':
7298			case 'resize':
7299				this._resize();
7300				break;
7301			case 'transitionend':
7302			case 'webkitTransitionEnd':
7303			case 'oTransitionEnd':
7304			case 'MSTransitionEnd':
7305				this._transitionEnd(e);
7306				break;
7307			case 'wheel':
7308			case 'DOMMouseScroll':
7309			case 'mousewheel':
7310				this._wheel(e);
7311				break;
7312			case 'keydown':
7313				this._key(e);
7314				break;
7315			case 'click':
7316				if ( this.enabled && !e._constructed ) {
7317					e.preventDefault();
7318					e.stopPropagation();
7319				}
7320				break;
7321		}
7322	}
7323};
7324function createDefaultScrollbar (direction, interactive, type) {
7325	var scrollbar = document.createElement('div'),
7326		indicator = document.createElement('div');
7327
7328	if ( type === true ) {
7329		scrollbar.style.cssText = 'position:absolute;z-index:9999';
7330		indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px';
7331	}
7332
7333	indicator.className = 'iScrollIndicator';
7334
7335	if ( direction == 'h' ) {
7336		if ( type === true ) {
7337			scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0';
7338			indicator.style.height = '100%';
7339		}
7340		scrollbar.className = 'iScrollHorizontalScrollbar';
7341	} else {
7342		if ( type === true ) {
7343			scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px';
7344			indicator.style.width = '100%';
7345		}
7346		scrollbar.className = 'iScrollVerticalScrollbar';
7347	}
7348
7349	scrollbar.style.cssText += ';overflow:hidden';
7350
7351	if ( !interactive ) {
7352		scrollbar.style.pointerEvents = 'none';
7353	}
7354
7355	scrollbar.appendChild(indicator);
7356
7357	return scrollbar;
7358}
7359
7360function Indicator (scroller, options) {
7361	this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el;
7362	this.wrapperStyle = this.wrapper.style;
7363	this.indicator = this.wrapper.children[0];
7364	this.indicatorStyle = this.indicator.style;
7365	this.scroller = scroller;
7366
7367	this.options = {
7368		listenX: true,
7369		listenY: true,
7370		interactive: false,
7371		resize: true,
7372		defaultScrollbars: false,
7373		shrink: false,
7374		fade: false,
7375		speedRatioX: 0,
7376		speedRatioY: 0
7377	};
7378
7379	for ( var i in options ) {
7380		this.options[i] = options[i];
7381	}
7382
7383	this.sizeRatioX = 1;
7384	this.sizeRatioY = 1;
7385	this.maxPosX = 0;
7386	this.maxPosY = 0;
7387
7388	if ( this.options.interactive ) {
7389		if ( !this.options.disableTouch ) {
7390			utils.addEvent(this.indicator, 'touchstart', this);
7391			utils.addEvent(window, 'touchend', this);
7392		}
7393		if ( !this.options.disablePointer ) {
7394			utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
7395			utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this);
7396		}
7397		if ( !this.options.disableMouse ) {
7398			utils.addEvent(this.indicator, 'mousedown', this);
7399			utils.addEvent(window, 'mouseup', this);
7400		}
7401	}
7402
7403	if ( this.options.fade ) {
7404		this.wrapperStyle[utils.style.transform] = this.scroller.translateZ;
7405		var durationProp = utils.style.transitionDuration;
7406		if(!durationProp) {
7407			return;
7408		}
7409		this.wrapperStyle[durationProp] = utils.isBadAndroid ? '0.0001ms' : '0ms';
7410		// remove 0.0001ms
7411		var self = this;
7412		if(utils.isBadAndroid) {
7413			rAF(function() {
7414				if(self.wrapperStyle[durationProp] === '0.0001ms') {
7415					self.wrapperStyle[durationProp] = '0s';
7416				}
7417			});
7418		}
7419		this.wrapperStyle.opacity = '0';
7420	}
7421}
7422
7423Indicator.prototype = {
7424	handleEvent: function (e) {
7425		switch ( e.type ) {
7426			case 'touchstart':
7427			case 'pointerdown':
7428			case 'MSPointerDown':
7429			case 'mousedown':
7430				this._start(e);
7431				break;
7432			case 'touchmove':
7433			case 'pointermove':
7434			case 'MSPointerMove':
7435			case 'mousemove':
7436				this._move(e);
7437				break;
7438			case 'touchend':
7439			case 'pointerup':
7440			case 'MSPointerUp':
7441			case 'mouseup':
7442			case 'touchcancel':
7443			case 'pointercancel':
7444			case 'MSPointerCancel':
7445			case 'mousecancel':
7446				this._end(e);
7447				break;
7448		}
7449	},
7450
7451	destroy: function () {
7452		if ( this.options.fadeScrollbars ) {
7453			clearTimeout(this.fadeTimeout);
7454			this.fadeTimeout = null;
7455		}
7456		if ( this.options.interactive ) {
7457			utils.removeEvent(this.indicator, 'touchstart', this);
7458			utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
7459			utils.removeEvent(this.indicator, 'mousedown', this);
7460
7461			utils.removeEvent(window, 'touchmove', this);
7462			utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
7463			utils.removeEvent(window, 'mousemove', this);
7464
7465			utils.removeEvent(window, 'touchend', this);
7466			utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this);
7467			utils.removeEvent(window, 'mouseup', this);
7468		}
7469
7470		if ( this.options.defaultScrollbars && this.wrapper.parentNode ) {
7471			this.wrapper.parentNode.removeChild(this.wrapper);
7472		}
7473	},
7474
7475	_start: function (e) {
7476		var point = e.touches ? e.touches[0] : e;
7477
7478		e.preventDefault();
7479		e.stopPropagation();
7480
7481		this.transitionTime();
7482
7483		this.initiated = true;
7484		this.moved = false;
7485		this.lastPointX	= point.pageX;
7486		this.lastPointY	= point.pageY;
7487
7488		this.startTime	= utils.getTime();
7489
7490		if ( !this.options.disableTouch ) {
7491			utils.addEvent(window, 'touchmove', this);
7492		}
7493		if ( !this.options.disablePointer ) {
7494			utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this);
7495		}
7496		if ( !this.options.disableMouse ) {
7497			utils.addEvent(window, 'mousemove', this);
7498		}
7499
7500		this.scroller._execEvent('beforeScrollStart');
7501	},
7502
7503	_move: function (e) {
7504		var point = e.touches ? e.touches[0] : e,
7505			deltaX, deltaY,
7506			newX, newY,
7507			timestamp = utils.getTime();
7508
7509		if ( !this.moved ) {
7510			this.scroller._execEvent('scrollStart');
7511		}
7512
7513		this.moved = true;
7514
7515		deltaX = point.pageX - this.lastPointX;
7516		this.lastPointX = point.pageX;
7517
7518		deltaY = point.pageY - this.lastPointY;
7519		this.lastPointY = point.pageY;
7520
7521		newX = this.x + deltaX;
7522		newY = this.y + deltaY;
7523
7524		this._pos(newX, newY);
7525
7526// INSERT POINT: indicator._move
7527
7528		e.preventDefault();
7529		e.stopPropagation();
7530	},
7531
7532	_end: function (e) {
7533		if ( !this.initiated ) {
7534			return;
7535		}
7536
7537		this.initiated = false;
7538
7539		e.preventDefault();
7540		e.stopPropagation();
7541
7542		utils.removeEvent(window, 'touchmove', this);
7543		utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
7544		utils.removeEvent(window, 'mousemove', this);
7545
7546		if ( this.scroller.options.snap ) {
7547			var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y);
7548
7549			var time = this.options.snapSpeed || Math.max(
7550					Math.max(
7551						Math.min(Math.abs(this.scroller.x - snap.x), 1000),
7552						Math.min(Math.abs(this.scroller.y - snap.y), 1000)
7553					), 300);
7554
7555			if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) {
7556				this.scroller.directionX = 0;
7557				this.scroller.directionY = 0;
7558				this.scroller.currentPage = snap;
7559				this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing);
7560			}
7561		}
7562
7563		if ( this.moved ) {
7564			this.scroller._execEvent('scrollEnd');
7565		}
7566	},
7567
7568	transitionTime: function (time) {
7569		time = time || 0;
7570		var durationProp = utils.style.transitionDuration;
7571		if(!durationProp) {
7572			return;
7573		}
7574
7575		this.indicatorStyle[durationProp] = time + 'ms';
7576
7577		if ( !time && utils.isBadAndroid ) {
7578			this.indicatorStyle[durationProp] = '0.0001ms';
7579			// remove 0.0001ms
7580			var self = this;
7581			rAF(function() {
7582				if(self.indicatorStyle[durationProp] === '0.0001ms') {
7583					self.indicatorStyle[durationProp] = '0s';
7584				}
7585			});
7586		}
7587	},
7588
7589	transitionTimingFunction: function (easing) {
7590		this.indicatorStyle[utils.style.transitionTimingFunction] = easing;
7591	},
7592
7593	refresh: function () {
7594		this.transitionTime();
7595
7596		if ( this.options.listenX && !this.options.listenY ) {
7597            this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none';
7598		} else if ( this.options.listenY && !this.options.listenX ) {
7599			this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none';
7600		} else {
7601			this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none';
7602		}
7603
7604        this.wrapperStyle.display = this.indicatorStyle.display;
7605
7606		if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) {
7607			utils.addClass(this.wrapper, 'iScrollBothScrollbars');
7608			utils.removeClass(this.wrapper, 'iScrollLoneScrollbar');
7609
7610			if ( this.options.defaultScrollbars && this.options.customStyle ) {
7611				if ( this.options.listenX ) {
7612					this.wrapper.style.right = '8px';
7613				} else {
7614					this.wrapper.style.bottom = '8px';
7615				}
7616			}
7617		} else {
7618			utils.removeClass(this.wrapper, 'iScrollBothScrollbars');
7619			utils.addClass(this.wrapper, 'iScrollLoneScrollbar');
7620
7621			if ( this.options.defaultScrollbars && this.options.customStyle ) {
7622				if ( this.options.listenX ) {
7623					this.wrapper.style.right = '2px';
7624				} else {
7625					this.wrapper.style.bottom = '2px';
7626				}
7627			}
7628		}
7629
7630		utils.getRect(this.wrapper);	// force refresh
7631
7632		if ( this.options.listenX ) {
7633			this.wrapperWidth = this.wrapper.clientWidth;
7634			if ( this.options.resize ) {
7635				this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperW
7635idth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8);
7636				this.indicatorStyle.width = this.indicatorWidth + 'px';
7637			} else {
7638				this.indicatorWidth = this.indicator.clientWidth;
7639			}
7640
7641			this.maxPosX = this.wrapperWidth - this.indicatorWidth;
7642
7643			if ( this.options.shrink == 'clip' ) {
7644				this.minBoundaryX = -this.indicatorWidth + 8;
7645				this.maxBoundaryX = this.wrapperWidth - 8;
7646			} else {
7647				this.minBoundaryX = 0;
7648				this.maxBoundaryX = this.maxPosX;
7649			}
7650
7651			this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX)) || 1;
7652		}
7653
7654		if ( this.options.listenY ) {
7655			this.wrapperHeight = this.wrapper.clientHeight;
7656			if ( this.options.resize ) {
7657				this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8);
7658				this.indicatorStyle.height = this.indicatorHeight + 'px';
7659			} else {
7660				this.indicatorHeight = this.indicator.clientHeight;
7661			}
7662
7663			this.maxPosY = this.wrapperHeight - this.indicatorHeight;
7664
7665			if ( this.options.shrink == 'clip' ) {
7666				this.minBoundaryY = -this.indicatorHeight + 8;
7667				this.maxBoundaryY = this.wrapperHeight - 8;
7668			} else {
7669				this.minBoundaryY = 0;
7670				this.maxBoundaryY = this.maxPosY;
7671			}
7672
7673			this.maxPosY = this.wrapperHeight - this.indicatorHeight;
7674			this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY)) || 1;
7675		}
7676
7677		this.updatePosition();
7678	},
7679
7680	updatePosition: function () {
7681		var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0,
7682			y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0;
7683
7684		if ( !this.options.ignoreBoundaries ) {
7685			if ( x < this.minBoundaryX ) {
7686				if ( this.options.shrink == 'scale' ) {
7687					this.width = Math.max(this.indicatorWidth + x, 8);
7688					this.indicatorStyle.width = this.width + 'px';
7689				}
7690				x = this.minBoundaryX;
7691			} else if ( x > this.maxBoundaryX ) {
7692				if ( this.options.shrink == 'scale' ) {
7693					this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8);
7694					this.indicatorStyle.width = this.width + 'px';
7695					x = this.maxPosX + this.indicatorWidth - this.width;
7696				} else {
7697					x = this.maxBoundaryX;
7698				}
7699			} else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) {
7700				this.width = this.indicatorWidth;
7701				this.indicatorStyle.width = this.width + 'px';
7702			}
7703
7704			if ( y < this.minBoundaryY ) {
7705				if ( this.options.shrink == 'scale' ) {
7706					this.height = Math.max(this.indicatorHeight + y * 3, 8);
7707					this.indicatorStyle.height = this.height + 'px';
7708				}
7709				y = this.minBoundaryY;
7710			} else if ( y > this.maxBoundaryY ) {
7711				if ( this.options.shrink == 'scale' ) {
7712					this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8);
7713					this.indicatorStyle.height = this.height + 'px';
7714					y = this.maxPosY + this.indicatorHeight - this.height;
7715				} else {
7716					y = this.maxBoundaryY;
7717				}
7718			} else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) {
7719				this.height = this.indicatorHeight;
7720				this.indicatorStyle.height = this.height + 'px';
7721			}
7722		}
7723
7724		this.x = x;
7725		this.y = y;
7726
7727		if ( this.scroller.options.useTransform ) {
7728			this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ;
7729		} else {
7730			this.indicatorStyle.left = x + 'px';
7731			this.indicatorStyle.top = y + 'px';
7732		}
7733	},
7734
7735	_pos: function (x, y) {
7736		if ( x < 0 ) {
7737			x = 0;
7738		} else if ( x > this.maxPosX ) {
7739			x = this.maxPosX;
7740		}
7741
7742		if ( y < 0 ) {
7743			y = 0;
7744		} else if ( y > this.maxPosY ) {
7745			y = this.maxPosY;
7746		}
7747
7748		x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x;
7749		y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y;
7750
7751		this.scroller.scrollTo(x, y);
7752	},
7753
7754	fade: function (val, hold) {
7755		if ( hold && !this.visible ) {
7756			return;
7757		}
7758
7759		clearTimeout(this.fadeTimeout);
7760		this.fadeTimeout = null;
7761
7762		var time = val ? 250 : 500,
7763			delay = val ? 0 : 300;
7764
7765		val = val ? '1' : '0';
7766
7767		this.wrapperStyle[utils.style.transitionDuration] = time + 'ms';
7768
7769		this.fadeTimeout = setTimeout((function (val) {
7770			this.wrapperStyle.opacity = val;
7771			this.visible = +val;
7772		}).bind(this, val), delay);
7773	}
7774};
7775
7776IScroll.utils = utils;
7777
7778if ( typeof module != 'undefined' && module.exports ) {
7779	module.exports = IScroll;
7780} else if ( typeof define == 'function' && define.amd ) {
7781        define( function () { return IScroll; } );
7782} else {
7783	window.IScroll = IScroll;
7784}
7785
7786})(window, document, Math);
7787;
7788/**
7789 * jquery.Jcrop.min.js v0.9.12 (build:20130202)
7790 * jQuery Image Cropping Plugin - released under MIT License
7791 * Copyright (c) 2008-2013 Tapmodo Interactive LLC
7792 * https://github.com/tapmodo/Jcrop
7793 */
7794(function(a){a.Jcrop=function(b,c){function i(a){return Math.round(a)+"px"}function j(a){return d.baseClass+"-"+a}function k(){return a.fx.step.hasOwnProperty("backgroundColor")}function l(b){var c=a(b).offset();return[c.left,c.top]}function m(a){return[a.pageX-e[0],a.pageY-e[1]]}function n(b){typeof b!="object"&&(b={}),d=a.extend(d,b),a.each(["onChange","onSelect","onRelease","onDblClick"],function(a,b){typeof d[b]!="function"&&(d[b]=function(){})})}function o(a,b,c){e=l(D),bc.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bc.activateHandlers(q(b),v,c);var d=_.getFixed(),f=r(a),g=_.getCorner(r(f));_.setPressed(_.getCorner(f)),_.setCurrent(g),bc.activateHandlers(p(a,d),v,c)}function p(a,b){return function(c){if(!d.aspectRatio)switch(a){case"e":c[1]=b.y2;break;case"w":c[1]=b.y2;break;case"n":c[0]=b.x2;break;case"s":c[0]=b.x2}else switch(a){case"e":c[1]=b.y+1;break;case"w":c[1]=b.y+1;break;case"n":c[0]=b.x+1;break;case"s":c[0]=b.x+1}_.setCurrent(c),bb.update()}}function q(a){var b=a;return bd.watchKeys
7795(),function(a){_.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bb.update()}}function r(a){switch(a){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function s(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(b)),b.stopPropagation(),b.preventDefault(),!1)}}function t(a,b,c){var d=a.width(),e=a.height();d>b&&b>0&&(d=b,e=b/a.width()*a.height()),e>c&&c>0&&(e=c,d=c/a.height()*a.width()),T=a.width()/d,U=a.height()/e,a.width(d).height(e)}function u(a){return{x:a.x*T,y:a.y*U,x2:a.x2*T,y2:a.y2*U,w:a.w*T,h:a.h*U}}function v(a){var b=_.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bb.enableHandles(),bb.done()):bb.release(),bc.setCursor(d.allowSelect?"crosshair":"default")}function w(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;W=!0,e=l(D),bb.disableHandles(),bc.setCursor("crosshair");var b=m(a);
7795return _.setPressed(b),bb.update(),bc.activateHandlers(x,v,a.type.substring
7796(0,5)==="touch"),bd.watchKeys(),a.stopPropagation(),a.preventDefault(),!1}function x(a){_.setCurrent(a),bb.update()}function y(){var b=a("<div></div>").addClass(j("tracker"));return g&&b.css({opacity:0,backgroundColor:"white"}),b}function be(a){G.removeClass().addClass(j("holder")).addClass(a)}function bf(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/T,e=a[1]/U,f=a[2]/T,g=a[3]/U;if(X)return;var h=_.flipCoords(c,e,f,g),i=_.getFixed(),j=[i.x,i.y,i.x2,i.y2],k=j,l=d.animationDelay,m=h[0]-j[0],n=h[1]-j[1],o=h[2]-j[2],p=h[3]-j[3],q=0,r=d.swingSpeed;c=k[0],e=k[1],f=k[2],g=k[3],bb.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=Math.round(c+q/100*m),k[1]=Math.round(e+q/100*n),k[2]=Math.round(f+q/100*o),k[3]=Math.round(g+q/100*p),q>=99.8&&(q=100),q<100?(bh(k),t()):(bb.done(),bb.animMode(!1),typeof b=="function"&&b.call(bs))}}();t()}function bg(a){bh([a[0]/T,a[1]/U,a[2]/T,a[3]/U]),d.onSelect.call(bs,u(_.getFixed())),bb.enableHandles()}function bh(a){_.setPressed([a[0],a[1]]),_.setCurrent([a[2],
7797a[3]]),bb.update()}function bi(){return u(_.getFixed())}function bj(){return _.getFixed()}function bk(a){n(a),br()}function bl(){d.disabled=!0,bb.disableHandles(),bb.setCursor("default"),bc.setCursor("default")}function bm(){d.disabled=!1,br()}function bn(){bb.done(),bc.activateHandlers(null,null)}function bo(){G.remove(),A.show(),A.css("visibility","visible"),a(b).removeData("Jcrop")}function bp(a,b){bb.release(),bl();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;D.width(e).height(f),D.attr("src",a),H.attr("src",a),t(D,g,h),E=D.width(),F=D.height(),H.width(E).height(F),M.width(E+L*2).height(F+L*2),G.width(E).height(F),ba.resize(E,F),bm(),typeof b=="function"&&b.call(bs)},c.src=a}function bq(a,b,c){var e=b||d.bgColor;d.bgFade&&k()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function br(a){d.allowResize?a?bb.enableOnly():bb.enableHandles():bb.disableHandles(),bc.setCursor(d.allowSelect?"crosshair":"default"),bb
7798.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(T=d.trueSize[0]/E,U=d.trueSize[1]/F),d.hasOwnProperty("setSelect")&&(bg(d.setSelect),bb.done(),delete d.setSelect),ba.refresh(),d.bgColor!=N&&(bq(d.shade?ba.getShades():G,d.shade?d.shadeColor||d.bgColor:d.bgColor),N=d.bgColor),O!=d.bgOpacity&&(O=d.bgOpacity,d.shade?ba.refresh():bb.setBgOpacity(O)),P=d.maxSize[0]||0,Q=d.maxSize[1]||0,R=d.minSize[0]||0,S=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(D.attr("src",d.outerImage),delete d.outerImage),bb.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f=navigator.userAgent.toLowerCase(),g=/msie/.test(f),h=/msie [1-6]\./.test(f);typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),n(c);var z={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},A=a(b),B=!0;if(b.tagName=="IMG"){if(A[0].width!=0&&A[0].height!=0)A.width(A[0].width),A.height(A[0].height);else{var C=new Image;C.src=A[0].src,A.width(C.width),A.height(C.height)}var D=A.clone().removeAttr("id").
7799css(z).show();D.width(A.width()),D.height(A.height()),A.after(D).hide()}else D=A.css(z).show(),B=!1,d.shade===null&&(d.shade=!0);t(D,d.boxWidth,d.boxHeight);var E=D.width(),F=D.height(),G=a("<div />").width(E).height(F).addClass(j("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(A).append(D);d.addClass&&G.addClass(d.addClass);var H=a("<div />"),I=a("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),J=a("<div />").width("100%").height("100%").css("zIndex",320),K=a("<div />").css({position:"absolute",zIndex:600}).dblclick(function(){var a=_.getFixed();d.onDblClick.call(bs,a)}).insertBefore(D).append(I,J);B&&(H=a("<img />").attr("src",D.attr("src")).css(z).width(E).height(F),I.append(H)),h&&K.css({overflowY:"hidden"});var L=d.boundary,M=y().width(E+L*2).height(F+L*2).css({position:"absolute",top:i(-L),left:i(-L),zIndex:290}).mousedown(w),N=d.bgColor,O=d.bgOpacity,P,Q,R,S,T,U,V=!0,W,X,Y;e=l(D);var Z=function(){function a(){var a={},b=["touchstart"
7800,"touchmove","touchend"],c=document.createElement("div"),d;try{for(d=0;d<b.length;d++){var e=b[d];e="on"+e;var f=e in c;f||(c.setAttribute(e,"return;"),f=typeof c[e]=="function"),a[b[d]]=f}return a.touchstart&&a.touchend&&a.touchmove}catch(g){return!1}}function b(){return d.touchSupport===!0||d.touchSupport===!1?d.touchSupport:a()}return{createDragger:function(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(Z.cfilter(b)),!0),b.stopPropagation(),b.preventDefault(),!1)}},newSelection:function(a){return w(Z.cfilter(a))},cfilter:function(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,a},isSupported:a,support:b()}}(),_=function(){function h(d){d=n(d),c=a=d[0],e=b=d[1]}function i(a){a=n(a),f=a[0]-c,g=a[1]-e,c=a[0],e=a[1]}function j(){return[f,g]}
7800function k(d){var f=d[0],g=d[1];0>a+f&&(f-=f+a),0>b+g&&(g-=g+b),F<e+g&&(g+=F-(e+g)),E<c+f&&(f+=E-(c+f)),a+=f,c+=f,b+=g,e+=g}function l(a){var b=m();switch(a){case"ne":return[
7801b.x2,b.y];case"nw":return[b.x,b.y];case"se":return[b.x2,b.y2];case"sw":return[b.x,b.y2]}}function m(){if(!d.aspectRatio)return p();var f=d.aspectRatio,g=d.minSize[0]/T,h=d.maxSize[0]/T,i=d.maxSize[1]/U,j=c-a,k=e-b,l=Math.abs(j),m=Math.abs(k),n=l/m,r,s,t,u;return h===0&&(h=E*10),i===0&&(i=F*10),n<f?(s=e,t=m*f,r=j<0?a-t:t+a,r<0?(r=0,u=Math.abs((r-a)/f),s=k<0?b-u:u+b):r>E&&(r=E,u=Math.abs((r-a)/f),s=k<0?b-u:u+b)):(r=c,u=l/f,s=k<0?b-u:b+u,s<0?(s=0,t=Math.abs((s-b)*f),r=j<0?a-t:t+a):s>F&&(s=F,t=Math.abs(s-b)*f,r=j<0?a-t:t+a)),r>a?(r-a<g?r=a+g:r-a>h&&(r=a+h),s>b?s=b+(r-a)/f:s=b-(r-a)/f):r<a&&(a-r<g?r=a-g:a-r>h&&(r=a-h),s>b?s=b+(a-r)/f:s=b-(a-r)/f),r<0?(a-=r,r=0):r>E&&(a-=r-E,r=E),s<0?(b-=s,s=0):s>F&&(b-=s-F,s=F),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>E&&(a[0]=E),a[1]>F&&(a[1]=F),[Math.round(a[0]),Math.round(a[1])]}function o(a,b,c,d){var e=a,f=c,g=b,h=d;return c<a&&(e=c,f=a),d<b&&(g=d,h=b),[e,g,f,h]}function p(){var d=c-a,f=e-b,g;return P&&Math.abs(d)>P&&(c=d>0?a+P:a-P),Q&&Math.abs
7802(f)>Q&&(e=f>0?b+Q:b-Q),S/U&&Math.abs(f)<S/U&&(e=f>0?b+S/U:b-S/U),R/T&&Math.abs(d)<R/T&&(c=d>0?a+R/T:a-R/T),a<0&&(c-=a,a-=a),b<0&&(e-=b,b-=b),c<0&&(a-=c,c-=c),e<0&&(b-=e,e-=e),c>E&&(g=c-E,a-=g,c-=g),e>F&&(g=e-F,b-=g,e-=g),a>E&&(g=a-F,e-=g,b-=g),b>F&&(g=b-F,e-=g,b-=g),q(o(a,b,c,e))}function q(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var a=0,b=0,c=0,e=0,f,g;return{flipCoords:o,setPressed:h,setCurrent:i,getOffset:j,moveOffset:k,getCorner:l,getFixed:m}}(),ba=function(){function f(a,b){e.left.css({height:i(b)}),e.right.css({height:i(b)})}function g(){return h(_.getFixed())}function h(a){e.top.css({left:i(a.x),width:i(a.w),height:i(a.y)}),e.bottom.css({top:i(a.y2),left:i(a.x),width:i(a.w),height:i(F-a.y2)}),e.right.css({left:i(a.x2),width:i(E-a.x2)}),e.left.css({width:i(a.x)})}function j(){return a("<div />").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(D),g(),bb.setBgOpacity(1,0,1),H.hide(),l(d.shadeColor||d.bgColor,1),bb.
7803isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){bq(p(),a,b)}function m(){b&&(c.remove(),H.show(),b=!1,bb.isAwake()?bb.setBgOpacity(d.bgOpacity,1,1):(bb.setBgOpacity(1,1,1),bb.disableHandles()),bq(G,0,1))}function n(a,e){b&&(d.bgFade&&!e?c.animate({opacity:1-a},{queue:!1,duration:d.fadeTime}):c.css({opacity:1-a}))}function o(){d.shade?k():m(),bb.isAwake()&&n(d.bgOpacity)}function p(){return c.children()}var b=!1,c=a("<div />").css({position:"absolute",zIndex:240,opacity:0}),e={top:j(),left:j().height(F),right:j().height(F),bottom:j()};return{update:g,updateRaw:h,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bb=function(){function k(b){var c=a("<div />").addClass(j(b));return I.append(c),c}function l(b,c){var d=a("<div />").mousedown(s(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return Z.support&&d.bind("touchstart.jcrop",Z.createDragger(b)),J.append(d),d}function m(a){var b=d.handleSize,e=l(a,c++
7804).css({opacity:d.handleOpacity}).addClass(j("handle"));return b&&e.width(b).height(b),e}function n(a){return l(a,c++).addClass("jcrop-dragbar")}function o(a){var b;for(b=0;b<a.length;b++)g[a[b]]=n(a[b])}function p(a){var b,c;for(c=0;c<a.length;c++){switch(a[c]){case"n":b="hline";break;case"s":b="hline bottom";break;case"e":b="vline right";break;case"w":b="vline"}e[a[c]]=k(b)}}function q(a){var b;for(b=0;b<a.length;b++)f[a[b]]=m(a[b])}function r(a,b){d.shade||H.css({top:i(-b),left:i(-a)}),K.css({top:i(b),left:i(a)})}function t(a,b){K.width(Math.round(a)).height(Math.round(b))}function v(){var a=_.getFixed();_.setPressed([a.x,a.y]),_.setCurrent([a.x2,a.y2]),w()}function w(a){if(b)return x(a)}function x(a){var c=_.getFixed();t(c.w,c.h),r(c.x,c.y),d.shade&&ba.updateRaw(c),b||A(),a?d.onSelect.call(bs,u(c)):d.onChange.call(bs,u(c))}function z(a,c,e){if(!b&&!c)return;d.bgFade&&!e?D.animate({opacity:a},{queue:!1,duration:d.fadeTime}):D.css("opacity",a)}function A(){K.show(),d.shade?ba.opacity(O):z(O,!0),b=!0}function B
7805(){F(),K.hide(),d.shade?ba.opacity(1):z(1),b=!1,d.onRelease.call(bs)}function C(){h&&J.show()}function E(){h=!0;if(d.allowResize)return J.show(),!0}function F(){h=!1,J.hide()}function G(a){a?(X=!0,F()):(X=!1,E())}function L(){G(!1),v()}var b,c=370,e={},f={},g={},h=!1;d.dragEdges&&a.isArray(d.createDragbars)&&o(d.createDragbars),a.isArray(d.createHandles)&&q(d.createHandles),d.drawBorders&&a.isArray(d.createBorders)&&p(d.createBorders),a(document).bind("touchstart.jcrop-ios",function(b){a(b.currentTarget).hasClass("jcrop-tracker")&&b.stopPropagation()});var M=y().mousedown(s("move")).css({cursor:"move",position:"absolute",zIndex:360});return Z.support&&M.bind("touchstart.jcrop",Z.createDragger("move")),I.append(M),F(),{updateVisible:w,update:x,release:B,refresh:v,isAwake:function(){return b},setCursor:function(a){M.css("cursor",a)},enableHandles:E,enableOnly:function(){h=!0},showHandles:C,disableHandles:F,animMode:G,setBgOpacity:z,done:L}}(),bc=function(){function f(b){M.css({zIndex:450}
7805),b?a(document).bind("touchmove.jcrop"
7806,k).bind("touchend.jcrop",l):e&&a(document).bind("mousemove.jcrop",h).bind("mouseup.jcrop",i)}function g(){M.css({zIndex:290}),a(document).unbind(".jcrop")}function h(a){return b(m(a)),!1}function i(a){return a.preventDefault(),a.stopPropagation(),W&&(W=!1,c(m(a)),bb.isAwake()&&d.onSelect.call(bs,u(_.getFixed())),g(),b=function(){},c=function(){}),!1}function j(a,d,e){return W=!0,b=a,c=d,f(e),!1}function k(a){return b(m(Z.cfilter(a))),!1}function l(a){return i(Z.cfilter(a))}function n(a){M.css("cursor",a)}var b=function(){},c=function(){},e=d.trackDocument;return e||M.mousemove(h).mouseup(i).mouseout(i),D.before(M),{activateHandlers:j,setCursor:n}}(),bd=function(){function e(){d.keySupport&&(b.show(),b.focus())}function f(a){b.hide()}function g(a,b,c){d.allowMove&&(_.moveOffset([b,c]),bb.updateVisible(!0)),a.preventDefault(),a.stopPropagation()}function i(a){if(a.ctrlKey||a.metaKey)return!0;Y=a.shiftKey?!0:!1;var b=Y?10:1;switch(a.keyCode){case 37:g(a,-b,0);break;case 39:g(a,b,0);break;case 38:g(a,0,-b);break;
7807case 40:g(a,0,b);break;case 27:d.allowSelect&&bb.release();break;case 9:return!0}return!1}var b=a('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),c=a("<div />").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),h||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(D)):b.insertBefore(D)),{watchKeys:e}}();Z.support&&M.bind("touchstart.jcrop",Z.newSelection),J.hide(),br(!0);var bs={setImage:bp,animateTo:bf,setSelect:bg,setOptions:bk,tellSelect:bi,tellScaled:bj,setClass:be,disable:bl,enable:bm,cancel:bn,release:bb.release,destroy:bo,focus:bd.watchKeys,getBounds:function(){return[E*T,F*U]},getWidgetSize:function(){return[E,F]},getScaleFactor:function(){return[T,U]},getOptions:function(){return d},ui:{holder:G,selection:K}};return g&&G.bind("selectstart",function(){return!1}),A.data("Jcrop",bs),bs},a.fn.Jcrop=function(b,c){var d;return this.each(function(){if(a(this).data("Jcrop")){if(
7808b==="api")return a(this).data("Jcrop");a(this).data("Jcrop").setOptions(b)}else this.tagName=="IMG"?a.Jcrop.Loader(this,function(){a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d)}):(a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d))}),this},a.Jcrop.Loader=function(b,c,d){function g(){f.complete?(e.unbind(".jcloader"),a.isFunction(c)&&c.call(f)):window.setTimeout(g,50)}var e=a(b),f=e[0];e.bind("load.jcloader",g).bind("error.jcloader",function(b){e.unbind(".jcloader"),a.isFunction(d)&&d.call(f)}),f.complete&&a.isFunction(c)&&(e.unbind(".jcloader"),c.call(f))},a.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:null,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges
7809:!0,fixedSupport:!0,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}})(jQuery);
7810;
7811/**
7812 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level
7813 * directory of this distribution and at
7814 * https://github.com/marcj/css-element-queries/blob/master/LICENSE.
7815 */
7816;
7817(function () {
7818
7819    /**
7820     * Class for dimension change detection.
7821     *
7822     * @param {Element|Element[]|Elements|jQuery} element
7823     * @param {Function} callback
7824     *
7825     * @constructor
7826     */
7827    this.ResizeSensor = function (element, callback) {
7828        /**
7829         *
7830         * @constructor
7831         */
7832        function EventQueue() {
7833            this.q = [];
7834            this.add = function (ev) {
7835                this.q.push(ev);
7836            };
7837
7838            var i, j;
7839            this.call = function () {
7840                for (i = 0, j = this.q.length; i < j; i++) {
7841                    this.q[i].call();
7842                }
7843            };
7844        }
7845
7846        /**
7847         * @param {HTMLElement} element
7848         * @param {String}      prop
7849         * @returns {String|Number}
7850         */
7851        function getComputedStyle(element, prop) {
7852            if (element.currentStyle) {
7853                return element.currentStyle[prop];
7854            } else if (window.getComputedStyle) {
7855                return window.getComputedStyle(element, null).getPropertyValue(prop);
7856            } else {
7857                return element.style[prop];
7858            }
7859        }
7860
7861        /**
7862         *
7863         * @param {HTMLElement} element
7864         * @param {Function}    resized
7865         */
7866        function attachResizeEvent(element, resized) {
7867            if (!element.resizedAttached) {
7868                element.resizedAttached = new EventQueue();
7869                element.resizedAttached.add(resized);
7870            } else if (element.resizedAttached) {
7871                element.resizedAttached.add(resized);
7872                return;
7873            }
7874
7875            element.resizeSensor = document.createElement('div');
7876            element.resizeSensor.className = 'resize-sensor';
7877            var style = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;';
7878            var styleChild = 'position: absolute; left: 0; top: 0;';
7879
7880            element.resizeSensor.style.cssText = style;
7881            element.resizeSensor.innerHTML =
7882                '<div class="resize-sensor-expand" style="' + style + '">' +
7883                    '<div style="' + styleChild + '"></div>' +
7884                '</div>' +
7885                '<div class="resize-sensor-shrink" style="' + style + '">' +
7886                    '<div style="' + styleChild + ' width: 200%; height: 200%"></div>' +
7887                '</div>';
7888            element.appendChild(element.resizeSensor);
7889
7890            if (!{ fixed: 1, absolute: 1 }[getComputedStyle(element, 'position')]) {
7891                element.style.position = 'relative';
7892            }
7893
7894            var expand = element.resizeSensor.childNodes[0];
7895            var expandChild = expand.childNodes[0];
7896            var shrink = element.resizeSensor.childNodes[1];
7897            var shrinkChild = shrink.childNodes[0];
7898
7899            var lastWidth, lastHeight;
7900
7901            var reset = function () {
7902                expandChild.style.width = expand.offsetWidth + 10 + 'px';
7903                expandChild.style.height = expand.offsetHeight + 10 + 'px';
7904                expand.scrollLeft = expand.scrollWidth;
7905                expand.scrollTop = expand.scrollHeight;
7906                shrink.scrollLeft = shrink.scrollWidth;
7907                shrink.scrollTop = shrink.scrollHeight;
7908                lastWidth = element.offsetWidth;
7909                lastHeight = element.offsetHeight;
7910            };
7911
7912            reset();
7913
7914            var changed = function () {
7915                if (element.resizedAttached) {
7916                    element.resizedAttached.call();
7917                }
7918            };
7919
7920            var addEvent = function (el, name, cb) {
7921                if (el.attachEvent) {
7922                    el.attachEvent('on' + name, cb);
7923                } else {
7924                    el.addEventListener(name, cb);
7925                }
7926            };
7927
7928            addEvent(expand, 'scroll', function () {
7929                if (element.offsetWidth > lastWidth || element.offsetHeight > lastHeight) {
7930                    changed();
7931                }
7932                reset();
7933            });
7934
7935            addEvent(shrink, 'scroll', function () {
7936                if (element.offsetWidth < lastWidth || element.offsetHeight < lastHeight) {
7937                    changed();
7938                }
7939                reset();
7940            });
7941        }
7942
7943        if ("[object Array]" === Object.prototype.toString.call(element)
7944            || ('undefined' !== typeof jQuery && element instanceof jQuery) //jquery
7945            || ('undefined' !== typeof Elements && element instanceof Elements) //mootools
7946            ) {
7947            var i = 0, j = element.length;
7948            for (; i < j; i++) {
7949                attachResizeEvent(element[i], callback);
7950            }
7951        } else {
7952            attachResizeEvent(element, callback);
7953        }
7954
7955        this.detach = function () {
7956            ResizeSensor.detach(element);
7957        };
7958    };
7959
7960    this.ResizeSensor.detach = function (element) {
7961        if (element.resizeSensor) {
7962            element.removeChild(element.resizeSensor);
7963            delete element.resizeSensor;
7964            delete element.resizedAttached;
7965        }
7966    };
7967
7968})();
7969;
7970// Ion.RangeSlider | version 2.2.0 | https://github.com/IonDen/ion.rangeSlider
7971;(function(f){"function"===typeof define&&define.amd?define(["jquery"],function(n){return f(n,document,window,navigator)}):"object"===typeof exports?f(require("jquery"),document,window,navigator):f(jQuery,document,window,navigator)})(function(f,n,k,r,p){var t=0,m=function(){var a=r.userAgent,b=/msie\s\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(" ")[1],9>a)?(f("html").addClass("lt-ie9"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=[].slice;if("function"!=
7972typeof b)throw new TypeError;
7972var c=d.call(arguments,1),e=function(){if(this instanceof e){var g=function(){};g.prototype=b.prototype;var g=new g,l=b.apply(g,c.concat(d.call(arguments)));return Object(l)===l?l:g}return b.apply(a,c.concat(d.call(arguments)))};return e});Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){if(null==this)throw new TypeError('"this" is null or not defined');var d=Object(this),c=d.length>>>0;if(0===c)return-1;var e=+b||0;Infinity===Math.abs(e)&&(e=0);if(e>=c)return-1;
7973for(e=Math.max(0<=e?e:c-Math.abs(e),0);e<c;){if(e in d&&d[e]===a)return e;e++}return-1});var q=function(a,b,d){this.VERSION="2.2.0";this.input=a;this.plugin_count=d;this.old_to=this.old_from=this.update_tm=this.calc_count=this.current_plugin=0;this.raf_id=this.old_min_interval=null;this.no_diapason=this.force_redraw=this.dragging=!1;this.has_tab_index=!0;this.is_update=this.is_key=!1;this.is_start=!0;this.is_click=this.is_resize=this.is_active=this.is_finish=!1;b=b||{};this.$cache={win:f(k),body:f(n.body),
7974input:f(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,s_from:null,s_to:null,shad_single:null,shad_from:null,shad_to:null,edge:null,grid:null,grid_labels:[]};this.coords={x_gap:0,x_pointer:0,w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single_fake:0,p_single_real:0,p_from_fake:0,p_from_real:0,p_to_fake:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],big_x:[]};
7975this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from_fake:0,p_from_left:0,p_to_fake:0,p_to_left:0,p_single_fake:0,p_single_left:0};var c=this.$cache.input;a=c.prop("value");var e;d={type:"single",min:10,max:100,from:null,to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_shadow:!1,prettify_enabled:!0,prettify_separator:" ",prettify:null,force_edges:!1,
7976keyboard:!0,grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:"",postfix:"",max_postfix:"",decorate_both:!0,values_separator:" \u2014 ",input_values_separator:";",disable:!1,block:!1,extra_classes:"",scope:null,onStart:null,onChange:null,onFinish:null,onUpdate:null};"INPUT"!==c[0].nodeName&&console&&console.warn&&console.warn("Base element should be <input>!",c[0]);c={type:c.data("type"),min:c.data("min"),max:c.data("max"),from:c.data("from"),to:c.data("to"),step:c.data("step"),
7977min_interval:c.data("minInterval"),max_interval:c.data("maxInterval"),drag_interval:c.data("dragInterval"),values:c.data("values"),from_fixed:c.data("fromFixed"),from_min:c.data("fromMin"),from_max:c.data("fromMax"),from_shadow:c.data("fromShadow"),to_fixed:c.data("toFixed"),to_min:c.data("toMin"),to_max:c.data("toMax"),to_shadow:c.data("toShadow"),prettify_enabled:c.data("prettifyEnabled"),prettify_separator:c.data("prettifySeparator"),force_edges:c.data("forceEdges"),keyboard:c.data("keyboard"),
7978grid:c.data("grid"),grid_margin:c.data("gridMargin"),grid_num:c.data("gridNum"),grid_snap:c.data("gridSnap"),hide_min_max:c.data("hideMinMax"),hide_from_to:c.data("hideFromTo"),prefix:c.data("prefix"),postfix:c.data("postfix"),max_postfix:c.data("maxPostfix"),decorate_both:c.data("decorateBoth"),values_separator:c.data("valuesSeparator"),input_values_separator:c.data("inputValuesSeparator"),disable:c.data("disable"),block:c.data("block"),extra_classes:c.data("extraClasses")};c.values=c.values&&c.values.split(",");
7979for(e in c)c.hasOwnProperty(e)&&(c[e]!==p&&""!==c[e]||delete c[e]);a!==p&&""!==a&&(a=a.split(c.input_values_separator||b.input_values_separator||";"),a[0]&&a[0]==+a[0]&&(a[0]=+a[0]),a[1]&&a[1]==+a[1]&&(a[1]=+a[1]),b&&b.values&&b.values.length?(d.from=a[0]&&b.values.indexOf(a[0]),d.to=a[1]&&b.values.indexOf(a[1])):(d.from=a[0]&&+a[0],d.to=a[1]&&+a[1]));f.extend(d,b);f.extend(d,c);this.options=d;this.update_check={};this.validate();this.result={input:this.$cache.input,slider:null,min:this.options.min,
7980max:this.options.max,from:this.options.from,from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.init()};q.prototype={init:function(a){this.no_diapason=!1;this.coords.p_step=this.convertToPercent(this.options.step,!0);this.target="base";this.toggleInput();this.append();this.setMinMax();a?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart());this.updateScene()},append:function(){this.$cache.input.before('<span class="irs js-irs-'+
7981this.plugin_count+" "+this.options.extra_classes+'"></span>');this.$cache.input.prop("readonly",!0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="0"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span><span class="irs-bar"></span>');
7982this.$cache.rs=this.$cache.cont.find(".irs");this.$cache.min=this.$cache.cont.find(".irs-min");this.$cache.max=this.$cache.cont.find(".irs-max");this.$cache.from=this.$cache.cont.find(".irs-from");this.$cache.to=this.$cache.cont.find(".irs-to");this.$cache.single=this.$cache.cont.find(".irs-single");this.$cache.bar=this.$cache.cont.find(".irs-bar");this.$cache.line=this.$cache.cont.find(".irs-line");this.$cache.grid=this.$cache.cont.find(".irs-grid");"single"===this.options.type?(this.$cache.cont.append('<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>'),
7983this.$cache.edge=this.$cache.cont.find(".irs-bar-edge"),this.$cache.s_single=this.$cache.cont.find(".single"),this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.shad_single=this.$cache.cont.find(".shadow-single")):(this.$cache.cont.append('<span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-slider from"></span><span class="irs-slider to"></span>'),this.$cache.s_from=this.$cache.cont.find(".from"),
7984this.$cache.s_to=this.$cache.cont.find(".to"),this.$cache.shad_from=this.$cache.cont.find(".shadow-from"),this.$cache.shad_to=this.$cache.cont.find(".shadow-to"),this.setTopHandler());this.options.hide_from_to&&(this.$cache.from[0].style.display="none",this.$cache.to[0].style.display="none",this.$cache.single[0].style.display="none");this.appendGrid();this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.input[0].disabled=!1,this.removeDisableMask(),this.bindEvents());
7985this.options.disable||(this.options.block?this.appendDisableMask():this.removeDisableMask());this.options.drag_interval&&(this.$cache.bar[0].style.cursor="ew-resize")},setTopHandler:function(){var a=this.options.max,b=this.options.to;this.options.from>this.options.min&&b===a?this.$cache.s_from.addClass("type_last"):b<a&&this.$cache.s_to.addClass("type_last")},changeLevel:function(a){switch(a){case "single":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);this.$cache.s_single.addClass("state_hover");
7986break;case "from":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake);this.$cache.s_from.addClass("state_hover");this.$cache.s_from.addClass("type_last");this.$cache.s_to.removeClass("type_last");break;case "to":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake);this.$cache.s_to.addClass("state_hover");this.$cache.s_to.addClass("type_last");this.$cache.s_from.removeClass("type_last");break;case "both":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-
7987this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake-this.coords.p_pointer),this.$cache.s_to.removeClass("type_last"),this.$cache.s_from.removeClass("type_last")}},appendDisableMask:function(){this.$cache.cont.append('<span class="irs-disable-mask"></span>');this.$cache.cont.addClass("irs-disabled")},removeDisableMask:function(){this.$cache.cont.remove(".irs-disable-mask");this.$cache.cont.removeClass("irs-disabled")},remove:function(){this.$cache.cont.remove();this.$cache.cont=
7988null;this.$cache.line.off("keydown.irs_"+this.plugin_count);this.$cache.body.off("touchmove.irs_"+this.plugin_count);this.$cache.body.off("mousemove.irs_"+this.plugin_count);this.$cache.win.off("touchend.irs_"+this.plugin_count);this.$cache.win.off("mouseup.irs_"+this.plugin_count);m&&(this.$cache.body.off("mouseup.irs_"+this.plugin_count),this.$cache.body.off("mouseleave.irs_"+this.plugin_count));this.$cache.grid_labels=[];this.coords.big=[];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=
7989[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(!this.no_diapason){this.$cache.body.on("touchmove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.body.on("mousemove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.win.on("touchend.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.win.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));
7990this.$cache.line.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.$cache.line.on("focus.irs_"+this.plugin_count,this.pointerFocus.bind(this));this.options.drag_interval&&"double"===this.options.type?(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"both")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"both"))):(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),
7991this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));"single"===this.options.type?(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.shad_single.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,
7992"single")),this.$cache.s_single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.edge.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_single.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on("touchstart.irs_"+
7993this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,
7994"click")),this.$cache.from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("mousedown.irs_"+
7995this.plugin_count,this.pointerClick.bind(this,"click")));
7995if(this.options.keyboard)this.$cache.line.on("keydown.irs_"+this.plugin_count,this.key.bind(this,"keyboard"));m&&(this.$cache.body.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on("mouseleave.irs_"+this.plugin_count,this.pointerUp.bind(this)))}},pointerFocus:function(a){if(!this.target){var b="single"===this.options.type?this.$cache.single:this.$cache.from;a=b.offset().left;a+=b.width()/2-1;this.pointerClick("single",
7996{preventDefault:function(){},pageX:a})}},pointerMove:function(a){this.dragging&&(this.coords.x_pointer=(a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX)-this.coords.x_gap,this.calc())},pointerUp:function(a){this.current_plugin===this.plugin_count&&this.is_active&&(this.is_active=!1,this.$cache.cont.find(".state_hover").removeClass("state_hover"),this.force_redraw=!0,m&&f("*").prop("unselectable",!1),this.updateScene(),this.restoreOriginalMinInterval(),(f.contains(this.$cache.cont[0],
7997a.target)||this.dragging)&&this.callOnFinish(),this.dragging=!1)},pointerDown:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&("both"===a&&this.setTempMinInterval(),a||(a=this.target||"from"),this.current_plugin=this.plugin_count,this.target=a,this.dragging=this.is_active=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(a),m&&f("*").prop("unselectable",
7998!0),this.$cache.line.trigger("focus"),this.updateScene())},pointerClick:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(d-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger("focus"))},key:function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||
7999b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault();this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,d=(this.options.max-this.options.min)/100,d=this.options.step/d;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*(a?b+d:b-d));this.is_key=!0;this.calc()},setMinMax:function(){if(this.options)if(this.options.hide_min_max)this.$cache.min[0].style.display=
8000"none",this.$cache.max[0].style.display="none";else{if(this.options.values.length)this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]));else{var a=this._prettify(this.options.min),b=this._prettify(this.options.max);this.result.min_pretty=a;this.result.max_pretty=b;this.$cache.min.html(this.decorate(a,this.options.min));this.$cache.max.html(this.decorate(b,this.options.max))}this.labels.w_min=this.$cache.min.outerWidth(!1);
8001this.labels.w_max=this.$cache.max.outerWidth(!1)}},setTempMinInterval:function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval);this.options.min_interval=a},restoreOriginalMinInterval:function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},calc:function(a){if(this.options){this.calc_count++;
8001if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),
8002this.calcHandlePercent();if(this.coords.w_rs){this.calcPointerPercent();a=this.getHandleX();"both"===this.target&&(this.coords.p_gap=0,a=this.getHandleX());"click"===this.target&&(this.coords.p_gap=this.coords.p_handle/2,a=this.getHandleX(),this.target=this.options.drag_interval?"both_one":this.chooseHandle(a));switch(this.target){case "base":var b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);
8003this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);this.coords.p_from_fake=
8004this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);this.target=null;break;case "single":if(this.options.from_fixed)break;this.coords.p_single_real=this.convertToRealPercent(a);this.coords.p_single_real=this.calcWithStep(this.coords.p_single_real);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);
8005break;case "from":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(a);this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_real=
8006this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case "to":if(this.options.to_fixed)break;this.coords.p_to_real=this.convertToRealPercent(a);this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);
8007this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case "both":if(this.options.from_fixed||this.options.to_fixed)break;a=this.toFixed(a+.001*this.coords.p_handle);this.coords.p_from_real=this.convertToRealPercent(a)-this.coords.p_gap_left;this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);
8008this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.convertToRealPercent(a)+this.coords.p_gap_right;this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,
8009this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case "both_one":if(!this.options.from_fixed&&!this.options.to_fixed){var d=this.convertToRealPercent(a);a=this.result.to_percent-this.result.from_percent;var c=a/2,b=d-c,d=d+c;0>b&&(b=0,d=b+a);100<d&&(d=100,b=d-a);this.coords.p_from_real=this.calcWithStep(b);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,
8010this.options.from_min,this.options.from_max);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.calcWithStep(d);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real)}}"single"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,
8011this.result.from=this.convertToValue(this.coords.p_single_real),this.result.from_pretty=this._prettify(this.result.from),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake-this.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.from_pretty=
8012this._prettify(this.result.from),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.result.to_pretty=this._prettify(this.result.to),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));this.calcMinMax();this.calcLabels()}}},calcPointerPercent:function(){this.coords.w_rs?(0>this.coords.x_pointer||isNaN(this.coords.x_pointer)?this.coords.x_pointer=
80130:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=0},convertToRealPercent:function(a){return a/(100-this.coords.p_handle)*100},convertToFakePercent:function(a){return a/100*(100-this.coords.p_handle)}
8013,getHandleX:function(){var a=100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);0>b?b=0:b>a&&(b=a);return b},calcHandlePercent:function(){this.coords.w_handle=
8014"single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},chooseHandle:function(a){return"single"===this.options.type?"single":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?this.options.to_fixed?"from":"to":this.options.from_fixed?"to":"from"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=
8015this.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&("single"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/2-this.labels.p_single_fake/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=
8016this.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=
8017this.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake))},updateScene:function(){this.raf_id&&
8018(cancelAnimationFrame(this.raf_id),this.raf_id=null);clearTimeout(this.update_tm);this.update_tm=null;this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);if(this.coords.w_rs){this.coords.w_rs!==this.coords.w_rs_old&&(this.target="base",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(),
8019this.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+"%";this.$cache.bar[0].style.width=this.coords.p_bar_w+"%";if("single"===this.options.type)this.$cache.s_single[0].style.left=
8020this.coords.p_single_fake+"%";else{this.$cache.s_from[0].style.left=this.coords.p_from_fake+"%";this.$cache.s_to[0].style.left=this.coords.p_to_fake+"%";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=this.labels.p_from_left+"%";if(this.old_to!==this.result.to||this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+"%"}this.$cache.single[0].style.left=this.labels.p_single_left+"%";this.writeToInput();this.old_from===this.result.from&&this.old_to===
8021this.result.to||this.is_start||(this.$cache.input.trigger("change"),this.$cache.input.trigger("input"));this.old_from=this.result.from;this.old_to=this.result.to;this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange();if(this.is_key||this.is_click)this.is_click=this.is_key=!1,this.callOnFinish();this.is_finish=this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}}},drawLabels:function(){if(this.options){var a=this.options.values.length,
8022b=this.options.p_values;if(!this.options.hide_from_to)if("single"===this.options.type){if(a)a=this.decorate(b[this.result.from]);else{var d=this._prettify(this.result.from);a=this.decorate(d,this.result.from)}this.$cache.single.html(a);this.calcLabels();this.$cache.min[0].style.visibility=this.labels.p_single_left<this.labels.p_min+1?"hidden":"visible";this.$cache.max[0].style.visibility=this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?"hidden":"visible"}else{a?(this.options.decorate_both?
8023(a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),d=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(d=this._prettify(this.result.from),b=this._prettify(this.result.to),this.options.decorate_both?(a=this.decorate(d,this.result.from),a+=this.options.values_separator,a+=this.decorate(b,this.result.to)):a=this.decorate(d+this.options.values_separator+
8024b,this.result.to),d=this.decorate(d,this.result.from),b=this.decorate(b,this.result.to));this.$cache.single.html(a);this.$cache.from.html(d);this.$cache.to.html(b);this.calcLabels();a=Math.min(this.labels.p_single_left,this.labels.p_from_left);d=this.labels.p_single_left+this.labels.p_single_fake;var b=this.labels.p_to_left+this.labels.p_to_fake,c=Math.max(d,b);this.labels.p_from_left+this.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility=
8025"hidden",this.$cache.single[0].style.visibility="visible",this.result.from===this.result.to?("from"===this.target?this.$cache.from[0].style.visibility="visible":"to"===this.target?this.$cache.to[0].style.visibility="visible":this.target||(this.$cache.from[0].style.visibility="visible"),this.$cache.single[0].style.visibility="hidden",c=b):(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",c=Math.max(d,b))):(this.$cache.from[0].style.visibility=
8026"visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden");this.$cache.min[0].style.visibility=a<this.labels.p_min+1?"hidden":"visible";this.$cache.max[0].style.visibility=c>100-this.labels.p_max-1?"hidden":"visible"}}},drawShadow:function(){var a=this.options,b=this.$cache,d="number"===typeof a.from_min&&!isNaN(a.from_min),c="number"===typeof a.from_max&&!isNaN(a.from_max),e="number"===typeof a.to_min&&!isNaN(a.to_min),g="number"===typeof a.to_max&&!isNaN(a.to_max);
8027"single"===a.type?a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_single[0].style.display="block",b.shad_single[0].style.left=d+"%",b.shad_single[0].style.width=c+"%"):b.shad_single[0].style.display="none":(a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-
8028d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_from[0].style.display="block",b.shad_from[0].style.left=d+"%",b.shad_from[0].style.width=c+"%"):b.shad_from[0].style.display="none",a.to_shadow&&(e||g)?(e=this.convertToPercent(e?a.to_min:a.min),a=this.convertToPercent(g?a.to_max:a.max)-e,e=this.toFixed(e-this.coords.p_handle/100*e),a=this.toFixed(a-this.coords.p_handle/100*a),e+=this.coords.p_handle/2,b.shad_to[0].style.display=
8029"block",b.shad_to[0].style.left=e+"%",b.shad_to[0].style.width=a+"
8029%"):b.shad_to[0].style.display="none")},writeToInput:function(){"single"===this.options.type?(this.options.values.length?this.$cache.input.prop("value",this.result.from_value):this.$cache.input.prop("value",this.result.from),this.$cache.input.data("from",this.result.from)):(this.options.values.length?this.$cache.input.prop("value",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop("value",
8030this.result.from+this.options.input_values_separator+this.result.to),this.$cache.input.data("from",this.result.from),this.$cache.input.data("to",this.result.to))},callOnStart:function(){this.writeToInput();if(this.options.onStart&&"function"===typeof this.options.onStart)if(this.options.scope)this.options.onStart.call(this.options.scope,this.result);else this.options.onStart(this.result)},callOnChange:function(){this.writeToInput();if(this.options.onChange&&"function"===typeof this.options.onChange)if(this.options.scope)this.options.onChange.call(this.options.scope,
8031this.result);else this.options.onChange(this.result)},callOnFinish:function(){this.writeToInput();if(this.options.onFinish&&"function"===typeof this.options.onFinish)if(this.options.scope)this.options.onFinish.call(this.options.scope,this.result);else this.options.onFinish(this.result)},callOnUpdate:function(){this.writeToInput();if(this.options.onUpdate&&"function"===typeof this.options.onUpdate)if(this.options.scope)this.options.onUpdate.call(this.options.scope,this.result);else this.options.onUpdate(this.result)},
8032toggleInput:function(){this.$cache.input.toggleClass("irs-hidden-input");this.has_tab_index?this.$cache.input.prop("tabindex",-1):this.$cache.input.removeProp("tabindex");this.has_tab_index=!this.has_tab_index},convertToPercent:function(a,b){var d=this.options.max-this.options.min;return d?this.toFixed((b?a:a-this.options.min)/(d/100)):(this.no_diapason=!0,0)},convertToValue:function(a){var b=this.options.min,d=this.options.max,c=b.toString().split(".")[1],e=d.toString().split(".")[1],g,l,f=0,h=0;
8033if(0===a)return this.options.min;if(100===a)return this.options.max;c&&(f=g=c.length);e&&(f=l=e.length);g&&l&&(f=g>=l?g:l);0>b&&(h=Math.abs(b),b=+(b+h).toFixed(f),d=+(d+h).toFixed(f));a=(d-b)/100*a+b;(b=this.options.step.toString().split(".")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));h&&(a-=h);h=b?+a.toFixed(b.length):this.toFixed(a);h<this.options.min?h=this.options.min:h>this.options.max&&(h=this.options.max);return h},calcWithStep:function(a){var b=
8034Math.round(a/this.coords.p_step)*this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,d){var c=this.options;if(!c.min_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a<c.min_interval&&(a=b-c.min_interval):a-b<c.min_interval&&(a=b+c.min_interval);return this.convertToPercent(a)},checkMaxInterval:function(a,b,d){var c=this.options;if(!c.max_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);"from"===
8035d?b-a>c.max_interval&&(a=b-c.max_interval):a-b>c.max_interval&&(a=b+c.max_interval);return this.convertToPercent(a)},checkDiapason:function(a,b,d){a=this.convertToValue(a);var c=this.options;"number"!==typeof b&&(b=c.min);"number"!==typeof d&&(d=c.max);a<b&&(a=b);a>d&&(a=d);return this.convertToPercent(a)},toFixed:function(a){a=a.toFixed(20);return+a},_prettify:function(a){return this.options.prettify_enabled?this.options.prettify&&"function"===typeof this.options.prettify?this.options.prettify(a):
8036this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,d=a.values,c=d.length,e;"string"===typeof a.min&&(a.min=+a.min);"string"===typeof a.max&&(a.max=+a.max);"string"===typeof a.from&&(a.from=+a.from);"string"===typeof a.to&&(a.to=+a.to);
8037"string"===typeof a.step&&(a.step=+a.step);"string"===typeof a.from_min&&(a.from_min=+a.from_min);"string"===typeof a.from_max&&(a.from_max=+a.from_max);"string"===typeof a.to_min&&(a.to_min=+a.to_min);"string"===typeof a.to_max&&(a.to_max=+a.to_max);"string"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<a.min&&(a.max=a.min);if(c)for(a.p_values=[],a.min=0,a.max=c-1,a.step=1,a.grid_num=a.max,a.grid_snap=!0,e=0;e<c;e++){var g=+d[e];isNaN(g)?g=d[e]:(d[e]=g,g=this._prettify(g));a.p_values.push(g)}if("number"!==
8038typeof a.from||isNaN(a.from))a.from=a.min;if("number"!==typeof a.to||isNaN(a.to))a.to=a.max;"single"===a.type?(a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max)):(a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max),a.to<a.min&&(a.to=a.min),a.to>a.max&&(a.to=a.max),this.update_check.from&&(this.update_check.from!==a.from&&a.from>a.to&&(a.from=a.to),this.update_check.to!==a.to&&a.to<a.from&&(a.to=a.from)),a.from>a.to&&(a.from=a.to),a.to<a.from&&(a.to=a.from));if("number"!==typeof a.step||
8039isNaN(a.step)||!a.step||0>a.step)a.step=1;"number"===typeof a.from_min&&a.from<a.from_min&&(a.from=a.from_min);"number"===typeof a.from_max&&a.from>a.from_max&&(a.from=a.from_max);"number"===typeof a.to_min&&a.to<a.to_min&&(a.to=a.to_min);"number"===typeof a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>b.max)b.to=a.to}if("number"!==typeof a.min_interval||isNaN(a.min_interval)||
8040!a.min_interval||0>a.min_interval)a.min_interval=0;if("number"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var d="",c=this.options;c.prefix&&(d+=c.prefix);d+=a;c.max_postfix&&(c.values.length&&a===c.p_values[c.max]?(d+=c.max_postfix,c.postfix&&(d+=" ")):b===c.max&&(d+=c.max_postfix,
8041c.postfix&&(d+=" ")));c.postfix&&(d+=c.postfix);return d},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.convertToPercent(this.result.from);this.result.from_pretty=this._prettify(this.result.from);this.options.values&&(this.result.from_value=this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.convertToPercent(this.result.to);this.result.to_pretty=this._prettify(this.result.to);this.options.values&&
8042(this.result.to_value=this.options.values[this.result.to])},updateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b;var d=a.max-a.min;var c=a.grid_num,e=4,g="";this.calcGridMargin();if(a.grid_snap)if(50<d){c=50/a.step;var f=this.toFixed(a.step/.5)}else c=d/a.step,f=this.toFixed(a.step/(d/100));else f=this.toFixed(100/c);4<c&&(e=3);7<c&&(e=2);14<c&&(e=1);28<c&&(e=0);
8043for(d=0;d<c+1;d++){var k=e;var h=this.toFixed(f*d);100<h&&(h=100);this.coords.big[d]=h;var m=(h-f*(d-1))/(k+1);for(b=1;b<=k&&0!==h;b++){var n=this.toFixed(h-m*b);g+='<span class="irs-grid-pol small" style="left: '+n+'%"></span>'}
8043g+='<span class="irs-grid-pol" style="left: '+h+'%"></span>';b=this.convertToValue(h);b=a.values.length?a.p_values[b]:this._prettify(b);g+='<span class="irs-grid-text js-grid-text-'+d+'" style="left: '+h+'%">'+b+"</span>"}this.coords.big_num=Math.ceil(c+1);this.$cache.cont.addClass("irs-with-grid");
8044this.$cache.grid.html(g);this.cacheGridLabels()}},cacheGridLabels:function(){var a,b=this.coords.big_num;for(a=0;a<b;a++){var d=this.$cache.grid.find(".js-grid-text-"+a);this.$cache.grid_labels.push(d)}this.calcGridLabels()},calcGridLabels:function(){var a;var b=[];var d=[],c=this.coords.big_num;for(a=0;a<c;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/
80452),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(b[a]+this.coords.big_p[a]);this.options.force_edges&&(b[0]<-this.coords.grid_gap&&(b[0]=-this.coords.grid_gap,d[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[c-1]>100+this.coords.grid_gap&&(d[c-1]=100+this.coords.grid_gap,b[c-1]=this.toFixed(d[c-1]-this.coords.big_p[c-1]),this.coords.big_x[c-1]=this.toFixed(this.coords.big_p[c-1]-this.coords.grid_gap)));this.calcGridCollision(2,
8046b,d);this.calcGridCollision(4,b,d);for(a=0;a<c;a++)b=this.$cache.grid_labels[a][0],this.coords.big_x[a]!==Number.POSITIVE_INFINITY&&(b.style.marginLeft=-this.coords.big_x[a]+"%")},calcGridCollision:function(a,b,d){var c,e=this.coords.big_num;for(c=0;c<e;c+=a){var g=c+a/2;if(g>=e)break;var f=this.$cache.grid_labels[g][0];f.style.visibility=d[c]<=b[g]?"visible":"hidden"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_handle=
8047"single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[
80470].style.width=this.toFixed(100-this.coords.p_handle)+"%",this.$cache.grid[0].style.left=this.coords.grid_gap+"%"))},update:function(a){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.update_check.from=
8048this.result.from,this.update_check.to=this.result.to,this.options=f.extend(this.options,a),this.validate(),this.updateResult(a),this.toggleInput(),this.remove(),this.init(!0))},reset:function(){this.input&&(this.updateResult(),this.update())},destroy:function(){this.input&&(this.toggleInput(),this.$cache.input.prop("readonly",!1),f.data(this.input,"ionRangeSlider",null),this.remove(),this.options=this.input=null)}};f.fn.ionRangeSlider=function(a){return this.each(function(){f.data(this,"ionRangeSlider")||
8049f.data(this,"ionRangeSlider",new q(this,a,t++))})};(function(){for(var a=0,b=["ms","moz","webkit","o"],d=0;d<b.length&&!k.requestAnimationFrame;++d)k.requestAnimationFrame=k[b[d]+"RequestAnimationFrame"],k.cancelAnimationFrame=k[b[d]+"CancelAnimationFrame"]||k[b[d]+"CancelRequestAnimationFrame"];k.requestAnimationFrame||(k.requestAnimationFrame=function(b,d){var c=(new Date).getTime(),e=Math.max(0,16-(c-a)),f=k.setTimeout(function(){b(c+e)},e);a=c+e;return f});k.cancelAnimationFrame||(k.cancelAnimationFrame=
8050function(a){clearTimeout(a)})})()});
8051;
8052(function ($) {
8053    'use strict';
8054    
8055    // Private RockList "class" that will represent instances of the item list in memory
8056    // and provide all functionality needed by instances of a list control.
8057    var RockList = function (element) {
8058        this.$el = $(element);
8059    };
8060
8061    // Prototype declaration for RockList, holds all new functionality of the list
8062    RockList.prototype = {
8063        constructor: RockList,
8064        init: function () {
8065            this.initListEvents();
8066        },
8067
8068        // Wire up DOM events for rockList instance
8069        initListEvents: function () {
8070            var self = this;
8071
8072            // remove event to make sure it doesn't get attached multiple times
8073            this.$el.off('click');
8074
8075            // Selecting an item...
8076            this.$el.on('click', '.rocklist-item', function (e) {
8077                e.preventDefault();
8078                e.stopPropagation();
8079
8080                var $rockList = $(this).parents('.rocklist'),
8081                    $item = $(this),
8082                    id = $item.closest('li').attr('data-id');
8083
8084                // clear all previous selections
8085                $rockList.find('.selected').removeClass('selected');
8086
8087                // mark the selected as selected
8088                $item.toggleClass('selected');
8089
8090                self.$el.trigger('rockList:selected', id);
8091            });
8092        }
8093    };
8094
8095    // jQuery plugin definition
8096    $.fn.rockList = function () {
8097
8098        // For each element matching the selector, attempt to get an instance
8099        // of RockList from $el.data, if not present, create a new instance
8100        // of RockList and stash it there, then initialize the list.
8101        return this.each(function () {
8102            var $el = $(this);
8103            var rockList = $el.data('rockList');
8104            
8105            if (!rockList) {
8106                // create a new rocklist
8107                rockList = new RockList(this);
8108            }
8109
8110            $el.data('rockList', rockList);
8111            rockList.init();
8112        });
8113    };
8114}(jQuery));;
8115(function ($) {
8116    'use strict';
8117
8118    // Private RockTree "class" that will represent instances of the node tree in memory
8119    // and provide all functionality needed by instances of a treeview control.
8120    var RockTree = function (element, options) {
8121        this.$el = $(element);
8122        this.options = options;
8123        this.selectedNodes = [];
8124
8125        // Create an object-based event aggregator (not DOM-based)
8126        // for internal eventing
8127        this.events = $({});
8128    },
8129        // Generic recursive utility function to find a node in the tree by its id
8130        _findNodeById = function (id, array) {
8131            var currentNode,
8132                node;
8133
8134            if (!array || typeof array.length !== 'number') {
8135                return null;
8136            }
8137
8138            // remove surrounding single quotes from id if they exist
8139            var idCompare = id.toString().replace(/(^')|('$)/g, '');
8140
8141            for (var i = 0; i < array.length; i++) {
8142                currentNode = array[i];
8143
8144                if (currentNode.id.toString() === idCompare) {
8145                    return currentNode;
8146                } else if (currentNode.hasChildren) {
8147                    node = _findNodeById(id, currentNode.children || []);
8148
8149                    if (node) {
8150                        return node;
8151                    }
8152                }
8153            }
8154
8155            return null;
8156        },
8157
8158        // Default utility function to attempt to map a Rock.Web.UI.Controls.Pickers.TreeViewItem
8159        // to a more standard JS object.
8160        _mapArrayDefault = function (arr, treeView) {
8161
8162            return $.map(arr, function (item) {
8163
8164                var node = {
8165                    id: item.Guid || item.Id,
8166                    name: item.Name || item.Title,
8167                    iconCssClass: item.IconCssClass,
8168                    parentId: item.ParentId,
8169                    hasChildren: item.HasChildren,
8170                    isActive: item.IsActive,
8171                    countInfo: item.CountInfo,
8172                    isCategory: item.IsCategory,
8173                    path: item.Path
8174                };
8175
8176                if (node.parentId === null) {
8177                    node.parentId = '0';
8178                }
8179
8180                if (item.Children && typeof item.Children.length === 'number') {
8181                    node.children = _mapArrayDefault(item.Children, treeView);
8182                }
8183
8184                if (node.isCategory) {
8185                    node.id = treeView.options.categoryPrefix + n
8185ode.id;
8186                }
8187
8188                return node;
8189            });
8190        },
8191
8192        // Utility function that attempts to derive a node tree structure given an HTML element
8193        _mapFromHtml = function ($el, attrs) {
8194            var nodes = [],
8195                $ul = $el.children('ul');
8196
8197            $ul.children('li').each(function () {
8198                var $li = $(this),
8199                    node = {
8200                        id: $li.attr('data-id'),
8201                        name: $li.children('span').first().html(),
8202                        hasChildren: $li.children('ul').length > 0,
8203                        isOpen: $li.attr('data-expanded') === 'true'
8204                    };
8205
8206                if (attrs && typeof attrs.length === 'number') {
8207                    for (var i = 0; i < attrs.length; i++) {
8208                        node[attrs[i]] = $li.attr('data-' + attrs[i]);
8209                    }
8210                }
8211
8212                if (node.hasChildren) {
8213                    node.children = _mapFromHtml($li, attrs);
8214                }
8215
8216                nodes.push(node);
8217            });
8218
8219            return nodes;
8220        };
8221
8222    // Prototype declaration for RockTree, holds all new functionality of the tree
8223    RockTree.prototype = {
8224        constructor: RockTree,
8225        init: function () {
8226            // Load data into tree asynchronously
8227
8228            var promise = this.fetch(this.options.id),
8229                self = this;
8230
8231            this.showLoading(this.$el);
8232
8233            // If Selected Ids is set, pre-select those nodes
8234            promise.done(function () {
8235                if (self.options.selectedIds && typeof self.options.selectedIds.length === 'number') {
8236                    self.clear();
8237                    self.setSelected(self.options.selectedIds);
8238                }
8239
8240                self.render();
8241                self.discardLoading(self.$el);
8242                self.initTreeEvents();
8243            });
8244
8245            // If attempt to load data fails, display error message
8246            promise.fail(function (msg) {
8247                self.renderError(msg);
8248                self.discardLoading(self.$el);
8249            });
8250        },
8251        fetch: function (id) {
8252            var self = this,
8253                startingNode = _findNodeById(id, this.nodes),
8254
8255                // Using a jQuery Deferred to control when this operation will get returned to the caller.
8256                // Since the fetch operation may span multiple AJAX requests, we need a good way to control
8257                // how the caller will be notified of completion.
8258                dfd = $.Deferred(),
8259
8260                // Create a queue of Ids to expand the corresponding parent item nodes
8261                toExpandParentItems = [],
8262
8263                // Create a queue of Ids to expand the corresponding parent category nodes (which have id values prefixed by categoryPrefix)
8264                toExpandCategories = [],
8265
8266                // Variable for category prefix.
8267                categoryPrefix = '',
8268
8269                // Create a "queue" or hash of AJAX calls that are currently in progress
8270                inProgress = {},
8271
8272                // Handler function to determine whether or not the fetch operation is complete.
8273                onProgressNotification = function (parentNode) {
8274                    var numberInQueue = Object.keys(inProgress).length;
8275
8276                    // If we've drained the queue of all items to prefetch,
8277                    // and there are no requests in queue currentling being fetched,
8278                    // and we have not already resolved the deferred, return
8279                    // control to the caller.
8280                    if (toExpandParentItems.length === 0 && toExpandCategories.length === 0 && numberInQueue === 0 && dfd.state() !== 'resolved') {
8281                        if (startingNode && parentNode) {
8282                            if (startingNode.id === parentNode.id) {
8283                                dfd.resolve();
8284                            }
8285                        } else {
8286                            dfd.resolve();
8287                        }
8288                    }
8289                },
8290
8291                // Wrapper function around jQuery.ajax. Appends a handler to databind the
8292                // resulting JSON from the server and returns the promise
8293                getNodes = function (parentId, parentNode) {
8294                    if (self.options.getNodes) {
8295                        self.clearError();
8296
8297                        return self.options
8298                            .getNodes(parentId, parentNode, self.options.selectedIds, toExpandParentItems)
8299                            .done(data => {
8300                                try {
8301                                    self.dataBind(data, parentNode);
8302                                }
8303                                catch (e) {
8304                                    dfd.reject(e);
8305                                }
8306
8307                                self.$el.trigger('rockTree:fetchCompleted', [{ success: true, data: data }]);
8308                            })
8309                            .fail(function (jqXHR, textStatus, errorThrown) {
8310                                self.renderError(jqXHR.responseJSON ? jqXHR.responseJSON.E
8310xceptionMessage : errorThrown);
8311
8312                                self.$el.trigger('rockTree:fetchCompleted', [{ success: false, data: jqXHR }]);
8313                            });
8314                    }
8315
8316                    var restUrl = self.options.restUrl;
8317
8318                    // If the Tree Node we are loading has an EntityId attribute, use it to identify the associated Data Entity key - otherwise use the Tree Node identifier itself.
8319                    // The Data Entity key identifies the node data we are requesting from the REST source to load into the tree.
8320                    if (parentNode && parentNode.entityId) {
8321                        restUrl += parentNode.entityId;
8322                    } else {
8323                        var sanitizedId = parentId.toString();
8324                        if (parentNode && parentNode.isCategory) {
8325                            sanitizedId = sanitizedId.replace(self.options.categoryPrefix, '');
8326                        }
8327                        restUrl += sanitizedId;
8328                    }
8329
8330                    if (self.options.restParams) {
8331                        restUrl += self.options.restParams;
8332                    }
8333
8334                    self.clearError();
8335
8336                    return $.ajax({
8337                        url: restUrl,
8338                        dataType: 'json',
8339                        contentType: 'application/json'
8340                    })
8341                        .done(function (data) {
8342                            try {
8343                                self.dataBind(data, parentNode);
8344                            } catch (e) {
8345                                dfd.reject(e);
8346                            }
8347
8348                            self.$el.trigger('rockTree:fetchCompleted', [{ success: true, data: data }]);
8349                        })
8350                        .fail(function (jqXHR, textStatus, errorThrown) {
8351                            self.renderError(jqXHR.responseJSON ? jqXHR.responseJSON.ExceptionMessage : errorThrown);
8352
8353                            self.$el.trigger('rockTree:fetchCompleted', [{ success: false, data: jqXHR }]);
8354                        });
8355                };
8356
8357            if (this.options.restUrl) {
8358
8359                if ((this.options.expandedIds && typeof this.options.expandedIds.length === 'number') ||
8360                    (this.options.expandedCategoryIds && typeof this.options.expandedCategoryIds.length === 'number') ||
8361                    this.options.universalItemPicker) {
8362                    toExpandParentItems = this.options.expandedIds || [];
8363                    toExpandCategories = this.options.expandedCategoryIds || [];
8364                    categoryPrefix = this.options.categoryPrefix;
8365
8366                    // Listen for progress on the Deferred and pass it the handler to
8367                    // check if we're "done"
8368                    dfd.progress(onProgressNotification);
8369
8370                    // Listen to internal databound event
8371                    this.events.on('nodes:dataBound', function () {
8372                        // First, check for parent items that need to be expanded.
8373                        var currentId = toExpandParentItems.shift(); // Pop the top item off the "stack" to de-queue it...
8374                        if (currentId) {
8375
8376                            // remove surrounding single quotes from id if they exist
8377                            // Quotes should never get to this point. ItemPicker.cs: _hfInitialItemParentIds should be updated to not have quotes. Other places may also add quotes and should be updated
8378                            currentId = currentId.toString().replace(/(^')|('$)/g, '');
8379
8380                            var currentNode = _findNodeById(currentId, self.nodes);
8381
8382                            while (currentNode === null && toExpandParentItems.length > 0) {
8383                                // if we can't find it, try the next one until we find one or run out of expanded ids
8384                                currentId = toExpandParentItems.shift();
8385                                currentNode = _findNodeById(currentId, self.nodes);
8386                            }
8387
8388                            if (currentNode) {
8389                                // If we find the node, make sure it's expanded, and fetch its children
8390                                currentNode.isOpen = true;
8391
8392                                if (!self.options.universalItemPicker || !currentNode.children) {
8393                                    // Queue up current node
8394                                    inProgress[currentId] = currentId;
8395                                    getNodes(currentId, currentNode).done(function () {
8396                                        // Dequeue on completion
8397                                        delete inProgress[currentId];
8398                                        // And notify the Deferred of progress
8399                                        dfd.notify();
8400                                    });
8401                                }
8402                                else if (self.options.universalItemPicker && toExpandParentItems.length > 0 && currentNode.children) {
8403                                    self.events.trigger('nodes:dataBound', [currentNode]);
8404                                }
8405                            }
8406                        }
8407
8408                        // Next check for category nodes that need to be expanded (this is similar to parent items, but because
8409                        // categories may share overlapping id numbers with the items, they have different element ids which are
8410                        // prefixed with "C".
8411                        var currentCategoryId = toExpandCategories.shift(); // Pop the top item off the "stack" to de-queue it...
8412                        if (currentCategoryId) {
8413                            currentCategoryId = categoryPrefix + currentCategoryId;
8414
8415                            // remove surrounding single quotes from id if they exist
8416                            // Quotes should never get to this point. ItemPicker.cs: _hfInitialItemParentIds should be updated to not have quotes. Other places may also add quotes and should be updated
8417                            currentCategoryId = currentCategoryId.toString().replace(/(^')|('$)/g, '');
8418
8419                            var currentCategoryNode = _findNodeById(currentCategoryId, self.nodes);
8420                            while (currentCategoryNode === null && toExpandCategories.length > 0) {
8421                                // if we can't find it, try the next one until we find one or run out of expanded ids
8422                                currentCategoryId = categoryPrefix + toExpandCategories.shift();
8423                                currentCategoryNode = _findNodeById(currentCategoryId, self.nodes);
8424                            }
8425
8426                            if (currentCategoryNode) {
8427                                // If we find the node, make sure it's expanded, and fetch its children
8428                                currentCategoryNode.isOpen = true;
8429
8430                                // Queue up current node
8431                                inProgress[currentCategoryId] = currentCategoryId;
8432                                getNodes(currentCategoryId, currentCategoryNode).done(function () {
8433                                    // Dequeue on completion
8434                                    delete inProgress[currentCategoryId];
8435                                    // And notify the Deferred of progress
8436                                    dfd.notify();
8437                                });
8438                            }
8439                        }
8440                    });
8441                }
8442
8443                // When databound, check to see if fetching is complete
8444                this.events.on('nodes:dataBound', (event,parentNode) => {
8445                    onProgressNotification(parentNode);
8446                });
8447
8448                // Get initial node's data
8449                getNodes(id, startingNode);
8450
8451            } else if (this.options.local) {
8452                // Assuming there is local data defined, attempt to databind it
8453                try {
8454                    this.dataBind(this.options.local);
8455                    dfd.resolve();
8456                } catch (e) {
8457                    dfd.reject(e);
8458                }
8459            } else {
8460                // Otherwise attempt to databind on HTML of the current element
8461                this.nodes = _mapFromHtml(this.$el, this.options.mapping.include);
8462                dfd.resolve();
8463            }
8464
8465            return dfd.promise();
8466        },
8467
8468        fetchAllChildNodes: function (startingNode) {
8469            var self = this,
8470
8471                // Use a deferr to manage all of the fetch call backs
8472                dfd = $.Deferred(),
8473
8474                // Create a "queue" of all the fetches that are currently in progress
8475                inProgress = {},
8476
8477                // Handler function to determine whether or not all the fetch operations
8478                // have completed
8479                onProgressNotification = function () {
8480                    var numberInQueue = Object.keys(inProgress).length;
8481                    if (numberInQueue === 0 && dfd.state() !== 'resolved') {
8482                        dfd.resolve();
8483                    }
8484                },
8485
8486                // Function to get child nodes
8487                getChildren = function (parentNode) {
8488
8489                    // Expand the node
8490                    parentNode.isOpen = true;
8491
8492                    // Recursively load all the child nodes
8493                    startingNode.children.forEach(function (node) {
8494                        inProgress[node.id] = node.id;
8495                        self.fetchAllChildNodes(node).done(function () {
8496                            delete inProgress[node.id];
8497                            dfd.notify();
8498                        });
8499                    });
8500                };
8501
8502            // Pass progress of deferred to handler
8503            dfd.progress(onProgressNotification);
8504
8505            // If the selected node is valid and has children
8506            if (startingNode && startingNode.hasChildren) {
8507
8508                // If child nodes have been loaded, fetch each of their child nodes
8509                if (startingNode.children) {
8510                    getChildren(startingNode);
8511
8512                } else {
8513                    // Otherwise fetch the child nodes first and then fetch their child nodes
8514                    inProgress[startingNode.id] = startingNode.id;
8515                    self.fetch(startingNode.id).done(function () {
8516                        delete inProgress[startingNode.id];
8517                        getChildren(startingNode);
8518                    });
8519                }
8520            }
8521
8522            // Notify the deferred
8523            dfd.notify();
8524
8525            // Return the deferred promise
8526            return dfd.promise();
8527        },
8528
8529        getChildNodes: function (parentNode) {
8530            var self = this,
8531                nodes = [];
8532            if (parentNode && parentNode.hasChildren && parentNode.children) {
8533                parentNode.children.forEach(function (node) {
8534                    nodes.push(node);
8535                    self.getChildNodes(node).forEach(function (childNode) {
8536                        nodes.push(childNode);
8537                    });
8538                });
8539            }
8540
8541            return nodes;
8542        },
8543
8544        // Attempt to load data returned by `fetch` into the current rockTree's
8545        // node data structure
8546        dataBind: function (data, parentNode) {
8547            var nodeArray,
8548                i;
8549
8550            if (!data || typeof this.options.mapping.mapData !== 'function') {
8551                throw 'Unable to load data!';
8552            }
8553
8554            // Call configured `mapData` function. If it wasn't overridden by the user,
8555            // `_mapArrayDefault` will be called.
8556            nodeArray = this.options.mapping.mapData(data, this);
8557
8558            for (i = 0; i < nodeArray.length; i++) {
8559                nodeArray[i].isOpen = false;
8560            }
8561            // If a parent node is supplied, append the result set to the parent node.
8562            if (parentNode) {
8563                parentNode.children = nodeArray;
8564                // Otherwise the result set would be the root array.
8565            } else {
8566                this.nodes = nodeArray;
8567            }
8568
8569            // Trigger "internal" databound event and trigger "public" databound event
8570            // via the $el to notify the DOM
8571            this.events.trigger('nodes:dataBound', [parentNode]);
8572            this.$el.trigger('rockTree:dataBound', [parentNode]);
8573
8574            return nodeArray;
8575        },
8576
8577        // Recursively render out each node in the DOM via the `$el` property
8578        render: function () {
8579
8580            var self = this,
8581                $ul = $('<ul/>'),
8582                renderNode = function ($list, node, parentId) {
8583                    var hasChildren = false;
8584
8585                    if (node.hasChildren) {
8586
8587                        hasChildren = true;
8588
8589                        // we know it has children, but they might not be loaded yet (children === undefined)
8590                        // but if they are loaded there may actually be NO active children, so in that case,
8591                        // we'll consider them as NOT having children
8592                        if (node.children === undefined) {
8593                            hasChildren = true;
8594                        } else if (node.children !== undefined && node.children.length === 0) {
8595                            hasChildren = false;
8596                        }
8597                    }
8598
8599                    var $li = $('<li/>'),
8600                        $childUl,
8601                        includeAttrs = self.options.mapping.include,
8602                        folderCssClass = hasChildren ? (node.isOpen ? self.options.iconClasses.branchOpe
8602n : self.options.iconClasses.branchClosed) : "",
8603                        leafCssClass = node.iconCssClass || self.options.iconClasses.leaf;
8604
8605                    var isActive = (!node.hasOwnProperty('isActive') || node.isActive);
8606
8607                    $li.attr('id', 'node-item-' + Rock.utility.dashify(node.id));
8608
8609                    $li.addClass('rocktree-item')
8610                        .addClass(hasChildren ? 'rocktree-folder' : 'rocktree-leaf')
8611                        .addClass(isActive ? '' : 'is-inactive')
8612                        .attr('data-id', node.id);
8613
8614
8615                    if (parentId) {
8616                        $li.attr('data-parent-id', parentId);
8617                    }
8618                    else {
8619                        $li.attr('data-parent-id', node.parentId);
8620                    }
8621
8622                    // Include any configured custom data-* attributes to be decorated on the <li>
8623                    for (var i = 0; i < includeAttrs.length; i++) {
8624                        $li.attr('data-' + includeAttrs[i], node[includeAttrs[i]]);
8625                    }
8626
8627                    // ensure we only get Text for the tooltip
8628                    var tmp = document.createElement("DIV");
8629                    tmp.innerHTML = node.name;
8630                    var nodeText = tmp.textContent || tmp.innerText || "";
8631                    var titleText = self.escapeHtml(nodeText.trim());
8632
8633                    var countInfoHtml = '';
8634                    if (typeof (node.countInfo) !== 'undefined' && node.countInfo !== null) {
8635                        countInfoHtml = '<span class="label label-tree">' + node.countInfo + '</span>';
8636                    }
8637
8638                    $li.append('<span class="rocktree-name" title="' + titleText + '"> <span class="rocktree-node-name-text">' + node.name + '</span>' + countInfoHtml + '</span>');
8639                    var $rockTreeNameNode = $li.find('.rocktree-name');
8640
8641                    if ((!self.options.categorySelection && node.isCategory) || node.isSelectionDisabled) {
8642                        // Remove the hover event for the item since it is a category and we don't want to show it as being selectable.
8643                        $rockTreeNameNode.addClass('disabled');
8644                    }
8645
8646                    for (var i = 0; i < self.selectedNodes.length; i++) {
8647                        if (self.selectedNodes[i].id === node.id) {
8648                            $rockTreeNameNode.addClass('selected');
8649                            break;
8650                        }
8651                    }
8652
8653                    if (hasChildren) {
8654                        $li.prepend('<i class="rocktree-icon icon-fw ' + folderCssClass + '"></i>');
8655
8656                        if (node.iconCssClass) {
8657                            $rockTreeNameNode.prepend('<i class="icon-fw ' + node.iconCssClass + '"></i>');
8658                        }
8659
8660                        if (self.options.showSelectChildren && self.options.multiselect) {
8661                            $li.append('<i class="ti ti-chevrons-down icon-fw clickable select-children js-select-children" title="Select Children"></i>');
8662                        }
8663                    } else {
8664                        if (leafCssClass) {
8665                            $rockTreeNameNode.prepend('<i class="icon-fw ' + leafCssClass + '"></i>');
8666                        }
8667                    }
8668
8669                    $list.append($li);
8670
8671                    if (node.hasChildren && node.children) {
8672
8673                        $childUl = $('<ul/>');
8674                        $childUl.addClass('rocktree-children');
8675
8676                        if (!node.isOpen) {
8677                            $childUl.hide();
8678                        }
8679
8680                        $li.append($childUl);
8681
8682                        var l = node.children.length;
8683                        for (var i = 0; i < l; i++) {
8684                            renderNode($childUl, node.children[i], node.id);
8685                        }
8686                    }
8687
8688                    $('#node-item-' + Rock.utility.dashify(node.id)).attr('node-open', node.isOpen);
8689
8690                };
8691
8692            // Clear tree and prepare to re-render
8693            this.$el.empty();
8694            $ul.addClass('rocktree');
8695            this.$el.append($ul);
8696
8697            $.each(this.nodes, function (index, node) {
8698                renderNode($ul, node);
8699            });
8700
8701            this.$el.trigger('rockTree:rendered');
8702        },
8703
8704        escapeHtml: function (unencodedString) {
8705            // This method is based on he.js (https://github.com/mathiasbynens/he).
8706            var regexEscape = /["&'<>`]/g;
8707            var escapeMap = {
8708                '"': '&quot;',
8709                '&': '&amp;',
8710                '\'': '&#x27;',
8711                '<': '&lt;',
8712                '>': '&gt;',
8713                '`': '&#x60;'
8714            };
8715
8716            return unencodedString.replace(regexEscape, function ($0) {
8717                return escapeMap[$0];
8718            });
8719        },
8720
8721        // clear the error message
8722        clearError: function () {
8723            this.$el.siblings('.js-rocktree-alert').remove();
8724        },
8725
8726        // Render Bootstrap alert displaying the error message.
8727        renderError: function (msg) {
8728            this.clearError();
8729            this.discardLoading(this.$el);
8730            var $warning = $('<div class="alert alert-danger alert-dismissable js-rocktree-alert"/>');
8731            $warning.append('<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>')
8732                .append('<strong><i class="ti ti-alert-triangle"></i> Error </strong>')
8733                .append(msg);
8734            $warning.insertBefore(this.$el);
8735        },
8736
8737        // Show loading spinner
8738        showLoading: function ($element) {
8739            if (this.options.loadingHtml && this.options.loadingHtml.length > 0) {
8740                $element.append(this.options.loadingHtml);
8741            }
8742        },
8743
8744        // Remove loading spinner
8745        discardLoading: function ($element) {
8746            $element.find('.rocktree-loading').remove();
8747        },
8748
8749        // Clears all selected nodes
8750        clear: function () {
8751            this.selectedNodes = [];
8752            this.render();
8753        },
8754
8755        // Sets selected nodes given an array of ids
8756        setSelected: function (array) {
8757            this.selectedNodes = [];
8758
8759            var currentNode,
8760                i;
8761
8762            for (i = 0; i < array.length; i++) {
8763                currentNode = _findNodeById(array[i], this.nodes);
8764
8765                if (currentNode) {
8766                    this.selectedNodes.push(currentNode);
8767
8768                    // trigger the node as selected
8769                    this.$el.trigger('rockTree:selected', currentNode.id);
8770                }
8771            }
8772        },
8773
8774        // Wire up DOM events for rockTree instance
8775        initTreeEvents: function () {
8776            var self = this;
8777
8778            // remove event to make sure it doesn't get attached multiple times
8779            this.$el.off('click');
8780
8781            // Expanding or collapsing a node...
8782            this.$el.on('click', '.rocktree-folder > .rocktree-icon', function (e) {
8783                e.preventDefault();
8784                e.stopPropagation();
8785
8786                var $icon = $(this),
8787                    $ul = $icon.siblings('ul'),
8788                    id = $icon.parent('li').attr('data-id'),
8789                    node = _findNodeById(id, self.nodes),
8790                    openClass = self.options.iconClasses.branchOpen,
8791                    closedClass = self.options.iconClasses.branchClosed;
8792
8793                if (node.isOpen) {
8794                    $ul.hide();
8795                    node.isOpen = false;
8796                    $icon.removeClass(openClass).addClass(closedClass);
8797                    self.render();
8798                    self.$el.trigger('rockTree:collapse', { nodeId: id, type: 'collapse' });
8799                } else {
8800                    node.isOpen = true;
8801                    $icon.removeClass(closedClass).addClass(openClass);
8802                    // If the node has children, but they haven't been loaded yet,
8803                    // attempt to load them first, then re-render
8804                    if (node.hasChildren && !node.children) {
8805                        self.showLoading($icon.parent('li'));
8806                        self.fetch(node.id).done(function () {
8807                            self.render();
8808                            self.$el.trigger('rockTree:expand', { nodeId: id, type: 'expand' });
8809                        });
8810                    }
8811                    else {
8812                        $ul.show();
8813                        self.render();
8814                        self.$el.trigger('rockTree:expand', { nodeId: id, type: 'expand' });
8815                    }
8816                }
8817            });
8818
8819            // Selecting a node...
8820            this.$el.on('click', '.rocktree-item > span', function (e) {
8821                e.preventDefault();
8822                e.stopPropagation();
8823
8824                var $rockTree = $(this).parents('.rocktree'),
8825                    $item = $(this),
8826                    id = $item.parent('li').attr('data-id'),
8827                    node = _findNodeById(id, self.nodes),
8828                    selectedNodes = [],
8829                    onSelected = self.options.onSelected,
8830                    i;
8831
8832                // Selecting a category when one is not allowed should do n
8832othing.
8833                if ((!self.options.categorySelection && node.isCategory) || node.isSelectionDisabled) {
8834                    return;
8835                }
8836
8837                // If multi-select is disabled, clear all previous selections
8838                if (!self.options.multiselect) {
8839                    $rockTree.find('.selected').removeClass('selected');
8840                }
8841
8842                $item.toggleClass('selected');
8843
8844                // If the item exists under multiple tree branches, select/de-select all instances of the same item.
8845                var isSelected = $item.hasClass('selected');
8846                $rockTree.find('li[data-id="' + id + '"].rocktree-item > span').each(function (idx, span) {
8847                    $(span).removeClass('selected');
8848                    if (isSelected) {
8849                        $(span).addClass('selected');
8850                    }
8851                });
8852
8853                $rockTree.find('.selected').parent('li[data-id="' + id + '"]').removeClass('selected');
8854                $rockTree.find('.selected').parent('li').each(function (idx, li) {
8855                    var $li = $(li);
8856                    var nodeId = $li.attr('data-id');
8857
8858                    var foundNode = _findNodeById(nodeId, self.nodes);
8859                    selectedNodes.push({
8860                        id: nodeId,
8861                        // get the li text excluding child text
8862                        name: $li.contents(':not(ul)').text(),
8863                        path: foundNode ? foundNode.path : undefined
8864                    });
8865                });
8866
8867                self.selectedNodes = selectedNodes;
8868
8869                self.$el.trigger('rockTree:selected', id);
8870                self.$el.trigger('rockTree:itemClicked', id);
8871
8872                // If there is an array of other events to trigger on select,
8873                // loop through them and trigger each, passing along the
8874                // currently selected node's id
8875                if (!onSelected || typeof onSelected.length !== 'number') {
8876                    return;
8877                }
8878
8879                for (i = 0; i < onSelected.length; i++) {
8880                    $(document).trigger(onSelected[i], id);
8881                }
8882            });
8883
8884            // clicking on the 'select children' icon
8885            this.$el.on('click', '.js-select-children', function (e) {
8886                e.preventDefault();
8887                e.stopPropagation();
8888
8889                var $itemNode = $(this).parent('li'),
8890                    id = $itemNode.attr('data-id'),
8891                    node = _findNodeById(id, self.nodes);
8892
8893                // Show the loading icon, because likely some child nodes will need to be fetched
8894                self.showLoading($itemNode);
8895
8896                // Before selecting or unselecting all the children, make sure they've all been fetched.
8897                self.fetchAllChildNodes(node).done(function () {
8898
8899                    // Assume all child nodes are selected
8900                    var allChildNodesAlreadySelected = true;
8901
8902                    // Then check to see if any of the child nodes are not selected
8903                    var childNodes = self.getChildNodes(node);
8904                    for (var i = 0; i < childNodes.length; i++) {
8905                        var selected = false;
8906                        for (var j = 0; j < self.selectedNodes.length; j++) {
8907                            if (self.selectedNodes[j].id === childNodes[i].id) {
8908                                selected = true;
8909                                break;
8910                            }
8911                        }
8912                        if (!selected && !childNodes[i].isSelectionDisabled) {
8913                            allChildNodesAlreadySelected = false;
8914                            break;
8915                        }
8916                    }
8917
8918                    // Get a list of selected nodes that are not any of the child nodes
8919                    var newSelectedNodes = [];
8920                    for (var i = 0; i < self.selectedNodes.length; i++) {
8921                        var isAChildNode = false;
8922                        for (var j = 0; j < childNodes.length; j++) {
8923                            if (childNodes[j].id === self.selectedNodes[i].id) {
8924                                isAChildNode = true;
8925                                break;
8926                            }
8927                        }
8928                        if (!isAChildNode) {
8929                            newSelectedNodes.push(self.selectedNodes[i]);
8930                        }
8931                    }
8932
8933                    // If all the child nodes were not already selected, select all them
8934                    if (!allChildNodesAlreadySelected) {
8935                        for (var i = 0; i < childNodes.length; i++) {
8936                            if (!childNodes[i].isSelectionDisabled) {
8937                                newSelectedNodes.push(childNodes[i]);
8938                            }
8939                        }
8940                    }
8941
8942                    // Reset the list of selected nodes
8943                    self.selectedNodes = newSelectedNodes;
8944
8945                    self.$el.trigger('rockTree:selected');
8946
8947                    // Rerender the tree
8948                    self.render();
8949                });
8950
8951            });
8952        }
8953    };
8954
8955    // jQuery plugin definition
8956    $.fn.rockTree = function (options) {
8957        // Make a deep copy of all configuration settings passed in
8958        // and merge it with a deep copy of the defaults defined below
8959        var settings = $.extend(true, {}, $.fn.rockTree.defaults, options);
8960
8961        // For each element matching the selector, attempt to get an instance
8962        // of RockTree from $el.data, if not present, create a new instance
8963        // of RockTree and stash it there, then initialize the tree.
8964        return this.each(function () {
8965            var $el = $(this);
8966            var rockTree = $el.data('rockTree');
8967
8968            if (!rockTree) {
8969                // create a new rocktree
8970                rockTree = new RockTree(this, settings);
8971            }
8972            else {
8973                // use the existing rocktree but update the settings and clean up selectedNodes
8974                rockTree.options = settings;
8975                rockTree.selectedNodes = [];
8976            }
8977
8978            $el.data('rockTree', rockTree);
8979            rockTree.init();
8980        });
8981    };
8982
8983    // Default values to be merged upon initialization of the jQuery plugin
8984    $.fn.rockTree.defaults = {
8985        id: 0,
8986        selectedIds: null,
8987        expandedIds: null,
8988        expandedCategoryIds: null,
8989        restUrl: null,
8990        restParams: null,
8991        local: null,
8992        multiselect: false,
8993        categorySelection: true,
8994        categoryPrefix: '',
8995        showSelectChildren: false,
8996        loadingHtml: '<span class="rocktree-loading"><i class="ti ti-rotate-clockwise-2 ti-spin"></i></span>',
8997        iconClasses: {
8998            branchOpen: 'ti ti-fw ti-chevron-down',
8999            branchClosed: 'ti ti-fw ti-chevron-right',
9000            leaf: ''
9001        },
9002        mapping: {
9003            include: [],
9004            mapData: _mapArrayDefault
9005        },
9006        onSelected: [],
9007        universalItemPicker: false
9008    };
9009}(jQuery));
9010;
9011(function ($) {
9012
9013    $.fn.rockFadeIn = function () {
9014        this.css("display", "none");
9015        this.fadeIn(400);
9016    }
9017
9018}(jQuery));
9019
9020// Paul Irish's debounced resize event
9021(function (c, b) { var a = function (g, d, e) { var h; return function f() { var k = this, j = arguments; function i() { if (!e) { g.apply(k, j) } h = null } if (h) { clearTimeout(h) } else { if (e) { g.apply(k, j) } } h = setTimeout(i, d || 100) } }; jQuery.fn[b] = function (d) { return d ? this.bind("resize", a(d)) : this.trigger(b) } })(jQuery, "smartresize");
9022;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.